Sign In

specshot

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

specshot - npm Package Compare versions

Comparing version
3.0.6
to
3.0.7
+1
ui/mock-ui/dist/assets/index-B2SKdyJS.js
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function y(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return x(t,s,i,a,null)}function x(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t}function w(e,t){if(t==null)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?w(e):null}function T(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),I(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??w(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,R(i,o,a),n.__e=n.__=null,o.__e!=r&&E(o)}}function E(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),E(e)}function D(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!O.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(O)}function O(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,T(e)}finally{r.length=O.__r=0}}function k(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y,b=r&&r.__k||h,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||m,p.__i=d,v=I(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&B(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),(y=!!(4&p.__u))||f.__k===p.__k?(c=j(p,c,e,y),y&&f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=x(null,o,null,null,null):_(o)?o=e.__k[a]=x(S,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=w(s)),V(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=w(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function P(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function F(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function I(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,x,w,T,E,D,O,A,j,M,N=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof N==`function`)try{if(w=n.props,T=N.prototype&&N.prototype.render,E=(d=N.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?x=(f=n.__c=r.__c).__=f.__E:(T?n.__c=f=new N(w,D):(n.__c=f=new C(w,D),f.constructor=N,f.render=te),E&&E.sub(f),f.state||={},f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=v({},f.__s)),v(f.__s,N.getDerivedStateFromProps(w,f.__s))),m=f.props,g=f.state,f.__v=n,p)T&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&N.getDerivedStateFromProps==null&&w!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,D),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(w,f.__s,D)){n.__v!=r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,g,b)})}if(f.context=D,f.props=w,f.__P=e,f.__e=!1,O=t.__r,A=0,T)f.state=f.__s,f.__d=!1,O&&O(n),d=f.render(f.props,f.state,f.context),h.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(n),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++A<25);f.state=f.__s,f.getChildContext!=null&&(i=v(v({},i),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(m,g)),j=d!=null&&d.type===S&&d.key==null?z(d.props.children):d,c=k(e,_(j)?j:[j],n,r,i,a,o,s,c,l,u),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(n.__v=null,l||o!=null)if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,n.__e=c}else{for(M=o.length;M--;)y(o[M]);L(n)}else n.__e=r.__e,n.__k=r.__k,e.then||L(n);t.__e(e,n,r)}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=ee(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function L(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(L))}function R(e,n,r){for(var i=0;i<r.length;i++)B(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function z(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(z):e.constructor===void 0?v({},e):null}function ee(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,b,x=i.props||m,S=r.props,C=r.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(C==null)return document.createTextNode(S);n=document.createElementNS(o,C,S.is&&S),l&&=(t.__m&&t.__m(r,s),!1),s=null}if(C==null)x===S||l&&n.data==S||(n.data=S);else{if(s=C==`textarea`&&S.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(x={},d=0;d<n.attributes.length;d++)x[(g=n.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||P(n,d,null,g,o);for(d in S)g=S[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?b=g:l&&typeof g!=`function`||x[d]===g||P(n,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),k(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&w(i,0),l,u),s!=null)for(d=s.length;d--;)y(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||C==`progress`&&!v||C==`option`&&v!=x[d])&&P(n,d,v,x[d],o),d=`checked`,b!=null&&b!=n[d]&&P(n,d,b,x[d],o))}return n}function B(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function V(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||B(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&V(i[a],n,r||typeof e.type!=`function`);r||y(e.__e),e.__c=e.__=e.__e=void 0}function te(e,t,n){return this.constructor(e,n)}function ne(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],I(r,n=(!a&&i||r).__k=b(S,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),R(s,n,c)}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,C.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),D(this))},C.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),D(this))},C.prototype.render=S,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=F(!1),p=F(!0);var H,U,re,W,G=0,K=[],q=t,ie=q.__b,ae=q.__r,oe=q.diffed,se=q.__c,ce=q.unmount,le=q.__;function ue(e,t){q.__h&&q.__h(U,e,G||t),G=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return G=1,de(ve,e)}function de(e,t,n){var r=ue(H++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ve(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},U.shouldComponentUpdate=i}return r.__N||r.__}function Y(e,t){var n=ue(H++,3);!q.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function fe(e,t){var n=ue(H++,7);return _e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function pe(){for(var e;e=K.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(ge),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){U=null,ie&&ie(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),le&&le(e,t)},q.__r=function(e){ae&&ae(e),H=0;var t=(U=e.__c).__H;t&&(re===U?(t.__h=[],U.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(X),t.__h.some(ge),t.__h=[],H=0)),re=U},q.diffed=function(e){oe&&oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(K.push(t)!==1&&W===q.requestAnimationFrame||((W=q.requestAnimationFrame)||he)(pe)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),re=U=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(X),e.__h=e.__h.filter(function(e){return!e.__||ge(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),se&&se(e,t)},q.unmount=function(e){ce&&ce(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{X(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var me=typeof requestAnimationFrame==`function`;function he(e){var t,n=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);me&&(t=requestAnimationFrame(n))}function X(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function ge(e){var t=U;e.__c=e.__(),U=t}function _e(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ve(e,t){return typeof t==`function`?t(e):t}async function ye(){let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to fetch config`);return e.json()}async function be(e){if(!(await fetch(`/api/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({endpoints:e})})).ok)throw Error(`Failed to save config`)}async function xe(){let e=await fetch(`/api/mock-server`);if(!e.ok)throw Error(`Failed to fetch mock server status`);return e.json()}async function Se(e,t){let n=await fetch(`/api/mock-server`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e,port:t})}),r=await n.json();if(!n.ok)throw Error(r.error||`Failed to ${e} mock server`);return r}async function Ce(e){let t=await fetch(`/api/spec?source=`+encodeURIComponent(e)),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to load spec`);return n}async function we(e){let t=await fetch(`/api/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to generate handlers`);return n}async function Te(e){let t=await fetch(`/api/regenerate-faker`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok||n.error)throw Error(n.error||`Failed to regenerate faker data`);return n}async function Ee(e,t,n){let r={method:e,headers:{}};n&&e!==`GET`&&e!==`HEAD`&&(r.headers[`Content-Type`]=`application/json`,r.body=n);let i=await fetch(t,r),a=await i.text();return{status:i.status,statusText:i.statusText,body:a}}async function De(){let e=await fetch(`/api/websocket`);if(!e.ok)throw Error(`Failed to fetch WebSocket endpoints`);return e.json()}async function Oe(e){let t=await fetch(`/api/websocket`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to save WebSocket endpoint`);return n}async function ke(e){let t=await fetch(`/api/websocket?id=${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to delete WebSocket endpoint`);return n}async function Ae(e){let t=await fetch(`/api/websocket/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok&&!n.sent)throw Error(n.error||`Failed to trigger WebSocket event`);return n}var Z=[{value:``,label:`Auto`},{value:`person.firstName`,label:`person.firstName`},{value:`person.lastName`,label:`person.lastName`},{value:`person.fullName`,label:`person.fullName`},{value:`person.jobTitle`,label:`person.jobTitle`},{value:`person.avatar`,label:`person.avatar`},{value:`internet.email`,label:`internet.email`},{value:`internet.url`,label:`internet.url`},{value:`internet.userName`,label:`internet.userName`},{value:`internet.password`,label:`internet.password`},{value:`internet.ip`,label:`internet.ip`},{value:`internet.ipv6`,label:`internet.ipv6`},{value:`string.uuid`,label:`string.uuid`},{value:`string.alpha`,label:`string.alpha`},{value:`string.numeric`,label:`string.numeric`},{value:`date.recent`,label:`date.recent`},{value:`date.past`,label:`date.past`},{value:`date.future`,label:`date.future`},{value:`date.birthdate`,label:`date.birthdate`},{value:`lorem.word`,label:`lorem.word`},{value:`lorem.words`,label:`lorem.words`},{value:`lorem.sentence`,label:`lorem.sentence`},{value:`lorem.paragraph`,label:`lorem.paragraph`},{value:`lorem.text`,label:`lorem.text`},{value:`location.city`,label:`location.city`},{value:`location.country`,label:`location.country`},{value:`location.streetAddress`,label:`location.streetAddress`},{value:`location.zipCode`,label:`location.zipCode`},{value:`location.state`,label:`location.state`},{value:`phone.number`,label:`phone.number`},{value:`commerce.productName`,label:`commerce.productName`},{value:`commerce.price`,label:`commerce.price`},{value:`commerce.productDescription`,label:`commerce.productDescription`},{value:`commerce.department`,label:`commerce.department`},{value:`image.url`,label:`image.url`},{value:`image.avatar`,label:`image.avatar`},{value:`number.int`,label:`number.int`},{value:`number.float`,label:`number.float`},{value:`finance.amount`,label:`finance.amount`},{value:`finance.currencyCode`,label:`finance.currencyCode`},{value:`finance.accountNumber`,label:`finance.accountNumber`},{value:`company.name`,label:`company.name`},{value:`company.catchPhrase`,label:`company.catchPhrase`},{value:`animal.type`,label:`animal.type`},{value:`color.human`,label:`color.human`}];function je(e){let t=Z.length;for(let e=t-1;e>=0;e--)Z[e].value.startsWith(`plugin:`)&&Z.splice(e,1);if(e&&e.length>0){Z.push({value:`---`,label:`--- Plugins ---`});for(let t of e)Z.push({value:`plugin:${t}`,label:`Plugin: ${t}`})}}function Me(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Ne(e){return e?Me(e).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(e){let t=`hl-n`;return/^"/.test(e)?t=/:$/.test(e)?`hl-k`:`hl-s`:/true|false/.test(e)?t=`hl-b`:/null/.test(e)&&(t=`hl-p`),`<span class="`+t+`">`+e+`</span>`}):``}function Q(e,t,n=`root`){if(Array.isArray(e)){if(e.length===0)return[];let r=t[n]??(n===`root`?t.root??3:3),i=[];for(let a=0;a<r;a++){let r=Q(a<e.length?e[a]:e[0],t,`${n}[]`),o=JSON.parse(JSON.stringify(r));a>=e.length&&o&&typeof o==`object`&&o.id&&(typeof o.id==`number`?o.id+=a:typeof o.id==`string`&&(o.id=o.id.replace(/-[a-z0-9]+$/,`-${a}`))),i.push(o)}return i}else if(typeof e==`object`&&e){let r={};for(let i of Object.keys(e)){let a=n===`root`?i:`${n}.${i}`;r[i]=Q(e[i],t,a)}return r}return e}function Pe(e){if(e.config?.mockMode===`faker`){try{let t=JSON.parse(e.mockExampleFaker||`null`);if(t!==null){let n=Q(t,e.config.fakerArraySizes||{});return JSON.stringify(n,null,2)}}catch{}return e.mockExampleFaker||``}return e.config?.mockData===void 0?e.mockExample||``:e.config.mockData}function Fe(){let[e,t]=J(``),[n,r]=J(``),[i,a]=J([]),[o,s]=J(0),[c,l]=J(!1),[u,d]=J(3457),[f,p]=J(!1),[m,h]=J(null),[g,_]=J(new Set),[v,y]=J(new Set),[b,x]=J(``),[S,C]=J(!1),[w,T]=J([]),E=(e,t=`success`)=>{h({msg:e,type:t}),setTimeout(()=>h(null),3e3)};Y(()=>{ye().then(e=>{e.specSource&&t(e.specSource),e.outputDir&&r(e.outputDir),e.specSource&&D(e.specSource)}).catch(console.error),xe().then(e=>{l(e.running),e.port&&d(e.port)}).catch(console.error),De().then(e=>T(e.endpoints)).catch(console.error)},[]),Y(()=>{if(i.length===0)return;let e=setTimeout(()=>{let e={};i.forEach(t=>{t.endpoints.forEach(t=>{(t.enabled||t.config)&&(e[t.key]={enabled:t.enabled,tag:t.tag,operationId:t.operationId,method:t.method,path:t.path,statusCode:t.config?.statusCode||200,delay:t.config?.delay||0,mockData:t.config?.mockData===void 0?t.mockExample||``:t.config.mockData,mockMode:t.config?.mockMode||`auto`,fakerArraySize:t.config?.fakerArraySize||3,fakerArraySizes:t.config?.fakerArraySizes||{},fakerFormats:t.config?.fakerFormats||{},errorEnabled:t.config?.errorEnabled,errorStatus:t.config?.errorStatus,errorBody:t.config?.errorBody})})}),be(e).catch(console.error)},500);return()=>clearTimeout(e)},[i]);let D=async e=>{if(e){p(!0);try{let t=await Ce(e);t.availablePlugins&&je(t.availablePlugins),a(t.tags.map(e=>({...e,endpoints:e.endpoints.map(e=>{if(e.config?.mockData)try{e.config.mockData=JSON.stringify(JSON.parse(e.config.mockData),null,2)}catch{}if(e.mockExample)try{e.mockExample=JSON.stringify(JSON.parse(e.mockExample),null,2)}catch{}return e})}))),s(t.totalEndpoints),_(new Set([t.tags[0]?.tag])),E(`Loaded ${t.totalEndpoints} endpoints`)}catch(e){E(e.message,`error`)}finally{p(!1)}}},O=async()=>{let e=c?`stop`:`start`;try{let t=await Se(e,u);l(t.running),t.port&&d(t.port),E(`Mock server ${t.running?`started`:`stopped`}`)}catch(e){E(e.message,`error`)}},k=e=>{let t=new Set(g);t.has(e)?t.delete(e):t.add(e),_(t)},A=e=>{let t=new Set(v);t.has(e)?t.delete(e):t.add(e),y(t)},j=(e,t)=>{a(n=>n.map(n=>({...n,endpoints:n.endpoints.map(n=>n.key===e?{...n,...t}:n)})))},M=async t=>{let n=i.flatMap(e=>e.endpoints).find(e=>e.key===t);if(n)try{E(`Regenerating...`,`info`);let t=await Te({specSource:e,key:n.key,fakerArraySizes:n.config?.fakerArraySizes||{},fakerFormats:n.config?.fakerFormats||{}});if(t.mockExampleFaker){a(i.map(e=>({...e,endpoints:e.endpoints.map(e=>e.key===n.key?{...e,mockExampleFaker:t.mockExampleFaker}:e)})));let e=n.config?.mockData||``;try{let r=JSON.parse(t.mockExampleFaker||`null`);r!==null&&(e=JSON.stringify(Q(r,n.config?.fakerArraySizes||{}),null,2))}catch{}j(n.key,{config:{...n.config,mockData:e}}),E(`Regenerated successfully!`,`success`)}}catch(e){E(e.message||`Failed to regenerate`,`error`)}},N=async()=>{let t={};i.forEach(e=>{e.endpoints.forEach(e=>{(e.enabled||e.config)&&(t[e.key]={enabled:e.enabled,tag:e.tag,operationId:e.operationId,method:e.method,path:e.path,...e.config||{}})})});try{E(`Generated ${(await we({specSource:e,outputDir:n,endpoints:t})).handlersGenerated} handlers`)}catch(e){E(e.message,`error`)}},P=fe(()=>{let e=b.toLowerCase();return i.map(t=>({...t,endpoints:t.endpoints.filter(n=>S&&!n.enabled?!1:e?n.path.toLowerCase().includes(e)||n.method.toLowerCase().includes(e)||(n.summary||``).toLowerCase().includes(e)||t.tag.toLowerCase().includes(e):!0)})).filter(e=>e.endpoints.length>0)},[i,b,S]),F=fe(()=>{let e=[];return i.forEach(t=>{t.endpoints.forEach(t=>{t.enabled&&e.push(t)})}),e},[i]),I=F.length,L=async()=>{try{T((await De()).endpoints)}catch(e){E(e.message,`error`)}};return{specSource:e,setSpecSource:t,outputDir:n,tags:i,setTags:a,totalEndpoints:o,mockServerRunning:c,mockServerPort:u,loading:f,toastMsg:m,toast:E,expandedTags:g,toggleTag:k,expandedEndpoints:v,toggleEndpointExpansion:A,searchQuery:b,setSearchQuery:x,mockOnly:S,setMockOnly:C,filteredTags:P,enabledEndpoints:F,enabledCount:I,wsEndpoints:w,fetchWsEndpoints:L,addWsEndpoint:async(e,t)=>{try{await Oe({path:e,description:t}),await L(),E(`WebSocket endpoint added`)}catch(e){E(e.message,`error`)}},removeWsEndpoint:async e=>{try{await ke(e),await L(),E(`WebSocket endpoint removed`)}catch(e){E(e.message,`error`)}},triggerWsEvent:async(e,t)=>{try{let n=await Ae({path:e,message:t});E(`Event sent to ${n.sent} client(s) on ${n.path}`)}catch(e){E(e.message,`error`)}},loadSpec:D,toggleMockServer:O,updateEndpointConfig:j,regenerateFakerForEndpoint:M,saveAndGenerate:N}}function Ie(e){let[t,n]=J(`GET`),[r,i]=J(``),[a,o]=J(``),[s,c]=J(null);return{testMethod:t,setTestMethod:n,testPath:r,setTestPath:i,testBody:a,setTestBody:o,testResponse:s,setTestResponse:c,handleTestRequest:async()=>{c(null);let n=performance.now(),i=`http://localhost:${e}`;try{let e=await Ee(t,`${i}${r}`,a),o=e.body;try{o=JSON.stringify(JSON.parse(e.body),null,2)}catch{}c({status:e.status,statusText:e.statusText,ms:Math.round(performance.now()-n),body:o})}catch(e){c({status:0,statusText:`Error`,ms:Math.round(performance.now()-n),body:``,error:e.message})}}}}var Le=0;Array.isArray;function $(e,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Le,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function Re({name:e,value:t,isLast:n,isRoot:r=!1,path:i=`root`,fakerArraySizes:a={},fakerFormats:o={},schemaTypes:s={},onSizeChange:c,onFormatChange:l}){let u=typeof t==`object`&&!!t,d=Array.isArray(t),[f,p]=J(!0);if(u){let u=Object.keys(t),m=u.length===0;return $(`div`,{class:`json-viewer-node`,style:{marginLeft:r?`0`:`20px`},children:[$(`div`,{class:`json-viewer-node-row`,children:[!m&&$(`span`,{onClick:()=>p(!f),class:`json-viewer-node-arrow`,children:f?`▼`:`▶`}),m&&$(`span`,{class:`json-viewer-node-arrow-placeholder`}),$(`div`,{class:`json-viewer-node-content`,children:[e&&$(`span`,{class:`json-viewer-node-key`,children:[e,`: `]}),$(`span`,{class:`json-viewer-node-type-indicator`,style:{marginLeft:e?`4px`:`0`},children:[d?`Array(${u.length}) `:`Object `,m?d?`[]`:`{}`:d?`[`:`{`]}),d&&c&&$(`div`,{class:`json-viewer-node-size-controls`,children:[$(`span`,{class:`size-label`,children:`size:`}),$(`input`,{type:`number`,min:`1`,max:`100`,value:a[i]??(i===`root`?a.root??3:3),onChange:e=>c(i,parseInt(e.target.value)||1),class:`size-input`})]})]})]}),f&&!m&&$(`div`,{class:`json-viewer-node-children`,children:u.map((e,n)=>{let r=d?`${i}[]`:i===`root`?e:`${i}.${e}`;return $(Re,{name:d?void 0:e,value:t[e],isLast:n===u.length-1,path:r,fakerArraySizes:a,fakerFormats:o,schemaTypes:s,onSizeChange:c,onFormatChange:l},e)})}),!m&&$(`div`,{class:`json-viewer-node-bracket ${f?`block`:`inline`}`,style:{marginLeft:f?`4px`:`20px`},children:[d?`]`:`}`,!n&&`,`]})]})}let m=String(t),h=`val-default`,g=typeof t;typeof t==`string`?(m=`"${t}"`,h=`val-string`,g=`String`):typeof t==`number`?(h=`val-number`,g=`Int32`):typeof t==`boolean`?(h=`val-boolean`,g=`Boolean`):t===null&&(m=`null`,h=`val-null`,g=`Null`);let _=s[i],v=!1;if(_&&t!==null){let e=typeof t;_===`string`&&e!==`string`&&(v=!0),(_===`number`||_===`integer`)&&e!==`number`&&(v=!0),_===`boolean`&&e!==`boolean`&&(v=!0)}return $(`div`,{class:`json-viewer-node primitive`,style:{marginLeft:r?`0`:`20px`},children:[$(`div`,{class:`json-viewer-node-left-col`,children:[$(`span`,{class:`json-viewer-node-arrow-placeholder`}),e&&$(`span`,{class:`json-viewer-node-key`,children:[e,`: `]}),$(`span`,{class:`json-viewer-node-val ${h}`,children:m}),!n&&$(`span`,{class:`json-viewer-node-comma`,children:`,`})]}),$(`div`,{class:`json-viewer-node-right-col`,children:[l&&$(`input`,{type:`text`,list:`faker-formats-list`,value:o[i]||``,onInput:e=>l(i,e.target.value),class:`faker-format-select`,title:`Search or select Faker format`,placeholder:`Auto`}),$(`div`,{class:`json-viewer-node-type-label ${v?`mismatch`:``}`,title:v?`Warning: Schema expected ${_}`:``,children:[v&&$(`span`,{class:`warning-icon`,children:`⚠️`}),g]})]})]})}function ze({jsonString:e,fakerArraySizes:t,fakerFormats:n,schemaTypes:r,onSizeChange:i,onFormatChange:a}){let o=null,s=!1;try{o=JSON.parse(e||`null`)}catch{s=!0}return s?$(`div`,{class:`compass-json-viewer-error`,children:`Invalid JSON`}):$(`div`,{class:`compass-json-viewer`,children:$(Re,{value:o,isLast:!0,isRoot:!0,fakerArraySizes:t,fakerFormats:n,schemaTypes:r,onSizeChange:i,onFormatChange:a})})}function Be({value:e,onChange:t,readOnly:n,schemaTypes:r}){let[i,a]=J(!0),[o,s]=J([]);return Y(()=>{try{let t=JSON.parse(e||`{}`);if(a(!0),r){let e=[],n=(t,i)=>{if(Array.isArray(t))t.forEach(e=>n(e,`${i}[]`));else if(typeof t==`object`&&t)for(let e of Object.keys(t))n(t[e],i===`root`?e:`${i}.${e}`);else{let n=r[i];if(n&&t!==null){let r=typeof t,a=!1;n===`string`&&r!==`string`&&(a=!0),(n===`number`||n===`integer`)&&r!==`number`&&(a=!0),n===`boolean`&&r!==`boolean`&&(a=!0),a&&e.push(`Type mismatch at "${i}": expected ${n}, got ${r}`)}}};n(t,`root`),s(e.slice(0,5))}}catch{a(!1),s([])}},[e,r]),$(`div`,{class:`code-editor ${i?`valid`:`invalid`}`,children:[$(`div`,{class:`code-body-wrap`,children:$(`div`,{class:`code-body`,children:[$(`pre`,{"aria-hidden":`true`,style:{userSelect:`none`},children:$(`code`,{dangerouslySetInnerHTML:{__html:Ne(e)}})}),$(`textarea`,{value:e,onInput:e=>t(e.target.value),onKeyDown:n=>{if(n.key===`Tab`){n.preventDefault();let r=n.target,i=r.selectionStart,a=r.selectionEnd;t(e.substring(0,i)+` `+e.substring(a)),setTimeout(()=>{r.selectionStart=r.selectionEnd=i+2},0)}},onScroll:e=>{let t=e.target,n=t.previousElementSibling;n&&(n.scrollTop=t.scrollTop,n.scrollLeft=t.scrollLeft)},spellcheck:!1,readOnly:n})]})}),o.length>0&&$(`div`,{class:`json-warnings`,children:[$(`div`,{class:`json-warnings-header`,children:`⚠️ Schema Type Mismatch:`}),o.map(e=>$(`div`,{class:`json-warnings-item`,children:[`• `,e]}))]})]})}function Ve({endpoint:e,isExpanded:t,onToggleExpand:n,onUpdateConfig:r,onRegenerateFaker:i,toast:a}){let o=e;return $(`div`,{class:`ep-card ${o.enabled?`mocked`:``} ${t?`expanded`:``}`,children:[$(`div`,{class:`ep-card-header`,onClick:n,children:[$(`span`,{class:`method-badge ${o.method.toLowerCase()}`,children:o.method}),$(`span`,{class:`ep-path`,children:o.path}),$(`span`,{class:`ep-summary`,children:o.summary}),$(`div`,{class:`spacer`}),$(`div`,{class:`toggle`,onClick:e=>{e.stopPropagation(),r(o.key,{enabled:!o.enabled})},children:[$(`input`,{type:`checkbox`,checked:o.enabled,readOnly:!0}),$(`div`,{class:`slider`})]}),$(`button`,{class:`expand-btn`,children:`▼`})]}),t&&$(`div`,{class:`ep-config`,children:[$(`div`,{class:`config-row`,children:[$(`label`,{children:`Status Code`}),$(`input`,{type:`number`,value:o.config?.statusCode||200,onChange:e=>r(o.key,{config:{...o.config,statusCode:parseInt(e.target.value)}})}),$(`label`,{class:`margin-left-16`,children:`Delay (ms)`}),$(`input`,{type:`number`,value:o.config?.delay||0,onChange:e=>r(o.key,{config:{...o.config,delay:parseInt(e.target.value)}})}),$(`label`,{class:`margin-left-16`,children:`Data Mode`}),$(`div`,{class:`segmented-control`,children:[$(`button`,{class:o.config?.mockMode===`faker`?``:`active`,onClick:()=>{r(o.key,{config:{...o.config,mockMode:`manual`,mockData:o.config?.mockData===void 0?o.mockExample||``:o.config.mockData}})},children:`Auto / Manual`}),$(`button`,{class:o.config?.mockMode===`faker`?`active`:``,onClick:()=>{let e=o.mockExampleFaker||``;try{let t=JSON.parse(e);t!==null&&(e=JSON.stringify(Q(t,o.config?.fakerArraySizes||{}),null,2))}catch{}r(o.key,{config:{...o.config,mockMode:`faker`,mockData:e}})},children:`Faker.js`})]})]}),$(`div`,{class:`config-row detail-row`,children:o.config?.mockMode===`faker`?$(`div`,{class:`faker-editor-section`,children:[$(`div`,{class:`section-title-bar`,children:[$(`div`,{children:[$(`h4`,{class:`section-title`,children:`Faker.js Data`}),$(`p`,{class:`section-description`,children:`Faker provides an initial random seed. You can edit it manually or regenerate it.`})]}),$(`button`,{class:`btn outline regenerate-btn`,onClick:()=>i(o.key),children:`Regenerate`})]}),$(ze,{jsonString:Pe(o),fakerArraySizes:o.config?.fakerArraySizes||{},fakerFormats:o.config?.fakerFormats||{},schemaTypes:o.schemaTypes||{},onSizeChange:(e,t)=>{let n={...o.config?.fakerArraySizes||{},[e]:t},i=o.config?.mockData||``;try{let e=JSON.parse(o.mockExampleFaker||`null`);e!==null&&(i=JSON.stringify(Q(e,n),null,2))}catch{}r(o.key,{config:{...o.config,fakerArraySizes:n,mockData:i}})},onFormatChange:(e,t)=>{r(o.key,{config:{...o.config,fakerFormats:{...o.config?.fakerFormats||{},[e]:t}}})}})]}):$(`div`,{class:`manual-editor-section`,children:[$(`div`,{class:`section-title-bar`,children:[$(`label`,{class:`section-title`,children:`Mock Data (JSON)`}),$(`button`,{class:`btn format-json-btn`,onClick:()=>{try{let e=o.config?.mockData===void 0?o.mockExample||``:o.config.mockData,t=JSON.stringify(JSON.parse(e),null,2);r(o.key,{config:{...o.config,mockData:t}}),a(`JSON Formatted!`,`success`)}catch{a(`Invalid JSON, cannot format`,`error`)}},children:`Format JSON`})]}),$(Be,{value:Pe(o),schemaTypes:o.schemaTypes||{},onChange:e=>r(o.key,{config:{...o.config,mockData:e,mockMode:`manual`}})})]})})]})]})}function He(){let[e,t]=J(`config`),{specSource:n,setSpecSource:r,tags:i,totalEndpoints:a,mockServerRunning:o,mockServerPort:s,loading:c,toastMsg:l,toast:u,expandedTags:d,toggleTag:f,expandedEndpoints:p,toggleEndpointExpansion:m,searchQuery:h,setSearchQuery:g,mockOnly:_,setMockOnly:v,filteredTags:y,enabledEndpoints:b,enabledCount:x,loadSpec:C,toggleMockServer:w,updateEndpointConfig:T,regenerateFakerForEndpoint:E,saveAndGenerate:D,wsEndpoints:O,addWsEndpoint:k,removeWsEndpoint:A,triggerWsEvent:j,fetchWsEndpoints:M}=Fe(),{testMethod:N,setTestMethod:P,testPath:F,setTestPath:I,testBody:L,setTestBody:R,testResponse:z,setTestResponse:ee,handleTestRequest:B}=Ie(s),[V,te]=J(``),[ne,H]=J(``),[U,re]=J(``),[W,G]=J(``),K=()=>{V.trim()&&(k(V.trim(),ne.trim()||void 0),te(``),H(``))};return Y(()=>{window.location.port===`3457`&&t(`test`)},[]),Y(()=>{if(e!==`ws`)return;let t=setInterval(()=>M(),3e3);return()=>clearInterval(t)},[e,M]),$(S,{children:[$(`div`,{id:`topbar`,class:`topbar`,children:[$(`div`,{class:`logo`,children:[$(`img`,{src:`/favicon.svg`,alt:`SpecShot Logo`,class:`logo-img`}),`SpecShot `,$(`span`,{children:`Mock`})]}),$(`div`,{class:`nav-tabs tabs-margin-left`,children:[$(`button`,{class:`nav-tab ${e===`config`?`active`:``}`,onClick:()=>t(`config`),children:`Configuration`}),$(`button`,{class:`nav-tab ${e===`test`?`active`:``}`,onClick:()=>t(`test`),children:`Test API`}),$(`button`,{class:`nav-tab ${e===`ws`?`active`:``}`,onClick:()=>t(`ws`),children:`WebSocket`})]}),$(`div`,{class:`spacer`}),e===`config`?$(S,{children:[$(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`OpenAPI URL or file path`}),$(`button`,{class:`btn`,onClick:()=>C(n),disabled:c,children:c?`Loading...`:`Load Spec`}),$(`div`,{class:`spacer-16`}),$(`button`,{class:`btn mock-server-btn ${o?`running`:``}`,onClick:w,children:[$(`span`,{class:`server-dot ${o?`on`:`off`}`}),o?`Stop Server`:`Start Server`]}),$(`button`,{class:`btn btn-primary`,onClick:D,disabled:i.length===0,children:`Save & Generate`})]}):$(S,{children:[$(`div`,{class:`server-port-display`,children:[$(`span`,{class:`server-dot ${o?`on`:`off`}`}),`Server Port: `,$(`span`,{class:`port-number`,children:s})]}),$(`div`,{class:`spacer-16`}),$(`button`,{class:`btn mock-server-btn ${o?`running`:``}`,onClick:w,children:o?`Stop Server`:`Start Server`})]})]}),e===`config`&&$(S,{children:[$(`div`,{class:`search-bar`,children:[$(`input`,{type:`text`,placeholder:`Filter endpoints...`,value:h,onInput:e=>g(e.target.value)}),$(`label`,{class:`mock-only-toggle`,children:[$(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),$(`span`,{children:`Mocked only`})]})]}),$(`div`,{class:`main`,children:[i.length>0&&$(`div`,{class:`summary-bar summary-flex`,children:[$(`div`,{class:`summary-stat`,children:[$(`span`,{class:`stat-value green`,children:x}),$(`span`,{class:`stat-label`,children:`Active Mocks`})]}),$(`div`,{class:`summary-stat`,children:[$(`span`,{class:`stat-value`,children:a-x}),$(`span`,{class:`stat-label`,children:`Passthrough`})]})]}),$(`div`,{id:`endpointList`,children:i.length===0?$(`div`,{class:`empty-state`,children:$(`p`,{children:[`Enter an OpenAPI spec source above and click`,` `,$(`strong`,{children:`Load Spec`})]})}):y.map(e=>$(`div`,{class:`tag-section ${d.has(e.tag)?`expanded`:``}`,children:[$(`div`,{class:`tag-section-header`,onClick:()=>f(e.tag),children:[$(`div`,{class:`chevron`,children:`▶`}),$(`div`,{class:`tag-name`,children:e.tag}),$(`div`,{class:`tag-count`,children:e.endpoints.length})]}),$(`div`,{class:`tag-section-body`,children:e.endpoints.map(e=>$(Ve,{endpoint:e,isExpanded:p.has(e.key),onToggleExpand:()=>m(e.key),onUpdateConfig:T,onRegenerateFaker:E,toast:u},e.key))})]},e.tag))})]})]}),e===`test`&&$(`div`,{class:`main test-view-container`,children:[$(`div`,{class:`test-left-col`,children:[$(`div`,{class:`section-header`,children:`Active Endpoints`}),$(`div`,{class:`active-endpoints-list`,children:b.length===0?$(`div`,{class:`empty-list-message`,children:`No mocked endpoints.`}):b.map(e=>{let t=`http://localhost:${s}${e.path}`;return $(`div`,{class:`ep-card active-endpoint-item ${F===e.path&&N===e.method.toUpperCase()?`selected`:``}`,onClick:()=>{P(e.method.toUpperCase()),I(e.path),e.method.toUpperCase()!==`GET`&&e.method.toUpperCase()!==`HEAD`?R(e.mockExample||`{}`):R(``)},children:[$(`span`,{class:`method-badge ${e.method.toLowerCase()}`,children:e.method}),$(`span`,{class:`ep-path`,children:e.path}),$(`span`,{class:`active-endpoint-status-check`,children:[`✓ `,e.config?.statusCode||200]}),$(`button`,{class:`btn ws-copy-btn`,title:`Copy URL`,onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t),u(`Copied `+t)},children:`⧉`})]},e.key)})})]}),$(`div`,{class:`test-right-col`,children:[$(`div`,{class:`section-header`,children:`Test API`}),$(`div`,{class:`test-api-panel`,children:[$(`div`,{class:`ws-trigger-url`,children:[$(`span`,{class:`form-label`,children:`Target`}),$(`code`,{children:F?`${N} http://localhost:${s}${F}`:`— pick an endpoint —`})]}),$(`div`,{class:`form-row select-row`,children:[$(`select`,{value:N,onChange:e=>P(e.target.value),class:`method-select`,children:[$(`option`,{children:`GET`}),$(`option`,{children:`POST`}),$(`option`,{children:`PUT`}),$(`option`,{children:`DELETE`}),$(`option`,{children:`PATCH`})]}),$(`select`,{onChange:e=>{let t=e.target.value;if(t){let[e,n]=t.split(`|`);P(e),I(n)}},class:`endpoint-picker`,children:[$(`option`,{value:``,children:`— pick endpoint —`}),b.map(e=>$(`option`,{value:`${e.method}|${e.path}`,children:[e.method,` `,e.path]},e.key))]})]}),$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Path`}),$(`input`,{type:`text`,value:F,onChange:e=>I(e.target.value),placeholder:`/api/users`,class:`path-input`})]}),$(`div`,{class:`form-row body-row`,children:[$(`label`,{class:`form-label`,children:`Body`}),$(Be,{value:L,onChange:R})]}),$(`div`,{class:`form-buttons-row`,children:[$(`button`,{class:`btn btn-primary`,onClick:B,disabled:!F.trim()||!o,children:`Send`}),$(`button`,{class:`btn`,onClick:()=>ee(null),children:`Clear`})]}),!o&&F&&$(`div`,{class:`ws-server-hint`,children:`Start the mock server to send requests.`}),z&&$(`div`,{class:`test-response-container`,children:z.error?$(`div`,{class:`response-error-message`,children:[`Error: `,z.error]}):$(S,{children:[$(`div`,{class:`response-status-title ${z.status>=400?`status-error`:`status-success`}`,children:[z.status,` `,z.statusText,` ·`,` `,z.ms,`ms`]}),$(`div`,{class:`response-body-pre`,children:z.body||`(empty)`})]})})]})]})]}),e===`ws`&&$(`div`,{class:`main test-view-container`,children:[$(`div`,{class:`test-left-col`,children:[$(`div`,{class:`section-header`,children:`Add Endpoint`}),$(`div`,{class:`test-api-panel`,children:[$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Path`}),$(`input`,{type:`text`,value:V,onInput:e=>te(e.target.value),placeholder:`/ws/events`,class:`path-input`,onKeyDown:e=>{e.key===`Enter`&&K()}})]}),$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Desc`}),$(`input`,{type:`text`,value:ne,onInput:e=>H(e.target.value),placeholder:`Optional description`,class:`path-input`,onKeyDown:e=>{e.key===`Enter`&&K()}})]}),$(`div`,{class:`form-buttons-row`,children:$(`button`,{class:`btn btn-primary`,onClick:K,disabled:!V.trim(),children:`Add Endpoint`})})]}),$(`div`,{class:`section-header`,style:`margin-top:24px`,children:`Endpoints`}),$(`div`,{class:`active-endpoints-list`,children:O.length===0?$(`div`,{class:`empty-list-message`,children:[`No WebSocket endpoints configured.`,$(`br`,{}),$(`small`,{children:`Add a path above to get started.`})]}):O.map(e=>{let t=`ws://localhost:${s}${e.path}`;return $(`div`,{class:`ep-card active-endpoint-item ws-ep-card ${U===e.path?`selected`:``}`,onClick:()=>{re(e.path),G(``)},children:[$(`div`,{class:`ws-ep-info`,children:[$(`span`,{class:`ep-path`,children:e.path}),$(`button`,{class:`btn ws-copy-btn`,title:`Copy WebSocket URL`,onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t),u(`Copied `+t)},children:`⧉`})]}),$(`span`,{class:`ws-connection-count`,children:[e.connections,` connected`]}),$(`button`,{class:`btn ws-remove-btn`,onClick:t=>{t.stopPropagation(),A(e.id)},children:`✕`})]},e.id)})})]}),$(`div`,{class:`test-right-col`,children:[$(`div`,{class:`section-header`,children:`Trigger Event`}),$(`div`,{class:`test-api-panel`,children:U?$(S,{children:[$(`div`,{class:`ws-trigger-url`,children:[$(`span`,{class:`form-label`,children:`Target`}),$(`code`,{children:[`ws://localhost:`,s,U]})]}),$(`div`,{class:`form-row body-row`,children:[$(`label`,{class:`form-label`,children:`Message`}),$(Be,{value:W,onChange:G})]}),$(`div`,{class:`form-buttons-row`,children:$(`button`,{class:`btn btn-primary`,onClick:()=>j(U,W||`{}`),disabled:!o,children:`Send Event`})}),!o&&$(`div`,{class:`ws-server-hint`,children:`Start the mock server to send events.`})]}):$(`div`,{class:`empty-list-message`,children:`Select an endpoint to trigger an event.`})})]})]}),$(`datalist`,{id:`faker-formats-list`,children:Z.filter(e=>e.value&&!e.value.startsWith(`---`)).map(e=>$(`option`,{value:e.value,children:e.label},e.value))}),l&&$(`div`,{class:`toast ${l.type}`,children:l.msg})]})}ne($(He,{}),document.getElementById(`app`));
+1
-1
{
"name": "specshot",
"version": "3.0.6",
"version": "3.0.7",
"description": "Fire an OpenAPI spec, get strictly-typed TypeScript code and a robust API mock server — zero-dependency, Zod-validated, and highly customizable.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -8,3 +8,3 @@ <!doctype html>

<title>SpecShot Dashboard</title>
<script type="module" crossorigin src="/assets/index-DHroxnRq.js"></script>
<script type="module" crossorigin src="/assets/index-B2SKdyJS.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DmGAqa2c.css">

@@ -11,0 +11,0 @@ </head>

(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function y(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return x(t,s,i,a,null)}function x(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t}function w(e,t){if(t==null)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?w(e):null}function T(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),I(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??w(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,R(i,o,a),n.__e=n.__=null,o.__e!=r&&E(o)}}function E(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),E(e)}function D(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!O.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(O)}function O(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,T(e)}finally{r.length=O.__r=0}}function k(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y,b=r&&r.__k||h,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||m,p.__i=d,v=I(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&B(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),(y=!!(4&p.__u))||f.__k===p.__k?(c=j(p,c,e,y),y&&f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=x(null,o,null,null,null):_(o)?o=e.__k[a]=x(S,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=w(s)),V(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=w(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function P(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function F(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function I(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,x,w,T,E,D,O,A,j,M,N=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof N==`function`)try{if(w=n.props,T=N.prototype&&N.prototype.render,E=(d=N.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?x=(f=n.__c=r.__c).__=f.__E:(T?n.__c=f=new N(w,D):(n.__c=f=new C(w,D),f.constructor=N,f.render=te),E&&E.sub(f),f.state||={},f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=v({},f.__s)),v(f.__s,N.getDerivedStateFromProps(w,f.__s))),m=f.props,g=f.state,f.__v=n,p)T&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&N.getDerivedStateFromProps==null&&w!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,D),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(w,f.__s,D)){n.__v!=r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,g,b)})}if(f.context=D,f.props=w,f.__P=e,f.__e=!1,O=t.__r,A=0,T)f.state=f.__s,f.__d=!1,O&&O(n),d=f.render(f.props,f.state,f.context),h.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(n),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++A<25);f.state=f.__s,f.getChildContext!=null&&(i=v(v({},i),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(m,g)),j=d!=null&&d.type===S&&d.key==null?z(d.props.children):d,c=k(e,_(j)?j:[j],n,r,i,a,o,s,c,l,u),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(n.__v=null,l||o!=null)if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,n.__e=c}else{for(M=o.length;M--;)y(o[M]);L(n)}else n.__e=r.__e,n.__k=r.__k,e.then||L(n);t.__e(e,n,r)}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=ee(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function L(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(L))}function R(e,n,r){for(var i=0;i<r.length;i++)B(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function z(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(z):e.constructor===void 0?v({},e):null}function ee(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,b,x=i.props||m,S=r.props,C=r.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(C==null)return document.createTextNode(S);n=document.createElementNS(o,C,S.is&&S),l&&=(t.__m&&t.__m(r,s),!1),s=null}if(C==null)x===S||l&&n.data==S||(n.data=S);else{if(s=C==`textarea`&&S.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(x={},d=0;d<n.attributes.length;d++)x[(g=n.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||P(n,d,null,g,o);for(d in S)g=S[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?b=g:l&&typeof g!=`function`||x[d]===g||P(n,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),k(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&w(i,0),l,u),s!=null)for(d=s.length;d--;)y(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||C==`progress`&&!v||C==`option`&&v!=x[d])&&P(n,d,v,x[d],o),d=`checked`,b!=null&&b!=n[d]&&P(n,d,b,x[d],o))}return n}function B(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function V(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||B(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&V(i[a],n,r||typeof e.type!=`function`);r||y(e.__e),e.__c=e.__=e.__e=void 0}function te(e,t,n){return this.constructor(e,n)}function ne(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],I(r,n=(!a&&i||r).__k=b(S,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),R(s,n,c)}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,C.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),D(this))},C.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),D(this))},C.prototype.render=S,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=F(!1),p=F(!0);var H,U,re,W,G=0,K=[],q=t,ie=q.__b,ae=q.__r,oe=q.diffed,se=q.__c,ce=q.unmount,le=q.__;function ue(e,t){q.__h&&q.__h(U,e,G||t),G=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return G=1,de(ve,e)}function de(e,t,n){var r=ue(H++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ve(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},U.shouldComponentUpdate=i}return r.__N||r.__}function Y(e,t){var n=ue(H++,3);!q.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function fe(e,t){var n=ue(H++,7);return _e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function pe(){for(var e;e=K.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(ge),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){U=null,ie&&ie(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),le&&le(e,t)},q.__r=function(e){ae&&ae(e),H=0;var t=(U=e.__c).__H;t&&(re===U?(t.__h=[],U.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(X),t.__h.some(ge),t.__h=[],H=0)),re=U},q.diffed=function(e){oe&&oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(K.push(t)!==1&&W===q.requestAnimationFrame||((W=q.requestAnimationFrame)||he)(pe)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),re=U=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(X),e.__h=e.__h.filter(function(e){return!e.__||ge(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),se&&se(e,t)},q.unmount=function(e){ce&&ce(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{X(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var me=typeof requestAnimationFrame==`function`;function he(e){var t,n=function(){clearTimeout(r),me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);me&&(t=requestAnimationFrame(n))}function X(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function ge(e){var t=U;e.__c=e.__(),U=t}function _e(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ve(e,t){return typeof t==`function`?t(e):t}async function ye(){let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to fetch config`);return e.json()}async function be(e){if(!(await fetch(`/api/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({endpoints:e})})).ok)throw Error(`Failed to save config`)}async function xe(){let e=await fetch(`/api/mock-server`);if(!e.ok)throw Error(`Failed to fetch mock server status`);return e.json()}async function Se(e,t){let n=await fetch(`/api/mock-server`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e,port:t})}),r=await n.json();if(!n.ok)throw Error(r.error||`Failed to ${e} mock server`);return r}async function Ce(e){let t=await fetch(`/api/spec?source=`+encodeURIComponent(e)),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to load spec`);return n}async function we(e){let t=await fetch(`/api/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to generate handlers`);return n}async function Te(e){let t=await fetch(`/api/regenerate-faker`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok||n.error)throw Error(n.error||`Failed to regenerate faker data`);return n}async function Ee(e,t,n){let r={method:e,headers:{}};n&&e!==`GET`&&e!==`HEAD`&&(r.headers[`Content-Type`]=`application/json`,r.body=n);let i=await fetch(t,r),a=await i.text();return{status:i.status,statusText:i.statusText,body:a}}async function De(){let e=await fetch(`/api/websocket`);if(!e.ok)throw Error(`Failed to fetch WebSocket endpoints`);return e.json()}async function Oe(e){let t=await fetch(`/api/websocket`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to save WebSocket endpoint`);return n}async function ke(e){let t=await fetch(`/api/websocket?id=${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json();if(!t.ok)throw Error(n.error||`Failed to delete WebSocket endpoint`);return n}async function Ae(e){let t=await fetch(`/api/websocket/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json();if(!t.ok&&!n.sent)throw Error(n.error||`Failed to trigger WebSocket event`);return n}var Z=[{value:``,label:`Auto`},{value:`person.firstName`,label:`person.firstName`},{value:`person.lastName`,label:`person.lastName`},{value:`person.fullName`,label:`person.fullName`},{value:`person.jobTitle`,label:`person.jobTitle`},{value:`person.avatar`,label:`person.avatar`},{value:`internet.email`,label:`internet.email`},{value:`internet.url`,label:`internet.url`},{value:`internet.userName`,label:`internet.userName`},{value:`internet.password`,label:`internet.password`},{value:`internet.ip`,label:`internet.ip`},{value:`internet.ipv6`,label:`internet.ipv6`},{value:`string.uuid`,label:`string.uuid`},{value:`string.alpha`,label:`string.alpha`},{value:`string.numeric`,label:`string.numeric`},{value:`date.recent`,label:`date.recent`},{value:`date.past`,label:`date.past`},{value:`date.future`,label:`date.future`},{value:`date.birthdate`,label:`date.birthdate`},{value:`lorem.word`,label:`lorem.word`},{value:`lorem.words`,label:`lorem.words`},{value:`lorem.sentence`,label:`lorem.sentence`},{value:`lorem.paragraph`,label:`lorem.paragraph`},{value:`lorem.text`,label:`lorem.text`},{value:`location.city`,label:`location.city`},{value:`location.country`,label:`location.country`},{value:`location.streetAddress`,label:`location.streetAddress`},{value:`location.zipCode`,label:`location.zipCode`},{value:`location.state`,label:`location.state`},{value:`phone.number`,label:`phone.number`},{value:`commerce.productName`,label:`commerce.productName`},{value:`commerce.price`,label:`commerce.price`},{value:`commerce.productDescription`,label:`commerce.productDescription`},{value:`commerce.department`,label:`commerce.department`},{value:`image.url`,label:`image.url`},{value:`image.avatar`,label:`image.avatar`},{value:`number.int`,label:`number.int`},{value:`number.float`,label:`number.float`},{value:`finance.amount`,label:`finance.amount`},{value:`finance.currencyCode`,label:`finance.currencyCode`},{value:`finance.accountNumber`,label:`finance.accountNumber`},{value:`company.name`,label:`company.name`},{value:`company.catchPhrase`,label:`company.catchPhrase`},{value:`animal.type`,label:`animal.type`},{value:`color.human`,label:`color.human`}];function je(e){let t=Z.length;for(let e=t-1;e>=0;e--)Z[e].value.startsWith(`plugin:`)&&Z.splice(e,1);if(e&&e.length>0){Z.push({value:`---`,label:`--- Plugins ---`});for(let t of e)Z.push({value:`plugin:${t}`,label:`Plugin: ${t}`})}}function Me(e){return e?e.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(e){let t=`hl-n`;return/^"/.test(e)?t=/:$/.test(e)?`hl-k`:`hl-s`:/true|false/.test(e)?t=`hl-b`:/null/.test(e)&&(t=`hl-p`),`<span class="`+t+`">`+e+`</span>`}):``}function Q(e,t,n=`root`){if(Array.isArray(e)){if(e.length===0)return[];let r=t[n]??(n===`root`?t.root??3:3),i=[];for(let a=0;a<r;a++){let r=Q(a<e.length?e[a]:e[0],t,`${n}[]`),o=JSON.parse(JSON.stringify(r));a>=e.length&&o&&typeof o==`object`&&o.id&&(typeof o.id==`number`?o.id+=a:typeof o.id==`string`&&(o.id=o.id.replace(/-[a-z0-9]+$/,`-${a}`))),i.push(o)}return i}else if(typeof e==`object`&&e){let r={};for(let i of Object.keys(e)){let a=n===`root`?i:`${n}.${i}`;r[i]=Q(e[i],t,a)}return r}return e}function Ne(e){if(e.config?.mockMode===`faker`){try{let t=JSON.parse(e.mockExampleFaker||`null`);if(t!==null){let n=Q(t,e.config.fakerArraySizes||{});return JSON.stringify(n,null,2)}}catch{}return e.mockExampleFaker||``}return e.config?.mockData===void 0?e.mockExample||``:e.config.mockData}function Pe(){let[e,t]=J(``),[n,r]=J(``),[i,a]=J([]),[o,s]=J(0),[c,l]=J(!1),[u,d]=J(3457),[f,p]=J(!1),[m,h]=J(null),[g,_]=J(new Set),[v,y]=J(new Set),[b,x]=J(``),[S,C]=J(!1),[w,T]=J([]),E=(e,t=`success`)=>{h({msg:e,type:t}),setTimeout(()=>h(null),3e3)};Y(()=>{ye().then(e=>{e.specSource&&t(e.specSource),e.outputDir&&r(e.outputDir),e.specSource&&D(e.specSource)}).catch(console.error),xe().then(e=>{l(e.running),e.port&&d(e.port)}).catch(console.error),De().then(e=>T(e.endpoints)).catch(console.error)},[]),Y(()=>{if(i.length===0)return;let e=setTimeout(()=>{let e={};i.forEach(t=>{t.endpoints.forEach(t=>{(t.enabled||t.config)&&(e[t.key]={enabled:t.enabled,tag:t.tag,operationId:t.operationId,method:t.method,path:t.path,statusCode:t.config?.statusCode||200,delay:t.config?.delay||0,mockData:t.config?.mockData===void 0?t.mockExample||``:t.config.mockData,mockMode:t.config?.mockMode||`auto`,fakerArraySize:t.config?.fakerArraySize||3,fakerArraySizes:t.config?.fakerArraySizes||{},fakerFormats:t.config?.fakerFormats||{},errorEnabled:t.config?.errorEnabled,errorStatus:t.config?.errorStatus,errorBody:t.config?.errorBody})})}),be(e).catch(console.error)},500);return()=>clearTimeout(e)},[i]);let D=async e=>{if(e){p(!0);try{let t=await Ce(e);t.availablePlugins&&je(t.availablePlugins),a(t.tags.map(e=>({...e,endpoints:e.endpoints.map(e=>{if(e.config?.mockData)try{e.config.mockData=JSON.stringify(JSON.parse(e.config.mockData),null,2)}catch{}if(e.mockExample)try{e.mockExample=JSON.stringify(JSON.parse(e.mockExample),null,2)}catch{}return e})}))),s(t.totalEndpoints),_(new Set([t.tags[0]?.tag])),E(`Loaded ${t.totalEndpoints} endpoints`)}catch(e){E(e.message,`error`)}finally{p(!1)}}},O=async()=>{let e=c?`stop`:`start`;try{let t=await Se(e,u);l(t.running),t.port&&d(t.port),E(`Mock server ${t.running?`started`:`stopped`}`)}catch(e){E(e.message,`error`)}},k=e=>{let t=new Set(g);t.has(e)?t.delete(e):t.add(e),_(t)},A=e=>{let t=new Set(v);t.has(e)?t.delete(e):t.add(e),y(t)},j=(e,t)=>{a(n=>n.map(n=>({...n,endpoints:n.endpoints.map(n=>n.key===e?{...n,...t}:n)})))},M=async t=>{let n=i.flatMap(e=>e.endpoints).find(e=>e.key===t);if(n)try{E(`Regenerating...`,`info`);let t=await Te({specSource:e,key:n.key,fakerArraySizes:n.config?.fakerArraySizes||{},fakerFormats:n.config?.fakerFormats||{}});if(t.mockExampleFaker){a(i.map(e=>({...e,endpoints:e.endpoints.map(e=>e.key===n.key?{...e,mockExampleFaker:t.mockExampleFaker}:e)})));let e=n.config?.mockData||``;try{let r=JSON.parse(t.mockExampleFaker||`null`);r!==null&&(e=JSON.stringify(Q(r,n.config?.fakerArraySizes||{}),null,2))}catch{}j(n.key,{config:{...n.config,mockData:e}}),E(`Regenerated successfully!`,`success`)}}catch(e){E(e.message||`Failed to regenerate`,`error`)}},N=async()=>{let t={};i.forEach(e=>{e.endpoints.forEach(e=>{(e.enabled||e.config)&&(t[e.key]={enabled:e.enabled,tag:e.tag,operationId:e.operationId,method:e.method,path:e.path,...e.config||{}})})});try{E(`Generated ${(await we({specSource:e,outputDir:n,endpoints:t})).handlersGenerated} handlers`)}catch(e){E(e.message,`error`)}},P=fe(()=>{let e=b.toLowerCase();return i.map(t=>({...t,endpoints:t.endpoints.filter(n=>S&&!n.enabled?!1:e?n.path.toLowerCase().includes(e)||n.method.toLowerCase().includes(e)||(n.summary||``).toLowerCase().includes(e)||t.tag.toLowerCase().includes(e):!0)})).filter(e=>e.endpoints.length>0)},[i,b,S]),F=fe(()=>{let e=[];return i.forEach(t=>{t.endpoints.forEach(t=>{t.enabled&&e.push(t)})}),e},[i]),I=F.length,L=async()=>{try{T((await De()).endpoints)}catch(e){E(e.message,`error`)}};return{specSource:e,setSpecSource:t,outputDir:n,tags:i,setTags:a,totalEndpoints:o,mockServerRunning:c,mockServerPort:u,loading:f,toastMsg:m,toast:E,expandedTags:g,toggleTag:k,expandedEndpoints:v,toggleEndpointExpansion:A,searchQuery:b,setSearchQuery:x,mockOnly:S,setMockOnly:C,filteredTags:P,enabledEndpoints:F,enabledCount:I,wsEndpoints:w,fetchWsEndpoints:L,addWsEndpoint:async(e,t)=>{try{await Oe({path:e,description:t}),await L(),E(`WebSocket endpoint added`)}catch(e){E(e.message,`error`)}},removeWsEndpoint:async e=>{try{await ke(e),await L(),E(`WebSocket endpoint removed`)}catch(e){E(e.message,`error`)}},triggerWsEvent:async(e,t)=>{try{let n=await Ae({path:e,message:t});E(`Event sent to ${n.sent} client(s) on ${n.path}`)}catch(e){E(e.message,`error`)}},loadSpec:D,toggleMockServer:O,updateEndpointConfig:j,regenerateFakerForEndpoint:M,saveAndGenerate:N}}function Fe(e){let[t,n]=J(`GET`),[r,i]=J(``),[a,o]=J(``),[s,c]=J(null);return{testMethod:t,setTestMethod:n,testPath:r,setTestPath:i,testBody:a,setTestBody:o,testResponse:s,setTestResponse:c,handleTestRequest:async()=>{c(null);let n=performance.now(),i=`http://localhost:${e}`;try{let e=await Ee(t,`${i}${r}`,a),o=e.body;try{o=JSON.stringify(JSON.parse(e.body),null,2)}catch{}c({status:e.status,statusText:e.statusText,ms:Math.round(performance.now()-n),body:o})}catch(e){c({status:0,statusText:`Error`,ms:Math.round(performance.now()-n),body:``,error:e.message})}}}}var Ie=0;Array.isArray;function $(e,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ie,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function Le({name:e,value:t,isLast:n,isRoot:r=!1,path:i=`root`,fakerArraySizes:a={},fakerFormats:o={},schemaTypes:s={},onSizeChange:c,onFormatChange:l}){let u=typeof t==`object`&&!!t,d=Array.isArray(t),[f,p]=J(!0);if(u){let u=Object.keys(t),m=u.length===0;return $(`div`,{class:`json-viewer-node`,style:{marginLeft:r?`0`:`20px`},children:[$(`div`,{class:`json-viewer-node-row`,children:[!m&&$(`span`,{onClick:()=>p(!f),class:`json-viewer-node-arrow`,children:f?`▼`:`▶`}),m&&$(`span`,{class:`json-viewer-node-arrow-placeholder`}),$(`div`,{class:`json-viewer-node-content`,children:[e&&$(`span`,{class:`json-viewer-node-key`,children:[e,`: `]}),$(`span`,{class:`json-viewer-node-type-indicator`,style:{marginLeft:e?`4px`:`0`},children:[d?`Array(${u.length}) `:`Object `,m?d?`[]`:`{}`:d?`[`:`{`]}),d&&c&&$(`div`,{class:`json-viewer-node-size-controls`,children:[$(`span`,{class:`size-label`,children:`size:`}),$(`input`,{type:`number`,min:`1`,max:`100`,value:a[i]??(i===`root`?a.root??3:3),onChange:e=>c(i,parseInt(e.target.value)||1),class:`size-input`})]})]})]}),f&&!m&&$(`div`,{class:`json-viewer-node-children`,children:u.map((e,n)=>{let r=d?`${i}[]`:i===`root`?e:`${i}.${e}`;return $(Le,{name:d?void 0:e,value:t[e],isLast:n===u.length-1,path:r,fakerArraySizes:a,fakerFormats:o,schemaTypes:s,onSizeChange:c,onFormatChange:l},e)})}),!m&&$(`div`,{class:`json-viewer-node-bracket ${f?`block`:`inline`}`,style:{marginLeft:f?`4px`:`20px`},children:[d?`]`:`}`,!n&&`,`]})]})}let m=String(t),h=`val-default`,g=typeof t;typeof t==`string`?(m=`"${t}"`,h=`val-string`,g=`String`):typeof t==`number`?(h=`val-number`,g=`Int32`):typeof t==`boolean`?(h=`val-boolean`,g=`Boolean`):t===null&&(m=`null`,h=`val-null`,g=`Null`);let _=s[i],v=!1;if(_&&t!==null){let e=typeof t;_===`string`&&e!==`string`&&(v=!0),(_===`number`||_===`integer`)&&e!==`number`&&(v=!0),_===`boolean`&&e!==`boolean`&&(v=!0)}return $(`div`,{class:`json-viewer-node primitive`,style:{marginLeft:r?`0`:`20px`},children:[$(`div`,{class:`json-viewer-node-left-col`,children:[$(`span`,{class:`json-viewer-node-arrow-placeholder`}),e&&$(`span`,{class:`json-viewer-node-key`,children:[e,`: `]}),$(`span`,{class:`json-viewer-node-val ${h}`,children:m}),!n&&$(`span`,{class:`json-viewer-node-comma`,children:`,`})]}),$(`div`,{class:`json-viewer-node-right-col`,children:[l&&$(`input`,{type:`text`,list:`faker-formats-list`,value:o[i]||``,onInput:e=>l(i,e.target.value),class:`faker-format-select`,title:`Search or select Faker format`,placeholder:`Auto`}),$(`div`,{class:`json-viewer-node-type-label ${v?`mismatch`:``}`,title:v?`Warning: Schema expected ${_}`:``,children:[v&&$(`span`,{class:`warning-icon`,children:`⚠️`}),g]})]})]})}function Re({jsonString:e,fakerArraySizes:t,fakerFormats:n,schemaTypes:r,onSizeChange:i,onFormatChange:a}){let o=null,s=!1;try{o=JSON.parse(e||`null`)}catch{s=!0}return s?$(`div`,{class:`compass-json-viewer-error`,children:`Invalid JSON`}):$(`div`,{class:`compass-json-viewer`,children:$(Le,{value:o,isLast:!0,isRoot:!0,fakerArraySizes:t,fakerFormats:n,schemaTypes:r,onSizeChange:i,onFormatChange:a})})}function ze({value:e,onChange:t,readOnly:n,schemaTypes:r}){let[i,a]=J(!0),[o,s]=J([]);return Y(()=>{try{let t=JSON.parse(e||`{}`);if(a(!0),r){let e=[],n=(t,i)=>{if(Array.isArray(t))t.forEach(e=>n(e,`${i}[]`));else if(typeof t==`object`&&t)for(let e of Object.keys(t))n(t[e],i===`root`?e:`${i}.${e}`);else{let n=r[i];if(n&&t!==null){let r=typeof t,a=!1;n===`string`&&r!==`string`&&(a=!0),(n===`number`||n===`integer`)&&r!==`number`&&(a=!0),n===`boolean`&&r!==`boolean`&&(a=!0),a&&e.push(`Type mismatch at "${i}": expected ${n}, got ${r}`)}}};n(t,`root`),s(e.slice(0,5))}}catch{a(!1),s([])}},[e,r]),$(`div`,{class:`code-editor ${i?`valid`:`invalid`}`,children:[$(`div`,{class:`code-body-wrap`,children:$(`div`,{class:`code-body`,children:[$(`pre`,{"aria-hidden":`true`,style:{userSelect:`none`},children:$(`code`,{dangerouslySetInnerHTML:{__html:Me(e)}})}),$(`textarea`,{value:e,onInput:e=>t(e.target.value),onKeyDown:n=>{if(n.key===`Tab`){n.preventDefault();let r=n.target,i=r.selectionStart,a=r.selectionEnd;t(e.substring(0,i)+` `+e.substring(a)),setTimeout(()=>{r.selectionStart=r.selectionEnd=i+2},0)}},onScroll:e=>{let t=e.target,n=t.previousElementSibling;n&&(n.scrollTop=t.scrollTop,n.scrollLeft=t.scrollLeft)},spellcheck:!1,readOnly:n})]})}),o.length>0&&$(`div`,{class:`json-warnings`,children:[$(`div`,{class:`json-warnings-header`,children:`⚠️ Schema Type Mismatch:`}),o.map(e=>$(`div`,{class:`json-warnings-item`,children:[`• `,e]}))]})]})}function Be({endpoint:e,isExpanded:t,onToggleExpand:n,onUpdateConfig:r,onRegenerateFaker:i,toast:a}){let o=e;return $(`div`,{class:`ep-card ${o.enabled?`mocked`:``} ${t?`expanded`:``}`,children:[$(`div`,{class:`ep-card-header`,onClick:n,children:[$(`span`,{class:`method-badge ${o.method.toLowerCase()}`,children:o.method}),$(`span`,{class:`ep-path`,children:o.path}),$(`span`,{class:`ep-summary`,children:o.summary}),$(`div`,{class:`spacer`}),$(`div`,{class:`toggle`,onClick:e=>{e.stopPropagation(),r(o.key,{enabled:!o.enabled})},children:[$(`input`,{type:`checkbox`,checked:o.enabled,readOnly:!0}),$(`div`,{class:`slider`})]}),$(`button`,{class:`expand-btn`,children:`▼`})]}),t&&$(`div`,{class:`ep-config`,children:[$(`div`,{class:`config-row`,children:[$(`label`,{children:`Status Code`}),$(`input`,{type:`number`,value:o.config?.statusCode||200,onChange:e=>r(o.key,{config:{...o.config,statusCode:parseInt(e.target.value)}})}),$(`label`,{class:`margin-left-16`,children:`Delay (ms)`}),$(`input`,{type:`number`,value:o.config?.delay||0,onChange:e=>r(o.key,{config:{...o.config,delay:parseInt(e.target.value)}})}),$(`label`,{class:`margin-left-16`,children:`Data Mode`}),$(`div`,{class:`segmented-control`,children:[$(`button`,{class:o.config?.mockMode===`faker`?``:`active`,onClick:()=>{r(o.key,{config:{...o.config,mockMode:`manual`,mockData:o.config?.mockData===void 0?o.mockExample||``:o.config.mockData}})},children:`Auto / Manual`}),$(`button`,{class:o.config?.mockMode===`faker`?`active`:``,onClick:()=>{let e=o.mockExampleFaker||``;try{let t=JSON.parse(e);t!==null&&(e=JSON.stringify(Q(t,o.config?.fakerArraySizes||{}),null,2))}catch{}r(o.key,{config:{...o.config,mockMode:`faker`,mockData:e}})},children:`Faker.js`})]})]}),$(`div`,{class:`config-row detail-row`,children:o.config?.mockMode===`faker`?$(`div`,{class:`faker-editor-section`,children:[$(`div`,{class:`section-title-bar`,children:[$(`div`,{children:[$(`h4`,{class:`section-title`,children:`Faker.js Data`}),$(`p`,{class:`section-description`,children:`Faker provides an initial random seed. You can edit it manually or regenerate it.`})]}),$(`button`,{class:`btn outline regenerate-btn`,onClick:()=>i(o.key),children:`Regenerate`})]}),$(Re,{jsonString:Ne(o),fakerArraySizes:o.config?.fakerArraySizes||{},fakerFormats:o.config?.fakerFormats||{},schemaTypes:o.schemaTypes||{},onSizeChange:(e,t)=>{let n={...o.config?.fakerArraySizes||{},[e]:t},i=o.config?.mockData||``;try{let e=JSON.parse(o.mockExampleFaker||`null`);e!==null&&(i=JSON.stringify(Q(e,n),null,2))}catch{}r(o.key,{config:{...o.config,fakerArraySizes:n,mockData:i}})},onFormatChange:(e,t)=>{r(o.key,{config:{...o.config,fakerFormats:{...o.config?.fakerFormats||{},[e]:t}}})}})]}):$(`div`,{class:`manual-editor-section`,children:[$(`div`,{class:`section-title-bar`,children:[$(`label`,{class:`section-title`,children:`Mock Data (JSON)`}),$(`button`,{class:`btn format-json-btn`,onClick:()=>{try{let e=o.config?.mockData===void 0?o.mockExample||``:o.config.mockData,t=JSON.stringify(JSON.parse(e),null,2);r(o.key,{config:{...o.config,mockData:t}}),a(`JSON Formatted!`,`success`)}catch{a(`Invalid JSON, cannot format`,`error`)}},children:`Format JSON`})]}),$(ze,{value:Ne(o),schemaTypes:o.schemaTypes||{},onChange:e=>r(o.key,{config:{...o.config,mockData:e,mockMode:`manual`}})})]})})]})]})}function Ve(){let[e,t]=J(`config`),{specSource:n,setSpecSource:r,tags:i,totalEndpoints:a,mockServerRunning:o,mockServerPort:s,loading:c,toastMsg:l,toast:u,expandedTags:d,toggleTag:f,expandedEndpoints:p,toggleEndpointExpansion:m,searchQuery:h,setSearchQuery:g,mockOnly:_,setMockOnly:v,filteredTags:y,enabledEndpoints:b,enabledCount:x,loadSpec:C,toggleMockServer:w,updateEndpointConfig:T,regenerateFakerForEndpoint:E,saveAndGenerate:D,wsEndpoints:O,addWsEndpoint:k,removeWsEndpoint:A,triggerWsEvent:j,fetchWsEndpoints:M}=Pe(),{testMethod:N,setTestMethod:P,testPath:F,setTestPath:I,testBody:L,setTestBody:R,testResponse:z,setTestResponse:ee,handleTestRequest:B}=Fe(s),[V,te]=J(``),[ne,H]=J(``),[U,re]=J(``),[W,G]=J(``),K=()=>{V.trim()&&(k(V.trim(),ne.trim()||void 0),te(``),H(``))};return Y(()=>{window.location.port===`3457`&&t(`test`)},[]),Y(()=>{if(e!==`ws`)return;let t=setInterval(()=>M(),3e3);return()=>clearInterval(t)},[e,M]),$(S,{children:[$(`div`,{id:`topbar`,class:`topbar`,children:[$(`div`,{class:`logo`,children:[$(`img`,{src:`/favicon.svg`,alt:`SpecShot Logo`,class:`logo-img`}),`SpecShot `,$(`span`,{children:`Mock`})]}),$(`div`,{class:`nav-tabs tabs-margin-left`,children:[$(`button`,{class:`nav-tab ${e===`config`?`active`:``}`,onClick:()=>t(`config`),children:`Configuration`}),$(`button`,{class:`nav-tab ${e===`test`?`active`:``}`,onClick:()=>t(`test`),children:`Test API`}),$(`button`,{class:`nav-tab ${e===`ws`?`active`:``}`,onClick:()=>t(`ws`),children:`WebSocket`})]}),$(`div`,{class:`spacer`}),e===`config`?$(S,{children:[$(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`OpenAPI URL or file path`}),$(`button`,{class:`btn`,onClick:()=>C(n),disabled:c,children:c?`Loading...`:`Load Spec`}),$(`div`,{class:`spacer-16`}),$(`button`,{class:`btn mock-server-btn ${o?`running`:``}`,onClick:w,children:[$(`span`,{class:`server-dot ${o?`on`:`off`}`}),o?`Stop Server`:`Start Server`]}),$(`button`,{class:`btn btn-primary`,onClick:D,disabled:i.length===0,children:`Save & Generate`})]}):$(S,{children:[$(`div`,{class:`server-port-display`,children:[$(`span`,{class:`server-dot ${o?`on`:`off`}`}),`Server Port: `,$(`span`,{class:`port-number`,children:s})]}),$(`div`,{class:`spacer-16`}),$(`button`,{class:`btn mock-server-btn ${o?`running`:``}`,onClick:w,children:o?`Stop Server`:`Start Server`})]})]}),e===`config`&&$(S,{children:[$(`div`,{class:`search-bar`,children:[$(`input`,{type:`text`,placeholder:`Filter endpoints...`,value:h,onInput:e=>g(e.target.value)}),$(`label`,{class:`mock-only-toggle`,children:[$(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),$(`span`,{children:`Mocked only`})]})]}),$(`div`,{class:`main`,children:[i.length>0&&$(`div`,{class:`summary-bar summary-flex`,children:[$(`div`,{class:`summary-stat`,children:[$(`span`,{class:`stat-value green`,children:x}),$(`span`,{class:`stat-label`,children:`Active Mocks`})]}),$(`div`,{class:`summary-stat`,children:[$(`span`,{class:`stat-value`,children:a-x}),$(`span`,{class:`stat-label`,children:`Passthrough`})]})]}),$(`div`,{id:`endpointList`,children:i.length===0?$(`div`,{class:`empty-state`,children:$(`p`,{children:[`Enter an OpenAPI spec source above and click`,` `,$(`strong`,{children:`Load Spec`})]})}):y.map(e=>$(`div`,{class:`tag-section ${d.has(e.tag)?`expanded`:``}`,children:[$(`div`,{class:`tag-section-header`,onClick:()=>f(e.tag),children:[$(`div`,{class:`chevron`,children:`▶`}),$(`div`,{class:`tag-name`,children:e.tag}),$(`div`,{class:`tag-count`,children:e.endpoints.length})]}),$(`div`,{class:`tag-section-body`,children:e.endpoints.map(e=>$(Be,{endpoint:e,isExpanded:p.has(e.key),onToggleExpand:()=>m(e.key),onUpdateConfig:T,onRegenerateFaker:E,toast:u},e.key))})]},e.tag))})]})]}),e===`test`&&$(`div`,{class:`main test-view-container`,children:[$(`div`,{class:`test-left-col`,children:[$(`div`,{class:`section-header`,children:`Active Endpoints`}),$(`div`,{class:`active-endpoints-list`,children:b.length===0?$(`div`,{class:`empty-list-message`,children:`No mocked endpoints.`}):b.map(e=>{let t=`http://localhost:${s}${e.path}`;return $(`div`,{class:`ep-card active-endpoint-item ${F===e.path&&N===e.method.toUpperCase()?`selected`:``}`,onClick:()=>{P(e.method.toUpperCase()),I(e.path),e.method.toUpperCase()!==`GET`&&e.method.toUpperCase()!==`HEAD`?R(e.mockExample||`{}`):R(``)},children:[$(`span`,{class:`method-badge ${e.method.toLowerCase()}`,children:e.method}),$(`span`,{class:`ep-path`,children:e.path}),$(`span`,{class:`active-endpoint-status-check`,children:[`✓ `,e.config?.statusCode||200]}),$(`button`,{class:`btn ws-copy-btn`,title:`Copy URL`,onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t),u(`Copied `+t)},children:`⧉`})]},e.key)})})]}),$(`div`,{class:`test-right-col`,children:[$(`div`,{class:`section-header`,children:`Test API`}),$(`div`,{class:`test-api-panel`,children:[$(`div`,{class:`ws-trigger-url`,children:[$(`span`,{class:`form-label`,children:`Target`}),$(`code`,{children:F?`${N} http://localhost:${s}${F}`:`— pick an endpoint —`})]}),$(`div`,{class:`form-row select-row`,children:[$(`select`,{value:N,onChange:e=>P(e.target.value),class:`method-select`,children:[$(`option`,{children:`GET`}),$(`option`,{children:`POST`}),$(`option`,{children:`PUT`}),$(`option`,{children:`DELETE`}),$(`option`,{children:`PATCH`})]}),$(`select`,{onChange:e=>{let t=e.target.value;if(t){let[e,n]=t.split(`|`);P(e),I(n)}},class:`endpoint-picker`,children:[$(`option`,{value:``,children:`— pick endpoint —`}),b.map(e=>$(`option`,{value:`${e.method}|${e.path}`,children:[e.method,` `,e.path]},e.key))]})]}),$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Path`}),$(`input`,{type:`text`,value:F,onChange:e=>I(e.target.value),placeholder:`/api/users`,class:`path-input`})]}),$(`div`,{class:`form-row body-row`,children:[$(`label`,{class:`form-label`,children:`Body`}),$(ze,{value:L,onChange:R})]}),$(`div`,{class:`form-buttons-row`,children:[$(`button`,{class:`btn btn-primary`,onClick:B,disabled:!F.trim()||!o,children:`Send`}),$(`button`,{class:`btn`,onClick:()=>ee(null),children:`Clear`})]}),!o&&F&&$(`div`,{class:`ws-server-hint`,children:`Start the mock server to send requests.`}),z&&$(`div`,{class:`test-response-container`,children:z.error?$(`div`,{class:`response-error-message`,children:[`Error: `,z.error]}):$(S,{children:[$(`div`,{class:`response-status-title ${z.status>=400?`status-error`:`status-success`}`,children:[z.status,` `,z.statusText,` ·`,` `,z.ms,`ms`]}),$(`div`,{class:`response-body-pre`,children:z.body||`(empty)`})]})})]})]})]}),e===`ws`&&$(`div`,{class:`main test-view-container`,children:[$(`div`,{class:`test-left-col`,children:[$(`div`,{class:`section-header`,children:`Add Endpoint`}),$(`div`,{class:`test-api-panel`,children:[$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Path`}),$(`input`,{type:`text`,value:V,onInput:e=>te(e.target.value),placeholder:`/ws/events`,class:`path-input`,onKeyDown:e=>{e.key===`Enter`&&K()}})]}),$(`div`,{class:`form-row input-row`,children:[$(`label`,{class:`form-label`,children:`Desc`}),$(`input`,{type:`text`,value:ne,onInput:e=>H(e.target.value),placeholder:`Optional description`,class:`path-input`,onKeyDown:e=>{e.key===`Enter`&&K()}})]}),$(`div`,{class:`form-buttons-row`,children:$(`button`,{class:`btn btn-primary`,onClick:K,disabled:!V.trim(),children:`Add Endpoint`})})]}),$(`div`,{class:`section-header`,style:`margin-top:24px`,children:`Endpoints`}),$(`div`,{class:`active-endpoints-list`,children:O.length===0?$(`div`,{class:`empty-list-message`,children:[`No WebSocket endpoints configured.`,$(`br`,{}),$(`small`,{children:`Add a path above to get started.`})]}):O.map(e=>{let t=`ws://localhost:${s}${e.path}`;return $(`div`,{class:`ep-card active-endpoint-item ws-ep-card ${U===e.path?`selected`:``}`,onClick:()=>{re(e.path),G(``)},children:[$(`div`,{class:`ws-ep-info`,children:[$(`span`,{class:`ep-path`,children:e.path}),$(`button`,{class:`btn ws-copy-btn`,title:`Copy WebSocket URL`,onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t),u(`Copied `+t)},children:`⧉`})]}),$(`span`,{class:`ws-connection-count`,children:[e.connections,` connected`]}),$(`button`,{class:`btn ws-remove-btn`,onClick:t=>{t.stopPropagation(),A(e.id)},children:`✕`})]},e.id)})})]}),$(`div`,{class:`test-right-col`,children:[$(`div`,{class:`section-header`,children:`Trigger Event`}),$(`div`,{class:`test-api-panel`,children:U?$(S,{children:[$(`div`,{class:`ws-trigger-url`,children:[$(`span`,{class:`form-label`,children:`Target`}),$(`code`,{children:[`ws://localhost:`,s,U]})]}),$(`div`,{class:`form-row body-row`,children:[$(`label`,{class:`form-label`,children:`Message`}),$(ze,{value:W,onChange:G})]}),$(`div`,{class:`form-buttons-row`,children:$(`button`,{class:`btn btn-primary`,onClick:()=>j(U,W||`{}`),disabled:!o,children:`Send Event`})}),!o&&$(`div`,{class:`ws-server-hint`,children:`Start the mock server to send events.`})]}):$(`div`,{class:`empty-list-message`,children:`Select an endpoint to trigger an event.`})})]})]}),$(`datalist`,{id:`faker-formats-list`,children:Z.filter(e=>e.value&&!e.value.startsWith(`---`)).map(e=>$(`option`,{value:e.value,children:e.label},e.value))}),l&&$(`div`,{class:`toast ${l.type}`,children:l.msg})]})}ne($(Ve,{}),document.getElementById(`app`));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display