revyse 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/overlay.js CHANGED
@@ -1,14 +1,14 @@
1
- var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var Wi=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty;var gt=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(i){throw n=0,i}};var Bi=(e,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ui(n))!ji.call(e,r)&&r!==i&&nn(e,r,{get:()=>n[r],enumerable:!(t=Hi(n,r))||t.enumerable});return e};var rn=(e,n,i)=>(i=e!=null?Ii(Wi(e)):{},Bi(n||!e||!e.__esModule?nn(i,"default",{value:e,enumerable:!0}):i,e));var ii=gt($t=>{"use strict";(function(e){var n=/\S/,i=/\"/g,t=/\n/g,r=/\r/g,o=/\\/g,s=/\u2028/,d=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(y,_){var E=y.length,R=0,V=1,re=2,P=R,te=null,ae=null,K="",M=[],ne=!1,I=0,C=0,N="{{",k="}}";function le(){K.length>0&&(M.push({tag:"_t",text:new String(K)}),K="")}function Ve(){for(var J=!0,oe=C;oe<M.length;oe++)if(J=e.tags[M[oe].tag]<e.tags._v||M[oe].tag=="_t"&&M[oe].text.match(n)===null,!J)return!1;return J}function qe(J,oe){if(le(),J&&Ve())for(var ce=C,Ce;ce<M.length;ce++)M[ce].text&&((Ce=M[ce+1])&&Ce.tag==">"&&(Ce.indent=M[ce].text.toString()),M.splice(ce,1));else oe||M.push({tag:`
2
- `});ne=!1,C=M.length}function ke(J,oe){var ce="="+k,Ce=J.indexOf(ce,oe),ht=c(J.substring(J.indexOf("=",oe)+1,Ce)).split(" ");return N=ht[0],k=ht[ht.length-1],Ce+ce.length-1}for(_&&(_=_.split(" "),N=_[0],k=_[1]),I=0;I<E;I++)P==R?f(N,y,I)?(--I,le(),P=V):y.charAt(I)==`
3
- `?qe(ne):K+=y.charAt(I):P==V?(I+=N.length-1,ae=e.tags[y.charAt(I+1)],te=ae?y.charAt(I+1):"_v",te=="="?(I=ke(y,I),P=R):(ae&&I++,P=re),ne=I):f(k,y,I)?(M.push({tag:te,n:c(K),otag:N,ctag:k,i:te=="/"?ne-N.length:I+k.length}),K="",I+=k.length-1,P=R,te=="{"&&(k=="}}"?I++:p(M[M.length-1]))):K+=y.charAt(I);return qe(ne,!0),M};function p(v){v.n.substr(v.n.length-1)==="}"&&(v.n=v.n.substring(0,v.n.length-1))}function c(v){return v.trim?v.trim():v.replace(/^\s*|\s*$/g,"")}function f(v,y,_){if(y.charAt(_)!=v.charAt(0))return!1;for(var E=1,R=v.length;E<R;E++)if(y.charAt(_+E)!=v.charAt(E))return!1;return!0}var x={_t:!0,"\n":!0,$:!0,"/":!0};function l(v,y,_,E){var R=[],V=null,re=null,P=null;for(re=_[_.length-1];v.length>0;){if(P=v.shift(),re&&re.tag=="<"&&!(P.tag in x))throw new Error("Illegal content in < super tag.");if(e.tags[P.tag]<=e.tags.$||u(P,E))_.push(P),P.nodes=l(v,P.tag,_,E);else if(P.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+P.n);if(V=_.pop(),P.n!=V.n&&!b(P.n,V.n,E))throw new Error("Nesting error: "+V.n+" vs. "+P.n);return V.end=P.i,R}else P.tag==`
4
- `&&(P.last=v.length==0||v[0].tag==`
5
- `);R.push(P)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return R}function u(v,y){for(var _=0,E=y.length;_<E;_++)if(y[_].o==v.n)return v.tag="#",!0}function b(v,y,_){for(var E=0,R=_.length;E<R;E++)if(_[E].c==v&&_[E].o==y)return!0}function h(v){var y=[];for(var _ in v)y.push('"'+m(_)+'": function(c,p,t,i) {'+v[_]+"}");return"{ "+y.join(",")+" }"}function g(v){var y=[];for(var _ in v.partials)y.push('"'+m(_)+'":{name:"'+m(v.partials[_].name)+'", '+g(v.partials[_])+"}");return"partials: {"+y.join(",")+"}, subs: "+h(v.subs)}e.stringify=function(v,y,_){return"{code: function (c,p,i) { "+e.wrapMain(v.code)+" },"+g(v)+"}"};var w=0;e.generate=function(v,y,_){w=0;var E={code:"",subs:{},partials:{}};return e.walk(v,E),_.asString?this.stringify(E,y,_):this.makeTemplate(E,y,_)},e.wrapMain=function(v){return'var t=this;t.b(i=i||"");'+v+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(v,y,_){var E=this.makePartials(v);return E.code=new Function("c","p","i",this.wrapMain(v.code)),new this.template(E,y,this,_)},e.makePartials=function(v){var y,_={subs:{},partials:v.partials,name:v.name};for(y in _.partials)_.partials[y]=this.makePartials(_.partials[y]);for(y in v.subs)_.subs[y]=new Function("c","p","t","i",v.subs[y]);return _};function m(v){return v.replace(o,"\\\\").replace(i,'\\"').replace(t,"\\n").replace(r,"\\r").replace(s,"\\u2028").replace(d,"\\u2029")}function S(v){return~v.indexOf(".")?"d":"f"}function A(v,y){var _="<"+(y.prefix||""),E=_+v.n+w++;return y.partials[E]={name:v.n,partials:{}},y.code+='t.b(t.rp("'+m(E)+'",c,p,"'+(v.indent||"")+'"));',E}e.codegen={"#":function(v,y){y.code+="if(t.s(t."+S(v.n)+'("'+m(v.n)+'",c,p,1),c,p,0,'+v.i+","+v.end+',"'+v.otag+" "+v.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(v.nodes,y),y.code+="});c.pop();}"},"^":function(v,y){y.code+="if(!t.s(t."+S(v.n)+'("'+m(v.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(v.nodes,y),y.code+="};"},">":A,"<":function(v,y){var _={partials:{},code:"",subs:{},inPartial:!0};e.walk(v.nodes,_);var E=y.partials[A(v,y)];E.subs=_.subs,E.partials=_.partials},$:function(v,y){var _={subs:{},code:"",partials:y.partials,prefix:v.n};e.walk(v.nodes,_),y.subs[v.n]=_.code,y.inPartial||(y.code+='t.sub("'+m(v.n)+'",c,p,i);')},"\n":function(v,y){y.code+=L('"\\n"'+(v.last?"":" + i"))},_v:function(v,y){y.code+="t.b(t.v(t."+S(v.n)+'("'+m(v.n)+'",c,p,0)));'},_t:function(v,y){y.code+=L('"'+m(v.text)+'"')},"{":F,"&":F};function F(v,y){y.code+="t.b(t.t(t."+S(v.n)+'("'+m(v.n)+'",c,p,0)));'}function L(v){return"t.b("+v+");"}e.walk=function(v,y){for(var _,E=0,R=v.length;E<R;E++)_=e.codegen[v[E].tag],_&&_(v[E],y);return y},e.parse=function(v,y,_){return _=_||{},l(v,"",[],_.sectionTags||[])},e.cache={},e.cacheKey=function(v,y){return[v,!!y.asString,!!y.disableLambda,y.delimiters,!!y.modelGet].join("||")},e.compile=function(v,y){y=y||{};var _=e.cacheKey(v,y),E=this.cache[_];if(E){var R=E.partials;for(var V in R)delete R[V].instance;return E}return E=this.generate(this.parse(this.scan(v,y.delimiters),v,y),v,y),this.cache[_]=E}})(typeof $t<"u"?$t:Hogan)});var ri=gt(Vt=>{"use strict";var Fr={};(function(e){e.Template=function(l,u,b,h){l=l||{},this.r=l.code||this.r,this.c=b,this.options=h||{},this.text=u||"",this.partials=l.partials||{},this.subs=l.subs||{},this.buf=""},e.Template.prototype={r:function(l,u,b){return""},v:f,t:c,render:function(u,b,h){return this.ri([u],b||{},h)},ri:function(l,u,b){return this.r(l,u,b)},ep:function(l,u){var b=this.partials[l],h=u[b.name];if(b.instance&&b.base==h)return b.instance;if(typeof h=="string"){if(!this.c)throw new Error("No compiler available.");h=this.c.compile(h,this.options)}if(!h)return null;if(this.partials[l].base=h,b.subs){u.stackText||(u.stackText={});for(key in b.subs)u.stackText[key]||(u.stackText[key]=this.activeSub!==void 0&&u.stackText[this.activeSub]?u.stackText[this.activeSub]:this.text);h=i(h,b.subs,b.partials,this.stackSubs,this.stackPartials,u.stackText)}return this.partials[l].instance=h,h},rp:function(l,u,b,h){var g=this.ep(l,b);return g?g.ri(u,b,h):""},rs:function(l,u,b){var h=l[l.length-1];if(!x(h)){b(l,u,this);return}for(var g=0;g<h.length;g++)l.push(h[g]),b(l,u,this),l.pop()},s:function(l,u,b,h,g,w,m){var S;return x(l)&&l.length===0?!1:(typeof l=="function"&&(l=this.ms(l,u,b,h,g,w,m)),S=!!l,!h&&S&&u&&u.push(typeof l=="object"?l:u[u.length-1]),S)},d:function(l,u,b,h){var g,w=l.split("."),m=this.f(w[0],u,b,h),S=this.options.modelGet,A=null;if(l==="."&&x(u[u.length-2]))m=u[u.length-1];else for(var F=1;F<w.length;F++)g=n(w[F],m,S),g!==void 0?(A=m,m=g):m="";return h&&!m?!1:(!h&&typeof m=="function"&&(u.push(A),m=this.mv(m,u,b),u.pop()),m)},f:function(l,u,b,h){for(var g=!1,w=null,m=!1,S=this.options.modelGet,A=u.length-1;A>=0;A--)if(w=u[A],g=n(l,w,S),g!==void 0){m=!0;break}return m?(!h&&typeof g=="function"&&(g=this.mv(g,u,b)),g):h?!1:""},ls:function(l,u,b,h,g,w){var m=this.options.delimiters;return this.options.delimiters=w,this.b(this.ct(c(l.call(u,g,b)),u,h)),this.options.delimiters=m,!1},ct:function(l,u,b){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(l,this.options).render(u,b)},b:function(l){this.buf+=l},fl:function(){var l=this.buf;return this.buf="",l},ms:function(l,u,b,h,g,w,m){var S,A=u[u.length-1],F=l.call(A);return typeof F=="function"?h?!0:(S=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(F,A,u,b,S.substring(g,w),m)):F},mv:function(l,u,b){var h=u[u.length-1],g=l.call(h);return typeof g=="function"?this.ct(c(g.call(h)),h,b):g},sub:function(l,u,b,h){var g=this.subs[l];g&&(this.activeSub=l,g(u,b,this,h),this.activeSub=!1)}};function n(l,u,b){var h;return u&&typeof u=="object"&&(u[l]!==void 0?h=u[l]:b&&u.get&&typeof u.get=="function"&&(h=u.get(l))),h}function i(l,u,b,h,g,w){function m(){}m.prototype=l;function S(){}S.prototype=l.subs;var A,F=new m;F.subs=new S,F.subsText={},F.buf="",h=h||{},F.stackSubs=h,F.subsText=w;for(A in u)h[A]||(h[A]=u[A]);for(A in h)F.subs[A]=h[A];g=g||{},F.stackPartials=g;for(A in b)g[A]||(g[A]=b[A]);for(A in g)F.partials[A]=g[A];return F}var t=/&/g,r=/</g,o=/>/g,s=/\'/g,d=/\"/g,p=/[&<>\"\']/;function c(l){return String(l??"")}function f(l){return l=c(l),p.test(l)?l.replace(t,"&amp;").replace(r,"&lt;").replace(o,"&gt;").replace(s,"&#39;").replace(d,"&quot;"):l}var x=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"}})(typeof Vt<"u"?Vt:Fr)});var qt=gt((Yo,oi)=>{"use strict";var pt=ii();pt.Template=ri().Template;pt.template=pt.Template;oi.exports=pt});var an={unauthorized:4401,handshakeTimeout:4408,badMessage:4400},G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),T=e=>typeof e=="string",on=e=>typeof e=="number"&&Number.isFinite(e),Ie=e=>Number.isInteger(e),Se=e=>typeof e=="boolean",U=e=>n=>n===void 0||e(n),q=e=>n=>Array.isArray(n)&&n.every(e),Y=e=>n=>T(n)&&e.includes(n),zi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ie=e=>T(e)&&zi.test(e);function ln(e){return G(e)&&e.type==="welcome"&&e.protocol===1&&T(e.agentVersion)&&G(e.project)&&T(e.project.framework)&&T(e.project.root)}function cn(e){return!G(e)||e.type!=="response"||!T(e.id)||!Se(e.ok)||e.error!==void 0&&(!G(e.error)||!T(e.error.code)||!T(e.error.message))?null:e}function dn(e){return!G(e)||e.type!=="event"||!T(e.event)?null:e}var un=["typecheck","lint","test","build","browser","visual"],pn=["passed","failed","skipped","not_run","running"],fn=["draft","planning","awaiting_clarification","applying","verifying","preview_ready","awaiting_approval","approved","released","rejected","failed","cancelled"],$i=["starting","planning","patching","applying","checking","reporting","reverting","accepting"],Vi=["replan","revise","revert","reload","login"],qi=["changed_since_plan","changed_while_applying","changed_since_apply"],Gi=e=>G(e)&&Y(["proceed","clarify","out_of_scope"])(e.decision)&&T(e.summary)&&q(n=>G(n)&&T(n.description)&&q(T)(n.files))(e.steps)&&U(T)(e.clarifyingQuestion)&&U(T)(e.outOfScopeReason)&&U(q(T))(e.notDoing)&&U(q(T))(e.envVars)&&U(q(T))(e.sensitive),Xi=e=>G(e)&&Y(un)(e.kind)&&Y(pn)(e.status)&&U(T)(e.command)&&U(T)(e.reason)&&U(Se)(e.preExisting)&&(e.baseline===void 0||Y(["passed","failed"])(e.baseline))&&(e.evidence===void 0||G(e.evidence)&&U(Ie)(e.evidence.exitCode)&&U(T)(e.evidence.summary)&&U(q(T))(e.evidence.artifactKeys))&&(e.durationMs===void 0||Ie(e.durationMs)&&e.durationMs>=0);function hn(e){return!G(e)||!T(e.type)?null:(()=>{switch(e.type){case"planning":case"reverted":case"accepted":case"cancelled":return ie(e.changeId)&&(e.type!=="reverted"||q(T)(e.files));case"plan":return ie(e.changeId)&&Gi(e.plan)&&T(e.model)&&(e.cost===void 0||on(e.cost)&&e.cost>=0);case"clarification":return ie(e.changeId)&&T(e.question)&&(e.integration===void 0||G(e.integration)&&T(e.integration.capability)&&q(T)(e.integration.providers)&&T(e.integration.reason)&&U(T)(e.integration.connectUrl));case"applying":return ie(e.changeId)&&Ie(e.files);case"checking":return ie(e.changeId)&&q(i=>G(i)&&Y(un)(i.kind)&&Y(pn)(i.status))(e.checks);case"result":return ie(e.changeId)&&Y(fn)(e.state)&&q(i=>G(i)&&T(i.path)&&Ie(i.additions)&&Ie(i.deletions)&&U(T)(i.explanation)&&U(Y(["create","modify","delete"]))(i.kind))(e.files)&&T(e.diff)&&q(Xi)(e.checks)&&(e.cost===void 0||on(e.cost)&&e.cost>=0)&&U(T)(e.summary)&&U(q(T))(e.envVars)&&U(q(T))(e.notDone)&&U(q(T))(e.sensitive);case"activity":return ie(e.changeId)&&Y(["plan","apply"])(e.phase)&&T(e.tool)&&T(e.text);case"conflict":return ie(e.changeId)&&q(T)(e.files)&&Y(qi)(e.reason)&&T(e.message);case"failed":return U(ie)(e.changeId)&&T(e.code)&&T(e.message)&&Se(e.retryable)&&(e.stage===void 0||Y($i)(e.stage))&&U(Se)(e.filesChanged)&&(e.next===void 0||q(Y(Vi))(e.next));case"permission_denied":return U(ie)(e.changeId)&&T(e.message);default:return!1}})()?e:null}function gn(e){if(!G(e)||!T(e.defaultModel))return null;let n=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0;return q(t=>G(t)&&T(t.id)&&Y(["anthropic","openai","google"])(t.provider)&&T(t.label)&&T(t.description)&&n(t.creditWeight)&&t.creditWeight>0&&n(t.typicalCredits)&&Se(t.allowed)&&Se(t.available))(e.models)?e:null}var Yi=["queued","building","ready","error","canceled"],mt=e=>{if(!T(e))return!1;try{return new URL(e),!0}catch{return!1}},sn=e=>n=>n===null||e(n);function mn(e){if(!G(e))return null;let n=e.preview;return ie(e.changeId)&&Y(fn)(e.state)&&mt(e.changeUrl)&&sn(mt)(e.pullRequestUrl)&&(n===null||G(n)&&Y(Yi)(n.status)&&sn(mt)(n.url))?e:null}var et,D,_n,Ki,pe,bn,wn,kn,bt,Xe,He,Cn,xt,vt,yt,Ji,Je={},Qe=[],Qi=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tt=Array.isArray;function de(e,n){for(var i in n)e[i]=n[i];return e}function _t(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Zi(e,n,i){var t,r,o,s={};for(o in n)o=="key"?t=n[o]:o=="ref"?r=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?et.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return Ye(e,s,t,r,null)}function Ye(e,n,i,t,r){var o={type:e,props:n,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++_n,__i:-1,__u:0};return r==null&&D.vnode!=null&&D.vnode(o),o}function Q(e){return e.children}function Ke(e,n){this.props=e,this.context=n}function ve(e,n){if(n==null)return e.__?ve(e.__,e.__i+1):null;for(var i;n<e.__k.length;n++)if((i=e.__k[n])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?ve(e):null}function er(e){if(e.__P&&e.__d){var n=e.__v,i=n.__e,t=[],r=[],o=de({},n);o.__v=n.__v+1,D.vnode&&D.vnode(o),wt(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,t,i??ve(n),!!(32&n.__u),r),o.__v=n.__v,o.__.__k[o.__i]=o,Fn(t,o,r),n.__e=n.__=null,o.__e!=i&&Sn(o)}}function Sn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Sn(e)}function vn(e){(!e.__d&&(e.__d=!0)&&pe.push(e)&&!Ze.__r++||bn!=D.debounceRendering)&&((bn=D.debounceRendering)||wn)(Ze)}function Ze(){try{for(var e,n=1;pe.length;)pe.length>n&&pe.sort(kn),e=pe.shift(),n=pe.length,er(e)}finally{pe.length=Ze.__r=0}}function En(e,n,i,t,r,o,s,d,p,c,f){var x,l,u,b,h,g,w=t&&t.__k||Qe,m=n.length;for(p=tr(i,n,w,p,m),x=0;x<m;x++)(u=i.__k[x])!=null&&(l=u.__i!=-1&&w[u.__i]||Je,u.__i=x,g=wt(e,u,l,r,o,s,d,p,c,f),b=u.__e,u.ref&&l.ref!=u.ref&&(l.ref&&kt(l.ref,null,u),f.push(u.ref,u.__c||b,u)),h==null&&b!=null&&(h=b),4&u.__u?(p=An(u,p,e),l.__e&&(l.__e=null)):typeof u.type=="function"&&g!==void 0?p=g:b&&(p=b.nextSibling),u.__u&=-7);return i.__e=h,p}function tr(e,n,i,t,r){var o,s,d,p,c,f=i.length,x=f,l=0;for(e.__k=new Array(r),o=0;o<r;o++)(s=n[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[o]=Ye(null,s,null,null,null):tt(s)?s=e.__k[o]=Ye(Q,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=Ye(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,p=o+l,s.__=e,s.__b=e.__b+1,d=null,(c=s.__i=nr(s,i,p,x))!=-1&&(x--,(d=i[c])&&(d.__u|=2)),d==null||d.__v==null?(c==-1&&(r>f?l--:r<f&&l++),typeof s.type!="function"&&(s.__u|=4)):c!=p&&(c==p-1?l--:c==p+1?l++:(c>p?l--:l++,s.__u|=4))):e.__k[o]=null;if(x)for(o=0;o<f;o++)(d=i[o])!=null&&(2&d.__u)==0&&(d.__e==t&&(t=ve(d)),Nn(d,d));return t}function An(e,n,i){var t,r;if(typeof e.type=="function"){for(t=e.__k,r=0;t&&r<t.length;r++)t[r]&&(t[r].__=e,n=An(t[r],n,i));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=ve(e)),n=i.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function nr(e,n,i,t){var r,o,s,d=e.key,p=e.type,c=n[i],f=c!=null&&(2&c.__u)==0;if(c===null&&d==null||f&&d==c.key&&p==c.type)return i;if(t>(f?1:0)){for(r=i-1,o=i+1;r>=0||o<n.length;)if((c=n[s=r>=0?r--:o++])!=null&&(2&c.__u)==0&&d==c.key&&p==c.type)return s}return-1}function yn(e,n,i){n[0]=="-"?e.setProperty(n,i??""):e[n]=i==null?"":typeof i!="number"||Qi.test(n)?i:i+"px"}function Ge(e,n,i,t,r){var o,s;e:if(n=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof t=="string"&&(e.style.cssText=t=""),t)for(n in t)i&&n in i||yn(e.style,n,"");if(i)for(n in i)t&&i[n]==t[n]||yn(e.style,n,i[n])}else if(n[0]=="o"&&n[1]=="n")o=n!=(n=n.replace(Cn,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+o]=i,i?t?i[He]=t[He]:(i[He]=xt,e.addEventListener(n,o?yt:vt,o)):e.removeEventListener(n,o?yt:vt,o);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&i==1?"":i))}}function xn(e){return function(n){if(this.l){var i=this.l[n.type+e];if(n[Xe]==null)n[Xe]=xt++;else if(n[Xe]<i[He])return;return i(D.event?D.event(n):n)}}}function wt(e,n,i,t,r,o,s,d,p,c){var f,x,l,u,b,h,g,w,m,S,A,F,L,v,y,_,E=n.type;if(n.constructor!==void 0)return null;128&i.__u&&(p=!!(32&i.__u),o=[d=n.__e=i.__e]),(f=D.__b)&&f(n);e:if(typeof E=="function"){x=s.length;try{if(m=n.props,S=E.prototype&&E.prototype.render,A=(f=E.contextType)&&t[f.__c],F=f?A?A.props.value:f.__:t,i.__c?w=(l=n.__c=i.__c).__=l.__E:(S?n.__c=l=new E(m,F):(n.__c=l=new Ke(m,F),l.constructor=E,l.render=rr),A&&A.sub(l),l.state||(l.state={}),l.__n=t,u=l.__d=!0,l.__h=[],l._sb=[]),S&&l.__s==null&&(l.__s=l.state),S&&E.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=de({},l.__s)),de(l.__s,E.getDerivedStateFromProps(m,l.__s))),b=l.props,h=l.state,l.__v=n,u)S&&E.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),S&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(S&&E.getDerivedStateFromProps==null&&m!==b&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(m,F),n.__v==i.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(m,l.__s,F)===!1){n.__v!=i.__v&&(l.props=m,l.state=l.__s,l.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(R){R&&(R.__=n)}),Qe.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l),d=ve(i);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(m,l.__s,F),S&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(b,h,g)})}if(l.context=F,l.props=m,l.__P=e,l.__e=!1,L=D.__r,v=0,S)l.state=l.__s,l.__d=!1,L&&L(n),f=l.render(l.props,l.state,l.context),Qe.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,L&&L(n),f=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++v<25);l.state=l.__s,l.getChildContext!=null&&(t=de(de({},t),l.getChildContext())),S&&!u&&l.getSnapshotBeforeUpdate!=null&&(g=l.getSnapshotBeforeUpdate(b,h)),y=f!=null&&f.type===Q&&f.key==null?Ln(f.props.children):f,d=En(e,tt(y)?y:[y],n,i,t,r,o,s,d,p,c),l.base=n.__e,n.__u&=-161,l.__h.length&&s.push(l),w&&(l.__E=l.__=null)}catch(R){if(s.length=x,n.__v=null,p||o!=null){if(R.then){for(n.__u|=p?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;o!=null&&(o[o.indexOf(d)]=null),n.__e=d}else if(o!=null)for(_=o.length;_--;)_t(o[_])}else n.__e=i.__e;n.__k==null&&(n.__k=i.__k||[]),R.then||Tn(n),D.__e(R,n,i)}}else o==null&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):d=n.__e=ir(i.__e,n,i,t,r,o,s,p,c);return(f=D.diffed)&&f(n),128&n.__u?void 0:d}function Tn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Tn))}function Fn(e,n,i){for(var t=0;t<i.length;t++)kt(i[t],i[++t],i[++t]);D.__c&&D.__c(n,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){D.__e(o,r.__v)}})}function Ln(e){return typeof e!="object"||e==null||e.__b>0?e:tt(e)?e.map(Ln):e.constructor!==void 0?null:de({},e)}function ir(e,n,i,t,r,o,s,d,p){var c,f,x,l,u,b,h,g=i.props||Je,w=n.props,m=n.type;if(m=="svg"?r="http://www.w3.org/2000/svg":m=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((u=o[c])&&"setAttribute"in u==!!m&&(m?u.localName==m:u.nodeType==3)){e=u,o[c]=null;break}}if(e==null){if(m==null)return document.createTextNode(w);e=document.createElementNS(r,m,w.is&&w),d&&(D.__m&&D.__m(n,o),d=!1),o=null}if(m==null)g===w||d&&e.data==w||(e.data=w);else{if(o=m=="textarea"&&w.defaultValue!=null?null:o&&et.call(e.childNodes),!d&&o!=null)for(g={},c=0;c<e.attributes.length;c++)g[(u=e.attributes[c]).name]=u.value;for(c in g)u=g[c],c=="dangerouslySetInnerHTML"?x=u:c=="children"||c in w||c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w||Ge(e,c,null,u,r);for(c in w)u=w[c],c=="children"?l=u:c=="dangerouslySetInnerHTML"?f=u:c=="value"?b=u:c=="checked"?h=u:d&&typeof u!="function"||g[c]===u||Ge(e,c,u,g[c],r);if(f)d||x&&(f.__html==x.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),n.__k=[];else if(x&&(e.innerHTML=""),En(n.type=="template"?e.content:e,tt(l)?l:[l],n,i,t,m=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,s,o?o[0]:i.__k&&ve(i,0),d,p),o!=null)for(c=o.length;c--;)_t(o[c]);d&&m!="textarea"||(c="value",m=="progress"&&b==null?e.removeAttribute("value"):b!=null&&(b!==e[c]||m=="progress"&&!b||m=="option"&&b!=g[c])&&Ge(e,c,b,g[c],r),c="checked",h!=null&&h!=e[c]&&Ge(e,c,h,g[c],r))}return e}function kt(e,n,i){try{if(typeof e=="function"){var t=typeof e.__u=="function";t&&e.__u(),t&&n==null||(e.__u=e(n))}else e.current=n}catch(r){D.__e(r,i)}}function Nn(e,n,i){var t,r;if(D.unmount&&D.unmount(e),(t=e.ref)&&(t.current&&t.current!=e.__e||kt(t,null,n)),(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(o){D.__e(o,n)}t.base=t.__P=t.__n=null}if(t=e.__k)for(r=0;r<t.length;r++)t[r]&&Nn(t[r],n,i||typeof e.type!="function");i||_t(e.__e),e.__c=e.__=e.__e=void 0}function rr(e,n,i){return this.constructor(e,i)}function Ct(e,n,i){var t,r,o,s;n==document&&(n=document.documentElement),D.__&&D.__(e,n),r=(t=typeof i=="function")?null:i&&i.__k||n.__k,o=[],s=[],wt(n,e=(!t&&i||n).__k=Zi(Q,null,[e]),r||Je,Je,n.namespaceURI,!t&&i?[i]:r?null:n.firstChild?et.call(n.childNodes):null,o,!t&&i?i:r?r.__e:n.firstChild,t,s),Fn(o,e,s),e.props.children=null}et=Qe.slice,D={__e:function(e,n,i,t){for(var r,o,s;n=n.__;)if((r=n.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,t||{}),s=r.__d),s)return r.__E=r}catch(d){e=d}throw e}},_n=0,Ki=function(e){return e!=null&&e.constructor===void 0},Ke.prototype.setState=function(e,n){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=de({},this.state),typeof e=="function"&&(e=e(de({},i),this.props)),e&&de(i,e),e!=null&&this.__v&&(n&&this._sb.push(n),vn(this))},Ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),vn(this))},Ke.prototype.render=Q,pe=[],wn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kn=function(e,n){return e.__v.__b-n.__v.__b},Ze.__r=0,bt=Math.random().toString(8),Xe="__d"+bt,He="__a"+bt,Cn=/(PointerCapture)$|Capture$/i,xt=0,vt=xn(!1),yt=xn(!0),Ji=0;var Ee,H,St,Pn,it=0,Wn=[],W=D,Rn=W.__b,Dn=W.__r,On=W.diffed,Mn=W.__c,In=W.unmount,Hn=W.__;function rt(e,n){W.__h&&W.__h(H,e,it||n),it=0;var i=H.__H||(H.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function $(e){return it=1,or(jn,e)}function or(e,n,i){var t=rt(Ee++,2);if(t.t=e,!t.__c&&(t.__=[i?i(n):jn(void 0,n),function(d){var p=t.__N?t.__N[0]:t.__[0],c=t.t(p,d);p!==c&&(t.__N=[c,t.__[1]],t.__c.setState({}))}],t.__c=H,!H.__f)){var r=function(d,p,c){if(!t.__c.__H)return!0;var f=!1,x=t.__c.props!==d;if(t.__c.__H.__.some(function(u){if(u.__N){f=!0;var b=u.__[0];u.__=u.__N,u.__N=void 0,b!==u.__[0]&&(x=!0)}}),o){var l=o.call(this,d,p,c);return f?l||x:l}return!f||x};H.__f=!0;var o=H.shouldComponentUpdate,s=H.componentWillUpdate;H.componentWillUpdate=function(d,p,c){if(this.__e){var f=o;o=void 0,r(d,p,c),o=f}s&&s.call(this,d,p,c)},H.shouldComponentUpdate=r}return t.__N||t.__}function Ae(e,n){var i=rt(Ee++,3);!W.__s&&Tt(i.__H,n)&&(i.__=e,i.u=n,H.__H.__h.push(i))}function ue(e,n){var i=rt(Ee++,4);!W.__s&&Tt(i.__H,n)&&(i.__=e,i.u=n,H.__h.push(i))}function Z(e){return it=5,At(function(){return{current:e}},[])}function At(e,n){var i=rt(Ee++,7);return Tt(i.__H,n)&&(i.__=e(),i.__H=n,i.__h=e),i.__}function sr(){for(var e;e=Wn.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(nt),n.__h.some(Et),n.__h=[]}catch(i){n.__h=[],W.__e(i,e.__v)}}}W.__b=function(e){H=null,Rn&&Rn(e)},W.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Hn&&Hn(e,n)},W.__r=function(e){Dn&&Dn(e),Ee=0;var n=(H=e.__c).__H;n&&(St===H?(n.__h=[],H.__h=[],n.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(n.__h.some(nt),n.__h.some(Et),n.__h=[],Ee=0)),St=H},W.diffed=function(e){On&&On(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Wn.push(n)!==1&&Pn===W.requestAnimationFrame||((Pn=W.requestAnimationFrame)||ar)(sr)),n.__H.__.some(function(i){i.u&&(i.__H=i.u,i.u=void 0)})),St=H=null},W.__c=function(e,n){n.some(function(i){try{i.__h.some(nt),i.__h=i.__h.filter(function(t){return!t.__||Et(t)})}catch(t){n.some(function(r){r.__h&&(r.__h=[])}),n=[],W.__e(t,i.__v)}}),Mn&&Mn(e,n)},W.unmount=function(e){In&&In(e);var n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(t){try{nt(t)}catch(r){n=r}}),i.__H=void 0,n&&W.__e(n,i.__v))};var Un=typeof requestAnimationFrame=="function";function ar(e){var n,i=function(){clearTimeout(t),Un&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(i,35);Un&&(n=requestAnimationFrame(i))}function nt(e){var n=H,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),H=n}function Et(e){var n=H;e.__c=e.__(),H=n}function Tt(e,n){return!e||e.length!==n.length||n.some(function(i,t){return i!==e[t]})}function jn(e,n){return typeof n=="function"?n(e):n}var O;(function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"})(O||(O={}));var Bn={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},zn={LINES:"lines",WORDS:"words",NONE:"none"},$n={WORD:"word",CHAR:"char"},ye;(function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"})(ye||(ye={}));var lr=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],cr=RegExp("["+lr.join("\\")+"]","g");function Vn(e){return e.replace(cr,"\\$&")}function Ft(e){return e&&e.replace(/\\/g,"/")}function qn(e){let n,i,t,r=0;for(n=0,t=e.length;n<t;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}function ot(e){let n=e.length,i=-1/0;for(let t=0;t<n;t++)i=Math.max(i,e[t]);return i}function Gn(e,n){let i=e.split(".");return i.length>1?i[i.length-1]:n}function Xn(e,n){return n.reduce((i,t)=>i||e.startsWith(t),!1)}var Yn=["a/","b/","i/","w/","c/","o/"];function fe(e,n,i){let t=i!==void 0?[...Yn,i]:Yn,r=n?new RegExp(`^${Vn(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=r.exec(e)||[],s=t.find(p=>o.indexOf(p)===0);return(s?o.slice(s.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function dr(e,n){return fe(e,"---",n)}function ur(e,n){return fe(e,"+++",n)}function Kn(e,n={}){let i=[],t=null,r=null,o=null,s=null,d=null,p=null,c=null,f="--- ",x="+++ ",l="@@",u=/^old mode (\d{6})/,b=/^new mode (\d{6})/,h=/^deleted file mode (\d{6})/,g=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,m=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,A=/^rename to "?(.+)"?/,F=/^similarity index (\d+)%/,L=/^dissimilarity index (\d+)%/,v=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,y=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,E=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,R=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,V=/^new file mode (\d{6})/,re=/^deleted file mode (\d{6}),(\d{6})/,P=e.replace(/\/g,"").replace(/\r\n?/g,`
1
+ var Ui=Object.create;var nn=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty;var mt=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(i){throw n=0,i}};var $i=(e,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ji(n))!zi.call(e,r)&&r!==i&&nn(e,r,{get:()=>n[r],enumerable:!(t=Wi(n,r))||t.enumerable});return e};var rn=(e,n,i)=>(i=e!=null?Ui(Bi(e)):{},$i(n||!e||!e.__esModule?nn(i,"default",{value:e,enumerable:!0}):i,e));var ii=mt(Vt=>{"use strict";(function(e){var n=/\S/,i=/\"/g,t=/\n/g,r=/\r/g,o=/\\/g,s=/\u2028/,c=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(y,k){var A=y.length,R=0,z=1,re=2,P=R,te=null,ae=null,J="",O=[],ne=!1,I=0,S=0,N="{{",C="}}";function le(){J.length>0&&(O.push({tag:"_t",text:new String(J)}),J="")}function qe(){for(var Q=!0,oe=S;oe<O.length;oe++)if(Q=e.tags[O[oe].tag]<e.tags._v||O[oe].tag=="_t"&&O[oe].text.match(n)===null,!Q)return!1;return Q}function Ge(Q,oe){if(le(),Q&&qe())for(var ce=S,Se;ce<O.length;ce++)O[ce].text&&((Se=O[ce+1])&&Se.tag==">"&&(Se.indent=O[ce].text.toString()),O.splice(ce,1));else oe||O.push({tag:`
2
+ `});ne=!1,S=O.length}function Ce(Q,oe){var ce="="+C,Se=Q.indexOf(ce,oe),gt=d(Q.substring(Q.indexOf("=",oe)+1,Se)).split(" ");return N=gt[0],C=gt[gt.length-1],Se+ce.length-1}for(k&&(k=k.split(" "),N=k[0],C=k[1]),I=0;I<A;I++)P==R?h(N,y,I)?(--I,le(),P=z):y.charAt(I)==`
3
+ `?Ge(ne):J+=y.charAt(I):P==z?(I+=N.length-1,ae=e.tags[y.charAt(I+1)],te=ae?y.charAt(I+1):"_v",te=="="?(I=Ce(y,I),P=R):(ae&&I++,P=re),ne=I):h(C,y,I)?(O.push({tag:te,n:d(J),otag:N,ctag:C,i:te=="/"?ne-N.length:I+C.length}),J="",I+=C.length-1,P=R,te=="{"&&(C=="}}"?I++:p(O[O.length-1]))):J+=y.charAt(I);return Ge(ne,!0),O};function p(m){m.n.substr(m.n.length-1)==="}"&&(m.n=m.n.substring(0,m.n.length-1))}function d(m){return m.trim?m.trim():m.replace(/^\s*|\s*$/g,"")}function h(m,y,k){if(y.charAt(k)!=m.charAt(0))return!1;for(var A=1,R=m.length;A<R;A++)if(y.charAt(k+A)!=m.charAt(A))return!1;return!0}var x={_t:!0,"\n":!0,$:!0,"/":!0};function l(m,y,k,A){var R=[],z=null,re=null,P=null;for(re=k[k.length-1];m.length>0;){if(P=m.shift(),re&&re.tag=="<"&&!(P.tag in x))throw new Error("Illegal content in < super tag.");if(e.tags[P.tag]<=e.tags.$||u(P,A))k.push(P),P.nodes=l(m,P.tag,k,A);else if(P.tag=="/"){if(k.length===0)throw new Error("Closing tag without opener: /"+P.n);if(z=k.pop(),P.n!=z.n&&!g(P.n,z.n,A))throw new Error("Nesting error: "+z.n+" vs. "+P.n);return z.end=P.i,R}else P.tag==`
4
+ `&&(P.last=m.length==0||m[0].tag==`
5
+ `);R.push(P)}if(k.length>0)throw new Error("missing closing tag: "+k.pop().n);return R}function u(m,y){for(var k=0,A=y.length;k<A;k++)if(y[k].o==m.n)return m.tag="#",!0}function g(m,y,k){for(var A=0,R=k.length;A<R;A++)if(k[A].c==m&&k[A].o==y)return!0}function f(m){var y=[];for(var k in m)y.push('"'+v(k)+'": function(c,p,t,i) {'+m[k]+"}");return"{ "+y.join(",")+" }"}function b(m){var y=[];for(var k in m.partials)y.push('"'+v(k)+'":{name:"'+v(m.partials[k].name)+'", '+b(m.partials[k])+"}");return"partials: {"+y.join(",")+"}, subs: "+f(m.subs)}e.stringify=function(m,y,k){return"{code: function (c,p,i) { "+e.wrapMain(m.code)+" },"+b(m)+"}"};var w=0;e.generate=function(m,y,k){w=0;var A={code:"",subs:{},partials:{}};return e.walk(m,A),k.asString?this.stringify(A,y,k):this.makeTemplate(A,y,k)},e.wrapMain=function(m){return'var t=this;t.b(i=i||"");'+m+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(m,y,k){var A=this.makePartials(m);return A.code=new Function("c","p","i",this.wrapMain(m.code)),new this.template(A,y,this,k)},e.makePartials=function(m){var y,k={subs:{},partials:m.partials,name:m.name};for(y in k.partials)k.partials[y]=this.makePartials(k.partials[y]);for(y in m.subs)k.subs[y]=new Function("c","p","t","i",m.subs[y]);return k};function v(m){return m.replace(o,"\\\\").replace(i,'\\"').replace(t,"\\n").replace(r,"\\r").replace(s,"\\u2028").replace(c,"\\u2029")}function _(m){return~m.indexOf(".")?"d":"f"}function E(m,y){var k="<"+(y.prefix||""),A=k+m.n+w++;return y.partials[A]={name:m.n,partials:{}},y.code+='t.b(t.rp("'+v(A)+'",c,p,"'+(m.indent||"")+'"));',A}e.codegen={"#":function(m,y){y.code+="if(t.s(t."+_(m.n)+'("'+v(m.n)+'",c,p,1),c,p,0,'+m.i+","+m.end+',"'+m.otag+" "+m.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(m.nodes,y),y.code+="});c.pop();}"},"^":function(m,y){y.code+="if(!t.s(t."+_(m.n)+'("'+v(m.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(m.nodes,y),y.code+="};"},">":E,"<":function(m,y){var k={partials:{},code:"",subs:{},inPartial:!0};e.walk(m.nodes,k);var A=y.partials[E(m,y)];A.subs=k.subs,A.partials=k.partials},$:function(m,y){var k={subs:{},code:"",partials:y.partials,prefix:m.n};e.walk(m.nodes,k),y.subs[m.n]=k.code,y.inPartial||(y.code+='t.sub("'+v(m.n)+'",c,p,i);')},"\n":function(m,y){y.code+=L('"\\n"'+(m.last?"":" + i"))},_v:function(m,y){y.code+="t.b(t.v(t."+_(m.n)+'("'+v(m.n)+'",c,p,0)));'},_t:function(m,y){y.code+=L('"'+v(m.text)+'"')},"{":T,"&":T};function T(m,y){y.code+="t.b(t.t(t."+_(m.n)+'("'+v(m.n)+'",c,p,0)));'}function L(m){return"t.b("+m+");"}e.walk=function(m,y){for(var k,A=0,R=m.length;A<R;A++)k=e.codegen[m[A].tag],k&&k(m[A],y);return y},e.parse=function(m,y,k){return k=k||{},l(m,"",[],k.sectionTags||[])},e.cache={},e.cacheKey=function(m,y){return[m,!!y.asString,!!y.disableLambda,y.delimiters,!!y.modelGet].join("||")},e.compile=function(m,y){y=y||{};var k=e.cacheKey(m,y),A=this.cache[k];if(A){var R=A.partials;for(var z in R)delete R[z].instance;return A}return A=this.generate(this.parse(this.scan(m,y.delimiters),m,y),m,y),this.cache[k]=A}})(typeof Vt<"u"?Vt:Hogan)});var ri=mt(qt=>{"use strict";var Nr={};(function(e){e.Template=function(l,u,g,f){l=l||{},this.r=l.code||this.r,this.c=g,this.options=f||{},this.text=u||"",this.partials=l.partials||{},this.subs=l.subs||{},this.buf=""},e.Template.prototype={r:function(l,u,g){return""},v:h,t:d,render:function(u,g,f){return this.ri([u],g||{},f)},ri:function(l,u,g){return this.r(l,u,g)},ep:function(l,u){var g=this.partials[l],f=u[g.name];if(g.instance&&g.base==f)return g.instance;if(typeof f=="string"){if(!this.c)throw new Error("No compiler available.");f=this.c.compile(f,this.options)}if(!f)return null;if(this.partials[l].base=f,g.subs){u.stackText||(u.stackText={});for(key in g.subs)u.stackText[key]||(u.stackText[key]=this.activeSub!==void 0&&u.stackText[this.activeSub]?u.stackText[this.activeSub]:this.text);f=i(f,g.subs,g.partials,this.stackSubs,this.stackPartials,u.stackText)}return this.partials[l].instance=f,f},rp:function(l,u,g,f){var b=this.ep(l,g);return b?b.ri(u,g,f):""},rs:function(l,u,g){var f=l[l.length-1];if(!x(f)){g(l,u,this);return}for(var b=0;b<f.length;b++)l.push(f[b]),g(l,u,this),l.pop()},s:function(l,u,g,f,b,w,v){var _;return x(l)&&l.length===0?!1:(typeof l=="function"&&(l=this.ms(l,u,g,f,b,w,v)),_=!!l,!f&&_&&u&&u.push(typeof l=="object"?l:u[u.length-1]),_)},d:function(l,u,g,f){var b,w=l.split("."),v=this.f(w[0],u,g,f),_=this.options.modelGet,E=null;if(l==="."&&x(u[u.length-2]))v=u[u.length-1];else for(var T=1;T<w.length;T++)b=n(w[T],v,_),b!==void 0?(E=v,v=b):v="";return f&&!v?!1:(!f&&typeof v=="function"&&(u.push(E),v=this.mv(v,u,g),u.pop()),v)},f:function(l,u,g,f){for(var b=!1,w=null,v=!1,_=this.options.modelGet,E=u.length-1;E>=0;E--)if(w=u[E],b=n(l,w,_),b!==void 0){v=!0;break}return v?(!f&&typeof b=="function"&&(b=this.mv(b,u,g)),b):f?!1:""},ls:function(l,u,g,f,b,w){var v=this.options.delimiters;return this.options.delimiters=w,this.b(this.ct(d(l.call(u,b,g)),u,f)),this.options.delimiters=v,!1},ct:function(l,u,g){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(l,this.options).render(u,g)},b:function(l){this.buf+=l},fl:function(){var l=this.buf;return this.buf="",l},ms:function(l,u,g,f,b,w,v){var _,E=u[u.length-1],T=l.call(E);return typeof T=="function"?f?!0:(_=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(T,E,u,g,_.substring(b,w),v)):T},mv:function(l,u,g){var f=u[u.length-1],b=l.call(f);return typeof b=="function"?this.ct(d(b.call(f)),f,g):b},sub:function(l,u,g,f){var b=this.subs[l];b&&(this.activeSub=l,b(u,g,this,f),this.activeSub=!1)}};function n(l,u,g){var f;return u&&typeof u=="object"&&(u[l]!==void 0?f=u[l]:g&&u.get&&typeof u.get=="function"&&(f=u.get(l))),f}function i(l,u,g,f,b,w){function v(){}v.prototype=l;function _(){}_.prototype=l.subs;var E,T=new v;T.subs=new _,T.subsText={},T.buf="",f=f||{},T.stackSubs=f,T.subsText=w;for(E in u)f[E]||(f[E]=u[E]);for(E in f)T.subs[E]=f[E];b=b||{},T.stackPartials=b;for(E in g)b[E]||(b[E]=g[E]);for(E in b)T.partials[E]=b[E];return T}var t=/&/g,r=/</g,o=/>/g,s=/\'/g,c=/\"/g,p=/[&<>\"\']/;function d(l){return String(l??"")}function h(l){return l=d(l),p.test(l)?l.replace(t,"&amp;").replace(r,"&lt;").replace(o,"&gt;").replace(s,"&#39;").replace(c,"&quot;"):l}var x=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"}})(typeof qt<"u"?qt:Nr)});var Gt=mt((Qo,oi)=>{"use strict";var ft=ii();ft.Template=ri().Template;ft.template=ft.Template;oi.exports=ft});var an={unauthorized:4401,handshakeTimeout:4408,badMessage:4400},G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),F=e=>typeof e=="string",on=e=>typeof e=="number"&&Number.isFinite(e),Ie=e=>Number.isInteger(e),Ee=e=>typeof e=="boolean",U=e=>n=>n===void 0||e(n),q=e=>n=>Array.isArray(n)&&n.every(e),Y=e=>n=>F(n)&&e.includes(n),Vi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ie=e=>F(e)&&Vi.test(e);function ln(e){return G(e)&&e.type==="welcome"&&e.protocol===1&&F(e.agentVersion)&&G(e.project)&&F(e.project.framework)&&F(e.project.root)}function cn(e){return!G(e)||e.type!=="response"||!F(e.id)||!Ee(e.ok)||e.error!==void 0&&(!G(e.error)||!F(e.error.code)||!F(e.error.message))?null:e}function dn(e){return!G(e)||e.type!=="event"||!F(e.event)?null:e}var un=["typecheck","lint","test","build","browser","visual"],pn=["passed","failed","skipped","not_run","running"],fn=["draft","planning","awaiting_clarification","applying","verifying","preview_ready","awaiting_approval","approved","released","rejected","failed","cancelled"],qi=["starting","planning","patching","applying","checking","reporting","reverting","accepting"],Gi=["replan","revise","revert","reload","login"],Xi=["changed_since_plan","changed_while_applying","changed_since_apply"],Yi=e=>G(e)&&Y(["proceed","clarify","out_of_scope"])(e.decision)&&F(e.summary)&&q(n=>G(n)&&F(n.description)&&q(F)(n.files))(e.steps)&&U(F)(e.clarifyingQuestion)&&U(F)(e.outOfScopeReason)&&U(q(F))(e.notDoing)&&U(q(F))(e.envVars)&&U(q(F))(e.sensitive),Ki=e=>G(e)&&Y(un)(e.kind)&&Y(pn)(e.status)&&U(F)(e.command)&&U(F)(e.reason)&&U(Ee)(e.preExisting)&&(e.baseline===void 0||Y(["passed","failed"])(e.baseline))&&(e.evidence===void 0||G(e.evidence)&&U(Ie)(e.evidence.exitCode)&&U(F)(e.evidence.summary)&&U(q(F))(e.evidence.artifactKeys))&&(e.durationMs===void 0||Ie(e.durationMs)&&e.durationMs>=0);function hn(e){return!G(e)||!F(e.type)?null:(()=>{switch(e.type){case"planning":case"reverted":case"accepted":case"cancelled":return ie(e.changeId)&&(e.type!=="reverted"||q(F)(e.files));case"plan":return ie(e.changeId)&&Yi(e.plan)&&F(e.model)&&(e.cost===void 0||on(e.cost)&&e.cost>=0);case"clarification":return ie(e.changeId)&&F(e.question)&&(e.integration===void 0||G(e.integration)&&F(e.integration.capability)&&q(F)(e.integration.providers)&&F(e.integration.reason)&&U(F)(e.integration.connectUrl));case"applying":return ie(e.changeId)&&Ie(e.files);case"checking":return ie(e.changeId)&&q(i=>G(i)&&Y(un)(i.kind)&&Y(pn)(i.status))(e.checks);case"result":return ie(e.changeId)&&Y(fn)(e.state)&&q(i=>G(i)&&F(i.path)&&Ie(i.additions)&&Ie(i.deletions)&&U(F)(i.explanation)&&U(Y(["create","modify","delete"]))(i.kind))(e.files)&&F(e.diff)&&q(Ki)(e.checks)&&(e.cost===void 0||on(e.cost)&&e.cost>=0)&&U(F)(e.summary)&&U(q(F))(e.envVars)&&U(q(F))(e.notDone)&&U(q(F))(e.sensitive);case"activity":return ie(e.changeId)&&Y(["plan","apply"])(e.phase)&&F(e.tool)&&F(e.text);case"conflict":return ie(e.changeId)&&q(F)(e.files)&&Y(Xi)(e.reason)&&F(e.message);case"failed":return U(ie)(e.changeId)&&F(e.code)&&F(e.message)&&Ee(e.retryable)&&(e.stage===void 0||Y(qi)(e.stage))&&U(Ee)(e.filesChanged)&&(e.next===void 0||q(Y(Gi))(e.next));case"permission_denied":return U(ie)(e.changeId)&&F(e.message);default:return!1}})()?e:null}function gn(e){if(!G(e)||!F(e.defaultModel))return null;let n=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0;return q(t=>G(t)&&F(t.id)&&Y(["anthropic","openai","google"])(t.provider)&&F(t.label)&&F(t.description)&&n(t.creditWeight)&&t.creditWeight>0&&n(t.typicalCredits)&&Ee(t.allowed)&&Ee(t.available))(e.models)?e:null}var Ji=["queued","building","ready","error","canceled"],bt=e=>{if(!F(e))return!1;try{return new URL(e),!0}catch{return!1}},sn=e=>n=>n===null||e(n);function mn(e){if(!G(e))return null;let n=e.preview;return ie(e.changeId)&&Y(fn)(e.state)&&bt(e.changeUrl)&&sn(bt)(e.pullRequestUrl)&&(n===null||G(n)&&Y(Ji)(n.status)&&sn(bt)(n.url))?e:null}var tt,D,_n,Qi,pe,bn,wn,kn,vt,Ye,He,Cn,_t,yt,xt,Zi,Qe={},Ze=[],er=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,nt=Array.isArray;function de(e,n){for(var i in n)e[i]=n[i];return e}function wt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function tr(e,n,i){var t,r,o,s={};for(o in n)o=="key"?t=n[o]:o=="ref"?r=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?tt.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return Ke(e,s,t,r,null)}function Ke(e,n,i,t,r){var o={type:e,props:n,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++_n,__i:-1,__u:0};return r==null&&D.vnode!=null&&D.vnode(o),o}function K(e){return e.children}function Je(e,n){this.props=e,this.context=n}function ve(e,n){if(n==null)return e.__?ve(e.__,e.__i+1):null;for(var i;n<e.__k.length;n++)if((i=e.__k[n])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?ve(e):null}function nr(e){if(e.__P&&e.__d){var n=e.__v,i=n.__e,t=[],r=[],o=de({},n);o.__v=n.__v+1,D.vnode&&D.vnode(o),kt(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,t,i??ve(n),!!(32&n.__u),r),o.__v=n.__v,o.__.__k[o.__i]=o,Fn(t,o,r),n.__e=n.__=null,o.__e!=i&&Sn(o)}}function Sn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Sn(e)}function vn(e){(!e.__d&&(e.__d=!0)&&pe.push(e)&&!et.__r++||bn!=D.debounceRendering)&&((bn=D.debounceRendering)||wn)(et)}function et(){try{for(var e,n=1;pe.length;)pe.length>n&&pe.sort(kn),e=pe.shift(),n=pe.length,nr(e)}finally{pe.length=et.__r=0}}function En(e,n,i,t,r,o,s,c,p,d,h){var x,l,u,g,f,b,w=t&&t.__k||Ze,v=n.length;for(p=ir(i,n,w,p,v),x=0;x<v;x++)(u=i.__k[x])!=null&&(l=u.__i!=-1&&w[u.__i]||Qe,u.__i=x,b=kt(e,u,l,r,o,s,c,p,d,h),g=u.__e,u.ref&&l.ref!=u.ref&&(l.ref&&Ct(l.ref,null,u),h.push(u.ref,u.__c||g,u)),f==null&&g!=null&&(f=g),4&u.__u?(p=An(u,p,e),l.__e&&(l.__e=null)):typeof u.type=="function"&&b!==void 0?p=b:g&&(p=g.nextSibling),u.__u&=-7);return i.__e=f,p}function ir(e,n,i,t,r){var o,s,c,p,d,h=i.length,x=h,l=0;for(e.__k=new Array(r),o=0;o<r;o++)(s=n[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[o]=Ke(null,s,null,null,null):nt(s)?s=e.__k[o]=Ke(K,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=Ke(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,p=o+l,s.__=e,s.__b=e.__b+1,c=null,(d=s.__i=rr(s,i,p,x))!=-1&&(x--,(c=i[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(r>h?l--:r<h&&l++),typeof s.type!="function"&&(s.__u|=4)):d!=p&&(d==p-1?l--:d==p+1?l++:(d>p?l--:l++,s.__u|=4))):e.__k[o]=null;if(x)for(o=0;o<h;o++)(c=i[o])!=null&&(2&c.__u)==0&&(c.__e==t&&(t=ve(c)),Nn(c,c));return t}function An(e,n,i){var t,r;if(typeof e.type=="function"){for(t=e.__k,r=0;t&&r<t.length;r++)t[r]&&(t[r].__=e,n=An(t[r],n,i));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=ve(e)),n=i.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function rr(e,n,i,t){var r,o,s,c=e.key,p=e.type,d=n[i],h=d!=null&&(2&d.__u)==0;if(d===null&&c==null||h&&c==d.key&&p==d.type)return i;if(t>(h?1:0)){for(r=i-1,o=i+1;r>=0||o<n.length;)if((d=n[s=r>=0?r--:o++])!=null&&(2&d.__u)==0&&c==d.key&&p==d.type)return s}return-1}function yn(e,n,i){n[0]=="-"?e.setProperty(n,i??""):e[n]=i==null?"":typeof i!="number"||er.test(n)?i:i+"px"}function Xe(e,n,i,t,r){var o,s;e:if(n=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof t=="string"&&(e.style.cssText=t=""),t)for(n in t)i&&n in i||yn(e.style,n,"");if(i)for(n in i)t&&i[n]==t[n]||yn(e.style,n,i[n])}else if(n[0]=="o"&&n[1]=="n")o=n!=(n=n.replace(Cn,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+o]=i,i?t?i[He]=t[He]:(i[He]=_t,e.addEventListener(n,o?xt:yt,o)):e.removeEventListener(n,o?xt:yt,o);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&i==1?"":i))}}function xn(e){return function(n){if(this.l){var i=this.l[n.type+e];if(n[Ye]==null)n[Ye]=_t++;else if(n[Ye]<i[He])return;return i(D.event?D.event(n):n)}}}function kt(e,n,i,t,r,o,s,c,p,d){var h,x,l,u,g,f,b,w,v,_,E,T,L,m,y,k,A=n.type;if(n.constructor!==void 0)return null;128&i.__u&&(p=!!(32&i.__u),o=[c=n.__e=i.__e]),(h=D.__b)&&h(n);e:if(typeof A=="function"){x=s.length;try{if(v=n.props,_=A.prototype&&A.prototype.render,E=(h=A.contextType)&&t[h.__c],T=h?E?E.props.value:h.__:t,i.__c?w=(l=n.__c=i.__c).__=l.__E:(_?n.__c=l=new A(v,T):(n.__c=l=new Je(v,T),l.constructor=A,l.render=sr),E&&E.sub(l),l.state||(l.state={}),l.__n=t,u=l.__d=!0,l.__h=[],l._sb=[]),_&&l.__s==null&&(l.__s=l.state),_&&A.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=de({},l.__s)),de(l.__s,A.getDerivedStateFromProps(v,l.__s))),g=l.props,f=l.state,l.__v=n,u)_&&A.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),_&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(_&&A.getDerivedStateFromProps==null&&v!==g&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(v,T),n.__v==i.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(v,l.__s,T)===!1){n.__v!=i.__v&&(l.props=v,l.state=l.__s,l.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(R){R&&(R.__=n)}),Ze.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l),c=ve(i);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(v,l.__s,T),_&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(g,f,b)})}if(l.context=T,l.props=v,l.__P=e,l.__e=!1,L=D.__r,m=0,_)l.state=l.__s,l.__d=!1,L&&L(n),h=l.render(l.props,l.state,l.context),Ze.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,L&&L(n),h=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++m<25);l.state=l.__s,l.getChildContext!=null&&(t=de(de({},t),l.getChildContext())),_&&!u&&l.getSnapshotBeforeUpdate!=null&&(b=l.getSnapshotBeforeUpdate(g,f)),y=h!=null&&h.type===K&&h.key==null?Ln(h.props.children):h,c=En(e,nt(y)?y:[y],n,i,t,r,o,s,c,p,d),l.base=n.__e,n.__u&=-161,l.__h.length&&s.push(l),w&&(l.__E=l.__=null)}catch(R){if(s.length=x,n.__v=null,p||o!=null){if(R.then){for(n.__u|=p?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(k=o.length;k--;)wt(o[k])}else n.__e=i.__e;n.__k==null&&(n.__k=i.__k||[]),R.then||Tn(n),D.__e(R,n,i)}}else o==null&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):c=n.__e=or(i.__e,n,i,t,r,o,s,p,d);return(h=D.diffed)&&h(n),128&n.__u?void 0:c}function Tn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Tn))}function Fn(e,n,i){for(var t=0;t<i.length;t++)Ct(i[t],i[++t],i[++t]);D.__c&&D.__c(n,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){D.__e(o,r.__v)}})}function Ln(e){return typeof e!="object"||e==null||e.__b>0?e:nt(e)?e.map(Ln):e.constructor!==void 0?null:de({},e)}function or(e,n,i,t,r,o,s,c,p){var d,h,x,l,u,g,f,b=i.props||Qe,w=n.props,v=n.type;if(v=="svg"?r="http://www.w3.org/2000/svg":v=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(d=0;d<o.length;d++)if((u=o[d])&&"setAttribute"in u==!!v&&(v?u.localName==v:u.nodeType==3)){e=u,o[d]=null;break}}if(e==null){if(v==null)return document.createTextNode(w);e=document.createElementNS(r,v,w.is&&w),c&&(D.__m&&D.__m(n,o),c=!1),o=null}if(v==null)b===w||c&&e.data==w||(e.data=w);else{if(o=v=="textarea"&&w.defaultValue!=null?null:o&&tt.call(e.childNodes),!c&&o!=null)for(b={},d=0;d<e.attributes.length;d++)b[(u=e.attributes[d]).name]=u.value;for(d in b)u=b[d],d=="dangerouslySetInnerHTML"?x=u:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||Xe(e,d,null,u,r);for(d in w)u=w[d],d=="children"?l=u:d=="dangerouslySetInnerHTML"?h=u:d=="value"?g=u:d=="checked"?f=u:c&&typeof u!="function"||b[d]===u||Xe(e,d,u,b[d],r);if(h)c||x&&(h.__html==x.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(x&&(e.innerHTML=""),En(n.type=="template"?e.content:e,nt(l)?l:[l],n,i,t,v=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,s,o?o[0]:i.__k&&ve(i,0),c,p),o!=null)for(d=o.length;d--;)wt(o[d]);c&&v!="textarea"||(d="value",v=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||v=="progress"&&!g||v=="option"&&g!=b[d])&&Xe(e,d,g,b[d],r),d="checked",f!=null&&f!=e[d]&&Xe(e,d,f,b[d],r))}return e}function Ct(e,n,i){try{if(typeof e=="function"){var t=typeof e.__u=="function";t&&e.__u(),t&&n==null||(e.__u=e(n))}else e.current=n}catch(r){D.__e(r,i)}}function Nn(e,n,i){var t,r;if(D.unmount&&D.unmount(e),(t=e.ref)&&(t.current&&t.current!=e.__e||Ct(t,null,n)),(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(o){D.__e(o,n)}t.base=t.__P=t.__n=null}if(t=e.__k)for(r=0;r<t.length;r++)t[r]&&Nn(t[r],n,i||typeof e.type!="function");i||wt(e.__e),e.__c=e.__=e.__e=void 0}function sr(e,n,i){return this.constructor(e,i)}function St(e,n,i){var t,r,o,s;n==document&&(n=document.documentElement),D.__&&D.__(e,n),r=(t=typeof i=="function")?null:i&&i.__k||n.__k,o=[],s=[],kt(n,e=(!t&&i||n).__k=tr(K,null,[e]),r||Qe,Qe,n.namespaceURI,!t&&i?[i]:r?null:n.firstChild?tt.call(n.childNodes):null,o,!t&&i?i:r?r.__e:n.firstChild,t,s),Fn(o,e,s),e.props.children=null}tt=Ze.slice,D={__e:function(e,n,i,t){for(var r,o,s;n=n.__;)if((r=n.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,t||{}),s=r.__d),s)return r.__E=r}catch(c){e=c}throw e}},_n=0,Qi=function(e){return e!=null&&e.constructor===void 0},Je.prototype.setState=function(e,n){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=de({},this.state),typeof e=="function"&&(e=e(de({},i),this.props)),e&&de(i,e),e!=null&&this.__v&&(n&&this._sb.push(n),vn(this))},Je.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),vn(this))},Je.prototype.render=K,pe=[],wn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kn=function(e,n){return e.__v.__b-n.__v.__b},et.__r=0,vt=Math.random().toString(8),Ye="__d"+vt,He="__a"+vt,Cn=/(PointerCapture)$|Capture$/i,_t=0,yt=xn(!1),xt=xn(!0),Zi=0;var Ae,H,Et,Pn,rt=0,Wn=[],W=D,Rn=W.__b,Dn=W.__r,Mn=W.diffed,On=W.__c,In=W.unmount,Hn=W.__;function ot(e,n){W.__h&&W.__h(H,e,rt||n),rt=0;var i=H.__H||(H.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function $(e){return rt=1,ar(jn,e)}function ar(e,n,i){var t=ot(Ae++,2);if(t.t=e,!t.__c&&(t.__=[i?i(n):jn(void 0,n),function(c){var p=t.__N?t.__N[0]:t.__[0],d=t.t(p,c);p!==d&&(t.__N=[d,t.__[1]],t.__c.setState({}))}],t.__c=H,!H.__f)){var r=function(c,p,d){if(!t.__c.__H)return!0;var h=!1,x=t.__c.props!==c;if(t.__c.__H.__.some(function(u){if(u.__N){h=!0;var g=u.__[0];u.__=u.__N,u.__N=void 0,g!==u.__[0]&&(x=!0)}}),o){var l=o.call(this,c,p,d);return h?l||x:l}return!h||x};H.__f=!0;var o=H.shouldComponentUpdate,s=H.componentWillUpdate;H.componentWillUpdate=function(c,p,d){if(this.__e){var h=o;o=void 0,r(c,p,d),o=h}s&&s.call(this,c,p,d)},H.shouldComponentUpdate=r}return t.__N||t.__}function ye(e,n){var i=ot(Ae++,3);!W.__s&&Ft(i.__H,n)&&(i.__=e,i.u=n,H.__H.__h.push(i))}function ue(e,n){var i=ot(Ae++,4);!W.__s&&Ft(i.__H,n)&&(i.__=e,i.u=n,H.__h.push(i))}function Z(e){return rt=5,Tt(function(){return{current:e}},[])}function Tt(e,n){var i=ot(Ae++,7);return Ft(i.__H,n)&&(i.__=e(),i.__H=n,i.__h=e),i.__}function lr(){for(var e;e=Wn.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(it),n.__h.some(At),n.__h=[]}catch(i){n.__h=[],W.__e(i,e.__v)}}}W.__b=function(e){H=null,Rn&&Rn(e)},W.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Hn&&Hn(e,n)},W.__r=function(e){Dn&&Dn(e),Ae=0;var n=(H=e.__c).__H;n&&(Et===H?(n.__h=[],H.__h=[],n.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(n.__h.some(it),n.__h.some(At),n.__h=[],Ae=0)),Et=H},W.diffed=function(e){Mn&&Mn(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Wn.push(n)!==1&&Pn===W.requestAnimationFrame||((Pn=W.requestAnimationFrame)||cr)(lr)),n.__H.__.some(function(i){i.u&&(i.__H=i.u,i.u=void 0)})),Et=H=null},W.__c=function(e,n){n.some(function(i){try{i.__h.some(it),i.__h=i.__h.filter(function(t){return!t.__||At(t)})}catch(t){n.some(function(r){r.__h&&(r.__h=[])}),n=[],W.__e(t,i.__v)}}),On&&On(e,n)},W.unmount=function(e){In&&In(e);var n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(t){try{it(t)}catch(r){n=r}}),i.__H=void 0,n&&W.__e(n,i.__v))};var Un=typeof requestAnimationFrame=="function";function cr(e){var n,i=function(){clearTimeout(t),Un&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(i,35);Un&&(n=requestAnimationFrame(i))}function it(e){var n=H,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),H=n}function At(e){var n=H;e.__c=e.__(),H=n}function Ft(e,n){return!e||e.length!==n.length||n.some(function(i,t){return i!==e[t]})}function jn(e,n){return typeof n=="function"?n(e):n}var M;(function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"})(M||(M={}));var Bn={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},zn={LINES:"lines",WORDS:"words",NONE:"none"},$n={WORD:"word",CHAR:"char"},xe;(function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"})(xe||(xe={}));var dr=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],ur=RegExp("["+dr.join("\\")+"]","g");function Vn(e){return e.replace(ur,"\\$&")}function Lt(e){return e&&e.replace(/\\/g,"/")}function qn(e){let n,i,t,r=0;for(n=0,t=e.length;n<t;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}function st(e){let n=e.length,i=-1/0;for(let t=0;t<n;t++)i=Math.max(i,e[t]);return i}function Gn(e,n){let i=e.split(".");return i.length>1?i[i.length-1]:n}function Xn(e,n){return n.reduce((i,t)=>i||e.startsWith(t),!1)}var Yn=["a/","b/","i/","w/","c/","o/"];function fe(e,n,i){let t=i!==void 0?[...Yn,i]:Yn,r=n?new RegExp(`^${Vn(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=r.exec(e)||[],s=t.find(p=>o.indexOf(p)===0);return(s?o.slice(s.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function pr(e,n){return fe(e,"---",n)}function fr(e,n){return fe(e,"+++",n)}function Kn(e,n={}){let i=[],t=null,r=null,o=null,s=null,c=null,p=null,d=null,h="--- ",x="+++ ",l="@@",u=/^old mode (\d{6})/,g=/^new mode (\d{6})/,f=/^deleted file mode (\d{6})/,b=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,v=/^copy to "?(.+)"?/,_=/^rename from "?(.+)"?/,E=/^rename to "?(.+)"?/,T=/^similarity index (\d+)%/,L=/^dissimilarity index (\d+)%/,m=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,y=/^Binary files (.*) and (.*) differ/,k=/^GIT binary patch/,A=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,R=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,z=/^new file mode (\d{6})/,re=/^deleted file mode (\d{6}),(\d{6})/,P=e.replace(/\/g,"").replace(/\r\n?/g,`
6
6
  `).split(`
7
- `);function te(){r!==null&&t!==null&&(t.blocks.push(r),r=null)}function ae(){t!==null&&(!t.oldName&&p!==null&&(t.oldName=p),!t.newName&&c!==null&&(t.newName=c),t.newName&&(i.push(t),t=null)),p=null,c=null}function K(){te(),ae(),t={blocks:[],deletedLines:0,addedLines:0}}function M(C){te();let N;t!==null&&((N=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(C))?(t.isCombined=!1,o=parseInt(N[1],10),d=parseInt(N[2],10)):(N=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(C))?(t.isCombined=!0,o=parseInt(N[1],10),s=parseInt(N[2],10),d=parseInt(N[3],10)):(C.startsWith(l)&&console.error("Failed to parse lines, starting in 0!"),o=0,d=0,t.isCombined=!1)),r={lines:[],oldStartLine:o,oldStartLine2:s,newStartLine:d,header:C}}function ne(C){if(t===null||r===null||o===null||d===null)return;let N={content:C},k=t.isCombined?["+ "," +","++"]:["+"],le=t.isCombined?["- "," -","--"]:["-"];Xn(C,k)?(t.addedLines++,N.type=O.INSERT,N.oldNumber=void 0,N.newNumber=d++):Xn(C,le)?(t.deletedLines++,N.type=O.DELETE,N.oldNumber=o++,N.newNumber=void 0):(N.type=O.CONTEXT,N.oldNumber=o++,N.newNumber=d++),r.lines.push(N)}function I(C,N){let k=N;for(;k<P.length-3;){if(C.startsWith("diff"))return!1;if(P[k].startsWith(f)&&P[k+1].startsWith(x)&&P[k+2].startsWith(l))return!0;k++}return!1}return P.forEach((C,N)=>{if(!C||C.startsWith("*"))return;let k,le=P[N-1],Ve=P[N+1],qe=P[N+2];if(C.startsWith("diff --git")||C.startsWith("diff --combined")){if(K(),(k=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(C))&&(p=fe(k[1],void 0,n.dstPrefix),c=fe(k[2],void 0,n.srcPrefix)),t===null)throw new Error("Where is my file !!!");t.isGitDiff=!0;return}if(C.startsWith("Binary files")&&!t?.isGitDiff){if(K(),(k=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(C))&&(p=fe(k[1],void 0,n.dstPrefix),c=fe(k[2],void 0,n.srcPrefix)),t===null)throw new Error("Where is my file !!!");t.isBinary=!0;return}if((!t||!t.isGitDiff&&t&&C.startsWith(f)&&Ve.startsWith(x)&&qe.startsWith(l))&&K(),t?.isTooBig)return;if(t&&(typeof n.diffMaxChanges=="number"&&t.addedLines+t.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&C.length>n.diffMaxLineLength)){t.isTooBig=!0,t.addedLines=0,t.deletedLines=0,t.blocks=[],r=null;let J=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(i.length):"Diff too big to be displayed";M(J);return}if(C.startsWith(f)&&Ve.startsWith(x)||C.startsWith(x)&&le.startsWith(f)){if(t&&!t.oldName&&C.startsWith("--- ")&&(k=dr(C,n.srcPrefix))){t.oldName=k,t.language=Gn(t.oldName,t.language);return}if(t&&!t.newName&&C.startsWith("+++ ")&&(k=ur(C,n.dstPrefix))){t.newName=k,t.language=Gn(t.newName,t.language);return}}if(t&&(C.startsWith(l)||t.isGitDiff&&t.oldName&&t.newName&&!r)){M(C);return}if(r&&(C.startsWith("+")||C.startsWith("-")||C.startsWith(" "))){ne(C);return}let ke=!I(C,N);if(t===null)throw new Error("Where is my file !!!");(k=u.exec(C))?t.oldMode=k[1]:(k=b.exec(C))?t.newMode=k[1]:(k=h.exec(C))?(t.deletedFileMode=k[1],t.isDeleted=!0):(k=g.exec(C))?(t.newFileMode=k[1],t.isNew=!0):(k=w.exec(C))?(ke&&(t.oldName=k[1]),t.isCopy=!0):(k=m.exec(C))?(ke&&(t.newName=k[1]),t.isCopy=!0):(k=S.exec(C))?(ke&&(t.oldName=k[1]),t.isRename=!0):(k=A.exec(C))?(ke&&(t.newName=k[1]),t.isRename=!0):(k=y.exec(C))?(t.isBinary=!0,t.oldName=fe(k[1],void 0,n.srcPrefix),t.newName=fe(k[2],void 0,n.dstPrefix),M("Binary file")):_.test(C)?(t.isBinary=!0,M(C)):(k=F.exec(C))?t.unchangedPercentage=parseInt(k[1],10):(k=L.exec(C))?t.changedPercentage=parseInt(k[1],10):(k=v.exec(C))?(t.checksumBefore=k[1],t.checksumAfter=k[2],k[3]&&(t.mode=k[3])):(k=E.exec(C))?(t.checksumBefore=[k[2],k[3]],t.checksumAfter=k[1]):(k=R.exec(C))?(t.oldMode=[k[2],k[3]],t.newMode=k[1]):(k=V.exec(C))?(t.newFileMode=k[1],t.isNew=!0):(k=re.exec(C))&&(t.deletedFileMode=k[1],t.isDeleted=!0)}),te(),ae(),i}var he=class{diff(n,i,t={}){let r;typeof t=="function"?(r=t,t={}):"callback"in t&&(r=t.callback);let o=this.castInput(n,t),s=this.castInput(i,t),d=this.removeEmpty(this.tokenize(o,t)),p=this.removeEmpty(this.tokenize(s,t));return this.diffWithOptionsObj(d,p,t,r)}diffWithOptionsObj(n,i,t,r){var o;let s=m=>{if(m=this.postProcess(m,t),r){setTimeout(function(){r(m)},0);return}else return m},d=i.length,p=n.length,c=1,f=d+p;t.maxEditLength!=null&&(f=Math.min(f,t.maxEditLength));let x=(o=t.timeout)!==null&&o!==void 0?o:1/0,l=Date.now()+x,u=[{oldPos:-1,lastComponent:void 0}],b=this.extractCommon(u[0],i,n,0,t);if(u[0].oldPos+1>=p&&b+1>=d)return s(this.buildValues(u[0].lastComponent,i,n));let h=-1/0,g=1/0,w=()=>{for(let m=Math.max(h,-c);m<=Math.min(g,c);m+=2){let S,A=u[m-1],F=u[m+1];A&&(u[m-1]=void 0);let L=!1;if(F){let y=F.oldPos-m;L=F&&0<=y&&y<d}let v=A&&A.oldPos+1<p;if(!L&&!v){u[m]=void 0;continue}if(!v||L&&A.oldPos<F.oldPos?S=this.addToPath(F,!0,!1,0,t):S=this.addToPath(A,!1,!0,1,t),b=this.extractCommon(S,i,n,m,t),S.oldPos+1>=p&&b+1>=d)return s(this.buildValues(S.lastComponent,i,n))||!0;u[m]=S,S.oldPos+1>=p&&(g=Math.min(g,m-1)),b+1>=d&&(h=Math.max(h,m+1))}c++};if(r)(function m(){setTimeout(function(){if(c>f||Date.now()>l)return r(void 0);w()||m()},0)})();else for(;c<=f&&Date.now()<=l;){let m=w();if(m)return m}}addToPath(n,i,t,r,o){let s=n.lastComponent;return s&&!o.oneChangePerToken&&s.added===i&&s.removed===t?{oldPos:n.oldPos+r,lastComponent:{count:s.count+1,added:i,removed:t,previousComponent:s.previousComponent}}:{oldPos:n.oldPos+r,lastComponent:{count:1,added:i,removed:t,previousComponent:s}}}extractCommon(n,i,t,r,o){let s=i.length,d=t.length,p=n.oldPos,c=p-r,f=0;for(;c+1<s&&p+1<d&&this.equals(t[p+1],i[c+1],o);)c++,p++,f++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return f&&!o.oneChangePerToken&&(n.lastComponent={count:f,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=p,c}equals(n,i,t){return t.comparator?t.comparator(n,i):n===i||!!t.ignoreCase&&n.toLowerCase()===i.toLowerCase()}removeEmpty(n){let i=[];for(let t=0;t<n.length;t++)n[t]&&i.push(n[t]);return i}castInput(n,i){return n}tokenize(n,i){return Array.from(n)}join(n){return n.join("")}postProcess(n,i){return n}get useLongestToken(){return!1}buildValues(n,i,t){let r=[],o;for(;n;)r.push(n),o=n.previousComponent,delete n.previousComponent,n=o;r.reverse();let s=r.length,d=0,p=0,c=0;for(;d<s;d++){let f=r[d];if(f.removed)f.value=this.join(t.slice(c,c+f.count)),c+=f.count;else{if(!f.added&&this.useLongestToken){let x=i.slice(p,p+f.count);x=x.map(function(l,u){let b=t[c+u];return b.length>l.length?b:l}),f.value=this.join(x)}else f.value=this.join(i.slice(p,p+f.count));p+=f.count,f.added||(c+=f.count)}}return r}};var Lt=class extends he{},Jn=new Lt;function Nt(e,n,i){return Jn.diff(e,n,i)}function Pt(e,n){let i;for(i=0;i<e.length&&i<n.length;i++)if(e[i]!=n[i])return e.slice(0,i);return e.slice(0,i)}function Rt(e,n){let i;if(!e||!n||e[e.length-1]!=n[n.length-1])return"";for(i=0;i<e.length&&i<n.length;i++)if(e[e.length-(i+1)]!=n[n.length-(i+1)])return e.slice(-i);return e.slice(-i)}function st(e,n,i){if(e.slice(0,n.length)!=n)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(n)}; this is a bug`);return i+e.slice(n.length)}function at(e,n,i){if(!n)return e+i;if(e.slice(-n.length)!=n)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(n)}; this is a bug`);return e.slice(0,-n.length)+i}function Te(e,n){return st(e,n,"")}function Ue(e,n){return at(e,n,"")}function Dt(e,n){return n.slice(0,fr(e,n))}function fr(e,n){let i=0;e.length>n.length&&(i=e.length-n.length);let t=n.length;e.length<n.length&&(t=e.length);let r=Array(t),o=0;r[0]=0;for(let s=1;s<t;s++){for(n[s]==n[o]?r[s]=r[o]:r[s]=o;o>0&&n[s]!=n[o];)o=r[o];n[s]==n[o]&&o++}o=0;for(let s=i;s<e.length;s++){for(;o>0&&e[s]!=n[o];)o=r[o];e[s]==n[o]&&o++}return o}function Ot(e,n){let i=[];for(let t of Array.from(n.segment(e))){let r=t.segment;i.length&&/\s/.test(i[i.length-1])&&/\s/.test(r)?i[i.length-1]+=r:i.push(r)}return i}function lt(e,n){if(n)return Fe(e,n)[1];let i;for(i=e.length-1;i>=0&&e[i].match(/\s/);i--);return e.substring(i+1)}function xe(e,n){if(n)return Fe(e,n)[0];let i=e.match(/^\s*/);return i?i[0]:""}function Fe(e,n){if(!n)return[xe(e),lt(e)];if(n.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let i=Ot(e,n),t=i[0],r=i[i.length-1],o=/\s/.test(t)?t:"",s=/\s/.test(r)?r:"";return[o,s]}var ct="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",hr=new RegExp(`[${ct}]+|\\s+|[^${ct}]`,"ug"),Mt=class extends he{equals(n,i,t){return t.ignoreCase&&(n=n.toLowerCase(),i=i.toLowerCase()),n.trim()===i.trim()}tokenize(n,i={}){let t;if(i.intlSegmenter){let s=i.intlSegmenter;if(s.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');t=Ot(n,s)}else t=n.match(hr)||[];let r=[],o=null;return t.forEach(s=>{/\s/.test(s)?o==null?r.push(s):r.push(r.pop()+s):o!=null&&/\s/.test(o)?r[r.length-1]==o?r.push(r.pop()+s):r.push(o+s):r.push(s),o=s}),r}join(n){return n.map((i,t)=>t==0?i:i.replace(/^\s+/,"")).join("")}postProcess(n,i){if(!n||i.oneChangePerToken)return n;let t=null,r=null,o=null;return n.forEach(s=>{s.added?r=s:s.removed?o=s:((r||o)&&Qn(t,o,r,s,i.intlSegmenter),t=s,r=null,o=null)}),(r||o)&&Qn(t,o,r,null,i.intlSegmenter),n}},gr=new Mt;function Qn(e,n,i,t,r){if(n&&i){let[o,s]=Fe(n.value,r),[d,p]=Fe(i.value,r);if(e){let c=Pt(o,d);e.value=at(e.value,d,c),n.value=Te(n.value,c),i.value=Te(i.value,c)}if(t){let c=Rt(s,p);t.value=st(t.value,p,c),n.value=Ue(n.value,c),i.value=Ue(i.value,c)}}else if(i){if(e){let o=xe(i.value,r);i.value=i.value.substring(o.length)}if(t){let o=xe(t.value,r);t.value=t.value.substring(o.length)}}else if(e&&t){let o=xe(t.value,r),[s,d]=Fe(n.value,r),p=Pt(o,s);n.value=Te(n.value,p);let c=Rt(Te(o,p),d);n.value=Ue(n.value,c),t.value=st(t.value,o,c),e.value=at(e.value,o,o.slice(0,o.length-c.length))}else if(t){let o=xe(t.value,r),s=lt(n.value,r),d=Dt(s,o);n.value=Ue(n.value,d)}else if(e){let o=lt(e.value,r),s=xe(n.value,r),d=Dt(o,s);n.value=Te(n.value,d)}}var It=class extends he{tokenize(n){let i=new RegExp(`(\\r?\\n)|[${ct}]+|[^\\S\\n\\r]+|[^${ct}]`,"ug");return n.match(i)||[]}},Zn=new It;function Ht(e,n,i){return Zn.diff(e,n,i)}function br(e,n){if(e.length===0)return n.length;if(n.length===0)return e.length;let i=[],t;for(t=0;t<=n.length;t++)i[t]=[t];let r;for(r=0;r<=e.length;r++)i[0][r]=r;for(t=1;t<=n.length;t++)for(r=1;r<=e.length;r++)n.charAt(t-1)===e.charAt(r-1)?i[t][r]=i[t-1][r-1]:i[t][r]=Math.min(i[t-1][r-1]+1,Math.min(i[t][r-1]+1,i[t-1][r]+1));return i[n.length][e.length]}function Le(e){return(n,i)=>{let t=e(n).trim(),r=e(i).trim();return br(t,r)/(t.length+r.length)}}function Ne(e){function n(t,r,o=new Map){let s=1/0,d;for(let p=0;p<t.length;++p)for(let c=0;c<r.length;++c){let f=JSON.stringify([t[p],r[c]]),x;o.has(f)&&(x=o.get(f))||(x=e(t[p],r[c]),o.set(f,x)),x<s&&(s=x,d={indexA:p,indexB:c,score:s})}return d}function i(t,r,o=0,s=new Map){let d=n(t,r,s);if(!d||t.length+r.length<3)return[[t,r]];let p=t.slice(0,d.indexA),c=r.slice(0,d.indexB),f=[t[d.indexA]],x=[r[d.indexB]],l=d.indexA+1,u=d.indexB+1,b=t.slice(l),h=r.slice(u),g=i(p,c,o+1,s),w=i(f,x,o+1,s),m=i(b,h,o+1,s),S=w;return(d.indexA>0||d.indexB>0)&&(S=g.concat(S)),(t.length>l||r.length>u)&&(S=S.concat(m)),S}return i}var X={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},_e={matching:zn.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:$n.WORD,colorScheme:ye.LIGHT},se="/",ei=Le(e=>e.value),vr=Ne(ei);function Wt(e){return e.indexOf("dev/null")!==-1}function yr(e){return e.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function xr(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function Pe(e){switch(e){case O.CONTEXT:return X.CONTEXT;case O.INSERT:return X.INSERTS;case O.DELETE:return X.DELETES}}function Re(e){switch(e){case ye.DARK:return"d2h-dark-color-scheme";case ye.AUTO:return"d2h-auto-color-scheme";case ye.LIGHT:default:return"d2h-light-color-scheme"}}function _r(e){return e?2:1}function ge(e){return e.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function ee(e,n,i=!0){let t=_r(n);return{prefix:e.substring(0,t),content:i?ge(e.substring(t)):e.substring(t)}}function we(e){let n=Ft(e.oldName),i=Ft(e.newName);if(n!==i&&!Wt(n)&&!Wt(i)){let t=[],r=[],o=n.split(se),s=i.split(se),d=o.length,p=s.length,c=0,f=d-1,x=p-1;for(;c<f&&c<x&&o[c]===s[c];)t.push(s[c]),c+=1;for(;f>c&&x>c&&o[f]===s[x];)r.unshift(s[x]),f-=1,x-=1;let l=t.join(se),u=r.join(se),b=o.slice(c,f+1).join(se),h=s.slice(c,x+1).join(se);return l.length&&u.length?l+se+"{"+b+" \u2192 "+h+"}"+se+u:l.length?l+se+"{"+b+" \u2192 "+h+"}":u.length?"{"+b+" \u2192 "+h+"}"+se+u:n+" \u2192 "+i}else return Wt(i)?n:i}function De(e){return`d2h-${qn(we(e)).toString().slice(-6)}`}function Oe(e){let n="file-changed";return e.isRename||e.isCopy?n="file-renamed":e.isNew?n="file-added":e.isDeleted?n="file-deleted":e.newName!==e.oldName&&(n="file-renamed"),n}function dt(e,n,i,t={}){let{matching:r,maxLineLengthHighlight:o,matchWordsThreshold:s,diffStyle:d}=Object.assign(Object.assign({},_e),t),p=ee(e,i,!1),c=ee(n,i,!1);if(p.content.length>o||c.content.length>o)return{oldLine:{prefix:p.prefix,content:ge(p.content)},newLine:{prefix:c.prefix,content:ge(c.content)}};let f=d==="char"?Nt(p.content,c.content):Ht(p.content,c.content),x=[];if(d==="word"&&r==="words"){let u=f.filter(g=>g.removed),b=f.filter(g=>g.added);vr(b,u).forEach(g=>{g[0].length===1&&g[1].length===1&&ei(g[0][0],g[1][0])<s&&(x.push(g[0][0]),x.push(g[1][0]))})}let l=f.reduce((u,b)=>{let h=b.added?"ins":b.removed?"del":null,g=x.indexOf(b)>-1?' class="d2h-change"':"",w=ge(b.value);return h!==null?`${u}<${h}${g}>${w}</${h}>`:`${u}${w}`},"");return{oldLine:{prefix:p.prefix,content:yr(l)},newLine:{prefix:c.prefix,content:xr(l)}}}var ti="file-summary",wr="icon",kr={colorScheme:_e.colorScheme},ut=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},kr),i)}render(n){let i=n.map(t=>this.hoganUtils.render(ti,"line",{fileHtmlId:De(t),oldName:t.oldName,newName:t.newName,fileName:we(t),deletedLines:"-"+t.deletedLines,addedLines:"+"+t.addedLines},{fileIcon:this.hoganUtils.template(wr,Oe(t))})).join(`
8
- `);return this.hoganUtils.render(ti,"wrapper",{colorScheme:Re(this.config.colorScheme),filesNumber:n.length,files:i})}};var Bt=Object.assign(Object.assign({},_e),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),We="generic",ni="line-by-line",Cr="icon",Sr="tag",je=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},Bt),i)}render(n){let i=n.map(t=>{let r;return t.blocks.length?r=this.generateFileHtml(t):r=this.generateEmptyDiff(),this.makeFileDiffHtml(t,r)}).join(`
9
- `);return this.hoganUtils.render(We,"wrapper",{colorScheme:Re(this.config.colorScheme),content:i})}makeFileDiffHtml(n,i){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";let t=this.hoganUtils.template(ni,"file-diff"),r=this.hoganUtils.template(We,"file-path"),o=this.hoganUtils.template(Cr,"file"),s=this.hoganUtils.template(Sr,Oe(n));return t.render({file:n,fileHtmlId:De(n),diffs:i,filePath:r.render({fileDiffName:we(n)},{fileIcon:o,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(We,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:X})}generateFileHtml(n){let i=Ne(Le(t=>ee(t.content,n.isCombined).content));return n.blocks.map(t=>{let r=this.hoganUtils.render(We,"block-header",{CSSLineClass:X,blockHeader:n.isTooBig?t.header:ge(t.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(t).forEach(([o,s,d])=>{if(s.length&&d.length&&!o.length)this.applyRematchMatching(s,d,i).map(([p,c])=>{let{left:f,right:x}=this.processChangedLines(n,n.isCombined,p,c);r+=f,r+=x});else if(o.length)o.forEach(p=>{let{prefix:c,content:f}=ee(p.content,n.isCombined);r+=this.generateSingleLineHtml(n,{type:X.CONTEXT,prefix:c,content:f,oldNumber:p.oldNumber,newNumber:p.newNumber})});else if(s.length||d.length){let{left:p,right:c}=this.processChangedLines(n,n.isCombined,s,d);r+=p,r+=c}else console.error("Unknown state reached while processing groups of lines",o,s,d)}),r}).join(`
10
- `)}applyLineGroupping(n){let i=[],t=[],r=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o];(s.type!==O.INSERT&&r.length||s.type===O.CONTEXT&&t.length>0)&&(i.push([[],t,r]),t=[],r=[]),s.type===O.CONTEXT?i.push([[s],[],[]]):s.type===O.INSERT&&t.length===0?i.push([[],[],[s]]):s.type===O.INSERT&&t.length>0?r.push(s):s.type===O.DELETE&&t.push(s)}return(t.length||r.length)&&(i.push([[],t,r]),t=[],r=[]),i}applyRematchMatching(n,i,t){let r=n.length*i.length,o=ot(n.concat(i).map(d=>d.content.length));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?t(n,i):[[n,i]]}processChangedLines(n,i,t,r){let o={right:"",left:""},s=Math.max(t.length,r.length);for(let d=0;d<s;d++){let p=t[d],c=r[d],f=p!==void 0&&c!==void 0?dt(p.content,c.content,i,this.config):void 0,x=p!==void 0&&p.oldNumber!==void 0?Object.assign(Object.assign({},f!==void 0?{prefix:f.oldLine.prefix,content:f.oldLine.content,type:X.DELETE_CHANGES}:Object.assign(Object.assign({},ee(p.content,i)),{type:Pe(p.type)})),{oldNumber:p.oldNumber,newNumber:p.newNumber}):void 0,l=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},f!==void 0?{prefix:f.newLine.prefix,content:f.newLine.content,type:X.INSERT_CHANGES}:Object.assign(Object.assign({},ee(c.content,i)),{type:Pe(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:u,right:b}=this.generateLineHtml(n,x,l);o.left+=u,o.right+=b}return o}generateLineHtml(n,i,t){return{left:this.generateSingleLineHtml(n,i),right:this.generateSingleLineHtml(n,t)}}generateSingleLineHtml(n,i){if(i===void 0)return"";let t=this.hoganUtils.render(ni,"numbers",{oldNumber:i.oldNumber||"",newNumber:i.newNumber||""});return this.hoganUtils.render(We,"line",{type:i.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:i.prefix===" "?"&nbsp;":i.prefix,content:i.content,lineNumber:t,line:i,file:n})}};var zt=Object.assign(Object.assign({},_e),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Be="generic",Er="side-by-side",Ar="icon",Tr="tag",ze=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},zt),i)}render(n){let i=n.map(t=>{let r;return t.blocks.length?r=this.generateFileHtml(t):r=this.generateEmptyDiff(),this.makeFileDiffHtml(t,r)}).join(`
11
- `);return this.hoganUtils.render(Be,"wrapper",{colorScheme:Re(this.config.colorScheme),content:i})}makeFileDiffHtml(n,i){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";let t=this.hoganUtils.template(Er,"file-diff"),r=this.hoganUtils.template(Be,"file-path"),o=this.hoganUtils.template(Ar,"file"),s=this.hoganUtils.template(Tr,Oe(n));return t.render({file:n,fileHtmlId:De(n),diffs:i,filePath:r.render({fileDiffName:we(n)},{fileIcon:o,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Be,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:X})}}generateFileHtml(n){let i=Ne(Le(t=>ee(t.content,n.isCombined).content));return n.blocks.map(t=>{let r={left:this.makeHeaderHtml(t.header,n),right:this.makeHeaderHtml("")};return this.applyLineGroupping(t).forEach(([o,s,d])=>{if(s.length&&d.length&&!o.length)this.applyRematchMatching(s,d,i).map(([p,c])=>{let{left:f,right:x}=this.processChangedLines(n.isCombined,p,c);r.left+=f,r.right+=x});else if(o.length)o.forEach(p=>{let{prefix:c,content:f}=ee(p.content,n.isCombined),{left:x,right:l}=this.generateLineHtml({type:X.CONTEXT,prefix:c,content:f,number:p.oldNumber},{type:X.CONTEXT,prefix:c,content:f,number:p.newNumber});r.left+=x,r.right+=l});else if(s.length||d.length){let{left:p,right:c}=this.processChangedLines(n.isCombined,s,d);r.left+=p,r.right+=c}else console.error("Unknown state reached while processing groups of lines",o,s,d)}),r}).reduce((t,r)=>({left:t.left+r.left,right:t.right+r.right}),{left:"",right:""})}applyLineGroupping(n){let i=[],t=[],r=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o];(s.type!==O.INSERT&&r.length||s.type===O.CONTEXT&&t.length>0)&&(i.push([[],t,r]),t=[],r=[]),s.type===O.CONTEXT?i.push([[s],[],[]]):s.type===O.INSERT&&t.length===0?i.push([[],[],[s]]):s.type===O.INSERT&&t.length>0?r.push(s):s.type===O.DELETE&&t.push(s)}return(t.length||r.length)&&(i.push([[],t,r]),t=[],r=[]),i}applyRematchMatching(n,i,t){let r=n.length*i.length,o=ot(n.concat(i).map(d=>d.content.length));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?t(n,i):[[n,i]]}makeHeaderHtml(n,i){return this.hoganUtils.render(Be,"block-header",{CSSLineClass:X,blockHeader:i?.isTooBig?n:ge(n),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(n,i,t){let r={right:"",left:""},o=Math.max(i.length,t.length);for(let s=0;s<o;s++){let d=i[s],p=t[s],c=d!==void 0&&p!==void 0?dt(d.content,p.content,n,this.config):void 0,f=d!==void 0&&d.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:X.DELETE_CHANGES}:Object.assign(Object.assign({},ee(d.content,n)),{type:Pe(d.type)})),{number:d.oldNumber}):void 0,x=p!==void 0&&p.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:X.INSERT_CHANGES}:Object.assign(Object.assign({},ee(p.content,n)),{type:Pe(p.type)})),{number:p.newNumber}):void 0,{left:l,right:u}=this.generateLineHtml(f,x);r.left+=l,r.right+=u}return r}generateLineHtml(n,i){return{left:this.generateSingleHtml(n),right:this.generateSingleHtml(i)}}generateSingleHtml(n){let i="d2h-code-side-linenumber",t="d2h-code-side-line";return this.hoganUtils.render(Be,"line",{type:n?.type||`${X.CONTEXT} d2h-emptyplaceholder`,lineClass:n!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,contentClass:n!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,prefix:n?.prefix===" "?"&nbsp;":n?.prefix,content:n?.content,lineNumber:n?.number})}};var Gt=rn(qt());var z=rn(qt()),j={};j["file-summary-line"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<li class="d2h-file-list-line">'),t.b(`
7
+ `);function te(){r!==null&&t!==null&&(t.blocks.push(r),r=null)}function ae(){t!==null&&(!t.oldName&&p!==null&&(t.oldName=p),!t.newName&&d!==null&&(t.newName=d),t.newName&&(i.push(t),t=null)),p=null,d=null}function J(){te(),ae(),t={blocks:[],deletedLines:0,addedLines:0}}function O(S){te();let N;t!==null&&((N=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(S))?(t.isCombined=!1,o=parseInt(N[1],10),c=parseInt(N[2],10)):(N=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(S))?(t.isCombined=!0,o=parseInt(N[1],10),s=parseInt(N[2],10),c=parseInt(N[3],10)):(S.startsWith(l)&&console.error("Failed to parse lines, starting in 0!"),o=0,c=0,t.isCombined=!1)),r={lines:[],oldStartLine:o,oldStartLine2:s,newStartLine:c,header:S}}function ne(S){if(t===null||r===null||o===null||c===null)return;let N={content:S},C=t.isCombined?["+ "," +","++"]:["+"],le=t.isCombined?["- "," -","--"]:["-"];Xn(S,C)?(t.addedLines++,N.type=M.INSERT,N.oldNumber=void 0,N.newNumber=c++):Xn(S,le)?(t.deletedLines++,N.type=M.DELETE,N.oldNumber=o++,N.newNumber=void 0):(N.type=M.CONTEXT,N.oldNumber=o++,N.newNumber=c++),r.lines.push(N)}function I(S,N){let C=N;for(;C<P.length-3;){if(S.startsWith("diff"))return!1;if(P[C].startsWith(h)&&P[C+1].startsWith(x)&&P[C+2].startsWith(l))return!0;C++}return!1}return P.forEach((S,N)=>{if(!S||S.startsWith("*"))return;let C,le=P[N-1],qe=P[N+1],Ge=P[N+2];if(S.startsWith("diff --git")||S.startsWith("diff --combined")){if(J(),(C=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(S))&&(p=fe(C[1],void 0,n.dstPrefix),d=fe(C[2],void 0,n.srcPrefix)),t===null)throw new Error("Where is my file !!!");t.isGitDiff=!0;return}if(S.startsWith("Binary files")&&!t?.isGitDiff){if(J(),(C=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(S))&&(p=fe(C[1],void 0,n.dstPrefix),d=fe(C[2],void 0,n.srcPrefix)),t===null)throw new Error("Where is my file !!!");t.isBinary=!0;return}if((!t||!t.isGitDiff&&t&&S.startsWith(h)&&qe.startsWith(x)&&Ge.startsWith(l))&&J(),t?.isTooBig)return;if(t&&(typeof n.diffMaxChanges=="number"&&t.addedLines+t.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&S.length>n.diffMaxLineLength)){t.isTooBig=!0,t.addedLines=0,t.deletedLines=0,t.blocks=[],r=null;let Q=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(i.length):"Diff too big to be displayed";O(Q);return}if(S.startsWith(h)&&qe.startsWith(x)||S.startsWith(x)&&le.startsWith(h)){if(t&&!t.oldName&&S.startsWith("--- ")&&(C=pr(S,n.srcPrefix))){t.oldName=C,t.language=Gn(t.oldName,t.language);return}if(t&&!t.newName&&S.startsWith("+++ ")&&(C=fr(S,n.dstPrefix))){t.newName=C,t.language=Gn(t.newName,t.language);return}}if(t&&(S.startsWith(l)||t.isGitDiff&&t.oldName&&t.newName&&!r)){O(S);return}if(r&&(S.startsWith("+")||S.startsWith("-")||S.startsWith(" "))){ne(S);return}let Ce=!I(S,N);if(t===null)throw new Error("Where is my file !!!");(C=u.exec(S))?t.oldMode=C[1]:(C=g.exec(S))?t.newMode=C[1]:(C=f.exec(S))?(t.deletedFileMode=C[1],t.isDeleted=!0):(C=b.exec(S))?(t.newFileMode=C[1],t.isNew=!0):(C=w.exec(S))?(Ce&&(t.oldName=C[1]),t.isCopy=!0):(C=v.exec(S))?(Ce&&(t.newName=C[1]),t.isCopy=!0):(C=_.exec(S))?(Ce&&(t.oldName=C[1]),t.isRename=!0):(C=E.exec(S))?(Ce&&(t.newName=C[1]),t.isRename=!0):(C=y.exec(S))?(t.isBinary=!0,t.oldName=fe(C[1],void 0,n.srcPrefix),t.newName=fe(C[2],void 0,n.dstPrefix),O("Binary file")):k.test(S)?(t.isBinary=!0,O(S)):(C=T.exec(S))?t.unchangedPercentage=parseInt(C[1],10):(C=L.exec(S))?t.changedPercentage=parseInt(C[1],10):(C=m.exec(S))?(t.checksumBefore=C[1],t.checksumAfter=C[2],C[3]&&(t.mode=C[3])):(C=A.exec(S))?(t.checksumBefore=[C[2],C[3]],t.checksumAfter=C[1]):(C=R.exec(S))?(t.oldMode=[C[2],C[3]],t.newMode=C[1]):(C=z.exec(S))?(t.newFileMode=C[1],t.isNew=!0):(C=re.exec(S))&&(t.deletedFileMode=C[1],t.isDeleted=!0)}),te(),ae(),i}var he=class{diff(n,i,t={}){let r;typeof t=="function"?(r=t,t={}):"callback"in t&&(r=t.callback);let o=this.castInput(n,t),s=this.castInput(i,t),c=this.removeEmpty(this.tokenize(o,t)),p=this.removeEmpty(this.tokenize(s,t));return this.diffWithOptionsObj(c,p,t,r)}diffWithOptionsObj(n,i,t,r){var o;let s=v=>{if(v=this.postProcess(v,t),r){setTimeout(function(){r(v)},0);return}else return v},c=i.length,p=n.length,d=1,h=c+p;t.maxEditLength!=null&&(h=Math.min(h,t.maxEditLength));let x=(o=t.timeout)!==null&&o!==void 0?o:1/0,l=Date.now()+x,u=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(u[0],i,n,0,t);if(u[0].oldPos+1>=p&&g+1>=c)return s(this.buildValues(u[0].lastComponent,i,n));let f=-1/0,b=1/0,w=()=>{for(let v=Math.max(f,-d);v<=Math.min(b,d);v+=2){let _,E=u[v-1],T=u[v+1];E&&(u[v-1]=void 0);let L=!1;if(T){let y=T.oldPos-v;L=T&&0<=y&&y<c}let m=E&&E.oldPos+1<p;if(!L&&!m){u[v]=void 0;continue}if(!m||L&&E.oldPos<T.oldPos?_=this.addToPath(T,!0,!1,0,t):_=this.addToPath(E,!1,!0,1,t),g=this.extractCommon(_,i,n,v,t),_.oldPos+1>=p&&g+1>=c)return s(this.buildValues(_.lastComponent,i,n))||!0;u[v]=_,_.oldPos+1>=p&&(b=Math.min(b,v-1)),g+1>=c&&(f=Math.max(f,v+1))}d++};if(r)(function v(){setTimeout(function(){if(d>h||Date.now()>l)return r(void 0);w()||v()},0)})();else for(;d<=h&&Date.now()<=l;){let v=w();if(v)return v}}addToPath(n,i,t,r,o){let s=n.lastComponent;return s&&!o.oneChangePerToken&&s.added===i&&s.removed===t?{oldPos:n.oldPos+r,lastComponent:{count:s.count+1,added:i,removed:t,previousComponent:s.previousComponent}}:{oldPos:n.oldPos+r,lastComponent:{count:1,added:i,removed:t,previousComponent:s}}}extractCommon(n,i,t,r,o){let s=i.length,c=t.length,p=n.oldPos,d=p-r,h=0;for(;d+1<s&&p+1<c&&this.equals(t[p+1],i[d+1],o);)d++,p++,h++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return h&&!o.oneChangePerToken&&(n.lastComponent={count:h,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=p,d}equals(n,i,t){return t.comparator?t.comparator(n,i):n===i||!!t.ignoreCase&&n.toLowerCase()===i.toLowerCase()}removeEmpty(n){let i=[];for(let t=0;t<n.length;t++)n[t]&&i.push(n[t]);return i}castInput(n,i){return n}tokenize(n,i){return Array.from(n)}join(n){return n.join("")}postProcess(n,i){return n}get useLongestToken(){return!1}buildValues(n,i,t){let r=[],o;for(;n;)r.push(n),o=n.previousComponent,delete n.previousComponent,n=o;r.reverse();let s=r.length,c=0,p=0,d=0;for(;c<s;c++){let h=r[c];if(h.removed)h.value=this.join(t.slice(d,d+h.count)),d+=h.count;else{if(!h.added&&this.useLongestToken){let x=i.slice(p,p+h.count);x=x.map(function(l,u){let g=t[d+u];return g.length>l.length?g:l}),h.value=this.join(x)}else h.value=this.join(i.slice(p,p+h.count));p+=h.count,h.added||(d+=h.count)}}return r}};var Nt=class extends he{},Jn=new Nt;function Pt(e,n,i){return Jn.diff(e,n,i)}function Rt(e,n){let i;for(i=0;i<e.length&&i<n.length;i++)if(e[i]!=n[i])return e.slice(0,i);return e.slice(0,i)}function Dt(e,n){let i;if(!e||!n||e[e.length-1]!=n[n.length-1])return"";for(i=0;i<e.length&&i<n.length;i++)if(e[e.length-(i+1)]!=n[n.length-(i+1)])return e.slice(-i);return e.slice(-i)}function at(e,n,i){if(e.slice(0,n.length)!=n)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(n)}; this is a bug`);return i+e.slice(n.length)}function lt(e,n,i){if(!n)return e+i;if(e.slice(-n.length)!=n)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(n)}; this is a bug`);return e.slice(0,-n.length)+i}function Te(e,n){return at(e,n,"")}function Ue(e,n){return lt(e,n,"")}function Mt(e,n){return n.slice(0,gr(e,n))}function gr(e,n){let i=0;e.length>n.length&&(i=e.length-n.length);let t=n.length;e.length<n.length&&(t=e.length);let r=Array(t),o=0;r[0]=0;for(let s=1;s<t;s++){for(n[s]==n[o]?r[s]=r[o]:r[s]=o;o>0&&n[s]!=n[o];)o=r[o];n[s]==n[o]&&o++}o=0;for(let s=i;s<e.length;s++){for(;o>0&&e[s]!=n[o];)o=r[o];e[s]==n[o]&&o++}return o}function Ot(e,n){let i=[];for(let t of Array.from(n.segment(e))){let r=t.segment;i.length&&/\s/.test(i[i.length-1])&&/\s/.test(r)?i[i.length-1]+=r:i.push(r)}return i}function ct(e,n){if(n)return Fe(e,n)[1];let i;for(i=e.length-1;i>=0&&e[i].match(/\s/);i--);return e.substring(i+1)}function _e(e,n){if(n)return Fe(e,n)[0];let i=e.match(/^\s*/);return i?i[0]:""}function Fe(e,n){if(!n)return[_e(e),ct(e)];if(n.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let i=Ot(e,n),t=i[0],r=i[i.length-1],o=/\s/.test(t)?t:"",s=/\s/.test(r)?r:"";return[o,s]}var dt="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",mr=new RegExp(`[${dt}]+|\\s+|[^${dt}]`,"ug"),It=class extends he{equals(n,i,t){return t.ignoreCase&&(n=n.toLowerCase(),i=i.toLowerCase()),n.trim()===i.trim()}tokenize(n,i={}){let t;if(i.intlSegmenter){let s=i.intlSegmenter;if(s.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');t=Ot(n,s)}else t=n.match(mr)||[];let r=[],o=null;return t.forEach(s=>{/\s/.test(s)?o==null?r.push(s):r.push(r.pop()+s):o!=null&&/\s/.test(o)?r[r.length-1]==o?r.push(r.pop()+s):r.push(o+s):r.push(s),o=s}),r}join(n){return n.map((i,t)=>t==0?i:i.replace(/^\s+/,"")).join("")}postProcess(n,i){if(!n||i.oneChangePerToken)return n;let t=null,r=null,o=null;return n.forEach(s=>{s.added?r=s:s.removed?o=s:((r||o)&&Qn(t,o,r,s,i.intlSegmenter),t=s,r=null,o=null)}),(r||o)&&Qn(t,o,r,null,i.intlSegmenter),n}},br=new It;function Qn(e,n,i,t,r){if(n&&i){let[o,s]=Fe(n.value,r),[c,p]=Fe(i.value,r);if(e){let d=Rt(o,c);e.value=lt(e.value,c,d),n.value=Te(n.value,d),i.value=Te(i.value,d)}if(t){let d=Dt(s,p);t.value=at(t.value,p,d),n.value=Ue(n.value,d),i.value=Ue(i.value,d)}}else if(i){if(e){let o=_e(i.value,r);i.value=i.value.substring(o.length)}if(t){let o=_e(t.value,r);t.value=t.value.substring(o.length)}}else if(e&&t){let o=_e(t.value,r),[s,c]=Fe(n.value,r),p=Rt(o,s);n.value=Te(n.value,p);let d=Dt(Te(o,p),c);n.value=Ue(n.value,d),t.value=at(t.value,o,d),e.value=lt(e.value,o,o.slice(0,o.length-d.length))}else if(t){let o=_e(t.value,r),s=ct(n.value,r),c=Mt(s,o);n.value=Ue(n.value,c)}else if(e){let o=ct(e.value,r),s=_e(n.value,r),c=Mt(o,s);n.value=Te(n.value,c)}}var Ht=class extends he{tokenize(n){let i=new RegExp(`(\\r?\\n)|[${dt}]+|[^\\S\\n\\r]+|[^${dt}]`,"ug");return n.match(i)||[]}},Zn=new Ht;function Ut(e,n,i){return Zn.diff(e,n,i)}function yr(e,n){if(e.length===0)return n.length;if(n.length===0)return e.length;let i=[],t;for(t=0;t<=n.length;t++)i[t]=[t];let r;for(r=0;r<=e.length;r++)i[0][r]=r;for(t=1;t<=n.length;t++)for(r=1;r<=e.length;r++)n.charAt(t-1)===e.charAt(r-1)?i[t][r]=i[t-1][r-1]:i[t][r]=Math.min(i[t-1][r-1]+1,Math.min(i[t][r-1]+1,i[t-1][r]+1));return i[n.length][e.length]}function Le(e){return(n,i)=>{let t=e(n).trim(),r=e(i).trim();return yr(t,r)/(t.length+r.length)}}function Ne(e){function n(t,r,o=new Map){let s=1/0,c;for(let p=0;p<t.length;++p)for(let d=0;d<r.length;++d){let h=JSON.stringify([t[p],r[d]]),x;o.has(h)&&(x=o.get(h))||(x=e(t[p],r[d]),o.set(h,x)),x<s&&(s=x,c={indexA:p,indexB:d,score:s})}return c}function i(t,r,o=0,s=new Map){let c=n(t,r,s);if(!c||t.length+r.length<3)return[[t,r]];let p=t.slice(0,c.indexA),d=r.slice(0,c.indexB),h=[t[c.indexA]],x=[r[c.indexB]],l=c.indexA+1,u=c.indexB+1,g=t.slice(l),f=r.slice(u),b=i(p,d,o+1,s),w=i(h,x,o+1,s),v=i(g,f,o+1,s),_=w;return(c.indexA>0||c.indexB>0)&&(_=b.concat(_)),(t.length>l||r.length>u)&&(_=_.concat(v)),_}return i}var X={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},we={matching:zn.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:$n.WORD,colorScheme:xe.LIGHT},se="/",ei=Le(e=>e.value),xr=Ne(ei);function jt(e){return e.indexOf("dev/null")!==-1}function _r(e){return e.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function wr(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function Pe(e){switch(e){case M.CONTEXT:return X.CONTEXT;case M.INSERT:return X.INSERTS;case M.DELETE:return X.DELETES}}function Re(e){switch(e){case xe.DARK:return"d2h-dark-color-scheme";case xe.AUTO:return"d2h-auto-color-scheme";case xe.LIGHT:default:return"d2h-light-color-scheme"}}function kr(e){return e?2:1}function ge(e){return e.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function ee(e,n,i=!0){let t=kr(n);return{prefix:e.substring(0,t),content:i?ge(e.substring(t)):e.substring(t)}}function ke(e){let n=Lt(e.oldName),i=Lt(e.newName);if(n!==i&&!jt(n)&&!jt(i)){let t=[],r=[],o=n.split(se),s=i.split(se),c=o.length,p=s.length,d=0,h=c-1,x=p-1;for(;d<h&&d<x&&o[d]===s[d];)t.push(s[d]),d+=1;for(;h>d&&x>d&&o[h]===s[x];)r.unshift(s[x]),h-=1,x-=1;let l=t.join(se),u=r.join(se),g=o.slice(d,h+1).join(se),f=s.slice(d,x+1).join(se);return l.length&&u.length?l+se+"{"+g+" \u2192 "+f+"}"+se+u:l.length?l+se+"{"+g+" \u2192 "+f+"}":u.length?"{"+g+" \u2192 "+f+"}"+se+u:n+" \u2192 "+i}else return jt(i)?n:i}function De(e){return`d2h-${qn(ke(e)).toString().slice(-6)}`}function Me(e){let n="file-changed";return e.isRename||e.isCopy?n="file-renamed":e.isNew?n="file-added":e.isDeleted?n="file-deleted":e.newName!==e.oldName&&(n="file-renamed"),n}function ut(e,n,i,t={}){let{matching:r,maxLineLengthHighlight:o,matchWordsThreshold:s,diffStyle:c}=Object.assign(Object.assign({},we),t),p=ee(e,i,!1),d=ee(n,i,!1);if(p.content.length>o||d.content.length>o)return{oldLine:{prefix:p.prefix,content:ge(p.content)},newLine:{prefix:d.prefix,content:ge(d.content)}};let h=c==="char"?Pt(p.content,d.content):Ut(p.content,d.content),x=[];if(c==="word"&&r==="words"){let u=h.filter(b=>b.removed),g=h.filter(b=>b.added);xr(g,u).forEach(b=>{b[0].length===1&&b[1].length===1&&ei(b[0][0],b[1][0])<s&&(x.push(b[0][0]),x.push(b[1][0]))})}let l=h.reduce((u,g)=>{let f=g.added?"ins":g.removed?"del":null,b=x.indexOf(g)>-1?' class="d2h-change"':"",w=ge(g.value);return f!==null?`${u}<${f}${b}>${w}</${f}>`:`${u}${w}`},"");return{oldLine:{prefix:p.prefix,content:_r(l)},newLine:{prefix:d.prefix,content:wr(l)}}}var ti="file-summary",Cr="icon",Sr={colorScheme:we.colorScheme},pt=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},Sr),i)}render(n){let i=n.map(t=>this.hoganUtils.render(ti,"line",{fileHtmlId:De(t),oldName:t.oldName,newName:t.newName,fileName:ke(t),deletedLines:"-"+t.deletedLines,addedLines:"+"+t.addedLines},{fileIcon:this.hoganUtils.template(Cr,Me(t))})).join(`
8
+ `);return this.hoganUtils.render(ti,"wrapper",{colorScheme:Re(this.config.colorScheme),filesNumber:n.length,files:i})}};var zt=Object.assign(Object.assign({},we),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),We="generic",ni="line-by-line",Er="icon",Ar="tag",je=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},zt),i)}render(n){let i=n.map(t=>{let r;return t.blocks.length?r=this.generateFileHtml(t):r=this.generateEmptyDiff(),this.makeFileDiffHtml(t,r)}).join(`
9
+ `);return this.hoganUtils.render(We,"wrapper",{colorScheme:Re(this.config.colorScheme),content:i})}makeFileDiffHtml(n,i){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";let t=this.hoganUtils.template(ni,"file-diff"),r=this.hoganUtils.template(We,"file-path"),o=this.hoganUtils.template(Er,"file"),s=this.hoganUtils.template(Ar,Me(n));return t.render({file:n,fileHtmlId:De(n),diffs:i,filePath:r.render({fileDiffName:ke(n)},{fileIcon:o,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(We,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:X})}generateFileHtml(n){let i=Ne(Le(t=>ee(t.content,n.isCombined).content));return n.blocks.map(t=>{let r=this.hoganUtils.render(We,"block-header",{CSSLineClass:X,blockHeader:n.isTooBig?t.header:ge(t.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(t).forEach(([o,s,c])=>{if(s.length&&c.length&&!o.length)this.applyRematchMatching(s,c,i).map(([p,d])=>{let{left:h,right:x}=this.processChangedLines(n,n.isCombined,p,d);r+=h,r+=x});else if(o.length)o.forEach(p=>{let{prefix:d,content:h}=ee(p.content,n.isCombined);r+=this.generateSingleLineHtml(n,{type:X.CONTEXT,prefix:d,content:h,oldNumber:p.oldNumber,newNumber:p.newNumber})});else if(s.length||c.length){let{left:p,right:d}=this.processChangedLines(n,n.isCombined,s,c);r+=p,r+=d}else console.error("Unknown state reached while processing groups of lines",o,s,c)}),r}).join(`
10
+ `)}applyLineGroupping(n){let i=[],t=[],r=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o];(s.type!==M.INSERT&&r.length||s.type===M.CONTEXT&&t.length>0)&&(i.push([[],t,r]),t=[],r=[]),s.type===M.CONTEXT?i.push([[s],[],[]]):s.type===M.INSERT&&t.length===0?i.push([[],[],[s]]):s.type===M.INSERT&&t.length>0?r.push(s):s.type===M.DELETE&&t.push(s)}return(t.length||r.length)&&(i.push([[],t,r]),t=[],r=[]),i}applyRematchMatching(n,i,t){let r=n.length*i.length,o=st(n.concat(i).map(c=>c.content.length));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?t(n,i):[[n,i]]}processChangedLines(n,i,t,r){let o={right:"",left:""},s=Math.max(t.length,r.length);for(let c=0;c<s;c++){let p=t[c],d=r[c],h=p!==void 0&&d!==void 0?ut(p.content,d.content,i,this.config):void 0,x=p!==void 0&&p.oldNumber!==void 0?Object.assign(Object.assign({},h!==void 0?{prefix:h.oldLine.prefix,content:h.oldLine.content,type:X.DELETE_CHANGES}:Object.assign(Object.assign({},ee(p.content,i)),{type:Pe(p.type)})),{oldNumber:p.oldNumber,newNumber:p.newNumber}):void 0,l=d!==void 0&&d.newNumber!==void 0?Object.assign(Object.assign({},h!==void 0?{prefix:h.newLine.prefix,content:h.newLine.content,type:X.INSERT_CHANGES}:Object.assign(Object.assign({},ee(d.content,i)),{type:Pe(d.type)})),{oldNumber:d.oldNumber,newNumber:d.newNumber}):void 0,{left:u,right:g}=this.generateLineHtml(n,x,l);o.left+=u,o.right+=g}return o}generateLineHtml(n,i,t){return{left:this.generateSingleLineHtml(n,i),right:this.generateSingleLineHtml(n,t)}}generateSingleLineHtml(n,i){if(i===void 0)return"";let t=this.hoganUtils.render(ni,"numbers",{oldNumber:i.oldNumber||"",newNumber:i.newNumber||""});return this.hoganUtils.render(We,"line",{type:i.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:i.prefix===" "?"&nbsp;":i.prefix,content:i.content,lineNumber:t,line:i,file:n})}};var $t=Object.assign(Object.assign({},we),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Be="generic",Tr="side-by-side",Fr="icon",Lr="tag",ze=class{constructor(n,i={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},$t),i)}render(n){let i=n.map(t=>{let r;return t.blocks.length?r=this.generateFileHtml(t):r=this.generateEmptyDiff(),this.makeFileDiffHtml(t,r)}).join(`
11
+ `);return this.hoganUtils.render(Be,"wrapper",{colorScheme:Re(this.config.colorScheme),content:i})}makeFileDiffHtml(n,i){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";let t=this.hoganUtils.template(Tr,"file-diff"),r=this.hoganUtils.template(Be,"file-path"),o=this.hoganUtils.template(Fr,"file"),s=this.hoganUtils.template(Lr,Me(n));return t.render({file:n,fileHtmlId:De(n),diffs:i,filePath:r.render({fileDiffName:ke(n)},{fileIcon:o,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Be,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:X})}}generateFileHtml(n){let i=Ne(Le(t=>ee(t.content,n.isCombined).content));return n.blocks.map(t=>{let r={left:this.makeHeaderHtml(t.header,n),right:this.makeHeaderHtml("")};return this.applyLineGroupping(t).forEach(([o,s,c])=>{if(s.length&&c.length&&!o.length)this.applyRematchMatching(s,c,i).map(([p,d])=>{let{left:h,right:x}=this.processChangedLines(n.isCombined,p,d);r.left+=h,r.right+=x});else if(o.length)o.forEach(p=>{let{prefix:d,content:h}=ee(p.content,n.isCombined),{left:x,right:l}=this.generateLineHtml({type:X.CONTEXT,prefix:d,content:h,number:p.oldNumber},{type:X.CONTEXT,prefix:d,content:h,number:p.newNumber});r.left+=x,r.right+=l});else if(s.length||c.length){let{left:p,right:d}=this.processChangedLines(n.isCombined,s,c);r.left+=p,r.right+=d}else console.error("Unknown state reached while processing groups of lines",o,s,c)}),r}).reduce((t,r)=>({left:t.left+r.left,right:t.right+r.right}),{left:"",right:""})}applyLineGroupping(n){let i=[],t=[],r=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o];(s.type!==M.INSERT&&r.length||s.type===M.CONTEXT&&t.length>0)&&(i.push([[],t,r]),t=[],r=[]),s.type===M.CONTEXT?i.push([[s],[],[]]):s.type===M.INSERT&&t.length===0?i.push([[],[],[s]]):s.type===M.INSERT&&t.length>0?r.push(s):s.type===M.DELETE&&t.push(s)}return(t.length||r.length)&&(i.push([[],t,r]),t=[],r=[]),i}applyRematchMatching(n,i,t){let r=n.length*i.length,o=st(n.concat(i).map(c=>c.content.length));return r<this.config.matchingMaxComparisons&&o<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?t(n,i):[[n,i]]}makeHeaderHtml(n,i){return this.hoganUtils.render(Be,"block-header",{CSSLineClass:X,blockHeader:i?.isTooBig?n:ge(n),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(n,i,t){let r={right:"",left:""},o=Math.max(i.length,t.length);for(let s=0;s<o;s++){let c=i[s],p=t[s],d=c!==void 0&&p!==void 0?ut(c.content,p.content,n,this.config):void 0,h=c!==void 0&&c.oldNumber!==void 0?Object.assign(Object.assign({},d!==void 0?{prefix:d.oldLine.prefix,content:d.oldLine.content,type:X.DELETE_CHANGES}:Object.assign(Object.assign({},ee(c.content,n)),{type:Pe(c.type)})),{number:c.oldNumber}):void 0,x=p!==void 0&&p.newNumber!==void 0?Object.assign(Object.assign({},d!==void 0?{prefix:d.newLine.prefix,content:d.newLine.content,type:X.INSERT_CHANGES}:Object.assign(Object.assign({},ee(p.content,n)),{type:Pe(p.type)})),{number:p.newNumber}):void 0,{left:l,right:u}=this.generateLineHtml(h,x);r.left+=l,r.right+=u}return r}generateLineHtml(n,i){return{left:this.generateSingleHtml(n),right:this.generateSingleHtml(i)}}generateSingleHtml(n){let i="d2h-code-side-linenumber",t="d2h-code-side-line";return this.hoganUtils.render(Be,"line",{type:n?.type||`${X.CONTEXT} d2h-emptyplaceholder`,lineClass:n!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,contentClass:n!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,prefix:n?.prefix===" "?"&nbsp;":n?.prefix,content:n?.content,lineNumber:n?.number})}};var Xt=rn(Gt());var V=rn(Gt()),j={};j["file-summary-line"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<li class="d2h-file-list-line">'),t.b(`
12
12
  `+i),t.b(' <span class="d2h-file-name-wrapper">'),t.b(`
13
13
  `+i),t.b(t.rp("<fileIcon0",e,n," ")),t.b(' <a href="#'),t.b(t.v(t.f("fileHtmlId",e,n,0))),t.b('" class="d2h-file-name">'),t.b(t.v(t.f("fileName",e,n,0))),t.b("</a>"),t.b(`
14
14
  `+i),t.b(' <span class="d2h-file-stats">'),t.b(`
@@ -16,7 +16,7 @@ var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDe
16
16
  `+i),t.b(' <span class="d2h-lines-deleted">'),t.b(t.v(t.f("deletedLines",e,n,0))),t.b("</span>"),t.b(`
17
17
  `+i),t.b(" </span>"),t.b(`
18
18
  `+i),t.b(" </span>"),t.b(`
19
- `+i),t.b("</li>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});j["file-summary-wrapper"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-file-list-wrapper '),t.b(t.v(t.f("colorScheme",e,n,0))),t.b('">'),t.b(`
19
+ `+i),t.b("</li>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});j["file-summary-wrapper"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-file-list-wrapper '),t.b(t.v(t.f("colorScheme",e,n,0))),t.b('">'),t.b(`
20
20
  `+i),t.b(' <div class="d2h-file-list-header">'),t.b(`
21
21
  `+i),t.b(' <span class="d2h-file-list-title">Files changed ('),t.b(t.v(t.f("filesNumber",e,n,0))),t.b(")</span>"),t.b(`
22
22
  `+i),t.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),t.b(`
@@ -25,24 +25,24 @@ var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDe
25
25
  `+i),t.b(' <ol class="d2h-file-list">'),t.b(`
26
26
  `+i),t.b(" "),t.b(t.t(t.f("files",e,n,0))),t.b(`
27
27
  `+i),t.b(" </ol>"),t.b(`
28
- `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["generic-block-header"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
28
+ `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["generic-block-header"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
29
29
  `+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",e,n,0))),t.b(" "),t.b(t.v(t.d("CSSLineClass.INFO",e,n,0))),t.b('"></td>'),t.b(`
30
30
  `+i),t.b(' <td class="'),t.b(t.v(t.d("CSSLineClass.INFO",e,n,0))),t.b('">'),t.b(`
31
31
  `+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",e,n,0))),t.b('">'),t.s(t.f("blockHeader",e,n,1),e,n,0,156,173,"{{ }}")&&(t.rs(e,n,function(r,o,s){s.b(s.t(s.f("blockHeader",r,o,0)))}),e.pop()),t.s(t.f("blockHeader",e,n,1),e,n,1,0,0,"")||t.b("&nbsp;"),t.b("</div>"),t.b(`
32
32
  `+i),t.b(" </td>"),t.b(`
33
- `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-empty-diff"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
33
+ `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-empty-diff"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
34
34
  `+i),t.b(' <td class="'),t.b(t.v(t.d("CSSLineClass.INFO",e,n,0))),t.b('">'),t.b(`
35
35
  `+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",e,n,0))),t.b('">'),t.b(`
36
36
  `+i),t.b(" File without changes"),t.b(`
37
37
  `+i),t.b(" </div>"),t.b(`
38
38
  `+i),t.b(" </td>"),t.b(`
39
- `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-file-path"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-file-name-wrapper">'),t.b(`
39
+ `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-file-path"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-file-name-wrapper">'),t.b(`
40
40
  `+i),t.b(t.rp("<fileIcon0",e,n," ")),t.b(' <span class="d2h-file-name">'),t.b(t.v(t.f("fileDiffName",e,n,0))),t.b("</span>"),t.b(`
41
41
  `+i),t.b(t.rp("<fileTag1",e,n," ")),t.b("</span>"),t.b(`
42
42
  `+i),t.b('<label class="d2h-file-collapse">'),t.b(`
43
43
  `+i),t.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),t.b(`
44
44
  `+i),t.b(" Viewed"),t.b(`
45
- `+i),t.b("</label>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});j["generic-line"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
45
+ `+i),t.b("</label>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});j["generic-line"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b(`
46
46
  `+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",e,n,0))),t.b(" "),t.b(t.v(t.f("type",e,n,0))),t.b('">'),t.b(`
47
47
  `+i),t.b(" "),t.b(t.t(t.f("lineNumber",e,n,0))),t.b(`
48
48
  `+i),t.b(" </td>"),t.b(`
@@ -54,23 +54,23 @@ var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDe
54
54
  `+i)}),e.pop()),t.s(t.f("content",e,n,1),e,n,1,0,0,"")||(t.b(' <span class="d2h-code-line-ctn"><br></span>'),t.b(`
55
55
  `+i)),t.b(" </div>"),t.b(`
56
56
  `+i),t.b(" </td>"),t.b(`
57
- `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-wrapper"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-wrapper '),t.b(t.v(t.f("colorScheme",e,n,0))),t.b('">'),t.b(`
57
+ `+i),t.b("</tr>"),t.fl()},partials:{},subs:{}});j["generic-wrapper"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-wrapper '),t.b(t.v(t.f("colorScheme",e,n,0))),t.b('">'),t.b(`
58
58
  `+i),t.b(" "),t.b(t.t(t.f("content",e,n,0))),t.b(`
59
- `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["icon-file-added"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),t.b(`
59
+ `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["icon-file-added"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),t.b(`
60
60
  `+i),t.b(' width="14">'),t.b(`
61
61
  `+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),t.b(`
62
- `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-changed"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),t.b(`
62
+ `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-changed"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),t.b(`
63
63
  `+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b(`
64
64
  `+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),t.b(`
65
- `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-deleted"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),t.b(`
65
+ `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-deleted"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),t.b(`
66
66
  `+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b(`
67
67
  `+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),t.b(`
68
- `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-renamed"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),t.b(`
68
+ `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file-renamed"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),t.b(`
69
69
  `+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b(`
70
70
  `+i),t.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),t.b(`
71
- `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),t.b(`
71
+ `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["icon-file"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),t.b(`
72
72
  `+i),t.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),t.b(`
73
- `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["line-by-line-file-diff"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",e,n,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",e,n,0))),t.b('">'),t.b(`
73
+ `+i),t.b("</svg>"),t.fl()},partials:{},subs:{}});j["line-by-line-file-diff"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",e,n,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",e,n,0))),t.b('">'),t.b(`
74
74
  `+i),t.b(' <div class="d2h-file-header">'),t.b(`
75
75
  `+i),t.b(" "),t.b(t.t(t.f("filePath",e,n,0))),t.b(`
76
76
  `+i),t.b(" </div>"),t.b(`
@@ -83,8 +83,8 @@ var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDe
83
83
  `+i),t.b(" </table>"),t.b(`
84
84
  `+i),t.b(" </div>"),t.b(`
85
85
  `+i),t.b(" </div>"),t.b(`
86
- `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["line-by-line-numbers"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="line-num1">'),t.b(t.v(t.f("oldNumber",e,n,0))),t.b("</div>"),t.b(`
87
- `+i),t.b('<div class="line-num2">'),t.b(t.v(t.f("newNumber",e,n,0))),t.b("</div>"),t.fl()},partials:{},subs:{}});j["side-by-side-file-diff"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",e,n,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",e,n,0))),t.b('">'),t.b(`
86
+ `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["line-by-line-numbers"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div class="line-num1">'),t.b(t.v(t.f("oldNumber",e,n,0))),t.b("</div>"),t.b(`
87
+ `+i),t.b('<div class="line-num2">'),t.b(t.v(t.f("newNumber",e,n,0))),t.b("</div>"),t.fl()},partials:{},subs:{}});j["side-by-side-file-diff"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",e,n,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",e,n,0))),t.b('">'),t.b(`
88
88
  `+i),t.b(' <div class="d2h-file-header">'),t.b(`
89
89
  `+i),t.b(" "),t.b(t.t(t.f("filePath",e,n,0))),t.b(`
90
90
  `+i),t.b(" </div>"),t.b(`
@@ -108,7 +108,7 @@ var Ii=Object.create;var nn=Object.defineProperty;var Hi=Object.getOwnPropertyDe
108
108
  `+i),t.b(" </div>"),t.b(`
109
109
  `+i),t.b(" </div>"),t.b(`
110
110
  `+i),t.b(" </div>"),t.b(`
111
- `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["tag-file-added"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-changed"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-deleted"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-renamed"]=new z.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),t.fl()},partials:{},subs:{}});var $e=class{constructor({compiledTemplates:n={},rawTemplates:i={}}){let t=Object.entries(i).reduce((r,[o,s])=>{let d=Gt.compile(s,{asString:!1});return Object.assign(Object.assign({},r),{[o]:d})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},j),n),t)}static compile(n){return Gt.compile(n,{asString:!1})}render(n,i,t,r,o){let s=this.templateKey(n,i);try{return this.preCompiledTemplates[s].render(t,r,o)}catch{throw new Error(`Could not find template to render '${s}'`)}}template(n,i){return this.preCompiledTemplates[this.templateKey(n,i)]}templateKey(n,i){return`${n}-${i}`}};var Lr=Object.assign(Object.assign(Object.assign({},Bt),zt),{outputFormat:Bn.LINE_BY_LINE,drawFileList:!0});function si(e,n={}){let i=Object.assign(Object.assign({},Lr),n),t=typeof e=="string"?Kn(e,i):e,r=new $e(i),{colorScheme:o}=i,s={colorScheme:o},d=i.drawFileList?new ut(r,s).render(t):"",p=i.outputFormat==="side-by-side"?new ze(r,i).render(t):new je(r,i).render(t);return d+p}var Nr=0;function a(e,n,i,t,r,o){n||(n={});var s,d,p=n;if("ref"in p)for(d in p={},n)d=="ref"?s=n[d]:p[d]=n[d];var c={type:e,props:p,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nr,__i:-1,__u:0,__source:r,__self:o};if(typeof e=="function"&&(s=e.defaultProps))for(d in s)p[d]===void 0&&(p[d]=s[d]);return D.vnode&&D.vnode(c),c}function Pr(e){return si(e,{outputFormat:"line-by-line",drawFileList:!1,matching:"none",diffStyle:"word"})}function Xt({diff:e}){let n=At(()=>e.trim()?Pr(e):"",[e]);return n?a("div",{class:"diff",role:"region","aria-label":"Diff",tabIndex:0,dangerouslySetInnerHTML:{__html:n}}):null}var Rr={starting:["The change didn't start","starting the change"],planning:["Revyse couldn't plan the change","planning the change"],patching:["Revyse couldn't write the change","writing the change"],applying:["The change couldn't be applied","applying the change to your files"],checking:["The checks didn't finish","running your project's checks"],reporting:["The result wasn't saved","saving the result to Revyse"],reverting:["The change couldn't be reverted","reverting the change"],accepting:["The change wasn't kept","keeping the change"]},Yt=e=>{let n=Math.round(e*10)/10;return`${n.toFixed(1)} ${n===1?"credit":"credits"}`},di={running:["\u2026","Running"],passed:["\u2713","Passed"],failed:["\u2715","Failed"],skipped:["\u2013","Skipped"],not_run:["\u2013","Not run"]},Kt={typecheck:"Typecheck",lint:"Lint",test:"Tests",build:"Build",browser:"Browser",visual:"Visual"},Me=(e,n)=>`${e} ${n}${e===1?"":"s"}`,Dr=e=>e.source?`${e.source.file}${e.source.line?`:${e.source.line}`:""}`:void 0;function Or({status:e}){return a("p",{class:"status","data-status":e,role:"status",children:[a("span",{class:"dot","aria-hidden":"true"}),a("span",{children:"Connected"})]})}function Mr({live:e,onAction:n}){return a("div",{class:"live-status",role:"group","aria-label":"Live session",children:[a("span",{class:"live-chip",title:"Signed in to Revyse as",children:[a("span",{class:"dot","aria-hidden":"true"}),e.email]}),a("span",{class:"live-chip",title:"Revyse project",children:e.project}),a("button",{type:"button",class:"signout",onClick:()=>n({type:"signout"}),children:"Sign out"})]})}var Ir={queued:["\u2026","Preview queued"],building:["\u2026","Preview building"],ready:["\u2713","Preview ready"],error:["\u2715","Preview failed to build"],canceled:["\u2013","Preview cancelled"]},Hr={awaiting_approval:["\u2026","Waiting for approval","running"],approved:["\u2713","Approved","passed"],released:["\u2713","Merged and released","passed"],rejected:["\u2715","Rejected","failed"]};function Ur({cloud:e}){let n=e.preview?Ir[e.preview.status]:null,i=e.pullRequestUrl?Hr[e.state]:void 0;return a("div",{class:"cloud","data-cloud-state":e.state,children:[e.pullRequestUrl&&a("ul",{class:"checks","aria-label":"Where the change is",children:[a("li",{"data-check":"passed","data-step":"pull_request",children:[a("span",{class:"check-icon","aria-hidden":"true",children:"\u2713"}),a("span",{class:"check-name",children:"Pull request open"}),a("a",{class:"link",href:e.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:"View"})]}),a("li",{"data-check":e.preview?.status==="ready"?"passed":e.preview?.status==="error"?"failed":"running","data-step":"preview",children:[a("span",{class:"check-icon","aria-hidden":"true",children:n?.[0]??"\u2026"}),a("span",{class:"check-name",children:n?.[1]??"Waiting for the preview"}),e.preview?.status==="ready"&&e.preview.url&&a("a",{class:"link",href:e.preview.url,target:"_blank",rel:"noopener noreferrer",children:"Open"})]}),i&&a("li",{"data-check":i[2],"data-step":"approval",children:[a("span",{class:"check-icon","aria-hidden":"true",children:i[0]}),a("span",{class:"check-name",children:i[1]})]})]}),a("p",{class:"meta",children:a("a",{class:"link",href:e.changeUrl,target:"_blank",rel:"noopener noreferrer",children:"Open this change on Revyse"})})]})}function Wr({context:e,onClear:n}){return a("div",{class:"chip",role:"group","aria-label":"Selected element",children:[a("div",{class:"chip-main",children:[a("code",{children:["<",e.tagName,">"]}),e.text&&a("span",{class:"chip-text",children:e.text.slice(0,60)})]}),a("div",{class:"chip-where",children:Dr(e)??"Source not found \u2014 Revyse will search for it"}),a("button",{type:"button",class:"chip-clear","aria-label":"Clear selection",onClick:n,children:"\xD7"})]})}function ai({text:e}){return a(Q,{children:e.split("`").map((n,i)=>i%2?a("code",{children:n},i):n)})}function B({kind:e,icon:n,title:i,tone:t,children:r}){return a("div",{class:"state","data-state":e,"data-tone":t,role:t==="error"?"alert":"status","aria-busy":t==="progress"?"true":void 0,children:[a("span",{class:"state-icon","aria-hidden":"true",children:t==="progress"?a("span",{class:"spinner"}):n}),a("div",{class:"state-main",children:[a("h3",{class:"state-title",children:i}),r]})]})}function me({items:e,onAction:n}){return a("div",{class:"actions",children:e.map(i=>a("button",{type:"button",class:i.primary?"primary":"secondary",onClick:()=>n(i.action),children:i.label},i.label))})}function jr({onAction:e}){let[n,i]=$("");return a("form",{class:"answer",onSubmit:t=>{t.preventDefault(),n.trim()&&e({type:"answer",text:n.trim()})},children:[a("label",{class:"field-label",for:"revyse-answer",children:"Your answer"}),a("textarea",{id:"revyse-answer",rows:3,value:n,onInput:t=>i(t.target.value)}),a("div",{class:"actions",children:[a("button",{type:"submit",class:"primary",disabled:!n.trim(),children:"Send answer"}),a("button",{type:"button",class:"secondary",onClick:()=>e({type:"cancel"}),children:"Cancel"})]})]})}var Br=e=>`${e.label} \xB7 \xD7${e.creditWeight}${e.allowed?e.available?"":" (not set up)":" (turned off)"}`;function zr(){return a("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:a("path",{d:"M8 13V3M3.5 7.5 8 3l4.5 4.5",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"})})}function $r(){return a("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:[a("circle",{cx:"8",cy:"8",r:"4.5",fill:"none",stroke:"currentColor","stroke-width":"1.5"}),a("path",{d:"M8 1v3M8 12v3M1 8h3M12 8h3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})]})}function Vr(){return a("svg",{viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true",children:a("path",{d:"M10.5 4.5 5.8 9.2a1.3 1.3 0 0 0 1.8 1.8l4.9-4.9a2.6 2.6 0 0 0-3.7-3.7L3.9 7.3a3.9 3.9 0 0 0 5.5 5.5L13 9.2",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})}var li=200;function qr(e){let n=Z(null);return ue(()=>{let i=n.current;if(!i)return;let t=i.offsetHeight;i.style.transition="none",i.style.height="0px";let r=i.scrollHeight;if(i.style.height=t?`${t}px`:"",!r||!t){i.style.height="",i.style.transition="";return}i.offsetHeight,i.style.transition="",i.style.height=`${Math.min(r,li)}px`,i.style.overflowY=r>li?"auto":"hidden"},[e]),n}var Gr="image/png,image/jpeg,image/webp",Xr=5*1024*1024;function Yr({context:e,models:n,selecting:i,selectButtonRef:t,onToggleSelect:r,onClearSelection:o,onAction:s,live:d=!1}){let[p,c]=$(""),[f,x]=$(null),[l,u]=$(null),[b,h]=$(""),g=n?.models.find(L=>L.id===n.defaultModel)?.label,w=n?.models.find(L=>L.id===b),m=!!(e&&p.trim()),S=qr(p),A=i?"Cancel selection":e?"Select another element":"Select an element",F=()=>{e&&p.trim()&&s({type:"start",prompt:p.trim(),element:e,...b?{model:b}:{},...f?{screenshot:f}:{}})};return a("form",{class:"composer",onSubmit:L=>{L.preventDefault(),F()},children:[a("div",{class:"box",children:[e&&!i&&a(Wr,{context:e,onClear:o}),a("div",{class:"line",children:[a("label",{class:"visually-hidden",for:"revyse-prompt",children:"Describe the change"}),a("textarea",{ref:S,id:"revyse-prompt",class:"prompt",rows:1,maxLength:4e3,"data-autofocus":!0,placeholder:e?"What should change about it?":"Select an element, then say what should change",value:p,onInput:L=>c(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!L.isComposing&&(L.preventDefault(),F())}}),a("button",{ref:t,type:"button",class:"select-toggle tool",title:A,"aria-pressed":i,onClick:r,children:[a($r,{}),a("span",{class:"tool-label",children:A})]}),d&&a("label",{class:"tool attach",title:f?"Change screenshot":"Attach a screenshot",children:[a("input",{type:"file",class:"visually-hidden",accept:Gr,onChange:L=>{let v=L.target,y=v.files?.[0]??null;if(v.value="",y&&y.size>Xr){u("Screenshots are limited to 5 MB.");return}u(null),x(y)}}),a(Vr,{}),a("span",{class:"tool-label",children:f?"Change screenshot":"Attach a screenshot"})]}),a("span",{class:"toolbar-end",children:[n&&a(Q,{children:[a("label",{class:"visually-hidden",for:"revyse-model",children:"Model"}),a("select",{id:"revyse-model",class:"tier",title:w?`${w.description}. About ${w.typicalCredits} credits a change.`:"The organization's default model",value:b,onChange:L=>h(L.target.value),children:[a("option",{value:"",children:["Default",g?` \xB7 ${g}`:""]}),n.models.map(L=>a("option",{value:L.id,disabled:!L.allowed||!L.available,children:Br(L)},L.id))]})]}),a("button",{type:"submit",class:"send","aria-label":"Plan the change",disabled:!m,children:a(zr,{})})]})]})]}),(f||l)&&a("p",{class:"meta attachment",role:l?"alert":void 0,children:l??a(Q,{children:["Screenshot: ",f.name," ",a("button",{type:"button",class:"signout",onClick:()=>x(null),children:"Remove"})]})})]})}function ui({turns:e}){return e.length===0?null:a("ol",{class:"conversation","aria-label":"Conversation",children:e.map((n,i)=>a("li",{"data-role":n.role,children:[a("span",{class:"who",children:n.role==="user"?"You":"Revyse"}),a("span",{class:"said",children:n.text})]},i))})}function ft({items:e,onAction:n}){let[i,t]=$(!1),[r,o]=$("");return i?a("form",{class:"answer",onSubmit:s=>{s.preventDefault(),r.trim()&&n({type:"revise",text:r.trim()})},children:[a("label",{class:"field-label",for:"revyse-revision",children:"What should be different?"}),a("textarea",{id:"revyse-revision",rows:3,maxLength:2e3,value:r,onInput:s=>o(s.target.value)}),a("div",{class:"actions",children:[a("button",{type:"submit",class:"primary",disabled:!r.trim(),children:"Send revision"}),a("button",{type:"button",class:"secondary",onClick:()=>t(!1),children:"Back"})]})]}):a("div",{class:"actions",children:e.map(s=>a("button",{type:"button",class:s.primary?"primary":"secondary",onClick:()=>s.action==="revise"?t(!0):n(s.action),children:s.label},s.label))})}var Kr=e=>e<1e3?"<1 s":`${(e/1e3).toFixed(1)} s`;function ci({items:e}){if(!e||e.length===0)return null;let n=e.slice(-6);return a("ol",{class:"activity","aria-label":"What Revyse is doing","aria-live":"polite",children:[e.length>n.length&&a("li",{class:"meta",children:Me(e.length-n.length,"earlier step")}),n.map((i,t)=>a("li",{"data-done":i.ms!==void 0,children:[a("span",{children:i.text}),a("span",{class:"took",children:i.ms!==void 0?Kr(i.ms):"\u2026"})]},e.length-n.length+t))]})}function Jt({envVars:e,notDone:n,sensitive:i}){return a(Q,{children:[i&&i.length>0&&a("p",{class:"note sensitive",children:["Touches sensitive areas: ",i.join(", "),". Review these parts carefully."]}),e&&e.length>0&&a("p",{class:"note",children:["Needs ",e.length===1?"this variable":"these variables"," set where the app runs:"," ",e.map(t=>a("code",{children:t},t))]}),n&&n.length>0&&a("div",{class:"note",children:[a("p",{children:"Not part of this change:"}),a("ul",{children:n.map(t=>a("li",{children:t},t))})]})]})}function Jr({state:e,onAction:n,live:i=!1}){return a(B,{kind:"plan",icon:"\u270E",title:"Here's the plan",tone:"info",children:[a(ui,{turns:e.conversation}),a("p",{class:"state-text plan-summary",children:e.plan.summary}),e.plan.steps.length>0&&a("ol",{class:"steps",children:e.plan.steps.map((t,r)=>a("li",{children:[a("span",{children:t.description}),t.files.map(o=>a("code",{children:o},o))]},r))}),a(Jt,{envVars:e.plan.envVars,notDone:e.plan.notDoing,sensitive:e.plan.sensitive}),a("p",{class:"meta",children:["Planned with ",e.model,e.cost!==void 0&&` for ${Yt(e.cost)}`,"."," ",i?"Applying makes the change on a branch, runs your checks and opens a pull request with a preview. Your site stays as it is.":"Nothing is changed until you apply it."]}),a(ft,{items:[{label:"Apply the change",action:{type:"approve"},primary:!0},{label:"Revise",action:"revise"},{label:"Cancel",action:{type:"cancel"}}],onAction:n})]})}function Qr({keys:e,artifactUrl:n}){let[i,t]=$([]);return Ae(()=>{let r=!0,o=[];return Promise.all(e.map(async s=>{let d=n(s);if(!d)return null;let p=await fetch(d,{mode:"cors"}).catch(()=>null);if(!p?.ok)return null;let c=URL.createObjectURL(await p.blob());return o.push(c),{label:/before\.png$/.test(s)?"Before":"After",src:c}})).then(s=>r&&t(s.filter(d=>d!==null))),()=>{r=!1;for(let s of o)URL.revokeObjectURL(s)}},[e.join("|"),n]),i.length===0?null:a("div",{class:"shots",role:"group","aria-label":"Browser check screenshots",children:i.map(r=>a("figure",{children:[a("img",{src:r.src,alt:`${r.label} the change`}),a("figcaption",{children:r.label})]},r.label))})}function pi({checks:e,artifactUrl:n}){if(e.length===0)return a("p",{class:"meta",children:"No checks are configured for this project, so none ran."});let i=e.find(r=>r.kind==="browser"),t=e.find(r=>r.kind==="browser"&&r.status==="failed");return a(Q,{children:[a("ul",{class:"badges","aria-label":"Checks",children:e.map(r=>{let[o,s]=di[r.status],d=r.evidence?.summary??r.reason;return a("li",{class:"badge","data-check":r.status,title:d,children:[a("span",{"aria-hidden":"true",children:o})," ",Kt[r.kind],": ",s]},r.kind)})}),t?.evidence?.summary&&a("pre",{class:"check-output",children:t.evidence.summary}),e.some(r=>r.preExisting)&&a("p",{class:"meta",children:"A check was already failing before this change, with the same errors, so it doesn't count against it."}),n&&i?.evidence?.artifactKeys?.length?a(Qr,{keys:i.evidence.artifactKeys,artifactUrl:n}):null]})}function Zr({state:e,onAction:n,artifactUrl:i}){let{result:t}=e,r=t.state==="failed";return a(B,{kind:"result",icon:r?"\u2715":"\u2713",title:r?"Applied, but checks failed":"Ready for review",tone:r?"error":"info",children:[a("p",{class:"state-text",children:r?"The change is in your files, but some checks failed. Revise it or revert it.":"The change is in your files. Check it on the page and in the diff below."}),t.summary&&a("p",{class:"state-text summary",children:t.summary}),a("ul",{class:"files changed",children:t.files.map(o=>a("li",{children:[a("code",{children:o.path})," ",o.kind==="create"&&a("span",{class:"kind",children:"new"}),o.kind==="delete"&&a("span",{class:"kind deleted",children:"deleted"}),a("span",{class:"counts","aria-label":`${Me(o.additions,"line")} added, ${Me(o.deletions,"line")} removed`,children:[a("span",{class:"add",children:["+",o.additions]})," ",a("span",{class:"del",children:["\u2212",o.deletions]})]}),o.explanation&&a("span",{class:"explanation",children:o.explanation})]},o.path))}),a(Jt,{envVars:t.envVars,notDone:t.notDone,sensitive:t.sensitive}),a(pi,{checks:t.checks,artifactUrl:i}),t.cost!==void 0&&a("p",{class:"meta cost",children:["This change has cost ",Yt(t.cost),"."]}),a(Xt,{diff:t.diff}),e.conversation.length>0&&a("details",{class:"history",children:[a("summary",{children:["Conversation (",e.conversation.length,")"]}),a(ui,{turns:e.conversation})]}),a(ft,{items:[{label:"Keep the change",action:{type:"accept"},primary:!r},{label:"Revise",action:"revise",primary:r},{label:"Revert",action:{type:"revert"}}],onAction:n})]})}function eo({state:e,cloud:n,onAction:i}){let{result:t}=e,r=t.state==="failed",o=n?.state==="released";return a(B,{kind:"result",icon:r?"\u2715":"\u2713",title:r?"Checks failed":o?"Merged and released":n?.pullRequestUrl?"Pull request open":"Ready for review",tone:r?"error":"info",children:[a("p",{class:"state-text",children:r?"Some checks failed, so no pull request was opened. Revise the change, or start another.":o?"The pull request was merged, so the change is on its way to your site.":"An approver reviews it on Revyse and it is merged on GitHub; your site changes only then. Open the preview to see it."}),t.summary&&a("p",{class:"state-text summary",children:t.summary}),a("ul",{class:"files changed",children:t.files.map(s=>a("li",{children:[a("code",{children:s.path})," ",s.kind==="create"&&a("span",{class:"kind",children:"new"}),s.kind==="delete"&&a("span",{class:"kind deleted",children:"deleted"}),a("span",{class:"counts","aria-label":`${Me(s.additions,"line")} added, ${Me(s.deletions,"line")} removed`,children:[a("span",{class:"add",children:["+",s.additions]})," ",a("span",{class:"del",children:["\u2212",s.deletions]})]})]},s.path))}),a(Jt,{envVars:t.envVars,notDone:t.notDone,sensitive:t.sensitive}),a(pi,{checks:t.checks}),t.cost!==void 0&&a("p",{class:"meta cost",children:["This change has cost ",Yt(t.cost),"."]}),a("details",{class:"history",children:[a("summary",{children:"The diff"}),a(Xt,{diff:t.diff})]}),a(ft,{items:[...o?[]:[{label:"Revise",action:"revise",primary:r}],{label:"Start another change",action:{type:"dismiss"},primary:!r}],onAction:i})]})}var to={accepted:["\u2713","Change kept",()=>"It's in your working tree. Review and commit it as you normally would."],reverted:["\u21BA","Change reverted",e=>e&&e.length>0?`Restored ${Me(e.length,"file")} to how ${e.length===1?"it was":"they were"} before Revyse changed ${e.length===1?"it":"them"}.`:"Your files are as they were before this change."],cancelled:["\u2013","Change cancelled",()=>"Revyse stopped working on it."]},no=new Set(["queued","planning","clarification","plan","applying","checking","result","failed","finished"]);function fi(e){let n=e.live?.cloud;return a(Q,{children:[a(io,{...e}),n&&no.has(e.state.kind)&&a(Ur,{cloud:n})]})}function io({state:e,models:n,artifactUrl:i,selecting:t=!1,selectButtonRef:r,onToggleSelect:o=()=>{},onClearSelection:s=()=>{},onAction:d=()=>{},live:p,touch:c=!1}){switch(e.kind){case"connecting":return p?a(B,{kind:"connecting",icon:"\u2026",title:"Connecting to Revyse\u2026",tone:"progress"}):a(B,{kind:"connecting",icon:"\u2026",title:"Connecting to Revyse\u2026",tone:"progress",children:a("p",{class:"state-text",children:"This takes a moment after the dev server starts."})});case"disconnected":return p?e.reason==="not_running"?a(B,{kind:"disconnected",icon:"!",title:"Reconnecting to Revyse\u2026",tone:"error",children:a("p",{class:"state-text",children:"The connection dropped. Revyse keeps trying, and your change carries on in the cloud meanwhile."})}):a(B,{kind:"disconnected",icon:"!",title:"Your live session has ended",tone:"error",children:[a("p",{class:"state-text",children:"Sign in again to keep requesting changes on this site. Changes you already asked for carry on; they are on the Revyse dashboard."}),a(me,{items:[{label:"Sign in again",action:{type:"signin"},primary:!0}],onAction:d})]}):e.reason==="not_running"?a(B,{kind:"disconnected",icon:"!",title:"Not connected",tone:"error",children:a("p",{class:"state-text",children:a(ai,{text:"Revyse runs with your dev server. Start it again (`npm run dev`) and this page reconnects on its own."})})}):a(B,{kind:"disconnected",icon:"!",title:"This page isn't connected",tone:"error",children:[a("p",{class:"state-text",children:"Revyse didn't accept this page's address. Open your app at an address listed under appOrigins in revyse.config.json."}),a(me,{items:[{label:"Reload page",action:{type:"reload"}}],onAction:d})]});case"unsupported":return a(B,{kind:"unsupported",icon:"\u2298",title:"Revyse can't run here",tone:"info",children:a("p",{class:"state-text",children:e.reason})});case"ready":case"selected":{let f=e.kind==="selected"?e.context:null;return a("div",{class:"state","data-state":e.kind,children:[p?a(Mr,{live:p,onAction:d}):a(Or,{status:"connected"}),a(Yr,{live:!!p,context:f,models:n,selecting:t,selectButtonRef:r,onToggleSelect:o,onClearSelection:s,onAction:d}),a("p",{class:"hint","aria-live":"polite",children:t?c?"Tap the element you want to change.":"Click an element, or use the arrow keys to move and Enter to choose. Esc cancels.":f?p?"Revyse plans the change first. Your site changes only when its pull request is merged.":"Revyse plans the change first; nothing is written until you apply it.":"Select the element you want to change, then send your request."})]})}case"queued":return a(B,{kind:"queued",icon:"\u2026",title:"Waiting for a cloud workspace\u2026",tone:"progress",children:[a("p",{class:"state-text",children:"Revyse picks the change up in a moment, then plans it from your repository."}),a(me,{items:[{label:"Cancel",action:{type:"cancel"}}],onAction:d})]});case"planning":return a(B,{kind:"planning",icon:"\u2026",title:"Planning the change\u2026",tone:"progress",children:[a("blockquote",{class:"quote",children:e.prompt}),a(ci,{items:e.activity}),a(me,{items:[{label:"Cancel",action:{type:"cancel"}}],onAction:d})]});case"clarification":{let f=e.integration;if(f){let x=f.providers[0]??"a provider";return a(B,{kind:"clarification",icon:"\u2699",title:`This needs ${f.capability==="email"?"an email":"a"} service`,tone:"info",children:[a("p",{class:"state-text question",children:f.reason}),a("p",{class:"note",children:["Connect ",f.providers.join(" or ")," on the Revyse dashboard. Keys are entered there, never here."]}),f.connectUrl&&a("p",{children:a("a",{href:f.connectUrl,target:"_blank",rel:"noopener noreferrer",class:"link",children:["Connect ",x," on the dashboard"]})}),a(me,{items:[{label:"I've connected it: plan again",action:{type:"answer",text:`I connected ${x} in Revyse. Plan the change again with it.`},primary:!0},{label:"Cancel",action:{type:"cancel"}}],onAction:d})]})}return a(B,{kind:"clarification",icon:"?",title:"Revyse has a question",tone:"info",children:[a("p",{class:"state-text question",children:e.question}),a(jr,{onAction:d})]})}case"applying":return a(B,{kind:"applying",icon:"\u2026",title:"Applying the change\u2026",tone:"progress",children:e.activity&&e.activity.length>0?a(ci,{items:e.activity}):a("p",{class:"state-text",children:p?"Writing the change on a branch of your repository, in a cloud workspace.":e.files?`Writing ${e.files} ${e.files===1?"file":"files"} in your project.`:"Writing the change to your project."})});case"checking":return a(B,{kind:"checking",icon:"\u2026",title:"Checking the change\u2026",tone:"progress",children:a("ul",{class:"checks",children:e.checks.map(f=>{let[x,l]=di[f.status];return a("li",{"data-check":f.status,children:[a("span",{class:"check-icon","aria-hidden":"true",children:x}),a("span",{class:"check-name",children:f.name}),a("span",{class:"check-status",children:l})]},f.name)})})});case"conflict":{let f=e.reason==="changed_since_apply";return a(B,{kind:"conflict",icon:"\u26A0",title:f?"Files changed after Revyse's edit":"Files changed while Revyse was working",tone:"error",children:[a("p",{class:"state-text",children:e.message??"Nothing was written. These files changed after Revyse read them:"}),a("ul",{class:"files",children:e.files.map(x=>a("li",{children:a("code",{children:x})},x))}),a(me,{items:f?[{label:"Dismiss",action:{type:"dismiss"},primary:!0}]:[{label:"Re-plan with the latest files",action:{type:"refresh"},primary:!0},{label:"Cancel",action:{type:"cancel"}}],onAction:d})]})}case"failed":{let[f,x]=e.stage?Rr[e.stage]:["The change didn't go through",void 0],l=e.next,u=[];return l?(l.includes("replan")&&u.push({label:"Try again",action:{type:"refresh"},primary:!0}),l.includes("revise")&&u.push({label:"Revise",action:"revise",primary:u.length===0}),l.includes("revert")&&u.push({label:"Revert Revyse's edits",action:{type:"revert"}}),l.includes("reload")&&u.push({label:"Reload page",action:{type:"reload"},primary:!0})):e.retryable&&u.push({label:"Try again",action:{type:"retry"},primary:!0}),u.push({label:"Dismiss",action:{type:"dismiss"}}),a(B,{kind:"failed",icon:"\u2715",title:f,tone:"error",children:[x&&a("p",{class:"meta",children:["While ",x,"."," ",e.filesChanged?"Revyse's edits are in your files.":"Your files weren't changed."]}),a("p",{class:"state-text",children:a(ai,{text:e.message})}),a(ft,{items:u,onAction:d})]})}case"plan":return a(Jr,{state:e,onAction:d,live:!!p});case"result":return p?a(eo,{state:e,cloud:p.cloud,onAction:d}):a(Zr,{state:e,onAction:d,artifactUrl:i});case"reverting":return a(B,{kind:"reverting",icon:"\u2026",title:"Reverting the change\u2026",tone:"progress",children:a("p",{class:"state-text",children:"Restoring your files to how they were before Revyse changed them."})});case"finished":{let[f,x,l]=to[e.outcome];return a(B,{kind:"finished",icon:f,title:x,tone:"info",children:[a("p",{class:"state-text",children:l(e.files)}),e.files&&e.files.length>0&&a("ul",{class:"files",children:e.files.map(u=>a("li",{children:a("code",{children:u})},u))}),a(me,{items:[{label:"Start another change",action:{type:"dismiss"},primary:!0}],onAction:d})]})}case"permission_denied":return a(B,{kind:"permission_denied",icon:"\u2298",title:"You don't have permission",tone:"error",children:[a("p",{class:"state-text",children:[e.message??"Your role in this project can't request changes."," Ask a project owner to give you the editor role."]}),a(me,{items:[{label:"Dismiss",action:{type:"dismiss"}}],onAction:d})]});default:return e}}function hi(e){return e.unsupported?{kind:"unsupported",reason:e.unsupported}:e.status==="connecting"?{kind:"connecting"}:e.status==="disconnected"?{kind:"disconnected",reason:"not_running"}:e.status==="rejected"?{kind:"disconnected",reason:"rejected"}:e.flow?e.flow:e.selected?{kind:"selected",context:e.selected}:{kind:"ready"}}function gi(e){return["localhost","127.0.0.1","[::1]","::1"].includes(e.hostname)||e.hostname.endsWith(".localhost")?null:"Revyse local mode only works on your own machine (localhost). Open the app from the address your dev server printed."}var ro={"change.start":e=>({kind:"planning",prompt:e}),"change.answer":e=>({kind:"planning",prompt:e}),"change.revise":e=>({kind:"planning",prompt:e}),"change.refresh":e=>({kind:"planning",prompt:e}),"change.approve":()=>({kind:"applying"}),"change.revert":()=>({kind:"reverting"})};function mi(e){let n=e.now??(()=>Date.now()),i=[],t=0,r,o=null,s=!1,d=[],p=null,c="",f=null,x=()=>[...d];function l(g){p&&d.push(p),p=null,d.push({role:"user",text:g}),c=g}function u(){o=null,s=!1,d=[],p=null,f=null,e.setCloud?.(null)}function b(g){f=g;let w=ro[g.type];w&&e.setFlow(w(c)),g.type==="change.start"&&(s=!0),e.connection.request(g.type,g.payload).then(m=>{g.type!=="change.start"||!s||(s=!1,o=m?.changeId??o)},m=>{g.type==="change.start"&&(s=!1),e.setFlow({kind:"failed",message:m.message,retryable:!0})})}let h=e.connection.onEvent((g,w)=>{if(g==="cloud"){let S=mn(w);if(!S||(!o&&s&&(o=S.changeId),S.changeId!==o))return;e.setCloud?.(S),S.state==="draft"&&e.setFlow({kind:"queued"});return}if(g!=="change")return;let m=hn(w);if(m){if(m.changeId){if(!o&&s&&(o=m.changeId),m.changeId!==o)return}else if(!s)return;switch(m.type){case"planning":return i=[],e.setFlow({kind:"planning",prompt:c});case"plan":return p={role:"revyse",text:m.plan.summary},e.setFlow({kind:"plan",plan:m.plan,model:m.model,cost:m.cost,conversation:x()});case"clarification":return p={role:"revyse",text:m.question},e.setFlow({kind:"clarification",question:m.question,...m.integration?{integration:m.integration}:{}});case"applying":return i=[],r=m.files,e.setFlow({kind:"applying",files:m.files});case"activity":{let S=n(),A=i.at(-1);return A&&A.ms===void 0&&(i=[...i.slice(0,-1),{...A,ms:S-t}]),i=[...i,{text:m.text}],t=S,e.setFlow(m.phase==="plan"?{kind:"planning",prompt:c,activity:i}:{kind:"applying",files:r,activity:i})}case"checking":return e.setFlow({kind:"checking",checks:m.checks.map(S=>({name:Kt[S.kind],status:S.status}))});case"result":{let{state:S,files:A,diff:F,checks:L,cost:v,summary:y,envVars:_,notDone:E,sensitive:R}=m;return e.setFlow({kind:"result",result:{state:S,files:A,diff:F,checks:L,cost:v,summary:y,envVars:_,notDone:E,sensitive:R},conversation:x()})}case"conflict":return e.setFlow({kind:"conflict",files:m.files,reason:m.reason,message:m.message});case"reverted":return e.setFlow({kind:"finished",outcome:"reverted",files:m.files});case"accepted":return e.setFlow({kind:"finished",outcome:"accepted"});case"cancelled":return e.setFlow({kind:"finished",outcome:"cancelled"});case"failed":return e.setFlow({kind:"failed",message:m.message,retryable:m.retryable,stage:m.stage,filesChanged:m.filesChanged,next:m.next});case"permission_denied":return e.setFlow({kind:"permission_denied",message:m.message})}}});return{handle(g){let w=o;switch(g.type){case"start":return u(),l(g.prompt),b({type:"change.start",payload:{prompt:g.prompt,element:g.element,...g.model?{model:g.model}:{},origin:globalThis.location?.origin,...g.screenshot?{screenshot:g.screenshot}:{}}});case"answer":case"revise":return w?(l(g.text),b({type:`change.${g.type}`,payload:{changeId:w,text:g.text}})):void 0;case"approve":case"revert":case"accept":case"refresh":return w?b({type:`change.${g.type}`,payload:{changeId:w}}):void 0;case"cancel":return w?b({type:"change.cancel",payload:{changeId:w}}):(u(),e.setFlow(null));case"retry":f&&b(f);return;case"dismiss":return u(),e.setFlow(null);case"reload":return}},dispose(){h()}}}function bi(e,n=6){let i=[],t=e;for(;t&&t.nodeType===1&&i.length<n;){let r=t.getAttribute("data-testid");if(r){i.unshift(`[data-testid="${CSS.escape(r)}"]`);break}if(t.id){i.unshift(`#${CSS.escape(t.id)}`);break}let o=t.tagName.toLowerCase(),s=t.parentElement;if(s){let d=Array.from(s.children).filter(p=>p.tagName===t.tagName);d.length>1&&(o+=`:nth-of-type(${d.indexOf(t)+1})`)}i.unshift(o),t=s}return i.join(" > ")}var vi=500;function _i(e){return e.closest("[data-revyse-ignore]")?!0:e instanceof HTMLInputElement?["password","hidden"].includes(e.type)||/cc-|card|cvc|cvv/i.test(e.autocomplete):!1}var oo="input, textarea, select, option, optgroup, datalist, [contenteditable]:not([contenteditable=false])",Qt=e=>e.matches(oo)||!!e.closest("[contenteditable]:not([contenteditable=false])");function wi(e){let n="",i=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:t=>{if(t.nodeType===Node.TEXT_NODE)return NodeFilter.FILTER_ACCEPT;let r=t;return r.matches("script, style, template, noscript, [data-revyse-ignore]")||Qt(r)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}});for(let t=i.nextNode();t&&n.length<=vi*2;t=i.nextNode())n+=` ${t.nodeValue??""}`;return n.replace(/\s+/g," ").trim().slice(0,vi)}var yi=["header","nav","main","footer","aside","section","article","form","dialog",...["banner","navigation","main","contentinfo","complementary","region","dialog"].map(e=>`[role=${e}]`)].join(", ");function so(e){let n=[],i=e.ownerDocument;for(let t=e.parentElement;t&&n.length<6&&!(t===i.body||t===i.documentElement);t=t.parentElement)n.push({tagName:t.tagName.toLowerCase(),...t.id?{id:t.id.slice(0,256)}:{},classList:Array.from(t.classList).slice(0,20)});return n}function ao(e){let n=[];for(let i=e.parentElement?.closest(yi)??null;i&&n.length<4;i=i.parentElement?.closest(yi)??null){let t=i.querySelector("h1, h2, h3, h4, h5, h6"),r=i.getAttribute("aria-label")??(t&&!_i(t)?wi(t):void 0),o=i.getAttribute("role");n.push({tagName:i.tagName.toLowerCase(),...o?{role:o}:{},...r?{label:r.slice(0,120)}:{}})}return n}function ki(e,n=location.pathname){let i=e.getBoundingClientRect(),t=_i(e)||Qt(e)?void 0:wi(e)||void 0;return{route:n,selector:bi(e),tagName:e.tagName.toLowerCase(),text:t,role:e.getAttribute("role")??void 0,ariaLabel:Qt(e)?void 0:e.getAttribute("aria-label")??void 0,classList:Array.from(e.classList).slice(0,100),boundingBox:{x:i.x,y:i.y,width:i.width,height:i.height},ancestors:so(e),landmarks:ao(e),...e.ownerDocument.defaultView?{viewport:{width:e.ownerDocument.defaultView.innerWidth,height:e.ownerDocument.defaultView.innerHeight}}:{},...xi(e)?{rv:xi(e)}:{},source:Zt(e)}}function xi(e){let n=e.closest("[data-rv]")?.getAttribute("data-rv");return n&&/^[0-9a-f]{12}$/.test(n)?n:void 0}function Zt(e){let i=e.closest("[data-revyse-loc]")?.getAttribute("data-revyse-loc")?.match(/^(.+):(\d+):(\d+)$/);if(i)return{file:i[1],line:Number(i[2]),column:Number(i[3])}}var lo="[data-revyse-ignore], script, style, template, noscript, head, meta, link, title";function be(e){return!e||e.nodeType!==Node.ELEMENT_NODE||e.closest(lo)||e===e.ownerDocument.documentElement?!1:e.checkVisibility?.()??!0}var en=e=>Array.from(e.children).filter(be);function co(e,n){if(n==="ArrowUp"){let r=e.parentElement;return r&&r!==e.ownerDocument.documentElement&&be(r)?r:null}if(n==="ArrowDown")return en(e)[0]??null;let i=e.parentElement?en(e.parentElement):[],t=i.indexOf(e);return i[n==="ArrowLeft"?t-1:t+1]??null}function Ci(e){let n=e.activeElement;if(be(n)&&n!==e.body)return n;let i=e.querySelector("main, [role=main]");return be(i)?i:en(e.body)[0]??null}var Si=["pointerdown","mousedown","pointerup","mouseup","click","dblclick","auxclick"];function Ei(e,n,i){let t=e.defaultView,r=null,o=h=>h.composedPath().includes(n),s=h=>{h!==r&&(r=h,i.onCandidate(h))},d=h=>{if(o(h))return;let g=h.composedPath()[0];g instanceof Element&&be(g)&&s(g)},p=h=>{if(o(h)||(h.preventDefault(),h.stopImmediatePropagation(),h.type!=="click"))return;let g=h.composedPath()[0];g instanceof Element&&be(g)&&i.onSelect(g)},c=null,f=10,x=h=>{if(o(h))return;h.stopImmediatePropagation();let g=h.touches[0];c=g?{x:g.clientX,y:g.clientY}:null;let w=h.composedPath()[0];w instanceof Element&&be(w)&&s(w)},l=h=>{if(o(h))return;h.stopImmediatePropagation();let g=h.changedTouches[0],w=c;if(c=null,!w||!g||Math.hypot(g.clientX-w.x,g.clientY-w.y)>f)return;h.preventDefault();let m=h.composedPath()[0];m instanceof Element&&be(m)&&i.onSelect(m)},u=h=>{if(!h.isComposing){if(h.key==="Escape"){h.preventDefault(),h.stopImmediatePropagation(),i.onExit();return}if(h.key==="Enter"&&r){h.preventDefault(),h.stopImmediatePropagation(),i.onSelect(r);return}if(h.key==="ArrowUp"||h.key==="ArrowDown"||h.key==="ArrowLeft"||h.key==="ArrowRight"){h.preventDefault(),h.stopImmediatePropagation();let g=r?co(r,h.key):Ci(e);g&&(s(g),g.scrollIntoView?.({block:"nearest",inline:"nearest"}))}}};t.addEventListener("pointermove",d,!0);for(let h of Si)t.addEventListener(h,p,!0);t.addEventListener("touchstart",x,{capture:!0,passive:!0}),t.addEventListener("touchend",l,{capture:!0,passive:!1}),t.addEventListener("keydown",u,!0),s(Ci(e));let b=!1;return{get candidate(){return r},stop(){if(!b){b=!0,t.removeEventListener("pointermove",d,!0);for(let h of Si)t.removeEventListener(h,p,!0);t.removeEventListener("touchstart",x,!0),t.removeEventListener("touchend",l,!0),t.removeEventListener("keydown",u,!0),s(null)}}}}var Ai=`
111
+ `+i),t.b("</div>"),t.fl()},partials:{},subs:{}});j["tag-file-added"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-changed"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-deleted"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),t.fl()},partials:{},subs:{}});j["tag-file-renamed"]=new V.Template({code:function(e,n,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),t.fl()},partials:{},subs:{}});var $e=class{constructor({compiledTemplates:n={},rawTemplates:i={}}){let t=Object.entries(i).reduce((r,[o,s])=>{let c=Xt.compile(s,{asString:!1});return Object.assign(Object.assign({},r),{[o]:c})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},j),n),t)}static compile(n){return Xt.compile(n,{asString:!1})}render(n,i,t,r,o){let s=this.templateKey(n,i);try{return this.preCompiledTemplates[s].render(t,r,o)}catch{throw new Error(`Could not find template to render '${s}'`)}}template(n,i){return this.preCompiledTemplates[this.templateKey(n,i)]}templateKey(n,i){return`${n}-${i}`}};var Pr=Object.assign(Object.assign(Object.assign({},zt),$t),{outputFormat:Bn.LINE_BY_LINE,drawFileList:!0});function si(e,n={}){let i=Object.assign(Object.assign({},Pr),n),t=typeof e=="string"?Kn(e,i):e,r=new $e(i),{colorScheme:o}=i,s={colorScheme:o},c=i.drawFileList?new pt(r,s).render(t):"",p=i.outputFormat==="side-by-side"?new ze(r,i).render(t):new je(r,i).render(t);return c+p}var Rr=0;function a(e,n,i,t,r,o){n||(n={});var s,c,p=n;if("ref"in p)for(c in p={},n)c=="ref"?s=n[c]:p[c]=n[c];var d={type:e,props:p,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Rr,__i:-1,__u:0,__source:r,__self:o};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)p[c]===void 0&&(p[c]=s[c]);return D.vnode&&D.vnode(d),d}function Dr(e){return si(e,{outputFormat:"line-by-line",drawFileList:!1,matching:"none",diffStyle:"word"})}function ht({diff:e}){let n=Tt(()=>e.trim()?Dr(e):"",[e]);return n?a("div",{class:"diff",role:"region","aria-label":"Diff",tabIndex:0,dangerouslySetInnerHTML:{__html:n}}):null}var Mr={starting:["The change didn't start","starting the change"],planning:["Revyse couldn't plan the change","planning the change"],patching:["Revyse couldn't write the change","writing the change"],applying:["The change couldn't be applied","applying the change to your files"],checking:["The checks didn't finish","running your project's checks"],reporting:["The result wasn't saved","saving the result to Revyse"],reverting:["The change couldn't be reverted","reverting the change"],accepting:["The change wasn't kept","keeping the change"]},Yt=e=>{let n=Math.round(e*10)/10;return`${n.toFixed(1)} ${n===1?"credit":"credits"}`},di={running:["\u2026","Running"],passed:["\u2713","Passed"],failed:["\u2715","Failed"],skipped:["\u2013","Skipped"],not_run:["\u2013","Not run"]},Kt={typecheck:"Typecheck",lint:"Lint",test:"Tests",build:"Build",browser:"Browser",visual:"Visual"},Oe=(e,n)=>`${e} ${n}${e===1?"":"s"}`,Or=e=>e.source?`${e.source.file}${e.source.line?`:${e.source.line}`:""}`:void 0;function Ir({status:e}){return a("p",{class:"status","data-status":e,role:"status",children:[a("span",{class:"dot","aria-hidden":"true"}),a("span",{children:"Connected"})]})}function Hr({live:e,onAction:n}){return a("div",{class:"live-status",role:"group","aria-label":"Live session",children:[a("span",{class:"live-chip",title:"Signed in to Revyse as",children:[a("span",{class:"dot","aria-hidden":"true"}),e.email]}),a("span",{class:"live-chip",title:"Revyse project",children:e.project}),a("button",{type:"button",class:"signout",onClick:()=>n({type:"signout"}),children:"Sign out"})]})}var Ur={queued:["\u2026","Preview queued"],building:["\u2026","Preview building"],ready:["\u2713","Preview ready"],error:["\u2715","Preview failed to build"],canceled:["\u2013","Preview cancelled"]},Wr={awaiting_approval:["\u2026","Waiting for approval","running"],approved:["\u2713","Approved","passed"],released:["\u2713","Merged and released","passed"],rejected:["\u2715","Rejected","failed"]};function jr({cloud:e}){let n=e.preview?Ur[e.preview.status]:null,i=e.pullRequestUrl?Wr[e.state]:void 0;return a("div",{class:"cloud","data-cloud-state":e.state,children:[e.pullRequestUrl&&a("ul",{class:"checks","aria-label":"Where the change is",children:[a("li",{"data-check":"passed","data-step":"pull_request",children:[a("span",{class:"check-icon","aria-hidden":"true",children:"\u2713"}),a("span",{class:"check-name",children:"Pull request open"}),a("a",{class:"link",href:e.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:"View"})]}),a("li",{"data-check":e.preview?.status==="ready"?"passed":e.preview?.status==="error"?"failed":"running","data-step":"preview",children:[a("span",{class:"check-icon","aria-hidden":"true",children:n?.[0]??"\u2026"}),a("span",{class:"check-name",children:n?.[1]??"Waiting for the preview"}),e.preview?.status==="ready"&&e.preview.url&&a("a",{class:"link",href:e.preview.url,target:"_blank",rel:"noopener noreferrer",children:"Open"})]}),i&&a("li",{"data-check":i[2],"data-step":"approval",children:[a("span",{class:"check-icon","aria-hidden":"true",children:i[0]}),a("span",{class:"check-name",children:i[1]})]})]}),a("p",{class:"meta",children:a("a",{class:"link",href:e.changeUrl,target:"_blank",rel:"noopener noreferrer",children:"Open this change on Revyse"})})]})}function Br({context:e,onClear:n}){return a("div",{class:"chip",role:"group","aria-label":"Selected element",children:[a("div",{class:"chip-main",children:[a("code",{children:["<",e.tagName,">"]}),e.text&&a("span",{class:"chip-text",children:e.text.slice(0,60)})]}),a("div",{class:"chip-where",children:Or(e)??"Source not found \u2014 Revyse will search for it"}),a("button",{type:"button",class:"chip-clear","aria-label":"Clear selection",onClick:n,children:"\xD7"})]})}function ai({text:e}){return a(K,{children:e.split("`").map((n,i)=>i%2?a("code",{children:n},i):n)})}function B({kind:e,icon:n,title:i,tone:t,children:r}){return a("div",{class:"state","data-state":e,"data-tone":t,role:t==="error"?"alert":"status","aria-busy":t==="progress"?"true":void 0,children:[a("span",{class:"state-icon","aria-hidden":"true",children:t==="progress"?a("span",{class:"spinner"}):n}),a("div",{class:"state-main",children:[a("h3",{class:"state-title",children:i}),r]})]})}function me({items:e,onAction:n}){return a("div",{class:"actions",children:e.map(i=>a("button",{type:"button",class:i.primary?"primary":"secondary",onClick:()=>n(i.action),children:i.label},i.label))})}function zr({onAction:e}){let[n,i]=$("");return a("form",{class:"answer",onSubmit:t=>{t.preventDefault(),n.trim()&&e({type:"answer",text:n.trim()})},children:[a("label",{class:"field-label",for:"revyse-answer",children:"Your answer"}),a("textarea",{id:"revyse-answer",rows:3,value:n,onInput:t=>i(t.target.value)}),a("div",{class:"actions",children:[a("button",{type:"submit",class:"primary",disabled:!n.trim(),children:"Send answer"}),a("button",{type:"button",class:"secondary",onClick:()=>e({type:"cancel"}),children:"Cancel"})]})]})}var $r=e=>`${e.label} \xB7 \xD7${e.creditWeight}${e.allowed?e.available?"":" (not set up)":" (turned off)"}`;function Vr(){return a("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:a("path",{d:"M8 13V3M3.5 7.5 8 3l4.5 4.5",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"})})}function qr(){return a("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:[a("circle",{cx:"8",cy:"8",r:"4.5",fill:"none",stroke:"currentColor","stroke-width":"1.5"}),a("path",{d:"M8 1v3M8 12v3M1 8h3M12 8h3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})]})}function Gr(){return a("svg",{viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true",children:a("path",{d:"M10.5 4.5 5.8 9.2a1.3 1.3 0 0 0 1.8 1.8l4.9-4.9a2.6 2.6 0 0 0-3.7-3.7L3.9 7.3a3.9 3.9 0 0 0 5.5 5.5L13 9.2",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})}var li=200;function Xr(e){let n=Z(null);return ue(()=>{let i=n.current;if(!i)return;let t=i.offsetHeight;i.style.transition="none",i.style.height="0px";let r=i.scrollHeight;if(i.style.height=t?`${t}px`:"",!r||!t){i.style.height="",i.style.transition="";return}i.offsetHeight,i.style.transition="",i.style.height=`${Math.min(r,li)}px`,i.style.overflowY=r>li?"auto":"hidden"},[e]),n}var Yr="image/png,image/jpeg,image/webp",Kr=5*1024*1024;function Jr({context:e,models:n,selecting:i,selectButtonRef:t,onToggleSelect:r,onClearSelection:o,onAction:s,live:c=!1}){let[p,d]=$(""),[h,x]=$(null),[l,u]=$(null),[g,f]=$(""),b=n?.models.find(L=>L.id===n.defaultModel)?.label,w=n?.models.find(L=>L.id===g),v=!!(e&&p.trim()),_=Xr(p),E=i?"Cancel selection":e?"Select another element":"Select an element",T=()=>{e&&p.trim()&&s({type:"start",prompt:p.trim(),element:e,...g?{model:g}:{},...h?{screenshot:h}:{}})};return a("form",{class:"composer",onSubmit:L=>{L.preventDefault(),T()},children:[a("div",{class:"box",children:[e&&!i&&a(Br,{context:e,onClear:o}),a("div",{class:"line",children:[a("label",{class:"visually-hidden",for:"revyse-prompt",children:"Describe the change"}),a("textarea",{ref:_,id:"revyse-prompt",class:"prompt",rows:1,maxLength:4e3,"data-autofocus":!0,placeholder:e?"What should change about it?":"Select an element, then say what should change",value:p,onInput:L=>d(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!L.isComposing&&(L.preventDefault(),T())}}),a("button",{ref:t,type:"button",class:"select-toggle tool",title:E,"aria-pressed":i,onClick:r,children:[a(qr,{}),a("span",{class:"tool-label",children:E})]}),c&&a("label",{class:"tool attach",title:h?"Change screenshot":"Attach a screenshot",children:[a("input",{type:"file",class:"visually-hidden",accept:Yr,onChange:L=>{let m=L.target,y=m.files?.[0]??null;if(m.value="",y&&y.size>Kr){u("Screenshots are limited to 5 MB.");return}u(null),x(y)}}),a(Gr,{}),a("span",{class:"tool-label",children:h?"Change screenshot":"Attach a screenshot"})]}),a("span",{class:"toolbar-end",children:[n&&a(K,{children:[a("label",{class:"visually-hidden",for:"revyse-model",children:"Model"}),a("select",{id:"revyse-model",class:"tier",title:w?`${w.description}. About ${w.typicalCredits} credits a change.`:"The organization's default model",value:g,onChange:L=>f(L.target.value),children:[a("option",{value:"",children:["Default",b?` \xB7 ${b}`:""]}),n.models.map(L=>a("option",{value:L.id,disabled:!L.allowed||!L.available,children:$r(L)},L.id))]})]}),a("button",{type:"submit",class:"send","aria-label":"Plan the change",disabled:!v,children:a(Vr,{})})]})]})]}),(h||l)&&a("p",{class:"meta attachment",role:l?"alert":void 0,children:l??a(K,{children:["Screenshot: ",h.name," ",a("button",{type:"button",class:"signout",onClick:()=>x(null),children:"Remove"})]})})]})}function ui({turns:e}){return e.length===0?null:a("ol",{class:"conversation","aria-label":"Conversation",children:e.map((n,i)=>a("li",{"data-role":n.role,children:[a("span",{class:"who",children:n.role==="user"?"You":"Revyse"}),a("span",{class:"said",children:n.text})]},i))})}function Ve({items:e,onAction:n}){let[i,t]=$(!1),[r,o]=$("");return i?a("form",{class:"answer",onSubmit:s=>{s.preventDefault(),r.trim()&&n({type:"revise",text:r.trim()})},children:[a("label",{class:"field-label",for:"revyse-revision",children:"What should be different?"}),a("textarea",{id:"revyse-revision",rows:3,maxLength:2e3,value:r,onInput:s=>o(s.target.value)}),a("div",{class:"actions",children:[a("button",{type:"submit",class:"primary",disabled:!r.trim(),children:"Send revision"}),a("button",{type:"button",class:"secondary",onClick:()=>t(!1),children:"Back"})]})]}):a("div",{class:"actions",children:e.map(s=>a("button",{type:"button",class:s.primary?"primary":"secondary",onClick:()=>s.action==="revise"?t(!0):n(s.action),children:s.label},s.label))})}var pi=e=>e<1e3?"<1 s":`${(e/1e3).toFixed(1)} s`;function ci({items:e}){if(!e||e.length===0)return null;let n=e.slice(-6);return a("ol",{class:"activity","aria-label":"What Revyse is doing","aria-live":"polite",children:[e.length>n.length&&a("li",{class:"meta",children:Oe(e.length-n.length,"earlier step")}),n.map((i,t)=>a("li",{"data-done":i.ms!==void 0,children:[a("span",{children:i.text}),a("span",{class:"took",children:i.ms!==void 0?pi(i.ms):"\u2026"})]},e.length-n.length+t))]})}function Jt({envVars:e,notDone:n,sensitive:i}){return a(K,{children:[i&&i.length>0&&a("p",{class:"note sensitive",children:["Touches sensitive areas: ",i.join(", "),". Review these parts carefully."]}),e&&e.length>0&&a("p",{class:"note",children:["Needs ",e.length===1?"this variable":"these variables"," set where the app runs:"," ",e.map(t=>a("code",{children:t},t))]}),n&&n.length>0&&a("div",{class:"note",children:[a("p",{children:"Not part of this change:"}),a("ul",{children:n.map(t=>a("li",{children:t},t))})]})]})}function Qr({state:e,onAction:n,live:i=!1,models:t}){let r=o=>t?.models.find(s=>s.id===o)?.label??o;return a(B,{kind:"plan",icon:"\u270E",title:"Here's the plan",tone:"info",children:[a(ui,{turns:e.conversation}),a("p",{class:"state-text plan-summary",children:e.plan.summary}),e.plan.steps.length>0&&a("ol",{class:"steps",children:e.plan.steps.map((o,s)=>a("li",{children:[a("span",{children:o.description}),o.files.map(c=>a("code",{children:c},c))]},s))}),a(Jt,{envVars:e.plan.envVars,notDone:e.plan.notDoing,sensitive:e.plan.sensitive}),a("p",{class:"meta",children:["Planned with ",r(e.model),e.cost!==void 0&&` for ${Yt(e.cost)}`,"."," ",e.fellBackFrom&&e.fellBackFrom.length>0?`${e.fellBackFrom.map(r).join(" and ")} wasn't available, so Revyse used ${r(e.model)}. `:null,i?"Applying makes the change on a branch, runs your checks and opens a pull request with a preview. Your site stays as it is.":"Nothing is changed until you apply it."]}),a(Ve,{items:[{label:"Apply the change",action:{type:"approve"},primary:!0},{label:"Revise",action:"revise"},{label:"Cancel",action:{type:"cancel"}}],onAction:n})]})}function Zr({keys:e,artifactUrl:n}){let[i,t]=$([]);return ye(()=>{let r=!0,o=[];return Promise.all(e.map(async s=>{let c=n(s);if(!c)return null;let p=await fetch(c,{mode:"cors"}).catch(()=>null);if(!p?.ok)return null;let d=URL.createObjectURL(await p.blob());return o.push(d),{label:/before\.png$/.test(s)?"Before":"After",src:d}})).then(s=>r&&t(s.filter(c=>c!==null))),()=>{r=!1;for(let s of o)URL.revokeObjectURL(s)}},[e.join("|"),n]),i.length===0?null:a("div",{class:"shots",role:"group","aria-label":"Browser check screenshots",children:i.map(r=>a("figure",{children:[a("img",{src:r.src,alt:`${r.label} the change`}),a("figcaption",{children:r.label})]},r.label))})}function fi({checks:e,artifactUrl:n}){if(e.length===0)return a("p",{class:"meta",children:"No checks are configured for this project, so none ran."});let i=e.find(r=>r.kind==="browser"),t=e.find(r=>r.kind==="browser"&&r.status==="failed");return a(K,{children:[a("ul",{class:"badges","aria-label":"Checks",children:e.map(r=>{let[o,s]=di[r.status],c=r.evidence?.summary??r.reason;return a("li",{class:"badge","data-check":r.status,title:c,children:[a("span",{"aria-hidden":"true",children:o})," ",Kt[r.kind],": ",s]},r.kind)})}),t?.evidence?.summary&&a("pre",{class:"check-output",children:t.evidence.summary}),e.some(r=>r.preExisting)&&a("p",{class:"meta",children:"A check was already failing before this change, with the same errors, so it doesn't count against it."}),n&&i?.evidence?.artifactKeys?.length?a(Zr,{keys:i.evidence.artifactKeys,artifactUrl:n}):null]})}function hi({files:e}){return a("ul",{class:"files changed",children:e.map(n=>a("li",{children:[a("code",{children:n.path})," ",n.kind==="create"&&a("span",{class:"kind",children:"new"}),n.kind==="delete"&&a("span",{class:"kind deleted",children:"deleted"}),a("span",{class:"counts","aria-label":`${Oe(n.additions,"line")} added, ${Oe(n.deletions,"line")} removed`,children:[a("span",{class:"add",children:["+",n.additions]})," ",a("span",{class:"del",children:["\u2212",n.deletions]})]}),n.explanation&&a("span",{class:"explanation",children:n.explanation})]},n.path))})}function eo({since:e}){let[n,i]=$(()=>Date.now());return ye(()=>{let t=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(t)},[]),a(K,{children:[Math.max(0,Math.round((n-e)/1e3))," s"]})}function to({state:e,onAction:n}){let i=e.files&&e.files.length>0;return a(B,{kind:"checking",icon:"\u2026",title:i?"Change made. Checking it\u2026":"Checking the change\u2026",tone:"progress",children:[i&&a("p",{class:"state-text",children:"The change is in your files and on the page. Checks are running."}),a("ul",{class:"checks",children:e.checks.map(t=>{let[r,o]=di[t.status];return a("li",{"data-check":t.status,children:[a("span",{class:"check-icon","aria-hidden":"true",children:r}),a("span",{class:"check-name",children:t.name}),a("span",{class:"check-status",children:[o,t.status==="running"&&e.startedAt!==void 0&&a(K,{children:[" \xB7 ",a(eo,{since:e.startedAt})]}),t.status!=="running"&&t.ms!==void 0&&` \xB7 ${pi(t.ms)}`]})]},t.name)})}),i&&a(hi,{files:e.files}),e.diff&&a(ht,{diff:e.diff}),i&&a(Ve,{items:[{label:"Revert",action:{type:"revert"}}],onAction:n})]})}function no({state:e,onAction:n,artifactUrl:i}){let{result:t}=e,r=t.state==="failed";return a(B,{kind:"result",icon:r?"\u2715":"\u2713",title:r?"Applied, but checks failed":"Ready for review",tone:r?"error":"info",children:[a("p",{class:"state-text",children:r?"The change is in your files, but some checks failed. Revise it or revert it.":"The change is in your files. Check it on the page and in the diff below."}),t.summary&&a("p",{class:"state-text summary",children:t.summary}),a(hi,{files:t.files}),a(Jt,{envVars:t.envVars,notDone:t.notDone,sensitive:t.sensitive}),a(fi,{checks:t.checks,artifactUrl:i}),t.cost!==void 0&&a("p",{class:"meta cost",children:["This change has cost ",Yt(t.cost),"."]}),a(ht,{diff:t.diff}),e.conversation.length>0&&a("details",{class:"history",children:[a("summary",{children:["Conversation (",e.conversation.length,")"]}),a(ui,{turns:e.conversation})]}),a(Ve,{items:[{label:"Keep the change",action:{type:"accept"},primary:!r},{label:"Revise",action:"revise",primary:r},{label:"Revert",action:{type:"revert"}}],onAction:n})]})}function io({state:e,cloud:n,onAction:i}){let{result:t}=e,r=t.state==="failed",o=n?.state==="released";return a(B,{kind:"result",icon:r?"\u2715":"\u2713",title:r?"Checks failed":o?"Merged and released":n?.pullRequestUrl?"Pull request open":"Ready for review",tone:r?"error":"info",children:[a("p",{class:"state-text",children:r?"Some checks failed, so no pull request was opened. Revise the change, or start another.":o?"The pull request was merged, so the change is on its way to your site.":"An approver reviews it on Revyse and it is merged on GitHub; your site changes only then. Open the preview to see it."}),t.summary&&a("p",{class:"state-text summary",children:t.summary}),a("ul",{class:"files changed",children:t.files.map(s=>a("li",{children:[a("code",{children:s.path})," ",s.kind==="create"&&a("span",{class:"kind",children:"new"}),s.kind==="delete"&&a("span",{class:"kind deleted",children:"deleted"}),a("span",{class:"counts","aria-label":`${Oe(s.additions,"line")} added, ${Oe(s.deletions,"line")} removed`,children:[a("span",{class:"add",children:["+",s.additions]})," ",a("span",{class:"del",children:["\u2212",s.deletions]})]})]},s.path))}),a(Jt,{envVars:t.envVars,notDone:t.notDone,sensitive:t.sensitive}),a(fi,{checks:t.checks}),t.cost!==void 0&&a("p",{class:"meta cost",children:["This change has cost ",Yt(t.cost),"."]}),a("details",{class:"history",children:[a("summary",{children:"The diff"}),a(ht,{diff:t.diff})]}),a(Ve,{items:[...o?[]:[{label:"Revise",action:"revise",primary:r}],{label:"Start another change",action:{type:"dismiss"},primary:!r}],onAction:i})]})}var ro={accepted:["\u2713","Change kept",()=>"It's in your working tree. Review and commit it as you normally would."],reverted:["\u21BA","Change reverted",e=>e&&e.length>0?`Restored ${Oe(e.length,"file")} to how ${e.length===1?"it was":"they were"} before Revyse changed ${e.length===1?"it":"them"}.`:"Your files are as they were before this change."],cancelled:["\u2013","Change cancelled",()=>"Revyse stopped working on it."]},oo=new Set(["queued","planning","clarification","plan","applying","checking","result","failed","finished"]);function gi(e){let n=e.live?.cloud;return a(K,{children:[a(so,{...e}),n&&oo.has(e.state.kind)&&a(jr,{cloud:n})]})}function so({state:e,models:n,artifactUrl:i,selecting:t=!1,selectButtonRef:r,onToggleSelect:o=()=>{},onClearSelection:s=()=>{},onAction:c=()=>{},live:p,touch:d=!1}){switch(e.kind){case"connecting":return p?a(B,{kind:"connecting",icon:"\u2026",title:"Connecting to Revyse\u2026",tone:"progress"}):a(B,{kind:"connecting",icon:"\u2026",title:"Connecting to Revyse\u2026",tone:"progress",children:a("p",{class:"state-text",children:"This takes a moment after the dev server starts."})});case"disconnected":return p?e.reason==="not_running"?a(B,{kind:"disconnected",icon:"!",title:"Reconnecting to Revyse\u2026",tone:"error",children:a("p",{class:"state-text",children:"The connection dropped. Revyse keeps trying, and your change carries on in the cloud meanwhile."})}):a(B,{kind:"disconnected",icon:"!",title:"Your live session has ended",tone:"error",children:[a("p",{class:"state-text",children:"Sign in again to keep requesting changes on this site. Changes you already asked for carry on; they are on the Revyse dashboard."}),a(me,{items:[{label:"Sign in again",action:{type:"signin"},primary:!0}],onAction:c})]}):e.reason==="not_running"?a(B,{kind:"disconnected",icon:"!",title:"Not connected",tone:"error",children:a("p",{class:"state-text",children:a(ai,{text:"Revyse runs with your dev server. Start it again (`npm run dev`) and this page reconnects on its own."})})}):a(B,{kind:"disconnected",icon:"!",title:"This page isn't connected",tone:"error",children:[a("p",{class:"state-text",children:"Revyse didn't accept this page's address. Open your app at an address listed under appOrigins in revyse.config.json."}),a(me,{items:[{label:"Reload page",action:{type:"reload"}}],onAction:c})]});case"unsupported":return a(B,{kind:"unsupported",icon:"\u2298",title:"Revyse can't run here",tone:"info",children:a("p",{class:"state-text",children:e.reason})});case"ready":case"selected":{let h=e.kind==="selected"?e.context:null;return a("div",{class:"state","data-state":e.kind,children:[p?a(Hr,{live:p,onAction:c}):a(Ir,{status:"connected"}),a(Jr,{live:!!p,context:h,models:n,selecting:t,selectButtonRef:r,onToggleSelect:o,onClearSelection:s,onAction:c}),a("p",{class:"hint","aria-live":"polite",children:t?d?"Tap the element you want to change.":"Click an element, or use the arrow keys to move and Enter to choose. Esc cancels.":h?p?"Revyse plans the change first. Your site changes only when its pull request is merged.":"Revyse plans the change first; nothing is written until you apply it.":"Select the element you want to change, then send your request."})]})}case"queued":return a(B,{kind:"queued",icon:"\u2026",title:"Waiting for a cloud workspace\u2026",tone:"progress",children:[a("p",{class:"state-text",children:"Revyse picks the change up in a moment, then plans it from your repository."}),a(me,{items:[{label:"Cancel",action:{type:"cancel"}}],onAction:c})]});case"planning":return a(B,{kind:"planning",icon:"\u2026",title:"Planning the change\u2026",tone:"progress",children:[a("blockquote",{class:"quote",children:e.prompt}),a(ci,{items:e.activity}),a(me,{items:[{label:"Cancel",action:{type:"cancel"}}],onAction:c})]});case"clarification":{let h=e.integration;if(h){let x=h.providers[0]??"a provider";return a(B,{kind:"clarification",icon:"\u2699",title:`This needs ${h.capability==="email"?"an email":"a"} service`,tone:"info",children:[a("p",{class:"state-text question",children:h.reason}),a("p",{class:"note",children:["Connect ",h.providers.join(" or ")," on the Revyse dashboard. Keys are entered there, never here."]}),h.connectUrl&&a("p",{children:a("a",{href:h.connectUrl,target:"_blank",rel:"noopener noreferrer",class:"link",children:["Connect ",x," on the dashboard"]})}),a(me,{items:[{label:"I've connected it: plan again",action:{type:"answer",text:`I connected ${x} in Revyse. Plan the change again with it.`},primary:!0},{label:"Cancel",action:{type:"cancel"}}],onAction:c})]})}return a(B,{kind:"clarification",icon:"?",title:"Revyse has a question",tone:"info",children:[a("p",{class:"state-text question",children:e.question}),a(zr,{onAction:c})]})}case"applying":return a(B,{kind:"applying",icon:"\u2026",title:"Applying the change\u2026",tone:"progress",children:e.activity&&e.activity.length>0?a(ci,{items:e.activity}):a("p",{class:"state-text",children:p?"Writing the change on a branch of your repository, in a cloud workspace.":e.files?`Writing ${e.files} ${e.files===1?"file":"files"} in your project.`:"Writing the change to your project."})});case"checking":return a(to,{state:e,onAction:c});case"conflict":{let h=e.reason==="changed_since_apply";return a(B,{kind:"conflict",icon:"\u26A0",title:h?"Files changed after Revyse's edit":"Files changed while Revyse was working",tone:"error",children:[a("p",{class:"state-text",children:e.message??"Nothing was written. These files changed after Revyse read them:"}),a("ul",{class:"files",children:e.files.map(x=>a("li",{children:a("code",{children:x})},x))}),a(me,{items:h?[{label:"Dismiss",action:{type:"dismiss"},primary:!0}]:[{label:"Re-plan with the latest files",action:{type:"refresh"},primary:!0},{label:"Cancel",action:{type:"cancel"}}],onAction:c})]})}case"failed":{let[h,x]=e.stage?Mr[e.stage]:["The change didn't go through",void 0],l=e.next,u=[];return l?(l.includes("replan")&&u.push({label:"Try again",action:{type:"refresh"},primary:!0}),l.includes("revise")&&u.push({label:"Revise",action:"revise",primary:u.length===0}),l.includes("revert")&&u.push({label:"Revert Revyse's edits",action:{type:"revert"}}),l.includes("reload")&&u.push({label:"Reload page",action:{type:"reload"},primary:!0})):e.retryable&&u.push({label:"Try again",action:{type:"retry"},primary:!0}),u.push({label:"Dismiss",action:{type:"dismiss"}}),a(B,{kind:"failed",icon:"\u2715",title:h,tone:"error",children:[x&&a("p",{class:"meta",children:["While ",x,"."," ",e.filesChanged?"Revyse's edits are in your files.":"Your files weren't changed."]}),a("p",{class:"state-text",children:a(ai,{text:e.message})}),a(Ve,{items:u,onAction:c})]})}case"plan":return a(Qr,{state:e,onAction:c,live:!!p,models:n});case"result":return p?a(io,{state:e,cloud:p.cloud,onAction:c}):a(no,{state:e,onAction:c,artifactUrl:i});case"reverting":return a(B,{kind:"reverting",icon:"\u2026",title:"Reverting the change\u2026",tone:"progress",children:a("p",{class:"state-text",children:"Restoring your files to how they were before Revyse changed them."})});case"finished":{let[h,x,l]=ro[e.outcome];return a(B,{kind:"finished",icon:h,title:x,tone:"info",children:[a("p",{class:"state-text",children:l(e.files)}),e.files&&e.files.length>0&&a("ul",{class:"files",children:e.files.map(u=>a("li",{children:a("code",{children:u})},u))}),a(me,{items:[{label:"Start another change",action:{type:"dismiss"},primary:!0}],onAction:c})]})}case"permission_denied":return a(B,{kind:"permission_denied",icon:"\u2298",title:"You don't have permission",tone:"error",children:[a("p",{class:"state-text",children:[e.message??"Your role in this project can't request changes."," Ask a project owner to give you the editor role."]}),a(me,{items:[{label:"Dismiss",action:{type:"dismiss"}}],onAction:c})]});default:return e}}function mi(e){return e.unsupported?{kind:"unsupported",reason:e.unsupported}:e.status==="connecting"?{kind:"connecting"}:e.status==="disconnected"?{kind:"disconnected",reason:"not_running"}:e.status==="rejected"?{kind:"disconnected",reason:"rejected"}:e.flow?e.flow:e.selected?{kind:"selected",context:e.selected}:{kind:"ready"}}function bi(e){return["localhost","127.0.0.1","[::1]","::1"].includes(e.hostname)||e.hostname.endsWith(".localhost")?null:"Revyse local mode only works on your own machine (localhost). Open the app from the address your dev server printed."}var ao={"change.start":e=>({kind:"planning",prompt:e}),"change.answer":e=>({kind:"planning",prompt:e}),"change.revise":e=>({kind:"planning",prompt:e}),"change.refresh":e=>({kind:"planning",prompt:e}),"change.approve":()=>({kind:"applying"}),"change.revert":()=>({kind:"reverting"})};function vi(e){let n=e.now??(()=>Date.now()),i=[],t,r=0,o,s=null,c=!1,p=[],d=null,h="",x=null,l=()=>[...p];function u(w){d&&p.push(d),d=null,p.push({role:"user",text:w}),h=w}function g(){s=null,c=!1,p=[],d=null,x=null,e.setCloud?.(null)}function f(w){x=w;let v=ao[w.type];v&&e.setFlow(v(h)),w.type==="change.start"&&(c=!0),e.connection.request(w.type,w.payload).then(_=>{w.type!=="change.start"||!c||(c=!1,s=_?.changeId??s)},_=>{w.type==="change.start"&&(c=!1),e.setFlow({kind:"failed",message:_.message,retryable:!0})})}let b=e.connection.onEvent((w,v)=>{if(w==="cloud"){let E=mn(v);if(!E||(!s&&c&&(s=E.changeId),E.changeId!==s))return;e.setCloud?.(E),E.state==="draft"&&e.setFlow({kind:"queued"});return}if(w!=="change")return;let _=hn(v);if(_){if(_.changeId){if(!s&&c&&(s=_.changeId),_.changeId!==s)return}else if(!c)return;switch(_.type){case"planning":return i=[],e.setFlow({kind:"planning",prompt:h});case"plan":return d={role:"revyse",text:_.plan.summary},e.setFlow({kind:"plan",plan:_.plan,model:_.model,..._.fellBackFrom?.length?{fellBackFrom:_.fellBackFrom}:{},cost:_.cost,conversation:l()});case"clarification":return d={role:"revyse",text:_.question},e.setFlow({kind:"clarification",question:_.question,..._.integration?{integration:_.integration}:{}});case"applying":return i=[],t=void 0,o=_.files,e.setFlow({kind:"applying",files:_.files});case"activity":{let E=n(),T=i.at(-1);return T&&T.ms===void 0&&(i=[...i.slice(0,-1),{...T,ms:E-r}]),i=[...i,{text:_.text}],r=E,e.setFlow(_.phase==="plan"?{kind:"planning",prompt:h,activity:i}:{kind:"applying",files:o,activity:i})}case"checking":return t??=n(),e.setFlow({kind:"checking",checks:_.checks.map(E=>({name:Kt[E.kind],status:E.status,...E.durationMs!==void 0?{ms:E.durationMs}:{}})),startedAt:t,..._.files?{files:_.files}:{},..._.diff!==void 0?{diff:_.diff}:{}});case"result":{let{state:E,files:T,diff:L,checks:m,cost:y,summary:k,envVars:A,notDone:R,sensitive:z}=_;return e.setFlow({kind:"result",result:{state:E,files:T,diff:L,checks:m,cost:y,summary:k,envVars:A,notDone:R,sensitive:z},conversation:l()})}case"conflict":return e.setFlow({kind:"conflict",files:_.files,reason:_.reason,message:_.message});case"reverted":return e.setFlow({kind:"finished",outcome:"reverted",files:_.files});case"accepted":return e.setFlow({kind:"finished",outcome:"accepted"});case"cancelled":return e.setFlow({kind:"finished",outcome:"cancelled"});case"failed":return e.setFlow({kind:"failed",message:_.message,retryable:_.retryable,stage:_.stage,filesChanged:_.filesChanged,next:_.next});case"permission_denied":return e.setFlow({kind:"permission_denied",message:_.message})}}});return{handle(w){let v=s;switch(w.type){case"start":return g(),u(w.prompt),f({type:"change.start",payload:{prompt:w.prompt,element:w.element,...w.model?{model:w.model}:{},origin:globalThis.location?.origin,...w.screenshot?{screenshot:w.screenshot}:{}}});case"answer":case"revise":return v?(u(w.text),f({type:`change.${w.type}`,payload:{changeId:v,text:w.text}})):void 0;case"approve":case"revert":case"accept":case"refresh":return v?f({type:`change.${w.type}`,payload:{changeId:v}}):void 0;case"cancel":return v?f({type:"change.cancel",payload:{changeId:v}}):(g(),e.setFlow(null));case"retry":x&&f(x);return;case"dismiss":return g(),e.setFlow(null);case"reload":return}},dispose(){b()}}}function yi(e,n=6){let i=[],t=e;for(;t&&t.nodeType===1&&i.length<n;){let r=t.getAttribute("data-testid");if(r){i.unshift(`[data-testid="${CSS.escape(r)}"]`);break}if(t.id){i.unshift(`#${CSS.escape(t.id)}`);break}let o=t.tagName.toLowerCase(),s=t.parentElement;if(s){let c=Array.from(s.children).filter(p=>p.tagName===t.tagName);c.length>1&&(o+=`:nth-of-type(${c.indexOf(t)+1})`)}i.unshift(o),t=s}return i.join(" > ")}var xi=500;function ki(e){return e.closest("[data-revyse-ignore]")?!0:e instanceof HTMLInputElement?["password","hidden"].includes(e.type)||/cc-|card|cvc|cvv/i.test(e.autocomplete):!1}var lo="input, textarea, select, option, optgroup, datalist, [contenteditable]:not([contenteditable=false])",Qt=e=>e.matches(lo)||!!e.closest("[contenteditable]:not([contenteditable=false])");function Ci(e){let n="",i=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:t=>{if(t.nodeType===Node.TEXT_NODE)return NodeFilter.FILTER_ACCEPT;let r=t;return r.matches("script, style, template, noscript, [data-revyse-ignore]")||Qt(r)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}});for(let t=i.nextNode();t&&n.length<=xi*2;t=i.nextNode())n+=` ${t.nodeValue??""}`;return n.replace(/\s+/g," ").trim().slice(0,xi)}var _i=["header","nav","main","footer","aside","section","article","form","dialog",...["banner","navigation","main","contentinfo","complementary","region","dialog"].map(e=>`[role=${e}]`)].join(", ");function co(e){let n=[],i=e.ownerDocument;for(let t=e.parentElement;t&&n.length<6&&!(t===i.body||t===i.documentElement);t=t.parentElement)n.push({tagName:t.tagName.toLowerCase(),...t.id?{id:t.id.slice(0,256)}:{},classList:Array.from(t.classList).slice(0,20)});return n}function uo(e){let n=[];for(let i=e.parentElement?.closest(_i)??null;i&&n.length<4;i=i.parentElement?.closest(_i)??null){let t=i.querySelector("h1, h2, h3, h4, h5, h6"),r=i.getAttribute("aria-label")??(t&&!ki(t)?Ci(t):void 0),o=i.getAttribute("role");n.push({tagName:i.tagName.toLowerCase(),...o?{role:o}:{},...r?{label:r.slice(0,120)}:{}})}return n}function Si(e,n=location.pathname){let i=e.getBoundingClientRect(),t=ki(e)||Qt(e)?void 0:Ci(e)||void 0;return{route:n,selector:yi(e),tagName:e.tagName.toLowerCase(),text:t,role:e.getAttribute("role")??void 0,ariaLabel:Qt(e)?void 0:e.getAttribute("aria-label")??void 0,classList:Array.from(e.classList).slice(0,100),boundingBox:{x:i.x,y:i.y,width:i.width,height:i.height},ancestors:co(e),landmarks:uo(e),...e.ownerDocument.defaultView?{viewport:{width:e.ownerDocument.defaultView.innerWidth,height:e.ownerDocument.defaultView.innerHeight}}:{},...wi(e)?{rv:wi(e)}:{},source:Zt(e)}}function wi(e){let n=e.closest("[data-rv]")?.getAttribute("data-rv");return n&&/^[0-9a-f]{12}$/.test(n)?n:void 0}function Zt(e){let i=e.closest("[data-revyse-loc]")?.getAttribute("data-revyse-loc")?.match(/^(.+):(\d+):(\d+)$/);if(i)return{file:i[1],line:Number(i[2]),column:Number(i[3])}}var po="[data-revyse-ignore], script, style, template, noscript, head, meta, link, title";function be(e){return!e||e.nodeType!==Node.ELEMENT_NODE||e.closest(po)||e===e.ownerDocument.documentElement?!1:e.checkVisibility?.()??!0}var en=e=>Array.from(e.children).filter(be);function fo(e,n){if(n==="ArrowUp"){let r=e.parentElement;return r&&r!==e.ownerDocument.documentElement&&be(r)?r:null}if(n==="ArrowDown")return en(e)[0]??null;let i=e.parentElement?en(e.parentElement):[],t=i.indexOf(e);return i[n==="ArrowLeft"?t-1:t+1]??null}function Ei(e){let n=e.activeElement;if(be(n)&&n!==e.body)return n;let i=e.querySelector("main, [role=main]");return be(i)?i:en(e.body)[0]??null}var Ai=["pointerdown","mousedown","pointerup","mouseup","click","dblclick","auxclick"];function Ti(e,n,i){let t=e.defaultView,r=null,o=f=>f.composedPath().includes(n),s=f=>{f!==r&&(r=f,i.onCandidate(f))},c=f=>{if(o(f))return;let b=f.composedPath()[0];b instanceof Element&&be(b)&&s(b)},p=f=>{if(o(f)||(f.preventDefault(),f.stopImmediatePropagation(),f.type!=="click"))return;let b=f.composedPath()[0];b instanceof Element&&be(b)&&i.onSelect(b)},d=null,h=10,x=f=>{if(o(f))return;f.stopImmediatePropagation();let b=f.touches[0];d=b?{x:b.clientX,y:b.clientY}:null;let w=f.composedPath()[0];w instanceof Element&&be(w)&&s(w)},l=f=>{if(o(f))return;f.stopImmediatePropagation();let b=f.changedTouches[0],w=d;if(d=null,!w||!b||Math.hypot(b.clientX-w.x,b.clientY-w.y)>h)return;f.preventDefault();let v=f.composedPath()[0];v instanceof Element&&be(v)&&i.onSelect(v)},u=f=>{if(!f.isComposing){if(f.key==="Escape"){f.preventDefault(),f.stopImmediatePropagation(),i.onExit();return}if(f.key==="Enter"&&r){f.preventDefault(),f.stopImmediatePropagation(),i.onSelect(r);return}if(f.key==="ArrowUp"||f.key==="ArrowDown"||f.key==="ArrowLeft"||f.key==="ArrowRight"){f.preventDefault(),f.stopImmediatePropagation();let b=r?fo(r,f.key):Ei(e);b&&(s(b),b.scrollIntoView?.({block:"nearest",inline:"nearest"}))}}};t.addEventListener("pointermove",c,!0);for(let f of Ai)t.addEventListener(f,p,!0);t.addEventListener("touchstart",x,{capture:!0,passive:!0}),t.addEventListener("touchend",l,{capture:!0,passive:!1}),t.addEventListener("keydown",u,!0),s(Ei(e));let g=!1;return{get candidate(){return r},stop(){if(!g){g=!0,t.removeEventListener("pointermove",c,!0);for(let f of Ai)t.removeEventListener(f,p,!0);t.removeEventListener("touchstart",x,!0),t.removeEventListener("touchend",l,!0),t.removeEventListener("keydown",u,!0),s(null)}}}}var Fi=`
112
112
  :host {
113
113
  all: initial !important;
114
114
  display: block !important;
@@ -742,4 +742,4 @@ select.tier:hover { background: #F2F2F2; }
742
742
  .spinner { animation: revyse-spin 800ms linear infinite; }
743
743
  @keyframes revyse-spin { to { transform: rotate(360deg); } }
744
744
  }
745
- `;var uo="revyse-overlay",Ti="revyse:panel-open";function Fi({size:e}){return a("svg",{class:"mark",viewBox:"0 0 64 64",width:e,height:e,"aria-hidden":"true",children:[a("path",{d:"M12 53V32.5A21.5 21.5 0 0 1 33.5 11V24A8.5 8.5 0 0 0 25 32.5V53Z",fill:"currentColor"}),a("circle",{cx:"44.5",cy:"17.5",r:"7.5",fill:"currentColor"})]})}var Li={get:()=>{try{return sessionStorage.getItem(Ti)==="1"}catch{return!1}},set:e=>{try{sessionStorage.setItem(Ti,e?"1":"0")}catch{}}};function po(e){let n=Zt(e);return{tag:e.tagName.toLowerCase(),where:n?`${n.file}${n.line?`:${n.line}`:""}`:void 0}}function fo({el:e}){let[n,i]=$(()=>e.getBoundingClientRect());ue(()=>i(e.getBoundingClientRect()),[e]),Ae(()=>{let s=0,d=()=>{i(e.getBoundingClientRect()),s=requestAnimationFrame(d)};return s=requestAnimationFrame(d),()=>cancelAnimationFrame(s)},[e]);let{tag:t,where:r}=po(e),o=n.top>28;return a("div",{class:"highlight","aria-hidden":"true",children:[a("div",{class:"outline",style:{left:n.left,top:n.top,width:n.width,height:n.height}}),a("div",{class:"label",style:{left:Math.max(n.left,0),top:o?n.top-26:n.bottom+4},children:[t,r&&a("span",{class:"where",children:[" \xB7 ",r]})]})]})}function Ri(e){let n=new URL(e);return n.protocol=n.protocol==="wss:"?"https:":"http:",i=>{let t=i.match(/^\.revyse\/changes\/([0-9a-f-]{36})\/(before|after)\.png$/);return t?new URL(`/artifacts/${t[1]}/${t[2]}.png`,n).toString():void 0}}function ho(){return Di()}function Di(){let e=null,n=new Set;return{get:()=>e,set(i){e=i;for(let t of n)t(i)},subscribe(i){return n.add(i),()=>{n.delete(i)}}}}function Ni(e){let[n,i]=$(e?.get()??null);return ue(()=>{if(e)return i(e.get()),e.subscribe(i)},[e]),n}var go=e=>{try{return!!e?.matchMedia?.("(pointer: coarse)").matches}catch{return!1}},Pi="cubic-bezier(0.2, 0.8, 0.2, 1)";function mo(e,n){let i=Z(0),t=Z(null),r=Z(!1);ue(()=>{let o=e.current,s=o?.ownerDocument.defaultView;if(!o||!s||typeof s.ResizeObserver>"u")return;let d=new s.ResizeObserver(()=>{i.current=o.offsetHeight});return d.observe(o),()=>d.disconnect()},[e]),ue(()=>{let o=e.current,s=n&&!r.current;r.current=n;let d=o?.ownerDocument.defaultView;if(!o||!n||!o.animate||d?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;if(s){o.animate([{opacity:0,translate:"0 8px"},{opacity:1,translate:"0 0"}],{duration:200,easing:Pi});return}let p=i.current;t.current?.playState==="running"&&(p=o.offsetHeight,t.current.cancel());let c=o.offsetHeight;p&&c&&Math.abs(p-c)>1&&(t.current=o.animate([{height:`${p}px`},{height:`${c}px`}],{duration:260,easing:Pi}))})}function bo({connection:e,host:n,onSelect:i,flow:t,onAction:r,artifactUrl:o,mode:s="local",live:d,cloud:p}){let[c,f]=$(Li.get),[x,l]=$(e?.status??"disconnected"),[u,b]=$(!1),[h,g]=$(null),[w,m]=$(null),S=Z(null),A=Z(null),F=Z(null),L=Z(null),v=Z(!1),y=Z(c),_=Z(i);_.current=i;let E=Ni(t),R=Ni(p),V=n.ownerDocument,[re]=$(()=>go(V.defaultView)),P=s==="local"&&V.defaultView?gi(V.defaultView.location):null;Ae(()=>{if(!e)return;l(e.status);let C=e.onStatus(l);return()=>{C()}},[e]);let[te,ae]=$(null);Ae(()=>{if(!e||x!=="connected")return;let C=!0;return e.request("models.list").then(N=>{C&&ae(gn(N))},()=>C&&ae(null)),()=>{C=!1}},[e,x]),ue(()=>{Li.set(c),c&&!y.current&&(A.current?.querySelector("[data-autofocus]")??A.current)?.focus(),!c&&y.current&&S.current?.focus(),y.current=c},[c]),ue(()=>{if(!u)return;let C=n.ownerDocument,N=()=>{L.current?.stop(),b(!1)};return L.current=Ei(C,n,{onCandidate:g,onSelect:k=>{let le={element:k,context:ki(k)};m(le),_.current?.(le),v.current=!0,N()},onExit:N}),()=>{L.current?.stop(),L.current=null,g(null);let k=A.current?.querySelector("[data-autofocus]");A.current&&!A.current.hidden&&(v.current&&k?k:F.current)?.focus(),v.current=!1}},[u,n]);let K=C=>{C.key==="Escape"&&c&&!u&&(C.stopPropagation(),f(!1))},M=()=>{m(null),_.current?.(null),F.current?.focus()},ne=hi({status:x,selected:w?.context??null,flow:E,unsupported:P}),I=ne.kind==="ready"||ne.kind==="selected";return mo(A,c),a("div",{class:"root",onKeyDown:K,children:[u&&h&&a(fo,{el:h}),u&&a("div",{class:"picking",role:"status",children:[a("span",{children:re?"Tap an element to change it.":"Click an element to change it. Arrow keys move, Enter chooses."}),a("button",{type:"button",class:"picking-cancel",onClick:()=>b(!1),children:"Cancel"})]}),a("div",{ref:A,id:"revyse-panel",class:"panel",role:"dialog","aria-label":"Revyse",tabIndex:-1,hidden:!c,"data-picking":u?"":void 0,"data-compact":I?"":void 0,children:[a("div",{class:"header",children:[a("h2",{class:"title",children:[a(Fi,{size:16}),"Revyse"]}),a("button",{type:"button",class:"close","aria-label":"Close Revyse",onClick:()=>{b(!1),f(!1)},children:"\xD7"})]}),a("div",{class:"body",children:a(fi,{state:ne,models:te,artifactUrl:o,live:d?{email:d.email,project:d.project,cloud:R}:void 0,touch:re,selecting:u,selectButtonRef:F,onToggleSelect:()=>b(!u),onClearSelection:M,onAction:C=>{if(C.type==="reload"&&V.defaultView?.location.reload(),C.type==="signout")return d?.onSignOut();if(C.type==="signin"){let N=V.defaultView?.location;N&&(N.hash="revyse",N.reload());return}r?.(C)}})})]}),a("button",{ref:S,type:"button",class:"launcher","aria-label":c?"Close Revyse":"Open Revyse","aria-expanded":c,"aria-controls":"revyse-panel",onClick:()=>f(!c),children:a(Fi,{size:20})})]})}function Oi(e,n={}){let i=ho(),t=Di(),r=e.createElement(uo);r.setAttribute("data-revyse-ignore","");let o=r.attachShadow({mode:"open"}),s=e.createElement("style");s.textContent=Ai,o.append(s);let d=e.createElement("div");return o.append(d),e.documentElement.append(r),Ct(a(bo,{connection:n.connection,onSelect:n.onSelect,onAction:n.onAction,artifactUrl:n.artifactUrl,mode:n.mode,live:n.live,flow:i,cloud:t,host:r}),d),{host:r,shadow:o,setFlow:i.set,setCloud:t.set,unmount(){Ct(null,d),r.remove()}}}function Mi(e){let n=e.WebSocketImpl??WebSocket,i=new Set,t=new Set,r=new Map,o="connecting",s=null,d=0,p=1,c=!1,f=l=>{o=l;for(let u of i)u(l)};function x(){f("connecting");let l=new n(e.url);s=l,l.onopen=()=>l.send(JSON.stringify({type:"hello",token:e.token,protocol:1})),l.onmessage=u=>{let b=JSON.parse(String(u.data));if(b.type==="welcome"&&ln(b))d=0,f("connected");else if(b.type==="response"){let h=cn(b);if(!h)return;let g=r.get(h.id);r.delete(h.id),h.ok?g?.resolve(h.result):g?.reject(new Error(h.error?.message??"Request failed"))}else if(b.type==="event"){let h=dn(b);if(!h)return;for(let g of t)g(h.event,h.data)}},l.onclose=u=>{for(let h of r.values())h.reject(new Error("Disconnected from the Revyse agent"));if(r.clear(),u.code===an.unauthorized)return f("rejected");if(f("disconnected"),c)return;let b=Math.min((e.retryMs??500)*2**d++,1e4);setTimeout(()=>!c&&x(),b)}}return x(),{get status(){return o},onStatus(l){return i.add(l),()=>i.delete(l)},onEvent(l){return t.add(l),()=>t.delete(l)},request(l,u){if(!s||o!=="connected")return Promise.reject(new Error("Not connected"));let b=String(p++);return s.send(JSON.stringify({id:b,type:l,payload:u})),new Promise((h,g)=>r.set(b,{resolve:h,reject:g}))},close(){c=!0,s?.close()}}}var tn=globalThis.__REVYSE_AGENT__;if(tn&&!window.__revyse){let e=Mi(tn),n={connection:e};window.__revyse=n;let i=()=>{let t=Oi(document,{connection:e,onAction:r=>n.flow?.handle(r),artifactUrl:Ri(tn.url)});n.overlay=t,n.flow=mi({connection:e,setFlow:t.setFlow})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i,{once:!0}):i(),e.onStatus(t=>{t==="rejected"&&console.warn("[revyse] the local agent rejected this page")})}
745
+ `;var ho="revyse-overlay",Li="revyse:panel-open";function Ni({size:e}){return a("svg",{class:"mark",viewBox:"0 0 64 64",width:e,height:e,"aria-hidden":"true",children:[a("path",{d:"M12 53V32.5A21.5 21.5 0 0 1 33.5 11V24A8.5 8.5 0 0 0 25 32.5V53Z",fill:"currentColor"}),a("circle",{cx:"44.5",cy:"17.5",r:"7.5",fill:"currentColor"})]})}var Pi={get:()=>{try{return sessionStorage.getItem(Li)==="1"}catch{return!1}},set:e=>{try{sessionStorage.setItem(Li,e?"1":"0")}catch{}}};function go(e){let n=Zt(e);return{tag:e.tagName.toLowerCase(),where:n?`${n.file}${n.line?`:${n.line}`:""}`:void 0}}function mo({el:e}){let[n,i]=$(()=>e.getBoundingClientRect());ue(()=>i(e.getBoundingClientRect()),[e]),ye(()=>{let s=0,c=()=>{i(e.getBoundingClientRect()),s=requestAnimationFrame(c)};return s=requestAnimationFrame(c),()=>cancelAnimationFrame(s)},[e]);let{tag:t,where:r}=go(e),o=n.top>28;return a("div",{class:"highlight","aria-hidden":"true",children:[a("div",{class:"outline",style:{left:n.left,top:n.top,width:n.width,height:n.height}}),a("div",{class:"label",style:{left:Math.max(n.left,0),top:o?n.top-26:n.bottom+4},children:[t,r&&a("span",{class:"where",children:[" \xB7 ",r]})]})]})}function Mi(e){let n=new URL(e);return n.protocol=n.protocol==="wss:"?"https:":"http:",i=>{let t=i.match(/^\.revyse\/changes\/([0-9a-f-]{36})\/(before|after)\.png$/);return t?new URL(`/artifacts/${t[1]}/${t[2]}.png`,n).toString():void 0}}function bo(){return Oi()}function Oi(){let e=null,n=new Set;return{get:()=>e,set(i){e=i;for(let t of n)t(i)},subscribe(i){return n.add(i),()=>{n.delete(i)}}}}function Ri(e){let[n,i]=$(e?.get()??null);return ue(()=>{if(e)return i(e.get()),e.subscribe(i)},[e]),n}var vo=e=>{try{return!!e?.matchMedia?.("(pointer: coarse)").matches}catch{return!1}},Di="cubic-bezier(0.2, 0.8, 0.2, 1)";function yo(e,n){let i=Z(0),t=Z(null),r=Z(!1);ue(()=>{let o=e.current,s=o?.ownerDocument.defaultView;if(!o||!s||typeof s.ResizeObserver>"u")return;let c=new s.ResizeObserver(()=>{i.current=o.offsetHeight});return c.observe(o),()=>c.disconnect()},[e]),ue(()=>{let o=e.current,s=n&&!r.current;r.current=n;let c=o?.ownerDocument.defaultView;if(!o||!n||!o.animate||c?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;if(s){o.animate([{opacity:0,translate:"0 8px"},{opacity:1,translate:"0 0"}],{duration:200,easing:Di});return}let p=i.current;t.current?.playState==="running"&&(p=o.offsetHeight,t.current.cancel());let d=o.offsetHeight;p&&d&&Math.abs(p-d)>1&&(t.current=o.animate([{height:`${p}px`},{height:`${d}px`}],{duration:260,easing:Di}))})}function xo({connection:e,host:n,onSelect:i,flow:t,onAction:r,artifactUrl:o,mode:s="local",live:c,cloud:p}){let[d,h]=$(Pi.get),[x,l]=$(e?.status??"disconnected"),[u,g]=$(!1),[f,b]=$(null),[w,v]=$(null),_=Z(null),E=Z(null),T=Z(null),L=Z(null),m=Z(!1),y=Z(d),k=Z(i);k.current=i;let A=Ri(t),R=Ri(p),z=n.ownerDocument,[re]=$(()=>vo(z.defaultView)),P=s==="local"&&z.defaultView?bi(z.defaultView.location):null;ye(()=>{if(!e)return;l(e.status);let S=e.onStatus(l);return()=>{S()}},[e]);let[te,ae]=$(null);ye(()=>{if(!e||x!=="connected")return;let S=!0;return e.request("models.list").then(N=>{S&&ae(gn(N))},()=>S&&ae(null)),()=>{S=!1}},[e,x]),ue(()=>{Pi.set(d),d&&!y.current&&(E.current?.querySelector("[data-autofocus]")??E.current)?.focus(),!d&&y.current&&_.current?.focus(),y.current=d},[d]),ue(()=>{if(!u)return;let S=n.ownerDocument,N=()=>{L.current?.stop(),g(!1)};return L.current=Ti(S,n,{onCandidate:b,onSelect:C=>{let le={element:C,context:Si(C)};v(le),k.current?.(le),m.current=!0,N()},onExit:N}),()=>{L.current?.stop(),L.current=null,b(null);let C=E.current?.querySelector("[data-autofocus]");E.current&&!E.current.hidden&&(m.current&&C?C:T.current)?.focus(),m.current=!1}},[u,n]);let J=S=>{S.key==="Escape"&&d&&!u&&(S.stopPropagation(),h(!1))},O=()=>{v(null),k.current?.(null),T.current?.focus()},ne=mi({status:x,selected:w?.context??null,flow:A,unsupported:P}),I=ne.kind==="ready"||ne.kind==="selected";return yo(E,d),a("div",{class:"root",onKeyDown:J,children:[u&&f&&a(mo,{el:f}),u&&a("div",{class:"picking",role:"status",children:[a("span",{children:re?"Tap an element to change it.":"Click an element to change it. Arrow keys move, Enter chooses."}),a("button",{type:"button",class:"picking-cancel",onClick:()=>g(!1),children:"Cancel"})]}),a("div",{ref:E,id:"revyse-panel",class:"panel",role:"dialog","aria-label":"Revyse",tabIndex:-1,hidden:!d,"data-picking":u?"":void 0,"data-compact":I?"":void 0,children:[a("div",{class:"header",children:[a("h2",{class:"title",children:[a(Ni,{size:16}),"Revyse"]}),a("button",{type:"button",class:"close","aria-label":"Close Revyse",onClick:()=>{g(!1),h(!1)},children:"\xD7"})]}),a("div",{class:"body",children:a(gi,{state:ne,models:te,artifactUrl:o,live:c?{email:c.email,project:c.project,cloud:R}:void 0,touch:re,selecting:u,selectButtonRef:T,onToggleSelect:()=>g(!u),onClearSelection:O,onAction:S=>{if(S.type==="reload"&&z.defaultView?.location.reload(),S.type==="signout")return c?.onSignOut();if(S.type==="signin"){let N=z.defaultView?.location;N&&(N.hash="revyse",N.reload());return}r?.(S)}})})]}),a("button",{ref:_,type:"button",class:"launcher","aria-label":d?"Close Revyse":"Open Revyse","aria-expanded":d,"aria-controls":"revyse-panel",onClick:()=>h(!d),children:a(Ni,{size:20})})]})}function Ii(e,n={}){let i=bo(),t=Oi(),r=e.createElement(ho);r.setAttribute("data-revyse-ignore","");let o=r.attachShadow({mode:"open"}),s=e.createElement("style");s.textContent=Fi,o.append(s);let c=e.createElement("div");return o.append(c),e.documentElement.append(r),St(a(xo,{connection:n.connection,onSelect:n.onSelect,onAction:n.onAction,artifactUrl:n.artifactUrl,mode:n.mode,live:n.live,flow:i,cloud:t,host:r}),c),{host:r,shadow:o,setFlow:i.set,setCloud:t.set,unmount(){St(null,c),r.remove()}}}function Hi(e){let n=e.WebSocketImpl??WebSocket,i=new Set,t=new Set,r=new Map,o="connecting",s=null,c=0,p=1,d=!1,h=l=>{o=l;for(let u of i)u(l)};function x(){h("connecting");let l=new n(e.url);s=l,l.onopen=()=>l.send(JSON.stringify({type:"hello",token:e.token,protocol:1})),l.onmessage=u=>{let g=JSON.parse(String(u.data));if(g.type==="welcome"&&ln(g))c=0,h("connected");else if(g.type==="response"){let f=cn(g);if(!f)return;let b=r.get(f.id);r.delete(f.id),f.ok?b?.resolve(f.result):b?.reject(new Error(f.error?.message??"Request failed"))}else if(g.type==="event"){let f=dn(g);if(!f)return;for(let b of t)b(f.event,f.data)}},l.onclose=u=>{for(let f of r.values())f.reject(new Error("Disconnected from the Revyse agent"));if(r.clear(),u.code===an.unauthorized)return h("rejected");if(h("disconnected"),d)return;let g=Math.min((e.retryMs??500)*2**c++,1e4);setTimeout(()=>!d&&x(),g)}}return x(),{get status(){return o},onStatus(l){return i.add(l),()=>i.delete(l)},onEvent(l){return t.add(l),()=>t.delete(l)},request(l,u){if(!s||o!=="connected")return Promise.reject(new Error("Not connected"));let g=String(p++);return s.send(JSON.stringify({id:g,type:l,payload:u})),new Promise((f,b)=>r.set(g,{resolve:f,reject:b}))},close(){d=!0,s?.close()}}}var tn=globalThis.__REVYSE_AGENT__;if(tn&&!window.__revyse){let e=Hi(tn),n={connection:e};window.__revyse=n;let i=()=>{let t=Ii(document,{connection:e,onAction:r=>n.flow?.handle(r),artifactUrl:Mi(tn.url)});n.overlay=t,n.flow=vi({connection:e,setFlow:t.setFlow})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i,{once:!0}):i(),e.onStatus(t=>{t==="rejected"&&console.warn("[revyse] the local agent rejected this page")})}