diff --git a/Distributables/percy-local-manager-extension/BrandMark.js b/Distributables/percy-local-manager-extension/BrandMark.js index 39bb90f..ecab6ca 100644 --- a/Distributables/percy-local-manager-extension/BrandMark.js +++ b/Distributables/percy-local-manager-extension/BrandMark.js @@ -1,8 +1 @@ -import{E as it}from"./constants.js";(function(){const R=document.createElement("link").relList;if(R&&R.supports&&R.supports("modulepreload"))return;for(const B of document.querySelectorAll('link[rel="modulepreload"]'))_e(B);new MutationObserver(B=>{for(const Y of B)if(Y.type==="childList")for(const ce of Y.addedNodes)ce.tagName==="LINK"&&ce.rel==="modulepreload"&&_e(ce)}).observe(document,{childList:!0,subtree:!0});function m(B){const Y={};return B.integrity&&(Y.integrity=B.integrity),B.referrerPolicy&&(Y.referrerPolicy=B.referrerPolicy),B.crossOrigin==="use-credentials"?Y.credentials="include":B.crossOrigin==="anonymous"?Y.credentials="omit":Y.credentials="same-origin",Y}function _e(B){if(B.ep)return;B.ep=!0;const Y=m(B);fetch(B.href,Y)}})();function Da(S){return S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S}var Co={exports:{}},gr={},xo={exports:{}},M={};var Ca;function Rf(){if(Ca)return M;Ca=1;var S=Symbol.for("react.element"),R=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),_e=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),Y=Symbol.for("react.provider"),ce=Symbol.for("react.context"),fe=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),Ce=Symbol.for("react.memo"),ye=Symbol.for("react.lazy"),ee=Symbol.iterator;function Z(c){return c===null||typeof c!="object"?null:(c=ee&&c[ee]||c["@@iterator"],typeof c=="function"?c:null)}var He={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$e=Object.assign,J={};function W(c,v,D){this.props=c,this.context=v,this.refs=J,this.updater=D||He}W.prototype.isReactComponent={},W.prototype.setState=function(c,v){if(typeof c!="object"&&typeof c!="function"&&c!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,c,v,"setState")},W.prototype.forceUpdate=function(c){this.updater.enqueueForceUpdate(this,c,"forceUpdate")};function yt(){}yt.prototype=W.prototype;function st(c,v,D){this.props=c,this.context=v,this.refs=J,this.updater=D||He}var Je=st.prototype=new yt;Je.constructor=st,$e(Je,W.prototype),Je.isPureReactComponent=!0;var ge=Array.isArray,qe=Object.prototype.hasOwnProperty,xe={current:null},ze={key:!0,ref:!0,__self:!0,__source:!0};function We(c,v,D){var I,j={},U=null,Q=null;if(v!=null)for(I in v.ref!==void 0&&(Q=v.ref),v.key!==void 0&&(U=""+v.key),v)qe.call(v,I)&&!ze.hasOwnProperty(I)&&(j[I]=v[I]);var V=arguments.length-2;if(V===1)j.children=D;else if(1>>1,v=k[c];if(0>>1;cB(j,C))UB(Q,j)?(k[c]=Q,k[U]=C,c=U):(k[c]=j,k[I]=C,c=I);else if(UB(Q,C))k[c]=Q,k[U]=C,c=U;else break e}}return L}function B(k,L){var C=k.sortIndex-L.sortIndex;return C!==0?C:k.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var Y=performance;S.unstable_now=function(){return Y.now()}}else{var ce=Date,fe=ce.now();S.unstable_now=function(){return ce.now()-fe}}var $=[],Ce=[],ye=1,ee=null,Z=3,He=!1,$e=!1,J=!1,W=typeof setTimeout=="function"?setTimeout:null,yt=typeof clearTimeout=="function"?clearTimeout:null,st=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Je(k){for(var L=m(Ce);L!==null;){if(L.callback===null)_e(Ce);else if(L.startTime<=k)_e(Ce),L.sortIndex=L.expirationTime,R($,L);else break;L=m(Ce)}}function ge(k){if(J=!1,Je(k),!$e)if(m($)!==null)$e=!0,Te(qe);else{var L=m(Ce);L!==null&&re(ge,L.startTime-k)}}function qe(k,L){$e=!1,J&&(J=!1,yt(We),We=-1),He=!0;var C=Z;try{for(Je(L),ee=m($);ee!==null&&(!(ee.expirationTime>L)||k&&!Yt());){var c=ee.callback;if(typeof c=="function"){ee.callback=null,Z=ee.priorityLevel;var v=c(ee.expirationTime<=L);L=S.unstable_now(),typeof v=="function"?ee.callback=v:ee===m($)&&_e($),Je(L)}else _e($);ee=m($)}if(ee!==null)var D=!0;else{var I=m(Ce);I!==null&&re(ge,I.startTime-L),D=!1}return D}finally{ee=null,Z=C,He=!1}}var xe=!1,ze=null,We=-1,Nt=5,gt=-1;function Yt(){return!(S.unstable_now()-gtk||125c?(k.sortIndex=C,R(Ce,k),m($)===null&&k===m(Ce)&&(J?(yt(We),We=-1):J=!0,re(ge,C-c))):(k.sortIndex=v,R($,k),$e||He||($e=!0,Te(qe))),k},S.unstable_shouldYield=Yt,S.unstable_wrapCallback=function(k){var L=Z;return function(){var C=Z;Z=L;try{return k.apply(this,arguments)}finally{Z=C}}}})(zo)),zo}var Ta;function jf(){return Ta||(Ta=1,No.exports=Ff()),No.exports}var La;function Uf(){if(La)return Ie;La=1;var S=To(),R=jf();function m(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$=Object.prototype.hasOwnProperty,Ce=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ye={},ee={};function Z(e){return $.call(ee,e)?!0:$.call(ye,e)?!1:Ce.test(e)?ee[e]=!0:(ye[e]=!0,!1)}function He(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function $e(e,t,n,r){if(t===null||typeof t>"u"||He(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function J(e,t,n,r,l,u,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=o}var W={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){W[e]=new J(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];W[t]=new J(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){W[e]=new J(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){W[e]=new J(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){W[e]=new J(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){W[e]=new J(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){W[e]=new J(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){W[e]=new J(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){W[e]=new J(e,5,!1,e.toLowerCase(),null,!1,!1)});var yt=/[\-:]([a-z])/g;function st(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(yt,st);W[t]=new J(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(yt,st);W[t]=new J(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(yt,st);W[t]=new J(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){W[e]=new J(e,1,!1,e.toLowerCase(),null,!1,!1)}),W.xlinkHref=new J("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){W[e]=new J(e,1,!1,e.toLowerCase(),null,!0,!0)});function Je(e,t,n,r){var l=W.hasOwnProperty(t)?W[t]:null;(l!==null?l.type!==0:r||!(2i||l[o]!==u[i]){var s=` -`+l[o].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=o&&0<=i);break}}}finally{D=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?v(e):""}function j(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=I(e.type,!1),e;case 11:return e=I(e.type.render,!1),e;case 1:return e=I(e.type,!0),e;default:return""}}function U(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ze:return"Fragment";case xe:return"Portal";case Nt:return"Profiler";case We:return"StrictMode";case Fe:return"Suspense";case be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Yt:return(e.displayName||"Context")+".Consumer";case gt:return(e._context.displayName||"Context")+".Provider";case at:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ct:return t=e.displayName||null,t!==null?t:U(e.type)||"Memo";case Te:t=e._payload,e=e._init;try{return U(e(t))}catch{}}return null}function Q(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(t);case 8:return t===We?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function V(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function q(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function je(e){var t=q(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,u=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,u.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){e._valueTracker||(e._valueTracker=je(e))}function Lo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=q(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Sr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ll(e,t){var n=t.checked;return C({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ro(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=V(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Oo(e,t){t=t.checked,t!=null&&Je(e,"checked",t,!1)}function Rl(e,t){Oo(e,t);var n=V(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ol(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ol(e,t.type,V(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Do(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ol(e,t,n){(t!=="number"||Sr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dn=Array.isArray;function sn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=kr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Mn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ma=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){Ma.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Ao(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function Bo(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ao(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ia=C({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Il(e,t){if(t){if(Ia[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(m(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(m(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(m(61))}if(t.style!=null&&typeof t.style!="object")throw Error(m(62))}}function Fl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jl=null;function Ul(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,an=null,cn=null;function Vo(e){if(e=rr(e)){if(typeof Al!="function")throw Error(m(280));var t=e.stateNode;t&&(t=Wr(t),Al(e.stateNode,e.type,t))}}function Ho(e){an?cn?cn.push(e):cn=[e]:an=e}function $o(){if(an){var e=an,t=cn;if(cn=an=null,Vo(e),t)for(e=0;e>>=0,e===0?32:31-(Ka(e)/Ya|0)|0}var Pr=64,Nr=4194304;function An(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function zr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,u=e.pingedLanes,o=n&268435455;if(o!==0){var i=o&~l;i!==0?r=An(i):(u&=o,u!==0&&(r=An(u)))}else o=n&~l,o!==0?r=An(o):u!==0&&(r=An(u));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,u=t&-t,l>=u||l===16&&(u&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Bn(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-et(t),e[t]=n}function Ja(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Xn),yi=" ",gi=!1;function wi(e,t){switch(e){case"keyup":return xc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Si(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pn=!1;function Nc(e,t){switch(e){case"compositionend":return Si(t);case"keypress":return t.which!==32?null:(gi=!0,yi);case"textInput":return e=t.data,e===yi&&gi?null:e;default:return null}}function zc(e,t){if(pn)return e==="compositionend"||!ru&&wi(e,t)?(e=fi(),Dr=Jl=Ot=null,pn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ni(n)}}function Ti(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ti(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Li(){for(var e=window,t=Sr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Sr(e.document)}return t}function ou(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jc(e){var t=Li(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ti(n.ownerDocument.documentElement,n)){if(r!==null&&ou(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,u=Math.min(r.start,l);r=r.end===void 0?u:Math.min(r.end,l),!e.extend&&u>r&&(l=r,r=u,u=l),l=zi(n,u);var o=zi(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),u>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,mn=null,iu=null,qn=null,su=!1;function Ri(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;su||mn==null||mn!==Sr(r)||(r=mn,"selectionStart"in r&&ou(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qn&&Jn(qn,r)||(qn=r,r=Vr(iu,"onSelect"),0wn||(e.current=Su[wn],Su[wn]=null,wn--)}function K(e,t){wn++,Su[wn]=e.current,e.current=t}var Ft={},we=It(Ft),Le=It(!1),Zt=Ft;function Sn(e,t){var n=e.type.contextTypes;if(!n)return Ft;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},u;for(u in n)l[u]=t[u];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Re(e){return e=e.childContextTypes,e!=null}function Qr(){G(Le),G(we)}function Ki(e,t,n){if(we.current!==Ft)throw Error(m(168));K(we,t),K(Le,n)}function Yi(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(m(108,Q(e)||"Unknown",l));return C({},n,r)}function Kr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ft,Zt=we.current,K(we,e),K(Le,Le.current),!0}function Xi(e,t,n){var r=e.stateNode;if(!r)throw Error(m(169));n?(e=Yi(e,t,Zt),r.__reactInternalMemoizedMergedChildContext=e,G(Le),G(we),K(we,e)):G(Le),K(Le,n)}var St=null,Yr=!1,ku=!1;function Gi(e){St===null?St=[e]:St.push(e)}function Gc(e){Yr=!0,Gi(e)}function jt(){if(!ku&&St!==null){ku=!0;var e=0,t=H;try{var n=St;for(H=1;e>=o,l-=o,kt=1<<32-et(t)+l|n<O?(me=T,T=null):me=T.sibling;var A=h(f,T,d[O],w);if(A===null){T===null&&(T=me);break}e&&T&&A.alternate===null&&t(f,T),a=u(A,a,O),z===null?N=A:z.sibling=A,z=A,T=me}if(O===d.length)return n(f,T),b&&qt(f,O),N;if(T===null){for(;OO?(me=T,T=null):me=T.sibling;var Kt=h(f,T,A.value,w);if(Kt===null){T===null&&(T=me);break}e&&T&&Kt.alternate===null&&t(f,T),a=u(Kt,a,O),z===null?N=Kt:z.sibling=Kt,z=Kt,T=me}if(A.done)return n(f,T),b&&qt(f,O),N;if(T===null){for(;!A.done;O++,A=d.next())A=g(f,A.value,w),A!==null&&(a=u(A,a,O),z===null?N=A:z.sibling=A,z=A);return b&&qt(f,O),N}for(T=r(f,T);!A.done;O++,A=d.next())A=E(T,f,O,A.value,w),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?O:A.key),a=u(A,a,O),z===null?N=A:z.sibling=A,z=A);return e&&T.forEach(function(Lf){return t(f,Lf)}),b&&qt(f,O),N}function oe(f,a,d,w){if(typeof d=="object"&&d!==null&&d.type===ze&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case qe:e:{for(var N=d.key,z=a;z!==null;){if(z.key===N){if(N=d.type,N===ze){if(z.tag===7){n(f,z.sibling),a=l(z,d.props.children),a.return=f,f=a;break e}}else if(z.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Te&&ts(N)===z.type){n(f,z.sibling),a=l(z,d.props),a.ref=lr(f,z,d),a.return=f,f=a;break e}n(f,z);break}else t(f,z);z=z.sibling}d.type===ze?(a=on(d.props.children,f.mode,w,d.key),a.return=f,f=a):(w=kl(d.type,d.key,d.props,null,f.mode,w),w.ref=lr(f,a,d),w.return=f,f=w)}return o(f);case xe:e:{for(z=d.key;a!==null;){if(a.key===z)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){n(f,a.sibling),a=l(a,d.children||[]),a.return=f,f=a;break e}else{n(f,a);break}else t(f,a);a=a.sibling}a=wo(d,f.mode,w),a.return=f,f=a}return o(f);case Te:return z=d._init,oe(f,a,z(d._payload),w)}if(Dn(d))return x(f,a,d,w);if(L(d))return P(f,a,d,w);Jr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(n(f,a.sibling),a=l(a,d),a.return=f,f=a):(n(f,a),a=go(d,f.mode,w),a.return=f,f=a),o(f)):n(f,a)}return oe}var Cn=ns(!0),rs=ns(!1),qr=It(null),br=null,xn=null,Nu=null;function zu(){Nu=xn=br=null}function Tu(e){var t=qr.current;G(qr),e._currentValue=t}function Lu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Pn(e,t){br=e,Nu=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Oe=!0),e.firstContext=null)}function Ye(e){var t=e._currentValue;if(Nu!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(br===null)throw Error(m(308));xn=e,br.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var bt=null;function Ru(e){bt===null?bt=[e]:bt.push(e)}function ls(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ru(t)):(n.next=l.next,l.next=n),t.interleaved=n,_t(e,r)}function _t(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ut=!1;function Ou(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function us(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ct(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function At(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(F&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,_t(e,n)}return l=r.interleaved,l===null?(t.next=t,Ru(r)):(t.next=l.next,l.next=t),r.interleaved=t,_t(e,n)}function el(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Kl(e,n)}}function os(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};u===null?l=u=o:u=u.next=o,n=n.next}while(n!==null);u===null?l=u=t:u=u.next=t}else l=u=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:u,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function tl(e,t,n,r){var l=e.updateQueue;Ut=!1;var u=l.firstBaseUpdate,o=l.lastBaseUpdate,i=l.shared.pending;if(i!==null){l.shared.pending=null;var s=i,p=s.next;s.next=null,o===null?u=p:o.next=p,o=s;var y=e.alternate;y!==null&&(y=y.updateQueue,i=y.lastBaseUpdate,i!==o&&(i===null?y.firstBaseUpdate=p:i.next=p,y.lastBaseUpdate=s))}if(u!==null){var g=l.baseState;o=0,y=p=s=null,i=u;do{var h=i.lane,E=i.eventTime;if((r&h)===h){y!==null&&(y=y.next={eventTime:E,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var x=e,P=i;switch(h=t,E=n,P.tag){case 1:if(x=P.payload,typeof x=="function"){g=x.call(E,g,h);break e}g=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=P.payload,h=typeof x=="function"?x.call(E,g,h):x,h==null)break e;g=C({},g,h);break e;case 2:Ut=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[i]:h.push(i))}else E={eventTime:E,lane:h,tag:i.tag,payload:i.payload,callback:i.callback,next:null},y===null?(p=y=E,s=g):y=y.next=E,o|=h;if(i=i.next,i===null){if(i=l.shared.pending,i===null)break;h=i,i=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(y===null&&(s=g),l.baseState=s,l.firstBaseUpdate=p,l.lastBaseUpdate=y,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else u===null&&(l.shared.lanes=0);nn|=o,e.lanes=o,e.memoizedState=g}}function is(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ju.transition;ju.transition={};try{e(!1),t()}finally{H=n,ju.transition=r}}function Ps(){return Xe().memoizedState}function bc(e,t,n){var r=$t(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ns(e))zs(t,n);else if(n=ls(e,t,n,r),n!==null){var l=Ne();ot(n,e,r,l),Ts(n,t,r)}}function ef(e,t,n){var r=$t(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ns(e))zs(t,l);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var o=t.lastRenderedState,i=u(o,n);if(l.hasEagerState=!0,l.eagerState=i,tt(i,o)){var s=t.interleaved;s===null?(l.next=l,Ru(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}n=ls(e,t,l,r),n!==null&&(l=Ne(),ot(n,e,r,l),Ts(n,t,r))}}function Ns(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function zs(e,t){sr=ll=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ts(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Kl(e,n)}}var il={readContext:Ye,useCallback:Se,useContext:Se,useEffect:Se,useImperativeHandle:Se,useInsertionEffect:Se,useLayoutEffect:Se,useMemo:Se,useReducer:Se,useRef:Se,useState:Se,useDebugValue:Se,useDeferredValue:Se,useTransition:Se,useMutableSource:Se,useSyncExternalStore:Se,useId:Se,unstable_isNewReconciler:!1},tf={readContext:Ye,useCallback:function(e,t){return mt().memoizedState=[e,t===void 0?null:t],e},useContext:Ye,useEffect:gs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ul(4194308,4,ks.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return ul(4,2,e,t)},useMemo:function(e,t){var n=mt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=mt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=bc.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=mt();return e={current:e},t.memoizedState=e},useState:vs,useDebugValue:Wu,useDeferredValue:function(e){return mt().memoizedState=e},useTransition:function(){var e=vs(!1),t=e[0];return e=qc.bind(null,e[1]),mt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,l=mt();if(b){if(n===void 0)throw Error(m(407));n=n()}else{if(n=t(),pe===null)throw Error(m(349));(tn&30)!==0||fs(r,t,n)}l.memoizedState=n;var u={value:n,getSnapshot:t};return l.queue=u,gs(ps.bind(null,r,u,e),[e]),r.flags|=2048,fr(9,ds.bind(null,r,u,n,t),void 0,null),n},useId:function(){var e=mt(),t=pe.identifierPrefix;if(b){var n=Et,r=kt;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ar++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[dt]=t,e[nr]=r,Gs(e,t,!1,!1),t.stateNode=e;e:{switch(o=Fl(n,r),n){case"dialog":X("cancel",e),X("close",e),l=r;break;case"iframe":case"object":case"embed":X("load",e),l=r;break;case"video":case"audio":for(l=0;lRn&&(t.flags|=128,r=!0,dr(u,!1),t.lanes=4194304)}else{if(!r)if(e=nl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dr(u,!0),u.tail===null&&u.tailMode==="hidden"&&!o.alternate&&!b)return ke(t),null}else 2*ue()-u.renderingStartTime>Rn&&n!==1073741824&&(t.flags|=128,r=!0,dr(u,!1),t.lanes=4194304);u.isBackwards?(o.sibling=t.child,t.child=o):(n=u.last,n!==null?n.sibling=o:t.child=o,u.last=o)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ue(),t.sibling=null,n=te.current,K(te,r?n&1|2:n&1),t):(ke(t),null);case 22:case 23:return ho(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Ve&1073741824)!==0&&(ke(t),t.subtreeFlags&6&&(t.flags|=8192)):ke(t),null;case 24:return null;case 25:return null}throw Error(m(156,t.tag))}function cf(e,t){switch(_u(t),t.tag){case 1:return Re(t.type)&&Qr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nn(),G(Le),G(we),Fu(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Mu(t),null;case 13:if(G(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(m(340));_n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(te),null;case 4:return Nn(),null;case 10:return Tu(t.type._context),null;case 22:case 23:return ho(),null;case 24:return null;default:return null}}var fl=!1,Ee=!1,ff=typeof WeakSet=="function"?WeakSet:Set,_=null;function Tn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){le(e,t,r)}else n.current=null}function no(e,t,n){try{n()}catch(r){le(e,t,r)}}var qs=!1;function df(e,t){if(mu=Rr,e=Li(),ou(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,u=r.focusNode;r=r.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var o=0,i=-1,s=-1,p=0,y=0,g=e,h=null;t:for(;;){for(var E;g!==n||l!==0&&g.nodeType!==3||(i=o+l),g!==u||r!==0&&g.nodeType!==3||(s=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(E=g.firstChild)!==null;)h=g,g=E;for(;;){if(g===e)break t;if(h===n&&++p===l&&(i=o),h===u&&++y===r&&(s=o),(E=g.nextSibling)!==null)break;g=h,h=g.parentNode}g=E}n=i===-1||s===-1?null:{start:i,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(hu={focusedElem:e,selectionRange:n},Rr=!1,_=t;_!==null;)if(t=_,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_=e;else for(;_!==null;){t=_;try{var x=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var P=x.memoizedProps,oe=x.memoizedState,f=t.stateNode,a=f.getSnapshotBeforeUpdate(t.elementType===t.type?P:rt(t.type,P),oe);f.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(m(163))}}catch(w){le(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,_=e;break}_=t.return}return x=qs,qs=!1,x}function pr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var u=l.destroy;l.destroy=void 0,u!==void 0&&no(t,n,u)}l=l.next}while(l!==r)}}function dl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ro(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function bs(e){var t=e.alternate;t!==null&&(e.alternate=null,bs(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dt],delete t[nr],delete t[wu],delete t[Yc],delete t[Xc])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ea(e){return e.tag===5||e.tag===3||e.tag===4}function ta(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ea(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$r));else if(r!==4&&(e=e.child,e!==null))for(lo(e,t,n),e=e.sibling;e!==null;)lo(e,t,n),e=e.sibling}function uo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(uo(e,t,n),e=e.sibling;e!==null;)uo(e,t,n),e=e.sibling}var he=null,lt=!1;function Bt(e,t,n){for(n=n.child;n!==null;)na(e,t,n),n=n.sibling}function na(e,t,n){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(xr,n)}catch{}switch(n.tag){case 5:Ee||Tn(n,t);case 6:var r=he,l=lt;he=null,Bt(e,t,n),he=r,lt=l,he!==null&&(lt?(e=he,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):he.removeChild(n.stateNode));break;case 18:he!==null&&(lt?(e=he,n=n.stateNode,e.nodeType===8?gu(e.parentNode,n):e.nodeType===1&&gu(e,n),Qn(e)):gu(he,n.stateNode));break;case 4:r=he,l=lt,he=n.stateNode.containerInfo,lt=!0,Bt(e,t,n),he=r,lt=l;break;case 0:case 11:case 14:case 15:if(!Ee&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var u=l,o=u.destroy;u=u.tag,o!==void 0&&((u&2)!==0||(u&4)!==0)&&no(n,t,o),l=l.next}while(l!==r)}Bt(e,t,n);break;case 1:if(!Ee&&(Tn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(i){le(n,t,i)}Bt(e,t,n);break;case 21:Bt(e,t,n);break;case 22:n.mode&1?(Ee=(r=Ee)||n.memoizedState!==null,Bt(e,t,n),Ee=r):Bt(e,t,n);break;default:Bt(e,t,n)}}function ra(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ff),t.forEach(function(r){var l=kf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~u}if(r=l,r=ue()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mf(r/1960))-r,10e?16:e,Ht===null)var r=!1;else{if(e=Ht,Ht=null,yl=0,(F&6)!==0)throw Error(m(331));var l=F;for(F|=4,_=e.current;_!==null;){var u=_,o=u.child;if((_.flags&16)!==0){var i=u.deletions;if(i!==null){for(var s=0;sue()-so?ln(e,0):io|=n),Me(e,t)}function va(e,t){t===0&&((e.mode&1)===0?t=1:(t=Nr,Nr<<=1,(Nr&130023424)===0&&(Nr=4194304)));var n=Ne();e=_t(e,t),e!==null&&(Bn(e,t,n),Me(e,n))}function Sf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),va(e,n)}function kf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(m(314))}r!==null&&r.delete(t),va(e,n)}var ya;ya=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Le.current)Oe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Oe=!1,sf(e,t,n);Oe=(e.flags&131072)!==0}else Oe=!1,b&&(t.flags&1048576)!==0&&Zi(t,Gr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;cl(e,t),e=t.pendingProps;var l=Sn(t,we.current);Pn(t,n),l=Au(null,t,r,e,l,n);var u=Bu();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Re(r)?(u=!0,Kr(t)):u=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ou(t),l.updater=sl,t.stateNode=l,l._reactInternals=t,Ku(t,r,e,n),t=Zu(null,t,r,!0,u,n)):(t.tag=0,b&&u&&Eu(t),Pe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(cl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=_f(r),e=rt(r,e),l){case 0:t=Gu(null,t,r,e,n);break e;case 1:t=$s(null,t,r,e,n);break e;case 11:t=Us(null,t,r,e,n);break e;case 14:t=As(null,t,r,rt(r.type,e),n);break e}throw Error(m(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),Gu(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),$s(e,t,r,l,n);case 3:e:{if(Ws(t),e===null)throw Error(m(387));r=t.pendingProps,u=t.memoizedState,l=u.element,us(e,t),tl(t,r,null,n);var o=t.memoizedState;if(r=o.element,u.isDehydrated)if(u={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){l=zn(Error(m(423)),t),t=Qs(e,t,r,n,l);break e}else if(r!==l){l=zn(Error(m(424)),t),t=Qs(e,t,r,n,l);break e}else for(Be=Mt(t.stateNode.containerInfo.firstChild),Ae=t,b=!0,nt=null,n=rs(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_n(),r===l){t=xt(e,t,n);break e}Pe(e,t,r,n)}t=t.child}return t;case 5:return ss(t),e===null&&xu(t),r=t.type,l=t.pendingProps,u=e!==null?e.memoizedProps:null,o=l.children,vu(r,l)?o=null:u!==null&&vu(r,u)&&(t.flags|=32),Hs(e,t),Pe(e,t,o,n),t.child;case 6:return e===null&&xu(t),null;case 13:return Ks(e,t,n);case 4:return Du(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cn(t,null,r,n):Pe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),Us(e,t,r,l,n);case 7:return Pe(e,t,t.pendingProps,n),t.child;case 8:return Pe(e,t,t.pendingProps.children,n),t.child;case 12:return Pe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,u=t.memoizedProps,o=l.value,K(qr,r._currentValue),r._currentValue=o,u!==null)if(tt(u.value,o)){if(u.children===l.children&&!Le.current){t=xt(e,t,n);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var i=u.dependencies;if(i!==null){o=u.child;for(var s=i.firstContext;s!==null;){if(s.context===r){if(u.tag===1){s=Ct(-1,n&-n),s.tag=2;var p=u.updateQueue;if(p!==null){p=p.shared;var y=p.pending;y===null?s.next=s:(s.next=y.next,y.next=s),p.pending=s}}u.lanes|=n,s=u.alternate,s!==null&&(s.lanes|=n),Lu(u.return,n,t),i.lanes|=n;break}s=s.next}}else if(u.tag===10)o=u.type===t.type?null:u.child;else if(u.tag===18){if(o=u.return,o===null)throw Error(m(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),Lu(o,n,t),o=u.sibling}else o=u.child;if(o!==null)o.return=u;else for(o=u;o!==null;){if(o===t){o=null;break}if(u=o.sibling,u!==null){u.return=o.return,o=u;break}o=o.return}u=o}Pe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Pn(t,n),l=Ye(l),r=r(l),t.flags|=1,Pe(e,t,r,n),t.child;case 14:return r=t.type,l=rt(r,t.pendingProps),l=rt(r.type,l),As(e,t,r,l,n);case 15:return Bs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),cl(e,t),t.tag=1,Re(r)?(e=!0,Kr(t)):e=!1,Pn(t,n),Rs(t,r,l),Ku(t,r,l,n),Zu(null,t,r,!0,e,n);case 19:return Xs(e,t,n);case 22:return Vs(e,t,n)}throw Error(m(156,t.tag))};function ga(e,t){return Jo(e,t)}function Ef(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ze(e,t,n,r){return new Ef(e,t,n,r)}function yo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _f(e){if(typeof e=="function")return yo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===at)return 11;if(e===ct)return 14}return 2}function Qt(e,t){var n=e.alternate;return n===null?(n=Ze(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function kl(e,t,n,r,l,u){var o=2;if(r=e,typeof e=="function")yo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ze:return on(n.children,l,u,t);case We:o=8,l|=8;break;case Nt:return e=Ze(12,n,t,l|2),e.elementType=Nt,e.lanes=u,e;case Fe:return e=Ze(13,n,t,l),e.elementType=Fe,e.lanes=u,e;case be:return e=Ze(19,n,t,l),e.elementType=be,e.lanes=u,e;case re:return El(n,l,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gt:o=10;break e;case Yt:o=9;break e;case at:o=11;break e;case ct:o=14;break e;case Te:o=16,r=null;break e}throw Error(m(130,e==null?e:typeof e,""))}return t=Ze(o,n,t,l),t.elementType=e,t.type=r,t.lanes=u,t}function on(e,t,n,r){return e=Ze(7,e,r,t),e.lanes=n,e}function El(e,t,n,r){return e=Ze(22,e,r,t),e.elementType=re,e.lanes=n,e.stateNode={isHidden:!1},e}function go(e,t,n){return e=Ze(6,e,null,t),e.lanes=n,e}function wo(e,t,n){return t=Ze(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function So(e,t,n,r,l,u,o,i,s){return e=new Cf(e,t,n,i,s),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Ze(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ou(u),e}function xf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S)}catch(R){console.error(R)}}return S(),Po.exports=Uf(),Po.exports}var Oa;function Bf(){if(Oa)return Tl;Oa=1;var S=Af();return Tl.createRoot=S.createRoot,Tl.hydrateRoot=S.hydrateRoot,Tl}var Vf=Bf();const Wf=Da(Vf);async function vt(S){if(!S.ok){const R=await S.text().catch(()=>"");throw new Error(`Backend request failed (${S.status}): ${R||S.statusText}`)}return S.json().catch(()=>({}))}async function Qf(){try{return(await fetch(it.HEALTH,{method:"GET"})).ok}catch{return!1}}async function Kf(S){const R=await fetch(it.SNAPSHOTS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});await vt(R)}async function Yf(){const S=await fetch(it.SNAPSHOTS,{method:"GET"}),R=await vt(S);return Array.isArray(R)?R:[]}async function Xf(S,R){const m=await fetch(`${it.SNAPSHOTS}/${S}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)});return(await vt(m)).snapshot}async function Gf(S){const R=await fetch(`${it.SNAPSHOTS}/${S}`,{method:"DELETE"});await vt(R)}async function Zf(){const S=await fetch(it.SNAPSHOTS,{method:"DELETE"});await vt(S)}async function Jf(S,R){const m=await fetch(it.FINALIZE_BUILD,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:S,branch:R?.branch,targetBranch:R?.targetBranch})});await vt(m)}async function qf(){const S=await fetch(it.BUILD_STATUS,{method:"GET"});return await vt(S)}async function bf(S){const R=await fetch(it.LIBRARY_TOKEN,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:S})});await vt(R)}async function ed(S){const R=await fetch(`${it.LIBRARY_SEARCH}?q=${encodeURIComponent(S)}`),m=await vt(R);return Array.isArray(m)?m:[]}async function td(){const S=await fetch(it.LIBRARY_ALL),R=await vt(S);return Array.isArray(R)?R:[]}function nd(){return Mf.jsx("img",{src:chrome.runtime.getURL("icons/percy-icon.svg"),alt:"Percy Logo",className:"popup__brand-mark",width:"24",height:"24"})}export{nd as B,Wf as R,Kf as a,bf as b,Qf as c,$f as d,td as e,Af as f,Yf as g,qf as h,Jf as i,Mf as j,Zf as k,Gf as l,If as r,ed as s,Xf as u}; +import{E as n}from"./constants.js";import{j as o}from"./client.js";async function s(t){if(!t.ok){const a=await t.text().catch(()=>"");throw new Error(`Backend request failed (${t.status}): ${a||t.statusText}`)}return t.json().catch(()=>({}))}async function h(){try{return(await fetch(n.HEALTH,{method:"GET"})).ok}catch{return!1}}async function p(t){const a=await fetch(n.SNAPSHOTS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await s(a)}async function y(){const t=await fetch(n.SNAPSHOTS,{method:"GET"}),a=await s(t);return Array.isArray(a)?a:[]}async function f(t,a){const e=await fetch(`${n.SNAPSHOTS}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return(await s(e)).snapshot}async function d(t){const a=await fetch(`${n.SNAPSHOTS}/${t}`,{method:"DELETE"});await s(a)}async function u(){const t=await fetch(n.SNAPSHOTS,{method:"DELETE"});await s(t)}async function S(t,a){const e=await fetch(n.FINALIZE_BUILD,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,branch:a?.branch,targetBranch:a?.targetBranch})});await s(e)}async function w(){const t=await fetch(n.BUILD_STATUS,{method:"GET"});return await s(t)}async function T(t){const a=await fetch(n.LIBRARY_TOKEN,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})});await s(a)}async function A(t){const a=await fetch(`${n.LIBRARY_SEARCH}?q=${encodeURIComponent(t)}`),e=await s(a);return Array.isArray(e)?e:[]}async function m(){const t=await fetch(n.LIBRARY_ALL),a=await s(t);return Array.isArray(a)?a:[]}function E(){return o.jsx("img",{src:chrome.runtime.getURL("icons/percy-icon.svg"),alt:"Percy Logo",className:"popup__brand-mark",width:"24",height:"24"})}export{E as B,p as a,T as b,h as c,m as d,w as e,S as f,y as g,u as h,d as i,A as s,f as u}; diff --git a/Distributables/percy-local-manager-extension/RecordedSteps.js b/Distributables/percy-local-manager-extension/RecordedSteps.js index 4c9ba27..8522d68 100644 --- a/Distributables/percy-local-manager-extension/RecordedSteps.js +++ b/Distributables/percy-local-manager-extension/RecordedSteps.js @@ -1 +1 @@ -import{r as h,j as t}from"./BrandMark.js";const $="percyToken";async function E(){const n=(await chrome.storage.local.get($))[$];return typeof n=="string"?n:""}async function W(e){await chrome.storage.local.set({[$]:e}),await F()}const j="percyTokenPromptedAt",I=1440*60*1e3;async function K(){const n=(await chrome.storage.local.get(j))[j];return typeof n!="number"?!1:Date.now()-n>=I?(await F(),!1):!0}async function Y(){await chrome.storage.local.set({[j]:Date.now()})}async function F(){await chrome.storage.local.remove(j)}function z(){const[e,n]=h.useState(""),[d,l]=h.useState(!0);return h.useEffect(()=>{let a=!1;E().then(c=>{a||n(c)}).finally(()=>{a||l(!1)});function i(c,m){m==="local"&&c.percyToken&&n(typeof c.percyToken.newValue=="string"?c.percyToken.newValue:"")}return chrome.storage.onChanged.addListener(i),()=>{a=!0,chrome.storage.onChanged.removeListener(i)}},[]),{token:e,hasToken:e.trim()!=="",isLoading:d}}function H(e,n){return{waitSeconds:String((e??4e3)/1e3),widths:(n?.widths?.length?n.widths:[]).map(String),minHeight:n?.minHeight?String(n.minHeight):"",scope:n?.scope??"",enableJavaScript:n?.enableJavaScript??!1,percyCSS:n?.percyCSS??""}}function A(e){const n=Number(e.waitSeconds);if(e.waitSeconds.trim()===""||!Number.isFinite(n)||n<0||n>60)return{error:"Wait must be between 0 and 60 seconds."};const d=[];for(const i of e.widths){if(i.trim()==="")continue;const c=Number(i);if(!Number.isInteger(c)||c<1||c>4e3)return{error:"Widths must be whole numbers from 1 to 4000."};d.push(c)}if(d.length>10)return{error:"At most 10 widths."};let l;if(e.minHeight.trim()!==""&&(l=Number(e.minHeight),!Number.isInteger(l)||l<0||l>2e4))return{error:"Minimum height must be 0 to 20000."};if(e.scope.length>500)return{error:"Scope is too long."};if(e.percyCSS.length>1e4)return{error:"Percy CSS is too long."};const a={};return d.length&&(a.widths=d),l&&(a.minHeight=l),e.scope.trim()&&(a.scope=e.scope.trim()),e.enableJavaScript&&(a.enableJavaScript=!0),e.percyCSS.trim()&&(a.percyCSS=e.percyCSS.trim()),{waitMs:Math.round(n*1e3),options:Object.keys(a).length?a:void 0}}function D({idPrefix:e,value:n,onChange:d}){const l=(a,i)=>d({...n,[a]:i});return t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${e}-wait`,children:"Wait before capture (seconds)"}),t.jsx("input",{id:`${e}-wait`,className:"text-input",type:"number",min:0,max:60,step:"0.5",value:n.waitSeconds,onChange:a=>l("waitSeconds",a.target.value)}),t.jsx("label",{className:"field-label",children:"Widths (blank = recorded viewport)"}),n.widths.map((a,i)=>t.jsxs("div",{className:"width-row",children:[t.jsx("input",{className:"text-input",type:"number",min:1,"aria-label":`Width ${i+1}`,value:a,onChange:c=>l("widths",n.widths.map((m,x)=>x===i?c.target.value:m))}),t.jsx("button",{type:"button",className:"width-remove","aria-label":`Remove width ${i+1}`,onClick:()=>l("widths",n.widths.filter((c,m)=>m!==i)),children:"×"})]},i)),t.jsx("button",{type:"button",className:"button button--link",onClick:()=>l("widths",[...n.widths,"1280"]),children:"+ Add width"}),t.jsx("label",{className:"field-label",htmlFor:`${e}-minh`,children:"Minimum height"}),t.jsx("input",{id:`${e}-minh`,className:"text-input",type:"number",min:0,value:n.minHeight,onChange:a=>l("minHeight",a.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${e}-scope`,children:"Scope"}),t.jsx("input",{id:`${e}-scope`,className:"text-input",placeholder:".main-content",value:n.scope,onChange:a=>l("scope",a.target.value)}),t.jsxs("label",{className:"checkbox-field",children:[t.jsx("input",{type:"checkbox",checked:n.enableJavaScript,onChange:a=>l("enableJavaScript",a.target.checked)}),t.jsx("span",{children:"Enable JavaScript"})]}),t.jsx("label",{className:"field-label",htmlFor:`${e}-css`,children:"Percy CSS"}),t.jsx("textarea",{id:`${e}-css`,className:"text-input textarea-input",rows:3,placeholder:".modal { display: none; }",value:n.percyCSS,onChange:a=>l("percyCSS",a.target.value)})]})}const J=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/;function L({step:e,onSave:n,onCancel:d}){const[l,a]=h.useState(e.label??""),[i,c]=h.useState(e.name??""),[m,x]=h.useState(e.target??{}),[S,r]=h.useState(e.value??""),[o,p]=h.useState(e.valueRef??""),[f,_]=h.useState(e.timeoutMs?String(e.timeoutMs):""),[y,R]=h.useState(()=>H(e.waitMs,e.options)),[k,v]=h.useState(null),w=!!e.valueRef,C=e.type==="fill"||e.type==="select",T=!!e.target;function N(s,b){x(g=>({...g,[s]:b||void 0}))}function M(){if(w&&!J.test(o)){v("Reference must be letters, digits and underscores (not starting with a digit).");return}const s=f===""?void 0:Number(f);if(s!==void 0&&(!Number.isFinite(s)||s<0||s>3e5)){v("Timeout must be between 0 and 300000 ms.");return}if(e.type==="snapshot"&&!i.trim()){v("Snapshot name is required.");return}const b={...e,label:l.trim()||void 0,timeoutMs:s||void 0};if(e.type==="snapshot"){const g=A(y);if("error"in g){v(g.error);return}b.waitMs=g.waitMs,b.options=g.options}T&&(b.target=m),C&&(w?b.valueRef=o:b.value=S),e.type==="snapshot"&&(b.name=i.trim()),n(b)}const u=e.id;return t.jsxs("div",{className:"edit-step",children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-label`,children:"Label"}),t.jsx("input",{id:`${u}-label`,className:"text-input",value:l,onChange:s=>a(s.target.value)}),e.type==="snapshot"&&t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-name`,children:"Snapshot name"}),t.jsx("input",{id:`${u}-name`,className:"text-input",value:i,onChange:s=>c(s.target.value)}),t.jsx(D,{idPrefix:u,value:y,onChange:R})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-testid`,children:"Test ID"}),t.jsx("input",{id:`${u}-testid`,className:"text-input",value:m.testId??"",onChange:s=>N("testId",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-role`,children:"Role"}),t.jsx("input",{id:`${u}-role`,className:"text-input",value:m.role??"",onChange:s=>N("role",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-tname`,children:"Accessible name"}),t.jsx("input",{id:`${u}-tname`,className:"text-input",value:m.name??"",onChange:s=>N("name",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-css`,children:"CSS selector"}),t.jsx("input",{id:`${u}-css`,className:"text-input",value:m.css??"",onChange:s=>N("css",s.target.value)})]}),C&&(w?t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-ref`,children:"Secret reference"}),t.jsx("input",{id:`${u}-ref`,className:"text-input",value:o,onChange:s=>p(s.target.value)}),t.jsx("p",{className:"field-help",children:"Resolved when the workflow is replayed. The value is never saved."})]}):t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-value`,children:"Value"}),t.jsx("input",{id:`${u}-value`,className:"text-input",value:S,onChange:s=>r(s.target.value)})]})),t.jsx("label",{className:"field-label",htmlFor:`${u}-timeout`,children:"Timeout (ms)"}),t.jsx("input",{id:`${u}-timeout`,className:"text-input",type:"number",min:0,max:3e5,value:f,onChange:s=>_(s.target.value)}),k&&t.jsx("p",{className:"message message--error",children:k}),t.jsxs("div",{className:"edit-step__actions",children:[t.jsx("button",{type:"button",className:"button button--primary",onClick:M,children:"Save step"}),t.jsx("button",{type:"button",className:"button button--link",onClick:d,children:"Cancel"})]})]})}function O(e){return e?e.testId?`[data-testid=${e.testId}]`:e.role&&e.name?`${e.role} "${e.name}"`:e.css?e.css:e.text?`text "${e.text}"`:"":""}function P(e){const n=O(e.target);switch(e.type){case"click":return`Click ${n}`;case"fill":return e.valueRef?`Fill ${n} with {${e.valueRef}}`:`Fill ${n}`;case"select":return`Select "${e.value??""}" in ${n}`;case"check":return`Check ${n}`;case"uncheck":return`Uncheck ${n}`;case"navigate":return`Go to ${e.url??""}`;case"waitFor":return`Wait for ${n} to be ${e.condition||"visible"}`;case"scroll":return`Scroll to (${e.scrollX??0}, ${e.scrollY??0})`;case"snapshot":return`Snapshot: ${e.name??e.checkpointId??""}${e.waitMs!==void 0?` (wait ${e.waitMs/1e3}s)`:""}`;default:return e.type}}function B({steps:e,editable:n,onChange:d}){const[l,a]=h.useState(null),[i,c]=h.useState(null);if(e.length===0)return t.jsx("p",{className:"field-help",children:"No steps recorded yet."});function m(r){d(e.map(o=>o.id===r.id?r:o)),a(null)}function x(r){d(e.filter(o=>o.id!==r)),c(null)}function S(r,o){const p=[...e],f=r+o;f<0||f>=p.length||([p[r],p[f]]=[p[f],p[r]],d(p))}return t.jsx("ol",{className:"recorded-steps","aria-label":"Recorded steps",children:e.map((r,o)=>t.jsx("li",{className:"recorded-step",children:l===r.id?t.jsx(L,{step:r,onSave:m,onCancel:()=>a(null)}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:`recorded-step__text${r.type==="snapshot"?" recorded-step__text--checkpoint":""}`,children:r.label||P(r)}),n&&i===r.id&&t.jsxs("span",{className:"recorded-step__actions",role:"alertdialog","aria-label":`Confirm delete step ${o+1}`,children:[t.jsx("span",{className:"recorded-step__confirm",children:"Delete this step?"}),t.jsx("button",{type:"button",className:"button button--danger",onClick:()=>x(r.id),children:"Yes, delete"}),t.jsx("button",{type:"button",className:"button button--link",onClick:()=>c(null),children:"Cancel"})]}),n&&i!==r.id&&t.jsxs("span",{className:"recorded-step__actions",children:[t.jsx("button",{type:"button",className:"button button--link","aria-label":`Move step ${o+1} up`,onClick:()=>S(o,-1),disabled:o===0,children:"↑"}),t.jsx("button",{type:"button",className:"button button--link","aria-label":`Move step ${o+1} down`,onClick:()=>S(o,1),disabled:o===e.length-1,children:"↓"}),t.jsx("button",{type:"button",className:"button button--link","aria-label":`Edit step ${o+1}`,onClick:()=>a(r.id),children:"Edit"}),t.jsx("button",{type:"button",className:"button button--danger","aria-label":`Delete step ${o+1}`,onClick:()=>c(r.id),children:"✕"})]})]})},r.id))})}export{B as R,Y as m,W as s,z as u,K as w}; +import{r as h,j as t}from"./client.js";const $="percyToken";async function E(){const n=(await chrome.storage.local.get($))[$];return typeof n=="string"?n:""}async function W(e){await chrome.storage.local.set({[$]:e}),await F()}const j="percyTokenPromptedAt",I=1440*60*1e3;async function K(){const n=(await chrome.storage.local.get(j))[j];return typeof n!="number"?!1:Date.now()-n>=I?(await F(),!1):!0}async function Y(){await chrome.storage.local.set({[j]:Date.now()})}async function F(){await chrome.storage.local.remove(j)}function z(){const[e,n]=h.useState(""),[d,l]=h.useState(!0);return h.useEffect(()=>{let a=!1;E().then(c=>{a||n(c)}).finally(()=>{a||l(!1)});function i(c,m){m==="local"&&c.percyToken&&n(typeof c.percyToken.newValue=="string"?c.percyToken.newValue:"")}return chrome.storage.onChanged.addListener(i),()=>{a=!0,chrome.storage.onChanged.removeListener(i)}},[]),{token:e,hasToken:e.trim()!=="",isLoading:d}}function H(e,n){return{waitSeconds:String((e??4e3)/1e3),widths:(n?.widths?.length?n.widths:[]).map(String),minHeight:n?.minHeight?String(n.minHeight):"",scope:n?.scope??"",enableJavaScript:n?.enableJavaScript??!1,percyCSS:n?.percyCSS??""}}function A(e){const n=Number(e.waitSeconds);if(e.waitSeconds.trim()===""||!Number.isFinite(n)||n<0||n>60)return{error:"Wait must be between 0 and 60 seconds."};const d=[];for(const i of e.widths){if(i.trim()==="")continue;const c=Number(i);if(!Number.isInteger(c)||c<1||c>4e3)return{error:"Widths must be whole numbers from 1 to 4000."};d.push(c)}if(d.length>10)return{error:"At most 10 widths."};let l;if(e.minHeight.trim()!==""&&(l=Number(e.minHeight),!Number.isInteger(l)||l<0||l>2e4))return{error:"Minimum height must be 0 to 20000."};if(e.scope.length>500)return{error:"Scope is too long."};if(e.percyCSS.length>1e4)return{error:"Percy CSS is too long."};const a={};return d.length&&(a.widths=d),l&&(a.minHeight=l),e.scope.trim()&&(a.scope=e.scope.trim()),e.enableJavaScript&&(a.enableJavaScript=!0),e.percyCSS.trim()&&(a.percyCSS=e.percyCSS.trim()),{waitMs:Math.round(n*1e3),options:Object.keys(a).length?a:void 0}}function D({idPrefix:e,value:n,onChange:d}){const l=(a,i)=>d({...n,[a]:i});return t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${e}-wait`,children:"Wait before capture (seconds)"}),t.jsx("input",{id:`${e}-wait`,className:"text-input",type:"number",min:0,max:60,step:"0.5",value:n.waitSeconds,onChange:a=>l("waitSeconds",a.target.value)}),t.jsx("label",{className:"field-label",children:"Widths (blank = recorded viewport)"}),n.widths.map((a,i)=>t.jsxs("div",{className:"width-row",children:[t.jsx("input",{className:"text-input",type:"number",min:1,"aria-label":`Width ${i+1}`,value:a,onChange:c=>l("widths",n.widths.map((m,x)=>x===i?c.target.value:m))}),t.jsx("button",{type:"button",className:"width-remove","aria-label":`Remove width ${i+1}`,onClick:()=>l("widths",n.widths.filter((c,m)=>m!==i)),children:"×"})]},i)),t.jsx("button",{type:"button",className:"button button--link",onClick:()=>l("widths",[...n.widths,"1280"]),children:"+ Add width"}),t.jsx("label",{className:"field-label",htmlFor:`${e}-minh`,children:"Minimum height"}),t.jsx("input",{id:`${e}-minh`,className:"text-input",type:"number",min:0,value:n.minHeight,onChange:a=>l("minHeight",a.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${e}-scope`,children:"Scope"}),t.jsx("input",{id:`${e}-scope`,className:"text-input",placeholder:".main-content",value:n.scope,onChange:a=>l("scope",a.target.value)}),t.jsxs("label",{className:"checkbox-field",children:[t.jsx("input",{type:"checkbox",checked:n.enableJavaScript,onChange:a=>l("enableJavaScript",a.target.checked)}),t.jsx("span",{children:"Enable JavaScript"})]}),t.jsx("label",{className:"field-label",htmlFor:`${e}-css`,children:"Percy CSS"}),t.jsx("textarea",{id:`${e}-css`,className:"text-input textarea-input",rows:3,placeholder:".modal { display: none; }",value:n.percyCSS,onChange:a=>l("percyCSS",a.target.value)})]})}const J=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/;function L({step:e,onSave:n,onCancel:d}){const[l,a]=h.useState(e.label??""),[i,c]=h.useState(e.name??""),[m,x]=h.useState(e.target??{}),[v,r]=h.useState(e.value??""),[o,p]=h.useState(e.valueRef??""),[f,_]=h.useState(e.timeoutMs?String(e.timeoutMs):""),[y,R]=h.useState(()=>H(e.waitMs,e.options)),[k,S]=h.useState(null),w=!!e.valueRef,C=e.type==="fill"||e.type==="select",T=!!e.target;function N(s,b){x(g=>({...g,[s]:b||void 0}))}function M(){if(w&&!J.test(o)){S("Reference must be letters, digits and underscores (not starting with a digit).");return}const s=f===""?void 0:Number(f);if(s!==void 0&&(!Number.isFinite(s)||s<0||s>3e5)){S("Timeout must be between 0 and 300000 ms.");return}if(e.type==="snapshot"&&!i.trim()){S("Snapshot name is required.");return}const b={...e,label:l.trim()||void 0,timeoutMs:s||void 0};if(e.type==="snapshot"){const g=A(y);if("error"in g){S(g.error);return}b.waitMs=g.waitMs,b.options=g.options}T&&(b.target=m),C&&(w?b.valueRef=o:b.value=v),e.type==="snapshot"&&(b.name=i.trim()),n(b)}const u=e.id;return t.jsxs("div",{className:"edit-step",children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-label`,children:"Label"}),t.jsx("input",{id:`${u}-label`,className:"text-input",value:l,onChange:s=>a(s.target.value)}),e.type==="snapshot"&&t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-name`,children:"Snapshot name"}),t.jsx("input",{id:`${u}-name`,className:"text-input",value:i,onChange:s=>c(s.target.value)}),t.jsx(D,{idPrefix:u,value:y,onChange:R})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-testid`,children:"Test ID"}),t.jsx("input",{id:`${u}-testid`,className:"text-input",value:m.testId??"",onChange:s=>N("testId",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-role`,children:"Role"}),t.jsx("input",{id:`${u}-role`,className:"text-input",value:m.role??"",onChange:s=>N("role",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-tname`,children:"Accessible name"}),t.jsx("input",{id:`${u}-tname`,className:"text-input",value:m.name??"",onChange:s=>N("name",s.target.value)}),t.jsx("label",{className:"field-label",htmlFor:`${u}-css`,children:"CSS selector"}),t.jsx("input",{id:`${u}-css`,className:"text-input",value:m.css??"",onChange:s=>N("css",s.target.value)})]}),C&&(w?t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-ref`,children:"Secret reference"}),t.jsx("input",{id:`${u}-ref`,className:"text-input",value:o,onChange:s=>p(s.target.value)}),t.jsx("p",{className:"field-help",children:"Resolved when the workflow is replayed. The value is never saved."})]}):t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"field-label",htmlFor:`${u}-value`,children:"Value"}),t.jsx("input",{id:`${u}-value`,className:"text-input",value:v,onChange:s=>r(s.target.value)})]})),t.jsx("label",{className:"field-label",htmlFor:`${u}-timeout`,children:"Timeout (ms)"}),t.jsx("input",{id:`${u}-timeout`,className:"text-input",type:"number",min:0,max:3e5,value:f,onChange:s=>_(s.target.value)}),k&&t.jsx("p",{className:"message message--error",children:k}),t.jsxs("div",{className:"edit-step__actions",children:[t.jsx("button",{type:"button",className:"button button--primary",onClick:M,children:"Save step"}),t.jsx("button",{type:"button",className:"button button--link",onClick:d,children:"Cancel"})]})]})}function O(e){return e?e.testId?`[data-testid=${e.testId}]`:e.role&&e.name?`${e.role} "${e.name}"`:e.css?e.css:e.text?`text "${e.text}"`:"":""}function P(e){const n=O(e.target);switch(e.type){case"click":return`${e.optional?"Click (if shown) ":"Click "}${n}`;case"hover":return`Hover ${n}`;case"fill":return e.valueRef?`Fill ${n} with {${e.valueRef}}`:`Fill ${n}`;case"select":return`Select "${e.value??""}" in ${n}`;case"check":return`Check ${n}`;case"uncheck":return`Uncheck ${n}`;case"navigate":return`Go to ${e.url??""}`;case"waitFor":return`Wait for ${n} to be ${e.condition||"visible"}`;case"scroll":return`Scroll to (${e.scrollX??0}, ${e.scrollY??0})`;case"snapshot":return`Snapshot: ${e.name??e.checkpointId??""}${e.waitMs!==void 0?` (wait ${e.waitMs/1e3}s)`:""}`;default:return e.type}}function B({steps:e,editable:n,onChange:d}){const[l,a]=h.useState(null),[i,c]=h.useState(null);if(e.length===0)return t.jsx("p",{className:"field-help",children:"No steps recorded yet."});function m(r){d(e.map(o=>o.id===r.id?r:o)),a(null)}function x(r){d(e.filter(o=>o.id!==r)),c(null)}function v(r,o){const p=[...e],f=r+o;f<0||f>=p.length||([p[r],p[f]]=[p[f],p[r]],d(p))}return t.jsx("ol",{className:"recorded-steps","aria-label":"Recorded steps",children:e.map((r,o)=>t.jsx("li",{className:"recorded-step",children:l===r.id?t.jsx(L,{step:r,onSave:m,onCancel:()=>a(null)}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:`recorded-step__text${r.type==="snapshot"?" recorded-step__text--checkpoint":""}`,children:r.label||P(r)}),n&&i===r.id&&t.jsxs("span",{className:"recorded-step__actions",role:"alertdialog","aria-label":`Confirm delete step ${o+1}`,children:[t.jsx("span",{className:"recorded-step__confirm",children:"Delete this step?"}),t.jsx("button",{type:"button",className:"button button--danger",onClick:()=>x(r.id),children:"Yes, delete"}),t.jsx("button",{type:"button",className:"button button--link",onClick:()=>c(null),children:"Cancel"})]}),n&&i!==r.id&&t.jsxs("span",{className:"recorded-step__actions",children:[t.jsx("button",{type:"button",className:"button button--link","aria-label":`Move step ${o+1} up`,onClick:()=>v(o,-1),disabled:o===0,children:"↑"}),t.jsx("button",{type:"button",className:"button button--link","aria-label":`Move step ${o+1} down`,onClick:()=>v(o,1),disabled:o===e.length-1,children:"↓"}),t.jsx("button",{type:"button",className:"button button--link","aria-label":`Edit step ${o+1}`,onClick:()=>a(r.id),children:"Edit"}),t.jsx("button",{type:"button",className:"button button--danger","aria-label":`Delete step ${o+1}`,onClick:()=>c(r.id),children:"✕"})]})]})},r.id))})}export{B as R,Y as m,W as s,z as u,K as w}; diff --git a/Distributables/percy-local-manager-extension/backendApi.js b/Distributables/percy-local-manager-extension/backendApi.js new file mode 100644 index 0000000..9eb33eb --- /dev/null +++ b/Distributables/percy-local-manager-extension/backendApi.js @@ -0,0 +1 @@ +import{E as n}from"./constants.js";async function s(t){if(!t.ok){const a=await t.text().catch(()=>"");throw new Error(`Backend request failed (${t.status}): ${a||t.statusText}`)}return t.json().catch(()=>({}))}async function r(){try{return(await fetch(n.HEALTH,{method:"GET"})).ok}catch{return!1}}async function i(t){const a=await fetch(n.SNAPSHOTS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await s(a)}async function h(){const t=await fetch(n.SNAPSHOTS,{method:"GET"}),a=await s(t);return Array.isArray(a)?a:[]}async function y(t,a){const e=await fetch(`${n.SNAPSHOTS}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return(await s(e)).snapshot}async function f(t){const a=await fetch(`${n.SNAPSHOTS}/${t}`,{method:"DELETE"});await s(a)}async function p(){const t=await fetch(n.SNAPSHOTS,{method:"DELETE"});await s(t)}async function S(t,a){const e=await fetch(n.FINALIZE_BUILD,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,branch:a?.branch,targetBranch:a?.targetBranch})});await s(e)}async function d(){const t=await fetch(n.BUILD_STATUS,{method:"GET"});return await s(t)}async function u(t){const a=await fetch(n.LIBRARY_TOKEN,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})});await s(a)}async function T(t){const a=await fetch(`${n.LIBRARY_SEARCH}?q=${encodeURIComponent(t)}`),e=await s(a);return Array.isArray(e)?e:[]}async function w(){const t=await fetch(n.LIBRARY_ALL),a=await s(t);return Array.isArray(a)?a:[]}export{i as a,u as b,r as c,w as d,d as e,S as f,h as g,p as h,f as i,T as s,y as u}; diff --git a/Distributables/percy-local-manager-extension/background.js b/Distributables/percy-local-manager-extension/background.js index cfbb17f..fa232c2 100644 --- a/Distributables/percy-local-manager-extension/background.js +++ b/Distributables/percy-local-manager-extension/background.js @@ -1 +1 @@ -import{d as w,r as f,e as y,f as m}from"./recorderCore.js";import"./constants.js";const u="recordingState",d={active:!1,steps:[]};async function i(){return(await chrome.storage.session.get(u))[u]??d}async function o(t){if(await chrome.storage.session.set({[u]:t}),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:t})}catch{}}async function c(t,e){if(t!==void 0)try{await chrome.tabs.sendMessage(t,{kind:"rec:active",active:e})}catch{}}async function h(t){try{const e=await chrome.tabs.sendMessage(t,{kind:"rec:viewport"});return e?.width&&e?.height?e:void 0}catch{return}}async function g(){const[t]=await chrome.tabs.query({active:!0,currentWindow:!0});if(!t?.id||!t.url||!/^https?:/.test(t.url))throw new Error("Open an http(s) page in the active tab to record.");let e=await h(t.id);if(!e)try{await chrome.scripting.executeScript({target:{tabId:t.id},files:["content.js"]}),e=await h(t.id)}catch{throw new Error("Could not attach the recorder to this page. Reload the page and try again.")}const r=e??{width:1280,height:800},s={active:!0,tabId:t.id,startUrl:t.url,viewport:r,steps:[]};return await o(s),await c(t.id,!0),s}async function I(){const t=await i(),e={...t,active:!1,paused:!1};if(await o(e),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:e})}catch{}return e}async function l(){const t=await i();if(await c(t.tabId,!1),await chrome.storage.session.set({[u]:d}),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:d})}catch{}return d}const v=new Set(["click","fill","select","check","uncheck"]);function b(t){const e=t.target;return!!(e&&(e.testId||e.role||e.css||e.text))}async function k(t){const e=await i();if(e.active)throw new Error("Stop recording before saving.");if(!e.startUrl||!e.viewport)throw new Error("Nothing recorded.");if(!e.steps.some(n=>n.type==="snapshot"))throw new Error("Add at least one Capture Snapshot checkpoint before saving.");const r=t.trim();if(!r)throw new Error("Enter a workflow name.");const s=e.steps.findIndex(n=>v.has(n.type)&&!b(n));if(s>=0)throw new Error(`Step ${s+1} (${e.steps[s].type}) has no locator. Delete it in the panel and save again.`);const a=await m({name:r,schemaVersion:1,startUrl:e.startUrl,steps:f(e.steps),settings:{defaultTimeoutMs:1e4,viewport:e.viewport}});return await l(),{workflowId:a.workflowId,name:a.name}}async function E(){const t=await i();if(!t.active)throw new Error("Not recording.");const e={...t,paused:!0};return await o(e),await c(t.tabId,!1),e}async function M(){const t=await i();if(!t.active)throw new Error("Not recording.");let e=t.steps;if(t.tabId!==void 0)try{const s=await chrome.tabs.get(t.tabId),a=[...e].reverse().find(n=>n.type==="navigate")?.url??t.startUrl;s.url&&/^https?:/.test(s.url)&&s.url!==a&&(e=w(e,{type:"navigate",url:s.url}))}catch{}const r={...t,paused:!1,steps:e};return await o(r),await c(t.tabId,!0),r}async function S(t,e){const r=await i();!r.active||r.paused||r.tabId!==e||v.has(t.type)&&!b(t)||await o({...r,steps:w(r.steps,t)})}chrome.runtime.onMessage.addListener((t,e,r)=>((async()=>{switch(t?.kind){case"rec:start":return g();case"rec:stop":return I();case"rec:pause":return E();case"rec:resume":return M();case"rec:get":return i();case"rec:clear":return l();case"rec:snapshot":{const a=await i();if(!a.active)throw new Error("Not recording.");const n=typeof t.waitMs=="number"&&t.waitMs>=0&&t.waitMs<=6e4?Math.round(t.waitMs):void 0,p={...a,steps:y(a.steps,String(t.name??""),{waitMs:n,options:t.options})};return await o(p),p}case"rec:save":return k(String(t.name??""));case"rec:setSteps":{const a=await i();return await o({...a,steps:f(t.steps)}),{ok:!0}}case"rec:event":return await S(t.step,e.tab?.id),{ok:!0};case"rec:hello":{const a=await i(),n=a.tabId===e.tab?.id;return{active:a.active&&!a.paused&&n,state:n?a:void 0}}default:return}})().then(a=>r(a)).catch(a=>r({error:String(a?.message??a)})),!0));chrome.webNavigation?.onCommitted.addListener(async t=>{if(t.frameId!==0)return;const e=await i();!e.active||e.tabId!==t.tabId||e.paused||((t.transitionType==="typed"||t.transitionType==="auto_bookmark")&&await o({...e,steps:w(e.steps,{type:"navigate",url:t.url})}),await c(t.tabId,!0))}); +import{d as w,r as f,e as g,f as y}from"./recorderCore.js";import"./constants.js";const u="recordingState",d={active:!1,steps:[]};async function i(){return(await chrome.storage.session.get(u))[u]??d}async function o(t){if(await chrome.storage.session.set({[u]:t}),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:t})}catch{}}async function c(t,e){if(t!==void 0)try{await chrome.tabs.sendMessage(t,{kind:"rec:active",active:e})}catch{}}async function h(t){try{const e=await chrome.tabs.sendMessage(t,{kind:"rec:viewport"});return e?.width&&e?.height?e:void 0}catch{return}}async function m(){const[t]=await chrome.tabs.query({active:!0,currentWindow:!0});if(!t?.id||!t.url||!/^https?:/.test(t.url))throw new Error("Open an http(s) page in the active tab to record.");let e=await h(t.id);if(!e)try{await chrome.scripting.executeScript({target:{tabId:t.id},files:["content.js"]}),e=await h(t.id)}catch{throw new Error("Could not attach the recorder to this page. Reload the page and try again.")}const r=e?{width:e.width,height:e.height}:{width:1280,height:800},s={active:!0,tabId:t.id,startUrl:t.url,viewport:r,pageKind:e?.pageKind,steps:[]};return await o(s),await c(t.id,!0),s}async function I(){const t=await i(),e={...t,active:!1,paused:!1};if(await o(e),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:e})}catch{}return e}async function l(){const t=await i();if(await c(t.tabId,!1),await chrome.storage.session.set({[u]:d}),t.tabId!==void 0)try{await chrome.tabs.sendMessage(t.tabId,{kind:"rec:state",state:d})}catch{}return d}const v=new Set(["click","hover","fill","select","check","uncheck"]);function b(t){const e=t.target;return!!(e&&(e.testId||e.role||e.css||e.text))}async function k(t){const e=await i();if(e.active)throw new Error("Stop recording before saving.");if(!e.startUrl||!e.viewport)throw new Error("Nothing recorded.");if(!e.steps.some(n=>n.type==="snapshot"))throw new Error("Add at least one Capture Snapshot checkpoint before saving.");const r=t.trim();if(!r)throw new Error("Enter a workflow name.");const s=e.steps.findIndex(n=>v.has(n.type)&&!b(n));if(s>=0)throw new Error(`Step ${s+1} (${e.steps[s].type}) has no locator. Delete it in the panel and save again.`);const a=await y({name:r,schemaVersion:1,startUrl:e.startUrl,steps:f(e.steps),settings:{defaultTimeoutMs:1e4,viewport:e.viewport,autoConsent:!0,stabilize:!0,pageKind:e.pageKind}});return await l(),{workflowId:a.workflowId,name:a.name}}async function E(){const t=await i();if(!t.active)throw new Error("Not recording.");const e={...t,paused:!0};return await o(e),await c(t.tabId,!1),e}async function M(){const t=await i();if(!t.active)throw new Error("Not recording.");let e=t.steps;if(t.tabId!==void 0)try{const s=await chrome.tabs.get(t.tabId),a=[...e].reverse().find(n=>n.type==="navigate")?.url??t.startUrl;s.url&&/^https?:/.test(s.url)&&s.url!==a&&(e=w(e,{type:"navigate",url:s.url}))}catch{}const r={...t,paused:!1,steps:e};return await o(r),await c(t.tabId,!0),r}async function S(t,e){const r=await i();!r.active||r.paused||r.tabId!==e||v.has(t.type)&&!b(t)||await o({...r,steps:w(r.steps,t)})}chrome.runtime.onMessage.addListener((t,e,r)=>((async()=>{switch(t?.kind){case"rec:start":return m();case"rec:stop":return I();case"rec:pause":return E();case"rec:resume":return M();case"rec:get":return i();case"rec:clear":return l();case"rec:snapshot":{const a=await i();if(!a.active)throw new Error("Not recording.");const n=typeof t.waitMs=="number"&&t.waitMs>=0&&t.waitMs<=6e4?Math.round(t.waitMs):void 0,p={...a,steps:g(a.steps,String(t.name??""),{waitMs:n,options:t.options})};return await o(p),p}case"rec:save":return k(String(t.name??""));case"rec:setSteps":{const a=await i();return await o({...a,steps:f(t.steps)}),{ok:!0}}case"rec:event":return await S(t.step,e.tab?.id),{ok:!0};case"rec:hello":{const a=await i(),n=a.tabId===e.tab?.id;return{active:a.active&&!a.paused&&n,state:n?a:void 0}}default:return}})().then(a=>r(a)).catch(a=>r({error:String(a?.message??a)})),!0));chrome.webNavigation?.onCommitted.addListener(async t=>{if(t.frameId!==0)return;const e=await i();!e.active||e.tabId!==t.tabId||e.paused||((t.transitionType==="typed"||t.transitionType==="auto_bookmark")&&await o({...e,steps:w(e.steps,{type:"navigate",url:t.url})}),await c(t.tabId,!0))}); diff --git a/Distributables/percy-local-manager-extension/client.js b/Distributables/percy-local-manager-extension/client.js new file mode 100644 index 0000000..f9399e2 --- /dev/null +++ b/Distributables/percy-local-manager-extension/client.js @@ -0,0 +1,8 @@ +(function(){const H=document.createElement("link").relList;if(H&&H.supports&&H.supports("modulepreload"))return;for(const V of document.querySelectorAll('link[rel="modulepreload"]'))Ne(V);new MutationObserver(V=>{for(const Y of V)if(Y.type==="childList")for(const fe of Y.addedNodes)fe.tagName==="LINK"&&fe.rel==="modulepreload"&&Ne(fe)}).observe(document,{childList:!0,subtree:!0});function m(V){const Y={};return V.integrity&&(Y.integrity=V.integrity),V.referrerPolicy&&(Y.referrerPolicy=V.referrerPolicy),V.crossOrigin==="use-credentials"?Y.credentials="include":V.crossOrigin==="anonymous"?Y.credentials="omit":Y.credentials="same-origin",Y}function Ne(V){if(V.ep)return;V.ep=!0;const Y=m(V);fetch(V.href,Y)}})();function Ra(T){return T&&T.__esModule&&Object.prototype.hasOwnProperty.call(T,"default")?T.default:T}var Eo={exports:{}},hr={},_o={exports:{}},M={};var Ea;function Lc(){if(Ea)return M;Ea=1;var T=Symbol.for("react.element"),H=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),Ne=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),Y=Symbol.for("react.provider"),fe=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),_e=Symbol.for("react.memo"),ye=Symbol.for("react.lazy"),ee=Symbol.iterator;function Z(f){return f===null||typeof f!="object"?null:(f=ee&&f[ee]||f["@@iterator"],typeof f=="function"?f:null)}var He={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$e=Object.assign,J={};function W(f,h,O){this.props=f,this.context=h,this.refs=J,this.updater=O||He}W.prototype.isReactComponent={},W.prototype.setState=function(f,h){if(typeof f!="object"&&typeof f!="function"&&f!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,f,h,"setState")},W.prototype.forceUpdate=function(f){this.updater.enqueueForceUpdate(this,f,"forceUpdate")};function vt(){}vt.prototype=W.prototype;function it(f,h,O){this.props=f,this.context=h,this.refs=J,this.updater=O||He}var Je=it.prototype=new vt;Je.constructor=it,$e(Je,W.prototype),Je.isPureReactComponent=!0;var ge=Array.isArray,qe=Object.prototype.hasOwnProperty,Ce={current:null},ze={key:!0,ref:!0,__self:!0,__source:!0};function We(f,h,O){var D,F={},j=null,Q=null;if(h!=null)for(D in h.ref!==void 0&&(Q=h.ref),h.key!==void 0&&(j=""+h.key),h)qe.call(h,D)&&!ze.hasOwnProperty(D)&&(F[D]=h[D]);var A=arguments.length-2;if(A===1)F.children=O;else if(1>>1,h=S[f];if(0>>1;fV(F,_))jV(Q,F)?(S[f]=Q,S[j]=_,f=j):(S[f]=F,S[D]=_,f=D);else if(jV(Q,_))S[f]=Q,S[j]=_,f=j;else break e}}return L}function V(S,L){var _=S.sortIndex-L.sortIndex;return _!==0?_:S.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var Y=performance;T.unstable_now=function(){return Y.now()}}else{var fe=Date,ce=fe.now();T.unstable_now=function(){return fe.now()-ce}}var $=[],_e=[],ye=1,ee=null,Z=3,He=!1,$e=!1,J=!1,W=typeof setTimeout=="function"?setTimeout:null,vt=typeof clearTimeout=="function"?clearTimeout:null,it=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Je(S){for(var L=m(_e);L!==null;){if(L.callback===null)Ne(_e);else if(L.startTime<=S)Ne(_e),L.sortIndex=L.expirationTime,H($,L);else break;L=m(_e)}}function ge(S){if(J=!1,Je(S),!$e)if(m($)!==null)$e=!0,Le(qe);else{var L=m(_e);L!==null&&re(ge,L.startTime-S)}}function qe(S,L){$e=!1,J&&(J=!1,vt(We),We=-1),He=!0;var _=Z;try{for(Je(L),ee=m($);ee!==null&&(!(ee.expirationTime>L)||S&&!Qt());){var f=ee.callback;if(typeof f=="function"){ee.callback=null,Z=ee.priorityLevel;var h=f(ee.expirationTime<=L);L=T.unstable_now(),typeof h=="function"?ee.callback=h:ee===m($)&&Ne($),Je(L)}else Ne($);ee=m($)}if(ee!==null)var O=!0;else{var D=m(_e);D!==null&&re(ge,D.startTime-L),O=!1}return O}finally{ee=null,Z=_,He=!1}}var Ce=!1,ze=null,We=-1,xt=5,ht=-1;function Qt(){return!(T.unstable_now()-htS||125f?(S.sortIndex=_,H(_e,S),m($)===null&&S===m(_e)&&(J?(vt(We),We=-1):J=!0,re(ge,_-f))):(S.sortIndex=h,H($,S),$e||He||($e=!0,Le(qe))),S},T.unstable_shouldYield=Qt,T.unstable_wrapCallback=function(S){var L=Z;return function(){var _=Z;Z=L;try{return S.apply(this,arguments)}finally{Z=_}}}})(Po)),Po}var Na;function Dc(){return Na||(Na=1,xo.exports=Mc()),xo.exports}var za;function Ic(){if(za)return Ie;za=1;var T=No(),H=Dc();function m(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$=Object.prototype.hasOwnProperty,_e=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ye={},ee={};function Z(e){return $.call(ee,e)?!0:$.call(ye,e)?!1:_e.test(e)?ee[e]=!0:(ye[e]=!0,!1)}function He(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function $e(e,t,n,r){if(t===null||typeof t>"u"||He(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function J(e,t,n,r,l,u,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=u,this.removeEmptyString=o}var W={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){W[e]=new J(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];W[t]=new J(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){W[e]=new J(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){W[e]=new J(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){W[e]=new J(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){W[e]=new J(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){W[e]=new J(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){W[e]=new J(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){W[e]=new J(e,5,!1,e.toLowerCase(),null,!1,!1)});var vt=/[\-:]([a-z])/g;function it(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vt,it);W[t]=new J(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vt,it);W[t]=new J(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vt,it);W[t]=new J(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){W[e]=new J(e,1,!1,e.toLowerCase(),null,!1,!1)}),W.xlinkHref=new J("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){W[e]=new J(e,1,!1,e.toLowerCase(),null,!0,!0)});function Je(e,t,n,r){var l=W.hasOwnProperty(t)?W[t]:null;(l!==null?l.type!==0:r||!(2i||l[o]!==u[i]){var s=` +`+l[o].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=o&&0<=i);break}}}finally{O=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?h(e):""}function F(e){switch(e.tag){case 5:return h(e.type);case 16:return h("Lazy");case 13:return h("Suspense");case 19:return h("SuspenseList");case 0:case 2:case 15:return e=D(e.type,!1),e;case 11:return e=D(e.type.render,!1),e;case 1:return e=D(e.type,!0),e;default:return""}}function j(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ze:return"Fragment";case Ce:return"Portal";case xt:return"Profiler";case We:return"StrictMode";case Fe:return"Suspense";case be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qt:return(e.displayName||"Context")+".Consumer";case ht:return(e._context.displayName||"Context")+".Provider";case st:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case at:return t=e.displayName||null,t!==null?t:j(e.type)||"Memo";case Le:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}function Q(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return j(t);case 8:return t===We?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function A(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function q(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function je(e){var t=q(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,u=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,u.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yr(e){e._valueTracker||(e._valueTracker=je(e))}function zo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=q(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function gr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function zl(e,t){var n=t.checked;return _({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Lo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=A(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function To(e,t){t=t.checked,t!=null&&Je(e,"checked",t,!1)}function Ll(e,t){To(e,t);var n=A(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Tl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Tl(e,t.type,A(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ro(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Tl(e,t,n){(t!=="number"||gr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rn=Array.isArray;function un(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function On(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Oa=["Webkit","ms","Moz","O"];Object.keys(Mn).forEach(function(e){Oa.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mn[t]=Mn[e]})});function jo(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mn.hasOwnProperty(e)&&Mn[e]?(""+t).trim():t+"px"}function Uo(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=jo(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ma=_({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ml(e,t){if(t){if(Ma[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(m(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(m(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(m(61))}if(t.style!=null&&typeof t.style!="object")throw Error(m(62))}}function Dl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Il=null;function Fl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var jl=null,on=null,sn=null;function Vo(e){if(e=tr(e)){if(typeof jl!="function")throw Error(m(280));var t=e.stateNode;t&&(t=Hr(t),jl(e.stateNode,e.type,t))}}function Ao(e){on?sn?sn.push(e):sn=[e]:on=e}function Bo(){if(on){var e=on,t=sn;if(sn=on=null,Vo(e),t)for(e=0;e>>=0,e===0?32:31-(Wa(e)/Qa|0)|0}var Cr=64,xr=4194304;function jn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,u=e.pingedLanes,o=n&268435455;if(o!==0){var i=o&~l;i!==0?r=jn(i):(u&=o,u!==0&&(r=jn(u)))}else o=n&~l,o!==0?r=jn(o):u!==0&&(r=jn(u));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,u=t&-t,l>=u||l===16&&(u&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Un(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-et(t),e[t]=n}function Ga(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Kn),vi=" ",hi=!1;function yi(e,t){switch(e){case"keyup":return Cf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gi(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cn=!1;function Pf(e,t){switch(e){case"compositionend":return gi(t);case"keypress":return t.which!==32?null:(hi=!0,vi);case"textInput":return e=t.data,e===vi&&hi?null:e;default:return null}}function Nf(e,t){if(cn)return e==="compositionend"||!tu&&yi(e,t)?(e=ai(),Rr=Gl=Tt=null,cn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=xi(n)}}function Ni(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ni(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zi(){for(var e=window,t=gr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=gr(e.document)}return t}function lu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ff(e){var t=zi(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ni(n.ownerDocument.documentElement,n)){if(r!==null&&lu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,u=Math.min(r.start,l);r=r.end===void 0?u:Math.min(r.end,l),!e.extend&&u>r&&(l=r,r=u,u=l),l=Pi(n,u);var o=Pi(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),u>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,dn=null,uu=null,Zn=null,ou=!1;function Li(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ou||dn==null||dn!==gr(r)||(r=dn,"selectionStart"in r&&lu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Zn&&Gn(Zn,r)||(Zn=r,r=Vr(uu,"onSelect"),0yn||(e.current=gu[yn],gu[yn]=null,yn--)}function K(e,t){yn++,gu[yn]=e.current,e.current=t}var Dt={},we=Mt(Dt),Te=Mt(!1),Xt=Dt;function gn(e,t){var n=e.type.contextTypes;if(!n)return Dt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},u;for(u in n)l[u]=t[u];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Re(e){return e=e.childContextTypes,e!=null}function $r(){G(Te),G(we)}function Wi(e,t,n){if(we.current!==Dt)throw Error(m(168));K(we,t),K(Te,n)}function Qi(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(m(108,Q(e)||"Unknown",l));return _({},n,r)}function Wr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Dt,Xt=we.current,K(we,e),K(Te,Te.current),!0}function Ki(e,t,n){var r=e.stateNode;if(!r)throw Error(m(169));n?(e=Qi(e,t,Xt),r.__reactInternalMemoizedMergedChildContext=e,G(Te),G(we),K(we,e)):G(Te),K(Te,n)}var gt=null,Qr=!1,wu=!1;function Yi(e){gt===null?gt=[e]:gt.push(e)}function Xf(e){Qr=!0,Yi(e)}function It(){if(!wu&>!==null){wu=!0;var e=0,t=B;try{var n=gt;for(B=1;e>=o,l-=o,wt=1<<32-et(t)+l|n<R?(me=z,z=null):me=z.sibling;var U=v(c,z,d[R],w);if(U===null){z===null&&(z=me);break}e&&z&&U.alternate===null&&t(c,z),a=u(U,a,R),N===null?P=U:N.sibling=U,N=U,z=me}if(R===d.length)return n(c,z),b&&Zt(c,R),P;if(z===null){for(;RR?(me=z,z=null):me=z.sibling;var Wt=v(c,z,U.value,w);if(Wt===null){z===null&&(z=me);break}e&&z&&Wt.alternate===null&&t(c,z),a=u(Wt,a,R),N===null?P=Wt:N.sibling=Wt,N=Wt,z=me}if(U.done)return n(c,z),b&&Zt(c,R),P;if(z===null){for(;!U.done;R++,U=d.next())U=g(c,U.value,w),U!==null&&(a=u(U,a,R),N===null?P=U:N.sibling=U,N=U);return b&&Zt(c,R),P}for(z=r(c,z);!U.done;R++,U=d.next())U=k(z,c,R,U.value,w),U!==null&&(e&&U.alternate!==null&&z.delete(U.key===null?R:U.key),a=u(U,a,R),N===null?P=U:N.sibling=U,N=U);return e&&z.forEach(function(zc){return t(c,zc)}),b&&Zt(c,R),P}function oe(c,a,d,w){if(typeof d=="object"&&d!==null&&d.type===ze&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case qe:e:{for(var P=d.key,N=a;N!==null;){if(N.key===P){if(P=d.type,P===ze){if(N.tag===7){n(c,N.sibling),a=l(N,d.props.children),a.return=c,c=a;break e}}else if(N.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Le&&bi(P)===N.type){n(c,N.sibling),a=l(N,d.props),a.ref=nr(c,N,d),a.return=c,c=a;break e}n(c,N);break}else t(c,N);N=N.sibling}d.type===ze?(a=ln(d.props.children,c.mode,w,d.key),a.return=c,c=a):(w=wl(d.type,d.key,d.props,null,c.mode,w),w.ref=nr(c,a,d),w.return=c,c=w)}return o(c);case Ce:e:{for(N=d.key;a!==null;){if(a.key===N)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){n(c,a.sibling),a=l(a,d.children||[]),a.return=c,c=a;break e}else{n(c,a);break}else t(c,a);a=a.sibling}a=yo(d,c.mode,w),a.return=c,c=a}return o(c);case Le:return N=d._init,oe(c,a,N(d._payload),w)}if(Rn(d))return C(c,a,d,w);if(L(d))return x(c,a,d,w);Gr(c,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(n(c,a.sibling),a=l(a,d),a.return=c,c=a):(n(c,a),a=ho(d,c.mode,w),a.return=c,c=a),o(c)):n(c,a)}return oe}var En=es(!0),ts=es(!1),Zr=Mt(null),Jr=null,_n=null,xu=null;function Pu(){xu=_n=Jr=null}function Nu(e){var t=Zr.current;G(Zr),e._currentValue=t}function zu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Cn(e,t){Jr=e,xu=_n=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Oe=!0),e.firstContext=null)}function Ye(e){var t=e._currentValue;if(xu!==e)if(e={context:e,memoizedValue:t,next:null},_n===null){if(Jr===null)throw Error(m(308));_n=e,Jr.dependencies={lanes:0,firstContext:e}}else _n=_n.next=e;return t}var Jt=null;function Lu(e){Jt===null?Jt=[e]:Jt.push(e)}function ns(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Lu(t)):(n.next=l.next,l.next=n),t.interleaved=n,kt(e,r)}function kt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ft=!1;function Tu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rs(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Et(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function jt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(I&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,kt(e,n)}return l=r.interleaved,l===null?(t.next=t,Lu(r)):(t.next=l.next,l.next=t),r.interleaved=t,kt(e,n)}function qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wl(e,n)}}function ls(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};u===null?l=u=o:u=u.next=o,n=n.next}while(n!==null);u===null?l=u=t:u=u.next=t}else l=u=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:u,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function br(e,t,n,r){var l=e.updateQueue;Ft=!1;var u=l.firstBaseUpdate,o=l.lastBaseUpdate,i=l.shared.pending;if(i!==null){l.shared.pending=null;var s=i,p=s.next;s.next=null,o===null?u=p:o.next=p,o=s;var y=e.alternate;y!==null&&(y=y.updateQueue,i=y.lastBaseUpdate,i!==o&&(i===null?y.firstBaseUpdate=p:i.next=p,y.lastBaseUpdate=s))}if(u!==null){var g=l.baseState;o=0,y=p=s=null,i=u;do{var v=i.lane,k=i.eventTime;if((r&v)===v){y!==null&&(y=y.next={eventTime:k,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var C=e,x=i;switch(v=t,k=n,x.tag){case 1:if(C=x.payload,typeof C=="function"){g=C.call(k,g,v);break e}g=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=x.payload,v=typeof C=="function"?C.call(k,g,v):C,v==null)break e;g=_({},g,v);break e;case 2:Ft=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[i]:v.push(i))}else k={eventTime:k,lane:v,tag:i.tag,payload:i.payload,callback:i.callback,next:null},y===null?(p=y=k,s=g):y=y.next=k,o|=v;if(i=i.next,i===null){if(i=l.shared.pending,i===null)break;v=i,i=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(y===null&&(s=g),l.baseState=s,l.firstBaseUpdate=p,l.lastBaseUpdate=y,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else u===null&&(l.shared.lanes=0);en|=o,e.lanes=o,e.memoizedState=g}}function us(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Iu.transition;Iu.transition={};try{e(!1),t()}finally{B=n,Iu.transition=r}}function Cs(){return Xe().memoizedState}function qf(e,t,n){var r=Bt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xs(e))Ps(t,n);else if(n=ns(e,t,n,r),n!==null){var l=Pe();ot(n,e,r,l),Ns(n,t,r)}}function bf(e,t,n){var r=Bt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xs(e))Ps(t,l);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var o=t.lastRenderedState,i=u(o,n);if(l.hasEagerState=!0,l.eagerState=i,tt(i,o)){var s=t.interleaved;s===null?(l.next=l,Lu(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}n=ns(e,t,l,r),n!==null&&(l=Pe(),ot(n,e,r,l),Ns(n,t,r))}}function xs(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function Ps(e,t){or=nl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wl(e,n)}}var ul={readContext:Ye,useCallback:Se,useContext:Se,useEffect:Se,useImperativeHandle:Se,useInsertionEffect:Se,useLayoutEffect:Se,useMemo:Se,useReducer:Se,useRef:Se,useState:Se,useDebugValue:Se,useDeferredValue:Se,useTransition:Se,useMutableSource:Se,useSyncExternalStore:Se,useId:Se,unstable_isNewReconciler:!1},ec={readContext:Ye,useCallback:function(e,t){return pt().memoizedState=[e,t===void 0?null:t],e},useContext:Ye,useEffect:hs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,rl(4194308,4,ws.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rl(4194308,4,e,t)},useInsertionEffect:function(e,t){return rl(4,2,e,t)},useMemo:function(e,t){var n=pt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=pt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=qf.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=pt();return e={current:e},t.memoizedState=e},useState:ms,useDebugValue:Hu,useDeferredValue:function(e){return pt().memoizedState=e},useTransition:function(){var e=ms(!1),t=e[0];return e=Jf.bind(null,e[1]),pt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,l=pt();if(b){if(n===void 0)throw Error(m(407));n=n()}else{if(n=t(),pe===null)throw Error(m(349));(bt&30)!==0||as(r,t,n)}l.memoizedState=n;var u={value:n,getSnapshot:t};return l.queue=u,hs(cs.bind(null,r,u,e),[e]),r.flags|=2048,ar(9,fs.bind(null,r,u,n,t),void 0,null),n},useId:function(){var e=pt(),t=pe.identifierPrefix;if(b){var n=St,r=wt;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ct]=t,e[er]=r,Ys(e,t,!1,!1),t.stateNode=e;e:{switch(o=Dl(n,r),n){case"dialog":X("cancel",e),X("close",e),l=r;break;case"iframe":case"object":case"embed":X("load",e),l=r;break;case"video":case"audio":for(l=0;lLn&&(t.flags|=128,r=!0,fr(u,!1),t.lanes=4194304)}else{if(!r)if(e=el(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fr(u,!0),u.tail===null&&u.tailMode==="hidden"&&!o.alternate&&!b)return ke(t),null}else 2*ue()-u.renderingStartTime>Ln&&n!==1073741824&&(t.flags|=128,r=!0,fr(u,!1),t.lanes=4194304);u.isBackwards?(o.sibling=t.child,t.child=o):(n=u.last,n!==null?n.sibling=o:t.child=o,u.last=o)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ue(),t.sibling=null,n=te.current,K(te,r?n&1|2:n&1),t):(ke(t),null);case 22:case 23:return po(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Be&1073741824)!==0&&(ke(t),t.subtreeFlags&6&&(t.flags|=8192)):ke(t),null;case 24:return null;case 25:return null}throw Error(m(156,t.tag))}function sc(e,t){switch(ku(t),t.tag){case 1:return Re(t.type)&&$r(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xn(),G(Te),G(we),Du(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ou(t),null;case 13:if(G(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(m(340));kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(te),null;case 4:return xn(),null;case 10:return Nu(t.type._context),null;case 22:case 23:return po(),null;case 24:return null;default:return null}}var al=!1,Ee=!1,ac=typeof WeakSet=="function"?WeakSet:Set,E=null;function Nn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){le(e,t,r)}else n.current=null}function eo(e,t,n){try{n()}catch(r){le(e,t,r)}}var Zs=!1;function fc(e,t){if(du=Lr,e=zi(),lu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,u=r.focusNode;r=r.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var o=0,i=-1,s=-1,p=0,y=0,g=e,v=null;t:for(;;){for(var k;g!==n||l!==0&&g.nodeType!==3||(i=o+l),g!==u||r!==0&&g.nodeType!==3||(s=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(k=g.firstChild)!==null;)v=g,g=k;for(;;){if(g===e)break t;if(v===n&&++p===l&&(i=o),v===u&&++y===r&&(s=o),(k=g.nextSibling)!==null)break;g=v,v=g.parentNode}g=k}n=i===-1||s===-1?null:{start:i,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(pu={focusedElem:e,selectionRange:n},Lr=!1,E=t;E!==null;)if(t=E,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,E=e;else for(;E!==null;){t=E;try{var C=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var x=C.memoizedProps,oe=C.memoizedState,c=t.stateNode,a=c.getSnapshotBeforeUpdate(t.elementType===t.type?x:rt(t.type,x),oe);c.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(m(163))}}catch(w){le(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,E=e;break}E=t.return}return C=Zs,Zs=!1,C}function cr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var u=l.destroy;l.destroy=void 0,u!==void 0&&eo(t,n,u)}l=l.next}while(l!==r)}}function fl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function to(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function Js(e){var t=e.alternate;t!==null&&(e.alternate=null,Js(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ct],delete t[er],delete t[yu],delete t[Kf],delete t[Yf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qs(e){return e.tag===5||e.tag===3||e.tag===4}function bs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qs(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function no(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Br));else if(r!==4&&(e=e.child,e!==null))for(no(e,t,n),e=e.sibling;e!==null;)no(e,t,n),e=e.sibling}function ro(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ro(e,t,n),e=e.sibling;e!==null;)ro(e,t,n),e=e.sibling}var ve=null,lt=!1;function Ut(e,t,n){for(n=n.child;n!==null;)ea(e,t,n),n=n.sibling}function ea(e,t,n){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(_r,n)}catch{}switch(n.tag){case 5:Ee||Nn(n,t);case 6:var r=ve,l=lt;ve=null,Ut(e,t,n),ve=r,lt=l,ve!==null&&(lt?(e=ve,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ve.removeChild(n.stateNode));break;case 18:ve!==null&&(lt?(e=ve,n=n.stateNode,e.nodeType===8?hu(e.parentNode,n):e.nodeType===1&&hu(e,n),$n(e)):hu(ve,n.stateNode));break;case 4:r=ve,l=lt,ve=n.stateNode.containerInfo,lt=!0,Ut(e,t,n),ve=r,lt=l;break;case 0:case 11:case 14:case 15:if(!Ee&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var u=l,o=u.destroy;u=u.tag,o!==void 0&&((u&2)!==0||(u&4)!==0)&&eo(n,t,o),l=l.next}while(l!==r)}Ut(e,t,n);break;case 1:if(!Ee&&(Nn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(i){le(n,t,i)}Ut(e,t,n);break;case 21:Ut(e,t,n);break;case 22:n.mode&1?(Ee=(r=Ee)||n.memoizedState!==null,Ut(e,t,n),Ee=r):Ut(e,t,n);break;default:Ut(e,t,n)}}function ta(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ac),t.forEach(function(r){var l=wc.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~u}if(r=l,r=ue()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dc(r/1960))-r,10e?16:e,At===null)var r=!1;else{if(e=At,At=null,vl=0,(I&6)!==0)throw Error(m(331));var l=I;for(I|=4,E=e.current;E!==null;){var u=E,o=u.child;if((E.flags&16)!==0){var i=u.deletions;if(i!==null){for(var s=0;sue()-oo?nn(e,0):uo|=n),De(e,t)}function ma(e,t){t===0&&((e.mode&1)===0?t=1:(t=xr,xr<<=1,(xr&130023424)===0&&(xr=4194304)));var n=Pe();e=kt(e,t),e!==null&&(Un(e,t,n),De(e,n))}function gc(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ma(e,n)}function wc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(m(314))}r!==null&&r.delete(t),ma(e,n)}var va;va=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Te.current)Oe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Oe=!1,oc(e,t,n);Oe=(e.flags&131072)!==0}else Oe=!1,b&&(t.flags&1048576)!==0&&Xi(t,Yr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;sl(e,t),e=t.pendingProps;var l=gn(t,we.current);Cn(t,n),l=ju(null,t,r,e,l,n);var u=Uu();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Re(r)?(u=!0,Wr(t)):u=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Tu(t),l.updater=ol,t.stateNode=l,l._reactInternals=t,Wu(t,r,e,n),t=Xu(null,t,r,!0,u,n)):(t.tag=0,b&&u&&Su(t),xe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(sl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=kc(r),e=rt(r,e),l){case 0:t=Yu(null,t,r,e,n);break e;case 1:t=Bs(null,t,r,e,n);break e;case 11:t=Fs(null,t,r,e,n);break e;case 14:t=js(null,t,r,rt(r.type,e),n);break e}throw Error(m(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),Yu(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),Bs(e,t,r,l,n);case 3:e:{if(Hs(t),e===null)throw Error(m(387));r=t.pendingProps,u=t.memoizedState,l=u.element,rs(e,t),br(t,r,null,n);var o=t.memoizedState;if(r=o.element,u.isDehydrated)if(u={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){l=Pn(Error(m(423)),t),t=$s(e,t,r,n,l);break e}else if(r!==l){l=Pn(Error(m(424)),t),t=$s(e,t,r,n,l);break e}else for(Ae=Ot(t.stateNode.containerInfo.firstChild),Ve=t,b=!0,nt=null,n=ts(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kn(),r===l){t=_t(e,t,n);break e}xe(e,t,r,n)}t=t.child}return t;case 5:return os(t),e===null&&_u(t),r=t.type,l=t.pendingProps,u=e!==null?e.memoizedProps:null,o=l.children,mu(r,l)?o=null:u!==null&&mu(r,u)&&(t.flags|=32),As(e,t),xe(e,t,o,n),t.child;case 6:return e===null&&_u(t),null;case 13:return Ws(e,t,n);case 4:return Ru(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=En(t,null,r,n):xe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),Fs(e,t,r,l,n);case 7:return xe(e,t,t.pendingProps,n),t.child;case 8:return xe(e,t,t.pendingProps.children,n),t.child;case 12:return xe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,u=t.memoizedProps,o=l.value,K(Zr,r._currentValue),r._currentValue=o,u!==null)if(tt(u.value,o)){if(u.children===l.children&&!Te.current){t=_t(e,t,n);break e}}else for(u=t.child,u!==null&&(u.return=t);u!==null;){var i=u.dependencies;if(i!==null){o=u.child;for(var s=i.firstContext;s!==null;){if(s.context===r){if(u.tag===1){s=Et(-1,n&-n),s.tag=2;var p=u.updateQueue;if(p!==null){p=p.shared;var y=p.pending;y===null?s.next=s:(s.next=y.next,y.next=s),p.pending=s}}u.lanes|=n,s=u.alternate,s!==null&&(s.lanes|=n),zu(u.return,n,t),i.lanes|=n;break}s=s.next}}else if(u.tag===10)o=u.type===t.type?null:u.child;else if(u.tag===18){if(o=u.return,o===null)throw Error(m(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),zu(o,n,t),o=u.sibling}else o=u.child;if(o!==null)o.return=u;else for(o=u;o!==null;){if(o===t){o=null;break}if(u=o.sibling,u!==null){u.return=o.return,o=u;break}o=o.return}u=o}xe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Cn(t,n),l=Ye(l),r=r(l),t.flags|=1,xe(e,t,r,n),t.child;case 14:return r=t.type,l=rt(r,t.pendingProps),l=rt(r.type,l),js(e,t,r,l,n);case 15:return Us(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rt(r,l),sl(e,t),t.tag=1,Re(r)?(e=!0,Wr(t)):e=!1,Cn(t,n),Ls(t,r,l),Wu(t,r,l,n),Xu(null,t,r,!0,e,n);case 19:return Ks(e,t,n);case 22:return Vs(e,t,n)}throw Error(m(156,t.tag))};function ha(e,t){return Go(e,t)}function Sc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ze(e,t,n,r){return new Sc(e,t,n,r)}function vo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kc(e){if(typeof e=="function")return vo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===st)return 11;if(e===at)return 14}return 2}function $t(e,t){var n=e.alternate;return n===null?(n=Ze(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function wl(e,t,n,r,l,u){var o=2;if(r=e,typeof e=="function")vo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ze:return ln(n.children,l,u,t);case We:o=8,l|=8;break;case xt:return e=Ze(12,n,t,l|2),e.elementType=xt,e.lanes=u,e;case Fe:return e=Ze(13,n,t,l),e.elementType=Fe,e.lanes=u,e;case be:return e=Ze(19,n,t,l),e.elementType=be,e.lanes=u,e;case re:return Sl(n,l,u,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ht:o=10;break e;case Qt:o=9;break e;case st:o=11;break e;case at:o=14;break e;case Le:o=16,r=null;break e}throw Error(m(130,e==null?e:typeof e,""))}return t=Ze(o,n,t,l),t.elementType=e,t.type=r,t.lanes=u,t}function ln(e,t,n,r){return e=Ze(7,e,r,t),e.lanes=n,e}function Sl(e,t,n,r){return e=Ze(22,e,r,t),e.elementType=re,e.lanes=n,e.stateNode={isHidden:!1},e}function ho(e,t,n){return e=Ze(6,e,null,t),e.lanes=n,e}function yo(e,t,n){return t=Ze(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ec(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$l(0),this.expirationTimes=$l(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$l(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function go(e,t,n,r,l,u,o,i,s){return e=new Ec(e,t,n,i,s),t===1?(t=1,u===!0&&(t|=8)):t=0,u=Ze(3,null,null,t),e.current=u,u.stateNode=e,u.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tu(u),e}function _c(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T)}catch(H){console.error(H)}}return T(),Co.exports=Ic(),Co.exports}var Ta;function jc(){if(Ta)return Nl;Ta=1;var T=Fc();return Nl.createRoot=T.createRoot,Nl.hydrateRoot=T.hydrateRoot,Nl}var Uc=jc();const Bc=Ra(Uc);export{Bc as R,Ac as a,Fc as b,Vc as j,Oc as r}; diff --git a/Distributables/percy-local-manager-extension/content.js b/Distributables/percy-local-manager-extension/content.js index e54268c..6361f3d 100644 --- a/Distributables/percy-local-manager-extension/content.js +++ b/Distributables/percy-local-manager-extension/content.js @@ -1,4 +1,4 @@ -(function(){"use strict";const fe=/pass(word|wd)?|secret|token|otp|cvv|card|ssn/i;function Y(e){if((e.type??"").toLowerCase()==="password")return!0;const t=e.autocomplete??"";return/password|cc-/i.test(t)?!0:[e.name,e.id,e.label].some(n=>!!n&&fe.test(n))}function me(e){const t=e.replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return((/^[A-Za-z_]/.test(t)?t:`v_${t}`)||"value").slice(0,64)}function he(e){return!!(!e||/\d{4,}/.test(e)||/^:[^:]+:$/.test(e)||/(^|[-_]):r[0-9a-z]+:/i.test(e)||/^(react-select|rc-|radix-|headlessui-|mui-|ember|ext-gen|yui_|downshift-|select2-|__next)/i.test(e)||/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e)||/[-_]\d+([-_]\d+)*$/.test(e)&&/[-_]\d+[-_]/.test(e))}function be(e){return!!(!e||/^(css|sc|jsx|svelte|emotion|styled)-/i.test(e)||/_[A-Za-z0-9]{5,}$/.test(e)&&/[0-9]/.test(e.split("_").pop()??"")||/\d{3,}/.test(e)||/^(active|selected|open|opened|closed|hover|focus|focused|disabled|enabled|show|shown|hide|hidden|visible|loading|loaded|checked|expanded|collapsed|current|is-.+|has-.+|ng-.+|js-.+)$/i.test(e)||/^[a-z]{1,2}[A-Z0-9][A-Za-z0-9]{4,}$/.test(e))}function W(e){const t=e.trim();return!!(t.length<2||/^[\d\s.,:/$\u20ac\u00a3\u00a5%+\-()]+$/.test(t)||/\d{2,}/.test(t)&&t.length<=12)}function ge(e){const t=new Set,n=[];for(const o of e){const{fallbacks:s,...i}=o,a=JSON.stringify(i);t.has(a)||(t.add(a),n.push(i))}return n}function xe(e,t=[]){const n=[];e.testId&&n.push({testId:e.testId}),e.role&&e.name&&n.push({role:e.role,name:e.name}),e.css&&n.push({css:e.css});for(const i of t)n.push({css:i});if(e.text&&n.push({text:e.text}),n.length===0)return e;const[o,...s]=ge(n);return s.length?{...o,fallbacks:s}:o}const P="recorderWidgetPos",q=` +(function(){"use strict";const Ee=/pass(word|wd)?|secret|token|otp|cvv|card|ssn/i;function ne(e){if((e.type??"").toLowerCase()==="password")return!0;const t=e.autocomplete??"";return/password|cc-/i.test(t)?!0:[e.name,e.id,e.label].some(n=>!!n&&Ee.test(n))}function $e(e){const t=e.replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return((/^[A-Za-z_]/.test(t)?t:`v_${t}`)||"value").slice(0,64)}function Le(e){return!!(!e||/\d{4,}/.test(e)||/^:[^:]+:$/.test(e)||/(^|[-_]):r[0-9a-z]+:/i.test(e)||/^(react-select|rc-|radix-|headlessui-|mui-|ember|ext-gen|yui_|downshift-|select2-|__next)/i.test(e)||/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e)||/[-_]\d+([-_]\d+)*$/.test(e)&&/[-_]\d+[-_]/.test(e))}function Ie(e){return!!(!e||/^(css|sc|jsx|svelte|emotion|styled)-/i.test(e)||/_[A-Za-z0-9]{5,}$/.test(e)&&/[0-9]/.test(e.split("_").pop()??"")||/\d{3,}/.test(e)||/^(active|selected|open|opened|closed|hover|focus|focused|disabled|enabled|show|shown|hide|hidden|visible|loading|loaded|checked|expanded|collapsed|current|is-.+|has-.+|ng-.+|js-.+)$/i.test(e)||/^[a-z]{1,2}[A-Z0-9][A-Za-z0-9]{4,}$/.test(e))}function F(e){const t=e.trim();return!!(t.length<2||/^[\d\s.,:/$\u20ac\u00a3\u00a5%+\-()]+$/.test(t)||/\d{2,}/.test(t)&&t.length<=12)}function _e(e){const t=[e.testId,e.className,e.id,e.ariaLabel,e.dataset].filter(Boolean).join(" ");return/cookie|consent|gdpr|onetrust|cookiefirst|didomi|usercentrics|cookiebot|trustarc/i.test(t)||/(^|[\s_-])(modal|popup|pop-up|newsletter|btn-close)([\s_-]|$)/i.test(t)?!0:!!e.inDialog}function Te(e){return e.expanded==="false"||e.expanded==="true"||e.hasPopup&&e.hasPopup!=="false"||/dropdown|collapse|menu/i.test(e.dataToggle??"")||/dropdown-toggle/.test(e.className??"")?!0:/hover/i.test(e.dataOnce??"")}function Me(e){return e.repeat||e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)?!1:(e.key??"").toLowerCase()==="s"}function Ne(e){const t=new Set,n=[];for(const o of e){const{fallbacks:i,...r}=o,a=JSON.stringify(r);t.has(a)||(t.add(a),n.push(r))}return n}function He(e,t=[],n){const o=[];n&&t[0]&&o.push({css:t[0],within:n}),e.testId&&o.push({testId:e.testId}),e.role&&e.name&&o.push({role:e.role,name:e.name}),e.css&&o.push({css:e.css});for(const a of n&&t[0]?t.slice(1):t)o.push({css:a});if(e.text&&o.push({text:e.text}),o.length===0)return e;const[i,...r]=Ne(o);return r.length?{...i,fallbacks:r}:i}const oe=/(^|\s)[A-Za-z]+_[A-Za-z0-9]+__[A-Za-z0-9]{4,}(\s|$)/;function ze(e){return oe.test(e)}function De(e){return/^\d+$/.test(e)}function re(e){const t=[],n=e.totalIds>0?e.numericIds/e.totalIds:0,o=e.next||e.react,i=e.drupal||e.bootstrap;e.next?t.push("Next.js app"):e.react&&t.push("React app"),e.drupal&&t.push("Drupal site"),e.bootstrap&&t.push("Bootstrap UI");const r=e.numericIds>=3||n>=.3;r&&t.push(`${e.numericIds} numeric ids (list keys)`);const a=e.hashedClasses>=3;a&&t.push(`${e.hashedClasses} hashed CSS-module classes`);const l=e.stickyTopBars>0;l&&t.push("sticky/fixed top bar");const c=e.hoverMenus>0;c&&t.push(`${e.hoverMenus} hover/dropdown menu trigger(s)`);const f=e.carousels>0;f&&t.push(`${e.carousels} carousel(s)`);const d=e.consentManager||e.dialogs>0;return e.consentManager&&t.push("cookie consent manager"),{kind:o?"spa":i?"cms":"static",reasons:t,locators:{distrustNumericIds:r,distrustHashedClasses:a,preferSemantic:r||a||o},clicks:{stickyBars:l,hoverMenus:c},waits:{hydration:o,freezeMotion:f,consent:d,settleMs:o?500:i?300:0}}}const Re=re({next:!1,react:!1,drupal:!1,bootstrap:!1,totalIds:0,numericIds:0,hashedClasses:0,hoverMenus:0,carousels:0,dialogs:0,stickyTopBars:0,consentManager:!1});function Pe(e,t){const n=Array.from(e.querySelectorAll("*")),o=n.filter(a=>a.id),i=t,r=n.filter(a=>{const l=t.getComputedStyle(a);if(l.position!=="sticky"&&l.position!=="fixed")return!1;const c=a.getBoundingClientRect();return c.height>30&&c.top<=5&&c.width>t.innerWidth*.6});return{next:!!e.getElementById("__next")||!!i.__NEXT_DATA__||!!e.querySelector('script[src*="/_next/"]'),react:!!e.querySelector("[data-reactroot]")||n.slice(0,400).some(a=>Object.keys(a).some(l=>l.startsWith("__reactFiber")||l.startsWith("__reactContainer"))),drupal:!!i.Drupal||!!e.querySelector("meta[name=Generator][content*=Drupal]"),bootstrap:!!e.querySelector("[data-bs-toggle]")||!!i.bootstrap,totalIds:o.length,numericIds:o.filter(a=>/^\d+$/.test(a.id)).length,hashedClasses:n.filter(a=>typeof a.className=="string"&&oe.test(a.className)).length,hoverMenus:e.querySelectorAll("[data-once*=hover], [aria-haspopup=true], .dropdown-toggle").length,carousels:e.querySelectorAll(".carousel, .swiper, .slick-slider, [class*=carousel]").length,dialogs:e.querySelectorAll("dialog, [role=dialog]").length,stickyTopBars:r.length,consentManager:!!e.querySelector('[data-testid="actionButton-accept"], #onetrust-accept-btn-handler, #CybotCookiebotDialog, #didomi-host')}}const U="recorderWidgetPos",ie=` :host { all: initial; } .box { position: fixed; top: 16px; right: 16px; width: 320px; max-height: 80vh; @@ -66,4 +66,4 @@ button.ic.stop { border-color: #c0392b; color: #c0392b; } button.danger-solid { background: #d6403a; border-color: #d6403a; color: #fff; } .modal input[type=text], .modal input[type=number], .modal textarea { padding: 9px 12px; border-color: #e6e2ef; background: #f5f4fa; } .modal input:focus, .modal textarea:focus { outline: none; border-color: #8567ff; background: #fff; box-shadow: 0 0 0 3px #eee8ff; } -`;let k=null,S=null,p={active:!1,steps:[]},I=!1,C=null,g=!1,z="",H="",E=null;const X=()=>({waitSeconds:"4",widths:["375","1280"],minHeight:"",scope:"",enableJavaScript:!1,percyCSS:""});let M=X(),R=!1,T=null,N=null,O=null,v=null,_=null;const ve='',we='',ye='';function G(e,t,n,o){const s=r("button",{class:`ic ${n}`.trim(),disabled:o}),i=document.createElement("span");return i.style.display="inline-flex",i.innerHTML=e,s.append(i,document.createTextNode(t)),s}function V(e){const t=Number(e.waitSeconds);if(e.waitSeconds.trim()===""||!Number.isFinite(t)||t<0||t>60)return{error:"Wait must be between 0 and 60 seconds."};const n=[];for(const i of e.widths.map(a=>a.trim()).filter(Boolean)){const a=Number(i);if(!Number.isInteger(a)||a<1||a>4e3)return{error:"Widths must be whole numbers 1-4000, comma separated."};n.push(a)}if(n.length>10)return{error:"At most 10 widths."};let o;if(e.minHeight.trim()!==""&&(o=Number(e.minHeight),!Number.isInteger(o)||o<0||o>2e4))return{error:"Minimum height must be 0-20000."};if(e.scope.length>500)return{error:"Scope is too long."};if(e.percyCSS.length>1e4)return{error:"Percy CSS is too long."};const s={};return n.length&&(s.widths=n),o&&(s.minHeight=o),e.scope.trim()&&(s.scope=e.scope.trim()),e.enableJavaScript&&(s.enableJavaScript=!0),e.percyCSS.trim()&&(s.percyCSS=e.percyCSS.trim()),{waitMs:Math.round(t*1e3),options:Object.keys(s).length?s:void 0}}function ke(e){return{waitSeconds:String((e.waitMs??4e3)/1e3),widths:(e.options?.widths??[]).map(String),minHeight:e.options?.minHeight?String(e.options.minHeight):"",scope:e.options?.scope??"",enableJavaScript:e.options?.enableJavaScript??!1,percyCSS:e.options?.percyCSS??""}}function Se(e){return e?e.testId?`[data-testid=${e.testId}]`:e.role&&e.name?`${e.role} "${e.name}"`:e.css?e.css:e.text?`text "${e.text}"`:"":""}function B(e){if(e.label)return e.label;const t=Se(e.target);switch(e.type){case"click":return`Click ${t}`;case"fill":return e.valueRef?`Fill ${t} with {${e.valueRef}}`:`Fill ${t}`;case"select":return`Select "${e.value??""}" in ${t}`;case"check":return`Check ${t}`;case"uncheck":return`Uncheck ${t}`;case"navigate":return`Go to ${e.url??""}`;case"waitFor":return`Wait for ${t}`;case"scroll":return`Scroll to (${e.scrollX??0}, ${e.scrollY??0})`;case"snapshot":return`Snapshot: ${e.name??e.checkpointId??""}${e.waitMs!==void 0?` (wait ${e.waitMs/1e3}s)`:""}`;default:return e.type}}async function w(e){const t=await chrome.runtime.sendMessage(e);if(t&&typeof t=="object"&&"error"in t&&t.error)throw new Error(t.error);return t}async function y(e){g=!0,C=null,m();try{await e()}catch(t){C={kind:"err",text:t instanceof Error?t.message:String(t)}}finally{g=!1,m()}}function r(e,t={},...n){const o=document.createElement(e),{class:s,...i}=t;s&&(o.className=String(s)),Object.assign(o,i);for(const a of n)o.append(a);return o}function K(){k||(k=document.createElement("div"),k.setAttribute("data-percy-recorder",""),S=k.attachShadow({mode:"open"}),document.documentElement.append(k))}function Q(){k?.remove(),k=null,S=null}function F(e){E&&(e.style.top=`${E.top}px`,e.style.left=`${E.left}px`,e.style.right="auto")}function Ce(e,t){e.addEventListener("pointerdown",n=>{if(n.target.closest("button"))return;const o=t.getBoundingClientRect(),s=n.clientX-o.left,i=n.clientY-o.top;e.setPointerCapture(n.pointerId);const a=l=>{const f=Math.min(Math.max(0,l.clientX-s),window.innerWidth-80);E={top:Math.min(Math.max(0,l.clientY-i),window.innerHeight-40),left:f},F(t)},d=()=>{e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",d),E&&chrome.storage.local.set({[P]:E})};e.addEventListener("pointermove",a),e.addEventListener("pointerup",d)})}let Ee=0;function x(e,t){const n=`pr-f-${++Ee}`;return t.id=n,r("div",{},r("label",{class:"lbl",textContent:e,htmlFor:n}),r("div",{class:"row"},t))}function ee(e,t){const n=r("div",{class:"adv stack"}),o=r("div",{class:"stack"});o.append(r("label",{class:"lbl",textContent:"Widths"})),e.widths.forEach((f,c)=>{const u=r("input",{type:"number",min:"1",value:f});u.setAttribute("aria-label",`Width ${c+1}`),u.addEventListener("input",()=>{e.widths[c]=u.value});const h=r("button",{class:"rm",textContent:"×",title:"Remove width",disabled:e.widths.length<=1});h.setAttribute("aria-label",`Remove width ${c+1}`),h.addEventListener("click",()=>{e.widths.splice(c,1),t()}),o.append(r("div",{class:"row"},u,h))});const s=r("button",{class:"link",textContent:"+ Add width"});s.addEventListener("click",()=>{e.widths.push("1280"),t()}),o.append(s);const i=r("input",{type:"number",min:"0",value:e.minHeight});i.addEventListener("input",()=>{e.minHeight=i.value});const a=r("input",{type:"text",placeholder:".main-content",value:e.scope});a.addEventListener("input",()=>{e.scope=a.value});const d=r("input",{type:"checkbox",checked:e.enableJavaScript});d.addEventListener("change",()=>{e.enableJavaScript=d.checked});const l=r("textarea",{rows:4,placeholder:".modal { display: none; }",value:e.percyCSS});return l.addEventListener("input",()=>{e.percyCSS=l.value}),n.append(o,x("Minimum height",i),x("Scope",a),r("label",{class:"chk"},d,"Enable JavaScript"),x("Percy CSS",l)),n}function $e(e){const t=r("div",{class:"editor"}),n=r("input",{type:"text",value:e.label??""});t.append(x("Label",n));let o=null;const s=N&&O===e.id?N:ke(e);if(N=s,O=e.id,e.type==="snapshot"){o=r("input",{type:"text",value:e.name??""}),t.append(x("Snapshot name",o));const c=r("input",{type:"number",min:"0",max:"60",step:"0.5",value:s.waitSeconds});c.addEventListener("input",()=>{s.waitSeconds=c.value}),t.append(x("Wait before capture (seconds)",c)),t.append(ee(s,m))}const i=e.target,a={};i&&["testId","role","name","css"].forEach(c=>{const u=r("input",{type:"text",value:i[c]??""});a[c]=u,t.append(x(c==="testId"?"Test ID":c==="name"?"Accessible name":c==="css"?"CSS selector":"Role",u))});let d=null;(e.type==="fill"||e.type==="select")&&(d=r("input",{type:"text",value:e.valueRef??e.value??""}),t.append(x(e.valueRef?"Secret reference":"Value",d))),v&&t.append(r("div",{class:"msg err",textContent:v}));const l=r("button",{class:"primary",textContent:"Save step"});l.addEventListener("click",()=>{const c={...e,label:n.value.trim()||void 0};if(e.type==="snapshot"&&o){if(!o.value.trim()){v="Snapshot name is required.",m();return}const u=V(s);if("error"in u){v=u.error,m();return}c.name=o.value.trim(),c.waitMs=u.waitMs,c.options=u.options}if(i&&(c.target={...i,testId:a.testId?.value||void 0,role:a.role?.value||void 0,name:a.name?.value||void 0,css:a.css?.value||void 0}),d)if(e.valueRef){if(!/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(d.value)){v="Reference must be letters, digits, underscores.",m();return}c.valueRef=d.value}else c.value=d.value;v=null,T=null,N=null,y(async()=>{await w({kind:"rec:setSteps",steps:p.steps.map(u=>u.id===e.id?c:u)})})});const f=r("button",{textContent:"Cancel"});return f.addEventListener("click",te),t.append(r("div",{class:"modal-actions"},f,l)),t}function te(){T=null,v=null,N=null,O=null,m()}function ne(e,t,n,o,s,i,a){const d=r("button",{class:"modal-close",textContent:"×",title:"Close"});d.setAttribute("aria-label","Close"),d.addEventListener("click",i);const l=r("h2",{textContent:n});l.id=e;const f=r("div",{class:s?"modal sm":"modal"},r("div",{class:"modal-head"},r("div",{},r("span",{class:"eyebrow",textContent:t}),l,r("p",{textContent:o})),d),a);f.setAttribute("role","dialog"),f.setAttribute("aria-modal","true"),f.setAttribute("aria-labelledby",e);const c=r("div",{class:"overlay"},f);return c.addEventListener("mousedown",u=>{u.target===c&&i()}),c}function Le(){const e=p.steps.find(n=>n.id===T);if(!e)return null;const t=e.type==="snapshot"?"Name, wait and Percy options for this snapshot.":"Update this step. Changes apply on the next replay.";return ne("pr-edit-title","Edit step",e.label||B(e),t,!1,te,$e(e))}function Ae(){const e=p.steps.find(i=>i.id===_);if(!e)return null;const t=()=>{_=null,m()},n=r("button",{textContent:"Cancel"});n.addEventListener("click",t);const o=r("button",{class:"danger-solid",textContent:"Delete step",disabled:g});o.addEventListener("click",()=>{_=null,y(async()=>{await w({kind:"rec:setSteps",steps:p.steps.filter(i=>i.id!==e.id)})})});const s=r("div",{class:"stack"},r("p",{textContent:`“${e.label||B(e)}” will be removed from this workflow.`}),r("div",{class:"modal-actions"},n,o));return ne("pr-del-title","Delete step","Are you sure?","This cannot be undone.",!0,t,s)}function oe(){if(p.steps.length===0)return r("p",{class:"hint",textContent:"No steps yet. Use the page normally."});const e=r("ol");return p.steps.forEach((t,n)=>{const o=r("li",{class:t.type==="snapshot"?"cp":""},t.label||B(t)),s=(d,l,f,c,u=!1)=>{const h=r("button",{class:f,textContent:d,title:l,disabled:u||g});return h.addEventListener("click",c),h},i=d=>{y(async()=>{await w({kind:"rec:setSteps",steps:d})})},a=d=>{const l=[...p.steps];[l[n],l[d]]=[l[d],l[n]],i(l)};o.append(s("↑","Move up","mv",()=>a(n-1),n===0),s("↓","Move down","mv",()=>a(n+1),n===p.steps.length-1),s("Edit","Edit step","ed",()=>{T=t.id,v=null,m()}),s("✕","Delete step","x",()=>{_=t.id,m()})),e.append(o)}),queueMicrotask(()=>{!T&&!_&&(e.scrollTop=e.scrollHeight)}),e}function m(){if(!(p.active||p.steps.length>0)){Q();return}if(K(),!S)return;const t=p.steps.some(l=>l.type==="snapshot"),n=r("div",{class:"box"});F(n);const o=r("button",{class:"icon",textContent:I?"▢":"–",title:I?"Expand":"Minimize"});o.addEventListener("click",()=>{I=!I,m()});const s=r("div",{class:"head"},r("span",{},r("span",{class:p.active&&!p.paused?"dot":"dot off"}),p.active?`${p.paused?"Paused":"Recording"} · ${p.steps.length} steps`:`Recorded · ${p.steps.length} steps`),o);Ce(s,n);const i=r("div",{class:I?"body min":"body"});if(p.active){const l=r("input",{type:"text",placeholder:'Defaults to "Checkpoint N"',value:z});l.addEventListener("input",()=>{z=l.value});const f=r("button",{class:"cap",textContent:"Capture Snapshot",disabled:g});f.addEventListener("click",()=>{const b=V(M);if("error"in b){C={kind:"err",text:b.error},m();return}y(async()=>{const Be=p.steps.filter(Fe=>Fe.type==="snapshot").length+1;await w({kind:"rec:snapshot",name:z.trim()||`Checkpoint ${Be}`,waitMs:b.waitMs,options:b.options}),z="",M=X()})});const c=r("button",{class:"toggle",textContent:`${R?"▾":"▸"} Advanced snapshot options`});c.addEventListener("click",()=>{R=!R,m()});const u=r("input",{type:"number",min:"0",max:"60",step:"0.5",value:M.waitSeconds});u.addEventListener("input",()=>{M.waitSeconds=u.value});const h=G(p.paused?we:ve,p.paused?"Resume":"Pause","",g);h.addEventListener("click",()=>{y(async()=>{await w({kind:p.paused?"rec:resume":"rec:pause"})})});const Z=G(ye,"Stop","stop",g);Z.addEventListener("click",()=>{y(async()=>{await w({kind:"rec:stop"})})}),i.append(r("div",{class:"eyebrow",textContent:"Capture"}),x("Snapshot name (optional)",l),x("Wait before capture (seconds, default 4)",u),c),R&&i.append(ee(M,m)),i.append(r("div",{class:"row"},f),r("div",{class:"row"},h,Z)),p.paused&&i.append(r("p",{class:"hint",textContent:"Paused: your actions on the page are not being recorded."})),i.append(oe())}else{const l=r("input",{type:"text",placeholder:"Workflow name",value:H});l.addEventListener("input",()=>{H=l.value});const f=r("button",{class:"primary",textContent:g?"Saving…":"Save Workflow",disabled:g||!t});f.addEventListener("click",()=>{y(async()=>{const u=await w({kind:"rec:save",name:H});H="",window.setTimeout(()=>Ie(`✓ Saved "${u.name}". Replay it from the Snapshots page.`),50)})});const c=r("button",{class:"danger",textContent:"Discard",disabled:g});c.addEventListener("click",()=>{y(async()=>{await w({kind:"rec:clear"})})}),i.append(oe()),t||i.append(r("p",{class:"hint",textContent:"Add at least one Capture Snapshot checkpoint to save."})),i.append(r("div",{class:"row"},l),r("div",{class:"row"},f,c))}C&&i.append(r("div",{class:`msg ${C.kind}`,textContent:C.text})),n.append(s,i);const a=r("style",{textContent:q});S.replaceChildren(a,n);const d=Le()??Ae();d&&S.append(d)}function Ie(e){if(K(),C={kind:"ok",text:e},!S)return;const t=r("div",{class:"box"},r("div",{class:"body"},r("div",{class:"msg ok",textContent:e})));F(t),S.replaceChildren(r("style",{textContent:q}),t),window.setTimeout(()=>{!p.active&&p.steps.length===0&&Q()},4e3)}function re(e){p=e??{active:!1,steps:[]},m()}async function Me(){E=(await chrome.storage.local.get(P))[P]??null}let $=!1;function L(e){chrome.runtime.sendMessage({kind:"rec:event",step:e}).catch(()=>{})}function A(e){return CSS.escape(e)}function ie(e){const t=e.getAttribute("aria-label");if(t)return t.trim();const n=e.getAttribute("id");if(n){const a=document.querySelector(`label[for="${A(n)}"]`);if(a?.textContent)return a.textContent.trim()}const o=e.closest("label");if(o?.textContent)return o.textContent.trim();const s=e.getAttribute("placeholder");if(s)return s.trim();const i=(e.textContent??"").trim().replace(/\s+/g," ");return i.length<=80?i:""}function Te(e){const t=e.getAttribute("role");if(t)return t;const n=e.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&e.hasAttribute("href"))return"link";if(n==="select")return"combobox";if(n==="textarea")return"textbox";if(n==="input"){const o=(e.getAttribute("type")??"text").toLowerCase();return o==="checkbox"?"checkbox":o==="radio"?"radio":o==="button"||o==="submit"||o==="reset"?"button":"textbox"}if(/^h[1-6]$/.test(n))return"heading"}function j(e){const t=e.getAttribute("id");if(t&&!he(t))return`#${A(t)}`;const n=e.getAttribute("name");if(n)return`${e.tagName.toLowerCase()}[name="${A(n)}"]`}function se(e){try{return document.querySelectorAll(e).length}catch{return 0}}function ae(e,t,n){return`${e}[${t}="${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function J(e){return Array.from(e.classList).filter(t=>!be(t)&&/^[A-Za-z_-][\w-]*$/.test(t))}function ce(e){const t=e.tagName.toLowerCase(),n=[];for(const i of["aria-label","title","alt","placeholder","name"]){const a=e.getAttribute(i);a&&a.length<=80&&!W(a)&&n.push(ae(t,i,a))}const o=e.getAttribute("href");if(o&&!o.startsWith("javascript:")&&o.length<=120){const i=o.replace(/[?#].*$/,"");i&&i!=="/"&&!/\d{4,}/.test(i)&&n.push(ae(t,"href",o.replace(/#.*$/,"")))}const s=J(e);return s.length&&(n.push(`${t}.${s.slice(0,2).map(A).join(".")}`),n.push(`.${s.slice(0,2).map(A).join(".")}`)),n}function le(e){const t=j(e);if(t)return t;const n=e.tagName.toLowerCase(),o=J(e).slice(0,2);return o.length?`${n}.${o.map(A).join(".")}`:n}function Ne(e){const t=ce(e)[0]??le(e);let n=e.parentElement;for(let o=0;n&&n!==document.body&&o<5;o++,n=n.parentElement){const s=j(n)??(J(n).length?le(n):void 0);if(!s)continue;const i=`${s} ${t}`;if(se(i)===1)return i}}function _e(e){const t=[];let n=e;for(;n&&n!==document.documentElement&&t.length<8;){const o=j(n);if(o&&n!==e){t.unshift(o);break}const s=n.tagName.toLowerCase(),i=n.parentElement;if(!i){t.unshift(s);break}const a=Array.from(i.children).filter(d=>d.tagName===n.tagName);t.unshift(a.length>1?`${s}:nth-of-type(${a.indexOf(n)+1})`:s),n=i}return t.join(" > ")}function ze(e){return(e.textContent??"").trim().replace(/\s+/g," ")}function He(e){for(let t=e;t;t=t.parentElement){const n=t.getAttribute("id"),o=t.getAttribute("name");if((n||o)&&Y({id:n,name:o,type:t.getAttribute("type")}))return!0}return!1}function D(e){const t=e.getAttribute("data-testid")??e.getAttribute("data-test-id")??e.getAttribute("data-test")??void 0,n=Te(e),o=ie(e),s=He(e),i=o&&!s&&!W(o)?o:void 0,a=(e.tagName.toLowerCase()==="a"||n==="button")&&i?i:void 0,d=[],l=[];for(const b of ce(e))(se(b)===1?d:l).push(b);const f=Ne(e),c=[...d,...f?[f]:[]];let u;if(!a&&!s&&e.children.length===0){const b=ze(e);b&&b.length<=80&&!W(b)&&(u=b)}const h=_e(e);return xe({testId:t,role:n,name:i,css:j(e),text:a??u},[...c,...l.slice(0,1),...h?[h]:[]])}function Re(e){return e instanceof Element?e.closest('button, a[href], input, select, textarea, [role="button"], [role="link"], [role="menuitem"], [role="tab"], summary, label')??e:null}function U(e){return e.composedPath().some(t=>t instanceof Element&&t.hasAttribute("data-percy-recorder"))}function je(e){if(!$||!e.isTrusted||U(e))return;const t=Re(e.target);if(!t)return;const n=t.tagName.toLowerCase();if(!(n==="select"||n==="textarea")){if(n==="input"){const o=(t.getAttribute("type")??"text").toLowerCase();if(o==="checkbox"||o==="radio"||!["button","submit","reset"].includes(o))return}L({type:"click",target:D(t)})}}function De(e){if(!$||!e.isTrusted||U(e))return;const t=e.target;if(t instanceof HTMLSelectElement)L({type:"select",target:D(t),value:t.value});else if(t instanceof HTMLInputElement){const n=t.type.toLowerCase();(n==="checkbox"||n==="radio")&&L({type:t.checked?"check":"uncheck",target:D(t)})}}function We(e){if(!$||!e.isTrusted||U(e))return;const t=e.target;if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)||t instanceof HTMLInputElement&&["checkbox","radio","button","submit","file"].includes(t.type))return;const n=ie(t),o=Y({type:t.getAttribute("type"),name:t.getAttribute("name"),id:t.getAttribute("id"),autocomplete:t.getAttribute("autocomplete"),label:n}),s=D(t);L(o?{type:"fill",target:s,valueRef:me(n||t.getAttribute("name")||t.id||"secret")}:{type:"fill",target:s,value:t.value})}let de;function Pe(){$&&(window.clearTimeout(de),de=window.setTimeout(()=>{L({type:"scroll",scrollX:Math.round(window.scrollX),scrollY:Math.round(window.scrollY)})},250))}const ue="__percyRecorderInstalled",pe=window[ue]===!0;window[ue]=!0;function Oe(){pe||(document.addEventListener("click",je,!0),document.addEventListener("change",De,!0),document.addEventListener("input",We,!0),window.addEventListener("scroll",Pe,{passive:!0}))}Oe(),pe||chrome.runtime.onMessage.addListener((e,t,n)=>{e?.kind==="rec:active"&&($=!!e.active),e?.kind==="rec:state"&&($=!!e.state?.active&&!e.state?.paused,re(e.state)),e?.kind==="rec:viewport"&&n({width:window.innerWidth,height:window.innerHeight})}),chrome.runtime.sendMessage({kind:"rec:hello",url:location.href}).then(e=>{$=!!e?.active,e?.state&&re(e.state)}).catch(()=>{}),Me()})(); +`;let S=null,C=null,p={active:!1,steps:[]},I=!1,A=null,g=!1,R="",P="",E=null;const se=()=>({waitSeconds:"4",widths:["375","1280"],minHeight:"",scope:"",enableJavaScript:!1,percyCSS:""});let _=se(),B=!1,T=null,M=null,Z=null,v=null,N=null;const Be='',Oe='',je='';function ae(e,t,n,o){const i=s("button",{class:`ic ${n}`.trim(),disabled:o}),r=document.createElement("span");return r.style.display="inline-flex",r.innerHTML=e,i.append(r,document.createTextNode(t)),i}function ce(e){const t=Number(e.waitSeconds);if(e.waitSeconds.trim()===""||!Number.isFinite(t)||t<0||t>60)return{error:"Wait must be between 0 and 60 seconds."};const n=[];for(const r of e.widths.map(a=>a.trim()).filter(Boolean)){const a=Number(r);if(!Number.isInteger(a)||a<1||a>4e3)return{error:"Widths must be whole numbers 1-4000, comma separated."};n.push(a)}if(n.length>10)return{error:"At most 10 widths."};let o;if(e.minHeight.trim()!==""&&(o=Number(e.minHeight),!Number.isInteger(o)||o<0||o>2e4))return{error:"Minimum height must be 0-20000."};if(e.scope.length>500)return{error:"Scope is too long."};if(e.percyCSS.length>1e4)return{error:"Percy CSS is too long."};const i={};return n.length&&(i.widths=n),o&&(i.minHeight=o),e.scope.trim()&&(i.scope=e.scope.trim()),e.enableJavaScript&&(i.enableJavaScript=!0),e.percyCSS.trim()&&(i.percyCSS=e.percyCSS.trim()),{waitMs:Math.round(t*1e3),options:Object.keys(i).length?i:void 0}}function qe(e){return{waitSeconds:String((e.waitMs??4e3)/1e3),widths:(e.options?.widths??[]).map(String),minHeight:e.options?.minHeight?String(e.options.minHeight):"",scope:e.options?.scope??"",enableJavaScript:e.options?.enableJavaScript??!1,percyCSS:e.options?.percyCSS??""}}function We(e){return e?e.testId?`[data-testid=${e.testId}]`:e.role&&e.name?`${e.role} "${e.name}"`:e.css?e.css:e.text?`text "${e.text}"`:"":""}function J(e){if(e.label)return e.label;const t=We(e.target);switch(e.type){case"click":return`${e.optional?"Click (if shown) ":"Click "}${t}`;case"hover":return`Hover ${t}`;case"fill":return e.valueRef?`Fill ${t} with {${e.valueRef}}`:`Fill ${t}`;case"select":return`Select "${e.value??""}" in ${t}`;case"check":return`Check ${t}`;case"uncheck":return`Uncheck ${t}`;case"navigate":return`Go to ${e.url??""}`;case"waitFor":return`Wait for ${t}`;case"scroll":return`Scroll to (${e.scrollX??0}, ${e.scrollY??0})`;case"snapshot":return`Snapshot: ${e.name??e.checkpointId??""}${e.waitMs!==void 0?` (wait ${e.waitMs/1e3}s)`:""}`;default:return e.type}}async function y(e){const t=await chrome.runtime.sendMessage(e);if(t&&typeof t=="object"&&"error"in t&&t.error)throw new Error(t.error);return t}const le="Ctrl+S";function de(){if(!p.active||p.paused||g)return!1;const e=ce(_);return"error"in e?(A={kind:"err",text:e.error},h(),!1):(w(async()=>{const t=p.steps.filter(n=>n.type==="snapshot").length+1;await y({kind:"rec:snapshot",name:R.trim()||`Checkpoint ${t}`,waitMs:e.waitMs,options:e.options}),R="",_=se()}),!0)}async function w(e){g=!0,A=null,h();try{await e()}catch(t){A={kind:"err",text:t instanceof Error?t.message:String(t)}}finally{g=!1,h()}}function s(e,t={},...n){const o=document.createElement(e),{class:i,...r}=t;i&&(o.className=String(i)),Object.assign(o,r);for(const a of n)o.append(a);return o}function ue(){S||(S=document.createElement("div"),S.setAttribute("data-percy-recorder",""),C=S.attachShadow({mode:"open"}),document.documentElement.append(S))}function pe(){S?.remove(),S=null,C=null}function K(e){E&&(e.style.top=`${E.top}px`,e.style.left=`${E.left}px`,e.style.right="auto")}function Fe(e,t){e.addEventListener("pointerdown",n=>{if(n.target.closest("button"))return;const o=t.getBoundingClientRect(),i=n.clientX-o.left,r=n.clientY-o.top;e.setPointerCapture(n.pointerId);const a=c=>{const f=Math.min(Math.max(0,c.clientX-i),window.innerWidth-80);E={top:Math.min(Math.max(0,c.clientY-r),window.innerHeight-40),left:f},K(t)},l=()=>{e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",l),E&&chrome.storage.local.set({[U]:E})};e.addEventListener("pointermove",a),e.addEventListener("pointerup",l)})}let Ue=0;function b(e,t){const n=`pr-f-${++Ue}`;return t.id=n,s("div",{},s("label",{class:"lbl",textContent:e,htmlFor:n}),s("div",{class:"row"},t))}function fe(e,t){const n=s("div",{class:"adv stack"}),o=s("div",{class:"stack"});o.append(s("label",{class:"lbl",textContent:"Widths"})),e.widths.forEach((f,d)=>{const u=s("input",{type:"number",min:"1",value:f});u.setAttribute("aria-label",`Width ${d+1}`),u.addEventListener("input",()=>{e.widths[d]=u.value});const m=s("button",{class:"rm",textContent:"×",title:"Remove width",disabled:e.widths.length<=1});m.setAttribute("aria-label",`Remove width ${d+1}`),m.addEventListener("click",()=>{e.widths.splice(d,1),t()}),o.append(s("div",{class:"row"},u,m))});const i=s("button",{class:"link",textContent:"+ Add width"});i.addEventListener("click",()=>{e.widths.push("1280"),t()}),o.append(i);const r=s("input",{type:"number",min:"0",value:e.minHeight});r.addEventListener("input",()=>{e.minHeight=r.value});const a=s("input",{type:"text",placeholder:".main-content",value:e.scope});a.addEventListener("input",()=>{e.scope=a.value});const l=s("input",{type:"checkbox",checked:e.enableJavaScript});l.addEventListener("change",()=>{e.enableJavaScript=l.checked});const c=s("textarea",{rows:4,placeholder:".modal { display: none; }",value:e.percyCSS});return c.addEventListener("input",()=>{e.percyCSS=c.value}),n.append(o,b("Minimum height",r),b("Scope",a),s("label",{class:"chk"},l,"Enable JavaScript"),b("Percy CSS",c)),n}function Ze(e){const t=s("div",{class:"editor"}),n=s("input",{type:"text",value:e.label??""});t.append(b("Label",n));let o=null;const i=M&&Z===e.id?M:qe(e);if(M=i,Z=e.id,e.type==="snapshot"){o=s("input",{type:"text",value:e.name??""}),t.append(b("Snapshot name",o));const d=s("input",{type:"number",min:"0",max:"60",step:"0.5",value:i.waitSeconds});d.addEventListener("input",()=>{i.waitSeconds=d.value}),t.append(b("Wait before capture (seconds)",d)),t.append(fe(i,h))}const r=e.target,a={};r&&["testId","role","name","css"].forEach(d=>{const u=s("input",{type:"text",value:r[d]??""});a[d]=u,t.append(b(d==="testId"?"Test ID":d==="name"?"Accessible name":d==="css"?"CSS selector":"Role",u))});let l=null;(e.type==="fill"||e.type==="select")&&(l=s("input",{type:"text",value:e.valueRef??e.value??""}),t.append(b(e.valueRef?"Secret reference":"Value",l))),v&&t.append(s("div",{class:"msg err",textContent:v}));const c=s("button",{class:"primary",textContent:"Save step"});c.addEventListener("click",()=>{const d={...e,label:n.value.trim()||void 0};if(e.type==="snapshot"&&o){if(!o.value.trim()){v="Snapshot name is required.",h();return}const u=ce(i);if("error"in u){v=u.error,h();return}d.name=o.value.trim(),d.waitMs=u.waitMs,d.options=u.options}if(r&&(d.target={...r,testId:a.testId?.value||void 0,role:a.role?.value||void 0,name:a.name?.value||void 0,css:a.css?.value||void 0}),l)if(e.valueRef){if(!/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(l.value)){v="Reference must be letters, digits, underscores.",h();return}d.valueRef=l.value}else d.value=l.value;v=null,T=null,M=null,w(async()=>{await y({kind:"rec:setSteps",steps:p.steps.map(u=>u.id===e.id?d:u)})})});const f=s("button",{textContent:"Cancel"});return f.addEventListener("click",he),t.append(s("div",{class:"modal-actions"},f,c)),t}function he(){T=null,v=null,M=null,Z=null,h()}function me(e,t,n,o,i,r,a){const l=s("button",{class:"modal-close",textContent:"×",title:"Close"});l.setAttribute("aria-label","Close"),l.addEventListener("click",r);const c=s("h2",{textContent:n});c.id=e;const f=s("div",{class:i?"modal sm":"modal"},s("div",{class:"modal-head"},s("div",{},s("span",{class:"eyebrow",textContent:t}),c,s("p",{textContent:o})),l),a);f.setAttribute("role","dialog"),f.setAttribute("aria-modal","true"),f.setAttribute("aria-labelledby",e);const d=s("div",{class:"overlay"},f);return d.addEventListener("mousedown",u=>{u.target===d&&r()}),d}function Je(){const e=p.steps.find(n=>n.id===T);if(!e)return null;const t=e.type==="snapshot"?"Name, wait and Percy options for this snapshot.":"Update this step. Changes apply on the next replay.";return me("pr-edit-title","Edit step",e.label||J(e),t,!1,he,Ze(e))}function Ke(){const e=p.steps.find(r=>r.id===N);if(!e)return null;const t=()=>{N=null,h()},n=s("button",{textContent:"Cancel"});n.addEventListener("click",t);const o=s("button",{class:"danger-solid",textContent:"Delete step",disabled:g});o.addEventListener("click",()=>{N=null,w(async()=>{await y({kind:"rec:setSteps",steps:p.steps.filter(r=>r.id!==e.id)})})});const i=s("div",{class:"stack"},s("p",{textContent:`“${e.label||J(e)}” will be removed from this workflow.`}),s("div",{class:"modal-actions"},n,o));return me("pr-del-title","Delete step","Are you sure?","This cannot be undone.",!0,t,i)}function ge(){if(p.steps.length===0)return s("p",{class:"hint",textContent:"No steps yet. Use the page normally."});const e=s("ol");return p.steps.forEach((t,n)=>{const o=s("li",{class:t.type==="snapshot"?"cp":""},t.label||J(t)),i=(l,c,f,d,u=!1)=>{const m=s("button",{class:f,textContent:l,title:c,disabled:u||g});return m.addEventListener("click",d),m},r=l=>{w(async()=>{await y({kind:"rec:setSteps",steps:l})})},a=l=>{const c=[...p.steps];[c[n],c[l]]=[c[l],c[n]],r(c)};o.append(i("↑","Move up","mv",()=>a(n-1),n===0),i("↓","Move down","mv",()=>a(n+1),n===p.steps.length-1),i("Edit","Edit step","ed",()=>{T=t.id,v=null,h()}),i("✕","Delete step","x",()=>{N=t.id,h()})),e.append(o)}),queueMicrotask(()=>{!T&&!N&&(e.scrollTop=e.scrollHeight)}),e}function h(){if(!(p.active||p.steps.length>0)){pe();return}if(ue(),!C)return;const t=p.steps.some(c=>c.type==="snapshot"),n=s("div",{class:"box"});K(n);const o=s("button",{class:"icon",textContent:I?"▢":"–",title:I?"Expand":"Minimize"});o.addEventListener("click",()=>{I=!I,h()});const i=s("div",{class:"head"},s("span",{},s("span",{class:p.active&&!p.paused?"dot":"dot off"}),p.active?`${p.paused?"Paused":"Recording"} · ${p.steps.length} steps`:`Recorded · ${p.steps.length} steps`),o);Fe(i,n);const r=s("div",{class:I?"body min":"body"});if(p.active){const c=s("input",{type:"text",placeholder:'Defaults to "Checkpoint N"',value:R});c.addEventListener("input",()=>{R=c.value});const f=s("button",{class:"cap",textContent:"Capture Snapshot",title:`Capture Snapshot (${le})`,disabled:g});f.addEventListener("click",()=>de());const d=s("button",{class:"toggle",textContent:`${B?"▾":"▸"} Advanced snapshot options`});d.addEventListener("click",()=>{B=!B,h()});const u=s("input",{type:"number",min:"0",max:"60",step:"0.5",value:_.waitSeconds});u.addEventListener("input",()=>{_.waitSeconds=u.value});const m=ae(p.paused?Oe:Be,p.paused?"Resume":"Pause","",g);m.addEventListener("click",()=>{w(async()=>{await y({kind:p.paused?"rec:resume":"rec:pause"})})});const D=ae(je,"Stop","stop",g);D.addEventListener("click",()=>{w(async()=>{await y({kind:"rec:stop"})})}),r.append(s("div",{class:"eyebrow",textContent:"Capture"}),b("Snapshot name (optional)",c),b("Wait before capture (seconds, default 4)",u),d),B&&r.append(fe(_,h)),r.append(s("div",{class:"row"},f),s("div",{class:"row"},m,D)),r.append(s("p",{class:"hint",textContent:`Tip: hover or click on the page, then press ${le} to capture a snapshot.`})),p.paused&&r.append(s("p",{class:"hint",textContent:"Paused: your actions on the page are not being recorded."})),r.append(ge())}else{const c=s("input",{type:"text",placeholder:"Workflow name",value:P});c.addEventListener("input",()=>{P=c.value});const f=s("button",{class:"primary",textContent:g?"Saving…":"Save Workflow",disabled:g||!t});f.addEventListener("click",()=>{w(async()=>{const u=await y({kind:"rec:save",name:P});P="",window.setTimeout(()=>Ye(`✓ Saved "${u.name}". Replay it from the Snapshots page.`),50)})});const d=s("button",{class:"danger",textContent:"Discard",disabled:g});d.addEventListener("click",()=>{w(async()=>{await y({kind:"rec:clear"})})}),r.append(ge()),t||r.append(s("p",{class:"hint",textContent:"Add at least one Capture Snapshot checkpoint to save."})),r.append(s("div",{class:"row"},c),s("div",{class:"row"},f,d))}A&&r.append(s("div",{class:`msg ${A.kind}`,textContent:A.text})),n.append(i,r);const a=s("style",{textContent:ie});C.replaceChildren(a,n);const l=Je()??Ke();l&&C.append(l)}function Ye(e){if(ue(),A={kind:"ok",text:e},!C)return;const t=s("div",{class:"box"},s("div",{class:"body"},s("div",{class:"msg ok",textContent:e})));K(t),C.replaceChildren(s("style",{textContent:ie}),t),window.setTimeout(()=>{!p.active&&p.steps.length===0&&pe()},4e3)}function be(e){p=e??{active:!1,steps:[]},h()}async function Xe(){E=(await chrome.storage.local.get(U))[U]??null}let k=!1;function $(e){chrome.runtime.sendMessage({kind:"rec:event",step:e}).catch(()=>{})}function L(e){return CSS.escape(e)}function xe(e){const t=e.getAttribute("aria-label");if(t)return t.trim();const n=e.getAttribute("id");if(n){const a=document.querySelector(`label[for="${L(n)}"]`);if(a?.textContent)return a.textContent.trim()}const o=e.closest("label");if(o?.textContent)return o.textContent.trim();const i=e.getAttribute("placeholder");if(i)return i.trim();const r=(e.textContent??"").trim().replace(/\s+/g," ");return r.length<=80?r:""}function Ge(e){const t=e.getAttribute("role");if(t)return t;const n=e.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&e.hasAttribute("href"))return"link";if(n==="select")return"combobox";if(n==="textarea")return"textbox";if(n==="input"){const o=(e.getAttribute("type")??"text").toLowerCase();return o==="checkbox"?"checkbox":o==="radio"?"radio":o==="button"||o==="submit"||o==="reset"?"button":"textbox"}if(/^h[1-6]$/.test(n))return"heading"}function O(e){const t=e.getAttribute("id");if(t&&!Le(t)&&!(j().locators.distrustNumericIds&&De(t)))return`#${L(t)}`;const n=e.getAttribute("name");if(n)return`${e.tagName.toLowerCase()}[name="${L(n)}"]`}function Ve(e){const t=e.getBoundingClientRect();if(t.width===0&&t.height===0)return!1;const n=getComputedStyle(e);return n.visibility!=="hidden"&&n.display!=="none"}function Y(e){try{const t=Array.from(document.querySelectorAll(e)),n=t.filter(Ve);return n.length>0?n.length:t.length}catch{return 0}}function X(e,t,n){return`${e}[${t}="${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function G(e){return Array.from(e.classList).filter(t=>!Ie(t)&&!(j().locators.distrustHashedClasses&&ze(t))&&/^[A-Za-z_-][\w-]*$/.test(t))}let H=null,ve=0,ye="";function j(){const e=Date.now();if(H&&ye===location.href&&e-ve<4e3)return H;try{H=re(Pe(document,window))}catch{H=Re}return ve=e,ye=location.href,H}const Qe=["data-sku","data-id","data-item-id","data-product-id","data-key","data-row-id"];function et(e){for(const t of Qe){const n=e.getAttribute(t);if(n&&n.length<=80)return X(e.tagName.toLowerCase(),t,n)}}function tt(e,t){const n=t.find(i=>{try{return document.querySelectorAll(i).length>1}catch{return!1}});if(!n)return;let o=e.parentElement;for(let i=0;o&&o!==document.body&&i<8;i++,o=o.parentElement){const r=o.parentElement;if(!r)break;const a=Array.from(r.children).filter(c=>c.tagName===o.tagName);if(a.length<3||a.filter(c=>c.querySelector(n)).length<3)continue;const l=Array.from(o.querySelectorAll("*")).filter(c=>c.children.length===0).map(c=>ee(c)).filter(c=>c.length>=3&&c.length<=60&&/[A-Za-z]{2,}/.test(c)&&!/^[\d\s.,:/$\u20ac\u00a3\u00a5%+\-()]+$/.test(c));for(const c of l)if(a.filter(d=>Array.from(d.querySelectorAll("*")).some(u=>u.children.length===0&&ee(u)===c)).length===1)return{css:n,within:c}}}function nt(e){const t=V(e)[0]??Q(e);let n=e;for(let o=0;n&&n!==document.body&&o<8;o++,n=n.parentElement){const i=et(n);if(!i)continue;const r=n===e?i:`${i} ${t}`;if(Y(r)===1)return r}}function V(e){const t=e.tagName.toLowerCase(),n=[];for(const r of["aria-label","title","alt","placeholder","name"]){const a=e.getAttribute(r);a&&a.length<=80&&!F(a)&&n.push(X(t,r,a))}const o=e.getAttribute("href");if(o&&!o.startsWith("javascript:")&&o.length<=120){const r=o.replace(/[?#].*$/,"");r&&r!=="/"&&!/\d{4,}/.test(r)&&n.push(X(t,"href",o.replace(/#.*$/,"")))}const i=G(e);return i.length&&(n.push(`${t}.${i.slice(0,2).map(L).join(".")}`),n.push(`.${i.slice(0,2).map(L).join(".")}`)),n}function Q(e){const t=O(e);if(t)return t;const n=e.tagName.toLowerCase(),o=G(e).slice(0,2);return o.length?`${n}.${o.map(L).join(".")}`:n}function ot(e){const t=V(e)[0]??Q(e);let n=e.parentElement;for(let o=0;n&&n!==document.body&&o<5;o++,n=n.parentElement){const i=O(n)??(G(n).length?Q(n):void 0);if(!i)continue;const r=`${i} ${t}`;if(Y(r)===1)return r}}function rt(e){const t=[];let n=e;for(;n&&n!==document.documentElement&&t.length<8;){const o=O(n);if(o&&n!==e){t.unshift(o);break}const i=n.tagName.toLowerCase(),r=n.parentElement;if(!r){t.unshift(i);break}const a=Array.from(r.children).filter(l=>l.tagName===n.tagName);t.unshift(a.length>1?`${i}:nth-of-type(${a.indexOf(n)+1})`:i),n=r}return t.join(" > ")}function ee(e){return(e.textContent??"").trim().replace(/\s+/g," ")}function it(e){for(let t=e;t;t=t.parentElement){const n=t.getAttribute("id"),o=t.getAttribute("name");if((n||o)&&ne({id:n,name:o,type:t.getAttribute("type")}))return!0}return!1}function z(e){const t=e.getAttribute("data-testid")??e.getAttribute("data-test-id")??e.getAttribute("data-test")??void 0,n=Ge(e),o=xe(e),i=it(e),r=o&&!i&&!F(o)?o:void 0,a=(e.tagName.toLowerCase()==="a"||n==="button")&&r?r:void 0,l=[],c=[];for(const x of V(e))(Y(x)===1?l:c).push(x);const f=ot(e),d=nt(e),u=[...d?[d]:[],...l,...f?[f]:[]];let m;if(!a&&!i&&e.children.length===0){const x=ee(e);x&&x.length<=80&&!F(x)&&(m=x)}const D=rt(e),Ae=[...u,...c.slice(0,1),...D?[D]:[]],W=j().locators.preferSemantic||c.length>0?tt(e,[...u,...c]):void 0;return He({testId:t,role:n,name:r,css:O(e),text:a??m},W?[W.css,...Ae.filter(x=>x!==W.css)]:Ae,W?.within)}function te(e){return e.composedPath().find(n=>n instanceof Element)??e.target}function we(e){const t=e.className;return typeof t=="string"?t:""}function st(e){const t=e.closest('.dropdown-menu, [role="menu"], [aria-labelledby]');if(!t)return null;const n=t.closest('li, .dropdown, [role="menuitem"]')??t.parentElement,o=[],i=t.getAttribute("aria-labelledby");if(i){const r=document.getElementById(i);r&&o.push(r)}n&&o.push(...Array.from(n.children));for(const r of o)if(!(r===e||r.contains(e)||r===t)&&Te({hasPopup:r.getAttribute("aria-haspopup"),expanded:r.getAttribute("aria-expanded"),dataToggle:r.getAttribute("data-bs-toggle")??r.getAttribute("data-toggle"),className:we(r),dataOnce:r.getAttribute("data-once")}))return r;return null}function at(e){for(let t=e;t&&t!==document.body;t=t.parentElement){const n=Object.entries(t.dataset??{}).map(([o,i])=>`${o}=${i}`).join(" ");if(_e({testId:t.getAttribute("data-testid"),className:we(t),id:t.getAttribute("id"),ariaLabel:t.getAttribute("aria-label"),dataset:n,inDialog:t.tagName==="DIALOG"||t.getAttribute("role")==="dialog"||t.getAttribute("aria-modal")==="true"}))return!0}return!1}function ct(e){return e instanceof Element?e.closest('button, a[href], input, select, textarea, [role="button"], [role="link"], [role="menuitem"], [role="tab"], summary, label')??e:null}function q(e){return e.composedPath().some(t=>t instanceof Element&&t.hasAttribute("data-percy-recorder"))}function lt(e){if(!k||!e.isTrusted||q(e))return;const t=ct(te(e));if(!t)return;const n=t.tagName.toLowerCase();if(n==="select"||n==="textarea")return;if(n==="input"){const r=(t.getAttribute("type")??"text").toLowerCase();if(r==="checkbox"||r==="radio"||!["button","submit","reset"].includes(r))return}const o={type:"click",target:z(t)};at(t)&&(o.optional=!0);const i=st(t);i&&$({type:"hover",target:z(i)}),$(o)}function dt(e){if(!k||!e.isTrusted||q(e))return;const t=te(e);if(t instanceof HTMLSelectElement)$({type:"select",target:z(t),value:t.value});else if(t instanceof HTMLInputElement){const n=t.type.toLowerCase();(n==="checkbox"||n==="radio")&&$({type:t.checked?"check":"uncheck",target:z(t)})}}function ut(e){if(!k||!e.isTrusted||q(e))return;const t=te(e);if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)||t instanceof HTMLInputElement&&["checkbox","radio","button","submit","file"].includes(t.type))return;const n=xe(t),o=ne({type:t.getAttribute("type"),name:t.getAttribute("name"),id:t.getAttribute("id"),autocomplete:t.getAttribute("autocomplete"),label:n}),i=z(t);$(o?{type:"fill",target:i,valueRef:$e(n||t.getAttribute("name")||t.id||"secret")}:{type:"fill",target:i,value:t.value})}function pt(e){!k||!e.isTrusted||!Me(e)||q(e)||(e.preventDefault(),e.stopPropagation(),de())}let ke;function ft(){k&&(window.clearTimeout(ke),ke=window.setTimeout(()=>{$({type:"scroll",scrollX:Math.round(window.scrollX),scrollY:Math.round(window.scrollY)})},250))}const Se="__percyRecorderInstalled",Ce=window[Se]===!0;window[Se]=!0;function ht(){Ce||(document.addEventListener("click",lt,!0),document.addEventListener("change",dt,!0),document.addEventListener("input",ut,!0),document.addEventListener("keydown",pt,!0),window.addEventListener("scroll",ft,{passive:!0}))}ht(),Ce||chrome.runtime.onMessage.addListener((e,t,n)=>{e?.kind==="rec:active"&&(k=!!e.active),e?.kind==="rec:state"&&(k=!!e.state?.active&&!e.state?.paused,be(e.state)),e?.kind==="rec:viewport"&&n({width:window.innerWidth,height:window.innerHeight,pageKind:j().kind})}),chrome.runtime.sendMessage({kind:"rec:hello",url:location.href}).then(e=>{k=!!e?.active,e?.state&&be(e.state)}).catch(()=>{}),Xe()})(); diff --git a/Distributables/percy-local-manager-extension/help.css b/Distributables/percy-local-manager-extension/help.css new file mode 100644 index 0000000..184c6e5 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help.css @@ -0,0 +1 @@ +:root{color-scheme:light;font-family:Arial,Helvetica,sans-serif;color:#15121f;background:#fff;font-synthesis:none;text-rendering:optimizeLegibility}*{box-sizing:border-box}html{scroll-behavior:smooth;scroll-padding-top:68px}body{margin:0;min-width:320px;background:#fff}.help-topbar{position:sticky;z-index:5;top:0;display:flex;height:54px;align-items:center;justify-content:space-between;gap:20px;padding:0 clamp(20px,6vw,94px);border-bottom:1px solid #e6e2ef;background:#fff}.help-brand{display:flex;min-width:0;align-items:center;gap:10px;color:#302b40;text-decoration:none}.help-brand__title{font-size:16px;font-weight:700;white-space:nowrap}.help-brand__divider{height:23px;border-left:1px solid #d5d1df}.help-brand__section{color:#423c56;font-size:14px;font-weight:600;white-space:nowrap}.help-search,.help-sidebar__search{display:flex;align-items:center;gap:8px;border:1px solid #d5d1df;border-radius:6px;background:#fff;color:#8a8599}.help-search{width:min(390px,42vw);height:34px;padding:0 8px 0 10px}.help-search input,.help-sidebar__search input{width:100%;min-width:0;border:0;outline:0;background:transparent;color:#302b40;font:inherit;font-size:13px}.help-search input::placeholder,.help-sidebar__search input::placeholder{color:#8a8599}.help-search kbd{border:0;color:#8a8599}.help-shell{display:grid;min-height:calc(100vh - 54px);grid-template-columns:minmax(270px,22.5vw) minmax(0,1fr)}.help-sidebar{position:sticky;top:54px;height:calc(100vh - 54px);overflow:auto;padding:30px clamp(20px,3vw,46px) 28px clamp(24px,6vw,94px);border-right:1px solid #e6e2ef;background:#fff}.help-sidebar__search{height:32px;margin-bottom:22px;padding:0 8px}.help-nav{display:grid;gap:9px}.help-nav details{min-width:0}.help-nav summary{display:flex;align-items:center;justify-content:space-between;padding:7px 0;color:#3a3a3a;cursor:pointer;font-size:13px;font-weight:400;list-style:none}.help-nav summary::-webkit-details-marker{display:none}.help-nav summary:after{content:"⌄";color:#726c87;font-size:12px}.help-nav details:not([open]) summary:after{content:"›"}.help-nav__items{display:grid;margin:2px 0 5px;padding-left:12px;border-left:1px solid #d9d9d9}.help-nav__items a{padding:7px 8px;border-radius:0;color:#3a3a3a;font-size:13px;line-height:1.4;text-decoration:none}.help-nav__items a:hover,.help-nav__items a:focus-visible{background:#f5f9ff;color:#007bff;outline:none}.help-nav__empty{padding:4px 5px;color:#726c87;font-size:12px;line-height:1.5}.help-content{min-width:0;padding:0 clamp(22px,3.5vw,54px) 64px;background:#fff}.help-content__layout{display:grid;width:min(100%,1210px);grid-template-columns:minmax(0,760px) 190px;justify-content:center;align-items:start;gap:clamp(30px,3.4vw,54px);margin:0 auto}.help-content__inner{min-width:0}.help-breadcrumb{display:flex;gap:10px;align-items:center;padding:22px 0 24px;color:#726c87;font-size:12px}.help-page-toc{position:sticky;top:82px;max-height:calc(100vh - 100px);overflow:auto;margin-top:76px;padding-left:14px;color:#3a3a3a}.help-page-toc h2{margin:0 0 10px;color:#3a3a3a;font-size:11px;font-weight:700;letter-spacing:.02em}.help-page-toc nav{display:grid;margin-bottom:28px;padding-left:12px;border-left:1px solid #d9d9d9}.help-page-toc nav a,.help-resource-links a{padding:5px 7px;color:#3a3a3a;font-size:13px;line-height:1.45;text-decoration:none}.help-page-toc nav a:first-child{border-left:2px solid #007bff;color:#007bff;font-weight:600}.help-page-toc nav a:hover,.help-resource-links a:hover{color:#007bff;text-decoration:underline}.help-resource-links{display:grid;gap:2px;margin:0;padding:0;list-style:none}.help-intro{padding:0 0 20px;scroll-margin-top:70px}.help-eyebrow{margin:0 0 7px;color:#007bff;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}.help-intro h1{margin:0 0 10px;color:#363636;font-size:clamp(27px,4vw,34px);letter-spacing:-.035em;line-height:1.2}.help-intro>p:not(.help-eyebrow){max-width:680px;margin:0;color:#666;font-size:16px;line-height:1.6}.help-flow{display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin-top:17px;color:#423c56;font-size:12px;font-weight:600}.help-flow span{padding:6px 10px;border:1px solid #e6e2ef;border-radius:999px;background:#faf9fd}.help-flow b{color:#6af}.help-section{padding-top:29px;scroll-margin-top:68px}.help-section h2{margin:0 0 9px;color:#363636;font-size:23px;letter-spacing:-.02em}.help-lead{margin:0 0 15px;color:#666;font-size:15px;line-height:1.6}.help-os-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.help-card{padding:14px;border:1px solid #e6e2ef;border-radius:8px;background:#fff}.help-card h3{margin:0 0 9px;color:#423c56;font-size:14px}.help-card ol,.help-steps{margin:0;padding-left:20px;color:#3a3a3a;font-size:14px;line-height:1.65}.help-card li+li,.help-steps li+li{margin-top:6px}.help-layout code,.help-content code{padding:2px 4px;border-radius:4px;background:#eef6ff;color:#0056b3;font-family:Courier New,monospace;font-size:.92em;overflow-wrap:anywhere}.help-note,.help-callout{margin:14px 0 0;padding:12px 14px;border:1px solid #e6e2ef;border-radius:7px;background:#faf9fd;color:#423c56;font-size:13px;line-height:1.6}.help-callout{border-color:#b3d4ff;background:#eaf3ff}.help-steps{padding:0 0 0 22px}.help-steps li{padding-left:2px}.recorder-tutorial{display:grid;gap:25px;margin-top:21px}.recorder-step{display:grid;grid-template-columns:35px minmax(0,1fr);gap:14px;align-items:start}.recorder-step__number{display:grid;width:32px;height:32px;place-items:center;border:1px solid #b3d4ff;border-radius:50%;background:#eaf3ff;color:#0056b3;font-size:11px;font-weight:700}.recorder-step__content{min-width:0;padding-bottom:22px;border-bottom:1px solid #e6e2ef}.recorder-step:last-child .recorder-step__content{padding-bottom:0;border-bottom:0}.recorder-step__content h3{margin:3px 0 7px;color:#423c56;font-size:16px;line-height:1.4}.recorder-step__content>p{margin:0;color:#5b556d;font-size:13px;line-height:1.65}.help-visual{margin:14px 0 0;overflow:hidden;border:1px solid #e6e2ef;border-radius:9px;background:#f5f4fa}.help-visual img{display:block;width:100%;height:auto}.help-visual figcaption{padding:10px 13px;border-top:1px solid #e6e2ef;background:#fff;color:#726c87;font-size:12px;line-height:1.5}kbd{display:inline-block;min-width:22px;padding:2px 6px;border:1px solid #d5d1df;border-bottom-width:2px;border-radius:4px;background:#faf9fd;color:#423c56;font-family:inherit;font-size:11px;text-align:center}.help-troubleshooting{display:grid;gap:8px}.help-issue{padding:12px 14px;border:1px solid #e6e2ef;border-radius:7px;background:#fff;scroll-margin-top:70px}.help-issue summary{color:#423c56;cursor:pointer;font-size:13px;font-weight:600;line-height:1.5}.help-issue p{margin:10px 0 0;color:#5b556d;font-size:13px;line-height:1.65}.help-footer{margin-top:28px;padding-top:14px;border-top:1px solid #e6e2ef;color:#726c87;font-size:12px;line-height:1.6}@media(max-width:1200px){.help-shell{grid-template-columns:210px minmax(0,1fr)}.help-content__layout{display:block}.help-page-toc{display:none}}@media(max-width:900px){.help-shell{grid-template-columns:210px minmax(0,1fr)}.help-content{padding-right:22px;padding-left:22px}.help-os-grid{grid-template-columns:1fr}}@media(max-width:680px){.help-topbar{height:auto;min-height:54px;padding:10px 14px}.help-brand__section,.help-brand__divider,.help-search{display:none}.help-shell{display:block}.help-sidebar{position:static;height:auto;overflow:visible;padding:12px 16px;border-right:0;border-bottom:1px solid #e6e2ef}.help-sidebar__search{margin-bottom:10px}.help-nav{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}.help-nav summary{font-size:11px}.help-nav__items{position:absolute;z-index:2;max-width:250px;padding:6px;border:1px solid #e6e2ef;border-radius:6px;background:#fff;box-shadow:0 8px 20px #15121f1f}.help-content{padding:0 18px 48px}.recorder-step{grid-template-columns:28px minmax(0,1fr);gap:9px}.recorder-step__number{width:27px;height:27px;font-size:10px}.help-breadcrumb{padding-top:16px;padding-bottom:17px}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}} diff --git a/Distributables/percy-local-manager-extension/help.html b/Distributables/percy-local-manager-extension/help.html new file mode 100644 index 0000000..eadf401 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help.html @@ -0,0 +1,14 @@ + + + + + + Documentation | Percy Chrome Extension + + + + + +
+ + diff --git a/Distributables/percy-local-manager-extension/help.js b/Distributables/percy-local-manager-extension/help.js new file mode 100644 index 0000000..2c8e3f2 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help.js @@ -0,0 +1 @@ +import{r as i,j as e,R as h,a as p}from"./client.js";const u=[{title:"macOS",steps:[e.jsxs(e.Fragment,{children:["Open Terminal in the supplied ",e.jsx("code",{children:"percy-mac"})," folder."]}),e.jsx(e.Fragment,{children:"Install Node.js and npm if needed. Go is not required for the prebuilt server."}),e.jsx(e.Fragment,{children:e.jsx("code",{children:"chmod +x server server-arm64 server.sh"})}),e.jsxs(e.Fragment,{children:[e.jsx("code",{children:"xattr -d com.apple.quarantine server server-arm64"})," only if macOS blocks the downloaded binaries."]}),e.jsx(e.Fragment,{children:e.jsx("code",{children:"./server.sh start"})})]},{title:"Linux",steps:[e.jsxs(e.Fragment,{children:["Open a terminal in the supplied ",e.jsx("code",{children:"percy-linux"})," folder."]}),e.jsx(e.Fragment,{children:"Install Node.js and npm if needed. Go is not required for the prebuilt server."}),e.jsx(e.Fragment,{children:e.jsx("code",{children:"chmod +x server server.sh"})}),e.jsx(e.Fragment,{children:e.jsx("code",{children:"./server.sh start"})})]},{title:"Windows",steps:[e.jsx(e.Fragment,{children:"Install Node.js LTS if needed, then reopen Command Prompt or PowerShell."}),e.jsxs(e.Fragment,{children:["Open a terminal in the supplied ",e.jsx("code",{children:"percy-windows"})," folder."]}),e.jsx(e.Fragment,{children:e.jsx("code",{children:"server.bat start"})}),e.jsxs(e.Fragment,{children:["If SmartScreen appears, choose ",e.jsx("strong",{children:"More info"}),", then ",e.jsx("strong",{children:"Run anyway"}),"."]})]}],o=[{id:"overview",title:"What is Percy Chrome Extension?"},{id:"backend",title:"Start the backend"},{id:"token",title:"Set your Percy token"},{id:"manual",title:"Manual snapshots"},{id:"workflow",title:"Record and replay workflows"},{id:"troubleshooting",title:"Troubleshooting"}],l=[{id:"trouble-backend",title:"The popup says “Backend server is offline”",text:e.jsxs(e.Fragment,{children:["Start the server using the command for your OS above. Open ",e.jsx("code",{children:"http://localhost:4321/health"})," to check that it responds, then reopen the popup. On macOS or Linux, use ",e.jsx("code",{children:"./server.sh status"})," and check ",e.jsx("code",{children:"server.log"})," if it will not start; on Windows, check ",e.jsx("code",{children:"server.log"})," and use ",e.jsx("code",{children:"server.bat status"}),"."]})},{id:"trouble-token",title:"Builds fail or Percy rejects the token",text:e.jsxs(e.Fragment,{children:["Open the extension popup, select the gear icon, and save a valid ",e.jsx("strong",{children:"Percy full access token"}),". Read-only or restricted tokens cannot create builds. If you saved the token while the backend was offline, start the backend and save the token again so the snapshot-library integration can also receive it. Never share your token."]})},{id:"trouble-record",title:"Record Workflow does not start",text:e.jsxs(e.Fragment,{children:["Recording requires an active ",e.jsx("code",{children:"http://"})," or ",e.jsx("code",{children:"https://"})," tab. Chrome internal pages (for example ",e.jsx("code",{children:"chrome://extensions"}),") cannot be recorded. Reload the website tab and try again if the recorder cannot attach to it."]})},{id:"trouble-shortcut",title:"Snapshot shortcut: Cmd/Ctrl+S opens the browser Save dialog",text:e.jsxs(e.Fragment,{children:["The shortcut works only during an unpaused workflow recording. Click back into the website page (not an input in the floating panel), make sure the recorder says ",e.jsx("strong",{children:"Recording"}),", and press ",e.jsx("kbd",{children:"⌘"}),"+",e.jsx("kbd",{children:"S"})," on macOS or ",e.jsx("kbd",{children:"Ctrl"}),"+",e.jsx("kbd",{children:"S"})," on Windows/Linux. It is not handled while paused."]})},{id:"trouble-save",title:"Cannot save a workflow",text:e.jsxs(e.Fragment,{children:["Stop the recording first, add at least one ",e.jsx("strong",{children:"Capture Snapshot"})," checkpoint, and enter a workflow name. Review the step list for any steps reported without a locator; edit those steps or delete and record them again before saving."]})},{id:"trouble-replay",title:"A workflow replay misses a menu, element, or visual state",text:e.jsx(e.Fragment,{children:"Record the journey again from a stable starting page. For a hover-only visual state, hover the target and press Cmd/Ctrl+S without moving the pointer to the floating panel; that adds a checkpoint for the currently rendered state. For a menu item click, the recorder may also capture its detected menu trigger. Add a longer checkpoint wait or edit the step/checkpoint from the Snapshots page if the page needs more time to settle."})}];function x(){const[r,c]=i.useState(""),t=i.useMemo(()=>{const s=r.trim().toLowerCase();return s?o.filter(n=>n.title.toLowerCase().includes(s)):o},[r]),a=i.useMemo(()=>{const s=r.trim().toLowerCase();return s?l.filter(n=>n.title.toLowerCase().includes(s)):l},[r]);return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"help-topbar",children:[e.jsxs("a",{className:"help-brand",href:"#overview","aria-label":"Percy Chrome Extension documentation home",children:[e.jsx("img",{src:"/icons/percy-icon.svg",alt:"",width:"24",height:"24"}),e.jsx("span",{className:"help-brand__title",children:"Percy Chrome Extension"}),e.jsx("span",{className:"help-brand__divider","aria-hidden":"true"}),e.jsx("span",{className:"help-brand__section",children:"Documentation"})]}),e.jsxs("label",{className:"help-search",children:[e.jsx("span",{"aria-hidden":"true",children:"⌕"}),e.jsx("input",{type:"search",placeholder:"Search documentation","aria-label":"Search documentation by title",value:r,onChange:s=>c(s.target.value)})]})]}),e.jsxs("div",{className:"help-shell",children:[e.jsxs("aside",{className:"help-sidebar","aria-label":"Documentation navigation",children:[e.jsxs("label",{className:"help-sidebar__search",children:[e.jsx("span",{"aria-hidden":"true",children:"⌕"}),e.jsx("input",{type:"search",placeholder:"Search by title","aria-label":"Search sections by title",value:r,onChange:s=>c(s.target.value)})]}),e.jsxs("nav",{className:"help-nav",children:[e.jsxs("details",{open:!0,children:[e.jsx("summary",{children:"Overview"}),t.some(s=>s.id==="overview"||s.id==="backend")&&e.jsx("div",{className:"help-nav__items",children:t.filter(s=>s.id==="overview"||s.id==="backend").map(s=>e.jsx("a",{href:`#${s.id}`,children:s.title},s.id))})]}),e.jsxs("details",{open:!0,children:[e.jsx("summary",{children:"Get started"}),t.some(s=>["token","manual","workflow"].includes(s.id))&&e.jsx("div",{className:"help-nav__items",children:t.filter(s=>["token","manual","workflow"].includes(s.id)).map(s=>e.jsx("a",{href:`#${s.id}`,children:s.title},s.id))})]}),e.jsxs("details",{open:!0,children:[e.jsx("summary",{children:"Troubleshooting"}),(t.some(s=>s.id==="troubleshooting")||a.length>0)&&e.jsxs("div",{className:"help-nav__items",children:[t.some(s=>s.id==="troubleshooting")&&e.jsx("a",{href:"#troubleshooting",children:"Common issues"}),a.map(s=>e.jsx("a",{href:`#${s.id}`,children:s.title},s.id))]})]}),t.length===0&&a.length===0&&e.jsxs("p",{className:"help-nav__empty",children:["No section titles match “",r,"”."]})]})]}),e.jsx("main",{className:"help-content",children:e.jsxs("div",{className:"help-content__layout",children:[e.jsxs("div",{className:"help-content__inner",children:[e.jsxs("div",{className:"help-breadcrumb",children:[e.jsx("span",{children:"Percy Chrome Extension"}),e.jsx("span",{"aria-hidden":"true",children:"›"}),e.jsx("span",{children:"Documentation"})]}),e.jsxs("section",{className:"help-intro",id:"overview",children:[e.jsx("p",{className:"help-eyebrow",children:"Percy Chrome Extension"}),e.jsx("h1",{children:"Setup and user guide"}),e.jsx("p",{children:"Capture visual checkpoints during manual regression testing, or record a repeatable workflow and replay it to create Percy builds."}),e.jsxs("div",{className:"help-flow","aria-label":"How the extension works",children:[e.jsx("span",{children:"Chrome extension"}),e.jsx("b",{"aria-hidden":"true",children:"→"}),e.jsx("span",{children:"Local backend"}),e.jsx("b",{"aria-hidden":"true",children:"→"}),e.jsx("span",{children:"Percy build"})]})]}),e.jsxs("section",{className:"help-section",id:"backend",children:[e.jsx("h2",{children:"Start the backend service"}),e.jsx("p",{className:"help-lead",children:"Start the local service before taking snapshots or replaying a workflow."}),e.jsx("div",{className:"help-os-grid",children:u.map(s=>e.jsxs("article",{className:"help-card",children:[e.jsx("h3",{children:s.title}),e.jsx("ol",{children:s.steps.map((n,d)=>e.jsx("li",{children:n},d))})]},s.title))}),e.jsxs("p",{className:"help-note",children:["The packaged backend listens on ",e.jsx("code",{children:"http://localhost:4321"}),". The popup shows ",e.jsx("strong",{children:"Backend Connected"})," when reachable. Full platform instructions are included alongside each server package."]})]}),e.jsxs("section",{className:"help-section",id:"token",children:[e.jsx("h2",{children:"Set your Percy token"}),e.jsx("p",{className:"help-lead",children:"Connect the extension to the Percy project where builds should be created."}),e.jsxs("ol",{className:"help-steps",children:[e.jsxs("li",{children:["Go to ",e.jsx("code",{children:"chrome://extensions"}),", turn on ",e.jsx("strong",{children:"Developer mode"}),", and choose ",e.jsx("strong",{children:"Load unpacked"}),"."]}),e.jsxs("li",{children:["Select the supplied extension folder, or the ",e.jsx("code",{children:"dist"})," folder if you built from source."]}),e.jsxs("li",{children:["Open the extension popup, click the ",e.jsx("strong",{children:"gear icon"}),", paste your ",e.jsx("strong",{children:"Percy full access token"}),", and save it."]})]}),e.jsxs("div",{className:"help-callout",children:[e.jsx("strong",{children:"Full access is required."})," Read-only or restricted tokens cannot create Percy builds. The token is stored in Chrome extension storage and used for Percy actions. Treat it like a password; do not share it or include it in screenshots."]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/token-settings.svg",alt:"Mock Percy Chrome Extension token settings panel with a masked full access token field, Save Token button, and saved confirmation.",loading:"lazy"}),e.jsx("figcaption",{children:"Open the gear settings in the popup, enter your full access token, and select Save Token. The illustration uses a masked placeholder, not a real token."})]})]}),e.jsxs("section",{className:"help-section",id:"manual",children:[e.jsx("h2",{children:"Manual snapshots"}),e.jsx("p",{className:"help-lead",children:"Best for quick captures during manual regression testing."}),e.jsxs("ol",{className:"help-steps",children:[e.jsx("li",{children:"Open the page you want to test in Chrome and open the Percy extension popup."}),e.jsx("li",{children:"Optionally enter a snapshot name. Otherwise, the page title is used."}),e.jsxs("li",{children:["Select ",e.jsx("strong",{children:"Capture Snapshot"}),". The current page DOM, URL, and viewport are sent to the local backend and added to the snapshot queue."]}),e.jsx("li",{children:"Repeat on the pages or states you want included in the build."}),e.jsxs("li",{children:["Select ",e.jsx("strong",{children:"View Snapshots"}),". Review the queued rows, set the build branch and optional target branch if needed, then select ",e.jsx("strong",{children:"Finalize Build"}),". When it finishes, choose ",e.jsx("strong",{children:"Open Percy Build"}),"."]})]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/manual-snapshot.svg",alt:"Illustration of the Percy extension popup capturing the current page and linking to the Snapshots page.",loading:"lazy"}),e.jsx("figcaption",{children:"Capture pages as you test. The popup adds each capture to the queue and links to the Snapshots page."})]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/recorder-replay.svg",alt:"Mock Snapshot page showing queued snapshots and Finalize Build at the top, with the Recorded Workflows selector and Replay / Create Build action lower down.",loading:"lazy"}),e.jsx("figcaption",{children:"The Snapshot page is the build hub: finalize the queued snapshots at the top, or replay a saved workflow in Recorded Workflows below."})]}),e.jsx("p",{className:"help-note",children:"Advanced options include viewport widths, minimum height, CSS scope, JavaScript rendering, and Percy CSS. Captures can be queued without a token; a full access token is required to finalize a build."})]}),e.jsxs("section",{className:"help-section",id:"workflow",children:[e.jsx("h2",{children:"Record and replay a workflow"}),e.jsx("p",{className:"help-lead",children:"Use this for a code-frozen feature or a journey you want to repeat across builds."}),e.jsxs("div",{className:"recorder-tutorial",children:[e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"01"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Start recording on the page you want to test"}),e.jsxs("p",{children:["Open the feature’s starting page, then select ",e.jsx("strong",{children:"Record Workflow"})," in the extension popup. The popup closes and the floating recorder appears on that tab."]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/recorder-start.svg",alt:"Mockup based on the extension popup, showing the connected state and the Record Workflow button beside a website.",loading:"lazy"}),e.jsx("figcaption",{children:"Start on the page and state you want the recorded journey to replay from."})]})]})]}),e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"02"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Perform the user journey"}),e.jsxs("p",{children:["Use the website normally. Clicks, text entry, selects, checkbox changes, and scrolling are recorded. Use",e.jsx("strong",{children:" Pause"})," when you need to do something outside the workflow."]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/recorder-actions.svg",alt:"Mockup based on the floating recorder panel, showing a recording with captured form steps and Pause and Stop controls.",loading:"lazy"}),e.jsx("figcaption",{children:"The floating panel lists captured actions and lets you pause or stop the recording."})]})]})]}),e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"03"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Add visual checkpoints as you go"}),e.jsxs("p",{children:["Leave the page in the state to capture, including an open hover menu, then press ",e.jsx("kbd",{children:"⌘"}),"+",e.jsx("kbd",{children:"S"})," on macOS or ",e.jsx("kbd",{children:"Ctrl"}),"+",e.jsx("kbd",{children:"S"})," on Windows/Linux. This adds a checkpoint without moving the pointer. The floating panel’s ",e.jsx("strong",{children:"Capture Snapshot"})," button also works when reaching the panel will not dismiss the state. The default wait is 4 seconds."]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/workflow-checkpoint.svg",alt:"Mockup of an open hover menu and the floating recorder checkpoint controls, including the Command or Control plus S shortcut.",loading:"lazy"}),e.jsx("figcaption",{children:"Capture the visible state before moving on. Name the checkpoint and adjust its wait or Percy options if needed."})]})]})]}),e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"04"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Stop, review, and save"}),e.jsxs("p",{children:["Select ",e.jsx("strong",{children:"Stop"}),", review the recorded steps, enter a workflow name, and select ",e.jsx("strong",{children:"Save Workflow"}),". You can edit, reorder, or remove steps. At least one snapshot checkpoint is required."]}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/recorder-save.svg",alt:"Mockup based on the stopped floating recorder, showing a checkpoint in the step list, a workflow name, and Save Workflow and Discard buttons.",loading:"lazy"}),e.jsx("figcaption",{children:"Save a named workflow after checking that the journey includes its required snapshot checkpoints."})]})]})]}),e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"05"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Replay it to create a Percy build"}),e.jsxs("p",{children:["Open ",e.jsx("strong",{children:"View Snapshots"})," to go to the Snapshots page shown above. The queued-snapshot controls are at the top; scroll to ",e.jsx("strong",{children:"Recorded Workflows"}),", choose the saved journey, set any desired branch or target branch, and provide any requested run-only secrets. Then select",e.jsx("strong",{children:" Replay / Create Build"}),". The backend starts replaying the workflow in Playwright."]})]})]}),e.jsxs("article",{className:"recorder-step",children:[e.jsx("span",{className:"recorder-step__number",children:"06"}),e.jsxs("div",{className:"recorder-step__content",children:[e.jsx("h3",{children:"Monitor the run and open the Percy build"}),e.jsx("p",{children:"Follow the workflow progress and logs on the Snapshots page while the backend captures each checkpoint. When the run completes, use its Percy build link to review the visual results."}),e.jsxs("figure",{className:"help-visual",children:[e.jsx("img",{src:"/help/workflow-complete.svg",alt:"Mock completed workflow run showing passed steps, uploaded checkpoint status, a View logs button, and Open Percy build.",loading:"lazy"}),e.jsx("figcaption",{children:"Check the run status and checkpoint results, view logs if needed, then open the Percy build."})]})]})]})]}),e.jsx("p",{className:"help-note",children:"Sensitive values such as passwords are not stored in a workflow. Provide them for the run when prompted. For hover states, use the shortcut while the pointer is over the target; it works only while recording is active and not paused."})]}),e.jsxs("section",{className:"help-section",id:"troubleshooting",children:[e.jsx("h2",{children:"Troubleshooting"}),e.jsx("p",{className:"help-lead",children:"Start with these common setup, capture, and replay issues."}),e.jsx("div",{className:"help-troubleshooting",children:l.map(s=>e.jsxs("details",{className:"help-issue",id:s.id,children:[e.jsx("summary",{children:s.title}),e.jsx("p",{children:s.text})]},s.id))})]}),e.jsxs("footer",{className:"help-footer",children:["Need more detail? Use the platform-specific Instructions file supplied with the backend, or check the backend’s ",e.jsx("code",{children:"server.log"}),"."]})]}),e.jsxs("aside",{className:"help-page-toc","aria-label":"On this page",children:[e.jsx("h2",{children:"ON THIS PAGE"}),e.jsx("nav",{"aria-label":"On this page",children:o.map(s=>e.jsx("a",{href:`#${s.id}`,children:s.title},s.id))}),e.jsx("h2",{children:"QUICK LINKS"}),e.jsxs("ul",{className:"help-resource-links",children:[e.jsx("li",{children:e.jsx("a",{href:"#trouble-backend",children:"Backend offline"})}),e.jsx("li",{children:e.jsx("a",{href:"#trouble-token",children:"Token issues"})})]})]})]})})]})]})}h.createRoot(document.getElementById("root")).render(e.jsx(p.StrictMode,{children:e.jsx(x,{})})); diff --git a/Distributables/percy-local-manager-extension/help/manual-snapshot.svg b/Distributables/percy-local-manager-extension/help/manual-snapshot.svg new file mode 100644 index 0000000..f5c1151 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/manual-snapshot.svg @@ -0,0 +1,48 @@ + + Manual snapshot capture walkthrough + A browser page beside the Percy Chrome Extension popup. The popup shows a snapshot name, Capture Snapshot button, a queued confirmation, and a link to View Snapshots. + + + + + + + + https://your-site.example/checkout + + + + + + + Your website under test + + + + + CURRENT PAGE STATE + Checkout review + + + Place order + + + + + + Percy Chrome Extension + CAPTURE + + SNAPSHOT NAME + Checkout - review + + + Capture Snapshot + + + + Snapshot added to queue + Review snapshots, then finalize build + + View Snapshots → + diff --git a/Distributables/percy-local-manager-extension/help/recorder-actions.svg b/Distributables/percy-local-manager-extension/help/recorder-actions.svg new file mode 100644 index 0000000..e3c0b4a --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/recorder-actions.svg @@ -0,0 +1,57 @@ + + Interact with the page while recording + A website and the actual style of the floating Percy recorder panel show a recording with recorded click, fill and scroll steps, plus Pause and Stop controls. + + + + + + + + https://your-site.example/checkout + + + + + CHECKOUT + Contact details + + Email address + + alex@example.com + Delivery method + + Standard delivery + + + Next: review order + + + + + + + Recording · 3 steps + RECORDED ACTIONS + + + 1 + Click "Email address" + + + 2 + Fill "Email address" + + + 3 + Select "Standard delivery" + + + Pause + + + Stop + Pause while handling anything you don't + want included in the recorded journey. + ACTIONS ARE RECORDED ON THIS TAB + diff --git a/Distributables/percy-local-manager-extension/help/recorder-replay.svg b/Distributables/percy-local-manager-extension/help/recorder-replay.svg new file mode 100644 index 0000000..49c5c3a --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/recorder-replay.svg @@ -0,0 +1,79 @@ + + Create either type of Percy build from the Snapshots page + A mock Snapshots page shows the Snapshot Queue with queued rows and the Finalize Build action, followed below by Recorded Workflows with a saved workflow and Replay / Create Build action. Both build paths are available on this same page. + + + + + + + + Percy Chrome Extension · snapshots.html + + Snapshot Queue + Review what's captured before you finalize a Percy build. + 2 + QUEUED + + + + NAME + URL + WIDTHS + MIN HEIGHT + OPTIONS + ACTIONS + + Product listing + /products + 375, 1280 + 1024 px + JS · CSS + + Edit + Product detail + /products/item + 375, 1280 + 1024 px + JS · CSS + + Edit + + + + Clear Snapshots + BUILD BRANCHES + + Default + Branch + + percy-local-manager + Target branch + + None (Percy's default) + + Finalize Build + + + Recorded Workflows + Replay a saved journey to create a Percy build. + + WORKFLOW + + Checkout regression (v1, 2 snapshots) + + + Edit workflow + BUILD BRANCHES + + Default + Branch + + percy-local-manager + Target branch + + None (Percy's default) + + + Replay / Create Build + diff --git a/Distributables/percy-local-manager-extension/help/recorder-save.svg b/Distributables/percy-local-manager-extension/help/recorder-save.svg new file mode 100644 index 0000000..264b651 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/recorder-save.svg @@ -0,0 +1,44 @@ + + Stop, review and save a workflow + The floating recorder is stopped and displays its recorded steps, including a named snapshot checkpoint, a workflow name field, and Save Workflow and Discard buttons. + + + + + + + + https://your-site.example/checkout + + + + CHECKOUT + + + + RECORDING STOPPED + Review before saving + + + + Checkpoint included + + + + + Recorded · 5 steps + + 1. Click "Email address" + + 2. Fill "Email address" + + 3. Snapshot: Checkout review (wait 4s) + WORKFLOW NAME + + Checkout regression + + Save Workflow + + Discard + At least one snapshot checkpoint is required. + diff --git a/Distributables/percy-local-manager-extension/help/recorder-start.svg b/Distributables/percy-local-manager-extension/help/recorder-start.svg new file mode 100644 index 0000000..61fc5e1 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/recorder-start.svg @@ -0,0 +1,44 @@ + + Start recording a workflow + The Percy Chrome Extension popup is open beside a website. Its Workflow panel has a Record Workflow button to start capturing a user journey. + + + + + + + + https://your-site.example/account + + + + + + Your application under test + + + + START FROM THE PAGE + Open the journey's + starting state + + + + + + + Percy Chrome Extension + + CONNECTED + WORKFLOW + + + + Record Workflow + Replay saved workflows from the + Snapshots page. + + + + Click to start on this tab + diff --git a/Distributables/percy-local-manager-extension/help/token-settings.svg b/Distributables/percy-local-manager-extension/help/token-settings.svg new file mode 100644 index 0000000..6516d00 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/token-settings.svg @@ -0,0 +1,38 @@ + + Enter and save a Percy full access token + A Percy Chrome Extension popup settings panel shows the Percy full access token password field, Save Token button, and confirmation after saving. The token itself is hidden. + + + + + + + Percy Chrome Extension + SETTINGS + + PERCY TOKEN + Percy full access token + + •••••••••••••••••••• + + + + + Save Token + + + + Token saved. + ← Back + + + Use a full access token + + + + Required to create builds + Restricted or read-only tokens + cannot finalize or replay builds. + The token value is masked. Never + share it or include it in screenshots. + diff --git a/Distributables/percy-local-manager-extension/help/workflow-checkpoint.svg b/Distributables/percy-local-manager-extension/help/workflow-checkpoint.svg new file mode 100644 index 0000000..876d16d --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/workflow-checkpoint.svg @@ -0,0 +1,54 @@ + + Record a workflow snapshot checkpoint + A website with a hover menu open and the floating Percy recorder showing a snapshot checkpoint. A keyboard hint shows Command or Control plus S to capture without moving the pointer. + + + + + + + + https://your-site.example/account + + + + + ACME STORE + Shop + Account + + + Account menu + + Profile + + Order history + + + The page state you want to compare + + + Page content + + + + + Recording · 5 steps + CAPTURE CHECKPOINT + + Account menu open + + + Capture Snapshot + + + Checkpoint added to workflow + + + ⌘ / Ctrl + + + + S + CAPTURE WITHOUT + moving the pointer + diff --git a/Distributables/percy-local-manager-extension/help/workflow-complete.svg b/Distributables/percy-local-manager-extension/help/workflow-complete.svg new file mode 100644 index 0000000..b326b80 --- /dev/null +++ b/Distributables/percy-local-manager-extension/help/workflow-complete.svg @@ -0,0 +1,48 @@ + + Monitor a workflow build and open it in Percy + A completed workflow build card on the Snapshots page shows passed steps and uploaded snapshot checkpoints, with controls to open the Percy build or view run logs. + + + + + + + + Percy Chrome Extension · Snapshots + + Recorded Workflows + Workflow run progress and Percy build links appear here. + + + Passed + Checkout regression · v1 · 3/3 steps + + + + + + + step-1 · navigate + passed + + + + + step-2 · click + passed + + + + + step-3 · snapshot + uploaded + + + + + Open Percy build → + + View logs + + Close + diff --git a/Distributables/percy-local-manager-extension/index.html b/Distributables/percy-local-manager-extension/index.html index 68d1ff5..f43209c 100644 --- a/Distributables/percy-local-manager-extension/index.html +++ b/Distributables/percy-local-manager-extension/index.html @@ -2,8 +2,9 @@ - Percy Local Manager + Percy Chrome Extension + diff --git a/Distributables/percy-local-manager-extension/library.html b/Distributables/percy-local-manager-extension/library.html index cf09bfb..feb3386 100644 --- a/Distributables/percy-local-manager-extension/library.html +++ b/Distributables/percy-local-manager-extension/library.html @@ -6,8 +6,9 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> - Percy Snapshots + Percy Chrome Extension | Snapshot Library + diff --git a/Distributables/percy-local-manager-extension/library.js b/Distributables/percy-local-manager-extension/library.js index 3f6747b..6f0ec28 100644 --- a/Distributables/percy-local-manager-extension/library.js +++ b/Distributables/percy-local-manager-extension/library.js @@ -1 +1 @@ -import{r as t,j as s,e as g,B as b,R as N,d as v}from"./BrandMark.js";/* empty css */import"./constants.js";function y({snapshot:a,onClose:p}){const r=a.comparisons??[],d=t.useMemo(()=>Array.from(new Set(r.map(e=>e.width))).sort((e,n)=>e-n),[r]),[o,u]=t.useState(d.length>0?d[0]:null),l=o===null?[]:r.filter(e=>e.width===o),[_,c]=t.useState(0),i=l[_]??l[0];function h(e){u(e),c(0)}function x(){l.length<=1||c(e=>e===0?l.length-1:e-1)}function m(){l.length<=1||c(e=>e===l.length-1?0:e+1)}return s.jsx("div",{className:"snapshot-modal",role:"dialog","aria-modal":"true","aria-labelledby":"snapshot-modal-title",onMouseDown:e=>{e.target===e.currentTarget&&p()},children:s.jsxs("div",{className:"snapshot-modal__content",children:[s.jsxs("header",{className:"snapshot-modal__header",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"snapshot-modal-title",className:"snapshot-modal__title",children:a.name}),s.jsxs("p",{className:"snapshot-modal__build",children:["Build ",a.buildId]})]}),s.jsx("button",{type:"button",className:"snapshot-modal__close",onClick:p,"aria-label":"Close",children:"×"})]}),s.jsxs("div",{className:"snapshot-modal__details",children:[s.jsxs("div",{className:"snapshot-modal__detail",children:[s.jsx("span",{className:"snapshot-modal__detail-label",children:"JavaScript"}),s.jsx("span",{className:"snapshot-modal__detail-value",children:a.enableJavaScript?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"snapshot-modal__detail",children:[s.jsx("span",{className:"snapshot-modal__detail-label",children:"Comparisons"}),s.jsx("span",{className:"snapshot-modal__detail-value",children:r.length})]})]}),d.length>0&&s.jsxs("div",{className:"snapshot-modal__width-section",children:[s.jsx("span",{className:"snapshot-modal__section-label",children:"Width"}),s.jsx("div",{className:"snapshot-modal__widths",children:d.map(e=>s.jsxs("button",{type:"button",className:`snapshot-modal__width ${o===e?"snapshot-modal__width--active":""}`,onClick:()=>h(e),children:[e,"px"]},e))})]}),i?s.jsxs("div",{className:"snapshot-modal__preview-section",children:[s.jsxs("div",{className:"snapshot-modal__comparison-info",children:[s.jsxs("div",{children:[s.jsxs("strong",{children:[i.width,"px"]}),s.jsxs("span",{children:[" ","× ",i.height,"px"]})]}),l.length>1&&s.jsxs("span",{children:[_+1," /"," ",l.length]})]}),s.jsx("div",{className:"snapshot-modal__image-container",children:i.previewUrl?s.jsx("img",{className:"snapshot-modal__image",src:i.previewUrl,alt:`${a.name} ${i.width}px`}):s.jsx("div",{className:"snapshot-modal__no-image",children:"No screenshot available."})}),l.length>1&&s.jsxs("div",{className:"snapshot-modal__navigation",children:[s.jsx("button",{type:"button",className:"button button--secondary",onClick:x,children:"← Previous"}),s.jsx("button",{type:"button",className:"button button--secondary",onClick:m,children:"Next →"})]})]}):s.jsx("div",{className:"snapshot-modal__empty",children:"No comparison data available."})]})})}function f(){const[a,p]=t.useState([]),[r,d]=t.useState(""),[o,u]=t.useState(!0),[l,_]=t.useState(null),[c,i]=t.useState(null),[h,x]=t.useState(null);t.useEffect(()=>{const e=new URLSearchParams(window.location.search),n=e.get("search"),j=e.get("snapshotId");n&&d(n),j&&(window.history.replaceState({},"",window.location.pathname),x(j))},[]),t.useEffect(()=>{g().then(p).catch(e=>_(e instanceof Error?e.message:"Failed to load library")).finally(()=>u(!1))},[]);const m=t.useMemo(()=>{const e=r.trim().toLowerCase();return e===""?a:a.filter(n=>n.name.toLowerCase().includes(e))},[a,r]);return t.useEffect(()=>{if(!h||o||a.length===0)return;const e=a.find(n=>n.id===h);e&&i(e),x(null)},[h,o,a]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"topbar",children:s.jsx("div",{className:"topbar__inner",children:s.jsxs("div",{className:"topbar__brand",children:[s.jsx(b,{}),s.jsxs("div",{className:"topbar__brand-text",children:[s.jsx("span",{className:"topbar__title",children:"Percy"}),s.jsx("span",{className:"topbar__subtitle",children:"Local Manager"})]})]})})}),s.jsx("div",{className:"topbar__accent-strip","aria-hidden":"true"}),s.jsxs("main",{className:"library-page",children:[s.jsxs("div",{className:"library-page__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"library-page__title",children:"Snapshot Library"}),s.jsx("p",{className:"library-page__description",children:"Browse snapshots captured in your Percy projects."})]}),s.jsx("input",{className:"text-input library-page__search",type:"text",placeholder:"Search snapshots...",value:r,onChange:e=>d(e.target.value)})]}),s.jsxs("div",{className:"library-page__scroll",children:[o&&s.jsx("p",{className:"field-label",children:"Loading library..."}),l&&s.jsx("p",{className:"message message--error",children:l}),!o&&!l&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"field-label",children:[m.length," of ",a.length," ","snapshot",a.length===1?"":"s"]}),m.length===0?s.jsx("div",{className:"library-page__empty",children:"No snapshots found."}):s.jsx("div",{className:"library-grid",children:m.map(e=>{const n=e.comparisons[0];return s.jsxs("button",{type:"button",className:"library-grid__item",onClick:()=>i(e),children:[n?.previewUrl?s.jsx("img",{className:"library-grid__preview",src:n.previewUrl,alt:e.name}):s.jsx("div",{className:"library-grid__preview library-grid__preview--empty"}),s.jsx("span",{className:"library-grid__name",children:e.name}),s.jsxs("span",{className:"library-grid__meta",children:[e.comparisons.length," ","comparison",e.comparisons.length===1?"":"s"]})]},`${e.buildId}-${e.id}`)})})]})]}),c&&s.jsx(y,{snapshot:c,onClose:()=>i(null)})]})]})}N.createRoot(document.getElementById("root")).render(s.jsx(v.StrictMode,{children:s.jsx(f,{})})); +import{r as l,j as s,R as b,a as g}from"./client.js";import{d as N,B as v}from"./BrandMark.js";/* empty css */import"./constants.js";function y({snapshot:a,onClose:p}){const r=a.comparisons??[],d=l.useMemo(()=>Array.from(new Set(r.map(e=>e.width))).sort((e,n)=>e-n),[r]),[o,u]=l.useState(d.length>0?d[0]:null),t=o===null?[]:r.filter(e=>e.width===o),[_,c]=l.useState(0),i=t[_]??t[0];function m(e){u(e),c(0)}function x(){t.length<=1||c(e=>e===0?t.length-1:e-1)}function h(){t.length<=1||c(e=>e===t.length-1?0:e+1)}return s.jsx("div",{className:"snapshot-modal",role:"dialog","aria-modal":"true","aria-labelledby":"snapshot-modal-title",onMouseDown:e=>{e.target===e.currentTarget&&p()},children:s.jsxs("div",{className:"snapshot-modal__content",children:[s.jsxs("header",{className:"snapshot-modal__header",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"snapshot-modal-title",className:"snapshot-modal__title",children:a.name}),s.jsxs("p",{className:"snapshot-modal__build",children:["Build ",a.buildId]})]}),s.jsx("button",{type:"button",className:"snapshot-modal__close",onClick:p,"aria-label":"Close",children:"×"})]}),s.jsxs("div",{className:"snapshot-modal__details",children:[s.jsxs("div",{className:"snapshot-modal__detail",children:[s.jsx("span",{className:"snapshot-modal__detail-label",children:"JavaScript"}),s.jsx("span",{className:"snapshot-modal__detail-value",children:a.enableJavaScript?"Enabled":"Disabled"})]}),s.jsxs("div",{className:"snapshot-modal__detail",children:[s.jsx("span",{className:"snapshot-modal__detail-label",children:"Comparisons"}),s.jsx("span",{className:"snapshot-modal__detail-value",children:r.length})]})]}),d.length>0&&s.jsxs("div",{className:"snapshot-modal__width-section",children:[s.jsx("span",{className:"snapshot-modal__section-label",children:"Width"}),s.jsx("div",{className:"snapshot-modal__widths",children:d.map(e=>s.jsxs("button",{type:"button",className:`snapshot-modal__width ${o===e?"snapshot-modal__width--active":""}`,onClick:()=>m(e),children:[e,"px"]},e))})]}),i?s.jsxs("div",{className:"snapshot-modal__preview-section",children:[s.jsxs("div",{className:"snapshot-modal__comparison-info",children:[s.jsxs("div",{children:[s.jsxs("strong",{children:[i.width,"px"]}),s.jsxs("span",{children:[" ","× ",i.height,"px"]})]}),t.length>1&&s.jsxs("span",{children:[_+1," /"," ",t.length]})]}),s.jsx("div",{className:"snapshot-modal__image-container",children:i.previewUrl?s.jsx("img",{className:"snapshot-modal__image",src:i.previewUrl,alt:`${a.name} ${i.width}px`}):s.jsx("div",{className:"snapshot-modal__no-image",children:"No screenshot available."})}),t.length>1&&s.jsxs("div",{className:"snapshot-modal__navigation",children:[s.jsx("button",{type:"button",className:"button button--secondary",onClick:x,children:"← Previous"}),s.jsx("button",{type:"button",className:"button button--secondary",onClick:h,children:"Next →"})]})]}):s.jsx("div",{className:"snapshot-modal__empty",children:"No comparison data available."})]})})}function f(){const[a,p]=l.useState([]),[r,d]=l.useState(""),[o,u]=l.useState(!0),[t,_]=l.useState(null),[c,i]=l.useState(null),[m,x]=l.useState(null);l.useEffect(()=>{const e=new URLSearchParams(window.location.search),n=e.get("search"),j=e.get("snapshotId");n&&d(n),j&&(window.history.replaceState({},"",window.location.pathname),x(j))},[]),l.useEffect(()=>{N().then(p).catch(e=>_(e instanceof Error?e.message:"Failed to load library")).finally(()=>u(!1))},[]);const h=l.useMemo(()=>{const e=r.trim().toLowerCase();return e===""?a:a.filter(n=>n.name.toLowerCase().includes(e))},[a,r]);return l.useEffect(()=>{if(!m||o||a.length===0)return;const e=a.find(n=>n.id===m);e&&i(e),x(null)},[m,o,a]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"topbar",children:s.jsx("div",{className:"topbar__inner",children:s.jsxs("div",{className:"topbar__brand",children:[s.jsx(v,{}),s.jsxs("div",{className:"topbar__brand-text",children:[s.jsx("span",{className:"topbar__title",children:"Percy"}),s.jsx("span",{className:"topbar__subtitle",children:"Chrome Extension"})]})]})})}),s.jsx("div",{className:"topbar__accent-strip","aria-hidden":"true"}),s.jsxs("main",{className:"library-page",children:[s.jsxs("div",{className:"library-page__header",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"library-page__title",children:"Snapshot Library"}),s.jsx("p",{className:"library-page__description",children:"Browse snapshots captured in your Percy projects."})]}),s.jsx("input",{className:"text-input library-page__search",type:"text",placeholder:"Search snapshots...",value:r,onChange:e=>d(e.target.value)})]}),s.jsxs("div",{className:"library-page__scroll",children:[o&&s.jsx("p",{className:"field-label",children:"Loading library..."}),t&&s.jsx("p",{className:"message message--error",children:t}),!o&&!t&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"field-label",children:[h.length," of ",a.length," ","snapshot",a.length===1?"":"s"]}),h.length===0?s.jsx("div",{className:"library-page__empty",children:"No snapshots found."}):s.jsx("div",{className:"library-grid",children:h.map(e=>{const n=e.comparisons[0];return s.jsxs("button",{type:"button",className:"library-grid__item",onClick:()=>i(e),children:[n?.previewUrl?s.jsx("img",{className:"library-grid__preview",src:n.previewUrl,alt:e.name}):s.jsx("div",{className:"library-grid__preview library-grid__preview--empty"}),s.jsx("span",{className:"library-grid__name",children:e.name}),s.jsxs("span",{className:"library-grid__meta",children:[e.comparisons.length," ","comparison",e.comparisons.length===1?"":"s"]})]},`${e.buildId}-${e.id}`)})})]})]}),c&&s.jsx(y,{snapshot:c,onClose:()=>i(null)})]})]})}b.createRoot(document.getElementById("root")).render(s.jsx(g.StrictMode,{children:s.jsx(f,{})})); diff --git a/Distributables/percy-local-manager-extension/manifest.json b/Distributables/percy-local-manager-extension/manifest.json index 7fffe4b..245ae71 100644 --- a/Distributables/percy-local-manager-extension/manifest.json +++ b/Distributables/percy-local-manager-extension/manifest.json @@ -1,11 +1,11 @@ { "manifest_version": 3, - "name": "Percy Local Manager", + "name": "Percy Chrome Extension", "version": "1.0.0", - "description": "Capture browser state (DOM, URL, viewport) and send it to the local Percy Local Manager backend.", + "description": "Capture browser snapshots and record workflows for Percy visual testing.", "action": { "default_popup": "index.html", - "default_title": "Percy Local Manager", + "default_title": "Percy Chrome Extension", "default_icon": "icons/percy-icon.png" }, "background": { diff --git a/Distributables/percy-local-manager-extension/popup.js b/Distributables/percy-local-manager-extension/popup.js index 8e0d10f..5dd91ad 100644 --- a/Distributables/percy-local-manager-extension/popup.js +++ b/Distributables/percy-local-manager-extension/popup.js @@ -1 +1 @@ -import{r as c,c as W,g as I,j as e,a as F,s as U,b as A,B as $,R as B,d as q}from"./BrandMark.js";/* empty css */import{H as D}from"./constants.js";import{w as J,m as O,s as Q,R as V,u as Y}from"./RecordedSteps.js";function G(){const[s,a]=c.useState("checking"),t=c.useRef(!0);return c.useEffect(()=>{t.current=!0;async function o(){const r=await W();t.current&&a(r?"connected":"offline")}o();const n=setInterval(o,D);return()=>{t.current=!1,clearInterval(n)}},[]),s}function K(){const[s,a]=c.useState(0),[t,o]=c.useState(!0),n=c.useCallback(async()=>{o(!0);try{const r=await I();a(r.length)}catch{}finally{o(!1)}},[]);return c.useEffect(()=>{n()},[n]),{count:s,isLoading:t,refresh:n}}const Z={checking:"Checking…",connected:"Connected",offline:"Offline"};function z({status:s}){return e.jsxs("div",{className:`connection-status connection-status--${s}`,children:[e.jsx("span",{className:"connection-status__dot","aria-hidden":"true"}),e.jsx("span",{children:Z[s]})]})}function X({count:s,isLoading:a}){return e.jsxs("div",{className:"queue-count",children:[e.jsx("span",{className:"queue-count__label",children:"Queued Snapshots"}),e.jsx("span",{className:"queue-count__value",children:a?"—":s})]})}function ee(){return{url:window.location.href,dom:document.documentElement.outerHTML,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,title:document.title}}async function te(){const[s]=await chrome.tabs.query({active:!0,currentWindow:!0});if(!s?.id)throw new Error("No active tab found to capture.");const[a]=await chrome.scripting.executeScript({target:{tabId:s.id},func:ee});if(!a?.result)throw new Error("Failed to capture page state from the active tab.");const{url:t,dom:o,viewportWidth:n,viewportHeight:r,title:i}=a.result;return{url:t,dom:o,viewportWidth:n,viewportHeight:r,title:i}}function se(s,a){const t=s?.trim();if(t)return t;try{const{hostname:o,pathname:n}=new URL(a);return`${o}${n}`}catch{return"Untitled snapshot"}}function ae(s){const[a,t]=c.useState("idle"),[o,n]=c.useState(null),r=c.useCallback(async(d,h)=>{t("loading"),n(null);try{const l=await te(),b=d?.trim()||se(l.title,l.url);await F({name:b,url:l.url,dom:l.dom,widths:h?.widths??[375,1280],minHeight:h?.minHeight??1024,enableJavaScript:h?.enableJavaScript??!1,percyCSS:h?.percyCSS?.trim()||void 0,scope:h?.scope?.trim()||void 0}),t("success"),s?.()}catch(l){t("error"),n(l instanceof Error?l.message:"Failed to capture snapshot.")}},[s]),i=c.useCallback(()=>{t("idle"),n(null)},[]);return{status:a,error:o,capture:r,reset:i}}const ne=300,re=2;function ce(s){const[a,t]=c.useState([]),[o,n]=c.useState(!1),r=c.useRef(0);return c.useEffect(()=>{const i=s.trim();if(i.length{try{const l=await U(i);d===r.current&&t(l)}catch{d===r.current&&t([])}finally{d===r.current&&n(!1)}},ne);return()=>clearTimeout(h)},[s]),{results:a,isSearching:o}}function oe(s){const a=new URLSearchParams;a.set("search",s.name),a.set("snapshotId",s.id),chrome.tabs.create({url:chrome.runtime.getURL(`library.html?${a.toString()}`)})}function ie({results:s,isSearching:a}){return a?e.jsx("p",{className:"field-label",children:"Searching library..."}):s.length===0?null:e.jsxs("div",{className:"library-matches",children:[e.jsxs("span",{className:"field-label",children:["Existing snapshot",s.length>1?"s":""," found"]}),s.map(t=>{const o=t.comparisons[0];return e.jsxs("button",{className:"library-match",type:"button",onClick:()=>oe(t),children:[o?.previewUrl?e.jsx("img",{className:"library-match__preview",src:o.previewUrl,alt:t.name}):e.jsx("div",{className:"library-match__preview library-match__preview--empty"}),e.jsxs("div",{className:"library-match__meta",children:[e.jsx("span",{className:"library-match__name",children:t.name}),e.jsxs("span",{className:"library-match__test",children:[t.comparisons.length," ","comparison",t.comparisons.length===1?"":"s"]})]})]},`${t.buildId}-${t.id}`)})]})}function le({disabled:s,onCaptured:a}){const[t,o]=c.useState(""),[n,r]=c.useState(!1),[i,d]=c.useState([375,1280]),[h,l]=c.useState(1024),[b,g]=c.useState(!1),[x,j]=c.useState(""),[v,y]=c.useState(""),{results:p,isSearching:C}=ce(t),{status:N,error:_,capture:E}=ae(a),m=N==="loading";function R(){d(u=>[...u,1280])}function L(u,f){const S=Number(f);d(k=>k.map((M,H)=>H===u?S:M))}function T(u){d(f=>f.filter((S,k)=>k!==u))}async function P(){await E(t,{widths:i,minHeight:h,enableJavaScript:b,percyCSS:x,scope:v})}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Capture"}),e.jsx("label",{className:"field-label",htmlFor:"snapshot-name",children:"Snapshot name (optional)"}),e.jsx("input",{id:"snapshot-name",className:"text-input",type:"text",placeholder:"Defaults to page title",value:t,onChange:u=>o(u.target.value),disabled:s||m}),e.jsx(ie,{results:p,isSearching:C}),e.jsxs("button",{type:"button",className:"advanced-toggle",onClick:()=>r(u=>!u),disabled:s||m,children:[e.jsx("span",{children:n?"▾":"▸"}),"Advanced snapshot options"]}),n&&e.jsxs("div",{className:"advanced-options",children:[e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",children:"Widths"}),e.jsx("div",{className:"width-list",children:i.map((u,f)=>e.jsxs("div",{className:"width-row",children:[e.jsx("input",{className:"text-input",type:"number",min:1,value:u,onChange:S=>L(f,S.target.value),disabled:m}),e.jsx("button",{type:"button",className:"width-remove",onClick:()=>T(f),disabled:m||i.length<=1,children:"×"})]},f))}),e.jsx("button",{type:"button",className:"button button--link",onClick:R,disabled:m,children:"+ Add width"})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"snapshot-min-height",children:"Minimum height"}),e.jsx("input",{id:"snapshot-min-height",className:"text-input",type:"number",min:0,value:h,onChange:u=>l(Number(u.target.value)),disabled:m})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"snapshot-scope",children:"Scope"}),e.jsx("input",{id:"snapshot-scope",className:"text-input",type:"text",placeholder:".main-content",value:v,onChange:u=>y(u.target.value),disabled:m})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:b,onChange:u=>g(u.target.checked),disabled:m}),e.jsx("span",{children:"Enable JavaScript"})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"percy-css",children:"Percy CSS"}),e.jsx("textarea",{id:"percy-css",className:"text-input textarea-input",placeholder:".modal { display: none; }",value:x,onChange:u=>j(u.target.value),disabled:m,rows:4})]})]}),e.jsx("button",{className:"button button--primary button--block",onClick:P,disabled:s||m||i.length===0||i.some(u=>u<=0),children:m?"Capturing…":e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M4 8a2 2 0 0 1 2-2h1.2a1 1 0 0 0 .83-.45l.94-1.4A1 1 0 0 1 9.8 3.5h4.4a1 1 0 0 1 .83.45l.94 1.4a1 1 0 0 0 .83.45H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8Z",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("circle",{cx:"12",cy:"12.5",r:"3.4",stroke:"currentColor",strokeWidth:"1.6"})]}),"Capture Snapshot"]})}),N==="success"&&e.jsx("p",{className:"message message--success",children:"✓ Snapshot saved"}),N==="error"&&e.jsx("p",{className:"message message--error",children:_})]})}function de(s,a){const[t,o]=c.useState(!1);return c.useEffect(()=>{if(a)return;if(s){o(!1);return}let n=!1;return J().then(async r=>{n||r||(o(!0),await O())}),()=>{n=!0}},[s,a]),t}function ue({hasToken:s,onClose:a}){const[t,o]=c.useState(""),[n,r]=c.useState("idle"),[i,d]=c.useState(null);async function h(){const l=t.trim();if(l!==""){r("saving"),d(null),await Q(l);try{await A(l),r("success"),d("Token saved.")}catch(b){r("error"),d(`Saved locally, but the backend could not be updated: ${b instanceof Error?b.message:"backend offline"}. Start the backend server and save again.`)}o("")}}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Percy Token"}),e.jsx("label",{className:"field-label",htmlFor:"percy-token",children:s?"A token is saved. Enter a new one to replace it.":"Percy full access token"}),e.jsx("input",{id:"percy-token",className:"text-input",type:"password",autoComplete:"off",placeholder:s?"••••••••":"Enter Percy token",value:t,onChange:l=>o(l.target.value),disabled:n==="saving"}),e.jsx("button",{type:"button",className:"button button--secondary button--block",onClick:h,disabled:n==="saving"||t.trim()==="",children:n==="saving"?"Saving...":s?"Update Token":"Save Token"}),i&&e.jsx("p",{className:`message ${n==="error"?"message--error":"message--success"}`,children:i}),e.jsx("button",{type:"button",className:"button button--link",onClick:a,children:"← Back"})]})}const w={active:!1,steps:[]};async function he(s){const a=await chrome.runtime.sendMessage(s);if(a?.error)throw new Error(a.error);return a??w}function pe(){const[s,a]=c.useState(w),[t,o]=c.useState(null),n=c.useCallback(async r=>{try{o(null),a(await he(r))}catch(i){o(i instanceof Error?i.message:String(i))}},[]);return c.useEffect(()=>{n({kind:"rec:get"});const r=(i,d)=>{d==="session"&&i.recordingState&&a(i.recordingState.newValue??w)};return chrome.storage.onChanged.addListener(r),()=>chrome.storage.onChanged.removeListener(r)},[n]),{state:s,error:t,start:async()=>{await n({kind:"rec:start"})},stop:()=>n({kind:"rec:stop"}),clear:()=>n({kind:"rec:clear"}),addSnapshot:r=>n({kind:"rec:snapshot",name:r}),setSteps:async r=>{await chrome.storage.session.set({recordingState:{...s,steps:r}})}}}function me({disabled:s}){const a=pe(),{state:t}=a,o=!t.active&&t.steps.length>0,n=t.steps.some(p=>p.type==="snapshot"),[r,i]=c.useState(""),[d,h]=c.useState(!1),[l,b]=c.useState(null),[g,x]=c.useState(null);async function j(){await a.start(),(await chrome.runtime.sendMessage({kind:"rec:get"}))?.active&&window.close()}async function v(){h(!0),b(null);try{const p=await chrome.runtime.sendMessage({kind:"rec:save",name:r});if(p?.error)throw new Error(p.error);x(p?.name??r),i("")}catch(p){b(p instanceof Error?p.message:String(p))}finally{h(!1)}}function y(p){a.setSteps(p)}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Workflow"}),t.active?e.jsx("p",{className:"field-help",role:"status",children:"Recording in progress. Use the floating panel on the page."}):o?e.jsxs(e.Fragment,{children:[e.jsx(V,{steps:t.steps,editable:!0,onChange:y}),!n&&e.jsx("p",{className:"field-help",children:"Add at least one Capture Snapshot checkpoint to save."}),e.jsx("label",{className:"field-label",htmlFor:"workflow-name-input",children:"Workflow name"}),e.jsx("input",{id:"workflow-name-input",className:"text-input",value:r,onChange:p=>i(p.target.value)}),e.jsxs("div",{className:"panel__actions",children:[e.jsx("button",{type:"button",className:"button button--primary button--block",onClick:v,disabled:d||!n,children:d?"Saving…":"Save Workflow"}),e.jsx("button",{type:"button",className:"button button--link button--block",onClick:()=>{a.clear()},disabled:d,children:"Discard"})]}),l&&e.jsx("p",{className:"message message--error",children:l})]}):null,g&&e.jsx("p",{className:"message message--success",role:"status",children:`✓ Saved "${g}"`}),!o&&!t.active&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"button button--primary button--block",onClick:j,disabled:s,children:"Record Workflow"}),e.jsx("p",{className:"field-help",children:"Replay saved workflows from the Snapshots page."})]}),a.error&&e.jsx("p",{className:"message message--error",children:a.error})]})}function be(){const s=G(),a=K(),t=s==="offline",{hasToken:o,isLoading:n}=Y(),[r,i]=c.useState(!1),d=de(o,n),h=!n&&!o;return e.jsxs("main",{className:"popup",children:[e.jsxs("header",{className:"popup__header",children:[e.jsxs("div",{className:"popup__brand",children:[e.jsx($,{}),e.jsxs("div",{className:"popup__brand-text",children:[e.jsx("span",{className:"popup__title",children:"Percy"}),e.jsx("span",{className:"popup__subtitle",children:"Local Manager"})]})]}),e.jsxs("div",{className:"popup__header-actions",children:[e.jsx(z,{status:s}),e.jsxs("div",{className:"tooltip-anchor",children:[e.jsx("button",{type:"button",className:`icon-button${h?" icon-button--attention":""}${d?" icon-button--pulse":""}`,"aria-label":h?"Set project token":"Token settings","aria-describedby":h?"token-tooltip":void 0,"aria-expanded":r,onClick:()=>i(l=>!l),children:"⚙"}),h&&e.jsx("span",{id:"token-tooltip",className:"tooltip-bubble",role:"tooltip",children:"Set project token"})]})]})]}),e.jsx("div",{className:"popup__accent-strip","aria-hidden":"true"}),r?e.jsx("div",{className:"popup__body",children:e.jsx(ue,{hasToken:o,onClose:()=>i(!1)})}):e.jsxs("div",{className:"popup__body",children:[t&&e.jsxs("div",{className:"offline-notice",role:"alert",children:[e.jsx("strong",{children:"Backend server is offline."}),e.jsxs("span",{children:["Start the backend server (run the ",e.jsx("code",{children:"server"})," script from the Percy distributable for your OS), then reopen this popup or wait for it to reconnect."]})]}),e.jsx(X,{count:a.count,isLoading:a.isLoading}),e.jsx(le,{disabled:t,onCaptured:a.refresh}),e.jsx(me,{disabled:t}),e.jsx("button",{className:"button button--secondary button--block",onClick:()=>chrome.tabs.create({url:chrome.runtime.getURL("snapshots.html")}),disabled:t,children:"View Snapshots"})]})]})}B.createRoot(document.getElementById("root")).render(e.jsx(q.StrictMode,{children:e.jsx(be,{})})); +import{r as c,j as e,R as W,a as I}from"./client.js";/* empty css */import{c as U,g as F,a as A,s as $,b as B,B as q}from"./BrandMark.js";import{H as D}from"./constants.js";import{w as J,m as O,s as Q,R as V,u as Y}from"./RecordedSteps.js";function G(){const[s,a]=c.useState("checking"),t=c.useRef(!0);return c.useEffect(()=>{t.current=!0;async function o(){const r=await U();t.current&&a(r?"connected":"offline")}o();const n=setInterval(o,D);return()=>{t.current=!1,clearInterval(n)}},[]),s}function K(){const[s,a]=c.useState(0),[t,o]=c.useState(!0),n=c.useCallback(async()=>{o(!0);try{const r=await F();a(r.length)}catch{}finally{o(!1)}},[]);return c.useEffect(()=>{n()},[n]),{count:s,isLoading:t,refresh:n}}const Z={checking:"Checking…",connected:"Connected",offline:"Offline"};function z({status:s}){return e.jsxs("div",{className:`connection-status connection-status--${s}`,children:[e.jsx("span",{className:"connection-status__dot","aria-hidden":"true"}),e.jsx("span",{children:Z[s]})]})}function X({count:s,isLoading:a}){return e.jsxs("div",{className:"queue-count",children:[e.jsx("span",{className:"queue-count__label",children:"Queued Snapshots"}),e.jsx("span",{className:"queue-count__value",children:a?"—":s})]})}function ee(){return{url:window.location.href,dom:document.documentElement.outerHTML,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,title:document.title}}async function te(){const[s]=await chrome.tabs.query({active:!0,currentWindow:!0});if(!s?.id)throw new Error("No active tab found to capture.");const[a]=await chrome.scripting.executeScript({target:{tabId:s.id},func:ee});if(!a?.result)throw new Error("Failed to capture page state from the active tab.");const{url:t,dom:o,viewportWidth:n,viewportHeight:r,title:i}=a.result;return{url:t,dom:o,viewportWidth:n,viewportHeight:r,title:i}}function se(s,a){const t=s?.trim();if(t)return t;try{const{hostname:o,pathname:n}=new URL(a);return`${o}${n}`}catch{return"Untitled snapshot"}}function ae(s){const[a,t]=c.useState("idle"),[o,n]=c.useState(null),r=c.useCallback(async(u,h)=>{t("loading"),n(null);try{const l=await te(),b=u?.trim()||se(l.title,l.url);await A({name:b,url:l.url,dom:l.dom,widths:h?.widths??[375,1280],minHeight:h?.minHeight??1024,enableJavaScript:h?.enableJavaScript??!1,percyCSS:h?.percyCSS?.trim()||void 0,scope:h?.scope?.trim()||void 0}),t("success"),s?.()}catch(l){t("error"),n(l instanceof Error?l.message:"Failed to capture snapshot.")}},[s]),i=c.useCallback(()=>{t("idle"),n(null)},[]);return{status:a,error:o,capture:r,reset:i}}const ne=300,re=2;function ce(s){const[a,t]=c.useState([]),[o,n]=c.useState(!1),r=c.useRef(0);return c.useEffect(()=>{const i=s.trim();if(i.length{try{const l=await $(i);u===r.current&&t(l)}catch{u===r.current&&t([])}finally{u===r.current&&n(!1)}},ne);return()=>clearTimeout(h)},[s]),{results:a,isSearching:o}}function oe(s){const a=new URLSearchParams;a.set("search",s.name),a.set("snapshotId",s.id),chrome.tabs.create({url:chrome.runtime.getURL(`library.html?${a.toString()}`)})}function ie({results:s,isSearching:a}){return a?e.jsx("p",{className:"field-label",children:"Searching library..."}):s.length===0?null:e.jsxs("div",{className:"library-matches",children:[e.jsxs("span",{className:"field-label",children:["Existing snapshot",s.length>1?"s":""," found"]}),s.map(t=>{const o=t.comparisons[0];return e.jsxs("button",{className:"library-match",type:"button",onClick:()=>oe(t),children:[o?.previewUrl?e.jsx("img",{className:"library-match__preview",src:o.previewUrl,alt:t.name}):e.jsx("div",{className:"library-match__preview library-match__preview--empty"}),e.jsxs("div",{className:"library-match__meta",children:[e.jsx("span",{className:"library-match__name",children:t.name}),e.jsxs("span",{className:"library-match__test",children:[t.comparisons.length," ","comparison",t.comparisons.length===1?"":"s"]})]})]},`${t.buildId}-${t.id}`)})]})}function le({disabled:s,onCaptured:a}){const[t,o]=c.useState(""),[n,r]=c.useState(!1),[i,u]=c.useState([375,1280]),[h,l]=c.useState(1024),[b,g]=c.useState(!1),[x,j]=c.useState(""),[v,N]=c.useState(""),{results:p,isSearching:C}=ce(t),{status:y,error:_,capture:E}=ae(a),m=y==="loading";function R(){u(d=>[...d,1280])}function L(d,f){const S=Number(f);u(k=>k.map((H,M)=>M===d?S:H))}function T(d){u(f=>f.filter((S,k)=>k!==d))}async function P(){await E(t,{widths:i,minHeight:h,enableJavaScript:b,percyCSS:x,scope:v})}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Capture"}),e.jsx("label",{className:"field-label",htmlFor:"snapshot-name",children:"Snapshot name (optional)"}),e.jsx("input",{id:"snapshot-name",className:"text-input",type:"text",placeholder:"Defaults to page title",value:t,onChange:d=>o(d.target.value),disabled:s||m}),e.jsx(ie,{results:p,isSearching:C}),e.jsxs("button",{type:"button",className:"advanced-toggle",onClick:()=>r(d=>!d),disabled:s||m,children:[e.jsx("span",{children:n?"▾":"▸"}),"Advanced snapshot options"]}),n&&e.jsxs("div",{className:"advanced-options",children:[e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",children:"Widths"}),e.jsx("div",{className:"width-list",children:i.map((d,f)=>e.jsxs("div",{className:"width-row",children:[e.jsx("input",{className:"text-input",type:"number",min:1,value:d,onChange:S=>L(f,S.target.value),disabled:m}),e.jsx("button",{type:"button",className:"width-remove",onClick:()=>T(f),disabled:m||i.length<=1,children:"×"})]},f))}),e.jsx("button",{type:"button",className:"button button--link",onClick:R,disabled:m,children:"+ Add width"})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"snapshot-min-height",children:"Minimum height"}),e.jsx("input",{id:"snapshot-min-height",className:"text-input",type:"number",min:0,value:h,onChange:d=>l(Number(d.target.value)),disabled:m})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"snapshot-scope",children:"Scope"}),e.jsx("input",{id:"snapshot-scope",className:"text-input",type:"text",placeholder:".main-content",value:v,onChange:d=>N(d.target.value),disabled:m})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:b,onChange:d=>g(d.target.checked),disabled:m}),e.jsx("span",{children:"Enable JavaScript"})]}),e.jsxs("div",{className:"advanced-field",children:[e.jsx("label",{className:"field-label",htmlFor:"percy-css",children:"Percy CSS"}),e.jsx("textarea",{id:"percy-css",className:"text-input textarea-input",placeholder:".modal { display: none; }",value:x,onChange:d=>j(d.target.value),disabled:m,rows:4})]})]}),e.jsx("button",{className:"button button--primary button--block",onClick:P,disabled:s||m||i.length===0||i.some(d=>d<=0),children:m?"Capturing…":e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M4 8a2 2 0 0 1 2-2h1.2a1 1 0 0 0 .83-.45l.94-1.4A1 1 0 0 1 9.8 3.5h4.4a1 1 0 0 1 .83.45l.94 1.4a1 1 0 0 0 .83.45H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8Z",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("circle",{cx:"12",cy:"12.5",r:"3.4",stroke:"currentColor",strokeWidth:"1.6"})]}),"Capture Snapshot"]})}),y==="success"&&e.jsx("p",{className:"message message--success",children:"✓ Snapshot saved"}),y==="error"&&e.jsx("p",{className:"message message--error",children:_})]})}function ue(s,a){const[t,o]=c.useState(!1);return c.useEffect(()=>{if(a)return;if(s){o(!1);return}let n=!1;return J().then(async r=>{n||r||(o(!0),await O())}),()=>{n=!0}},[s,a]),t}function de({hasToken:s,onClose:a}){const[t,o]=c.useState(""),[n,r]=c.useState("idle"),[i,u]=c.useState(null);async function h(){const l=t.trim();if(l!==""){r("saving"),u(null),await Q(l);try{await B(l),r("success"),u("Token saved.")}catch(b){r("error"),u(`Saved locally, but the backend could not be updated: ${b instanceof Error?b.message:"backend offline"}. Start the backend server and save again.`)}o("")}}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Percy Token"}),e.jsx("label",{className:"field-label",htmlFor:"percy-token",children:s?"A token is saved. Enter a new one to replace it.":"Percy full access token"}),e.jsx("input",{id:"percy-token",className:"text-input",type:"password",autoComplete:"off",placeholder:s?"••••••••":"Enter Percy token",value:t,onChange:l=>o(l.target.value),disabled:n==="saving"}),e.jsx("button",{type:"button",className:"button button--secondary button--block",onClick:h,disabled:n==="saving"||t.trim()==="",children:n==="saving"?"Saving...":s?"Update Token":"Save Token"}),i&&e.jsx("p",{className:`message ${n==="error"?"message--error":"message--success"}`,children:i}),e.jsx("button",{type:"button",className:"button button--link",onClick:a,children:"← Back"})]})}const w={active:!1,steps:[]};async function he(s){const a=await chrome.runtime.sendMessage(s);if(a?.error)throw new Error(a.error);return a??w}function pe(){const[s,a]=c.useState(w),[t,o]=c.useState(null),n=c.useCallback(async r=>{try{o(null),a(await he(r))}catch(i){o(i instanceof Error?i.message:String(i))}},[]);return c.useEffect(()=>{n({kind:"rec:get"});const r=(i,u)=>{u==="session"&&i.recordingState&&a(i.recordingState.newValue??w)};return chrome.storage.onChanged.addListener(r),()=>chrome.storage.onChanged.removeListener(r)},[n]),{state:s,error:t,start:async()=>{await n({kind:"rec:start"})},stop:()=>n({kind:"rec:stop"}),clear:()=>n({kind:"rec:clear"}),addSnapshot:r=>n({kind:"rec:snapshot",name:r}),setSteps:async r=>{await chrome.storage.session.set({recordingState:{...s,steps:r}})}}}function me({disabled:s}){const a=pe(),{state:t}=a,o=!t.active&&t.steps.length>0,n=t.steps.some(p=>p.type==="snapshot"),[r,i]=c.useState(""),[u,h]=c.useState(!1),[l,b]=c.useState(null),[g,x]=c.useState(null);async function j(){await a.start(),(await chrome.runtime.sendMessage({kind:"rec:get"}))?.active&&window.close()}async function v(){h(!0),b(null);try{const p=await chrome.runtime.sendMessage({kind:"rec:save",name:r});if(p?.error)throw new Error(p.error);x(p?.name??r),i("")}catch(p){b(p instanceof Error?p.message:String(p))}finally{h(!1)}}function N(p){a.setSteps(p)}return e.jsxs("div",{className:"panel",children:[e.jsx("span",{className:"panel__eyebrow",children:"Workflow"}),t.active?e.jsx("p",{className:"field-help",role:"status",children:"Recording in progress. Use the floating panel on the page."}):o?e.jsxs(e.Fragment,{children:[e.jsx(V,{steps:t.steps,editable:!0,onChange:N}),!n&&e.jsx("p",{className:"field-help",children:"Add at least one Capture Snapshot checkpoint to save."}),e.jsx("label",{className:"field-label",htmlFor:"workflow-name-input",children:"Workflow name"}),e.jsx("input",{id:"workflow-name-input",className:"text-input",value:r,onChange:p=>i(p.target.value)}),e.jsxs("div",{className:"panel__actions",children:[e.jsx("button",{type:"button",className:"button button--primary button--block",onClick:v,disabled:u||!n,children:u?"Saving…":"Save Workflow"}),e.jsx("button",{type:"button",className:"button button--link button--block",onClick:()=>{a.clear()},disabled:u,children:"Discard"})]}),l&&e.jsx("p",{className:"message message--error",children:l})]}):null,g&&e.jsx("p",{className:"message message--success",role:"status",children:`✓ Saved "${g}"`}),!o&&!t.active&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"button button--primary button--block",onClick:j,disabled:s,children:"Record Workflow"}),e.jsx("p",{className:"field-help",children:"Replay saved workflows from the Snapshots page."})]}),a.error&&e.jsx("p",{className:"message message--error",children:a.error})]})}function be(){const s=G(),a=K(),t=s==="offline",{hasToken:o,isLoading:n}=Y(),[r,i]=c.useState(!1),u=ue(o,n),h=!n&&!o;return e.jsxs("main",{className:"popup",children:[e.jsxs("header",{className:"popup__header",children:[e.jsxs("div",{className:"popup__brand",children:[e.jsx(q,{}),e.jsxs("div",{className:"popup__brand-text",children:[e.jsx("span",{className:"popup__title",children:"Percy"}),e.jsx("span",{className:"popup__subtitle",children:"Chrome Extension"})]})]}),e.jsxs("div",{className:"popup__header-actions",children:[e.jsx(z,{status:s}),e.jsxs("div",{className:"tooltip-anchor",children:[e.jsx("button",{type:"button",className:`icon-button${h?" icon-button--attention":""}${u?" icon-button--pulse":""}`,"aria-label":h?"Set project token":"Token settings","aria-describedby":h?"token-tooltip":void 0,"aria-expanded":r,onClick:()=>i(l=>!l),children:"⚙"}),h&&e.jsx("span",{id:"token-tooltip",className:"tooltip-bubble",role:"tooltip",children:"Set project token"})]})]})]}),e.jsx("div",{className:"popup__accent-strip","aria-hidden":"true"}),r?e.jsx("div",{className:"popup__body",children:e.jsx(de,{hasToken:o,onClose:()=>i(!1)})}):e.jsxs("div",{className:"popup__body",children:[t&&e.jsxs("div",{className:"offline-notice",role:"alert",children:[e.jsx("strong",{children:"Backend server is offline."}),e.jsxs("span",{children:["Start the backend server (run the ",e.jsx("code",{children:"server"})," script from the Percy distributable for your OS), then reopen this popup or wait for it to reconnect."]})]}),e.jsx(X,{count:a.count,isLoading:a.isLoading}),e.jsx(le,{disabled:t,onCaptured:a.refresh}),e.jsx(me,{disabled:t}),e.jsx("button",{className:"button button--secondary button--block",onClick:()=>chrome.tabs.create({url:chrome.runtime.getURL("snapshots.html")}),disabled:t,children:"View Snapshots"}),e.jsx("button",{className:"button button--link button--block",onClick:()=>chrome.tabs.create({url:chrome.runtime.getURL("help.html")}),children:"Setup & Troubleshooting"})]})]})}W.createRoot(document.getElementById("root")).render(e.jsx(I.StrictMode,{children:e.jsx(be,{})})); diff --git a/Distributables/percy-local-manager-extension/recorderCore.js b/Distributables/percy-local-manager-extension/recorderCore.js index 2505b0f..b9a6734 100644 --- a/Distributables/percy-local-manager-extension/recorderCore.js +++ b/Distributables/percy-local-manager-extension/recorderCore.js @@ -1 +1 @@ -import{E as e}from"./constants.js";async function i(t){if(!t.ok){let n=t.statusText;try{const a=await t.json();a?.error&&(n=a.error)}catch{}throw new Error(n||`Backend request failed (${t.status})`)}return await t.json()}async function l(){const t=await i(await fetch(e.WORKFLOWS));return Array.isArray(t)?t:[]}async function f(t){return i(await fetch(e.WORKFLOWS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}))}async function y(t,n){return i(await fetch(`${e.WORKFLOWS}/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}))}async function h(t,n,a,o,r){return i(await fetch(`${e.WORKFLOWS}/${encodeURIComponent(t)}/runs`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":a},body:JSON.stringify({token:n,secrets:o,branch:r?.branch,targetBranch:r?.targetBranch})}))}async function p(t){return i(await fetch(`${e.BUILDS}/${encodeURIComponent(t)}`))}async function g(){const t=await i(await fetch(e.BUILDS));return Array.isArray(t)?t:[]}async function w(t){const n=await fetch(`${e.BUILDS}/${encodeURIComponent(t)}/artifacts/logs/runner.log`);if(n.status===404)return"";if(!n.ok)throw new Error(`Could not load logs (${n.status})`);return n.text()}async function S(t){await i(await fetch(`${e.BUILDS}/${encodeURIComponent(t)}/cancel`,{method:"POST"}))}function s(t){return`step_${String(t+1).padStart(3,"0")}`}function u(t,n){const a=t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,50)||"checkpoint";let o=a,r=2;for(;n.includes(o);)o=`${a}_${r++}`;return o}function m(t,n){const a=t[t.length-1];return a&&n.type==="fill"&&a.type==="fill"&&JSON.stringify(a.target)===JSON.stringify(n.target)?[...t.slice(0,-1),{...n,id:a.id}]:a&&n.type==="scroll"&&a.type==="scroll"?[...t.slice(0,-1),{...n,id:a.id}]:[...t,{...n,id:s(t.length)}]}function O(t,n,a={}){const o=t.filter(c=>c.type==="snapshot").map(c=>c.checkpointId??""),r={id:s(t.length),type:"snapshot",checkpointId:u(n,o),name:n.trim()||"Snapshot",waitMs:a.waitMs??4e3};return a.options&&Object.keys(a.options).length>0&&(r.options=a.options),[...t,r]}function $(t){return t.map((n,a)=>({...n,id:s(a)}))}export{g as a,w as b,S as c,m as d,O as e,f,p as g,l,$ as r,h as s,y as u}; +import{E as e}from"./constants.js";async function i(t){if(!t.ok){let n=t.statusText;try{const a=await t.json();a?.error&&(n=a.error)}catch{}throw new Error(n||`Backend request failed (${t.status})`)}return await t.json()}async function d(){const t=await i(await fetch(e.WORKFLOWS));return Array.isArray(t)?t:[]}async function l(t){return i(await fetch(e.WORKFLOWS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}))}async function y(t,n){return i(await fetch(`${e.WORKFLOWS}/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}))}async function h(t,n,a,o,r){return i(await fetch(`${e.WORKFLOWS}/${encodeURIComponent(t)}/runs`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":a},body:JSON.stringify({token:n,secrets:o,branch:r?.branch,targetBranch:r?.targetBranch})}))}async function p(t){return i(await fetch(`${e.BUILDS}/${encodeURIComponent(t)}`))}async function g(){const t=await i(await fetch(e.BUILDS));return Array.isArray(t)?t:[]}async function w(t){const n=await fetch(`${e.BUILDS}/${encodeURIComponent(t)}/artifacts/logs/runner.log`);if(n.status===404)return"";if(!n.ok)throw new Error(`Could not load logs (${n.status})`);return n.text()}async function S(t){await i(await fetch(`${e.BUILDS}/${encodeURIComponent(t)}/cancel`,{method:"POST"}))}function s(t){return`step_${String(t+1).padStart(3,"0")}`}function u(t,n){const a=t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,50)||"checkpoint";let o=a,r=2;for(;n.includes(o);)o=`${a}_${r++}`;return o}function O(t,n){const a=t[t.length-1];return a&&n.type==="fill"&&a.type==="fill"&&JSON.stringify(a.target)===JSON.stringify(n.target)?[...t.slice(0,-1),{...n,id:a.id}]:a&&n.type==="hover"&&a.type==="hover"&&JSON.stringify(a.target)===JSON.stringify(n.target)?t:a&&n.type==="scroll"&&a.type==="scroll"?[...t.slice(0,-1),{...n,id:a.id}]:[...t,{...n,id:s(t.length)}]}function m(t,n,a={}){const o=t.filter(c=>c.type==="snapshot").map(c=>c.checkpointId??""),r={id:s(t.length),type:"snapshot",checkpointId:u(n,o),name:n.trim()||"Snapshot",waitMs:a.waitMs??4e3};return a.options&&Object.keys(a.options).length>0&&(r.options=a.options),[...t,r]}function $(t){return t.map((n,a)=>({...n,id:s(a)}))}export{g as a,w as b,S as c,O as d,m as e,l as f,p as g,d as l,$ as r,h as s,y as u}; diff --git a/Distributables/percy-local-manager-extension/snapshots.html b/Distributables/percy-local-manager-extension/snapshots.html index da57a92..e76af82 100644 --- a/Distributables/percy-local-manager-extension/snapshots.html +++ b/Distributables/percy-local-manager-extension/snapshots.html @@ -6,8 +6,9 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> - Percy Snapshots + Percy Chrome Extension | Snapshots + diff --git a/Distributables/percy-local-manager-extension/snapshots.js b/Distributables/percy-local-manager-extension/snapshots.js index 10fcb58..84b61c3 100644 --- a/Distributables/percy-local-manager-extension/snapshots.js +++ b/Distributables/percy-local-manager-extension/snapshots.js @@ -1,4 +1,4 @@ -import{j as e,f as re,r as a,h as z,i as ie,k as oe,u as ce,B as de,g as ue,l as he,R as pe,d as me}from"./BrandMark.js";import{E as ge}from"./constants.js";import{R as be,u as xe}from"./RecordedSteps.js";import{s as fe,c as je,g as Ne,l as _e,a as ye,b as we,u as ve,r as Se}from"./recorderCore.js";function ke({snapshot:s,onDelete:l,onEdit:r,deleting:c=!1}){const u=s.widths.length>0?s.widths.join(", "):"Default",h=!!s.scope||!!s.percyCSS||s.enableJavaScript;return e.jsxs("tr",{className:"snapshot-row",children:[e.jsx("td",{className:"snapshot-row__name",children:e.jsxs("div",{className:"snapshot-row__name-content",children:[e.jsx("span",{children:s.name}),s.enableJavaScript&&e.jsx("span",{className:"snapshot-row__badge snapshot-row__badge--js",children:"JS"})]})}),e.jsx("td",{className:"snapshot-row__url",title:s.url,children:s.url}),e.jsx("td",{className:"snapshot-row__widths",children:u}),e.jsxs("td",{className:"snapshot-row__height",children:[s.minHeight,"px"]}),e.jsx("td",{className:"snapshot-row__options",children:h?e.jsxs("div",{className:"snapshot-row__options-list",children:[s.scope&&e.jsx("span",{className:"snapshot-row__option",title:`Scope: ${s.scope}`,children:"Scope"}),s.percyCSS&&e.jsx("span",{className:"snapshot-row__option",title:"Custom Percy CSS",children:"CSS"}),s.enableJavaScript&&e.jsx("span",{className:"snapshot-row__option",children:"JavaScript"})]}):e.jsx("span",{className:"snapshot-row__no-options",children:"—"})}),e.jsxs("td",{className:"snapshot-row__actions",children:[r&&e.jsx("button",{type:"button",className:"snapshot-row__edit",onClick:()=>r(s),disabled:c,children:"Edit"}),l&&s.id&&e.jsx("button",{type:"button",className:"snapshot-row__delete",onClick:()=>l(s.id),disabled:c,title:"Delete snapshot",children:c?"Deleting…":"Delete"})]})]})}var Ce=re();const B="percyBranchSettings",T="percy-local-manager",Z="",Q={branch:T,targetBranch:Z};function M(s){const l=s??{},r=typeof l.branch=="string"?l.branch.trim():"",c=typeof l.targetBranch=="string"?l.targetBranch.trim():"";return{branch:r===""?T:r,targetBranch:c}}function Ee(s){const l=M(s);return l.branch===T&&l.targetBranch===Z}async function H(){const s=await chrome.storage.local.get(B);return M(s[B])}async function Be(s){await chrome.storage.local.set({[B]:M(s)})}async function Re(){await chrome.storage.local.remove(B)}const A=1e3;function Ie(s){const[l,r]=a.useState(null),c=a.useRef(s);c.current=s;const u=a.useRef(!1),h=a.useRef(null),d=()=>{h.current&&(clearTimeout(h.current),h.current=null)},i=a.useCallback(n=>{u.current||(r(n),(n.status==="success"||n.status==="failed")&&c.current?.(n))},[]),o=a.useCallback(async()=>{d();try{const n=await z();return i(n),n.status==="running"&&(h.current=setTimeout(o,A)),n}catch{return u.current||(h.current=setTimeout(o,A*2)),null}},[i]),p=a.useRef(null),f=a.useCallback(()=>{if(p.current&&(p.current.close(),p.current=null),typeof EventSource>"u")return;const n=new EventSource(ge.BUILD_STREAM);p.current=n,n.onmessage=N=>{try{const g=JSON.parse(N.data);i(g),(g.status==="success"||g.status==="failed")&&(n.close(),p.current=null)}catch{}},n.onerror=()=>{n.close(),p.current=null,u.current||(h.current=setTimeout(o,A))}},[i,o]),m=a.useCallback(async()=>{d(),p.current&&(p.current.close(),p.current=null);let n=null;try{n=await z(),n&&i(n)}catch{}return typeof EventSource<"u"?f():n?.status==="running"&&(h.current=setTimeout(o,A)),n},[i,f,o]);return a.useEffect(()=>(u.current=!1,z().then(n=>{u.current||n.status==="running"&&(r(n),f())}).catch(()=>{}),()=>{u.current=!0,d(),p.current&&(p.current.close(),p.current=null)}),[f]),{build:l,refresh:m}}function Te(s){const[l,r]=a.useState("idle"),[c,u]=a.useState(null),[h,d]=a.useState(null),{build:i,refresh:o}=Ie(m=>{m.status==="success"?(d({buildId:m.buildId??"",buildUrl:m.buildUrl??""}),r("success"),s?.()):(u(m.error??"Build failed."),r("error"))}),p=a.useCallback(async m=>{r("loading"),u(null),d(null);try{await ie(m,await H()),await o()}catch(n){r("error"),u(n instanceof Error?n.message:"Failed to finalize build.")}},[o]),f=a.useCallback(()=>{r("idle"),u(null),d(null)},[]);return{status:l,error:c,result:h,build:i,finalize:p,reset:f}}const Y=[{key:"installing",label:"Install"},{key:"starting",label:"Start"},{key:"uploading",label:"Upload"},{key:"processing",label:"Process"},{key:"done",label:"Done"}],Le={pending:"Waiting",sending:"Uploading",sent:"Sent",failed:"Failed"},Pe={pending:"",sending:"",sent:"✓",failed:"✕"};function Fe({build:s}){const[l,r]=a.useState(!1),[c,u]=a.useState(!1),h=a.useRef(null),d=Y.findIndex(n=>n.key===s.phase),i=s.status==="failed",o=s.status==="success",p=s.total>0?Math.round(s.sent/s.total*100):0,f=s.logs.filter(n=>n.level==="error").length;a.useEffect(()=>{l&&h.current?.scrollIntoView({block:"end"})},[s.logs.length,l]);async function m(){const n=s.logs.map(N=>`${N.ts} [${N.level}] ${N.line}`).join(` -`);try{await navigator.clipboard.writeText(n),u(!0),setTimeout(()=>u(!1),1500)}catch{u(!1)}}return e.jsxs("section",{className:`build-card${i?" build-card--failed":""}${o?" build-card--success":""}`,"aria-label":"Build progress",children:[e.jsx("ol",{className:"build-stepper",children:Y.map((n,N)=>{let g="todo";return o||Ne.jsxs("li",{className:`build-snapshot build-snapshot--${n.state}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true",children:Pe[n.state]}),e.jsxs("div",{className:"build-snapshot__main",children:[e.jsx("span",{className:"build-snapshot__name",title:n.name,children:n.name}),n.error&&e.jsx("span",{className:"build-snapshot__error",children:n.error})]}),e.jsx("span",{className:"build-snapshot__state",children:Le[n.state]})]},n.id))}),e.jsxs("div",{className:"build-logs",children:[e.jsxs("div",{className:"build-logs__bar",children:[e.jsxs("button",{type:"button",className:"build-logs__toggle","aria-expanded":l,onClick:()=>r(n=>!n),children:[e.jsx("span",{className:"build-logs__chevron",children:l?"▾":"▸"}),"Logs",e.jsx("span",{className:"build-logs__count",children:s.logs.length}),f>0&&e.jsxs("span",{className:"build-logs__count build-logs__count--error",children:[f," error",f>1?"s":""]})]}),e.jsx("button",{type:"button",className:"build-logs__copy",onClick:m,disabled:s.logs.length===0,children:c?"Copied ✓":"Copy logs"})]}),l&&e.jsxs("div",{className:"build-logs__body",role:"log",children:[s.logs.length===0&&e.jsx("div",{className:"build-log build-log--empty",children:"No output yet…"}),s.logs.map((n,N)=>e.jsxs("div",{className:`build-log build-log--${n.level}`,children:[e.jsx("span",{className:"build-log__tag",children:n.level==="error"?"ERR":n.level==="warn"?"WRN":"INF"}),e.jsx("span",{className:"build-log__text",children:n.line})]},N)),e.jsx("div",{ref:h})]})]})]})}function $e(){const[s,l]=a.useState(Q),[r,c]=a.useState(!0);a.useEffect(()=>{let d=!1;H().then(o=>{d||l(o)}).finally(()=>{d||c(!1)});function i(o,p){p==="local"&&o[B]&&l(M(o[B].newValue))}return chrome.storage.onChanged.addListener(i),()=>{d=!0,chrome.storage.onChanged.removeListener(i)}},[]);const u=a.useCallback(d=>{l(d),Be(d)},[]),h=a.useCallback(()=>{l(Q),Re()},[]);return{settings:s,isLoading:r,isDefault:Ee(s),update:u,reset:h}}function ee({disabled:s}){const{settings:l,isDefault:r,update:c,reset:u}=$e(),h=a.useId(),d=`${h}-branch`,i=`${h}-target`;return e.jsxs("div",{className:"branch-settings","aria-label":"Percy branch settings",children:[e.jsxs("div",{className:"branch-settings__header",children:[e.jsx("span",{className:"branch-settings__title",children:"Build branches"}),e.jsx("span",{className:`branch-settings__badge${r?"":" branch-settings__badge--changed"}`,children:r?"Default":"Changed"}),!r&&e.jsx("button",{type:"button",className:"button button--link",onClick:u,disabled:s,children:"Reset to default"})]}),e.jsxs("div",{className:"branch-settings__field",children:[e.jsx("label",{htmlFor:d,children:"Branch"}),e.jsx("input",{id:d,className:"input",type:"text",autoComplete:"off",spellCheck:!1,placeholder:T,value:l.branch,disabled:s,onChange:o=>c({...l,branch:o.target.value})}),e.jsxs("span",{className:"snapshot-edit-help",children:["Name of the branch this build is created on. Default:"," ",e.jsx("code",{children:T}),". Use e.g. ",e.jsx("code",{children:"production"})," to create a baseline."]})]}),e.jsxs("div",{className:"branch-settings__field",children:[e.jsx("label",{htmlFor:i,children:"Target branch"}),e.jsx("input",{id:i,className:"input",type:"text",autoComplete:"off",spellCheck:!1,placeholder:"None (Percy's default)",value:l.targetBranch,disabled:s,onChange:o=>c({...l,targetBranch:o.target.value})}),e.jsxs("span",{className:"snapshot-edit-help",children:["Branch whose latest build is used as the baseline for comparison. Leave empty to use Percy's normal base-build selection. Example: build ",e.jsx("code",{children:"production"})," first, then build ",e.jsx("code",{children:"staging"})," ","with target ",e.jsx("code",{children:"production"})," to compare two URLs."]})]})]})}function De({token:s,disabled:l,onFinalized:r,progressHost:c}){const{status:u,error:h,result:d,build:i,finalize:o}=Te(r),p=u==="loading"||i?.status==="running",f=i&&i.status!=="idle"?e.jsx(Fe,{build:i}):null;function m(){d?.buildUrl&&chrome.tabs.create({url:d.buildUrl})}return e.jsxs("div",{className:"finalize-build",children:[e.jsx(ee,{disabled:p}),e.jsxs("div",{className:"finalize-build__actions",children:[e.jsx("button",{className:"button button--primary",onClick:()=>o(s),disabled:l||p||s.trim()==="",children:p?"Finalizing Build…":"Finalize Build"}),u==="success"&&d&&e.jsxs("div",{className:"finalize-result",children:[e.jsx("p",{className:"message message--success",children:"✓ Build finished"}),e.jsx("button",{className:"button button--link",onClick:m,children:"Open Percy Build →"})]}),u==="error"&&!f&&e.jsx("p",{className:"message message--error",children:h})]}),f&&(c?Ce.createPortal(f,c):f)]})}function Ae({disabled:s,onCleared:l}){async function r(){try{await oe(),l()}catch(c){console.error(c),alert("Failed to clear snapshots")}}return e.jsxs("button",{className:"button button--danger",onClick:r,disabled:s,children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M5 7h14M10 7V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2m-7 0 1 12a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2l1-12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})}),"Clear Snapshots"]})}function Ue({snapshot:s,onClose:l,onSaved:r}){const[c,u]=a.useState(s.name),[h,d]=a.useState(s.widths.join(", ")),[i,o]=a.useState(String(s.minHeight)),[p,f]=a.useState(s.scope??""),[m,n]=a.useState(s.percyCSS??""),[N,g]=a.useState(s.enableJavaScript),[b,_]=a.useState(!1),[y,j]=a.useState(null);async function L(){if(!s.id){j("Snapshot ID is missing.");return}j(null);const w=c.trim();if(!w){j("Snapshot name is required.");return}const S=h.split(",").map(k=>Number(k.trim())).filter(k=>Number.isFinite(k)&&k>0);if(S.length===0){j("At least one valid width is required.");return}const E=Number(i);if(!Number.isFinite(E)||E<0){j("Minimum height must be a valid number.");return}_(!0);try{const k=await ce(s.id,{name:w,widths:S,minHeight:E,scope:p.trim()||void 0,percyCSS:m.trim()||void 0,enableJavaScript:N});r(k),l()}catch(k){j(k instanceof Error?k.message:"Failed to update snapshot.")}finally{_(!1)}}return e.jsx("div",{className:"snapshot-edit-overlay",onMouseDown:w=>{w.target===w.currentTarget&&!b&&l()},children:e.jsxs("div",{className:"snapshot-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":"edit-snapshot-title",children:[e.jsxs("div",{className:"snapshot-edit-panel__header",children:[e.jsxs("div",{children:[e.jsx("span",{className:"snapshot-edit-panel__eyebrow",children:"Snapshot"}),e.jsx("h2",{id:"edit-snapshot-title",children:"Edit Snapshot"}),e.jsx("p",{children:"Update the Percy options for this snapshot."})]}),e.jsx("button",{type:"button",className:"snapshot-edit-panel__close",onClick:l,disabled:b,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-name",children:"Name"}),e.jsx("input",{id:"edit-snapshot-name",className:"input",type:"text",value:c,onChange:w=>u(w.target.value),disabled:b})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-widths",children:"Widths"}),e.jsx("input",{id:"edit-snapshot-widths",className:"input",type:"text",value:h,onChange:w=>d(w.target.value),placeholder:"375, 768, 1280",disabled:b}),e.jsx("span",{className:"snapshot-edit-help",children:"Comma-separated widths in pixels."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-height",children:"Minimum Height"}),e.jsx("input",{id:"edit-snapshot-height",className:"input",type:"number",min:"0",value:i,onChange:w=>o(w.target.value),disabled:b}),e.jsx("span",{className:"snapshot-edit-help",children:"Minimum height in pixels."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-scope",children:"Scope"}),e.jsx("input",{id:"edit-snapshot-scope",className:"input",type:"text",value:p,onChange:w=>f(w.target.value),placeholder:".main-content",disabled:b}),e.jsx("span",{className:"snapshot-edit-help",children:"Optional CSS selector to capture only a specific element."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-css",children:"Percy CSS"}),e.jsx("textarea",{id:"edit-snapshot-css",className:"input snapshot-edit-panel__textarea",value:m,onChange:w=>n(w.target.value),placeholder:`body { +import{j as e,b as re,r as a,R as ie,a as oe}from"./client.js";import{e as z,f as ce,h as de,u as ue,B as he,g as pe,i as me}from"./BrandMark.js";import{E as be}from"./constants.js";import{R as ge,u as xe}from"./RecordedSteps.js";import{s as fe,c as je,g as Ne,l as _e,a as ye,b as we,u as ve,r as Se}from"./recorderCore.js";function ke({snapshot:s,onDelete:l,onEdit:r,deleting:c=!1}){const u=s.widths.length>0?s.widths.join(", "):"Default",h=!!s.scope||!!s.percyCSS||s.enableJavaScript;return e.jsxs("tr",{className:"snapshot-row",children:[e.jsx("td",{className:"snapshot-row__name",children:e.jsxs("div",{className:"snapshot-row__name-content",children:[e.jsx("span",{children:s.name}),s.enableJavaScript&&e.jsx("span",{className:"snapshot-row__badge snapshot-row__badge--js",children:"JS"})]})}),e.jsx("td",{className:"snapshot-row__url",title:s.url,children:s.url}),e.jsx("td",{className:"snapshot-row__widths",children:u}),e.jsxs("td",{className:"snapshot-row__height",children:[s.minHeight,"px"]}),e.jsx("td",{className:"snapshot-row__options",children:h?e.jsxs("div",{className:"snapshot-row__options-list",children:[s.scope&&e.jsx("span",{className:"snapshot-row__option",title:`Scope: ${s.scope}`,children:"Scope"}),s.percyCSS&&e.jsx("span",{className:"snapshot-row__option",title:"Custom Percy CSS",children:"CSS"}),s.enableJavaScript&&e.jsx("span",{className:"snapshot-row__option",children:"JavaScript"})]}):e.jsx("span",{className:"snapshot-row__no-options",children:"—"})}),e.jsxs("td",{className:"snapshot-row__actions",children:[r&&e.jsx("button",{type:"button",className:"snapshot-row__edit",onClick:()=>r(s),disabled:c,children:"Edit"}),l&&s.id&&e.jsx("button",{type:"button",className:"snapshot-row__delete",onClick:()=>l(s.id),disabled:c,title:"Delete snapshot",children:c?"Deleting…":"Delete"})]})]})}var Ce=re();const B="percyBranchSettings",T="percy-local-manager",Z="",Q={branch:T,targetBranch:Z};function M(s){const l=s??{},r=typeof l.branch=="string"?l.branch.trim():"",c=typeof l.targetBranch=="string"?l.targetBranch.trim():"";return{branch:r===""?T:r,targetBranch:c}}function Ee(s){const l=M(s);return l.branch===T&&l.targetBranch===Z}async function H(){const s=await chrome.storage.local.get(B);return M(s[B])}async function Be(s){await chrome.storage.local.set({[B]:M(s)})}async function Re(){await chrome.storage.local.remove(B)}const A=1e3;function Ie(s){const[l,r]=a.useState(null),c=a.useRef(s);c.current=s;const u=a.useRef(!1),h=a.useRef(null),d=()=>{h.current&&(clearTimeout(h.current),h.current=null)},i=a.useCallback(n=>{u.current||(r(n),(n.status==="success"||n.status==="failed")&&c.current?.(n))},[]),o=a.useCallback(async()=>{d();try{const n=await z();return i(n),n.status==="running"&&(h.current=setTimeout(o,A)),n}catch{return u.current||(h.current=setTimeout(o,A*2)),null}},[i]),p=a.useRef(null),f=a.useCallback(()=>{if(p.current&&(p.current.close(),p.current=null),typeof EventSource>"u")return;const n=new EventSource(be.BUILD_STREAM);p.current=n,n.onmessage=N=>{try{const b=JSON.parse(N.data);i(b),(b.status==="success"||b.status==="failed")&&(n.close(),p.current=null)}catch{}},n.onerror=()=>{n.close(),p.current=null,u.current||(h.current=setTimeout(o,A))}},[i,o]),m=a.useCallback(async()=>{d(),p.current&&(p.current.close(),p.current=null);let n=null;try{n=await z(),n&&i(n)}catch{}return typeof EventSource<"u"?f():n?.status==="running"&&(h.current=setTimeout(o,A)),n},[i,f,o]);return a.useEffect(()=>(u.current=!1,z().then(n=>{u.current||n.status==="running"&&(r(n),f())}).catch(()=>{}),()=>{u.current=!0,d(),p.current&&(p.current.close(),p.current=null)}),[f]),{build:l,refresh:m}}function Te(s){const[l,r]=a.useState("idle"),[c,u]=a.useState(null),[h,d]=a.useState(null),{build:i,refresh:o}=Ie(m=>{m.status==="success"?(d({buildId:m.buildId??"",buildUrl:m.buildUrl??""}),r("success"),s?.()):(u(m.error??"Build failed."),r("error"))}),p=a.useCallback(async m=>{r("loading"),u(null),d(null);try{await ce(m,await H()),await o()}catch(n){r("error"),u(n instanceof Error?n.message:"Failed to finalize build.")}},[o]),f=a.useCallback(()=>{r("idle"),u(null),d(null)},[]);return{status:l,error:c,result:h,build:i,finalize:p,reset:f}}const Y=[{key:"installing",label:"Install"},{key:"starting",label:"Start"},{key:"uploading",label:"Upload"},{key:"processing",label:"Process"},{key:"done",label:"Done"}],Le={pending:"Waiting",sending:"Uploading",sent:"Sent",failed:"Failed"},Pe={pending:"",sending:"",sent:"✓",failed:"✕"};function Fe({build:s}){const[l,r]=a.useState(!1),[c,u]=a.useState(!1),h=a.useRef(null),d=Y.findIndex(n=>n.key===s.phase),i=s.status==="failed",o=s.status==="success",p=s.total>0?Math.round(s.sent/s.total*100):0,f=s.logs.filter(n=>n.level==="error").length;a.useEffect(()=>{l&&h.current?.scrollIntoView({block:"end"})},[s.logs.length,l]);async function m(){const n=s.logs.map(N=>`${N.ts} [${N.level}] ${N.line}`).join(` +`);try{await navigator.clipboard.writeText(n),u(!0),setTimeout(()=>u(!1),1500)}catch{u(!1)}}return e.jsxs("section",{className:`build-card${i?" build-card--failed":""}${o?" build-card--success":""}`,"aria-label":"Build progress",children:[e.jsx("ol",{className:"build-stepper",children:Y.map((n,N)=>{let b="todo";return o||Ne.jsxs("li",{className:`build-snapshot build-snapshot--${n.state}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true",children:Pe[n.state]}),e.jsxs("div",{className:"build-snapshot__main",children:[e.jsx("span",{className:"build-snapshot__name",title:n.name,children:n.name}),n.error&&e.jsx("span",{className:"build-snapshot__error",children:n.error})]}),e.jsx("span",{className:"build-snapshot__state",children:Le[n.state]})]},n.id))}),e.jsxs("div",{className:"build-logs",children:[e.jsxs("div",{className:"build-logs__bar",children:[e.jsxs("button",{type:"button",className:"build-logs__toggle","aria-expanded":l,onClick:()=>r(n=>!n),children:[e.jsx("span",{className:"build-logs__chevron",children:l?"▾":"▸"}),"Logs",e.jsx("span",{className:"build-logs__count",children:s.logs.length}),f>0&&e.jsxs("span",{className:"build-logs__count build-logs__count--error",children:[f," error",f>1?"s":""]})]}),e.jsx("button",{type:"button",className:"build-logs__copy",onClick:m,disabled:s.logs.length===0,children:c?"Copied ✓":"Copy logs"})]}),l&&e.jsxs("div",{className:"build-logs__body",role:"log",children:[s.logs.length===0&&e.jsx("div",{className:"build-log build-log--empty",children:"No output yet…"}),s.logs.map((n,N)=>e.jsxs("div",{className:`build-log build-log--${n.level}`,children:[e.jsx("span",{className:"build-log__tag",children:n.level==="error"?"ERR":n.level==="warn"?"WRN":"INF"}),e.jsx("span",{className:"build-log__text",children:n.line})]},N)),e.jsx("div",{ref:h})]})]})]})}function $e(){const[s,l]=a.useState(Q),[r,c]=a.useState(!0);a.useEffect(()=>{let d=!1;H().then(o=>{d||l(o)}).finally(()=>{d||c(!1)});function i(o,p){p==="local"&&o[B]&&l(M(o[B].newValue))}return chrome.storage.onChanged.addListener(i),()=>{d=!0,chrome.storage.onChanged.removeListener(i)}},[]);const u=a.useCallback(d=>{l(d),Be(d)},[]),h=a.useCallback(()=>{l(Q),Re()},[]);return{settings:s,isLoading:r,isDefault:Ee(s),update:u,reset:h}}function ee({disabled:s}){const{settings:l,isDefault:r,update:c,reset:u}=$e(),h=a.useId(),d=`${h}-branch`,i=`${h}-target`;return e.jsxs("div",{className:"branch-settings","aria-label":"Percy branch settings",children:[e.jsxs("div",{className:"branch-settings__header",children:[e.jsx("span",{className:"branch-settings__title",children:"Build branches"}),e.jsx("span",{className:`branch-settings__badge${r?"":" branch-settings__badge--changed"}`,children:r?"Default":"Changed"}),!r&&e.jsx("button",{type:"button",className:"button button--link",onClick:u,disabled:s,children:"Reset to default"})]}),e.jsxs("div",{className:"branch-settings__field",children:[e.jsx("label",{htmlFor:d,children:"Branch"}),e.jsx("input",{id:d,className:"input",type:"text",autoComplete:"off",spellCheck:!1,placeholder:T,value:l.branch,disabled:s,onChange:o=>c({...l,branch:o.target.value})}),e.jsxs("span",{className:"snapshot-edit-help",children:["Name of the branch this build is created on. Default:"," ",e.jsx("code",{children:T}),". Use e.g. ",e.jsx("code",{children:"production"})," to create a baseline."]})]}),e.jsxs("div",{className:"branch-settings__field",children:[e.jsx("label",{htmlFor:i,children:"Target branch"}),e.jsx("input",{id:i,className:"input",type:"text",autoComplete:"off",spellCheck:!1,placeholder:"None (Percy's default)",value:l.targetBranch,disabled:s,onChange:o=>c({...l,targetBranch:o.target.value})}),e.jsxs("span",{className:"snapshot-edit-help",children:["Branch whose latest build is used as the baseline for comparison. Leave empty to use Percy's normal base-build selection. Example: build ",e.jsx("code",{children:"production"})," first, then build ",e.jsx("code",{children:"staging"})," ","with target ",e.jsx("code",{children:"production"})," to compare two URLs."]})]})]})}function De({token:s,disabled:l,onFinalized:r,progressHost:c}){const{status:u,error:h,result:d,build:i,finalize:o}=Te(r),p=u==="loading"||i?.status==="running",f=i&&i.status!=="idle"?e.jsx(Fe,{build:i}):null;function m(){d?.buildUrl&&chrome.tabs.create({url:d.buildUrl})}return e.jsxs("div",{className:"finalize-build",children:[e.jsx(ee,{disabled:p}),e.jsxs("div",{className:"finalize-build__actions",children:[e.jsx("button",{className:"button button--primary",onClick:()=>o(s),disabled:l||p||s.trim()==="",children:p?"Finalizing Build…":"Finalize Build"}),u==="success"&&d&&e.jsxs("div",{className:"finalize-result",children:[e.jsx("p",{className:"message message--success",children:"✓ Build finished"}),e.jsx("button",{className:"button button--link",onClick:m,children:"Open Percy Build →"})]}),u==="error"&&!f&&e.jsx("p",{className:"message message--error",children:h})]}),f&&(c?Ce.createPortal(f,c):f)]})}function Ae({disabled:s,onCleared:l}){async function r(){try{await de(),l()}catch(c){console.error(c),alert("Failed to clear snapshots")}}return e.jsxs("button",{className:"button button--danger",onClick:r,disabled:s,children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M5 7h14M10 7V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2m-7 0 1 12a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2l1-12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})}),"Clear Snapshots"]})}function Ue({snapshot:s,onClose:l,onSaved:r}){const[c,u]=a.useState(s.name),[h,d]=a.useState(s.widths.join(", ")),[i,o]=a.useState(String(s.minHeight)),[p,f]=a.useState(s.scope??""),[m,n]=a.useState(s.percyCSS??""),[N,b]=a.useState(s.enableJavaScript),[g,_]=a.useState(!1),[y,j]=a.useState(null);async function L(){if(!s.id){j("Snapshot ID is missing.");return}j(null);const w=c.trim();if(!w){j("Snapshot name is required.");return}const S=h.split(",").map(k=>Number(k.trim())).filter(k=>Number.isFinite(k)&&k>0);if(S.length===0){j("At least one valid width is required.");return}const E=Number(i);if(!Number.isFinite(E)||E<0){j("Minimum height must be a valid number.");return}_(!0);try{const k=await ue(s.id,{name:w,widths:S,minHeight:E,scope:p.trim()||void 0,percyCSS:m.trim()||void 0,enableJavaScript:N});r(k),l()}catch(k){j(k instanceof Error?k.message:"Failed to update snapshot.")}finally{_(!1)}}return e.jsx("div",{className:"snapshot-edit-overlay",onMouseDown:w=>{w.target===w.currentTarget&&!g&&l()},children:e.jsxs("div",{className:"snapshot-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":"edit-snapshot-title",children:[e.jsxs("div",{className:"snapshot-edit-panel__header",children:[e.jsxs("div",{children:[e.jsx("span",{className:"snapshot-edit-panel__eyebrow",children:"Snapshot"}),e.jsx("h2",{id:"edit-snapshot-title",children:"Edit Snapshot"}),e.jsx("p",{children:"Update the Percy options for this snapshot."})]}),e.jsx("button",{type:"button",className:"snapshot-edit-panel__close",onClick:l,disabled:g,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-name",children:"Name"}),e.jsx("input",{id:"edit-snapshot-name",className:"input",type:"text",value:c,onChange:w=>u(w.target.value),disabled:g})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-widths",children:"Widths"}),e.jsx("input",{id:"edit-snapshot-widths",className:"input",type:"text",value:h,onChange:w=>d(w.target.value),placeholder:"375, 768, 1280",disabled:g}),e.jsx("span",{className:"snapshot-edit-help",children:"Comma-separated widths in pixels."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-height",children:"Minimum Height"}),e.jsx("input",{id:"edit-snapshot-height",className:"input",type:"number",min:"0",value:i,onChange:w=>o(w.target.value),disabled:g}),e.jsx("span",{className:"snapshot-edit-help",children:"Minimum height in pixels."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-scope",children:"Scope"}),e.jsx("input",{id:"edit-snapshot-scope",className:"input",type:"text",value:p,onChange:w=>f(w.target.value),placeholder:".main-content",disabled:g}),e.jsx("span",{className:"snapshot-edit-help",children:"Optional CSS selector to capture only a specific element."})]}),e.jsxs("div",{className:"snapshot-edit-field",children:[e.jsx("label",{htmlFor:"edit-snapshot-css",children:"Percy CSS"}),e.jsx("textarea",{id:"edit-snapshot-css",className:"input snapshot-edit-panel__textarea",value:m,onChange:w=>n(w.target.value),placeholder:`body { background: white; -}`,rows:6,disabled:b}),e.jsx("span",{className:"snapshot-edit-help",children:"CSS applied specifically to this Percy snapshot."})]}),e.jsxs("label",{className:"snapshot-edit-toggle",children:[e.jsxs("div",{className:"snapshot-edit-toggle__content",children:[e.jsx("span",{className:"snapshot-edit-toggle__title",children:"Enable JavaScript"}),e.jsx("span",{className:"snapshot-edit-toggle__description",children:"Allow JavaScript to run when Percy renders this snapshot."})]}),e.jsx("input",{type:"checkbox",checked:N,onChange:w=>g(w.target.checked),disabled:b}),e.jsx("span",{className:"snapshot-edit-toggle__switch"})]}),y&&e.jsx("p",{className:"message message--error",children:y}),e.jsxs("div",{className:"snapshot-edit-panel__actions",children:[e.jsx("button",{type:"button",className:"button button--secondary",onClick:l,disabled:b,children:"Cancel"}),e.jsx("button",{type:"button",className:"button button--primary",onClick:L,disabled:b,children:b?"Saving…":"Save Changes"})]})]})})}function Me({message:s="A Percy token is required for this action.",onOpenSettings:l}){return e.jsxs("div",{className:"token-notice",role:"alert",children:[e.jsx("span",{children:s}),l&&e.jsx("button",{type:"button",className:"button button--link",onClick:l,children:"Set token (⚙) →"})]})}const U=s=>s==="passed"||s==="failed"||s==="partial"||s==="cancelled",I="activeBuildId",Oe=1500;function We(){return`run-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ze(s,l){const[r,c]=a.useState(null),[u,h]=a.useState(null),[d,i]=a.useState(!1),o=a.useRef(void 0),p=a.useRef(null),f=a.useRef(l);f.current=l;const m=a.useCallback(()=>{window.clearTimeout(o.current),o.current=void 0},[]),n=a.useCallback(_=>{m();const y=async()=>{try{const j=await Ne(_);if(c(j),U(j.status)){await chrome.storage.session.remove(I),p.current!==_&&(p.current=_,f.current?.());return}}catch(j){h(j instanceof Error?j.message:String(j))}o.current=window.setTimeout(y,Oe)};y()},[m]);a.useEffect(()=>(chrome.storage.session.get(I).then(_=>{const y=_[I];y&&n(y)}),m),[n,m]);const N=a.useCallback(async(_,y)=>{h(null),i(!0);try{const j=await fe(_,s,We(),y,await H());await chrome.storage.session.set({[I]:j.buildId}),n(j.buildId)}catch(j){h(j instanceof Error?j.message:String(j))}finally{i(!1)}},[n,s]),g=a.useCallback(async()=>{if(r)try{await je(r.buildId)}catch(_){h(_ instanceof Error?_.message:String(_))}},[r]),b=a.useCallback(()=>{m(),c(null),chrome.storage.session.remove(I)},[m]);return{build:r,error:u,starting:d,running:r!==null&&!U(r.status),start:N,cancel:g,dismiss:b}}function He(s){const[l,r]=a.useState([]),[c,u]=a.useState(!1),[h,d]=a.useState(null),i=a.useCallback(async()=>{u(!0);try{r(await _e()),d(null)}catch(o){d(o instanceof Error?o.message:String(o))}finally{u(!1)}},[s]);return a.useEffect(()=>{i()},[i]),{workflows:l,isLoading:c,error:h,refresh:i}}const X={queued:"Queued",running:"Running",passed:"Passed",failed:"Failed",partial:"Partially completed",cancelled:"Cancelled"},Je={pending:"○",running:"◐",passed:"✓",failed:"✕",skipped:"–"};function qe(s){return[...new Set(s.steps.map(l=>l.valueRef).filter(l=>!!l))]}function Ve(s){const l=new Date(s);return Number.isNaN(l.getTime())?s:l.toLocaleString()}function Ke({token:s,hasToken:l,busy:r}){const{workflows:c,error:u,refresh:h}=He(!0),[d,i]=a.useState(null),[o,p]=a.useState(!1),[f,m]=a.useState(null),[n,N]=a.useState(0),g=ze(s,()=>N(t=>t+1)),[b,_]=a.useState(""),[y,j]=a.useState({}),[L,w]=a.useState([]),[S,E]=a.useState(null),[k,se]=a.useState(""),[J,q]=a.useState(null),V=g.build?.buildId,K=g.build?U(g.build.status):!1;a.useEffect(()=>{if(!S)return;let t=!1,C;const D=async()=>{try{const R=await we(S);if(t)return;se(R),q(null)}catch(R){t||q(R instanceof Error?R.message:String(R))}!t&&S===V&&!K&&(C=window.setTimeout(D,1500))};return D(),()=>{t=!0,window.clearTimeout(C)}},[S,V,K]),a.useEffect(()=>{let t=!1;return ye().then(C=>{t||w(C)}).catch(()=>{}),()=>{t=!0}},[n]);const v=c.find(t=>t.workflowId===b)??c[0],P=v?qe(v):[],te=P.filter(t=>!y[t]),O=d!==null,ae=l&&!r&&!!v&&!g.running&&!g.starting&&te.length===0&&!O;function W(){o||(i(null),m(null))}async function ne(){if(!(!v?.workflowId||!d)){p(!0),m(null);try{await ve(v.workflowId,{...v,steps:Se(d)}),await h(),i(null)}catch(t){m(t instanceof Error?t.message:String(t))}finally{p(!1)}}}async function le(){v?.workflowId&&(await g.start(v.workflowId,Object.fromEntries(P.map(t=>[t,y[t]]))),j({}))}const x=g.build,F=x?U(x.status):!1,G=x?x.steps.filter(t=>t.status==="passed").length:0,$=x?.errors[0];return e.jsxs("section",{className:"workflow-runs","aria-label":"Recorded workflows",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Recorded Workflows"}),e.jsx("p",{children:"Replay a recorded journey to create a new Percy build. Record one from the extension popup."})]}),e.jsxs("div",{className:"stat-pill",children:[e.jsx("span",{className:"stat-pill__value",children:c.length}),e.jsx("span",{className:"stat-pill__label",children:"Saved"})]})]}),u&&e.jsx("p",{className:"message message--error",children:u}),c.length===0&&!u&&e.jsx("div",{className:"empty-state",children:"No workflows yet. Click “Record Workflow” in the extension popup, use the floating panel on the page, and save."}),c.length>0&&!x&&e.jsxs("div",{className:"workflow-runs__card",children:[e.jsxs("div",{className:"token-section",children:[e.jsx("label",{htmlFor:"wf-select",children:"Workflow"}),e.jsx("select",{id:"wf-select",className:"input",value:v?.workflowId??"",onChange:t=>{_(t.target.value),i(null),m(null)},disabled:O,children:c.map(t=>e.jsxs("option",{value:t.workflowId,children:[t.name," (v",t.version,", ",t.steps.filter(C=>C.type==="snapshot").length," snapshots)"]},t.workflowId))}),v&&!O&&e.jsx("div",{children:e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>{i(v.steps),m(null)},children:"Edit workflow"})}),P.map(t=>e.jsxs("div",{className:"token-section",children:[e.jsx("label",{htmlFor:`wf-secret-${t}`,children:t}),e.jsx("input",{id:`wf-secret-${t}`,className:"input",type:"password",autoComplete:"off",value:y[t]??"",onChange:C=>j(D=>({...D,[t]:C.target.value}))})]},t)),P.length>0&&e.jsx("span",{className:"snapshot-edit-help",children:"Used for this run only. Never saved."})]}),e.jsx(ee,{disabled:g.starting||g.running}),!l&&e.jsx("p",{className:"message message--error",children:"A Percy token is required. Click the ⚙ icon in the extension popup to set it."}),r&&e.jsx("p",{className:"message message--error",children:"A snapshot build is being finalized. Wait for it to finish."}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"button button--primary",onClick:le,disabled:!ae,children:g.starting?"Starting…":"Replay / Create Build"})}),g.error&&e.jsx("p",{className:"message message--error",children:g.error})]}),v&&d&&e.jsx("div",{className:"snapshot-edit-overlay",onMouseDown:t=>{t.target===t.currentTarget&&W()},children:e.jsxs("div",{className:"snapshot-edit-panel workflow-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":"workflow-edit-title",children:[e.jsxs("header",{className:"snapshot-edit-panel__header",children:[e.jsxs("div",{children:[e.jsx("span",{className:"snapshot-edit-panel__eyebrow",children:"Edit workflow"}),e.jsx("h2",{id:"workflow-edit-title",children:v.name}),e.jsx("p",{children:"Reorder, edit or remove steps. Changes apply to the next replay."})]}),e.jsx("button",{type:"button",className:"snapshot-edit-panel__close","aria-label":"Close",onClick:W,disabled:o,children:"×"})]}),e.jsx("div",{className:"workflow-edit-panel__steps",children:e.jsx(be,{steps:d,editable:!0,onChange:i})}),f&&e.jsx("p",{className:"message message--error",children:f}),e.jsxs("div",{className:"snapshot-edit-panel__actions",children:[e.jsx("button",{type:"button",className:"button button--secondary",onClick:W,disabled:o,children:"Cancel"}),e.jsx("button",{type:"button",className:"button button--primary",onClick:ne,disabled:o||d.length===0,children:o?"Saving…":"Save changes"})]})]})}),x&&e.jsxs("div",{className:`build-card${x.status==="failed"?" build-card--failed":""}${x.status==="passed"?" build-card--success":""}`,children:[e.jsxs("div",{className:"build-summary",children:[e.jsxs("div",{className:"build-summary__row",children:[e.jsx("span",{className:"build-summary__count",children:X[x.status]}),e.jsxs("span",{className:"build-summary__text",children:[x.workflowName," · v",x.workflowVersion," · ",G,"/",x.steps.length," steps",!F&&x.currentStepId?` · ${x.currentStepId}`:""]})]}),e.jsx("div",{className:"build-bar",children:e.jsx("div",{className:`build-bar__fill${F?"":" build-bar__fill--live"}${x.status==="failed"?" build-bar__fill--failed":""}`,style:{width:`${x.steps.length?Math.round(G/x.steps.length*100):0}%`}})})]}),e.jsx("ul",{className:"build-snapshots","aria-label":"Steps",children:x.steps.map(t=>e.jsxs("li",{className:`build-snapshot build-snapshot--${t.status==="passed"?"sent":t.status==="failed"?"failed":t.status==="running"?"sending":"pending"}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true"}),e.jsxs("span",{className:"build-snapshot__main",children:[e.jsxs("span",{className:"build-snapshot__name",children:[Je[t.status]," ",t.stepId," · ",t.type]}),t.error&&e.jsx("span",{className:"build-snapshot__error",children:t.error})]}),e.jsx("span",{className:"build-snapshot__state",children:t.status})]},t.stepId))}),x.checkpoints.length>0&&e.jsx("ul",{className:"build-snapshots","aria-label":"Checkpoints",children:x.checkpoints.map(t=>e.jsxs("li",{className:`build-snapshot build-snapshot--${t.status==="uploaded"?"sent":t.status==="failed"?"failed":"sending"}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true"}),e.jsxs("span",{className:"build-snapshot__main",children:[e.jsx("span",{className:"build-snapshot__name",children:t.name}),t.error&&e.jsx("span",{className:"build-snapshot__error",children:t.error})]}),e.jsx("span",{className:"build-snapshot__state",children:t.status})]},t.checkpointId))}),F&&$&&x.status!=="passed"&&e.jsxs("div",{className:"build-alert",role:"alert",children:[e.jsxs("strong",{children:[$.stepId?`${$.stepId}: `:"","Run did not complete cleanly"]}),e.jsx("span",{children:$.message})]}),e.jsxs("div",{className:"workflow-runs__actions",children:[x.percyBuildUrl&&e.jsx("a",{className:"button button--link",href:x.percyBuildUrl,target:"_blank",rel:"noreferrer",children:"Open Percy build →"}),e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>E(S===x.buildId?null:x.buildId),children:S===x.buildId?"Hide logs":"View logs"}),F?e.jsx("button",{type:"button",className:"button button--secondary",onClick:g.dismiss,children:"Close"}):e.jsx("button",{type:"button",className:"button button--danger",onClick:g.cancel,children:"Cancel run"})]})]}),S&&e.jsxs("div",{className:"workflow-runs__card",children:[e.jsxs("div",{className:"workflow-runs__actions",children:[e.jsxs("strong",{children:["Run logs · ",S]}),e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>E(null),children:"Close logs"})]}),J&&e.jsx("p",{className:"message message--error",children:J}),e.jsx("pre",{className:"workflow-log","aria-label":"Run logs",children:k||"No log output yet."})]}),L.length>0&&e.jsx("div",{className:"table-wrap",children:e.jsxs("table",{className:"snapshot-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Workflow"}),e.jsx("th",{children:"Version"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Started"}),e.jsx("th",{children:"Percy"}),e.jsx("th",{children:"Logs"})]})}),e.jsx("tbody",{children:L.slice(0,10).map(t=>e.jsxs("tr",{className:"snapshot-row",children:[e.jsx("td",{className:"snapshot-row__name",children:t.workflowName}),e.jsxs("td",{children:["v",t.workflowVersion]}),e.jsx("td",{children:X[t.status]}),e.jsx("td",{className:"snapshot-row__viewport",children:Ve(t.createdAt)}),e.jsx("td",{children:t.percyBuildUrl?e.jsx("a",{href:t.percyBuildUrl,target:"_blank",rel:"noreferrer",children:"Open"}):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"button button--link",onClick:()=>E(t.buildId),children:"Logs"})})]},t.buildId))})]})})]})}function Ge(){const[s,l]=a.useState([]),[r,c]=a.useState(!0),{token:u,hasToken:h,isLoading:d}=xe(),[i,o]=a.useState(null),[p,f]=a.useState(null),[m,n]=a.useState(null);async function N(){c(!0);try{const b=await ue();l(b)}catch(b){console.error("Failed to load snapshots:",b)}finally{c(!1)}}async function g(b){o(b);try{await he(b),l(_=>_.filter(y=>y.id!==b))}catch(_){console.error("Failed to delete snapshot:",_)}finally{o(null)}}return a.useEffect(()=>{N()},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"topbar",children:e.jsx("div",{className:"topbar__inner",children:e.jsxs("div",{className:"topbar__brand",children:[e.jsx(de,{}),e.jsxs("div",{className:"topbar__brand-text",children:[e.jsx("span",{className:"topbar__title",children:"Percy"}),e.jsx("span",{className:"topbar__subtitle",children:"Local Manager"})]})]})})}),e.jsx("div",{className:"topbar__accent-strip","aria-hidden":"true"}),e.jsxs("main",{className:"snapshots-page",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Snapshot Queue"}),e.jsx("p",{children:"Review what's captured before you finalize a Percy build."})]}),e.jsxs("div",{className:"stat-pill",children:[e.jsx("span",{className:"stat-pill__value",children:r?"—":s.length}),e.jsx("span",{className:"stat-pill__label",children:"Queued"})]})]}),r&&e.jsx("div",{className:"loading-state",children:"Loading snapshots…"}),!r&&s.length===0&&e.jsx("div",{className:"empty-state",children:"No snapshots queued yet. Capture one from the extension popup to get started."}),!r&&s.length>0&&e.jsx("div",{className:"table-wrap",children:e.jsxs("table",{className:"snapshot-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Widths"}),e.jsx("th",{children:"Min Height"}),e.jsx("th",{children:"Options"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:s.map(b=>e.jsx(ke,{snapshot:b,deleting:i===b.id,onDelete:g,onEdit:f},b.id))})]})}),!d&&!h&&e.jsx(Me,{message:"A Percy token is required to finalize a build. Click the ⚙ icon in the Percy extension popup to set it."}),e.jsxs("div",{className:"page-actions",children:[e.jsx(Ae,{disabled:s.length===0,onCleared:N}),e.jsx(De,{token:u,disabled:s.length===0||!h,onFinalized:N,progressHost:m})]}),e.jsx("div",{className:"build-progress-slot",ref:n}),e.jsx(Ke,{token:u,hasToken:h,busy:!1})]}),p&&e.jsx(Ue,{snapshot:p,onClose:()=>f(null),onSaved:b=>{l(_=>_.map(y=>y.id===b.id?b:y))}})]})}pe.createRoot(document.getElementById("root")).render(e.jsx(me.StrictMode,{children:e.jsx(Ge,{})})); +}`,rows:6,disabled:g}),e.jsx("span",{className:"snapshot-edit-help",children:"CSS applied specifically to this Percy snapshot."})]}),e.jsxs("label",{className:"snapshot-edit-toggle",children:[e.jsxs("div",{className:"snapshot-edit-toggle__content",children:[e.jsx("span",{className:"snapshot-edit-toggle__title",children:"Enable JavaScript"}),e.jsx("span",{className:"snapshot-edit-toggle__description",children:"Allow JavaScript to run when Percy renders this snapshot."})]}),e.jsx("input",{type:"checkbox",checked:N,onChange:w=>b(w.target.checked),disabled:g}),e.jsx("span",{className:"snapshot-edit-toggle__switch"})]}),y&&e.jsx("p",{className:"message message--error",children:y}),e.jsxs("div",{className:"snapshot-edit-panel__actions",children:[e.jsx("button",{type:"button",className:"button button--secondary",onClick:l,disabled:g,children:"Cancel"}),e.jsx("button",{type:"button",className:"button button--primary",onClick:L,disabled:g,children:g?"Saving…":"Save Changes"})]})]})})}function Me({message:s="A Percy token is required for this action.",onOpenSettings:l}){return e.jsxs("div",{className:"token-notice",role:"alert",children:[e.jsx("span",{children:s}),l&&e.jsx("button",{type:"button",className:"button button--link",onClick:l,children:"Set token (⚙) →"})]})}const U=s=>s==="passed"||s==="failed"||s==="partial"||s==="cancelled",I="activeBuildId",Oe=1500;function We(){return`run-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ze(s,l){const[r,c]=a.useState(null),[u,h]=a.useState(null),[d,i]=a.useState(!1),o=a.useRef(void 0),p=a.useRef(null),f=a.useRef(l);f.current=l;const m=a.useCallback(()=>{window.clearTimeout(o.current),o.current=void 0},[]),n=a.useCallback(_=>{m();const y=async()=>{try{const j=await Ne(_);if(c(j),U(j.status)){await chrome.storage.session.remove(I),p.current!==_&&(p.current=_,f.current?.());return}}catch(j){h(j instanceof Error?j.message:String(j))}o.current=window.setTimeout(y,Oe)};y()},[m]);a.useEffect(()=>(chrome.storage.session.get(I).then(_=>{const y=_[I];y&&n(y)}),m),[n,m]);const N=a.useCallback(async(_,y)=>{h(null),i(!0);try{const j=await fe(_,s,We(),y,await H());await chrome.storage.session.set({[I]:j.buildId}),n(j.buildId)}catch(j){h(j instanceof Error?j.message:String(j))}finally{i(!1)}},[n,s]),b=a.useCallback(async()=>{if(r)try{await je(r.buildId)}catch(_){h(_ instanceof Error?_.message:String(_))}},[r]),g=a.useCallback(()=>{m(),c(null),chrome.storage.session.remove(I)},[m]);return{build:r,error:u,starting:d,running:r!==null&&!U(r.status),start:N,cancel:b,dismiss:g}}function He(s){const[l,r]=a.useState([]),[c,u]=a.useState(!1),[h,d]=a.useState(null),i=a.useCallback(async()=>{u(!0);try{r(await _e()),d(null)}catch(o){d(o instanceof Error?o.message:String(o))}finally{u(!1)}},[s]);return a.useEffect(()=>{i()},[i]),{workflows:l,isLoading:c,error:h,refresh:i}}const X={queued:"Queued",running:"Running",passed:"Passed",failed:"Failed",partial:"Partially completed",cancelled:"Cancelled"},Je={pending:"○",running:"◐",passed:"✓",failed:"✕",skipped:"–"};function qe(s){return[...new Set(s.steps.map(l=>l.valueRef).filter(l=>!!l))]}function Ve(s){const l=new Date(s);return Number.isNaN(l.getTime())?s:l.toLocaleString()}function Ke({token:s,hasToken:l,busy:r}){const{workflows:c,error:u,refresh:h}=He(!0),[d,i]=a.useState(null),[o,p]=a.useState(!1),[f,m]=a.useState(null),[n,N]=a.useState(0),b=ze(s,()=>N(t=>t+1)),[g,_]=a.useState(""),[y,j]=a.useState({}),[L,w]=a.useState([]),[S,E]=a.useState(null),[k,se]=a.useState(""),[J,q]=a.useState(null),V=b.build?.buildId,K=b.build?U(b.build.status):!1;a.useEffect(()=>{if(!S)return;let t=!1,C;const D=async()=>{try{const R=await we(S);if(t)return;se(R),q(null)}catch(R){t||q(R instanceof Error?R.message:String(R))}!t&&S===V&&!K&&(C=window.setTimeout(D,1500))};return D(),()=>{t=!0,window.clearTimeout(C)}},[S,V,K]),a.useEffect(()=>{let t=!1;return ye().then(C=>{t||w(C)}).catch(()=>{}),()=>{t=!0}},[n]);const v=c.find(t=>t.workflowId===g)??c[0],P=v?qe(v):[],te=P.filter(t=>!y[t]),O=d!==null,ae=l&&!r&&!!v&&!b.running&&!b.starting&&te.length===0&&!O;function W(){o||(i(null),m(null))}async function ne(){if(!(!v?.workflowId||!d)){p(!0),m(null);try{await ve(v.workflowId,{...v,steps:Se(d)}),await h(),i(null)}catch(t){m(t instanceof Error?t.message:String(t))}finally{p(!1)}}}async function le(){v?.workflowId&&(await b.start(v.workflowId,Object.fromEntries(P.map(t=>[t,y[t]]))),j({}))}const x=b.build,F=x?U(x.status):!1,G=x?x.steps.filter(t=>t.status==="passed").length:0,$=x?.errors[0];return e.jsxs("section",{className:"workflow-runs","aria-label":"Recorded workflows",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Recorded Workflows"}),e.jsx("p",{children:"Replay a recorded journey to create a new Percy build. Record one from the extension popup."})]}),e.jsxs("div",{className:"stat-pill",children:[e.jsx("span",{className:"stat-pill__value",children:c.length}),e.jsx("span",{className:"stat-pill__label",children:"Saved"})]})]}),u&&e.jsx("p",{className:"message message--error",children:u}),c.length===0&&!u&&e.jsx("div",{className:"empty-state",children:"No workflows yet. Click “Record Workflow” in the extension popup, use the floating panel on the page, and save."}),c.length>0&&!x&&e.jsxs("div",{className:"workflow-runs__card",children:[e.jsxs("div",{className:"token-section",children:[e.jsx("label",{htmlFor:"wf-select",children:"Workflow"}),e.jsx("select",{id:"wf-select",className:"input",value:v?.workflowId??"",onChange:t=>{_(t.target.value),i(null),m(null)},disabled:O,children:c.map(t=>e.jsxs("option",{value:t.workflowId,children:[t.name," (v",t.version,", ",t.steps.filter(C=>C.type==="snapshot").length," snapshots)"]},t.workflowId))}),v&&!O&&e.jsx("div",{children:e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>{i(v.steps),m(null)},children:"Edit workflow"})}),P.map(t=>e.jsxs("div",{className:"token-section",children:[e.jsx("label",{htmlFor:`wf-secret-${t}`,children:t}),e.jsx("input",{id:`wf-secret-${t}`,className:"input",type:"password",autoComplete:"off",value:y[t]??"",onChange:C=>j(D=>({...D,[t]:C.target.value}))})]},t)),P.length>0&&e.jsx("span",{className:"snapshot-edit-help",children:"Used for this run only. Never saved."})]}),e.jsx(ee,{disabled:b.starting||b.running}),!l&&e.jsx("p",{className:"message message--error",children:"A Percy token is required. Click the ⚙ icon in the extension popup to set it."}),r&&e.jsx("p",{className:"message message--error",children:"A snapshot build is being finalized. Wait for it to finish."}),e.jsx("div",{children:e.jsx("button",{type:"button",className:"button button--primary",onClick:le,disabled:!ae,children:b.starting?"Starting…":"Replay / Create Build"})}),b.error&&e.jsx("p",{className:"message message--error",children:b.error})]}),v&&d&&e.jsx("div",{className:"snapshot-edit-overlay",onMouseDown:t=>{t.target===t.currentTarget&&W()},children:e.jsxs("div",{className:"snapshot-edit-panel workflow-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":"workflow-edit-title",children:[e.jsxs("header",{className:"snapshot-edit-panel__header",children:[e.jsxs("div",{children:[e.jsx("span",{className:"snapshot-edit-panel__eyebrow",children:"Edit workflow"}),e.jsx("h2",{id:"workflow-edit-title",children:v.name}),e.jsx("p",{children:"Reorder, edit or remove steps. Changes apply to the next replay."})]}),e.jsx("button",{type:"button",className:"snapshot-edit-panel__close","aria-label":"Close",onClick:W,disabled:o,children:"×"})]}),e.jsx("div",{className:"workflow-edit-panel__steps",children:e.jsx(ge,{steps:d,editable:!0,onChange:i})}),f&&e.jsx("p",{className:"message message--error",children:f}),e.jsxs("div",{className:"snapshot-edit-panel__actions",children:[e.jsx("button",{type:"button",className:"button button--secondary",onClick:W,disabled:o,children:"Cancel"}),e.jsx("button",{type:"button",className:"button button--primary",onClick:ne,disabled:o||d.length===0,children:o?"Saving…":"Save changes"})]})]})}),x&&e.jsxs("div",{className:`build-card${x.status==="failed"?" build-card--failed":""}${x.status==="passed"?" build-card--success":""}`,children:[e.jsxs("div",{className:"build-summary",children:[e.jsxs("div",{className:"build-summary__row",children:[e.jsx("span",{className:"build-summary__count",children:X[x.status]}),e.jsxs("span",{className:"build-summary__text",children:[x.workflowName," · v",x.workflowVersion," · ",G,"/",x.steps.length," steps",!F&&x.currentStepId?` · ${x.currentStepId}`:""]})]}),e.jsx("div",{className:"build-bar",children:e.jsx("div",{className:`build-bar__fill${F?"":" build-bar__fill--live"}${x.status==="failed"?" build-bar__fill--failed":""}`,style:{width:`${x.steps.length?Math.round(G/x.steps.length*100):0}%`}})})]}),e.jsx("ul",{className:"build-snapshots","aria-label":"Steps",children:x.steps.map(t=>e.jsxs("li",{className:`build-snapshot build-snapshot--${t.status==="passed"?"sent":t.status==="failed"?"failed":t.status==="running"?"sending":"pending"}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true"}),e.jsxs("span",{className:"build-snapshot__main",children:[e.jsxs("span",{className:"build-snapshot__name",children:[Je[t.status]," ",t.stepId," · ",t.type]}),t.error&&e.jsx("span",{className:"build-snapshot__error",children:t.error})]}),e.jsx("span",{className:"build-snapshot__state",children:t.status})]},t.stepId))}),x.checkpoints.length>0&&e.jsx("ul",{className:"build-snapshots","aria-label":"Checkpoints",children:x.checkpoints.map(t=>e.jsxs("li",{className:`build-snapshot build-snapshot--${t.status==="uploaded"?"sent":t.status==="failed"?"failed":"sending"}`,children:[e.jsx("span",{className:"build-snapshot__badge","aria-hidden":"true"}),e.jsxs("span",{className:"build-snapshot__main",children:[e.jsx("span",{className:"build-snapshot__name",children:t.name}),t.error&&e.jsx("span",{className:"build-snapshot__error",children:t.error})]}),e.jsx("span",{className:"build-snapshot__state",children:t.status})]},t.checkpointId))}),F&&$&&x.status!=="passed"&&e.jsxs("div",{className:"build-alert",role:"alert",children:[e.jsxs("strong",{children:[$.stepId?`${$.stepId}: `:"","Run did not complete cleanly"]}),e.jsx("span",{children:$.message})]}),e.jsxs("div",{className:"workflow-runs__actions",children:[x.percyBuildUrl&&e.jsx("a",{className:"button button--link",href:x.percyBuildUrl,target:"_blank",rel:"noreferrer",children:"Open Percy build →"}),e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>E(S===x.buildId?null:x.buildId),children:S===x.buildId?"Hide logs":"View logs"}),F?e.jsx("button",{type:"button",className:"button button--secondary",onClick:b.dismiss,children:"Close"}):e.jsx("button",{type:"button",className:"button button--danger",onClick:b.cancel,children:"Cancel run"})]})]}),S&&e.jsxs("div",{className:"workflow-runs__card",children:[e.jsxs("div",{className:"workflow-runs__actions",children:[e.jsxs("strong",{children:["Run logs · ",S]}),e.jsx("button",{type:"button",className:"button button--secondary",onClick:()=>E(null),children:"Close logs"})]}),J&&e.jsx("p",{className:"message message--error",children:J}),e.jsx("pre",{className:"workflow-log","aria-label":"Run logs",children:k||"No log output yet."})]}),L.length>0&&e.jsx("div",{className:"table-wrap",children:e.jsxs("table",{className:"snapshot-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Workflow"}),e.jsx("th",{children:"Version"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Started"}),e.jsx("th",{children:"Percy"}),e.jsx("th",{children:"Logs"})]})}),e.jsx("tbody",{children:L.slice(0,10).map(t=>e.jsxs("tr",{className:"snapshot-row",children:[e.jsx("td",{className:"snapshot-row__name",children:t.workflowName}),e.jsxs("td",{children:["v",t.workflowVersion]}),e.jsx("td",{children:X[t.status]}),e.jsx("td",{className:"snapshot-row__viewport",children:Ve(t.createdAt)}),e.jsx("td",{children:t.percyBuildUrl?e.jsx("a",{href:t.percyBuildUrl,target:"_blank",rel:"noreferrer",children:"Open"}):"—"}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"button button--link",onClick:()=>E(t.buildId),children:"Logs"})})]},t.buildId))})]})})]})}function Ge(){const[s,l]=a.useState([]),[r,c]=a.useState(!0),{token:u,hasToken:h,isLoading:d}=xe(),[i,o]=a.useState(null),[p,f]=a.useState(null),[m,n]=a.useState(null);async function N(){c(!0);try{const g=await pe();l(g)}catch(g){console.error("Failed to load snapshots:",g)}finally{c(!1)}}async function b(g){o(g);try{await me(g),l(_=>_.filter(y=>y.id!==g))}catch(_){console.error("Failed to delete snapshot:",_)}finally{o(null)}}return a.useEffect(()=>{N()},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"topbar",children:e.jsx("div",{className:"topbar__inner",children:e.jsxs("div",{className:"topbar__brand",children:[e.jsx(he,{}),e.jsxs("div",{className:"topbar__brand-text",children:[e.jsx("span",{className:"topbar__title",children:"Percy"}),e.jsx("span",{className:"topbar__subtitle",children:"Chrome Extension"})]})]})})}),e.jsx("div",{className:"topbar__accent-strip","aria-hidden":"true"}),e.jsxs("main",{className:"snapshots-page",children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Snapshot Queue"}),e.jsx("p",{children:"Review what's captured before you finalize a Percy build."})]}),e.jsxs("div",{className:"stat-pill",children:[e.jsx("span",{className:"stat-pill__value",children:r?"—":s.length}),e.jsx("span",{className:"stat-pill__label",children:"Queued"})]})]}),r&&e.jsx("div",{className:"loading-state",children:"Loading snapshots…"}),!r&&s.length===0&&e.jsx("div",{className:"empty-state",children:"No snapshots queued yet. Capture one from the extension popup to get started."}),!r&&s.length>0&&e.jsx("div",{className:"table-wrap",children:e.jsxs("table",{className:"snapshot-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Widths"}),e.jsx("th",{children:"Min Height"}),e.jsx("th",{children:"Options"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:s.map(g=>e.jsx(ke,{snapshot:g,deleting:i===g.id,onDelete:b,onEdit:f},g.id))})]})}),!d&&!h&&e.jsx(Me,{message:"A Percy token is required to finalize a build. Click the ⚙ icon in the Percy extension popup to set it."}),e.jsxs("div",{className:"page-actions",children:[e.jsx(Ae,{disabled:s.length===0,onCleared:N}),e.jsx(De,{token:u,disabled:s.length===0||!h,onFinalized:N,progressHost:m})]}),e.jsx("div",{className:"build-progress-slot",ref:n}),e.jsx(Ke,{token:u,hasToken:h,busy:!1})]}),p&&e.jsx(Ue,{snapshot:p,onClose:()=>f(null),onSaved:g=>{l(_=>_.map(y=>y.id===g.id?g:y))}})]})}ie.createRoot(document.getElementById("root")).render(e.jsx(oe.StrictMode,{children:e.jsx(Ge,{})})); diff --git a/README.md b/README.md index a631e99..abcc14f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Percy Local Manager +# Percy Chrome Extension -A lightweight **Visual Testing Companion** that abstracts Percy server management for Manual QA Engineers. Start the server, use the Chrome extension to capture snapshots or record multi-step workflows, and finalize the build — no terminal knowledge required. +A lightweight **Visual Testing Companion** for Manual QA Engineers. Start the local backend, use the Percy Chrome Extension to capture snapshots or record multi-step workflows, and finalize the build — without writing application code or test scripts. Initial setup does require Node.js/npm and a one-time platform-specific server command. ``` Chrome Extension → HTTP (localhost:4321) → Go Backend → Percy CLI / Playwright → Percy Cloud @@ -10,7 +10,7 @@ Chrome Extension → HTTP (localhost:4321) → Go Backend → Percy CLI / Playwr ## Overview -Percy Local Manager consists of three components that work together: +Percy Chrome Extension works with the local backend and Percy services: | Component | Technology | Role | |---|---|---| @@ -351,10 +351,28 @@ The recorder captures a multi-step user journey in the browser and replays it he --- -## Setup Guides +## End-user Documentation and Downloads + +The extension includes a **Setup & Troubleshooting** guide, opened from the popup. It covers backend startup, Percy token setup, manual snapshot capture, workflow recording and replay, and common issues, with screenshots. The guide is implemented in [`HelpPage.tsx`](percy-local-manager-extension/src/help/HelpPage.tsx). + +Use the platform-specific instructions for backend installation and operation: | Platform | Guide | |---|---| | macOS | [`Distributables/percy-mac/Instructions.md`](Distributables/percy-mac/Instructions.md) | | Linux | [`Distributables/percy-linux/Instruction.md`](Distributables/percy-linux/Instruction.md) | | Windows | [`Distributables/percy-windows/Instructions.md`](Distributables/percy-windows/Instructions.md) | + +### Download packages + +Each package includes the prebuilt backend and the unpacked Chrome extension. The backend requires Node.js/npm; Go and project build tools are not required for end users. + +| Platform | Download | +|---|---| +| Linux | [percy-linux.zip](https://github.com/BrowserStackCE/Percy_chrome_ext/releases/latest/download/percy-linux.zip) | +| macOS | [percy-mac.zip](https://github.com/BrowserStackCE/Percy_chrome_ext/releases/latest/download/percy-mac.zip) | +| Windows | [percy-windows.zip](https://github.com/BrowserStackCE/Percy_chrome_ext/releases/latest/download/percy-windows.zip) | + +### Demo videos + +- [Customer demo](https://zoom.us/clips/share/KXnDSKQHRuK9aJyhg6bUsQ) diff --git a/percy-local-manager-extension/README.md b/percy-local-manager-extension/README.md index 446de72..83d4dfd 100644 --- a/percy-local-manager-extension/README.md +++ b/percy-local-manager-extension/README.md @@ -1,9 +1,9 @@ -# Percy Local Manager — Chrome Extension +# Percy Chrome Extension -A thin browser-state capture client for the Percy Local Manager Go backend. -This extension **never** talks to Percy CLI, never downloads Percy, never -handles Percy tokens, and never knows about builds beyond the opaque -`{ buildId, buildUrl }` result returned by the backend. +A browser-state capture client for the local Percy Go backend. +It captures browser state and workflows, stores the Percy token in Chrome +extension storage, and sends capture/build requests to the local backend. The +backend—not the extension—invokes Percy CLI and manages Percy build lifecycle. ``` Chrome Extension → HTTP (localhost:4321) → Go Backend → Percy CLI → Percy Cloud @@ -69,9 +69,7 @@ The extension assumes a Go backend running at `http://localhost:4321` with: - No Percy CLI invocation - No Percy binary download -- No Percy token handling - No build lifecycle logic (starting/stopping Percy, upload sequencing) -All of that is the Go backend's responsibility. The extension only captures -`document.documentElement.outerHTML`, the active tab's URL, and the viewport -size, then POSTs it — and later asks the backend to finalize. \ No newline at end of file +The extension sends the Percy token with build requests; it does not invoke or +manage Percy CLI itself. The Go backend handles build execution and upload. \ No newline at end of file diff --git a/percy-local-manager-extension/help.html b/percy-local-manager-extension/help.html new file mode 100644 index 0000000..3459af6 --- /dev/null +++ b/percy-local-manager-extension/help.html @@ -0,0 +1,12 @@ + + + + + + Documentation | Percy Chrome Extension + + +
+ + + diff --git a/percy-local-manager-extension/index.html b/percy-local-manager-extension/index.html index 2526b90..473a148 100644 --- a/percy-local-manager-extension/index.html +++ b/percy-local-manager-extension/index.html @@ -2,7 +2,7 @@ - Percy Local Manager + Percy Chrome Extension diff --git a/percy-local-manager-extension/library.html b/percy-local-manager-extension/library.html index 27fe027..56e39b5 100644 --- a/percy-local-manager-extension/library.html +++ b/percy-local-manager-extension/library.html @@ -6,7 +6,7 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> - Percy Snapshots + Percy Chrome Extension | Snapshot Library diff --git a/percy-local-manager-extension/public/help/manual-snapshot.svg b/percy-local-manager-extension/public/help/manual-snapshot.svg new file mode 100644 index 0000000..f5c1151 --- /dev/null +++ b/percy-local-manager-extension/public/help/manual-snapshot.svg @@ -0,0 +1,48 @@ + + Manual snapshot capture walkthrough + A browser page beside the Percy Chrome Extension popup. The popup shows a snapshot name, Capture Snapshot button, a queued confirmation, and a link to View Snapshots. + + + + + + + + https://your-site.example/checkout + + + + + + + Your website under test + + + + + CURRENT PAGE STATE + Checkout review + + + Place order + + + + + + Percy Chrome Extension + CAPTURE + + SNAPSHOT NAME + Checkout - review + + + Capture Snapshot + + + + Snapshot added to queue + Review snapshots, then finalize build + + View Snapshots → + diff --git a/percy-local-manager-extension/public/help/recorder-actions.svg b/percy-local-manager-extension/public/help/recorder-actions.svg new file mode 100644 index 0000000..e3c0b4a --- /dev/null +++ b/percy-local-manager-extension/public/help/recorder-actions.svg @@ -0,0 +1,57 @@ + + Interact with the page while recording + A website and the actual style of the floating Percy recorder panel show a recording with recorded click, fill and scroll steps, plus Pause and Stop controls. + + + + + + + + https://your-site.example/checkout + + + + + CHECKOUT + Contact details + + Email address + + alex@example.com + Delivery method + + Standard delivery + + + Next: review order + + + + + + + Recording · 3 steps + RECORDED ACTIONS + + + 1 + Click "Email address" + + + 2 + Fill "Email address" + + + 3 + Select "Standard delivery" + + + Pause + + + Stop + Pause while handling anything you don't + want included in the recorded journey. + ACTIONS ARE RECORDED ON THIS TAB + diff --git a/percy-local-manager-extension/public/help/recorder-replay.svg b/percy-local-manager-extension/public/help/recorder-replay.svg new file mode 100644 index 0000000..49c5c3a --- /dev/null +++ b/percy-local-manager-extension/public/help/recorder-replay.svg @@ -0,0 +1,79 @@ + + Create either type of Percy build from the Snapshots page + A mock Snapshots page shows the Snapshot Queue with queued rows and the Finalize Build action, followed below by Recorded Workflows with a saved workflow and Replay / Create Build action. Both build paths are available on this same page. + + + + + + + + Percy Chrome Extension · snapshots.html + + Snapshot Queue + Review what's captured before you finalize a Percy build. + 2 + QUEUED + + + + NAME + URL + WIDTHS + MIN HEIGHT + OPTIONS + ACTIONS + + Product listing + /products + 375, 1280 + 1024 px + JS · CSS + + Edit + Product detail + /products/item + 375, 1280 + 1024 px + JS · CSS + + Edit + + + + Clear Snapshots + BUILD BRANCHES + + Default + Branch + + percy-local-manager + Target branch + + None (Percy's default) + + Finalize Build + + + Recorded Workflows + Replay a saved journey to create a Percy build. + + WORKFLOW + + Checkout regression (v1, 2 snapshots) + + + Edit workflow + BUILD BRANCHES + + Default + Branch + + percy-local-manager + Target branch + + None (Percy's default) + + + Replay / Create Build + diff --git a/percy-local-manager-extension/public/help/recorder-save.svg b/percy-local-manager-extension/public/help/recorder-save.svg new file mode 100644 index 0000000..264b651 --- /dev/null +++ b/percy-local-manager-extension/public/help/recorder-save.svg @@ -0,0 +1,44 @@ + + Stop, review and save a workflow + The floating recorder is stopped and displays its recorded steps, including a named snapshot checkpoint, a workflow name field, and Save Workflow and Discard buttons. + + + + + + + + https://your-site.example/checkout + + + + CHECKOUT + + + + RECORDING STOPPED + Review before saving + + + + Checkpoint included + + + + + Recorded · 5 steps + + 1. Click "Email address" + + 2. Fill "Email address" + + 3. Snapshot: Checkout review (wait 4s) + WORKFLOW NAME + + Checkout regression + + Save Workflow + + Discard + At least one snapshot checkpoint is required. + diff --git a/percy-local-manager-extension/public/help/recorder-start.svg b/percy-local-manager-extension/public/help/recorder-start.svg new file mode 100644 index 0000000..61fc5e1 --- /dev/null +++ b/percy-local-manager-extension/public/help/recorder-start.svg @@ -0,0 +1,44 @@ + + Start recording a workflow + The Percy Chrome Extension popup is open beside a website. Its Workflow panel has a Record Workflow button to start capturing a user journey. + + + + + + + + https://your-site.example/account + + + + + + Your application under test + + + + START FROM THE PAGE + Open the journey's + starting state + + + + + + + Percy Chrome Extension + + CONNECTED + WORKFLOW + + + + Record Workflow + Replay saved workflows from the + Snapshots page. + + + + Click to start on this tab + diff --git a/percy-local-manager-extension/public/help/screenshots/manual-build-complete.png b/percy-local-manager-extension/public/help/screenshots/manual-build-complete.png new file mode 100644 index 0000000..237e615 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-build-complete.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/manual-capture-popup.png b/percy-local-manager-extension/public/help/screenshots/manual-capture-popup.png new file mode 100644 index 0000000..1986b7d Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-capture-popup.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/manual-capture-saved.png b/percy-local-manager-extension/public/help/screenshots/manual-capture-saved.png new file mode 100644 index 0000000..237e615 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-capture-saved.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/manual-capture-start.png b/percy-local-manager-extension/public/help/screenshots/manual-capture-start.png new file mode 100644 index 0000000..30c422a Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-capture-start.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/manual-snapshot-queue.png b/percy-local-manager-extension/public/help/screenshots/manual-snapshot-queue.png new file mode 100644 index 0000000..fc66fb4 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-snapshot-queue.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/manual-width-options.png b/percy-local-manager-extension/public/help/screenshots/manual-width-options.png new file mode 100644 index 0000000..1986b7d Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/manual-width-options.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/percy-build-review.png b/percy-local-manager-extension/public/help/screenshots/percy-build-review.png new file mode 100644 index 0000000..e9fc580 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/percy-build-review.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/percy-processing.png b/percy-local-manager-extension/public/help/screenshots/percy-processing.png new file mode 100644 index 0000000..66c5df1 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/percy-processing.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/token-saved.png b/percy-local-manager-extension/public/help/screenshots/token-saved.png new file mode 100644 index 0000000..93ec8f7 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/token-saved.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/token-settings.png b/percy-local-manager-extension/public/help/screenshots/token-settings.png new file mode 100644 index 0000000..0a9019b Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/token-settings.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-cart-state.png b/percy-local-manager-extension/public/help/screenshots/workflow-cart-state.png new file mode 100644 index 0000000..cfd3f95 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-cart-state.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-passed.png b/percy-local-manager-extension/public/help/screenshots/workflow-passed.png new file mode 100644 index 0000000..5148c4b Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-passed.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-pending.png b/percy-local-manager-extension/public/help/screenshots/workflow-pending.png new file mode 100644 index 0000000..e15590d Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-pending.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-recording-start.png b/percy-local-manager-extension/public/help/screenshots/workflow-recording-start.png new file mode 100644 index 0000000..1118165 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-recording-start.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-replay.png b/percy-local-manager-extension/public/help/screenshots/workflow-replay.png new file mode 100644 index 0000000..2686cf8 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-replay.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-run-summary.png b/percy-local-manager-extension/public/help/screenshots/workflow-run-summary.png new file mode 100644 index 0000000..b319ba4 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-run-summary.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-save.png b/percy-local-manager-extension/public/help/screenshots/workflow-save.png new file mode 100644 index 0000000..6537083 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-save.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-select.png b/percy-local-manager-extension/public/help/screenshots/workflow-select.png new file mode 100644 index 0000000..080edcb Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-select.png differ diff --git a/percy-local-manager-extension/public/help/screenshots/workflow-snapshot-home.png b/percy-local-manager-extension/public/help/screenshots/workflow-snapshot-home.png new file mode 100644 index 0000000..1db2f35 Binary files /dev/null and b/percy-local-manager-extension/public/help/screenshots/workflow-snapshot-home.png differ diff --git a/percy-local-manager-extension/public/help/token-settings.svg b/percy-local-manager-extension/public/help/token-settings.svg new file mode 100644 index 0000000..6516d00 --- /dev/null +++ b/percy-local-manager-extension/public/help/token-settings.svg @@ -0,0 +1,38 @@ + + Enter and save a Percy full access token + A Percy Chrome Extension popup settings panel shows the Percy full access token password field, Save Token button, and confirmation after saving. The token itself is hidden. + + + + + + + Percy Chrome Extension + SETTINGS + + PERCY TOKEN + Percy full access token + + •••••••••••••••••••• + + + + + Save Token + + + + Token saved. + ← Back + + + Use a full access token + + + + Required to create builds + Restricted or read-only tokens + cannot finalize or replay builds. + The token value is masked. Never + share it or include it in screenshots. + diff --git a/percy-local-manager-extension/public/help/workflow-checkpoint.svg b/percy-local-manager-extension/public/help/workflow-checkpoint.svg new file mode 100644 index 0000000..876d16d --- /dev/null +++ b/percy-local-manager-extension/public/help/workflow-checkpoint.svg @@ -0,0 +1,54 @@ + + Record a workflow snapshot checkpoint + A website with a hover menu open and the floating Percy recorder showing a snapshot checkpoint. A keyboard hint shows Command or Control plus S to capture without moving the pointer. + + + + + + + + https://your-site.example/account + + + + + ACME STORE + Shop + Account + + + Account menu + + Profile + + Order history + + + The page state you want to compare + + + Page content + + + + + Recording · 5 steps + CAPTURE CHECKPOINT + + Account menu open + + + Capture Snapshot + + + Checkpoint added to workflow + + + ⌘ / Ctrl + + + + S + CAPTURE WITHOUT + moving the pointer + diff --git a/percy-local-manager-extension/public/help/workflow-complete.svg b/percy-local-manager-extension/public/help/workflow-complete.svg new file mode 100644 index 0000000..b326b80 --- /dev/null +++ b/percy-local-manager-extension/public/help/workflow-complete.svg @@ -0,0 +1,48 @@ + + Monitor a workflow build and open it in Percy + A completed workflow build card on the Snapshots page shows passed steps and uploaded snapshot checkpoints, with controls to open the Percy build or view run logs. + + + + + + + + Percy Chrome Extension · Snapshots + + Recorded Workflows + Workflow run progress and Percy build links appear here. + + + Passed + Checkout regression · v1 · 3/3 steps + + + + + + + step-1 · navigate + passed + + + + + step-2 · click + passed + + + + + step-3 · snapshot + uploaded + + + + + Open Percy build → + + View logs + + Close + diff --git a/percy-local-manager-extension/public/manifest.json b/percy-local-manager-extension/public/manifest.json index 7fffe4b..245ae71 100644 --- a/percy-local-manager-extension/public/manifest.json +++ b/percy-local-manager-extension/public/manifest.json @@ -1,11 +1,11 @@ { "manifest_version": 3, - "name": "Percy Local Manager", + "name": "Percy Chrome Extension", "version": "1.0.0", - "description": "Capture browser state (DOM, URL, viewport) and send it to the local Percy Local Manager backend.", + "description": "Capture browser snapshots and record workflows for Percy visual testing.", "action": { "default_popup": "index.html", - "default_title": "Percy Local Manager", + "default_title": "Percy Chrome Extension", "default_icon": "icons/percy-icon.png" }, "background": { diff --git a/percy-local-manager-extension/snapshots.html b/percy-local-manager-extension/snapshots.html index 5a3abf6..3dd60a0 100644 --- a/percy-local-manager-extension/snapshots.html +++ b/percy-local-manager-extension/snapshots.html @@ -6,7 +6,7 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> - Percy Snapshots + Percy Chrome Extension | Snapshots diff --git a/percy-local-manager-extension/src/components/CaptureSnapshotPanel.tsx b/percy-local-manager-extension/src/components/CaptureSnapshotPanel.tsx index 8b86aef..44dffe1 100644 --- a/percy-local-manager-extension/src/components/CaptureSnapshotPanel.tsx +++ b/percy-local-manager-extension/src/components/CaptureSnapshotPanel.tsx @@ -16,12 +16,9 @@ export function CaptureSnapshotPanel({ const [showAdvanced, setShowAdvanced] = useState(false); - const [widths, setWidths] = useState([ - 375, - 1280, - ]); + const [widths, setWidths] = useState([1028, 360]); - const [minHeight, setMinHeight] = useState(1024); + const [minHeight, setMinHeight] = useState(0); const [enableJavaScript, setEnableJavaScript] = useState(false); @@ -116,7 +113,7 @@ export function CaptureSnapshotPanel({
@@ -145,10 +142,7 @@ export function CaptureSnapshotPanel({ onClick={() => removeWidth(index) } - disabled={ - isCapturing || - widths.length <= 1 - } + disabled={isCapturing} > × @@ -160,7 +154,7 @@ export function CaptureSnapshotPanel({ type="button" className="button button--link" onClick={addWidth} - disabled={isCapturing} + disabled={isCapturing || widths.length >= 10} > + Add width @@ -171,7 +165,7 @@ export function CaptureSnapshotPanel({ className="field-label" htmlFor="snapshot-min-height" > - Minimum height + Minimum height (0 = active tab height) width <= 0) } > diff --git a/percy-local-manager-extension/src/help/HelpPage.tsx b/percy-local-manager-extension/src/help/HelpPage.tsx new file mode 100644 index 0000000..1ca16f5 --- /dev/null +++ b/percy-local-manager-extension/src/help/HelpPage.tsx @@ -0,0 +1,567 @@ +import { useEffect, useMemo, useState, type ReactNode } from 'react'; + +const setupCards = [ + { + title: 'macOS', + steps: [ + <>Open Terminal in the supplied percy-mac folder., + <>Install Node.js and npm if needed. Go is not required for the prebuilt server., + <>chmod +x server server-arm64 server.sh, + <>xattr -d com.apple.quarantine server server-arm64 only if macOS blocks the downloaded binaries., + <>./server.sh start, + ], + }, + { + title: 'Linux', + steps: [ + <>Open a terminal in the supplied percy-linux folder., + <>Install Node.js and npm if needed. Go is not required for the prebuilt server., + <>chmod +x server server.sh, + <>./server.sh start, + ], + }, + { + title: 'Windows', + steps: [ + <>Install Node.js LTS if needed, then reopen Command Prompt or PowerShell., + <>Open a terminal in the supplied percy-windows folder., + <>server.bat start, + <>If SmartScreen appears, choose More info, then Run anyway., + ], + }, +]; + +const sections = [ + { id: 'overview', title: 'What is Percy Chrome Extension?' }, + { id: 'backend', title: 'Start the backend' }, + { id: 'token', title: 'Set your Percy token' }, + { id: 'manual', title: 'Manual snapshots' }, + { id: 'workflow', title: 'Record and replay workflows' }, + { id: 'troubleshooting', title: 'Troubleshooting' }, +]; + +const troubleshooting = [ + { + id: 'trouble-backend', + title: 'The popup says “Backend server is offline”', + text: <>Start the server using the command for your OS above. Open http://localhost:4321/health to check that it responds, then reopen the popup. On macOS or Linux, use ./server.sh status and check server.log if it will not start; on Windows, check server.log and use server.bat status., + }, + { + id: 'trouble-token', + title: 'Builds fail or Percy rejects the token', + text: <>Open the extension popup, select the gear icon, and save a valid Percy full access token. Read-only or restricted tokens cannot create builds. If you saved the token while the backend was offline, start the backend and save the token again so the snapshot-library integration can also receive it. Never share your token., + }, + { + id: 'trouble-record', + title: 'Record Workflow does not start', + text: <>Recording requires an active http:// or https:// tab. Chrome internal pages (for example chrome://extensions) cannot be recorded. Reload the website tab and try again if the recorder cannot attach to it., + }, + { + id: 'trouble-shortcut', + title: 'Snapshot shortcut: Cmd/Ctrl+S opens the browser Save dialog', + text: <>The shortcut works only during an unpaused workflow recording. Click back into the website page (not an input in the floating panel), make sure the recorder says Recording, and press ⌘+S on macOS or Ctrl+S on Windows/Linux. It is not handled while paused., + }, + { + id: 'trouble-save', + title: 'Cannot save a workflow', + text: <>Stop the recording first, add at least one Capture Snapshot checkpoint, and enter a workflow name. Review the step list for any steps reported without a locator; edit those steps or delete and record them again before saving., + }, + { + id: 'trouble-replay', + title: 'A workflow replay misses a menu, element, or visual state', + text: <>Record the journey again from a stable starting page. For a hover-only visual state, hover the target and press Cmd/Ctrl+S without moving the pointer to the floating panel; that adds a checkpoint for the currently rendered state. For a menu item click, the recorder may also capture its detected menu trigger. Add a longer checkpoint wait or edit the step/checkpoint from the Snapshots page if the page needs more time to settle., + }, +]; + +function getSectionFromHash(hash: string) { + const id = hash.slice(1); + if (sections.some((section) => section.id === id)) return id; + if (troubleshooting.some((item) => item.id === id)) return 'troubleshooting'; + if (id.startsWith('manual-step-') || id === 'manual-screenshots') return 'manual'; + if (id.startsWith('workflow-step-')) return 'workflow'; + if (id === 'token-screenshots') return 'token'; + return 'overview'; +} + +function toAnchorSlug(value: string) { + return value.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, ''); +} + +const tokenScreenshots = [ + { + src: '/help/screenshots/token-settings.png', + alt: 'Percy extension settings with a saved token displayed as masked dots.', + caption: 'Enter the Percy token in settings. The token stays masked in the extension.', + }, + { + src: '/help/screenshots/token-saved.png', + alt: 'Percy extension token settings with a green Token saved confirmation.', + caption: 'The extension confirms when the token is saved.', + }, +]; + +const manualScreenshots = [ + { + src: '/help/screenshots/manual-capture-start.png', + alt: 'BrowserStack Demo page with the Percy extension popup open to the Capture Snapshot panel.', + title: 'Open the page to capture', + caption: 'Open the extension on the page you want to capture.', + }, + { + src: '/help/screenshots/manual-capture-popup.png', + alt: 'Percy extension popup showing the capture panel and workflow recording controls.', + title: 'Name and capture the snapshot', + caption: 'Name a snapshot if desired, then choose Capture Snapshot.', + }, + { + src: '/help/screenshots/manual-snapshot-queue.png', + alt: 'Snapshot queue showing two saved snapshots and the Finalize Build button.', + title: 'Review the queue and finalize the build', + caption: 'Review queued snapshots and finalize them as a Percy build.', + }, + { + src: '/help/screenshots/manual-build-complete.png', + alt: 'Completed Percy build showing two of two snapshots sent.', + title: 'Check the build progress', + caption: 'Confirm the snapshots were sent and follow the link to open the Percy build.', + }, +]; + +const workflowScreenshots = [ + { + src: '/help/screenshots/workflow-recording-start.png', + alt: 'Floating recorder panel over BrowserStack Demo with the first recorded action.', + title: 'Start recording', + caption: 'Open the feature’s starting page and choose Record Workflow. The popup closes and the floating recorder appears on the tab.', + }, + { + src: '/help/screenshots/workflow-cart-state.png', + alt: 'Floating recorder panel showing recorded steps while the shopping cart is open.', + title: 'Perform the user journey', + caption: 'Use the website normally. Clicks, text entry, selects, checkbox changes, and scrolling are recorded. Pause when you need to do something outside the workflow.', + }, + { + src: '/help/screenshots/workflow-snapshot-home.png', + alt: 'Floating recorder panel listing a Home snapshot checkpoint.', + title: 'Add visual checkpoints', + caption: <>Leave the page in the state to capture, then press ⌘+S on macOS or Ctrl+S on Windows/Linux. This adds a checkpoint without moving the pointer. The recorder’s Capture Snapshot button also works when reaching the panel will not dismiss the state. The default wait is 4 seconds., + }, + { + src: '/help/screenshots/workflow-save.png', + alt: 'Recorder save dialog with the workflow name and Save Workflow button.', + title: 'Stop, review, and save', + caption: 'Stop recording, name the workflow, and save it.', + }, + { + src: '/help/screenshots/workflow-select.png', + alt: 'Snapshots page with a saved workflow selected and branch settings visible.', + title: 'Select the saved workflow', + caption: 'Open View Snapshots, choose the saved journey, set any desired branch or target branch, and provide any requested run-only secrets.', + }, + { + src: '/help/screenshots/workflow-replay.png', + alt: 'Snapshots page with a workflow selected and the Replay / Create Build button.', + title: 'Replay to create a build', + caption: 'Select Replay / Create Build to run the workflow.', + }, + { + src: '/help/screenshots/workflow-pending.png', + alt: 'Workflow run panel showing pending steps and snapshot checkpoints.', + title: 'Monitor the run', + caption: 'Follow workflow progress and logs on the Snapshots page while the backend replays the journey in Playwright and captures each checkpoint.', + }, + { + src: '/help/screenshots/workflow-passed.png', + alt: 'Completed workflow panel showing five of five steps passed and uploaded checkpoints.', + title: 'Confirm the run passed', + caption: 'Confirm that the steps passed and all snapshot checkpoints uploaded.', + }, + { + src: '/help/screenshots/workflow-run-summary.png', + alt: 'Workflow history showing a passed run and links to its Percy build and logs.', + title: 'Open the run summary', + caption: 'Open the completed run summary, Percy build, or logs.', + }, + { + src: '/help/screenshots/percy-processing.png', + alt: 'Percy build page while snapshots are still processing.', + title: 'Review the Percy build', + caption: 'Percy processes uploaded snapshots before displaying visual comparisons.', + }, + { + src: '/help/screenshots/percy-build-review.png', + alt: 'Percy visual review with the captured storefront snapshot beside the comparison view.', + title: 'Review visual changes', + caption: 'Review the resulting snapshot and visual changes in Percy.', + }, +]; + +function ScreenshotGallery({ + screenshots, +}: { + screenshots: Array<{ src: string; alt: string; caption: string }>; +}) { + return ( +
+ {screenshots.map((screenshot) => ( +
+ + {screenshot.alt} + +
{screenshot.caption}
+
+ ))} +
+ ); +} + +function ScreenshotSteps({ + sectionId, + screenshots, +}: { + sectionId: 'manual' | 'workflow'; + screenshots: Array<{ src: string; alt: string; title: string; caption: ReactNode }>; +}) { + return ( +
+ {screenshots.map((screenshot, index) => ( +
+ + {screenshot.alt} + +
+ Step {index + 1} +

{screenshot.title}

+

{screenshot.caption}

+
+
+ ))} +
+ ); +} + +export function HelpPage() { + const [query, setQuery] = useState(''); + const [selectedSection, setSelectedSection] = useState(() => getSectionFromHash(window.location.hash)); + useEffect(() => { + const handleHashChange = () => setSelectedSection(getSectionFromHash(window.location.hash)); + window.addEventListener('hashchange', handleHashChange); + return () => window.removeEventListener('hashchange', handleHashChange); + }, []); + const visibleSections = useMemo(() => { + const normalized = query.trim().toLowerCase(); + return normalized + ? sections.filter((section) => section.title.toLowerCase().includes(normalized)) + : sections; + }, [query]); + const visibleTroubleshooting = useMemo(() => { + const normalized = query.trim().toLowerCase(); + return normalized + ? troubleshooting.filter((item) => item.title.toLowerCase().includes(normalized)) + : troubleshooting; + }, [query]); + const currentSection = sections.find((section) => section.id === selectedSection) ?? sections[0]; + const onPageItems = [ + { href: `#${currentSection.id}`, title: currentSection.title }, + ...(selectedSection === 'token' + ? [{ href: '#token-screenshots', title: 'Token setup screenshots' }] + : []), + ...(selectedSection === 'manual' + ? [ + { href: '#manual-screenshots', title: 'Manual capture screenshots' }, + ...manualScreenshots.map((screenshot) => ({ + href: `#manual-step-${toAnchorSlug(screenshot.title)}`, + title: screenshot.title, + })), + ] + : []), + ...(selectedSection === 'workflow' + ? workflowScreenshots.map((screenshot) => ({ + href: `#workflow-step-${toAnchorSlug(screenshot.title)}`, + title: screenshot.title, + })) + : []), + ...(selectedSection === 'troubleshooting' + ? troubleshooting.map((item) => ({ href: `#${item.id}`, title: item.title })) + : []), + ]; + + return ( + <> +
+ setSelectedSection('overview')} + > + + Percy Chrome Extension + + +
+ +
+ + +
+
+
+
+ Percy Chrome Extension + + Documentation +
+ + + + + + + + + + + + + +
+ Need more detail? Use the platform-specific Instructions file supplied + with the backend, or check the backend’s server.log. +
+
+ + +
+
+
+ + ); +} diff --git a/percy-local-manager-extension/src/help/help.css b/percy-local-manager-extension/src/help/help.css new file mode 100644 index 0000000..f305471 --- /dev/null +++ b/percy-local-manager-extension/src/help/help.css @@ -0,0 +1,756 @@ +:root { + color-scheme: light; + font-family: Arial, Helvetica, sans-serif; + color: #15121f; + background: #fff; + font-synthesis: none; + text-rendering: optimizeLegibility; +} + +* { + box-sizing: border-box; +} + +html { + scroll-behavior: smooth; + scroll-padding-top: 68px; +} + +body { + margin: 0; + min-width: 320px; + background: #fff; +} + +.help-topbar { + position: sticky; + z-index: 5; + top: 0; + display: flex; + height: 54px; + align-items: center; + justify-content: space-between; + gap: 20px; + padding: 0 clamp(20px, 6vw, 94px); + border-bottom: 1px solid #e6e2ef; + background: #fff; +} + +.help-brand { + display: flex; + min-width: 0; + align-items: center; + gap: 10px; + color: #302b40; + text-decoration: none; +} + +.help-brand__title { + font-size: 16px; + font-weight: 700; + white-space: nowrap; +} + +.help-brand__divider { + height: 23px; + border-left: 1px solid #d5d1df; +} + +.help-brand__section { + color: #423c56; + font-size: 14px; + font-weight: 600; + white-space: nowrap; +} + +.help-search, +.help-sidebar__search { + display: flex; + align-items: center; + gap: 8px; + border: 1px solid #d5d1df; + border-radius: 6px; + background: #fff; + color: #8a8599; +} + +.help-search { + width: min(390px, 42vw); + height: 34px; + padding: 0 8px 0 10px; +} + +.help-search input, +.help-sidebar__search input { + width: 100%; + min-width: 0; + border: 0; + outline: 0; + background: transparent; + color: #302b40; + font: inherit; + font-size: 13px; +} + +.help-search input::placeholder, +.help-sidebar__search input::placeholder { + color: #8a8599; +} + +.help-search kbd { + border: 0; + color: #8a8599; +} + +.help-shell { + display: grid; + min-height: calc(100vh - 54px); + grid-template-columns: minmax(270px, 22.5vw) minmax(0, 1fr); +} + +.help-sidebar { + position: sticky; + top: 54px; + height: calc(100vh - 54px); + overflow: auto; + padding: 30px clamp(20px, 3vw, 46px) 28px clamp(24px, 6vw, 94px); + border-right: 1px solid #e6e2ef; + background: #fff; +} + +.help-sidebar__search { + height: 32px; + margin-bottom: 22px; + padding: 0 8px; +} + +.help-nav { + display: grid; + gap: 9px; +} + +.help-nav details { + min-width: 0; +} + +.help-nav summary { + display: flex; + align-items: center; + justify-content: space-between; + padding: 7px 0; + color: #3a3a3a; + cursor: pointer; + font-size: 13px; + font-weight: 400; + list-style: none; +} + +.help-nav summary::-webkit-details-marker { + display: none; +} + +.help-nav summary::after { + content: "⌄"; + color: #726c87; + font-size: 12px; +} + +.help-nav details:not([open]) summary::after { + content: "›"; +} + +.help-nav__items { + display: grid; + margin: 2px 0 5px; + padding-left: 12px; + border-left: 1px solid #d9d9d9; +} + +.help-nav__items a { + padding: 7px 8px; + border-radius: 0; + color: #3a3a3a; + font-size: 13px; + line-height: 1.4; + text-decoration: none; +} + +.help-nav__items a:hover, +.help-nav__items a:focus-visible { + background: #f5f9ff; + color: #007bff; + outline: none; +} + +.help-nav__items a[aria-current="page"] { + background: #f0ebff; + color: #5b36df; + font-weight: 600; +} + +.help-intro[hidden], +.help-section[hidden], +.help-footer[hidden] { + display: none; +} + +.help-nav__empty { + padding: 4px 5px; + color: #726c87; + font-size: 12px; + line-height: 1.5; +} + +.help-content { + min-width: 0; + padding: 0 clamp(22px, 3.5vw, 54px) 64px; + background: #fff; +} + +.help-content__layout { + display: grid; + width: min(100%, 1210px); + grid-template-columns: minmax(0, 760px) 190px; + justify-content: center; + align-items: start; + gap: clamp(30px, 3.4vw, 54px); + margin: 0 auto; +} + +.help-content__inner { + min-width: 0; +} + +.help-breadcrumb { + display: flex; + gap: 10px; + align-items: center; + padding: 22px 0 24px; + color: #726c87; + font-size: 12px; +} + +.help-page-toc { + position: sticky; + top: 82px; + max-height: calc(100vh - 100px); + overflow: auto; + margin-top: 76px; + padding-left: 14px; + color: #3a3a3a; +} + +.help-page-toc h2 { + margin: 0 0 10px; + color: #3a3a3a; + font-size: 11px; + font-weight: 700; + letter-spacing: 0.02em; +} + +.help-page-toc nav { + display: grid; + margin-bottom: 28px; + padding-left: 12px; + border-left: 1px solid #d9d9d9; +} + +.help-page-toc nav a, +.help-resource-links a { + padding: 5px 7px; + color: #3a3a3a; + font-size: 13px; + line-height: 1.45; + text-decoration: none; +} + +.help-page-toc nav a:first-child { + border-left: 2px solid #007bff; + color: #007bff; + font-weight: 600; +} + +.help-page-toc nav a:hover, +.help-resource-links a:hover { + color: #007bff; + text-decoration: underline; +} + +.help-resource-links { + display: grid; + gap: 2px; + margin: 0; + padding: 0; + list-style: none; +} + +.help-intro { + padding: 0 0 20px; + scroll-margin-top: 70px; +} + +.help-eyebrow { + margin: 0 0 7px; + color: #007bff; + font-size: 11px; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.help-intro h1 { + margin: 0 0 10px; + color: #363636; + font-size: clamp(27px, 4vw, 34px); + letter-spacing: -0.035em; + line-height: 1.2; +} + +.help-intro > p:not(.help-eyebrow) { + max-width: 680px; + margin: 0; + color: #666; + font-size: 16px; + line-height: 1.6; +} + +.help-flow { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + margin-top: 24px; +} + +.help-flow a { + display: grid; + grid-template-columns: 35px minmax(0, 1fr); + gap: 5px 12px; + align-content: start; + padding: 16px; + border: 1px solid #e6e2ef; + border-radius: 10px; + background: linear-gradient(145deg, #fff, #faf9fd); + color: #423c56; + text-decoration: none; + transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; +} + +.help-flow a:hover, +.help-flow a:focus-visible { + transform: translateY(-2px); + border-color: #b8a7ff; + box-shadow: 0 7px 18px rgba(91, 54, 223, 0.1); + outline: none; +} + +.help-flow__number { + display: grid; + width: 32px; + height: 32px; + grid-row: span 2; + place-items: center; + border-radius: 9px; + background: #f0ebff; + color: #5b36df; + font-size: 11px; + font-weight: 700; +} + +.help-flow a strong { + align-self: center; + font-size: 14px; +} + +.help-flow a > span:last-child { + grid-column: 2; + color: #726c87; + font-size: 12px; + font-weight: 400; + line-height: 1.55; +} + +.help-section { + padding-top: 29px; + scroll-margin-top: 68px; +} + +.help-section h2 { + margin: 0 0 9px; + color: #363636; + font-size: 23px; + letter-spacing: -0.02em; +} + +.help-lead { + margin: 0 0 15px; + color: #666; + font-size: 15px; + line-height: 1.6; +} + +.help-os-grid { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; +} + +.help-card { + padding: 14px; + border: 1px solid #e6e2ef; + border-radius: 8px; + background: #fff; +} + +.help-card h3 { + margin: 0 0 9px; + color: #423c56; + font-size: 14px; +} + +.help-card ol, +.help-steps { + margin: 0; + padding-left: 20px; + color: #3a3a3a; + font-size: 14px; + line-height: 1.65; +} + +.help-card li + li, +.help-steps li + li { + margin-top: 6px; +} + +.help-layout code, +.help-content code { + padding: 2px 4px; + border-radius: 4px; + background: #eef6ff; + color: #0056b3; + font-family: "Courier New", monospace; + font-size: 0.92em; + overflow-wrap: anywhere; +} + +.help-note, +.help-callout { + margin: 14px 0 0; + padding: 12px 14px; + border: 1px solid #e6e2ef; + border-radius: 7px; + background: #faf9fd; + color: #423c56; + font-size: 13px; + line-height: 1.6; +} + +.help-callout { + border-color: #b3d4ff; + background: #eaf3ff; +} + +.help-steps { + padding: 0 0 0 22px; +} + +.help-steps li { + padding-left: 2px; +} + +.help-visual { + margin: 14px 0 0; + overflow: hidden; + border: 1px solid #e6e2ef; + border-radius: 9px; + background: #f5f4fa; +} + +.help-visual img { + display: block; + width: 100%; + height: auto; +} + +.help-visual figcaption { + padding: 10px 13px; + border-top: 1px solid #e6e2ef; + background: #fff; + color: #726c87; + font-size: 12px; + line-height: 1.5; +} + +.help-gallery-heading { + margin: 22px 0 0; + color: #423c56; + font-size: 16px; +} + +.help-screenshot-gallery { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + margin-top: 12px; +} + +.help-screenshot-gallery .help-visual { + min-width: 0; + margin: 0; +} + +.help-screenshot-gallery a:focus-visible { + display: block; + outline: 3px solid #6d4aff; + outline-offset: -3px; +} + +.manual-screenshot-steps { + display: grid; + gap: 16px; + margin-top: 12px; +} + +.manual-screenshot-step { + display: grid; + grid-template-areas: "image copy"; + grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); + gap: clamp(18px, 3vw, 36px); + align-items: center; + padding: clamp(12px, 2vw, 20px); + border: 1px solid #e6e2ef; + border-radius: 12px; + background: #fff; + box-shadow: 0 5px 16px rgba(38, 29, 68, 0.045); +} + +.manual-screenshot-step--reversed { + grid-template-areas: "copy image"; + grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); +} + +.manual-screenshot-step__image { + grid-area: image; + display: block; + min-width: 0; + overflow: hidden; + border: 1px solid #e6e2ef; + border-radius: 9px; + background: #f5f4fa; +} + +.manual-screenshot-step__image:focus-visible { + outline: 3px solid #6d4aff; + outline-offset: 3px; +} + +.manual-screenshot-step__image img { + display: block; + width: 100%; + height: auto; +} + +.manual-screenshot-step__copy { + grid-area: copy; + padding: 8px; +} + +.manual-screenshot-step__number { + display: inline-flex; + padding: 5px 9px; + border-radius: 999px; + background: #f0ebff; + color: #5b36df; + font-size: 11px; + font-weight: 700; + letter-spacing: 0.04em; + text-transform: uppercase; +} + +.manual-screenshot-step__copy h4 { + margin: 12px 0 7px; + color: #282337; + font-size: 18px; + line-height: 1.35; +} + +.manual-screenshot-step__copy p { + margin: 0; + color: #6b657d; + font-size: 14px; + line-height: 1.65; +} + +kbd { + display: inline-block; + min-width: 22px; + padding: 2px 6px; + border: 1px solid #d5d1df; + border-bottom-width: 2px; + border-radius: 4px; + background: #faf9fd; + color: #423c56; + font-family: inherit; + font-size: 11px; + text-align: center; +} + +.help-troubleshooting { + display: grid; + gap: 8px; +} + +.help-issue { + padding: 12px 14px; + border: 1px solid #e6e2ef; + border-radius: 7px; + background: #fff; + scroll-margin-top: 70px; +} + +.help-issue summary { + color: #423c56; + cursor: pointer; + font-size: 13px; + font-weight: 600; + line-height: 1.5; +} + +.help-issue p { + margin: 10px 0 0; + color: #5b556d; + font-size: 13px; + line-height: 1.65; +} + +.help-footer { + margin-top: 28px; + padding-top: 14px; + border-top: 1px solid #e6e2ef; + color: #726c87; + font-size: 12px; + line-height: 1.6; +} + +@media (max-width: 1200px) { + .help-shell { + grid-template-columns: 210px minmax(0, 1fr); + } + + .help-content__layout { + display: block; + } + + .help-page-toc { + display: none; + } + +} + +@media (max-width: 900px) { + .help-shell { + grid-template-columns: 210px minmax(0, 1fr); + } + + .help-content { + padding-right: 22px; + padding-left: 22px; + } + + .help-os-grid { + grid-template-columns: 1fr; + } + + .help-flow { + grid-template-columns: minmax(0, 1fr); + } +} + +@media (max-width: 680px) { + .help-topbar { + height: auto; + min-height: 54px; + padding: 10px 14px; + } + + .help-brand__section, + .help-brand__divider, + .help-search { + display: none; + } + + .help-shell { + display: block; + } + + .help-sidebar { + position: static; + height: auto; + overflow: visible; + padding: 12px 16px; + border-right: 0; + border-bottom: 1px solid #e6e2ef; + } + + .help-sidebar__search { + margin-bottom: 10px; + } + + .help-nav { + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 4px; + } + + .help-nav summary { + font-size: 11px; + } + + .help-nav__items { + position: absolute; + z-index: 2; + max-width: 250px; + padding: 6px; + border: 1px solid #e6e2ef; + border-radius: 6px; + background: #fff; + box-shadow: 0 8px 20px rgba(21, 18, 31, 0.12); + } + + .help-content { + padding: 0 18px 48px; + } + + .help-screenshot-gallery { + grid-template-columns: minmax(0, 1fr); + } + + .manual-screenshot-step, + .manual-screenshot-step--reversed { + grid-template-areas: + "image" + "copy"; + grid-template-columns: minmax(0, 1fr); + gap: 10px; + padding: 12px; + } + + .manual-screenshot-step__copy { + padding: 4px 2px 2px; + } + + .manual-screenshot-step__copy h4 { + margin-top: 9px; + font-size: 16px; + } + + .help-breadcrumb { + padding-top: 16px; + padding-bottom: 17px; + } + +} + +@media (prefers-reduced-motion: reduce) { + html { + scroll-behavior: auto; + } +} diff --git a/percy-local-manager-extension/src/help/main.tsx b/percy-local-manager-extension/src/help/main.tsx new file mode 100644 index 0000000..ff140f3 --- /dev/null +++ b/percy-local-manager-extension/src/help/main.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import { HelpPage } from './HelpPage'; +import './help.css'; + +ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( + + + , +); diff --git a/percy-local-manager-extension/src/hooks/useCaptureSnapshot.ts b/percy-local-manager-extension/src/hooks/useCaptureSnapshot.ts index 3a6e0b4..64b22b7 100644 --- a/percy-local-manager-extension/src/hooks/useCaptureSnapshot.ts +++ b/percy-local-manager-extension/src/hooks/useCaptureSnapshot.ts @@ -56,8 +56,8 @@ export function useCaptureSnapshot( url: pageState.url, dom: pageState.dom, - widths: options?.widths ?? [375, 1280], - minHeight: options?.minHeight ?? 1024, + widths: options?.widths?.length ? options.widths : [pageState.viewportWidth], + minHeight: options?.minHeight ? options.minHeight : pageState.viewportHeight, enableJavaScript: options?.enableJavaScript ?? false, diff --git a/percy-local-manager-extension/src/library/LibraryPage.tsx b/percy-local-manager-extension/src/library/LibraryPage.tsx index a306a8c..cf00954 100644 --- a/percy-local-manager-extension/src/library/LibraryPage.tsx +++ b/percy-local-manager-extension/src/library/LibraryPage.tsx @@ -154,7 +154,7 @@ export function LibraryPage() { - Local Manager + Chrome Extension
diff --git a/percy-local-manager-extension/src/popup/Popup.tsx b/percy-local-manager-extension/src/popup/Popup.tsx index 9c9faae..71c9fc5 100644 --- a/percy-local-manager-extension/src/popup/Popup.tsx +++ b/percy-local-manager-extension/src/popup/Popup.tsx @@ -31,7 +31,7 @@ export function Popup() {
Percy - Local Manager + Chrome Extension
@@ -116,6 +116,17 @@ export function Popup() { > View Snapshots + + )} diff --git a/percy-local-manager-extension/src/services/domCapture.ts b/percy-local-manager-extension/src/services/domCapture.ts index ff5004a..85408be 100644 --- a/percy-local-manager-extension/src/services/domCapture.ts +++ b/percy-local-manager-extension/src/services/domCapture.ts @@ -5,10 +5,13 @@ import type { CapturedPageState } from '../types'; * Keep this function pure and self-contained — it is serialized and injected, * it cannot close over anything from the popup's scope. */ -function readPageState(): { url: string; dom: string; viewportWidth: number; viewportHeight: number; title: string } { +export function readPageState(): { url: string; dom: string; viewportWidth: number; viewportHeight: number; title: string } { + const doctype = document.doctype + ? new XMLSerializer().serializeToString(document.doctype) + : ''; return { url: window.location.href, - dom: document.documentElement.outerHTML, + dom: `${doctype}${document.documentElement.outerHTML}`, viewportWidth: window.innerWidth, viewportHeight: window.innerHeight, title: document.title diff --git a/percy-local-manager-extension/src/snapshots/SnapshotsPage.tsx b/percy-local-manager-extension/src/snapshots/SnapshotsPage.tsx index 1bb68e0..fcc4385 100644 --- a/percy-local-manager-extension/src/snapshots/SnapshotsPage.tsx +++ b/percy-local-manager-extension/src/snapshots/SnapshotsPage.tsx @@ -65,7 +65,7 @@ export function SnapshotsPage() {
Percy - Local Manager + Chrome Extension
diff --git a/percy-local-manager-extension/tests/domCapture.test.mjs b/percy-local-manager-extension/tests/domCapture.test.mjs new file mode 100644 index 0000000..e728385 --- /dev/null +++ b/percy-local-manager-extension/tests/domCapture.test.mjs @@ -0,0 +1,60 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync, mkdtempSync, writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { fileURLToPath, pathToFileURL } from 'node:url'; +import path from 'node:path'; +import { tmpdir } from 'node:os'; + +const require = createRequire(import.meta.url); +const ts = require('typescript'); +const here = path.dirname(fileURLToPath(import.meta.url)); +const js = ts.transpileModule(readFileSync(path.join(here, '../src/services/domCapture.ts'), 'utf8'), { + compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ES2020 }, +}).outputText; +const out = path.join(mkdtempSync(path.join(tmpdir(), 'dom-capture-')), 'domCapture.mjs'); +writeFileSync(out, js); +const { readPageState } = await import(pathToFileURL(out).href); + +test('manual capture preserves the source doctype in the Percy DOM', () => { + const keys = ['document', 'window', 'XMLSerializer']; + const originals = new Map(keys.map((key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)])); + const html = ''; + const doctype = {}; + + try { + Object.defineProperty(globalThis, 'document', { + configurable: true, + value: { doctype, documentElement: { outerHTML: html }, title: 'Example' }, + }); + Object.defineProperty(globalThis, 'window', { + configurable: true, + value: { location: { href: 'https://example.test/' }, innerWidth: 1280, innerHeight: 712 }, + }); + Object.defineProperty(globalThis, 'XMLSerializer', { + configurable: true, + value: class { + serializeToString(node) { + assert.equal(node, doctype); + return ''; + } + }, + }); + + assert.deepEqual(readPageState(), { + url: 'https://example.test/', + dom: `${html}`, + viewportWidth: 1280, + viewportHeight: 712, + title: 'Example', + }); + + globalThis.document.doctype = null; + assert.equal(readPageState().dom, html); + } finally { + for (const [key, descriptor] of originals) { + if (descriptor) Object.defineProperty(globalThis, key, descriptor); + else Reflect.deleteProperty(globalThis, key); + } + } +}); diff --git a/percy-local-manager-extension/tsconfig.tsbuildinfo b/percy-local-manager-extension/tsconfig.tsbuildinfo index 4e0281a..14f63b4 100644 --- a/percy-local-manager-extension/tsconfig.tsbuildinfo +++ b/percy-local-manager-extension/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/vite-env.d.ts","./src/background/recorder.ts","./src/components/branchsettingsfields.tsx","./src/components/brandmark.tsx","./src/components/buildprogress.tsx","./src/components/capturesnapshotpanel.tsx","./src/components/clearsnapshotsbutton.tsx","./src/components/connectionstatus.tsx","./src/components/editsnapshotpanel.tsx","./src/components/editsteppanel.tsx","./src/components/finalizebuildpanel.tsx","./src/components/librarymatches.tsx","./src/components/queuecount.tsx","./src/components/recordlauncher.tsx","./src/components/recordedsteps.tsx","./src/components/snapshotcard.tsx","./src/components/snapshotdetailmodal.tsx","./src/components/snapshotoptionsfields.tsx","./src/components/snapshotrow.tsx","./src/components/tokenrequirednotice.tsx","./src/components/tokensettingspanel.tsx","./src/components/workflowrunssection.tsx","./src/content/recorder.ts","./src/content/widget.ts","./src/hooks/usebranchsettings.ts","./src/hooks/usebuildstatus.ts","./src/hooks/usecapturesnapshot.ts","./src/hooks/useconnectionstatus.ts","./src/hooks/usefinalizebuild.ts","./src/hooks/uselibrarysearch.ts","./src/hooks/userecorder.ts","./src/hooks/userun.ts","./src/hooks/usesnapshotqueue.ts","./src/hooks/usetoken.ts","./src/hooks/usetokenprompt.ts","./src/hooks/useworkflows.ts","./src/library/librarypage.tsx","./src/library/main.tsx","./src/popup/popup.tsx","./src/popup/main.tsx","./src/services/backendapi.ts","./src/services/domcapture.ts","./src/services/workflowapi.ts","./src/snapshots/snapshotspage.tsx","./src/snapshots/main.tsx","./src/types/build.ts","./src/types/index.ts","./src/types/workflow.ts","./src/utils/branchstorage.ts","./src/utils/constants.ts","./src/utils/formatsnapshotname.ts","./src/utils/pageprofile.ts","./src/utils/recordercore.ts","./src/utils/tokenstorage.ts"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/vite-env.d.ts","./src/background/recorder.ts","./src/components/branchsettingsfields.tsx","./src/components/brandmark.tsx","./src/components/buildprogress.tsx","./src/components/capturesnapshotpanel.tsx","./src/components/clearsnapshotsbutton.tsx","./src/components/connectionstatus.tsx","./src/components/editsnapshotpanel.tsx","./src/components/editsteppanel.tsx","./src/components/finalizebuildpanel.tsx","./src/components/librarymatches.tsx","./src/components/queuecount.tsx","./src/components/recordlauncher.tsx","./src/components/recordedsteps.tsx","./src/components/snapshotcard.tsx","./src/components/snapshotdetailmodal.tsx","./src/components/snapshotoptionsfields.tsx","./src/components/snapshotrow.tsx","./src/components/tokenrequirednotice.tsx","./src/components/tokensettingspanel.tsx","./src/components/workflowrunssection.tsx","./src/content/recorder.ts","./src/content/widget.ts","./src/help/helppage.tsx","./src/help/main.tsx","./src/hooks/usebranchsettings.ts","./src/hooks/usebuildstatus.ts","./src/hooks/usecapturesnapshot.ts","./src/hooks/useconnectionstatus.ts","./src/hooks/usefinalizebuild.ts","./src/hooks/uselibrarysearch.ts","./src/hooks/userecorder.ts","./src/hooks/userun.ts","./src/hooks/usesnapshotqueue.ts","./src/hooks/usetoken.ts","./src/hooks/usetokenprompt.ts","./src/hooks/useworkflows.ts","./src/library/librarypage.tsx","./src/library/main.tsx","./src/popup/popup.tsx","./src/popup/main.tsx","./src/services/backendapi.ts","./src/services/domcapture.ts","./src/services/workflowapi.ts","./src/snapshots/snapshotspage.tsx","./src/snapshots/main.tsx","./src/types/build.ts","./src/types/index.ts","./src/types/workflow.ts","./src/utils/branchstorage.ts","./src/utils/constants.ts","./src/utils/formatsnapshotname.ts","./src/utils/pageprofile.ts","./src/utils/recordercore.ts","./src/utils/tokenstorage.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/percy-local-manager-extension/vite.config.js b/percy-local-manager-extension/vite.config.js index f447dfe..b81e645 100644 --- a/percy-local-manager-extension/vite.config.js +++ b/percy-local-manager-extension/vite.config.js @@ -12,6 +12,7 @@ export default defineConfig({ popup: 'index.html', library: 'library.html', snapshots: 'snapshots.html', + help: 'help.html', // Service worker (ES module worker, may share chunks with the popup). background: 'src/background/recorder.ts' }, diff --git a/percy-local-manager-extension/vite.config.ts b/percy-local-manager-extension/vite.config.ts index fc21148..0854c11 100644 --- a/percy-local-manager-extension/vite.config.ts +++ b/percy-local-manager-extension/vite.config.ts @@ -13,6 +13,7 @@ export default defineConfig({ popup: 'index.html', library: 'library.html', snapshots: 'snapshots.html', + help: 'help.html', // Service worker (ES module worker, may share chunks with the popup). background: 'src/background/recorder.ts' },