vibora 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,7 +41,7 @@ ${e.directory}`:e.name,children:[f&&y.jsx("div",{className:We("absolute top-0 bo
|
|
|
41
41
|
|
|
42
42
|
`)+n.map(LRe).join(`
|
|
43
43
|
`)}var jRe=0,FRe=(function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:jRe++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:dr.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:dr.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t);this.lastCacheModificationPerId.set(t,n===void 0?1:n+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t)||0;return"".concat(this.cacheId,"-").concat(n)}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){if(n===void 0&&(n=!0),t.identifierAttribute){var r=t.identifier;this.cache.has(r)||this.cache.set(r,dr.array([],ew));var i=this.cache.get(r);if(i.indexOf(t)!==-1)throw new St("Already registered");i.push(t),n&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this;Vne(t.identifierCache.cache).forEach(function(r){return r.forEach(function(i){n.addNodeToCache(i)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.identifierAttribute){var n=t.identifier,r=this.cache.get(n);r&&(r.remove(t),r.length||this.cache.delete(n),this.updateLastCacheModificationPerId(t.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,r=new e,i=t.path+"/";return QAe(this.cache).forEach(function(a){for(var s=hu(a,2),o=s[0],l=s[1],u=!1,f=l.length-1;f>=0;f--){var d=l[f];(d===t||d.path.indexOf(i)===0)&&(r.addNodeToCache(d,!1),l.splice(f,1),l.length||n.cache.delete(o),u=!0)}u&&n.updateLastCacheModificationPerId(o)}),r}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);return r?r.some(function(i){return t.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);if(!r)return null;var i=r.filter(function(a){return t.isAssignableFrom(a.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new St("Cannot resolve a reference to type '".concat(t.name,"' with id: '").concat(n,"' unambigously, there are multiple candidates: ").concat(i.map(function(a){return a.path}).join(", ")))}}}),e})();function DM(e,t,n,r,i){var a=tie(i);if(a){if(a.parent)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t?t.path:"","/").concat(n,"', but it lives already at '").concat(a.path,"'"));return t&&a.setParent(t,n),a}return new Oa(e,t,n,r,i)}function ad(e,t,n,r,i){return new Ev(e,t,n,r,i)}function BRe(e){return e instanceof Ev||e instanceof Oa}var _i;(function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"})(_i||(_i={}));function vr(e){return!!(e&&e.$treenode)}function On(e){if(!vr(e))throw new St("Value ".concat(e," is no MST Node"));return e.$treenode}function tie(e){return e&&e.$treenode||null}function URe(){return On(this).snapshot}function $Re(e,t,n){n===void 0&&(n=!0);var r=e;try{for(var i=0;i<t.length;i++){var a=t[i];if(a===".."){if(r=r.parent,r)continue}else{if(a===".")continue;if(r){if(r instanceof Ev){var s=r.value;vr(s)&&(r=On(s))}if(r instanceof Oa){var o=r.getChildType(a);if(o&&(r=r.getChildNode(a),r))continue}}}throw new St("Could not resolve '".concat(a,"' in path '").concat(XH(t.slice(0,i))||"/","' while resolving '").concat(XH(t),"'"))}}catch(l){if(!n)return;throw l}return r}function nie(e){if(!e)return zp;var t=Object.keys(e);if(!t.length)return zp;var n=new Array(t.length);return t.forEach(function(r,i){n[i]=e[r]}),n}var HRe=Object.toString(),zp=Object.freeze([]),Vp=Object.freeze({}),ew=xAe().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(ew);var St=(function(e){er(t,e);function t(n){return n===void 0&&(n="Illegal state"),e.call(this,"[mobx-state-tree] ".concat(n))||this}return t})(Error);function zRe(e){return e}var VRe=Number.isInteger;function WRe(e){return Number(e)===e&&e%1!==0}function GRe(e){return Number.isFinite(e)}function rie(e){return Array.isArray(e)||hl(e)}function iie(e){return e?rie(e)?e:[e]:zp}function qRe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var i=t[r];for(var a in i)e[a]=i[a]}return e}function sp(e){var t;if(e===null||typeof e!="object")return!1;var n=Object.getPrototypeOf(e);return n==null?!0:((t=n.constructor)===null||t===void 0?void 0:t.toString())===HRe}function aie(e){return e!==null&&typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)}function xv(e,t){return t===void 0&&(t=!0),e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t&&e instanceof Date}function sie(e){return typeof e!="function"}function KRe(e,t,n){xo(e)?Gne(e,t,n):Object.defineProperty(e,t,n)}function cf(e,t,n){KRe(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var YRe=(function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this;return n===void 0&&(n=!1),n?this.handlers.unshift(t):this.handlers.push(t),function(){r.unregister(t)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.handlers.indexOf(t)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.handlers.indexOf(t);n>=0&&this.handlers.splice(n,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.handlers.slice();r.forEach(function(i){return i.apply(void 0,pu([],hu(t),!1))})}}),e})(),oie=(function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.eventHandlers&&this.eventHandlers[t];return!!n&&n.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){r===void 0&&(r=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[t];return i||(i=this.eventHandlers[t]=new YRe),i.register(n,r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];return!!r&&r.has(n)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];r&&r.unregister(n)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.eventHandlers&&delete this.eventHandlers[t]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var a=this.eventHandlers&&this.eventHandlers[t];a&&(n=a).emit.apply(n,pu([],hu(r),!1))}}),e})();function lie(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function pk(e,t){return e.indexOf(t)===0}function XRe(e){console.warn(new Error("[mobx-state-tree] ".concat(e)))}function ZRe(){return typeof process<"u"&&KH&&KH.ENABLE_TYPE_CHECK==="true"}function mk(e){typeof queueMicrotask=="function"?queueMicrotask(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,1)}function gk(e){return QRe(e.name,e)}function QRe(e,t){var n=function(){var i=Qre(),a=Zre();if(!a)throw new St("a mst flow must always have a parent context");var s=Jre(a);if(!s)throw new St("a mst flow must always have a parent action context");var o={name:e,id:i,tree:a.tree,context:a.context,parentId:a.id,allParentIds:pu(pu([],hu(a.allParentIds),!1),[a.id],!1),rootId:a.rootId,parentEvent:a,parentActionEvent:s},l=arguments;function u(f,d,p){return f.$mst_middleware=n.$mst_middleware,cD(Sa(Sa({},o),{type:d,args:[p]}),f)}return new Promise(function(f,d){var p,m=function(){p=t.apply(null,arguments),S(void 0)};m.$mst_middleware=n.$mst_middleware,cD(Sa(Sa({},o),{type:"flow_spawn",args:lie(l)}),m);function S(E){var b;try{var x=u(function(T){b=p.next(T)},"flow_resume",E);x instanceof Error&&(b=p.throw(x))}catch(T){mk(function(){u(function(w){d(T)},"flow_throw",T)});return}g(b)}function _(E){var b;try{u(function(x){b=p.throw(x)},"flow_resume_error",E)}catch(x){mk(function(){u(function(T){d(x)},"flow_throw",x)});return}g(b)}function g(E){if(E.done){mk(function(){u(function(b){f(b)},"flow_return",E.value)});return}if(!E.value||typeof E.value.then!="function")throw new St("Only promises can be yielded to `async`, got: "+E);return E.value.then(S,_)}})};return n._isFlowAction=!0,n}function JRe(e){if(!("oldValue"in e))throw new St("Patches without `oldValue` field cannot be inversed");return[e2e(e),t2e(e)]}function e2e(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function t2e(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function n2e(e){return typeof e=="number"}function df(e){return n2e(e)===!0?""+e:e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function r2e(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function XH(e){if(e.length===0)return"";var t=function(n){return n.map(df).join("/")};return e[0]==="."||e[0]===".."?t(e):"/"+t(e)}function i2e(e){var t=e.split("/").map(r2e),n=e===""||e==="."||e===".."||pk(e,"/")||pk(e,"./")||pk(e,"../");if(!n)throw new St("a json path must be either rooted, empty or relative, but got '".concat(e,"'"));return t[0]===""&&t.shift(),t}var bk=Symbol("$preProcessorFailed"),a2e=(function(e){er(t,e);function t(n,r,i){var a=e.call(this,i||n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._processors.preProcessor?this._processors.preProcessor.call(null,n):n}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(n){try{return this.preProcessSnapshot(n)}catch{return bk}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._processors.postProcessor?this._processors.postProcessor.call(null,n,r.storedValue):n}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;s2e(n.type,this,"create"),n instanceof Oa&&(n.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=n.getSnapshot;n.getSnapshot=function(){return r.postProcessSnapshot(i.call(n),n)},C2e(this._subtype)||(n.getReconciliationType=function(){return r})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=vr(a)?a:this.preProcessSnapshot(a),o=this._subtype.instantiate(n,r,i,s);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this._subtype.reconcile(n,vr(r)?r:this.preProcessSnapshot(r),i,a);return s!==n&&this._fixNode(s),s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=!0);var i=this._subtype.getSnapshot(n);return r?this.postProcessSnapshot(i,n):i}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.preProcessSnapshotSafe(n);return i===bk?Na(r,n,"Failed to preprocess value"):this._subtype.validate(i,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=gu(n)?this._subtype:vr(n)?n:this.preProcessSnapshotSafe(n);return r===bk?!1:this._subtype.validate(r,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(!(this._subtype instanceof Hp))return!1;var i=this.preProcessSnapshot(r);return this._subtype.isMatchingSnapshotId(n,i)}}),t})(mu);function s2e(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var s=Bb(i),o=s.next();!o.done;o=s.next()){var l=o.value;e[l]=t[l].bind(t)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function o2e(e,t,n){return new a2e(e,t,n)}var ZH="Map.put can only be used to store complex values that have an identifier type attribute";function uie(e,t){var n,r,i=e.getSubTypes();if(i===Xre)return!1;if(i){var a=iie(i);try{for(var s=Bb(a),o=s.next();!o.done;o=s.next()){var l=o.value;if(!uie(l,t))return!1}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}return e instanceof wv&&t.push(e),!0}var pc;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"})(pc||(pc={}));var l2e=(function(e){er(t,e);function t(n,r){return e.call(this,n,dr.ref.enhancer,r)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.get.call(this,""+n)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.has.call(this,""+n)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.delete.call(this,""+n)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return e.prototype.set.call(this,""+n,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!n)throw new St("Map.put cannot be used to set empty values");if(vr(n)){var r=On(n);if(r.identifier===null)throw new St(ZH);return this.set(r.identifier,n),n}else if(aie(n)){var i=On(this),a=i.type;if(a.identifierMode!==pc.YES)throw new St(ZH);var s=a.mapIdentifierAttribute,o=n[s];if(!LM(o)){var l=this.put(a.getChildType().create(n,i.environment));return this.put(SRe(l))}var u=Gy(o);return this.set(u,n),this.get(u)}else throw new St("Map.put can only be used to store complex values")}}),t})(EM),UE=(function(e){er(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:pc.UNKNOWN}),Object.defineProperty(a,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Map}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a._determineIdentifierMode(),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._determineIdentifierMode(),DM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===pc.UNKNOWN){var n=[];if(uie(this._subType,n)){var r=n.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new St("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(a.name,"' declared attribute '").concat(a.identifierAttribute,"' as identifier"));return a.identifierAttribute},void 0);r?(this.identifierMode=pc.YES,this.mapIdentifierAttribute=r):this.identifierMode=pc.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type._subType,a={};return Object.keys(r).forEach(function(s){a[s]=i.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new l2e(n,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){Hne(r,n.unbox);var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Sv(r,o,l);cf(r,o,u)})}),vM(r,this.willChange),yM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return Vne(n.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n.storedValue.get(""+r);if(!i)throw new St("Not a child "+r);return i}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object),i=n.name;r.assertWritable({subpath:i});var a=r.type,s=a._subType;switch(n.type){case"update":{var o=n.newValue,l=n.object.get(i);if(o===l)return null;su(s,o),n.newValue=s.reconcile(r.getChildNode(i),n.newValue,r,i),a.processIdentifier(i,n.newValue)}break;case"add":su(s,n.newValue),n.newValue=s.instantiate(r,i,void 0,n.newValue),a.processIdentifier(i,n.newValue);break}return n}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.identifierMode===pc.YES&&r instanceof Oa){var i=r.identifier;if(i!==n)throw new St("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(n,"'"))}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return n.getChildren().forEach(function(i){r[i.subpath]=i.snapshot}),r}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:df(n.name),value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"add":return void r.emitPatch({op:"add",path:df(n.name),value:n.newValue.snapshot,oldValue:void 0},r);case"delete":var i=n.oldValue.snapshot;return n.oldValue.die(),void r.emitPatch({op:"remove",path:df(n.name),oldValue:i},r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue;switch(i.op){case"add":case"replace":a.set(r,i.value);break;case"remove":a.delete(r);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){su(this,r);var i=n.storedValue,a={};if(Array.from(i.keys()).forEach(function(o){a[o]=!1}),r)for(var s in r)i.set(s,r[s]),a[""+s]=!0;Object.keys(a).forEach(function(o){a[o]===!1&&i.delete(o)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return sp(n)?Jx(Object.keys(n).map(function(a){return i._subType.validate(n[a],NM(r,a,i._subType))})):Na(r,n,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Vp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.delete(r)}}),t})(Hp);UE.prototype.applySnapshot=Qr(UE.prototype.applySnapshot);function u2e(e){return new UE("Map<string, ".concat(e.name,">"),e)}var $E=(function(e){er(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Array}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return DM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=[]);var i=n.type._subType,a={};return r.forEach(function(s,o){var l=""+o;a[l]=i.instantiate(n,l,void 0,s)}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Sa(Sa({},ew),{name:this.name});return dr.array(nie(n),r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){al(r).dehancer=n.unbox;var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Sv(r,o,l);cf(r,o,u)})}),vM(r,this.willChange),yM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=Number(r);if(i<n.storedValue.length)return n.storedValue[i];throw new St("Not a child: "+r)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);r.assertWritable({subpath:""+n.index});var i=r.type._subType,a=r.getChildren();switch(n.type){case"update":{if(n.newValue===n.object[n.index])return null;var s=QH(r,i,[a[n.index]],[n.newValue],[n.index]);if(!s)return null;n.newValue=s[0]}break;case"splice":{var o=n.index,l=n.removedCount,u=n.added,f=QH(r,i,a.slice(o,o+l),u,u.map(function(p,m){return o+m}));if(!f)return null;n.added=f;for(var d=o+l;d<a.length;d++)a[d].setParent(r,""+(d+u.length-l))}break}return n}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.getChildren().map(function(r){return r.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=[];return Object.keys(n).forEach(function(i){r.push(n[i].getSnapshot())}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:""+n.index,value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"splice":if(n.removedCount&&n.addedCount===n.object.length)return void r.emitPatch({op:"replace",path:"",value:r.snapshot,oldValue:n.removed.map(function(a){return a.snapshot})},r);for(var i=n.removedCount-1;i>=0;i--)r.emitPatch({op:"remove",path:""+(n.index+i),oldValue:n.removed[i].snapshot},r);for(var i=0;i<n.addedCount;i++)r.emitPatch({op:"add",path:""+(n.index+i),value:n.added[i].snapshot,oldValue:void 0},r);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue,s=r==="-"?a.length:Number(r);switch(i.op){case"replace":a[s]=i.value;break;case"add":a.splice(s,0,i.value);break;case"remove":a.splice(s,1);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){su(this,r);var i=n.storedValue;i.replace(r)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return rie(n)?Jx(n.map(function(a,s){return i._subType.validate(a,NM(r,""+s,i._subType))})):Na(r,n,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return zp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.splice(Number(r),1)}}),t})(Hp);$E.prototype.applySnapshot=Qr($E.prototype.applySnapshot);function c2e(e){return new $E("".concat(e.name,"[]"),e)}function QH(e,t,n,r,i){for(var a=!0,s=0;;s++){var o=s<=r.length-1,l=n[s],u=o?r[s]:void 0,f=""+i[s];if(BRe(u)&&(u=u.storedValue),!l&&!o)break;if(!o)a=!1,n.splice(s,1),l instanceof Oa&&l.createObservableInstanceIfNeeded(),l.die(),s--;else if(l)if(JH(l,u))n[s]=vk(t,e,f,u,l);else{for(var p=void 0,m=s;m<n.length;m++)if(JH(n[m],u)){p=n.splice(m,1)[0];break}a=!1;var d=vk(t,e,f,u,p);n.splice(s,0,d)}else{if(vr(u)&&On(u).parent===e)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e.path,"/").concat(f,"', but it lives already at '").concat(On(u).path,"'"));a=!1;var d=vk(t,e,f,u);n.splice(s,0,d)}}return a?null:n}function vk(e,t,n,r,i){su(e,r);function a(){if(vr(r)){var o=On(r);if(o.assertAlive(Vp),o.parent!==null&&o.parent===t)return o.setParent(t,n),o}return i?e.reconcile(i,r,t,n):e.instantiate(t,n,void 0,r)}var s=a();return i&&i!==s&&(i instanceof Oa&&i.createObservableInstanceIfNeeded(),i.die()),s}function JH(e,t){if(!e.isAlive)return!1;if(vr(t)){var n=On(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof Oa))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&sp(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var ez="preProcessSnapshot",tz="postProcessSnapshot";function d2e(){return On(this).toString()}var nz={name:"AnonymousModel",properties:{},initializers:zp};function f2e(e){var t=Object.keys(e),n=new Set;return t.forEach(function(r){if(n.has(r))throw new St("".concat(r," is declared twice in the model. Model should not contain the same keys"));n.add(r)}),t.reduce(function(r,i){if(i in Zr)throw new St("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var a=Object.getOwnPropertyDescriptor(e,i);if("get"in a)throw new St("Getters are not supported as properties. Please use views instead");var s=a.value;if(s==null)throw new St("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(xv(s))r[i]=ff(y2e(s),s);else if(s instanceof UE)r[i]=ff(s,{});else if(s instanceof $E)r[i]=ff(s,[]);else if(!gu(s))throw new St("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(s,"' (").concat(typeof s,")"));return r},Sa({},e))}var wv=(function(e){er(t,e);function t(n){var r=e.call(this,n.name||nz.name)||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Object}),Object.defineProperty(r,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({name:i})}}),Object.defineProperty(r,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({properties:i})}}),Object.defineProperty(r,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.preProcessor;return a?r.cloneAndEnhance({preProcessor:function(s){return a(i(s))}}):r.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(r,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.postProcessor;return a?r.cloneAndEnhance({postProcessor:function(s){return i(a(s))}}):r.cloneAndEnhance({postProcessor:i})}}),Object.assign(r,nz,n),r.properties=f2e(r.properties),r.properties,r.propertyNames=Object.keys(r.properties),r.identifierAttribute=r._getIdentifierAttribute(),r}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=void 0;return this.forAllProps(function(r,i){if(i.flags&_n.Identifier){if(n)throw new St("Cannot define property '".concat(r,"' as object identifier, property '").concat(n,"' is already defined as identifier property"));n=r}}),n}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new t({name:n.name||this.name,properties:Object.assign({},this.properties,n.properties),initializers:this.initializers.concat(n.initializers||[]),preProcessor:n.preProcessor||this.preProcessor,postProcessor:n.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateActions(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!sp(r))throw new St("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as an action"));if(a===ez)throw new St("Cannot define action '".concat(ez,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===tz)throw new St("Cannot define action '".concat(tz,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var s=r[a],o=n[a];if(a in Zr&&o){var l=s;s=function(){o.apply(null,arguments),l.apply(null,arguments)}}var u=s.$mst_middleware,f=s.bind(r);f._isFlowAction=s._isFlowAction||!1,f.$mst_middleware=u;var d=Sv(n,a,f);r[a]=d,cf(n,a,d)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;if(typeof n!="function")throw new St("You passed an ".concat(typeof n," to volatile state as an argument, when function is expected"));var i=function(a){return r.instantiateVolatileState(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!sp(r))throw new St("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as volatile state"));Wne(n,a,r[a])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){var s=n(a),o=s.actions,l=s.views,u=s.state,f=_Re(s,["actions","views","state"]);for(var d in f)throw new St("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(d,"'"));return u&&r.instantiateVolatileState(a,u),l&&r.instantiateViews(a,l),o&&r.instantiateActions(a,o),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateViews(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!sp(r))throw new St("views initializer should return a plain object containing views");Object.getOwnPropertyNames(r).forEach(function(a){var s;if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as a view"));var o=Object.getOwnPropertyDescriptor(r,a);if("get"in o)Gne(n,a,o),Kne(n,(s={},s[a]=Nm,s));else if(typeof o.value=="function")cf(n,a,o.value);else throw new St("A view member should either be a function or getter based property")})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=vr(a)?a:this.applySnapshotPreProcessor(a);return DM(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type,a={};return i.forAllProps(function(s,o){a[s]=o.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Sa(Sa({},ew),{name:this.name});return dr.object(n,Vp,r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cf(r,"toString",d2e),this.forAllProps(function(i){Hne(r,i,n.unbox)}),this.initializers.reduce(function(i,a){return a(i)},r),vM(r,this.willChange),yM(r,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=r.name;i.assertWritable({subpath:a});var s=i.type.properties[a];return s&&(su(s,r.newValue),r.newValue=s.reconcile(i.getChildNode(a),r.newValue,i,a)),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=i.type.properties[r.name];if(a){var s=r.oldValue?r.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:df(r.name),value:r.newValue.snapshot,oldValue:s},i)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=[];return this.forAllProps(function(a){i.push(r.getChildNode(n,a))}),i}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i;if(!(r in this.properties))throw new St("Not a value property: "+r);var a=al(n.storedValue,r),s=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!s)throw new St("Node not available for property "+r);return s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={};return this.forAllProps(function(s,o){var l=Bp(n.storedValue,s);l.reportObserved(),a[s]=i.getChildNode(n,s).snapshot}),r?this.applySnapshotPostProcessor(a):a}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),this.applySnapshotPostProcessor(r)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){if(!(i.op==="replace"||i.op==="add"))throw new St("object does not support operation ".concat(i.op));n.storedValue[r]=i.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){su(this,r);var i=this.applySnapshotPreProcessor(r);this.forAllProps(function(a){n.storedValue[a]=i[a]})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.preProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.postProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.properties[n]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.applySnapshotPreProcessor(n);return sp(a)?Jx(this.propertyNames.map(function(s){return i.properties[s].validate(a[s],NM(r,s,i.properties[s]))})):Na(r,a,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.propertyNames.forEach(function(i){return n(i,r.properties[i])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;return"{ "+this.propertyNames.map(function(r){return r+": "+n.properties[r].describe()}).join("; ")+" }"}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Vp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue[r]=void 0}}),t})(Hp);wv.prototype.applySnapshot=Qr(wv.prototype.applySnapshot);function h2e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():"AnonymousModel",r=e.shift()||{};return new wv({name:n,properties:r})}function p2e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string",r=n?e[0]:"AnonymousModel";return n&&e.shift(),e.reduce(function(i,a){return i.cloneAndEnhance({name:i.name+"_"+a.name,properties:a.properties,initializers:a.initializers,preProcessor:function(s){return a.applySnapshotPreProcessor(i.applySnapshotPreProcessor(s))},postProcessor:function(s){return a.applySnapshotPostProcessor(i.applySnapshotPostProcessor(s))}})}).named(r)}function m2e(e){return gu(e)&&(e.flags&_n.Object)>0}var Cu=(function(e){er(t,e);function t(n,r,i,a){a===void 0&&(a=zRe);var s=e.call(this,n)||this;return Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:a}),s.flags=r,s}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return ad(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.initializer(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(xv(n)&&this.checker(n))return Ra();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return Na(r,n,"Value is not a ".concat(i))}}),t})(Xf),cie=new Cu("string",_n.String,function(e){return typeof e=="string"}),die=new Cu("number",_n.Number,function(e){return typeof e=="number"}),g2e=new Cu("integer",_n.Integer,function(e){return VRe(e)}),b2e=new Cu("float",_n.Float,function(e){return WRe(e)}),v2e=new Cu("finite",_n.Finite,function(e){return GRe(e)}),fie=new Cu("boolean",_n.Boolean,function(e){return typeof e=="boolean"}),hie=new Cu("null",_n.Null,function(e){return e===null}),pie=new Cu("undefined",_n.Undefined,function(e){return e===void 0}),mie=new Cu("Date",_n.Date,function(e){return typeof e=="number"||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});mie.getSnapshot=function(e){return e.storedValue.getTime()};var gie=mie;function y2e(e){switch(typeof e){case"string":return cie;case"number":return die;case"boolean":return fie;case"object":if(e instanceof Date)return gie}throw new St("Cannot determine primitive type from value "+e)}function _2e(e){return gu(e)&&(e.flags&(_n.String|_n.Number|_n.Integer|_n.Boolean|_n.Date))>0}var E2e=(function(e){er(t,e);function t(n){var r=e.call(this,JSON.stringify(n))||this;return Object.defineProperty(r,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Literal}),r.value=n,r}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return ad(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return xv(n)&&n===this.value?Ra():Na(r,n,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),t})(Xf);function bie(e){return new E2e(e)}var S2e=(function(e){er(t,e);function t(n,r,i,a){var s=e.call(this,n)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_message",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this._subtype.validate(n,r);if(i.length>0)return i;var a=vr(n)?On(n).snapshot:n;return this._predicate(a)?Ra():Na(r,n,this._message(n))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(mu);function x2e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():gu(e[0])?e[0].name:null,r=e[0],i=e[1],a=e[2]?e[2]:function(s){return"Value does not respect the refinement predicate"};return new S2e(n,r,i,a)}function w2e(e,t){var n=typeof e=="string"?t:e,r=tw.apply(void 0,pu([],hu(n.map(function(i){return bie(""+i)})),!1));return typeof e=="string"&&(r.name=e),r}var T2e=(function(e){er(t,e);function t(n,r,i){var a=e.call(this,n)||this;return Object.defineProperty(a,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=Sa({eager:!0,dispatcher:void 0},i),a._dispatcher=i.dispatcher,i.eager||(a._eager=!1),a}return Object.defineProperty(t.prototype,"flags",{get:function(){var n=_n.Union;return this._types.forEach(function(r){n|=r.flags}),n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._types.some(function(r){return r.isAssignableFrom(n)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(n){return n.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(a,void 0);if(!s)throw new St("No matching type for union "+this.describe());return s.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(r,n.getReconciliationType());if(!s)throw new St("No matching type for union "+this.describe());return s.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._dispatcher?this._dispatcher(n):r?r.is(n)?r:this._types.filter(function(i){return i!==r}).find(function(i){return i.is(n)}):this._types.find(function(i){return i.is(n)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._dispatcher)return this._dispatcher(n).validate(n,r);for(var i=[],a=0,s=0;s<this._types.length;s++){var o=this._types[s],l=o.validate(n,r);if(l.length===0){if(this._eager)return Ra();a++}else i.push(l)}return a===1?Ra():Na(r,n,"No type is applicable for the union").concat(Jx(i))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t})(mu);function tw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=gu(e)?void 0:e,i=gu(e)?pu([e],hu(t),!1):t,a="("+i.map(function(s){return s.name}).join(" | ")+")";return new T2e(a,i,r)}function C2e(e){return gu(e)&&(e.flags&_n.Union)>0}var A2e=(function(e){er(t,e);function t(n,r,i){var a=e.call(this,n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(this.optionalValues.indexOf(a)>=0){var s=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(n,r,i,s)}return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,this.optionalValues.indexOf(r)<0&&this._subtype.is(r)?r:this.getDefaultInstanceOrSnapshot(),i,a)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&su(this,n),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.optionalValues.indexOf(n)>=0?Ra():this._subtype.validate(n,r)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(mu);function k2e(e,t){if(typeof t!="function"&&vr(t))throw new St("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function ff(e,t,n){return k2e(e,t),new A2e(e,t,n||O2e)}var O2e=[void 0],R2e=ff(pie,void 0),I2e=ff(hie,null);function vie(e){return tw(e,R2e)}function N2e(e){return tw(e,I2e)}var D2e=(function(e){er(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|_n.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._subType){var r=void 0;try{r=this._definition()}catch(i){if(i instanceof ReferenceError)r=void 0;else throw i}if(n&&r===void 0)throw new St("Late type seems to be used too early, the definition (still) returns undefined");r&&(this._subType=r)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n?n.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.getSubType(!1);return i?i.validate(n,r):Ra()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getSubType(!1);return r?r.isAssignableFrom(n):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n||Xre}}),t})(mu);function L2e(e,t){var n=typeof e=="string"?e:"late(".concat(e.toString(),")"),r=typeof e=="string"?t:e;return new D2e(n,r)}function P2e(e,t){return new M2e(e,t)}var M2e=(function(e){er(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:dr.array()}),rH(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(a){return a.isAlive&&i.options.shouldLoadPredicate(a.parent?a.parent.value:null)})},function(){i.options.loadType().then(Qr(function(a){i.loadedType=a,i.pendingNodeList.forEach(function(s){s.parent&&i.loadedType&&s.parent.applyPatches([{op:"replace",path:"/".concat(s.subpath),value:s.snapshot}])})}))}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this;if(this.loadedType)return this.loadedType.instantiate(n,r,i,a);var o=ad(this,n,r,i,a);return this.pendingNodeList.push(o),rH(function(){return!o.isAlive},function(){return s.pendingNodeList.splice(s.pendingNodeList.indexOf(o),1)}),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.loadedType?this.loadedType.validate(n,r):sie(n)?Ra():Na(r,n,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.loadedType?(n.die(),this.loadedType.instantiate(i,a,i.environment,r)):e.prototype.reconcile.call(this,n,r,i,a)}}),t})(Xf),yie=(function(e){er(t,e);function t(n){var r=e.call(this,n?"frozen(".concat(n.name,")"):"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Frozen}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return ad(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return sie(n)?this.subType?this.subType.validate(n,r):Ra():Na(r,n,"Value is not serializable and cannot be frozen")}}),t})(Xf),rz=new yie;function j2e(e){return arguments.length===0?rz:gu(e)?new yie(e):ff(rz,e)}function F2e(e){switch(e){case Zr.beforeDestroy:return"destroy";case Zr.beforeDetach:return"detach";default:return}}var B2e=(function(){function e(t,n){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),LM(t))this.identifier=t;else if(vr(t)){var r=On(t);if(!r.identifierAttribute)throw new St("Can only store references with a defined identifier attribute.");var i=r.unnormalizedIdentifier;if(i==null)throw new St("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new St("Can only store references to tree nodes or identifiers, got: '".concat(t,"'"))}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=Gy(this.identifier),r=t.root,i=r.identifierCache.getLastCacheModificationPerId(n);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var a=this.targetType,s=r.identifierCache.resolve(a,n);if(!s)throw new U2e("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(t.path,")"));this.resolvedReference={node:s,lastCacheModification:i}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e})(),U2e=(function(e){er(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t})(Error),_ie=(function(e){er(t,e);function t(n,r){var i=e.call(this,"reference(".concat(n.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Reference}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.targetType.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return LM(n)?Ra():Na(r,n,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=r.parent;if(!(!s||!s.isAlive)){var o=s.storedValue;o&&this.onInvalidated({cause:n,parent:o,invalidTarget:a?a.storedValue:void 0,invalidId:i,replaceRef:function(l){_v(r.root.storedValue,{op:"replace",value:l,path:r.path})},removeRef:function(){m2e(s.type)?this.replaceRef(void 0):_v(r.root.storedValue,{op:"remove",path:r.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.getValue(n);if(a){var s=On(a),o=function(f,d){var p=F2e(d);p&&i.fireInvalidated(p,n,r,s)},l=s.registerHook(Zr.beforeDetach,o),u=s.registerHook(Zr.beforeDestroy,o);return function(){l(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=this;if(this.onInvalidated){var s;n.registerHook(Zr.beforeDestroy,function(){s&&s()});var o=function(l){s&&s();var u=n.parent,f=u&&u.storedValue;if(u&&u.isAlive&&f){var d=void 0;i?d=!!i.get(r,f):d=n.root.identifierCache.has(a.targetType,Gy(r)),d?s=a.addTargetNodeWatcher(n,r):l||a.fireInvalidated("invalidSnapshotReference",n,r,null)}};n.state===_i.FINALIZED?o(!0):(n.isRoot||n.root.registerHook(Zr.afterCreationFinalization,function(){n.parent&&n.parent.createObservableInstanceIfNeeded()}),n.registerHook(Zr.afterAttach,function(){o(!1)}))}}}),t})(Xf),$2e=(function(e){er(t,e);function t(n,r){return e.call(this,n,r)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=n.storedValue;return r.resolvedValue}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n.storedValue;return r.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=vr(a)?wRe(a):a,o=new B2e(a,this.targetType),l=ad(this,n,r,i,o);return o.node=l,this.watchTargetNodeForInvalidations(l,s,void 0),l}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this){var s=vr(r),o=n.storedValue;if(!s&&o.identifier===r||s&&o.resolvedValue===r)return n.setParent(i,a),n}var l=this.instantiate(i,a,void 0,r);return n.die(),l}}),t})(_ie),H2e=(function(e){er(t,e);function t(n,r,i){var a=e.call(this,n,i)||this;return Object.defineProperty(a,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=this.options.get(n.storedValue,n.parent?n.parent.storedValue:null);return r}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=vr(a)?this.options.set(a,n?n.storedValue:null):a,o=ad(this,n,r,i,s);return this.watchTargetNodeForInvalidations(o,s,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=vr(r)?this.options.set(r,n?n.storedValue:null):r;if(!n.isDetaching&&n.type===this&&n.storedValue===s)return n.setParent(i,a),n;var o=this.instantiate(i,a,void 0,s);return n.die(),o}}),t})(_ie);function Eie(e,t){var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new H2e(e,{get:n.get,set:n.set},r):new $2e(e,r)}function z2e(e,t){var n=Eie(e,Sa(Sa({},t),{onInvalidated:function(r){t&&t.onInvalidated&&t.onInvalidated(r),r.removeRef()}}));return t&&t.acceptsUndefined===!1?n:vie(n)}var Sie=(function(e){er(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),i}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n||!(n.type instanceof wv))throw new St("Identifier types can only be instantiated as direct child of a model type");return ad(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(n.storedValue!==r)throw new St("Tried to change identifier from '".concat(n.storedValue,"' to '").concat(r,"'. Changing identifiers is not allowed."));return n.setParent(i,a),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return typeof n!==this.validType?Na(r,n,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Ra()}}),t})(Xf),V2e=(function(e){er(t,e);function t(){var n=e.call(this,"identifier","string")||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t})(Sie),W2e=(function(e){er(t,e);function t(){return e.call(this,"identifierNumber","number")||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t})(Sie),G2e=new V2e,q2e=new W2e;function Gy(e){return""+e}function LM(e){return typeof e=="string"||typeof e=="number"}function K2e(e){return new Y2e(e)}var Y2e=(function(e){er(t,e);function t(n){var r=e.call(this,n.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Custom}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.options.isTargetType(n))return Ra();var i=this.options.getValidationMessage(n);return i?Na(r,n,"Invalid value for type '".concat(this.name,"': ").concat(i)):Ra()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.options.toSnapshot(n.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.options.isTargetType(a)?a:this.options.fromSnapshot(a,n&&n.root.environment);return ad(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=!this.options.isTargetType(r);if(!n.isDetaching){var o=n.type===this&&(s?r===n.snapshot:r===n.storedValue);if(o)return n.setParent(i,a),n}var l=s?this.options.fromSnapshot(r,i.root.environment):r,u=this.instantiate(i,a,void 0,l);return n.die(),u}}),t})(Xf),At={enumeration:w2e,model:h2e,compose:p2e,custom:K2e,reference:Eie,safeReference:z2e,union:tw,optional:ff,literal:bie,maybe:vie,maybeNull:N2e,refinement:x2e,string:cie,boolean:fie,number:die,integer:g2e,float:b2e,finite:v2e,Date:gie,map:u2e,array:c2e,frozen:j2e,identifier:G2e,identifierNumber:q2e,late:L2e,lazy:P2e,undefined:pie,null:hie,snapshotProcessor:o2e};const X2e=At.enumeration("TerminalStatus",["running","exited","error"]),Z2e=At.model("Terminal",{id:At.identifier,name:At.string,cwd:At.string,status:X2e,exitCode:At.maybe(At.number),cols:At.number,rows:At.number,createdAt:At.number,tabId:At.maybeNull(At.string),positionInTab:At.optional(At.number,0)}).volatile(()=>({xterm:null,attachCleanup:null,isPending:!1,pendingId:null})).views(e=>({get isAlive(){return e.status==="running"},get isTabTerminal(){return e.tabId!=null}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.cwd!==void 0&&(e.cwd=t.cwd),t.status!==void 0&&(e.status=t.status),t.exitCode!==void 0&&(e.exitCode=t.exitCode),t.cols!==void 0&&(e.cols=t.cols),t.rows!==void 0&&(e.rows=t.rows),t.tabId!==void 0&&(e.tabId=t.tabId),t.positionInTab!==void 0&&(e.positionInTab=t.positionInTab)},setXterm(t){e.xterm=t},setAttachCleanup(t){e.attachCleanup=t},markExited(t){e.status="exited",e.exitCode=t},assignToTab(t,n){e.tabId=t,n!==void 0&&(e.positionInTab=n)},rename(t){e.name=t},resize(t,n){e.cols=t,e.rows=n},setPending(t,n){e.isPending=t,n!==void 0&&(e.pendingId=n)},cleanup(){e.attachCleanup&&(e.attachCleanup(),e.attachCleanup=null),e.xterm=null}})),Q2e=At.model("Tab",{id:At.identifier,name:At.string,position:At.number,directory:At.maybeNull(At.string),createdAt:At.number}).volatile(()=>({isPending:!1})).views(e=>({get terminals(){const t=qre(e);return t.terminals?.items?t.terminals.items.filter(n=>n.tabId===e.id).sort((n,r)=>n.positionInTab-r.positionInTab):[]},get terminalCount(){return this.terminals.length}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.directory!==void 0&&(e.directory=t.directory),t.position!==void 0&&(e.position=t.position)},rename(t){e.name=t},setDirectory(t){e.directory=t},setPosition(t){e.position=t},setPending(t){e.isPending=t}})),J2e=At.map(At.string),eIe=At.model("ViewState",{focusedTerminals:At.optional(J2e,{}),currentView:At.maybeNull(At.string),currentTaskId:At.maybeNull(At.string),isTabVisible:At.maybeNull(At.boolean),viewUpdatedAt:At.maybeNull(At.string)}).volatile(()=>({pendingUpdates:{},debounceTimer:null})).views(e=>({getFocusedTerminal(t){return e.focusedTerminals.get(t)??null}})).actions(e=>({setFocusedTerminal(t,n){n===null?e.focusedTerminals.delete(t):e.focusedTerminals.set(t,n)},clearFocusedTerminalForTab(t){e.focusedTerminals.delete(t)},updateViewTracking(t,n){e.currentView=t,e.currentTaskId=n,e.viewUpdatedAt=new Date().toISOString()},setTabVisible(t){e.isTabVisible=t,e.viewUpdatedAt=new Date().toISOString()},hydrateFromServer(t){if(t.focusedTerminals){e.focusedTerminals.clear();for(const[n,r]of Object.entries(t.focusedTerminals))e.focusedTerminals.set(n,r)}t.currentView!==void 0&&(e.currentView=t.currentView),t.currentTaskId!==void 0&&(e.currentTaskId=t.currentTaskId),t.isTabVisible!==void 0&&(e.isTabVisible=t.isTabVisible),t.viewUpdatedAt!==void 0&&(e.viewUpdatedAt=t.viewUpdatedAt)}}));function dD(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function iz(){return`temp-${dD()}`}const tIe=At.model("TerminalsStore",{items:At.array(Z2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},getByTab(t){return e.items.filter(n=>n.tabId===t).sort((n,r)=>n.positionInTab-r.positionInTab)},get taskTerminals(){return e.items.filter(t=>t.tabId==null)},has(t){return e.items.some(n=>n.id===t)}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){Gt.ws.debug("Terminal already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&(n.cleanup(),BE(n))},replaceAll(t){for(const n of e.items)n.cleanup();e.items.clear();for(const n of t)e.items.push(n)},clear(){for(const t of e.items)t.cleanup();e.items.clear()}})),nIe=At.model("TabsStore",{items:At.array(Q2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},get sorted(){return[...e.items].sort((t,n)=>t.position-n.position)},has(t){return e.items.some(n=>n.id===t)},get first(){return this.sorted[0]}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){Gt.ws.debug("Tab already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&BE(n)},replaceAll(t){e.items.clear();for(const n of t)e.items.push(n)},clear(){e.items.clear()}})),rIe=At.model("RootStore",{terminals:At.optional(tIe,{items:[]}),tabs:At.optional(nIe,{items:[]}),viewState:At.optional(eIe,{})}).volatile(()=>({connected:!1,initialized:!1,newTerminalIds:new Set,pendingUpdates:new Map,onAttachedCallbacks:new Map,terminalsReadyForCallback:new Set,lastFocusedTerminalId:null,terminalsPendingStartup:new Map,pendingTabCreation:null,lastCreatedTabId:null})).views(e=>({get isReady(){return e.connected&&e.initialized}})).actions(e=>{const t=()=>TRe(e);return{setConnected(n){const r=e.connected;if(e.connected=n,!n)e.initialized=!1;else if(!r&&n&&e.pendingUpdates.size>0){t().log.ws.info("Reconnected: clearing stale pending updates",{count:e.pendingUpdates.size});for(const i of e.pendingUpdates.values())if(i.entityType==="terminal"){const a=e.terminals.get(i.tempId);a&&(a.cleanup(),e.terminals.remove(i.tempId)),e.newTerminalIds.delete(i.tempId)}else i.entityType==="tab"&&e.tabs.remove(i.tempId);e.pendingUpdates.clear()}},setInitialized(n){e.initialized=n},markNewTerminal(n){e.newTerminalIds.add(n)},clearNewTerminal(n){e.newTerminalIds.delete(n)},setLastFocusedTerminal(n){e.lastFocusedTerminalId=n},consumePendingStartup(n){const r=e.terminalsPendingStartup.get(n);return r&&(e.terminalsPendingStartup.delete(n),t().log.ws.debug("consumed pending startup",{terminalId:n,taskName:r.taskName})),r},setPendingTabCreation(n){e.pendingTabCreation=n},clearLastCreatedTabId(){e.lastCreatedTabId=null},createTerminal(n){const r=dD(),i=iz(),a={id:i,name:n.name,cwd:n.cwd??"~",status:"running",cols:n.cols,rows:n.rows,createdAt:Date.now(),tabId:n.tabId??null,positionInTab:n.positionInTab??0},s=YH(e.terminals);e.terminals.add(a),s.stop(),e.terminals.get(i)?.setPending(!0,i),e.pendingUpdates.set(r,{entityType:"terminal",tempId:i,inversePatches:s.inversePatches,createdAt:Date.now()}),e.newTerminalIds.add(i),n.startup&&(e.terminalsPendingStartup.set(i,n.startup),t().log.ws.debug("createTerminal registered startup",{tempId:i,taskName:n.startup.taskName}));const{startup:l,...u}=n;t().send({type:"terminal:create",payload:{...u,requestId:r,tempId:i}}),t().log.ws.debug("createTerminal optimistic",{requestId:r,tempId:i,name:n.name})},destroyTerminal(n,r){t().send({type:"terminal:destroy",payload:{terminalId:n,force:r?.force,reason:r?.reason}});const i=e.terminals.get(n);i&&i.cleanup(),e.terminals.remove(n)},writeToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}})},sendInputToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}}),setTimeout(()=>{t().send({type:"terminal:input",payload:{terminalId:n,data:"\r"}})},50)},resizeTerminal(n,r,i){t().send({type:"terminal:resize",payload:{terminalId:n,cols:r,rows:i}}),e.terminals.get(n)?.resize(r,i)},renameTerminal(n,r){t().send({type:"terminal:rename",payload:{terminalId:n,name:r}}),e.terminals.get(n)?.rename(r)},attachXterm(n,r,i){const a=e.terminals.get(n);if(!a)return t().log.ws.warn("attachXterm: terminal not found",{terminalId:n}),()=>{};if(a.xterm===r)return t().log.ws.debug("attachXterm: already attached, skipping",{terminalId:n}),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):e.onAttachedCallbacks.set(n,i.onAttached)),a.attachCleanup||(()=>{});a.attachCleanup&&a.attachCleanup(),a.setXterm(r),r.attachCustomKeyEventHandler(u=>u.type==="keydown"&&u.shiftKey&&u.key==="Enter"?(u.preventDefault(),u.stopPropagation(),t().send({type:"terminal:input",payload:{terminalId:n,data:`
|
|
44
|
-
`}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i){const a=dD(),s=iz(),o=r??e.tabs.items.length,l={id:s,name:n,position:o,directory:i??null,createdAt:Date.now()},u=YH(e.tabs);e.tabs.add(l),u.stop(),e.tabs.get(s)?.setPending(!0),e.pendingTabCreation=s,e.pendingUpdates.set(a,{entityType:"tab",tempId:s,inversePatches:u.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,requestId:a,tempId:s}}),t().log.ws.debug("createTab optimistic",{requestId:a,tempId:s,name:n})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),e.tabs.get(n)?.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const S=e.terminals.items.findIndex(E=>E.id===l);S>=0&&BE(e.terminals.items[S]),e.terminals.add(a);const _=e.terminals.get(a.id);t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!_,hasXterm:!!d,willAttach:!!(_&&d)}),_&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const g=e.terminalsPendingStartup.get(l);g&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,g),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!g})}else{const S=e.terminals.items.findIndex(g=>g.id===l);S>=0&&BE(e.terminals.items[S]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,e.lastCreatedTabId=a.id,t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"tab:reordered":{const{tabId:a,position:s}=i;e.tabs.get(a)?.setPosition(s);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)_v(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}Gt.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function xie(){const e=uIe();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await Jee(l);e.writeToTerminal(r,u)}catch(u){Gt.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.items]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const yk="",iIe=At.model("File",{path:At.identifier,content:At.string,originalContent:At.string,mimeType:At.string,size:At.number,lineCount:At.number,truncated:At.boolean,isMarkdownView:At.optional(At.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),aIe=At.model("FilesStore",{selectedFile:At.maybeNull(At.string),expandedDirs:At.array(At.string),openFiles:At.map(iIe)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:gk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield Zt(`${yk}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:gk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield Zt(`${yk}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:gk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${yk}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function sIe(){return aIe.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const wie=k.createContext(null);function oIe(e,t=!1){const n=k.useMemo(()=>sIe(),[]);return k.useEffect(()=>{n.setWorktreePath(e),n.setReadOnly(t),e&&n.loadFileTree()},[n,e,t]),n}function lIe(){const e=k.useContext(wie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function Tie(){const e=lIe();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const Cie=k.createContext(null);function uIe(){const e=k.useContext(Cie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function cIe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function dIe({children:e,wsUrl:t=cIe(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(Gt.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):Gt.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:Gt};o.current=rIe.create({},d)}const f=o.current;return k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const S=new WebSocket(t);i.current=S,S.onopen=()=>{d&&(Gt.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},S.onmessage=_=>{if(d)try{const g=JSON.parse(_.data);f.handleMessage(g)}catch(g){Gt.ws.error("Failed to parse WebSocket message",{error:String(g)})}},S.onclose=()=>{if(d)if(Gt.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===S&&(i.current=null),a.current<r){a.current++;const _=n*Math.pow(1.5,a.current-1);Gt.ws.info("Scheduling reconnect",{attempt:a.current,delay:_}),s.current=setTimeout(p,_)}else Gt.ws.warn("Max reconnect attempts reached")},S.onerror=_=>{Gt.ws.error("WebSocket error",{event:String(_)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),y.jsx(Cie.Provider,{value:f,children:e})}function az(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function fIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const qi="all-tasks",sz=["IN_PROGRESS","IN_REVIEW"],oz="vibora:lastTerminalTab",hIe=wM(function(){const{t}=an("terminals"),n=ss(),{tab:r}=ax({from:"/terminals/"}),{terminals:i,tabs:a,connected:s,createTerminal:o,destroyTerminal:l,renameTerminal:u,assignTerminalToTab:f,createTab:d,updateTab:p,deleteTab:m,reorderTab:S,attachXterm:_,resizeTerminal:g,setupImagePaste:E,writeToTerminal:b,sendInputToTerminal:x,newTerminalIds:T,pendingTabCreation:w,lastCreatedTabId:A,clearLastCreatedTabId:R}=xie(),[O,I]=k.useState(null),{getFocusedTerminal:D}=ene(),P=k.useMemo(()=>a.map(ue=>ue.id),[a]),H=r&&(P.includes(r)||r===qi),M=H?r:a[0]?.id??null,W=k.useCallback(ue=>{n({to:"/terminals",search:{tab:ue},replace:!0})},[n]);k.useEffect(()=>{if(a.length!==0){if(A){Gt.terminal.debug("Navigating to newly created tab",{tabId:A}),W(A);const ue=A;R(),setTimeout(()=>{Z.current++;const ye=`Terminal ${Z.current}`;Gt.terminal.debug("Creating terminal in new tab",{tabId:ue,name:ye}),o({name:ye,cols:80,rows:24,tabId:ue,positionInTab:0})},100);return}if(!w&&!H){const ue=localStorage.getItem(oz),ye=ue&&(a.some(Ie=>Ie.id===ue)||ue===qi)?ue:a[0].id;n({to:"/terminals",search:{tab:ye},replace:!0})}}},[a,H,A,w,W,R,n,o]),k.useEffect(()=>{M&&localStorage.setItem(oz,M)},[M]);const{data:V=[],status:$}=cM(),{data:G=[]}=My(),[K,U]=k.useState(null),B=k.useMemo(()=>{const ue=new Map;for(const ye of G)ue.set(ye.path,ye.id);return ue},[G]),F=k.useMemo(()=>new Set(V.filter(ue=>sz.includes(ue.status)&&ue.worktreePath).map(ue=>ue.worktreePath)),[V]),Y=k.useMemo(()=>i.filter(ue=>ue.tabId!=null||ue.cwd&&F.has(ue.cwd)).length,[i,F]),z=k.useMemo(()=>new Set(V.filter(ue=>ue.worktreePath).map(ue=>ue.worktreePath)),[V]),J=k.useMemo(()=>{const ue=new Map;for(const ye of V)ye.worktreePath&&ue.set(ye.worktreePath,{taskId:ye.id,repoId:B.get(ye.repoPath),repoName:ye.repoName,title:ye.title,repoPath:ye.repoPath,worktreePath:ye.worktreePath,baseBranch:ye.baseBranch,branch:ye.branch,prUrl:ye.prUrl});return ue},[V,B]),ee=k.useMemo(()=>{const ue=new Set(V.filter(ye=>sz.includes(ye.status)).map(ye=>ye.repoName));return Array.from(ue).sort()},[V]),te=k.useRef(new Map),Z=k.useRef(0),q=k.useRef(!1),Q=k.useRef(!1),ae=k.useMemo(()=>M===qi?i.filter(ue=>ue.cwd&&F.has(ue.cwd)).filter(ue=>K?V.find(Ie=>Ie.worktreePath===ue.cwd)?.repoName===K:!0).sort((ue,ye)=>{const Ie=V.find(Ne=>Ne.worktreePath===ue.cwd),pe=V.find(Ne=>Ne.worktreePath===ye.cwd);return!Ie||!pe?0:new Date(pe.createdAt).getTime()-new Date(Ie.createdAt).getTime()}).map(az):i.filter(ue=>ue.tabId===M).sort((ue,ye)=>ue.positionInTab-ye.positionInTab).map(az),[M,i,F,K,V]),se=k.useCallback(()=>{if(Gt.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:s,pendingTerminalCreate:q.current,terminalCount:i.length}),q.current){Gt.terminal.debug("Skipping terminal creation, already pending");return}q.current=!0,Z.current++;const ue=`Terminal ${Z.current}`,ye=i.filter(pe=>pe.tabId===M),Ie=ye.length;Gt.terminal.info("Creating terminal",{name:ue,tabId:M,positionInTab:Ie,terminalsInTabCount:ye.length}),o({name:ue,cols:80,rows:24,tabId:M??void 0,positionInTab:Ie}),setTimeout(()=>{q.current=!1},500)},[o,M,i,s]);k.useEffect(()=>{if($!=="success"){Gt.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:$});return}for(const ue of i)ue.cwd&&z.has(ue.cwd)&&ue.tabId&&(Gt.terminalsView.debug("Removing task terminal from regular tab",{terminalId:ue.id,name:ue.name,cwd:ue.cwd,tabId:ue.tabId}),f(ue.id,null))},[i,z,f,$]);const ne=k.useCallback(ue=>{const ye=te.current.get(ue);ye&&(ye(),te.current.delete(ue)),l(ue,{force:!0,reason:"user_closed"})},[l]),_e=k.useCallback((ue,ye)=>{const Ie=_(ue,ye);te.current.set(ue,Ie),T.has(ue)&&setTimeout(()=>{ye.focus()},50)},[_,T]),Ee=k.useCallback((ue,ye,Ie)=>{g(ue,ye,Ie)},[g]),de=k.useCallback((ue,ye)=>{u(ue,ye)},[u]),ge=k.useCallback(()=>{if(Q.current){Gt.terminal.debug("Skipping tab creation, already pending");return}Q.current=!0;const ue=`Tab ${a.length+1}`;Gt.terminal.debug("Quick creating tab",{name:ue}),d(ue,void 0,void 0),setTimeout(()=>{Q.current=!1},500)},[d,a.length]),me=k.useCallback((ue,ye)=>{Gt.terminal.debug("Reordering tab",{tabId:ue,newPosition:ye}),S(ue,ye)},[S]),Ke=k.useCallback((ue,ye)=>{if(Q.current){Gt.terminal.debug("Skipping tab creation, already pending");return}Q.current=!0,Gt.terminal.debug("Creating tab",{name:ue,directory:ye}),d(ue,void 0,ye),setTimeout(()=>{Q.current=!1},500)},[d]),Se=k.useCallback(ue=>{const ye=i.filter(Ie=>Ie.tabId===ue);for(const Ie of ye){const pe=te.current.get(Ie.id);pe&&(pe(),te.current.delete(Ie.id))}m(ue)},[i,m]),$e=a.map(fIe),we=k.useCallback(ue=>{I(ue)},[]),Pe=k.useCallback((ue,ye)=>{p(ue,ye)},[p]);return Ts("meta+d",se,{enabled:M!==qi&&s,allowInTerminal:!0,deps:[se,M,s]}),Ts("meta+w",()=>{if(M&&M!==qi){const ue=D(M);ue&&ne(ue)}},{enabled:M!==qi,allowInTerminal:!0,deps:[M,D,ne]}),y.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[y.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[y.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto",children:y.jsxs("div",{className:"flex items-center",children:[y.jsxs("button",{onClick:()=>W(qi),className:We("relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===qi?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===qi?"after:opacity-100":"after:opacity-0"),children:[y.jsx(ve,{icon:Lp,size:12,strokeWidth:2}),y.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),y.jsx("div",{className:"mx-2 h-4 w-px bg-border"}),y.jsx(gRe,{tabs:$e,activeTabId:M??"",onTabSelect:W,onTabClose:Se,onTabCreate:ge,onTabEdit:we,onTabReorder:me})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===qi&&ee.length>1&&y.jsxs(Ji,{value:K??"",onValueChange:ue=>U(ue||null),children:[y.jsxs(ta,{size:"sm",className:"max-sm:w-auto",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(ea,{children:K||t("allRepos")})]}),y.jsxs(na,{children:[y.jsx(Nn,{value:"",children:t("allRepos")}),ee.map(ue=>y.jsx(Nn,{value:ue,children:ue},ue))]})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:se,disabled:!s||Y>=24||M===qi,className:"max-sm:px-2 border-transparent text-primary",children:[y.jsx(ve,{icon:Cx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),y.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:y.jsx(TOe,{terminals:ae,onTerminalClose:M===qi?void 0:ne,onTerminalAdd:s&&M!==qi?se:void 0,onTerminalReady:_e,onTerminalResize:Ee,onTerminalRename:M===qi?void 0:de,setupImagePaste:E,writeToTerminal:b,sendInputToTerminal:x,taskInfoByCwd:M===qi?J:void 0})}),y.jsx(bRe,{tab:O,open:O!==null,onOpenChange:ue=>{ue||I(null)},onSave:Pe,onCreate:Ke,defaultName:`Tab ${a.length+1}`})]})}),pIe=Us("/terminals/")({component:hIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0})});function mIe(){return{x:0,y:0}}function gIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?mIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:jre,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(Vy()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=Hre({onDragStart:o,onDrop:o})}var bIe=Yf(function(){return Vy()&&"ontouchend"in document}),vIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function yIe(e){return function(n){var r=n.container;if(bIe()||$re())return vIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const Aie=k.createContext(null);function _Ie({children:e}){const[t,n]=k.useState(null);return y.jsx(Aie.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function kie(){const e=k.useContext(Aie);if(!e)throw new Error("useDrag must be used within DragProvider");return e}function EIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function Oie({task:e,open:t,onOpenChange:n}){const r=dM(),i=qte(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,S]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),S(e.linearTicketUrl||""),l(!0))},[t,e]);const _=()=>{const b={},x=a.trim();if(!x)return;x!==e.title&&(b.title=x);const T=u.trim();T!==(e.description||"")&&(b.description=T);const w=d.trim();w!==(e.prUrl||"")&&(b.prUrl=w||null);const A=m.trim();A!==(e.linearTicketUrl||"")&&(b.linearTicketUrl=A||null,b.linearTicketId=A?EIe(A):null),Object.keys(b).length>0&&r.mutate({taskId:e.id,updates:b}),n(!1)},g=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),_())},E=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return y.jsx(ul,{open:t,onOpenChange:n,children:y.jsxs(cl,{className:"sm:max-w-md",onKeyDown:g,children:[y.jsx(xu,{children:y.jsx(wu,{children:"Task Settings"})}),y.jsxs(tu,{className:"mt-4",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-title",children:"Title"}),y.jsx(sn,{id:"config-title",value:a,onChange:b=>s(b.target.value),autoFocus:!0})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-description",children:"Description"}),y.jsx(tte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),y.jsx(sn,{id:"config-pr-url",value:d,onChange:b=>p(b.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),y.jsx(sn,{id:"config-linear-url",value:m,onChange:b=>S(b.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),y.jsxs(zf,{className:"mt-4 flex-row justify-between sm:justify-between",children:[y.jsxs(Fc,{children:[y.jsx(Bc,{render:y.jsx(Ye,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),y.jsxs(Uc,{children:[y.jsxs($c,{children:[y.jsx(zc,{children:"Delete Task"}),y.jsx(Vc,{children:"This will permanently delete this task. This action cannot be undone."})]}),y.jsxs("div",{className:"flex items-center gap-2 py-2",children:[y.jsx(rl,{id:"delete-worktree",checked:o,onCheckedChange:b=>l(b===!0)}),y.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),y.jsxs(Hc,{children:[y.jsx(Wc,{children:"Cancel"}),y.jsx(ine,{onClick:E,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Ye,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),y.jsx(Ye,{onClick:_,disabled:!a.trim(),children:"Save"})]})]})]})})}function Rie({task:e,isDragPreview:t}){const{setActiveTask:n}=kie(),r=ss(),i=k.useRef(null),[a,s]=k.useState(!1),[o,l]=k.useState(null),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=k.useRef(!1);k.useEffect(()=>{const E=i.current;if(!(!E||t))return Wy(zre({element:E,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:b})=>{gIe({nativeSetDragImage:b,getOffset:yIe({x:"16px",y:"8px"}),render:({container:x})=>{f(x)}})},onDragStart:()=>{s(!0),n(e),m.current=!0},onDrop:()=>{s(!1),n(null),f(null)}}),Qx({element:E,getData:({input:b,element:x})=>{const T={type:"task",taskId:e.id,status:e.status};return Wre(T,{input:b,element:x,allowedEdges:["top","bottom"]})},canDrop:({source:b})=>b.data.taskId!==e.id,onDragEnter:({self:b})=>{l(Ep(b.data))},onDrag:({self:b})=>{l(Ep(b.data))},onDragLeave:()=>{l(null)},onDrop:()=>{l(null)}}))},[e,t,n]);const S=()=>{m.current=!1},_=()=>{m.current||r({to:"/tasks/$taskId",params:{taskId:e.id}}),m.current=!1},g=y.jsxs(Ca,{ref:t?void 0:i,onPointerDown:S,onClick:_,className:We("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",a&&"opacity-50"),children:[o&&y.jsx("div",{className:We("absolute left-0 right-0 h-0.5 bg-primary z-10",o==="top"&&"-top-1",o==="bottom"&&"-bottom-1")}),y.jsxs(dCe,{className:"p-3 pb-1 flex flex-row items-start justify-between gap-2",children:[y.jsx(fCe,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&y.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:E=>{E.stopPropagation(),p(!0)},onPointerDown:E=>E.stopPropagation(),children:y.jsx(ve,{icon:Bee,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),y.jsxs(kf,{className:"p-3 pt-1",children:[e.description&&y.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),y.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[y.jsx(ve,{icon:Mi,size:12,strokeWidth:2}),y.jsx("span",{children:e.repoName}),e.prUrl&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(ve,{icon:TE,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(ve,{icon:qP,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]});return y.jsxs(y.Fragment,{children:[g,u&&Nr.createPortal(y.jsx("div",{className:"w-72 max-w-[90vw]",children:y.jsx(Rie,{task:e,isDragPreview:!0})}),u),y.jsx(Oie,{task:e,open:d,onOpenChange:p})]})}const SIe={IN_PROGRESS:"border-t-[#8d909b]",IN_REVIEW:"border-t-[#2a2a27] dark:border-t-[#faf9f5]",DONE:"border-t-[#0d5c63]",CANCELED:"border-t-[#dd403a]"};function lz({status:e,tasks:t,isMobile:n}){const{t:r}=an("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>u.position-l.position);return k.useEffect(()=>{const l=i.current;if(l)return Qx({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),y.jsxs("div",{ref:i,className:We("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",SIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&y.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[y.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),y.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),y.jsx(Af,{className:"min-h-0 flex-1",children:y.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>y.jsx(Rie,{task:l},l.id))})})]})}const _k=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function xIe({status:e}){const{t}=an("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return Qx({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),y.jsx("div",{ref:n,className:We("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function wIe({repoFilter:e,searchQuery:t}){const{t:n}=an("common"),{data:r=[],isLoading:i}=cM(),a=KSe(),{activeTask:s}=kie(),[o,l]=k.useState("IN_PROGRESS"),u=k.useMemo(()=>{let d=r;return e&&(d=d.filter(p=>p.repoName===e)),t?.trim()?d=d.map(p=>({task:p,score:Math.max(Ud(p.title,t),Ud(p.description||"",t),Ud(p.branch||"",t),Ud(p.linearTicketId||"",t),Ud(p.prUrl||"",t))})).filter(({score:p})=>p>0).sort((p,m)=>m.score-p.score).map(({task:p})=>p):d=[...d].sort((p,m)=>new Date(m.createdAt).getTime()-new Date(p.createdAt).getTime()),d},[r,e,t]),f=k.useMemo(()=>{const d={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const p of u)d[p.status]++;return d},[u]);return k.useEffect(()=>Hre({canMonitor:({source:d})=>d.data.type==="task",onDrop:({source:d,location:p})=>{const m=p.current.dropTargets;if(m.length===0)return;const S=d.data.taskId,_=u.find(b=>b.id===S);if(!_)return;const g=m[0],E=g.data;if(E.type==="column"){const b=E.status;if(b!==_.status){const x=u.filter(T=>T.status===b);a.mutate({taskId:S,status:b,position:x.length})}}else if(E.type==="task"){const b=Ep(g.data),x=E.status,T=u.filter(R=>R.status===x).sort((R,O)=>R.position-O.position),w=T.findIndex(R=>R.id===E.taskId);let A=w;b==="bottom"&&(A=w+1),_.status===x&&T.findIndex(O=>O.id===S)<w&&(A=Math.max(0,A-1)),(_.status!==x||A!==_.position)&&a.mutate({taskId:S,status:x,position:A})}}}),[u,a]),i?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"border-b bg-background lg:hidden",children:y.jsx(nu,{value:o,onValueChange:d=>l(d),children:y.jsx(ru,{variant:"line",className:"w-full justify-start px-4",children:_k.map(d=>y.jsxs(oi,{value:d,className:"gap-1.5",children:[y.jsx("span",{className:"truncate",children:n(`statuses.${d}`)}),y.jsx("span",{className:"text-muted-foreground",children:f[d]})]},d))})})}),y.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:_k.map(d=>y.jsx(lz,{status:d,tasks:u.filter(p=>p.status===d)},d))}),y.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:y.jsx(lz,{status:o,tasks:u.filter(d=>d.status===o),isMobile:!0})}),s&&y.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:_k.filter(d=>d!==o).map(d=>y.jsx(xIe,{status:d},d))})]})}function TIe(e){return y.jsx(_Ie,{children:y.jsx(wIe,{...e})})}const Iie=Us("/tasks/")({component:CIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function CIe(){const{t:e}=an("tasks"),{data:t=[]}=cM(),{repo:n}=Iie.useSearch(),r=ss(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"relative flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2",children:[y.jsx(ve,{icon:jee,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(sn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-64 pl-6"})]}),y.jsx("div",{className:"ml-auto",children:y.jsxs(Ji,{value:n??"",onValueChange:l=>s(l||null),children:[y.jsxs(ta,{size:"sm",className:"max-sm:w-auto gap-1.5",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(ea,{children:n??e("allRepos")})]}),y.jsxs(na,{className:"min-w-[160px]",children:[y.jsx(Nn,{value:"",children:e("allRepos")}),o.map(l=>y.jsx(Nn,{value:l,children:l},l))]})]})})]}),y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(TIe,{repoFilter:n??null,searchQuery:i})})]})}function Gl({className:e,size:t="default",...n}){return y.jsx(TSe,{"data-slot":"switch","data-size":t,className:We("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:y.jsx(CSe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const AIe=Us("/settings/")({component:kIe});function Vl({title:e,children:t}){return y.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[y.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function kIe(){const{t:e}=an("settings"),{t}=an("common"),{data:n,isLoading:r}=Kte(),{data:i,isLoading:a}=jx(),{data:s,isLoading:o}=Fx(),{data:l,isLoading:u}=Bx(),{data:f,isLoading:d}=Ux(),{data:p,isLoading:m}=nxe(),{data:S,isLoading:_}=rxe(),{data:g,isLoading:E}=uxe(),{data:b,isLoading:x}=cxe(),{data:T,isLoading:w}=fxe(),{data:A,isLoading:R}=mxe(),{data:O}=Yte(),I=bxe(),{savedLanguage:D,changeLanguage:P}=Qte(),{theme:H,syncClaudeCode:M,changeTheme:W}=Jte(),{data:V}=oxe(),{data:$}=lxe(),G=fM(),K=dxe(),U=hxe(),B=gxe(),F=pxe(),[Y,z]=k.useState(""),[J,ee]=k.useState(""),[te,Z]=k.useState("vscode"),[q,Q]=k.useState(""),[ae,se]=k.useState(""),[ne,_e]=k.useState(""),[Ee,de]=k.useState(""),[ge,me]=k.useState(""),[Ke,Se]=k.useState(""),[$e,we]=k.useState(!1),[Pe,ue]=k.useState(!1),[ye,Ie]=k.useState(!1),[pe,Ne]=k.useState(!1),[Te,ze]=k.useState(!1),[Ze,gt]=k.useState(""),[it,ot]=k.useState(!1),[Me,ft]=k.useState(""),[ke,Fe]=k.useState(!1),[Je,lt]=k.useState(""),[ht,vn]=k.useState(""),[Dt,Ot]=k.useState(!1),[ct,en]=k.useState(""),[Lt,yt]=k.useState("glm-4.5-air"),[Bt,jt]=k.useState("glm-4.7"),[Ut,pt]=k.useState("glm-4.7"),[ln,yr]=k.useState(!1),[kr,Dr]=k.useState("light-ansi"),[Hi,_l]=k.useState("dark-ansi"),[di,lr]=k.useState(!1),[mr,ua]=k.useState(!1),[Ai,ls]=k.useState(!1),Nu=k.useRef(null);k.useEffect(()=>{n!==void 0&&z(String(n)),i!==void 0&&ee(i),s!==void 0&&Z(s),l!==void 0&&Q(l),f!==void 0&&se(String(f)),p!==void 0&&_e(p),S!==void 0&&de(S),g!==void 0&&me(g)},[n,i,s,l,f,p,S,g]),k.useEffect(()=>{T&&(Ie(T.enabled),Ne(T.sound?.enabled??!1),ua(!!T.sound?.customSoundFile),ze(T.slack?.enabled??!1),gt(T.slack?.webhookUrl??""),ot(T.discord?.enabled??!1),ft(T.discord?.webhookUrl??""),Fe(T.pushover?.enabled??!1),lt(T.pushover?.appToken??""),vn(T.pushover?.userKey??""))},[T]),k.useEffect(()=>{A&&(Ot(A.enabled),en(A.apiKey??""),yt(A.haikuModel),jt(A.sonnetModel),pt(A.opusModel))},[A]),k.useEffect(()=>{M!==void 0&&yr(M),V!==void 0&&Dr(V),$!==void 0&&_l($)},[M,V,$]);const Vt=r||a||o||u||d||m||_||E||x||w||R,Ao=A&&(Dt!==A.enabled||ct!==(A.apiKey??"")||Lt!==A.haikuModel||Bt!==A.sonnetModel||Ut!==A.opusModel),ko=ln!==(M??!1)||kr!==V||Hi!==$,us=T&&(ye!==T.enabled||pe!==(T.sound?.enabled??!1)||Te!==(T.slack?.enabled??!1)||Ze!==(T.slack?.webhookUrl??"")||it!==(T.discord?.enabled??!1)||Me!==(T.discord?.webhookUrl??"")||ke!==(T.pushover?.enabled??!1)||Je!==(T.pushover?.appToken??"")||ht!==(T.pushover?.userKey??"")),cs=ge!==g||Ke!=="",El=te!==s||q!==l||ae!==String(f),Pa=Y!==String(n)||J!==i||ne!==p||Ee!==S||cs||El||us||Ao||ko,_r=async()=>{const Ve=[];if(Y!==String(n)){const Ft=parseInt(Y,10);!isNaN(Ft)&&Ft>=1&&Ft<=65535&&Ve.push(new Promise(Oi=>{G.mutate({key:nn.PORT,value:Ft},{onSettled:Oi})}))}if(J!==i&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.DEFAULT_GIT_REPOS_DIR,value:J},{onSettled:Ft})})),te!==s&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.EDITOR_APP,value:te},{onSettled:Ft})})),q!==l&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.EDITOR_HOST,value:q},{onSettled:Ft})})),ae!==String(f)){const Ft=parseInt(ae,10);!isNaN(Ft)&&Ft>=1&&Ft<=65535&&Ve.push(new Promise(Oi=>{G.mutate({key:nn.EDITOR_SSH_PORT,value:Ft},{onSettled:Oi})}))}ne!==p&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.LINEAR_API_KEY,value:ne},{onSettled:Ft})})),Ee!==S&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.GITHUB_PAT,value:Ee},{onSettled:Ft})})),ge!==g&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.BASIC_AUTH_USERNAME,value:ge},{onSettled:Ft})})),Ke!==""&&(Ve.push(new Promise(Ft=>{G.mutate({key:nn.BASIC_AUTH_PASSWORD,value:Ke},{onSettled:Ft})})),Se("")),us&&Ve.push(new Promise(Ft=>{U.mutate({enabled:ye,sound:{enabled:pe},slack:{enabled:Te,webhookUrl:Ze},discord:{enabled:it,webhookUrl:Me},pushover:{enabled:ke,appToken:Je,userKey:ht}},{onSettled:Ft})})),Ao&&Ve.push(new Promise(Ft=>{B.mutate({enabled:Dt,apiKey:ct||null,haikuModel:Lt,sonnetModel:Bt,opusModel:Ut},{onSettled:Ft})})),ko&&(ln!==(M??!1)&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.SYNC_CLAUDE_CODE_THEME,value:ln},{onSettled:Ft})})),kr!==V&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.CLAUDE_CODE_LIGHT_THEME,value:kr},{onSettled:Ft})})),Hi!==$&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.CLAUDE_CODE_DARK_THEME,value:Hi},{onSettled:Ft})}))),await Promise.all(Ve),ue(!0),setTimeout(()=>ue(!1),2e3)},fi=()=>{K.mutate(nn.PORT,{onSuccess:Ve=>{Ve.value!==null&&z(String(Ve.value))}})},hi=()=>{K.mutate(nn.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ve=>{Ve.value&&ee(String(Ve.value))}})},zi=()=>{K.mutate(nn.EDITOR_APP,{onSuccess:Ve=>{Ve.value!==null&&Ve.value!==void 0&&Z(Ve.value)}})},Ma=()=>{K.mutate(nn.EDITOR_HOST,{onSuccess:Ve=>{Q(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},tg=()=>{K.mutate(nn.EDITOR_SSH_PORT,{onSuccess:Ve=>{Ve.value!==null&&Ve.value!==void 0&&se(String(Ve.value))}})},Du=()=>{K.mutate(nn.LINEAR_API_KEY,{onSuccess:Ve=>{_e(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},Lu=()=>{K.mutate(nn.GITHUB_PAT,{onSuccess:Ve=>{de(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},ng=()=>{K.mutate(nn.BASIC_AUTH_USERNAME,{onSuccess:Ve=>{me(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},Ks=()=>{K.mutate(nn.BASIC_AUTH_PASSWORD,{onSuccess:()=>{Se("")}})},ja=async Ve=>{F.mutate(Ve,{onSuccess:Ft=>{Ft.success?gn.success(e("notifications.testSuccess",{channel:Ve})):gn.error(e("notifications.testFailed",{channel:Ve,error:Ft.error}))},onError:Ft=>{gn.error(e("notifications.testFailed",{channel:Ve,error:Ft.message}))}})},Vi=async Ve=>{const Ft=Ve.target.files?.[0];if(Ft){ls(!0);try{const Oi=new FormData;Oi.append("file",Ft);const ds=await fetch("/api/uploads/sound",{method:"POST",body:Oi});if(!ds.ok){const Wi=await ds.json();throw new Error(Wi.error||"Upload failed")}ua(!0),gn.success(e("notifications.soundUploaded"))}catch(Oi){gn.error(e("notifications.soundUploadFailed",{error:Oi instanceof Error?Oi.message:"Unknown error"}))}finally{ls(!1),Nu.current&&(Nu.current.value="")}}},ki=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");ua(!1),gn.success(e("notifications.soundDeleted"))}catch{gn.error(e("notifications.soundDeleteFailed"))}};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:y.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),y.jsx("div",{className:"flex-1 overflow-auto p-6",children:y.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[y.jsx(Vl,{title:e("sections.server"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(sn,{type:"number",min:1,max:65535,value:Y,onChange:Ve=>z(Ve.target.value),placeholder:"7777",disabled:Vt,className:"w-24 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:fi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),y.jsx(Vl,{title:e("sections.paths"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:J,onChange:Ve=>ee(Ve.target.value),placeholder:"~/projects",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>we(!0),disabled:Vt,title:t("buttons.browse"),children:y.jsx(ve,{icon:Mi,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),y.jsx(Vl,{title:e("sections.authentication"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.username")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:ge,onChange:Ve=>me(Ve.target.value),placeholder:e("fields.auth.usernamePlaceholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:ng,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]})}),y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.password")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:Ke,onChange:Ve=>Se(Ve.target.value),placeholder:e(b?"fields.auth.passwordSet":"fields.auth.passwordPlaceholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Ks,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]})}),y.jsx("p",{className:"text-xs text-muted-foreground",children:e("fields.auth.description")})]})}),y.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[y.jsx(Vl,{title:e("sections.editor"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs(Ji,{value:te,onValueChange:Ve=>Z(Ve),children:[y.jsx(ta,{className:"w-32",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"vscode",children:"VS Code"}),y.jsx(Nn,{value:"cursor",children:"Cursor"}),y.jsx(Nn,{value:"windsurf",children:"Windsurf"}),y.jsx(Nn,{value:"zed",children:"Zed"})]})]}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:zi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:q,onChange:Ve=>Q(Ve.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Ma,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(sn,{type:"number",min:1,max:65535,value:ae,onChange:Ve=>se(Ve.target.value),placeholder:"22",disabled:Vt,className:"w-20 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:tg,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),y.jsx(Vl,{title:e("sections.integrations"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:ne,onChange:Ve=>_e(Ve.target.value),placeholder:"lin_api_...",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Du,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:Ee,onChange:Ve=>de(Ve.target.value),placeholder:"ghp_...",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Lu,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),y.jsx(Vl,{title:e("sections.zai"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),y.jsx(Gl,{checked:Dt,onCheckedChange:Ot,disabled:Vt})]}),Dt&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),y.jsx(sn,{type:"password",value:ct,onChange:Ve=>en(Ve.target.value),placeholder:"zai_...",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),y.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[y.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),y.jsx(sn,{value:Lt,onChange:Ve=>yt(Ve.target.value),placeholder:"glm-4.5-air",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),y.jsx(sn,{value:Bt,onChange:Ve=>jt(Ve.target.value),placeholder:"glm-4.7",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),y.jsx(sn,{value:Ut,onChange:Ve=>pt(Ve.target.value),placeholder:"glm-4.7",disabled:Vt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),y.jsx(Vl,{title:e("sections.notifications"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),y.jsx(Gl,{checked:ye,onCheckedChange:Ie,disabled:Vt})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:pe,onCheckedChange:Ne,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),y.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[y.jsx("input",{ref:Nu,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Vi}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Nu.current?.click(),disabled:Vt||!ye||!pe||Ai,title:e("notifications.uploadSound"),children:Ai?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:p1e,size:14,strokeWidth:2})}),mr&&y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:ki,disabled:Vt||!ye||!pe,title:e("notifications.deleteSound"),children:y.jsx(ve,{icon:Om,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("sound"),disabled:Vt||!ye||!pe||F.isPending,title:e("notifications.testSound"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]})]}),mr&&y.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:Te,onCheckedChange:ze,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("slack"),disabled:Vt||!ye||!Te||!Ze||F.isPending,title:e("notifications.slack"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),Te&&y.jsx(sn,{type:"password",value:Ze,onChange:Ve=>gt(Ve.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Vt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:it,onCheckedChange:ot,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("discord"),disabled:Vt||!ye||!it||!Me||F.isPending,title:e("notifications.discord"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),it&&y.jsx(sn,{type:"password",value:Me,onChange:Ve=>ft(Ve.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Vt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:ke,onCheckedChange:Fe,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("pushover"),disabled:Vt||!ye||!ke||!Je||!ht||F.isPending,title:e("notifications.pushover"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),ke&&y.jsxs("div",{className:"ml-6 space-y-2",children:[y.jsx(sn,{type:"password",value:Je,onChange:Ve=>lt(Ve.target.value),placeholder:e("notifications.appToken"),disabled:Vt||!ye,className:"flex-1 font-mono text-sm"}),y.jsx(sn,{type:"password",value:ht,onChange:Ve=>vn(Ve.target.value),placeholder:e("notifications.userKey"),disabled:Vt||!ye,className:"flex-1 font-mono text-sm"})]})]})]})}),y.jsx(Vl,{title:e("sections.appearance"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),y.jsxs(Ji,{value:D??"auto",onValueChange:Ve=>P(Ve==="auto"?null:Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"auto",children:e("fields.language.options.auto")}),y.jsx(Nn,{value:"en",children:e("fields.language.options.en")}),y.jsx(Nn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),y.jsxs(Ji,{value:H??"system",onValueChange:Ve=>W(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"system",children:e("fields.theme.options.system")}),y.jsx(Nn,{value:"light",children:e("fields.theme.options.light")}),y.jsx(Nn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),y.jsx(Gl,{checked:ln,onCheckedChange:yr})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ln&&y.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),y.jsxs(Ji,{value:kr,onValueChange:Ve=>Dr(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsx(na,{children:G$.filter(Ve=>Ve.startsWith("light")).map(Ve=>y.jsx(Nn,{value:Ve,children:e(`fields.claudeCodeTheme.options.${Ve}`)},Ve))})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),y.jsxs(Ji,{value:Hi,onValueChange:Ve=>_l(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsx(na,{children:G$.filter(Ve=>Ve.startsWith("dark")).map(Ve=>y.jsx(Nn,{value:Ve,children:e(`fields.claudeCodeTheme.options.${Ve}`)},Ve))})]})]})]})]})}),O?.enabled&&y.jsx(Vl,{title:e("sections.developer"),children:y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[y.jsx("div",{className:"flex-1",children:y.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:()=>{const Ve=O?.startedAt;lr(!0),I.mutate(void 0,{onSuccess:()=>{(async()=>{for(let ds=0;ds<120;ds++){await new Promise(Wi=>setTimeout(Wi,500));try{const Wi=await fetch("/api/config/developer-mode");if(Wi.ok&&(await Wi.json()).startedAt!==Ve){window.location.reload();return}}catch{}}lr(!1),gn.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Ft=>{lr(!1),gn.error(e("developer.restartFailed"),{description:Ft.message})}})},disabled:I.isPending||di,className:"shrink-0 gap-2",children:[(I.isPending||di)&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),e(di?"developer.restarting":"developer.restartButton")]})]})})})]})}),y.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:y.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[Pe&&y.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[y.jsx(ve,{icon:Eu,size:12,strokeWidth:2}),t("status.saved")]}),y.jsx(Ye,{size:"sm",onClick:_r,disabled:!Pa||Vt||G.isPending,children:t("buttons.save")})]})}),y.jsx(jy,{open:$e,onOpenChange:we,onSelect:Ve=>ee(Ve),initialPath:J||void 0})]})}const nw="";function OIe(){return or({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${nw}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function RIe(){return or({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${nw}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function IIe(e,t,n){return or({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${nw}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function NIe(e,t,n){return or({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${nw}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function DIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=an("review"),{t:i}=an("common"),{data:a,isLoading:s,error:o}=IIe(e,t,n);if(s)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(ve,{icon:xn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Hf,size:24}),y.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),y.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>y.jsx(LIe,{issue:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Eu,size:24}),y.jsx("p",{className:"text-sm",children:r(l[e])})]})}function LIe({issue:e}){return y.jsx(Ca,{className:"transition-colors hover:border-border/80",children:y.jsx(kf,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>y.jsx(uo,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&y.jsxs(uo,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function PIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=an("review"),{t:i}=an("common"),{data:a,isLoading:s,error:o}=NIe(e,t,n);if(s)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(ve,{icon:xn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Hf,size:24}),y.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),y.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>y.jsx(MIe,{pr:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Eu,size:24}),y.jsx("p",{className:"text-sm",children:r(l[e])})]})}function MIe({pr:e}){const{t}=an("review");return y.jsx(Ca,{className:"transition-colors hover:border-border/80",children:y.jsx(kf,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&y.jsx(uo,{variant:"secondary",className:We("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&y.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),y.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>y.jsx(uo,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&y.jsxs(uo,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const jIe=Us("/review/")({component:FIe});function FIe(){const{t:e}=an("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=OIe(),{data:m=[]}=RIe();return!p&&!d?y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:y.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[y.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:y.jsx(ve,{icon:i1e,size:24,className:"text-muted-foreground"})}),y.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),y.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),y.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[y.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),y.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:y.jsxs(Ye,{variant:"outline",size:"sm",className:"w-full",children:[y.jsx(ve,{icon:a1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),y.jsx(Pi,{to:"/settings",children:y.jsx(Ye,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):y.jsx("div",{className:"flex h-full flex-col",children:y.jsxs(nu,{value:t,onValueChange:S=>n(S),className:"flex flex-1 flex-col overflow-hidden",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-1 max-sm:px-2",children:[y.jsxs(ru,{variant:"line",children:[y.jsx(oi,{value:"prs",children:e("tabs.pullRequests")}),y.jsx(oi,{value:"issues",children:e("tabs.issues")})]}),y.jsxs("div",{className:"flex items-center gap-4 max-sm:gap-2",children:[t==="prs"?y.jsxs(Ji,{value:r,onValueChange:S=>i(S),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"created",children:e("filters.pr.created")}),y.jsx(Nn,{value:"assigned",children:e("filters.pr.assigned")}),y.jsx(Nn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),y.jsx(Nn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):y.jsxs(Ji,{value:a,onValueChange:S=>s(S),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"assigned",children:e("filters.issue.assigned")}),y.jsx(Nn,{value:"created",children:e("filters.issue.created")}),y.jsx(Nn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),y.jsxs(Ji,{value:u,onValueChange:S=>f(S||""),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{children:u||e("filters.allOrgs")})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"",children:e("filters.allOrganizations")}),m.map(S=>y.jsx(Nn,{value:S.login,children:S.login},S.login))]})]}),y.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",title:e("filters.viboraReposOnly"),children:[y.jsx(Gl,{checked:o,onCheckedChange:l,disabled:!!u}),y.jsx("span",{className:"text-muted-foreground max-sm:hidden",children:e("filters.viboraReposOnly")})]})]})]}),y.jsx(Ni,{value:"prs",className:"flex-1 overflow-auto p-4",children:y.jsx(PIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),y.jsx(Ni,{value:"issues",className:"flex-1 overflow-auto p-4",children:y.jsx(DIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function BIe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function UIe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function PM(e={}){const t=xie();return{get terminals(){return t.terminals.map(BIe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(UIe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup}}function Nie(){const e=ss(),{tabs:t,createTab:n,createTerminal:r,connected:i}=PM(),a=k.useRef(null);return k.useEffect(()=>{if(Gt.ws.debug("useOpenInTerminal: tabs effect",{hasPending:!!a.current,pendingDirectory:a.current?.directory,tabCount:t.length,tabDirectories:t.map(u=>u.directory)}),!a.current)return;const{directory:o}=a.current,l=t.find(u=>u.directory===o);Gt.ws.debug("useOpenInTerminal: checking for matching tab",{directory:o,matchingTab:l?{id:l.id,name:l.name}:null}),l&&(a.current=null,Gt.ws.info("useOpenInTerminal: creating terminal in tab",{tabId:l.id,directory:o}),r({name:"Terminal 1",cols:80,rows:24,tabId:l.id,positionInTab:0}),e({to:"/terminals",search:{tab:l.id}}))},[t,r,e]),{openInTerminal:k.useCallback((o,l)=>{if(Gt.ws.info("useOpenInTerminal: openInTerminal called",{directory:o,name:l,connected:i,tabCount:t.length}),!i){Gt.ws.warn("useOpenInTerminal: not connected, aborting");return}const u=t.find(f=>f.directory===o);if(Gt.ws.debug("useOpenInTerminal: existing tab check",{directory:o,existingTab:u?{id:u.id,name:u.name}:null}),u){Gt.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:u.id}),e({to:"/terminals",search:{tab:u.id}});return}Gt.ws.info("useOpenInTerminal: creating new tab",{name:l,directory:o}),a.current={directory:o,name:l},n(l,void 0,o)},[i,t,n,e]),connected:i}}const $Ie={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function HE(e,t,n,r){const i=$Ie[t];if(!n)return`${i}://file${e}`;const a=r!==22?`${n}:${r}`:n;return`${i}://vscode-remote/ssh-remote+${a}${e}`}function Die(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}function zE(e){window.parent!==window?window.parent.postMessage({type:"vibora:openUrl",url:e},"*"):window.open(e,"_blank")}const Lie="";function HIe(e){return or({queryKey:["copier-questions",e],queryFn:()=>Zt(`${Lie}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function zIe(){const{data:e,...t}=My();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function VIe(){const e=zr();return pr({mutationFn:t=>Zt(`${Lie}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function WIe(){const{t:e}=an("repositories"),t=ss(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,S]=k.useState(""),[_,g]=k.useState({}),[E,b]=k.useState(""),[x,T]=k.useState(""),[w,A]=k.useState(null),{data:R}=zIe(),{data:O}=jx(),I=d||m,{data:D,isLoading:P,error:H}=HIe(i==="questions"||i==="output"?I:null),M=VIe();k.useEffect(()=>{n&&(a("template"),p(""),S(""),g({}),b(O||""),T(""),A(null))},[n,O]),k.useEffect(()=>{D?.questions&&g(J=>{const ee={...J};for(const te of D.questions)ee[te.name]===void 0&&te.default!==void 0&&(ee[te.name]=te.default);return ee})},[D]);const W=k.useCallback(()=>{const J=f.current;if(!J)return;const ee=J.scrollHeight>J.clientHeight&&J.scrollTop+J.clientHeight<J.scrollHeight-10;u(ee)},[]);k.useEffect(()=>{const J=setTimeout(W,100);return()=>clearTimeout(J)},[i,D,W]);const V=k.useCallback(()=>{W()},[W]),$=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},G=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},K=()=>{a("creating"),A(null),M.mutate({templateSource:I,outputPath:E,answers:_,projectName:x},{onSuccess:J=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:J.repositoryId}})},onError:J=>{A(J.message),a("output")}})},U=J=>{const ee=_[J.name],te=Q=>g(ae=>({...ae,[J.name]:Q})),q=J.default===void 0||typeof J.default=="string"&&J.default.includes("{{")?`${J.name} *`:J.name;switch(J.type){case"bool":return y.jsxs(Dn,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(rl,{checked:ee,onCheckedChange:te}),y.jsx(Ln,{className:"cursor-pointer",children:q})]}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);case"int":case"float":return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),y.jsx(sn,{type:"number",value:ee,onChange:Q=>te(J.type==="int"?parseInt(Q.target.value):parseFloat(Q.target.value)),step:J.type==="float"?"any":1}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);default:{if(J.choices&&J.choices.length>0)return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),y.jsxs(Ji,{value:String(ee??""),onValueChange:te,children:[y.jsx(ta,{className:"w-full",children:y.jsx(ea,{})}),y.jsx(na,{children:J.choices.map(ae=>y.jsx(Nn,{value:String(ae.value),children:ae.label},String(ae.value)))})]}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);const Q=J.type==="yaml"||J.type==="json";return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),Q?y.jsx(Dx,{value:String(ee??""),onChange:ae=>te(ae.target.value),rows:4}):y.jsx(sn,{value:String(ee??""),onChange:ae=>te(ae.target.value)}),J.help&&y.jsx(Xi,{children:J.help})]},J.name)}}},B=!!I,F=D?.questions.filter(J=>{if(J.default!==void 0&&!(typeof J.default=="string"&&J.default.includes("{{")))return!1;const te=_[J.name];return te==null||te===""})??[],Y=D&&!P&&F.length===0,z=x.trim()&&E.trim();return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:n,onOpenChange:r,children:[y.jsxs(QP,{render:y.jsx(Ye,{variant:"outline",size:"sm"}),children:[y.jsx(ve,{icon:Q0e,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),y.jsxs(cl,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[y.jsxs(xu,{className:"shrink-0",children:[y.jsx(wu,{children:e("newProject.title")}),y.jsxs(Iy,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),y.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((J,ee)=>y.jsx("div",{className:We("flex-1 h-1 rounded",i===J||["template","questions","output"].indexOf(i)>ee||i==="creating"?"bg-primary":"bg-muted")},J))}),y.jsxs("div",{ref:f,onScroll:V,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&y.jsxs(tu,{children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.template.savedTemplates")}),y.jsxs(Ji,{value:d,onValueChange:J=>{p(J??""),S("")},children:[y.jsx(ta,{className:"w-full",children:y.jsx(ea,{children:d?R?.find(J=>J.id===d)?.displayName:y.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),y.jsx(na,{children:R?.map(J=>y.jsx(Nn,{value:J.id,children:J.displayName},J.id))})]})]}),y.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.template.customUrl")}),y.jsx(sn,{value:m,onChange:J=>{S(J.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),y.jsx(Xi,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&y.jsxs(tu,{children:[P&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),H&&y.jsx("div",{className:"text-destructive text-sm py-4",children:H.message}),D?.questions.map(U),D&&D.questions.length===0&&y.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&y.jsxs(tu,{children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.output.projectName")}),y.jsx(sn,{value:x,onChange:J=>T(J.target.value),placeholder:"my-new-project"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.output.outputDirectory")}),y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[y.jsx(ve,{icon:Mi,size:14,strokeWidth:2,className:"mr-2"}),E||e("newProject.steps.output.selectDirectory")]})]}),x&&E&&y.jsxs(Xi,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",E,"/",x]}),w&&y.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w})]}),i==="creating"&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[y.jsx(ve,{icon:xn,size:32,strokeWidth:2,className:"animate-spin text-primary"}),y.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&y.jsx("div",{className:"flex justify-center py-1",children:y.jsx(ve,{icon:WP,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),y.jsxs(zf,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&y.jsxs(Ye,{variant:"outline",onClick:G,children:[y.jsx(ve,{icon:Iee,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&y.jsx(Ry,{render:y.jsx(Ye,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&y.jsxs(Ye,{onClick:$,disabled:!B,children:[e("newProject.next"),y.jsx(ve,{icon:A$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&y.jsxs(Ye,{onClick:$,disabled:!Y,children:[e("newProject.next"),y.jsx(ve,{icon:A$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&y.jsx(Ye,{onClick:K,disabled:!z||M.isPending,children:e("newProject.create")})]})]})]}),y.jsx(jy,{open:s,onOpenChange:o,onSelect:J=>b(J),initialPath:O||void 0})]})}const GIe=Us("/repositories/")({component:YIe});function qIe({repository:e,onDelete:t,onStartTask:n,onOpenInTerminal:r,onViewTasks:i}){const{t:a}=an("repositories"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),{data:f}=Fx(),{data:d}=Bx(),{data:p}=Ux(),m=()=>{const _=HE(e.path,f,d,p);zE(_)},S=async()=>{u(!0);try{await t(),o(!1)}catch{}finally{u(!1)}};return y.jsxs(Ca,{className:"h-full group transition-colors hover:border-foreground/20",children:[y.jsx(Pi,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:y.jsx(kf,{className:"flex flex-col gap-3 py-4",children:y.jsxs("div",{className:"space-y-1",children:[y.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),y.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[y.jsx(ve,{icon:Mi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),y.jsx(kf,{className:"pt-0 pb-4 px-6",children:y.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[y.jsxs(Ye,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(ve,{icon:KP,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(ve,{icon:Lp,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[y.jsx(ve,{icon:Cx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:m,className:"text-muted-foreground hover:text-foreground",title:a("openInEditor",{editor:Die(f)}),children:[y.jsx(ve,{icon:YP,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("editor")})]}),y.jsxs(Fc,{open:s,onOpenChange:o,children:[y.jsxs(Bc,{render:y.jsx(Ye,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:a("delete.button")}),children:[y.jsx(ve,{icon:Om,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]}),y.jsxs(Uc,{children:[y.jsxs($c,{children:[y.jsx(zc,{children:a("delete.title")}),y.jsx(Vc,{children:a("delete.description",{name:e.displayName})})]}),y.jsxs(Hc,{children:[y.jsx(Wc,{disabled:l,children:a("addModal.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:S,disabled:l,className:"gap-2",children:[l&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),a(l?"delete.deleting":"delete.button")]})]})]})]})]})})]})}function KIe(){const{t:e}=an("repositories"),[t,n]=k.useState(!1),[r,i]=k.useState(!1),[a,s]=k.useState(""),[o,l]=k.useState(""),[u,f]=k.useState(""),[d,p]=k.useState(""),[m,S]=k.useState(!1),_=Xte(),{data:g}=jx(),E=T=>{s(T),o||l(T.split("/").pop()||"")},b=T=>{T.preventDefault(),a.trim()&&_.mutate({path:a.trim(),displayName:o.trim()||a.split("/").pop()||"repo",startupScript:u.trim()||null,copyFiles:d.trim()||null,isCopierTemplate:m},{onSuccess:()=>{n(!1),s(""),l(""),f(""),p(""),S(!1)}})},x=a?a.split("/").pop():"";return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:t,onOpenChange:n,children:[y.jsxs(QP,{render:y.jsx(Ye,{size:"sm"}),children:[y.jsx(ve,{icon:Ax,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),y.jsx(cl,{className:"sm:max-w-md",children:y.jsxs("form",{onSubmit:b,children:[y.jsxs(xu,{children:[y.jsx(wu,{children:e("addModal.title")}),y.jsx(Iy,{children:e("addModal.description")})]}),y.jsxs(tu,{className:"mt-4",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("addModal.fields.path")}),y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>i(!0),children:[y.jsx(ve,{icon:Mi,size:14,strokeWidth:2,className:"mr-2"}),x?y.jsx("span",{className:"truncate",children:a}):y.jsx("span",{className:"text-muted-foreground",children:e("addModal.fields.pathPlaceholder")})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"displayName",children:e("addModal.fields.displayName")}),y.jsx(sn,{id:"displayName",value:o,onChange:T=>l(T.target.value),placeholder:x||"My Project"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"startupScript",children:e("addModal.fields.startupScript")}),y.jsx(Dx,{id:"startupScript",value:u,onChange:T=>f(T.target.value),placeholder:e("addModal.fields.startupScriptPlaceholder"),rows:2}),y.jsx(Xi,{children:e("addModal.fields.startupScriptDescription")})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"copyFiles",children:e("addModal.fields.copyFiles")}),y.jsx(sn,{id:"copyFiles",value:d,onChange:T=>p(T.target.value),placeholder:e("addModal.fields.copyFilesPlaceholder")}),y.jsx(Xi,{children:e("addModal.fields.copyFilesDescription")})]}),y.jsxs(Dn,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(rl,{checked:m,onCheckedChange:T=>S(T===!0)}),y.jsx(Ln,{className:"cursor-pointer",children:e("addModal.fields.isCopierTemplate")})]}),y.jsx(Xi,{children:e("addModal.fields.isCopierTemplateDescription")})]})]}),y.jsxs(zf,{className:"mt-4",children:[y.jsx(Ry,{render:y.jsx(Ye,{variant:"outline",type:"button"}),children:e("addModal.cancel")}),y.jsx(Ye,{type:"submit",disabled:_.isPending||!a.trim(),children:_.isPending?e("addModal.adding"):e("addRepository")})]})]})})]}),y.jsx(jy,{open:r,onOpenChange:i,onSelect:E,initialPath:g||void 0})]})}function YIe(){const{t:e}=an("repositories"),t=ss(),{data:n,isLoading:r,error:i}=My(),a=Zte(),[s,o]=k.useState(null),{openInTerminal:l}=Nie(),u=async d=>{await a.mutateAsync(d)},f=d=>{t({to:"/tasks",search:{repo:d}})};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsx(WIe,{}),y.jsx(KIe,{})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(ve,{icon:Hf,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n?.map(d=>y.jsx(qIe,{repository:d,onDelete:()=>u(d.id),onStartTask:()=>o(d),onOpenInTerminal:()=>l(d.path,d.displayName),onViewTasks:()=>f(d.displayName)},d.id))})]}),y.jsx(hM,{open:s!==null,onOpenChange:d=>!d&&o(null),defaultRepository:s??void 0,showTrigger:!1})]})}var Ek,uz;function Da(){if(uz)return Ek;uz=1;var e=Array.isArray;return Ek=e,Ek}var Sk,cz;function Pie(){if(cz)return Sk;cz=1;var e=typeof N1=="object"&&N1&&N1.Object===Object&&N1;return Sk=e,Sk}var xk,dz;function ml(){if(dz)return xk;dz=1;var e=Pie(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return xk=n,xk}var wk,fz;function qy(){if(fz)return wk;fz=1;var e=ml(),t=e.Symbol;return wk=t,wk}var Tk,hz;function XIe(){if(hz)return Tk;hz=1;var e=qy(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return Tk=a,Tk}var Ck,pz;function ZIe(){if(pz)return Ck;pz=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Ck=n,Ck}var Ak,mz;function Au(){if(mz)return Ak;mz=1;var e=qy(),t=XIe(),n=ZIe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return Ak=s,Ak}var kk,gz;function ku(){if(gz)return kk;gz=1;function e(t){return t!=null&&typeof t=="object"}return kk=e,kk}var Ok,bz;function Pm(){if(bz)return Ok;bz=1;var e=Au(),t=ku(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Ok=r,Ok}var Rk,vz;function MM(){if(vz)return Rk;vz=1;var e=Da(),t=Pm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Rk=i,Rk}var Ik,yz;function sd(){if(yz)return Ik;yz=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ik=e,Ik}var Nk,_z;function jM(){if(_z)return Nk;_z=1;var e=Au(),t=sd(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Nk=s,Nk}var Dk,Ez;function QIe(){if(Ez)return Dk;Ez=1;var e=ml(),t=e["__core-js_shared__"];return Dk=t,Dk}var Lk,Sz;function JIe(){if(Sz)return Lk;Sz=1;var e=QIe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Lk=n,Lk}var Pk,xz;function Mie(){if(xz)return Pk;xz=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Pk=n,Pk}var Mk,wz;function eNe(){if(wz)return Mk;wz=1;var e=jM(),t=JIe(),n=sd(),r=Mie(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return Mk=d,Mk}var jk,Tz;function tNe(){if(Tz)return jk;Tz=1;function e(t,n){return t?.[n]}return jk=e,jk}var Fk,Cz;function Zf(){if(Cz)return Fk;Cz=1;var e=eNe(),t=tNe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return Fk=n,Fk}var Bk,Az;function rw(){if(Az)return Bk;Az=1;var e=Zf(),t=e(Object,"create");return Bk=t,Bk}var Uk,kz;function nNe(){if(kz)return Uk;kz=1;var e=rw();function t(){this.__data__=e?e(null):{},this.size=0}return Uk=t,Uk}var $k,Oz;function rNe(){if(Oz)return $k;Oz=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return $k=e,$k}var Hk,Rz;function iNe(){if(Rz)return Hk;Rz=1;var e=rw(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return Hk=i,Hk}var zk,Iz;function aNe(){if(Iz)return zk;Iz=1;var e=rw(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return zk=r,zk}var Vk,Nz;function sNe(){if(Nz)return Vk;Nz=1;var e=rw(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return Vk=n,Vk}var Wk,Dz;function oNe(){if(Dz)return Wk;Dz=1;var e=nNe(),t=rNe(),n=iNe(),r=aNe(),i=sNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Wk=a,Wk}var Gk,Lz;function lNe(){if(Lz)return Gk;Lz=1;function e(){this.__data__=[],this.size=0}return Gk=e,Gk}var qk,Pz;function FM(){if(Pz)return qk;Pz=1;function e(t,n){return t===n||t!==t&&n!==n}return qk=e,qk}var Kk,Mz;function iw(){if(Mz)return Kk;Mz=1;var e=FM();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Kk=t,Kk}var Yk,jz;function uNe(){if(jz)return Yk;jz=1;var e=iw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return Yk=r,Yk}var Xk,Fz;function cNe(){if(Fz)return Xk;Fz=1;var e=iw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return Xk=t,Xk}var Zk,Bz;function dNe(){if(Bz)return Zk;Bz=1;var e=iw();function t(n){return e(this.__data__,n)>-1}return Zk=t,Zk}var Qk,Uz;function fNe(){if(Uz)return Qk;Uz=1;var e=iw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return Qk=t,Qk}var Jk,$z;function aw(){if($z)return Jk;$z=1;var e=lNe(),t=uNe(),n=cNe(),r=dNe(),i=fNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Jk=a,Jk}var eO,Hz;function BM(){if(Hz)return eO;Hz=1;var e=Zf(),t=ml(),n=e(t,"Map");return eO=n,eO}var tO,zz;function hNe(){if(zz)return tO;zz=1;var e=oNe(),t=aw(),n=BM();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return tO=r,tO}var nO,Vz;function pNe(){if(Vz)return nO;Vz=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return nO=e,nO}var rO,Wz;function sw(){if(Wz)return rO;Wz=1;var e=pNe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return rO=t,rO}var iO,Gz;function mNe(){if(Gz)return iO;Gz=1;var e=sw();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return iO=t,iO}var aO,qz;function gNe(){if(qz)return aO;qz=1;var e=sw();function t(n){return e(this,n).get(n)}return aO=t,aO}var sO,Kz;function bNe(){if(Kz)return sO;Kz=1;var e=sw();function t(n){return e(this,n).has(n)}return sO=t,sO}var oO,Yz;function vNe(){if(Yz)return oO;Yz=1;var e=sw();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return oO=t,oO}var lO,Xz;function UM(){if(Xz)return lO;Xz=1;var e=hNe(),t=mNe(),n=gNe(),r=bNe(),i=vNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,lO=a,lO}var uO,Zz;function jie(){if(Zz)return uO;Zz=1;var e=UM(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,uO=n,uO}var cO,Qz;function yNe(){if(Qz)return cO;Qz=1;var e=jie(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return cO=n,cO}var dO,Jz;function _Ne(){if(Jz)return dO;Jz=1;var e=yNe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return dO=r,dO}var fO,eV;function $M(){if(eV)return fO;eV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return fO=e,fO}var hO,tV;function ENe(){if(tV)return hO;tV=1;var e=qy(),t=$M(),n=Da(),r=Pm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return hO=s,hO}var pO,nV;function Fie(){if(nV)return pO;nV=1;var e=ENe();function t(n){return n==null?"":e(n)}return pO=t,pO}var mO,rV;function Bie(){if(rV)return mO;rV=1;var e=Da(),t=MM(),n=_Ne(),r=Fie();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return mO=i,mO}var gO,iV;function ow(){if(iV)return gO;iV=1;var e=Pm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return gO=t,gO}var bO,aV;function HM(){if(aV)return bO;aV=1;var e=Bie(),t=ow();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return bO=n,bO}var vO,sV;function Uie(){if(sV)return vO;sV=1;var e=HM();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return vO=t,vO}var SNe=Uie();const Fs=Sn(SNe);var yO,oV;function xNe(){if(oV)return yO;oV=1;function e(t){return t==null}return yO=e,yO}var wNe=xNe();const fn=Sn(wNe);var _O,lV;function TNe(){if(lV)return _O;lV=1;var e=Au(),t=Da(),n=ku(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return _O=i,_O}var CNe=TNe();const Nf=Sn(CNe);var ANe=jM();const zt=Sn(ANe);var kNe=sd();const Mm=Sn(kNe);var EO={exports:{}},Pn={};var uV;function ONe(){if(uV)return Pn;uV=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),S;S=Symbol.for("react.module.reference");function _(g){if(typeof g=="object"&&g!==null){var E=g.$$typeof;switch(E){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return E}}case t:return E}}}return Pn.ContextConsumer=s,Pn.ContextProvider=a,Pn.Element=e,Pn.ForwardRef=l,Pn.Fragment=n,Pn.Lazy=p,Pn.Memo=d,Pn.Portal=t,Pn.Profiler=i,Pn.StrictMode=r,Pn.Suspense=u,Pn.SuspenseList=f,Pn.isAsyncMode=function(){return!1},Pn.isConcurrentMode=function(){return!1},Pn.isContextConsumer=function(g){return _(g)===s},Pn.isContextProvider=function(g){return _(g)===a},Pn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Pn.isForwardRef=function(g){return _(g)===l},Pn.isFragment=function(g){return _(g)===n},Pn.isLazy=function(g){return _(g)===p},Pn.isMemo=function(g){return _(g)===d},Pn.isPortal=function(g){return _(g)===t},Pn.isProfiler=function(g){return _(g)===i},Pn.isStrictMode=function(g){return _(g)===r},Pn.isSuspense=function(g){return _(g)===u},Pn.isSuspenseList=function(g){return _(g)===f},Pn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===S||g.getModuleId!==void 0)},Pn.typeOf=_,Pn}var cV;function RNe(){return cV||(cV=1,EO.exports=ONe()),EO.exports}var INe=RNe(),SO,dV;function $ie(){if(dV)return SO;dV=1;var e=Au(),t=ku(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return SO=r,SO}var xO,fV;function NNe(){if(fV)return xO;fV=1;var e=$ie();function t(n){return e(n)&&n!=+n}return xO=t,xO}var DNe=NNe();const jm=Sn(DNe);var LNe=$ie();const PNe=Sn(LNe);var xa=function(t){return t===0?0:t>0?1:-1},Xd=function(t){return Nf(t)&&t.indexOf("%")===t.length-1},at=function(t){return PNe(t)&&!jm(t)},MNe=function(t){return fn(t)},Jr=function(t){return at(t)||Nf(t)},jNe=0,Ky=function(t){var n=++jNe;return"".concat(t||"").concat(n)},oo=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Nf(t))return r;var a;if(Xd(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return jm(a)&&(a=r),i&&a>n&&(a=n),a},mc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},FNe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},Zi=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function VE(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Fs(r,t))===n})}var BNe=function(t,n){return at(t)&&at(n)?t-n:Nf(t)&&Nf(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Sp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function fD(e){"@babel/helpers - typeof";return fD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fD(e)}var UNe=["viewBox","children"],$Ne=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],hV=["points","pathLength"],wO={svg:UNe,polygon:hV,polyline:hV},zM=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],WE=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Mm(r))return null;var i={};return Object.keys(r).forEach(function(a){zM.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},HNe=function(t,n,r){return function(i){return t(n,r,i),null}},Yc=function(t,n,r){if(!Mm(t)||fD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];zM.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=HNe(s,n,r))}),i},zNe=["children"],VNe=["children"];function pV(e,t){if(e==null)return{};var n=WNe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function WNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hD(e){"@babel/helpers - typeof";return hD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hD(e)}var mV={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},ou=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},gV=null,TO=null,VM=function e(t){if(t===gV&&Array.isArray(TO))return TO;var n=[];return k.Children.forEach(t,function(r){fn(r)||(INe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),TO=n,gV=t,n};function Bs(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return ou(i)}):r=[ou(t)],VM(e).forEach(function(i){var a=Fs(i,"type.displayName")||Fs(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function Ya(e,t){var n=Bs(e,t);return n&&n[0]}var bV=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},GNe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],qNe=function(t){return t&&t.type&&Nf(t.type)&&GNe.indexOf(t.type)>=0},KNe=function(t){return t&&hD(t)==="object"&&"clipDot"in t},YNe=function(t,n,r,i){var a,s=(a=wO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!zt(t)&&(i&&s.includes(n)||$Ne.includes(n))||r&&zM.includes(n)},It=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Mm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;YNe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},pD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return vV(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!vV(a,s))return!1}return!0},vV=function(t,n){if(fn(t)&&fn(n))return!0;if(!fn(t)&&!fn(n)){var r=t.props||{},i=r.children,a=pV(r,zNe),s=n.props||{},o=s.children,l=pV(s,VNe);return i&&o?Sp(a,l)&&pD(i,o):!i&&!o?Sp(a,l):!1}return!1},yV=function(t,n){var r=[],i={};return VM(t).forEach(function(a,s){if(qNe(a))r.push(a);else if(a){var o=ou(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},XNe=function(t){var n=t&&t.type;return n&&mV[n]?mV[n]:null},ZNe=function(t,n){return VM(n).indexOf(t)},QNe=["children","width","height","viewBox","className","style","title","desc"];function mD(){return mD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mD.apply(this,arguments)}function JNe(e,t){if(e==null)return{};var n=eDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gD(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=JNe(e,QNe),f=i||{width:n,height:r,x:0,y:0},d=Xt("recharts-surface",a);return oe.createElement("svg",mD({},It(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var tDe=["children","className"];function bD(){return bD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bD.apply(this,arguments)}function nDe(e,t){if(e==null)return{};var n=rDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var wn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=nDe(e,tDe),a=Xt("recharts-layer",r);return oe.createElement("g",bD({className:a},It(i,!0),{ref:t}),n)}),lu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},CO,_V;function iDe(){if(_V)return CO;_V=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return CO=e,CO}var AO,EV;function aDe(){if(EV)return AO;EV=1;var e=iDe();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return AO=t,AO}var kO,SV;function Hie(){if(SV)return kO;SV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return kO=l,kO}var OO,xV;function sDe(){if(xV)return OO;xV=1;function e(t){return t.split("")}return OO=e,OO}var RO,wV;function oDe(){if(wV)return RO;wV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",S=u+"?",_="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+_+S+")*",E=_+S+g,b="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+b+E,"g");function T(w){return w.match(x)||[]}return RO=T,RO}var IO,TV;function lDe(){if(TV)return IO;TV=1;var e=sDe(),t=Hie(),n=oDe();function r(i){return t(i)?n(i):e(i)}return IO=r,IO}var NO,CV;function uDe(){if(CV)return NO;CV=1;var e=aDe(),t=Hie(),n=lDe(),r=Fie();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return NO=i,NO}var DO,AV;function cDe(){if(AV)return DO;AV=1;var e=uDe(),t=e("toUpperCase");return DO=t,DO}var dDe=cDe();const lw=Sn(dDe);function Zn(e){return function(){return e}}const zie=Math.cos,GE=Math.sin,wo=Math.sqrt,qE=Math.PI,uw=2*qE,vD=Math.PI,yD=2*vD,jd=1e-6,fDe=yD-jd;function Vie(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function hDe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Vie;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class pDe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Vie:hDe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>jd)if(!(Math.abs(d*l-u*f)>jd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,S=i-o,_=l*l+u*u,g=m*m+S*S,E=Math.sqrt(_),b=Math.sqrt(p),x=a*Math.tan((vD-Math.acos((_+p-g)/(2*E*b)))/2),T=x/b,w=x/E;Math.abs(T-1)>jd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*S)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>jd||Math.abs(this._y1-f)>jd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%yD+yD),p>fDe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>jd&&this._append`A${r},${r},0,${+(p>=vD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function WM(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new pDe(t)}function GM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wie(e){this._context=e}Wie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function cw(e){return new Wie(e)}function Gie(e){return e[0]}function qie(e){return e[1]}function Kie(e,t){var n=Zn(!0),r=null,i=cw,a=null,s=WM(o);e=typeof e=="function"?e:e===void 0?Gie:Zn(e),t=typeof t=="function"?t:t===void 0?qie:Zn(t);function o(l){var u,f=(l=GM(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function c_(e,t,n){var r=null,i=Zn(!0),a=null,s=cw,o=null,l=WM(u);e=typeof e=="function"?e:e===void 0?Gie:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?qie:Zn(+n);function u(d){var p,m,S,_=(d=GM(d)).length,g,E=!1,b,x=new Array(_),T=new Array(_);for(a==null&&(o=s(b=l())),p=0;p<=_;++p){if(!(p<_&&i(g=d[p],p,d))===E)if(E=!E)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),S=p-1;S>=m;--S)o.point(x[S],T[S]);o.lineEnd(),o.areaEnd()}E&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(b)return o=null,b+""||null}function f(){return Kie().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class Yie{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function mDe(e){return new Yie(e,!0)}function gDe(e){return new Yie(e,!1)}const qM={draw(e,t){const n=wo(t/qE);e.moveTo(n,0),e.arc(0,0,n,0,uw)}},bDe={draw(e,t){const n=wo(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Xie=wo(1/3),vDe=Xie*2,yDe={draw(e,t){const n=wo(t/vDe),r=n*Xie;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},_De={draw(e,t){const n=wo(t),r=-n/2;e.rect(r,r,n,n)}},EDe=.8908130915292852,Zie=GE(qE/10)/GE(7*qE/10),SDe=GE(uw/10)*Zie,xDe=-zie(uw/10)*Zie,wDe={draw(e,t){const n=wo(t*EDe),r=SDe*n,i=xDe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=uw*a/5,o=zie(s),l=GE(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},LO=wo(3),TDe={draw(e,t){const n=-wo(t/(LO*3));e.moveTo(0,n*2),e.lineTo(-LO*n,-n),e.lineTo(LO*n,-n),e.closePath()}},_s=-.5,Es=wo(3)/2,_D=1/wo(12),CDe=(_D/2+1)*3,ADe={draw(e,t){const n=wo(t/CDe),r=n/2,i=n*_D,a=r,s=n*_D+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(_s*r-Es*i,Es*r+_s*i),e.lineTo(_s*a-Es*s,Es*a+_s*s),e.lineTo(_s*o-Es*l,Es*o+_s*l),e.lineTo(_s*r+Es*i,_s*i-Es*r),e.lineTo(_s*a+Es*s,_s*s-Es*a),e.lineTo(_s*o+Es*l,_s*l-Es*o),e.closePath()}};function kDe(e,t){let n=null,r=WM(i);e=typeof e=="function"?e:Zn(e||qM),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function KE(){}function YE(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Qie(e){this._context=e}Qie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:YE(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ODe(e){return new Qie(e)}function Jie(e){this._context=e}Jie.prototype={areaStart:KE,areaEnd:KE,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RDe(e){return new Jie(e)}function eae(e){this._context=e}eae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IDe(e){return new eae(e)}function tae(e){this._context=e}tae.prototype={areaStart:KE,areaEnd:KE,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function NDe(e){return new tae(e)}function kV(e){return e<0?-1:1}function OV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(kV(a)+kV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function RV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function PO(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function XE(e){this._context=e}XE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:PO(this,this._t0,RV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,PO(this,RV(this,n=OV(this,e,t)),n);break;default:PO(this,this._t0,n=OV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function nae(e){this._context=new rae(e)}(nae.prototype=Object.create(XE.prototype)).point=function(e,t){XE.prototype.point.call(this,t,e)};function rae(e){this._context=e}rae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function DDe(e){return new XE(e)}function LDe(e){return new nae(e)}function iae(e){this._context=e}iae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=IV(e),i=IV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function IV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function PDe(e){return new iae(e)}function dw(e,t){this._context=e,this._t=t}dw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function MDe(e){return new dw(e,.5)}function jDe(e){return new dw(e,0)}function FDe(e){return new dw(e,1)}function Wp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ED(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function BDe(e,t){return e[t]}function UDe(e){const t=[];return t.key=e,t}function $De(){var e=Zn([]),t=ED,n=Wp,r=BDe;function i(a){var s=Array.from(e.apply(this,arguments),UDe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=GM(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ED:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Wp,i):n},i}function HDe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Wp(e,t)}}function zDe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Wp(e,t)}}function VDe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,S=0;S<o;++S){var _=e[t[S]],g=_[r][1]||0,E=_[r-1][1]||0;m+=g-E}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Wp(e,t)}}function Tv(e){"@babel/helpers - typeof";return Tv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tv(e)}var WDe=["type","size","sizeType"];function SD(){return SD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SD.apply(this,arguments)}function NV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function DV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NV(Object(n),!0).forEach(function(r){GDe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function GDe(e,t,n){return t=qDe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qDe(e){var t=KDe(e,"string");return Tv(t)=="symbol"?t:t+""}function KDe(e,t){if(Tv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Tv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function YDe(e,t){if(e==null)return{};var n=XDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var aae={symbolCircle:qM,symbolCross:bDe,symbolDiamond:yDe,symbolSquare:_De,symbolStar:wDe,symbolTriangle:TDe,symbolWye:ADe},ZDe=Math.PI/180,QDe=function(t){var n="symbol".concat(lw(t));return aae[n]||qM},JDe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*ZDe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},eLe=function(t,n){aae["symbol".concat(lw(t))]=n},KM=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=YDe(t,WDe),u=DV(DV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=QDe(r),E=kDe().type(g).size(JDe(a,o,r));return E()},d=u.className,p=u.cx,m=u.cy,S=It(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",SD({},S,{className:Xt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};KM.registerSymbol=eLe;function Gp(e){"@babel/helpers - typeof";return Gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gp(e)}function xD(){return xD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xD.apply(this,arguments)}function LV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tLe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LV(Object(n),!0).forEach(function(r){Cv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nLe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rLe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oae(r.key),r)}}function iLe(e,t,n){return t&&rLe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aLe(e,t,n){return t=ZE(t),sLe(e,sae()?Reflect.construct(t,n||[],ZE(e).constructor):t.apply(e,n))}function sLe(e,t){if(t&&(Gp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oLe(e)}function oLe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sae=function(){return!!e})()}function ZE(e){return ZE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ZE(e)}function lLe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wD(e,t)}function wD(e,t){return wD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},wD(e,t)}function Cv(e,t,n){return t=oae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oae(e){var t=uLe(e,"string");return Gp(t)=="symbol"?t:t+""}function uLe(e,t){if(Gp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ss=32,YM=(function(e){function t(){return nLe(this,t),aLe(this,t,arguments)}return lLe(t,e),iLe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=Ss/2,s=Ss/6,o=Ss/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:Ss,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
|
|
44
|
+
`}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i){const a=dD(),s=iz(),o=r??e.tabs.items.length,l={id:s,name:n,position:o,directory:i??null,createdAt:Date.now()},u=YH(e.tabs);e.tabs.add(l),u.stop(),e.tabs.get(s)?.setPending(!0),e.pendingTabCreation=s,e.pendingUpdates.set(a,{entityType:"tab",tempId:s,inversePatches:u.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,requestId:a,tempId:s}}),t().log.ws.debug("createTab optimistic",{requestId:a,tempId:s,name:n})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){const i=e.tabs.get(n);if(!i)return;const a=i.position;if(t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),r>a)for(const s of e.tabs.items)s.position>a&&s.position<=r&&s.setPosition(s.position-1);else if(r<a)for(const s of e.tabs.items)s.position>=r&&s.position<a&&s.setPosition(s.position+1);i.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const S=e.terminals.items.findIndex(E=>E.id===l);S>=0&&BE(e.terminals.items[S]),e.terminals.add(a);const _=e.terminals.get(a.id);t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!_,hasXterm:!!d,willAttach:!!(_&&d)}),_&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const g=e.terminalsPendingStartup.get(l);g&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,g),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!g})}else{const S=e.terminals.items.findIndex(g=>g.id===l);S>=0&&BE(e.terminals.items[S]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,e.lastCreatedTabId=a.id,t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)_v(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}Gt.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function xie(){const e=uIe();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await Jee(l);e.writeToTerminal(r,u)}catch(u){Gt.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.sorted]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const yk="",iIe=At.model("File",{path:At.identifier,content:At.string,originalContent:At.string,mimeType:At.string,size:At.number,lineCount:At.number,truncated:At.boolean,isMarkdownView:At.optional(At.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),aIe=At.model("FilesStore",{selectedFile:At.maybeNull(At.string),expandedDirs:At.array(At.string),openFiles:At.map(iIe)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:gk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield Zt(`${yk}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:gk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield Zt(`${yk}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:gk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${yk}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function sIe(){return aIe.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const wie=k.createContext(null);function oIe(e,t=!1){const n=k.useMemo(()=>sIe(),[]);return k.useEffect(()=>{n.setWorktreePath(e),n.setReadOnly(t),e&&n.loadFileTree()},[n,e,t]),n}function lIe(){const e=k.useContext(wie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function Tie(){const e=lIe();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const Cie=k.createContext(null);function uIe(){const e=k.useContext(Cie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function cIe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function dIe({children:e,wsUrl:t=cIe(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(Gt.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):Gt.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:Gt};o.current=rIe.create({},d)}const f=o.current;return k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const S=new WebSocket(t);i.current=S,S.onopen=()=>{d&&(Gt.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},S.onmessage=_=>{if(d)try{const g=JSON.parse(_.data);f.handleMessage(g)}catch(g){Gt.ws.error("Failed to parse WebSocket message",{error:String(g)})}},S.onclose=()=>{if(d)if(Gt.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===S&&(i.current=null),a.current<r){a.current++;const _=n*Math.pow(1.5,a.current-1);Gt.ws.info("Scheduling reconnect",{attempt:a.current,delay:_}),s.current=setTimeout(p,_)}else Gt.ws.warn("Max reconnect attempts reached")},S.onerror=_=>{Gt.ws.error("WebSocket error",{event:String(_)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),y.jsx(Cie.Provider,{value:f,children:e})}function az(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function fIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const qi="all-tasks",sz=["IN_PROGRESS","IN_REVIEW"],oz="vibora:lastTerminalTab",hIe=wM(function(){const{t}=an("terminals"),n=ss(),{tab:r}=ax({from:"/terminals/"}),{terminals:i,tabs:a,connected:s,createTerminal:o,destroyTerminal:l,renameTerminal:u,assignTerminalToTab:f,createTab:d,updateTab:p,deleteTab:m,reorderTab:S,attachXterm:_,resizeTerminal:g,setupImagePaste:E,writeToTerminal:b,sendInputToTerminal:x,newTerminalIds:T,pendingTabCreation:w,lastCreatedTabId:A,clearLastCreatedTabId:R}=xie(),[O,I]=k.useState(null),{getFocusedTerminal:D}=ene(),P=k.useMemo(()=>a.map(ue=>ue.id),[a]),H=r&&(P.includes(r)||r===qi),M=H?r:a[0]?.id??null,W=k.useCallback(ue=>{n({to:"/terminals",search:{tab:ue},replace:!0})},[n]);k.useEffect(()=>{if(a.length!==0){if(A){Gt.terminal.debug("Navigating to newly created tab",{tabId:A}),W(A);const ue=A;R(),setTimeout(()=>{Z.current++;const ye=`Terminal ${Z.current}`;Gt.terminal.debug("Creating terminal in new tab",{tabId:ue,name:ye}),o({name:ye,cols:80,rows:24,tabId:ue,positionInTab:0})},100);return}if(!w&&!H){const ue=localStorage.getItem(oz),ye=ue&&(a.some(Ie=>Ie.id===ue)||ue===qi)?ue:a[0].id;n({to:"/terminals",search:{tab:ye},replace:!0})}}},[a,H,A,w,W,R,n,o]),k.useEffect(()=>{M&&localStorage.setItem(oz,M)},[M]);const{data:V=[],status:$}=cM(),{data:G=[]}=My(),[K,U]=k.useState(null),B=k.useMemo(()=>{const ue=new Map;for(const ye of G)ue.set(ye.path,ye.id);return ue},[G]),F=k.useMemo(()=>new Set(V.filter(ue=>sz.includes(ue.status)&&ue.worktreePath).map(ue=>ue.worktreePath)),[V]),Y=k.useMemo(()=>i.filter(ue=>ue.tabId!=null||ue.cwd&&F.has(ue.cwd)).length,[i,F]),z=k.useMemo(()=>new Set(V.filter(ue=>ue.worktreePath).map(ue=>ue.worktreePath)),[V]),J=k.useMemo(()=>{const ue=new Map;for(const ye of V)ye.worktreePath&&ue.set(ye.worktreePath,{taskId:ye.id,repoId:B.get(ye.repoPath),repoName:ye.repoName,title:ye.title,repoPath:ye.repoPath,worktreePath:ye.worktreePath,baseBranch:ye.baseBranch,branch:ye.branch,prUrl:ye.prUrl});return ue},[V,B]),ee=k.useMemo(()=>{const ue=new Set(V.filter(ye=>sz.includes(ye.status)).map(ye=>ye.repoName));return Array.from(ue).sort()},[V]),te=k.useRef(new Map),Z=k.useRef(0),q=k.useRef(!1),Q=k.useRef(!1),ae=k.useMemo(()=>M===qi?i.filter(ue=>ue.cwd&&F.has(ue.cwd)).filter(ue=>K?V.find(Ie=>Ie.worktreePath===ue.cwd)?.repoName===K:!0).sort((ue,ye)=>{const Ie=V.find(Ne=>Ne.worktreePath===ue.cwd),pe=V.find(Ne=>Ne.worktreePath===ye.cwd);return!Ie||!pe?0:new Date(pe.createdAt).getTime()-new Date(Ie.createdAt).getTime()}).map(az):i.filter(ue=>ue.tabId===M).sort((ue,ye)=>ue.positionInTab-ye.positionInTab).map(az),[M,i,F,K,V]),se=k.useCallback(()=>{if(Gt.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:s,pendingTerminalCreate:q.current,terminalCount:i.length}),q.current){Gt.terminal.debug("Skipping terminal creation, already pending");return}q.current=!0,Z.current++;const ue=`Terminal ${Z.current}`,ye=i.filter(pe=>pe.tabId===M),Ie=ye.length;Gt.terminal.info("Creating terminal",{name:ue,tabId:M,positionInTab:Ie,terminalsInTabCount:ye.length}),o({name:ue,cols:80,rows:24,tabId:M??void 0,positionInTab:Ie}),setTimeout(()=>{q.current=!1},500)},[o,M,i,s]);k.useEffect(()=>{if($!=="success"){Gt.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:$});return}for(const ue of i)ue.cwd&&z.has(ue.cwd)&&ue.tabId&&(Gt.terminalsView.debug("Removing task terminal from regular tab",{terminalId:ue.id,name:ue.name,cwd:ue.cwd,tabId:ue.tabId}),f(ue.id,null))},[i,z,f,$]);const ne=k.useCallback(ue=>{const ye=te.current.get(ue);ye&&(ye(),te.current.delete(ue)),l(ue,{force:!0,reason:"user_closed"})},[l]),_e=k.useCallback((ue,ye)=>{const Ie=_(ue,ye);te.current.set(ue,Ie),T.has(ue)&&setTimeout(()=>{ye.focus()},50)},[_,T]),Ee=k.useCallback((ue,ye,Ie)=>{g(ue,ye,Ie)},[g]),de=k.useCallback((ue,ye)=>{u(ue,ye)},[u]),ge=k.useCallback(()=>{if(Q.current){Gt.terminal.debug("Skipping tab creation, already pending");return}Q.current=!0;const ue=`Tab ${a.length+1}`;Gt.terminal.debug("Quick creating tab",{name:ue}),d(ue,void 0,void 0),setTimeout(()=>{Q.current=!1},500)},[d,a.length]),me=k.useCallback((ue,ye)=>{Gt.terminal.debug("Reordering tab",{tabId:ue,newPosition:ye}),S(ue,ye)},[S]),Ke=k.useCallback((ue,ye)=>{if(Q.current){Gt.terminal.debug("Skipping tab creation, already pending");return}Q.current=!0,Gt.terminal.debug("Creating tab",{name:ue,directory:ye}),d(ue,void 0,ye),setTimeout(()=>{Q.current=!1},500)},[d]),Se=k.useCallback(ue=>{const ye=i.filter(Ie=>Ie.tabId===ue);for(const Ie of ye){const pe=te.current.get(Ie.id);pe&&(pe(),te.current.delete(Ie.id))}m(ue)},[i,m]),$e=a.map(fIe),we=k.useCallback(ue=>{I(ue)},[]),Pe=k.useCallback((ue,ye)=>{p(ue,ye)},[p]);return Ts("meta+d",se,{enabled:M!==qi&&s,allowInTerminal:!0,deps:[se,M,s]}),Ts("meta+w",()=>{if(M&&M!==qi){const ue=D(M);ue&&ne(ue)}},{enabled:M!==qi,allowInTerminal:!0,deps:[M,D,ne]}),y.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[y.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[y.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto",children:y.jsxs("div",{className:"flex items-center",children:[y.jsxs("button",{onClick:()=>W(qi),className:We("relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===qi?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===qi?"after:opacity-100":"after:opacity-0"),children:[y.jsx(ve,{icon:Lp,size:12,strokeWidth:2}),y.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),y.jsx("div",{className:"mx-2 h-4 w-px bg-border"}),y.jsx(gRe,{tabs:$e,activeTabId:M??"",onTabSelect:W,onTabClose:Se,onTabCreate:ge,onTabEdit:we,onTabReorder:me})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===qi&&ee.length>1&&y.jsxs(Ji,{value:K??"",onValueChange:ue=>U(ue||null),children:[y.jsxs(ta,{size:"sm",className:"max-sm:w-auto",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(ea,{children:K||t("allRepos")})]}),y.jsxs(na,{children:[y.jsx(Nn,{value:"",children:t("allRepos")}),ee.map(ue=>y.jsx(Nn,{value:ue,children:ue},ue))]})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:se,disabled:!s||Y>=24||M===qi,className:"max-sm:px-2 border-transparent text-primary",children:[y.jsx(ve,{icon:Cx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),y.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:y.jsx(TOe,{terminals:ae,onTerminalClose:M===qi?void 0:ne,onTerminalAdd:s&&M!==qi?se:void 0,onTerminalReady:_e,onTerminalResize:Ee,onTerminalRename:M===qi?void 0:de,setupImagePaste:E,writeToTerminal:b,sendInputToTerminal:x,taskInfoByCwd:M===qi?J:void 0})}),y.jsx(bRe,{tab:O,open:O!==null,onOpenChange:ue=>{ue||I(null)},onSave:Pe,onCreate:Ke,defaultName:`Tab ${a.length+1}`})]})}),pIe=Us("/terminals/")({component:hIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0})});function mIe(){return{x:0,y:0}}function gIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?mIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:jre,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(Vy()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=Hre({onDragStart:o,onDrop:o})}var bIe=Yf(function(){return Vy()&&"ontouchend"in document}),vIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function yIe(e){return function(n){var r=n.container;if(bIe()||$re())return vIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const Aie=k.createContext(null);function _Ie({children:e}){const[t,n]=k.useState(null);return y.jsx(Aie.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function kie(){const e=k.useContext(Aie);if(!e)throw new Error("useDrag must be used within DragProvider");return e}function EIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function Oie({task:e,open:t,onOpenChange:n}){const r=dM(),i=qte(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,S]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),S(e.linearTicketUrl||""),l(!0))},[t,e]);const _=()=>{const b={},x=a.trim();if(!x)return;x!==e.title&&(b.title=x);const T=u.trim();T!==(e.description||"")&&(b.description=T);const w=d.trim();w!==(e.prUrl||"")&&(b.prUrl=w||null);const A=m.trim();A!==(e.linearTicketUrl||"")&&(b.linearTicketUrl=A||null,b.linearTicketId=A?EIe(A):null),Object.keys(b).length>0&&r.mutate({taskId:e.id,updates:b}),n(!1)},g=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),_())},E=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return y.jsx(ul,{open:t,onOpenChange:n,children:y.jsxs(cl,{className:"sm:max-w-md",onKeyDown:g,children:[y.jsx(xu,{children:y.jsx(wu,{children:"Task Settings"})}),y.jsxs(tu,{className:"mt-4",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-title",children:"Title"}),y.jsx(sn,{id:"config-title",value:a,onChange:b=>s(b.target.value),autoFocus:!0})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-description",children:"Description"}),y.jsx(tte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),y.jsx(sn,{id:"config-pr-url",value:d,onChange:b=>p(b.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),y.jsx(sn,{id:"config-linear-url",value:m,onChange:b=>S(b.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),y.jsxs(zf,{className:"mt-4 flex-row justify-between sm:justify-between",children:[y.jsxs(Fc,{children:[y.jsx(Bc,{render:y.jsx(Ye,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),y.jsxs(Uc,{children:[y.jsxs($c,{children:[y.jsx(zc,{children:"Delete Task"}),y.jsx(Vc,{children:"This will permanently delete this task. This action cannot be undone."})]}),y.jsxs("div",{className:"flex items-center gap-2 py-2",children:[y.jsx(rl,{id:"delete-worktree",checked:o,onCheckedChange:b=>l(b===!0)}),y.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),y.jsxs(Hc,{children:[y.jsx(Wc,{children:"Cancel"}),y.jsx(ine,{onClick:E,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Ye,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),y.jsx(Ye,{onClick:_,disabled:!a.trim(),children:"Save"})]})]})]})})}function Rie({task:e,isDragPreview:t}){const{setActiveTask:n}=kie(),r=ss(),i=k.useRef(null),[a,s]=k.useState(!1),[o,l]=k.useState(null),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=k.useRef(!1);k.useEffect(()=>{const E=i.current;if(!(!E||t))return Wy(zre({element:E,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:b})=>{gIe({nativeSetDragImage:b,getOffset:yIe({x:"16px",y:"8px"}),render:({container:x})=>{f(x)}})},onDragStart:()=>{s(!0),n(e),m.current=!0},onDrop:()=>{s(!1),n(null),f(null)}}),Qx({element:E,getData:({input:b,element:x})=>{const T={type:"task",taskId:e.id,status:e.status};return Wre(T,{input:b,element:x,allowedEdges:["top","bottom"]})},canDrop:({source:b})=>b.data.taskId!==e.id,onDragEnter:({self:b})=>{l(Ep(b.data))},onDrag:({self:b})=>{l(Ep(b.data))},onDragLeave:()=>{l(null)},onDrop:()=>{l(null)}}))},[e,t,n]);const S=()=>{m.current=!1},_=()=>{m.current||r({to:"/tasks/$taskId",params:{taskId:e.id}}),m.current=!1},g=y.jsxs(Ca,{ref:t?void 0:i,onPointerDown:S,onClick:_,className:We("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",a&&"opacity-50"),children:[o&&y.jsx("div",{className:We("absolute left-0 right-0 h-0.5 bg-primary z-10",o==="top"&&"-top-1",o==="bottom"&&"-bottom-1")}),y.jsxs(dCe,{className:"p-3 pb-1 flex flex-row items-start justify-between gap-2",children:[y.jsx(fCe,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&y.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:E=>{E.stopPropagation(),p(!0)},onPointerDown:E=>E.stopPropagation(),children:y.jsx(ve,{icon:Bee,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),y.jsxs(kf,{className:"p-3 pt-1",children:[e.description&&y.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),y.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[y.jsx(ve,{icon:Mi,size:12,strokeWidth:2}),y.jsx("span",{children:e.repoName}),e.prUrl&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(ve,{icon:TE,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-muted-foreground/30",children:"•"}),y.jsx(ve,{icon:qP,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]});return y.jsxs(y.Fragment,{children:[g,u&&Nr.createPortal(y.jsx("div",{className:"w-72 max-w-[90vw]",children:y.jsx(Rie,{task:e,isDragPreview:!0})}),u),y.jsx(Oie,{task:e,open:d,onOpenChange:p})]})}const SIe={IN_PROGRESS:"border-t-[#8d909b]",IN_REVIEW:"border-t-[#2a2a27] dark:border-t-[#faf9f5]",DONE:"border-t-[#0d5c63]",CANCELED:"border-t-[#dd403a]"};function lz({status:e,tasks:t,isMobile:n}){const{t:r}=an("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>u.position-l.position);return k.useEffect(()=>{const l=i.current;if(l)return Qx({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),y.jsxs("div",{ref:i,className:We("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",SIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&y.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[y.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),y.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),y.jsx(Af,{className:"min-h-0 flex-1",children:y.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>y.jsx(Rie,{task:l},l.id))})})]})}const _k=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function xIe({status:e}){const{t}=an("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return Qx({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),y.jsx("div",{ref:n,className:We("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function wIe({repoFilter:e,searchQuery:t}){const{t:n}=an("common"),{data:r=[],isLoading:i}=cM(),a=KSe(),{activeTask:s}=kie(),[o,l]=k.useState("IN_PROGRESS"),u=k.useMemo(()=>{let d=r;return e&&(d=d.filter(p=>p.repoName===e)),t?.trim()?d=d.map(p=>({task:p,score:Math.max(Ud(p.title,t),Ud(p.description||"",t),Ud(p.branch||"",t),Ud(p.linearTicketId||"",t),Ud(p.prUrl||"",t))})).filter(({score:p})=>p>0).sort((p,m)=>m.score-p.score).map(({task:p})=>p):d=[...d].sort((p,m)=>new Date(m.createdAt).getTime()-new Date(p.createdAt).getTime()),d},[r,e,t]),f=k.useMemo(()=>{const d={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const p of u)d[p.status]++;return d},[u]);return k.useEffect(()=>Hre({canMonitor:({source:d})=>d.data.type==="task",onDrop:({source:d,location:p})=>{const m=p.current.dropTargets;if(m.length===0)return;const S=d.data.taskId,_=u.find(b=>b.id===S);if(!_)return;const g=m[0],E=g.data;if(E.type==="column"){const b=E.status;if(b!==_.status){const x=u.filter(T=>T.status===b);a.mutate({taskId:S,status:b,position:x.length})}}else if(E.type==="task"){const b=Ep(g.data),x=E.status,T=u.filter(R=>R.status===x).sort((R,O)=>R.position-O.position),w=T.findIndex(R=>R.id===E.taskId);let A=w;b==="bottom"&&(A=w+1),_.status===x&&T.findIndex(O=>O.id===S)<w&&(A=Math.max(0,A-1)),(_.status!==x||A!==_.position)&&a.mutate({taskId:S,status:x,position:A})}}}),[u,a]),i?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"border-b bg-background lg:hidden",children:y.jsx(nu,{value:o,onValueChange:d=>l(d),children:y.jsx(ru,{variant:"line",className:"w-full justify-start px-4",children:_k.map(d=>y.jsxs(oi,{value:d,className:"gap-1.5",children:[y.jsx("span",{className:"truncate",children:n(`statuses.${d}`)}),y.jsx("span",{className:"text-muted-foreground",children:f[d]})]},d))})})}),y.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:_k.map(d=>y.jsx(lz,{status:d,tasks:u.filter(p=>p.status===d)},d))}),y.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:y.jsx(lz,{status:o,tasks:u.filter(d=>d.status===o),isMobile:!0})}),s&&y.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:_k.filter(d=>d!==o).map(d=>y.jsx(xIe,{status:d},d))})]})}function TIe(e){return y.jsx(_Ie,{children:y.jsx(wIe,{...e})})}const Iie=Us("/tasks/")({component:CIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function CIe(){const{t:e}=an("tasks"),{data:t=[]}=cM(),{repo:n}=Iie.useSearch(),r=ss(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"relative flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2",children:[y.jsx(ve,{icon:jee,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(sn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-64 pl-6"})]}),y.jsx("div",{className:"ml-auto",children:y.jsxs(Ji,{value:n??"",onValueChange:l=>s(l||null),children:[y.jsxs(ta,{size:"sm",className:"max-sm:w-auto gap-1.5",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"text-muted-foreground"}),y.jsx(ea,{children:n??e("allRepos")})]}),y.jsxs(na,{className:"min-w-[160px]",children:[y.jsx(Nn,{value:"",children:e("allRepos")}),o.map(l=>y.jsx(Nn,{value:l,children:l},l))]})]})})]}),y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(TIe,{repoFilter:n??null,searchQuery:i})})]})}function Gl({className:e,size:t="default",...n}){return y.jsx(TSe,{"data-slot":"switch","data-size":t,className:We("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:y.jsx(CSe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const AIe=Us("/settings/")({component:kIe});function Vl({title:e,children:t}){return y.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[y.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function kIe(){const{t:e}=an("settings"),{t}=an("common"),{data:n,isLoading:r}=Kte(),{data:i,isLoading:a}=jx(),{data:s,isLoading:o}=Fx(),{data:l,isLoading:u}=Bx(),{data:f,isLoading:d}=Ux(),{data:p,isLoading:m}=nxe(),{data:S,isLoading:_}=rxe(),{data:g,isLoading:E}=uxe(),{data:b,isLoading:x}=cxe(),{data:T,isLoading:w}=fxe(),{data:A,isLoading:R}=mxe(),{data:O}=Yte(),I=bxe(),{savedLanguage:D,changeLanguage:P}=Qte(),{theme:H,syncClaudeCode:M,changeTheme:W}=Jte(),{data:V}=oxe(),{data:$}=lxe(),G=fM(),K=dxe(),U=hxe(),B=gxe(),F=pxe(),[Y,z]=k.useState(""),[J,ee]=k.useState(""),[te,Z]=k.useState("vscode"),[q,Q]=k.useState(""),[ae,se]=k.useState(""),[ne,_e]=k.useState(""),[Ee,de]=k.useState(""),[ge,me]=k.useState(""),[Ke,Se]=k.useState(""),[$e,we]=k.useState(!1),[Pe,ue]=k.useState(!1),[ye,Ie]=k.useState(!1),[pe,Ne]=k.useState(!1),[Te,ze]=k.useState(!1),[Ze,gt]=k.useState(""),[it,ot]=k.useState(!1),[Me,ft]=k.useState(""),[ke,Fe]=k.useState(!1),[Je,lt]=k.useState(""),[ht,vn]=k.useState(""),[Dt,Ot]=k.useState(!1),[ct,en]=k.useState(""),[Lt,yt]=k.useState("glm-4.5-air"),[Bt,jt]=k.useState("glm-4.7"),[Ut,pt]=k.useState("glm-4.7"),[ln,yr]=k.useState(!1),[kr,Dr]=k.useState("light-ansi"),[Hi,_l]=k.useState("dark-ansi"),[di,lr]=k.useState(!1),[mr,ua]=k.useState(!1),[Ai,ls]=k.useState(!1),Nu=k.useRef(null);k.useEffect(()=>{n!==void 0&&z(String(n)),i!==void 0&&ee(i),s!==void 0&&Z(s),l!==void 0&&Q(l),f!==void 0&&se(String(f)),p!==void 0&&_e(p),S!==void 0&&de(S),g!==void 0&&me(g)},[n,i,s,l,f,p,S,g]),k.useEffect(()=>{T&&(Ie(T.enabled),Ne(T.sound?.enabled??!1),ua(!!T.sound?.customSoundFile),ze(T.slack?.enabled??!1),gt(T.slack?.webhookUrl??""),ot(T.discord?.enabled??!1),ft(T.discord?.webhookUrl??""),Fe(T.pushover?.enabled??!1),lt(T.pushover?.appToken??""),vn(T.pushover?.userKey??""))},[T]),k.useEffect(()=>{A&&(Ot(A.enabled),en(A.apiKey??""),yt(A.haikuModel),jt(A.sonnetModel),pt(A.opusModel))},[A]),k.useEffect(()=>{M!==void 0&&yr(M),V!==void 0&&Dr(V),$!==void 0&&_l($)},[M,V,$]);const Vt=r||a||o||u||d||m||_||E||x||w||R,Ao=A&&(Dt!==A.enabled||ct!==(A.apiKey??"")||Lt!==A.haikuModel||Bt!==A.sonnetModel||Ut!==A.opusModel),ko=ln!==(M??!1)||kr!==V||Hi!==$,us=T&&(ye!==T.enabled||pe!==(T.sound?.enabled??!1)||Te!==(T.slack?.enabled??!1)||Ze!==(T.slack?.webhookUrl??"")||it!==(T.discord?.enabled??!1)||Me!==(T.discord?.webhookUrl??"")||ke!==(T.pushover?.enabled??!1)||Je!==(T.pushover?.appToken??"")||ht!==(T.pushover?.userKey??"")),cs=ge!==g||Ke!=="",El=te!==s||q!==l||ae!==String(f),Pa=Y!==String(n)||J!==i||ne!==p||Ee!==S||cs||El||us||Ao||ko,_r=async()=>{const Ve=[];if(Y!==String(n)){const Ft=parseInt(Y,10);!isNaN(Ft)&&Ft>=1&&Ft<=65535&&Ve.push(new Promise(Oi=>{G.mutate({key:nn.PORT,value:Ft},{onSettled:Oi})}))}if(J!==i&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.DEFAULT_GIT_REPOS_DIR,value:J},{onSettled:Ft})})),te!==s&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.EDITOR_APP,value:te},{onSettled:Ft})})),q!==l&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.EDITOR_HOST,value:q},{onSettled:Ft})})),ae!==String(f)){const Ft=parseInt(ae,10);!isNaN(Ft)&&Ft>=1&&Ft<=65535&&Ve.push(new Promise(Oi=>{G.mutate({key:nn.EDITOR_SSH_PORT,value:Ft},{onSettled:Oi})}))}ne!==p&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.LINEAR_API_KEY,value:ne},{onSettled:Ft})})),Ee!==S&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.GITHUB_PAT,value:Ee},{onSettled:Ft})})),ge!==g&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.BASIC_AUTH_USERNAME,value:ge},{onSettled:Ft})})),Ke!==""&&(Ve.push(new Promise(Ft=>{G.mutate({key:nn.BASIC_AUTH_PASSWORD,value:Ke},{onSettled:Ft})})),Se("")),us&&Ve.push(new Promise(Ft=>{U.mutate({enabled:ye,sound:{enabled:pe},slack:{enabled:Te,webhookUrl:Ze},discord:{enabled:it,webhookUrl:Me},pushover:{enabled:ke,appToken:Je,userKey:ht}},{onSettled:Ft})})),Ao&&Ve.push(new Promise(Ft=>{B.mutate({enabled:Dt,apiKey:ct||null,haikuModel:Lt,sonnetModel:Bt,opusModel:Ut},{onSettled:Ft})})),ko&&(ln!==(M??!1)&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.SYNC_CLAUDE_CODE_THEME,value:ln},{onSettled:Ft})})),kr!==V&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.CLAUDE_CODE_LIGHT_THEME,value:kr},{onSettled:Ft})})),Hi!==$&&Ve.push(new Promise(Ft=>{G.mutate({key:nn.CLAUDE_CODE_DARK_THEME,value:Hi},{onSettled:Ft})}))),await Promise.all(Ve),ue(!0),setTimeout(()=>ue(!1),2e3)},fi=()=>{K.mutate(nn.PORT,{onSuccess:Ve=>{Ve.value!==null&&z(String(Ve.value))}})},hi=()=>{K.mutate(nn.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ve=>{Ve.value&&ee(String(Ve.value))}})},zi=()=>{K.mutate(nn.EDITOR_APP,{onSuccess:Ve=>{Ve.value!==null&&Ve.value!==void 0&&Z(Ve.value)}})},Ma=()=>{K.mutate(nn.EDITOR_HOST,{onSuccess:Ve=>{Q(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},tg=()=>{K.mutate(nn.EDITOR_SSH_PORT,{onSuccess:Ve=>{Ve.value!==null&&Ve.value!==void 0&&se(String(Ve.value))}})},Du=()=>{K.mutate(nn.LINEAR_API_KEY,{onSuccess:Ve=>{_e(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},Lu=()=>{K.mutate(nn.GITHUB_PAT,{onSuccess:Ve=>{de(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},ng=()=>{K.mutate(nn.BASIC_AUTH_USERNAME,{onSuccess:Ve=>{me(Ve.value!==null&&Ve.value!==void 0?String(Ve.value):"")}})},Ks=()=>{K.mutate(nn.BASIC_AUTH_PASSWORD,{onSuccess:()=>{Se("")}})},ja=async Ve=>{F.mutate(Ve,{onSuccess:Ft=>{Ft.success?gn.success(e("notifications.testSuccess",{channel:Ve})):gn.error(e("notifications.testFailed",{channel:Ve,error:Ft.error}))},onError:Ft=>{gn.error(e("notifications.testFailed",{channel:Ve,error:Ft.message}))}})},Vi=async Ve=>{const Ft=Ve.target.files?.[0];if(Ft){ls(!0);try{const Oi=new FormData;Oi.append("file",Ft);const ds=await fetch("/api/uploads/sound",{method:"POST",body:Oi});if(!ds.ok){const Wi=await ds.json();throw new Error(Wi.error||"Upload failed")}ua(!0),gn.success(e("notifications.soundUploaded"))}catch(Oi){gn.error(e("notifications.soundUploadFailed",{error:Oi instanceof Error?Oi.message:"Unknown error"}))}finally{ls(!1),Nu.current&&(Nu.current.value="")}}},ki=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");ua(!1),gn.success(e("notifications.soundDeleted"))}catch{gn.error(e("notifications.soundDeleteFailed"))}};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:y.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),y.jsx("div",{className:"flex-1 overflow-auto p-6",children:y.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[y.jsx(Vl,{title:e("sections.server"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(sn,{type:"number",min:1,max:65535,value:Y,onChange:Ve=>z(Ve.target.value),placeholder:"7777",disabled:Vt,className:"w-24 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:fi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),y.jsx(Vl,{title:e("sections.paths"),children:y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:J,onChange:Ve=>ee(Ve.target.value),placeholder:"~/projects",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>we(!0),disabled:Vt,title:t("buttons.browse"),children:y.jsx(ve,{icon:Mi,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),y.jsx(Vl,{title:e("sections.authentication"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.username")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:ge,onChange:Ve=>me(Ve.target.value),placeholder:e("fields.auth.usernamePlaceholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:ng,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]})}),y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.auth.password")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:Ke,onChange:Ve=>Se(Ve.target.value),placeholder:e(b?"fields.auth.passwordSet":"fields.auth.passwordPlaceholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Ks,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]})}),y.jsx("p",{className:"text-xs text-muted-foreground",children:e("fields.auth.description")})]})}),y.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[y.jsx(Vl,{title:e("sections.editor"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs(Ji,{value:te,onValueChange:Ve=>Z(Ve),children:[y.jsx(ta,{className:"w-32",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"vscode",children:"VS Code"}),y.jsx(Nn,{value:"cursor",children:"Cursor"}),y.jsx(Nn,{value:"windsurf",children:"Windsurf"}),y.jsx(Nn,{value:"zed",children:"Zed"})]})]}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:zi,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{value:q,onChange:Ve=>Q(Ve.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Ma,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(sn,{type:"number",min:1,max:65535,value:ae,onChange:Ve=>se(Ve.target.value),placeholder:"22",disabled:Vt,className:"w-20 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:tg,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),y.jsx(Vl,{title:e("sections.integrations"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:ne,onChange:Ve=>_e(Ve.target.value),placeholder:"lin_api_...",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Du,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),y.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[y.jsx(sn,{type:"password",value:Ee,onChange:Ve=>de(Ve.target.value),placeholder:"ghp_...",disabled:Vt,className:"flex-1 font-mono text-sm"}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Lu,disabled:Vt||K.isPending,title:t("buttons.reset"),children:y.jsx(ve,{icon:Hl,size:14,strokeWidth:2})})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),y.jsx(Vl,{title:e("sections.zai"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),y.jsx(Gl,{checked:Dt,onCheckedChange:Ot,disabled:Vt})]}),Dt&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),y.jsx(sn,{type:"password",value:ct,onChange:Ve=>en(Ve.target.value),placeholder:"zai_...",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),y.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[y.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),y.jsx(sn,{value:Lt,onChange:Ve=>yt(Ve.target.value),placeholder:"glm-4.5-air",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),y.jsx(sn,{value:Bt,onChange:Ve=>jt(Ve.target.value),placeholder:"glm-4.7",disabled:Vt,className:"flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),y.jsx(sn,{value:Ut,onChange:Ve=>pt(Ve.target.value),placeholder:"glm-4.7",disabled:Vt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),y.jsx(Vl,{title:e("sections.notifications"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),y.jsx(Gl,{checked:ye,onCheckedChange:Ie,disabled:Vt})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:pe,onCheckedChange:Ne,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),y.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[y.jsx("input",{ref:Nu,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Vi}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Nu.current?.click(),disabled:Vt||!ye||!pe||Ai,title:e("notifications.uploadSound"),children:Ai?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:p1e,size:14,strokeWidth:2})}),mr&&y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:ki,disabled:Vt||!ye||!pe,title:e("notifications.deleteSound"),children:y.jsx(ve,{icon:Om,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("sound"),disabled:Vt||!ye||!pe||F.isPending,title:e("notifications.testSound"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]})]}),mr&&y.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:Te,onCheckedChange:ze,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("slack"),disabled:Vt||!ye||!Te||!Ze||F.isPending,title:e("notifications.slack"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),Te&&y.jsx(sn,{type:"password",value:Ze,onChange:Ve=>gt(Ve.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Vt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:it,onCheckedChange:ot,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("discord"),disabled:Vt||!ye||!it||!Me||F.isPending,title:e("notifications.discord"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),it&&y.jsx(sn,{type:"password",value:Me,onChange:Ve=>ft(Ve.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Vt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),y.jsxs("div",{className:"space-y-2 pl-4",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Gl,{checked:ke,onCheckedChange:Fe,disabled:Vt||!ye}),y.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),y.jsx(Ye,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ja("pushover"),disabled:Vt||!ye||!ke||!Je||!ht||F.isPending,title:e("notifications.pushover"),children:F.isPending?y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}):y.jsx(ve,{icon:Z1,size:14,strokeWidth:2})})]}),ke&&y.jsxs("div",{className:"ml-6 space-y-2",children:[y.jsx(sn,{type:"password",value:Je,onChange:Ve=>lt(Ve.target.value),placeholder:e("notifications.appToken"),disabled:Vt||!ye,className:"flex-1 font-mono text-sm"}),y.jsx(sn,{type:"password",value:ht,onChange:Ve=>vn(Ve.target.value),placeholder:e("notifications.userKey"),disabled:Vt||!ye,className:"flex-1 font-mono text-sm"})]})]})]})}),y.jsx(Vl,{title:e("sections.appearance"),children:y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),y.jsxs(Ji,{value:D??"auto",onValueChange:Ve=>P(Ve==="auto"?null:Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"auto",children:e("fields.language.options.auto")}),y.jsx(Nn,{value:"en",children:e("fields.language.options.en")}),y.jsx(Nn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),y.jsxs(Ji,{value:H??"system",onValueChange:Ve=>W(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"system",children:e("fields.theme.options.system")}),y.jsx(Nn,{value:"light",children:e("fields.theme.options.light")}),y.jsx(Nn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),y.jsx(Gl,{checked:ln,onCheckedChange:yr})]}),y.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ln&&y.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),y.jsxs(Ji,{value:kr,onValueChange:Ve=>Dr(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsx(na,{children:G$.filter(Ve=>Ve.startsWith("light")).map(Ve=>y.jsx(Nn,{value:Ve,children:e(`fields.claudeCodeTheme.options.${Ve}`)},Ve))})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[y.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),y.jsxs(Ji,{value:Hi,onValueChange:Ve=>_l(Ve),children:[y.jsx(ta,{className:"w-40",children:y.jsx(ea,{})}),y.jsx(na,{children:G$.filter(Ve=>Ve.startsWith("dark")).map(Ve=>y.jsx(Nn,{value:Ve,children:e(`fields.claudeCodeTheme.options.${Ve}`)},Ve))})]})]})]})]})}),O?.enabled&&y.jsx(Vl,{title:e("sections.developer"),children:y.jsx("div",{className:"space-y-1",children:y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[y.jsx("div",{className:"flex-1",children:y.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:()=>{const Ve=O?.startedAt;lr(!0),I.mutate(void 0,{onSuccess:()=>{(async()=>{for(let ds=0;ds<120;ds++){await new Promise(Wi=>setTimeout(Wi,500));try{const Wi=await fetch("/api/config/developer-mode");if(Wi.ok&&(await Wi.json()).startedAt!==Ve){window.location.reload();return}}catch{}}lr(!1),gn.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Ft=>{lr(!1),gn.error(e("developer.restartFailed"),{description:Ft.message})}})},disabled:I.isPending||di,className:"shrink-0 gap-2",children:[(I.isPending||di)&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),e(di?"developer.restarting":"developer.restartButton")]})]})})})]})}),y.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:y.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[Pe&&y.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[y.jsx(ve,{icon:Eu,size:12,strokeWidth:2}),t("status.saved")]}),y.jsx(Ye,{size:"sm",onClick:_r,disabled:!Pa||Vt||G.isPending,children:t("buttons.save")})]})}),y.jsx(jy,{open:$e,onOpenChange:we,onSelect:Ve=>ee(Ve),initialPath:J||void 0})]})}const nw="";function OIe(){return or({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${nw}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function RIe(){return or({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${nw}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function IIe(e,t,n){return or({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${nw}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function NIe(e,t,n){return or({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${nw}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function DIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=an("review"),{t:i}=an("common"),{data:a,isLoading:s,error:o}=IIe(e,t,n);if(s)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(ve,{icon:xn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Hf,size:24}),y.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),y.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>y.jsx(LIe,{issue:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Eu,size:24}),y.jsx("p",{className:"text-sm",children:r(l[e])})]})}function LIe({issue:e}){return y.jsx(Ca,{className:"transition-colors hover:border-border/80",children:y.jsx(kf,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>y.jsx(uo,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&y.jsxs(uo,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function PIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=an("review"),{t:i}=an("common"),{data:a,isLoading:s,error:o}=NIe(e,t,n);if(s)return y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx(ve,{icon:xn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Hf,size:24}),y.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),y.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>y.jsx(MIe,{pr:u},u.id))})]}):y.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[y.jsx(ve,{icon:Eu,size:24}),y.jsx("p",{className:"text-sm",children:r(l[e])})]})}function MIe({pr:e}){const{t}=an("review");return y.jsx(Ca,{className:"transition-colors hover:border-border/80",children:y.jsx(kf,{className:"py-4",children:y.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[y.jsx("div",{className:"flex items-start gap-2",children:y.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),y.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[y.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&y.jsx(uo,{variant:"secondary",className:We("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&y.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),y.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&y.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>y.jsx(uo,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&y.jsxs(uo,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const jIe=Us("/review/")({component:FIe});function FIe(){const{t:e}=an("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=OIe(),{data:m=[]}=RIe();return!p&&!d?y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:y.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[y.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:y.jsx(ve,{icon:i1e,size:24,className:"text-muted-foreground"})}),y.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),y.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),y.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[y.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),y.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),y.jsxs("li",{children:["• ",y.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:y.jsxs(Ye,{variant:"outline",size:"sm",className:"w-full",children:[y.jsx(ve,{icon:a1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),y.jsx(Pi,{to:"/settings",children:y.jsx(Ye,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):y.jsx("div",{className:"flex h-full flex-col",children:y.jsxs(nu,{value:t,onValueChange:S=>n(S),className:"flex flex-1 flex-col overflow-hidden",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-1 max-sm:px-2",children:[y.jsxs(ru,{variant:"line",children:[y.jsx(oi,{value:"prs",children:e("tabs.pullRequests")}),y.jsx(oi,{value:"issues",children:e("tabs.issues")})]}),y.jsxs("div",{className:"flex items-center gap-4 max-sm:gap-2",children:[t==="prs"?y.jsxs(Ji,{value:r,onValueChange:S=>i(S),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"created",children:e("filters.pr.created")}),y.jsx(Nn,{value:"assigned",children:e("filters.pr.assigned")}),y.jsx(Nn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),y.jsx(Nn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):y.jsxs(Ji,{value:a,onValueChange:S=>s(S),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"assigned",children:e("filters.issue.assigned")}),y.jsx(Nn,{value:"created",children:e("filters.issue.created")}),y.jsx(Nn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),y.jsxs(Ji,{value:u,onValueChange:S=>f(S||""),children:[y.jsx(ta,{size:"sm",className:"max-sm:w-auto",children:y.jsx(ea,{children:u||e("filters.allOrgs")})}),y.jsxs(na,{children:[y.jsx(Nn,{value:"",children:e("filters.allOrganizations")}),m.map(S=>y.jsx(Nn,{value:S.login,children:S.login},S.login))]})]}),y.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",title:e("filters.viboraReposOnly"),children:[y.jsx(Gl,{checked:o,onCheckedChange:l,disabled:!!u}),y.jsx("span",{className:"text-muted-foreground max-sm:hidden",children:e("filters.viboraReposOnly")})]})]})]}),y.jsx(Ni,{value:"prs",className:"flex-1 overflow-auto p-4",children:y.jsx(PIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),y.jsx(Ni,{value:"issues",className:"flex-1 overflow-auto p-4",children:y.jsx(DIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function BIe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function UIe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function PM(e={}){const t=xie();return{get terminals(){return t.terminals.map(BIe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(UIe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup}}function Nie(){const e=ss(),{tabs:t,createTab:n,createTerminal:r,connected:i}=PM(),a=k.useRef(null);return k.useEffect(()=>{if(Gt.ws.debug("useOpenInTerminal: tabs effect",{hasPending:!!a.current,pendingDirectory:a.current?.directory,tabCount:t.length,tabDirectories:t.map(u=>u.directory)}),!a.current)return;const{directory:o}=a.current,l=t.find(u=>u.directory===o);Gt.ws.debug("useOpenInTerminal: checking for matching tab",{directory:o,matchingTab:l?{id:l.id,name:l.name}:null}),l&&(a.current=null,Gt.ws.info("useOpenInTerminal: creating terminal in tab",{tabId:l.id,directory:o}),r({name:"Terminal 1",cols:80,rows:24,tabId:l.id,positionInTab:0}),e({to:"/terminals",search:{tab:l.id}}))},[t,r,e]),{openInTerminal:k.useCallback((o,l)=>{if(Gt.ws.info("useOpenInTerminal: openInTerminal called",{directory:o,name:l,connected:i,tabCount:t.length}),!i){Gt.ws.warn("useOpenInTerminal: not connected, aborting");return}const u=t.find(f=>f.directory===o);if(Gt.ws.debug("useOpenInTerminal: existing tab check",{directory:o,existingTab:u?{id:u.id,name:u.name}:null}),u){Gt.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:u.id}),e({to:"/terminals",search:{tab:u.id}});return}Gt.ws.info("useOpenInTerminal: creating new tab",{name:l,directory:o}),a.current={directory:o,name:l},n(l,void 0,o)},[i,t,n,e]),connected:i}}const $Ie={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function HE(e,t,n,r){const i=$Ie[t];if(!n)return`${i}://file${e}`;const a=r!==22?`${n}:${r}`:n;return`${i}://vscode-remote/ssh-remote+${a}${e}`}function Die(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}function zE(e){window.parent!==window?window.parent.postMessage({type:"vibora:openUrl",url:e},"*"):window.open(e,"_blank")}const Lie="";function HIe(e){return or({queryKey:["copier-questions",e],queryFn:()=>Zt(`${Lie}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function zIe(){const{data:e,...t}=My();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function VIe(){const e=zr();return pr({mutationFn:t=>Zt(`${Lie}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function WIe(){const{t:e}=an("repositories"),t=ss(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,S]=k.useState(""),[_,g]=k.useState({}),[E,b]=k.useState(""),[x,T]=k.useState(""),[w,A]=k.useState(null),{data:R}=zIe(),{data:O}=jx(),I=d||m,{data:D,isLoading:P,error:H}=HIe(i==="questions"||i==="output"?I:null),M=VIe();k.useEffect(()=>{n&&(a("template"),p(""),S(""),g({}),b(O||""),T(""),A(null))},[n,O]),k.useEffect(()=>{D?.questions&&g(J=>{const ee={...J};for(const te of D.questions)ee[te.name]===void 0&&te.default!==void 0&&(ee[te.name]=te.default);return ee})},[D]);const W=k.useCallback(()=>{const J=f.current;if(!J)return;const ee=J.scrollHeight>J.clientHeight&&J.scrollTop+J.clientHeight<J.scrollHeight-10;u(ee)},[]);k.useEffect(()=>{const J=setTimeout(W,100);return()=>clearTimeout(J)},[i,D,W]);const V=k.useCallback(()=>{W()},[W]),$=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},G=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},K=()=>{a("creating"),A(null),M.mutate({templateSource:I,outputPath:E,answers:_,projectName:x},{onSuccess:J=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:J.repositoryId}})},onError:J=>{A(J.message),a("output")}})},U=J=>{const ee=_[J.name],te=Q=>g(ae=>({...ae,[J.name]:Q})),q=J.default===void 0||typeof J.default=="string"&&J.default.includes("{{")?`${J.name} *`:J.name;switch(J.type){case"bool":return y.jsxs(Dn,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(rl,{checked:ee,onCheckedChange:te}),y.jsx(Ln,{className:"cursor-pointer",children:q})]}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);case"int":case"float":return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),y.jsx(sn,{type:"number",value:ee,onChange:Q=>te(J.type==="int"?parseInt(Q.target.value):parseFloat(Q.target.value)),step:J.type==="float"?"any":1}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);default:{if(J.choices&&J.choices.length>0)return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),y.jsxs(Ji,{value:String(ee??""),onValueChange:te,children:[y.jsx(ta,{className:"w-full",children:y.jsx(ea,{})}),y.jsx(na,{children:J.choices.map(ae=>y.jsx(Nn,{value:String(ae.value),children:ae.label},String(ae.value)))})]}),J.help&&y.jsx(Xi,{children:J.help})]},J.name);const Q=J.type==="yaml"||J.type==="json";return y.jsxs(Dn,{children:[y.jsx(Ln,{children:q}),Q?y.jsx(Dx,{value:String(ee??""),onChange:ae=>te(ae.target.value),rows:4}):y.jsx(sn,{value:String(ee??""),onChange:ae=>te(ae.target.value)}),J.help&&y.jsx(Xi,{children:J.help})]},J.name)}}},B=!!I,F=D?.questions.filter(J=>{if(J.default!==void 0&&!(typeof J.default=="string"&&J.default.includes("{{")))return!1;const te=_[J.name];return te==null||te===""})??[],Y=D&&!P&&F.length===0,z=x.trim()&&E.trim();return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:n,onOpenChange:r,children:[y.jsxs(QP,{render:y.jsx(Ye,{variant:"outline",size:"sm"}),children:[y.jsx(ve,{icon:Q0e,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),y.jsxs(cl,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[y.jsxs(xu,{className:"shrink-0",children:[y.jsx(wu,{children:e("newProject.title")}),y.jsxs(Iy,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),y.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((J,ee)=>y.jsx("div",{className:We("flex-1 h-1 rounded",i===J||["template","questions","output"].indexOf(i)>ee||i==="creating"?"bg-primary":"bg-muted")},J))}),y.jsxs("div",{ref:f,onScroll:V,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&y.jsxs(tu,{children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.template.savedTemplates")}),y.jsxs(Ji,{value:d,onValueChange:J=>{p(J??""),S("")},children:[y.jsx(ta,{className:"w-full",children:y.jsx(ea,{children:d?R?.find(J=>J.id===d)?.displayName:y.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),y.jsx(na,{children:R?.map(J=>y.jsx(Nn,{value:J.id,children:J.displayName},J.id))})]})]}),y.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.template.customUrl")}),y.jsx(sn,{value:m,onChange:J=>{S(J.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),y.jsx(Xi,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&y.jsxs(tu,{children:[P&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),H&&y.jsx("div",{className:"text-destructive text-sm py-4",children:H.message}),D?.questions.map(U),D&&D.questions.length===0&&y.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&y.jsxs(tu,{children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.output.projectName")}),y.jsx(sn,{value:x,onChange:J=>T(J.target.value),placeholder:"my-new-project"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("newProject.steps.output.outputDirectory")}),y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[y.jsx(ve,{icon:Mi,size:14,strokeWidth:2,className:"mr-2"}),E||e("newProject.steps.output.selectDirectory")]})]}),x&&E&&y.jsxs(Xi,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",E,"/",x]}),w&&y.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w})]}),i==="creating"&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[y.jsx(ve,{icon:xn,size:32,strokeWidth:2,className:"animate-spin text-primary"}),y.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&y.jsx("div",{className:"flex justify-center py-1",children:y.jsx(ve,{icon:WP,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),y.jsxs(zf,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&y.jsxs(Ye,{variant:"outline",onClick:G,children:[y.jsx(ve,{icon:Iee,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&y.jsx(Ry,{render:y.jsx(Ye,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&y.jsxs(Ye,{onClick:$,disabled:!B,children:[e("newProject.next"),y.jsx(ve,{icon:A$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&y.jsxs(Ye,{onClick:$,disabled:!Y,children:[e("newProject.next"),y.jsx(ve,{icon:A$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&y.jsx(Ye,{onClick:K,disabled:!z||M.isPending,children:e("newProject.create")})]})]})]}),y.jsx(jy,{open:s,onOpenChange:o,onSelect:J=>b(J),initialPath:O||void 0})]})}const GIe=Us("/repositories/")({component:YIe});function qIe({repository:e,onDelete:t,onStartTask:n,onOpenInTerminal:r,onViewTasks:i}){const{t:a}=an("repositories"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),{data:f}=Fx(),{data:d}=Bx(),{data:p}=Ux(),m=()=>{const _=HE(e.path,f,d,p);zE(_)},S=async()=>{u(!0);try{await t(),o(!1)}catch{}finally{u(!1)}};return y.jsxs(Ca,{className:"h-full group transition-colors hover:border-foreground/20",children:[y.jsx(Pi,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:y.jsx(kf,{className:"flex flex-col gap-3 py-4",children:y.jsxs("div",{className:"space-y-1",children:[y.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),y.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[y.jsx(ve,{icon:Mi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),y.jsx(kf,{className:"pt-0 pb-4 px-6",children:y.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[y.jsxs(Ye,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(ve,{icon:KP,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[y.jsx(ve,{icon:Lp,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[y.jsx(ve,{icon:Cx,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:m,className:"text-muted-foreground hover:text-foreground",title:a("openInEditor",{editor:Die(f)}),children:[y.jsx(ve,{icon:YP,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("editor")})]}),y.jsxs(Fc,{open:s,onOpenChange:o,children:[y.jsxs(Bc,{render:y.jsx(Ye,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:a("delete.button")}),children:[y.jsx(ve,{icon:Om,size:14,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]}),y.jsxs(Uc,{children:[y.jsxs($c,{children:[y.jsx(zc,{children:a("delete.title")}),y.jsx(Vc,{children:a("delete.description",{name:e.displayName})})]}),y.jsxs(Hc,{children:[y.jsx(Wc,{disabled:l,children:a("addModal.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:S,disabled:l,className:"gap-2",children:[l&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),a(l?"delete.deleting":"delete.button")]})]})]})]})]})})]})}function KIe(){const{t:e}=an("repositories"),[t,n]=k.useState(!1),[r,i]=k.useState(!1),[a,s]=k.useState(""),[o,l]=k.useState(""),[u,f]=k.useState(""),[d,p]=k.useState(""),[m,S]=k.useState(!1),_=Xte(),{data:g}=jx(),E=T=>{s(T),o||l(T.split("/").pop()||"")},b=T=>{T.preventDefault(),a.trim()&&_.mutate({path:a.trim(),displayName:o.trim()||a.split("/").pop()||"repo",startupScript:u.trim()||null,copyFiles:d.trim()||null,isCopierTemplate:m},{onSuccess:()=>{n(!1),s(""),l(""),f(""),p(""),S(!1)}})},x=a?a.split("/").pop():"";return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:t,onOpenChange:n,children:[y.jsxs(QP,{render:y.jsx(Ye,{size:"sm"}),children:[y.jsx(ve,{icon:Ax,size:16,strokeWidth:2,"data-slot":"icon"}),y.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),y.jsx(cl,{className:"sm:max-w-md",children:y.jsxs("form",{onSubmit:b,children:[y.jsxs(xu,{children:[y.jsx(wu,{children:e("addModal.title")}),y.jsx(Iy,{children:e("addModal.description")})]}),y.jsxs(tu,{className:"mt-4",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{children:e("addModal.fields.path")}),y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>i(!0),children:[y.jsx(ve,{icon:Mi,size:14,strokeWidth:2,className:"mr-2"}),x?y.jsx("span",{className:"truncate",children:a}):y.jsx("span",{className:"text-muted-foreground",children:e("addModal.fields.pathPlaceholder")})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"displayName",children:e("addModal.fields.displayName")}),y.jsx(sn,{id:"displayName",value:o,onChange:T=>l(T.target.value),placeholder:x||"My Project"})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"startupScript",children:e("addModal.fields.startupScript")}),y.jsx(Dx,{id:"startupScript",value:u,onChange:T=>f(T.target.value),placeholder:e("addModal.fields.startupScriptPlaceholder"),rows:2}),y.jsx(Xi,{children:e("addModal.fields.startupScriptDescription")})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"copyFiles",children:e("addModal.fields.copyFiles")}),y.jsx(sn,{id:"copyFiles",value:d,onChange:T=>p(T.target.value),placeholder:e("addModal.fields.copyFilesPlaceholder")}),y.jsx(Xi,{children:e("addModal.fields.copyFilesDescription")})]}),y.jsxs(Dn,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(rl,{checked:m,onCheckedChange:T=>S(T===!0)}),y.jsx(Ln,{className:"cursor-pointer",children:e("addModal.fields.isCopierTemplate")})]}),y.jsx(Xi,{children:e("addModal.fields.isCopierTemplateDescription")})]})]}),y.jsxs(zf,{className:"mt-4",children:[y.jsx(Ry,{render:y.jsx(Ye,{variant:"outline",type:"button"}),children:e("addModal.cancel")}),y.jsx(Ye,{type:"submit",disabled:_.isPending||!a.trim(),children:_.isPending?e("addModal.adding"):e("addRepository")})]})]})})]}),y.jsx(jy,{open:r,onOpenChange:i,onSelect:E,initialPath:g||void 0})]})}function YIe(){const{t:e}=an("repositories"),t=ss(),{data:n,isLoading:r,error:i}=My(),a=Zte(),[s,o]=k.useState(null),{openInTerminal:l}=Nie(),u=async d=>{await a.mutateAsync(d)},f=d=>{t({to:"/tasks",search:{repo:d}})};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsx(WIe,{}),y.jsx(KIe,{})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(ve,{icon:Hf,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n?.map(d=>y.jsx(qIe,{repository:d,onDelete:()=>u(d.id),onStartTask:()=>o(d),onOpenInTerminal:()=>l(d.path,d.displayName),onViewTasks:()=>f(d.displayName)},d.id))})]}),y.jsx(hM,{open:s!==null,onOpenChange:d=>!d&&o(null),defaultRepository:s??void 0,showTrigger:!1})]})}var Ek,uz;function Da(){if(uz)return Ek;uz=1;var e=Array.isArray;return Ek=e,Ek}var Sk,cz;function Pie(){if(cz)return Sk;cz=1;var e=typeof N1=="object"&&N1&&N1.Object===Object&&N1;return Sk=e,Sk}var xk,dz;function ml(){if(dz)return xk;dz=1;var e=Pie(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return xk=n,xk}var wk,fz;function qy(){if(fz)return wk;fz=1;var e=ml(),t=e.Symbol;return wk=t,wk}var Tk,hz;function XIe(){if(hz)return Tk;hz=1;var e=qy(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return Tk=a,Tk}var Ck,pz;function ZIe(){if(pz)return Ck;pz=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Ck=n,Ck}var Ak,mz;function Au(){if(mz)return Ak;mz=1;var e=qy(),t=XIe(),n=ZIe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return Ak=s,Ak}var kk,gz;function ku(){if(gz)return kk;gz=1;function e(t){return t!=null&&typeof t=="object"}return kk=e,kk}var Ok,bz;function Pm(){if(bz)return Ok;bz=1;var e=Au(),t=ku(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Ok=r,Ok}var Rk,vz;function MM(){if(vz)return Rk;vz=1;var e=Da(),t=Pm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Rk=i,Rk}var Ik,yz;function sd(){if(yz)return Ik;yz=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ik=e,Ik}var Nk,_z;function jM(){if(_z)return Nk;_z=1;var e=Au(),t=sd(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Nk=s,Nk}var Dk,Ez;function QIe(){if(Ez)return Dk;Ez=1;var e=ml(),t=e["__core-js_shared__"];return Dk=t,Dk}var Lk,Sz;function JIe(){if(Sz)return Lk;Sz=1;var e=QIe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Lk=n,Lk}var Pk,xz;function Mie(){if(xz)return Pk;xz=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Pk=n,Pk}var Mk,wz;function eNe(){if(wz)return Mk;wz=1;var e=jM(),t=JIe(),n=sd(),r=Mie(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return Mk=d,Mk}var jk,Tz;function tNe(){if(Tz)return jk;Tz=1;function e(t,n){return t?.[n]}return jk=e,jk}var Fk,Cz;function Zf(){if(Cz)return Fk;Cz=1;var e=eNe(),t=tNe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return Fk=n,Fk}var Bk,Az;function rw(){if(Az)return Bk;Az=1;var e=Zf(),t=e(Object,"create");return Bk=t,Bk}var Uk,kz;function nNe(){if(kz)return Uk;kz=1;var e=rw();function t(){this.__data__=e?e(null):{},this.size=0}return Uk=t,Uk}var $k,Oz;function rNe(){if(Oz)return $k;Oz=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return $k=e,$k}var Hk,Rz;function iNe(){if(Rz)return Hk;Rz=1;var e=rw(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return Hk=i,Hk}var zk,Iz;function aNe(){if(Iz)return zk;Iz=1;var e=rw(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return zk=r,zk}var Vk,Nz;function sNe(){if(Nz)return Vk;Nz=1;var e=rw(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return Vk=n,Vk}var Wk,Dz;function oNe(){if(Dz)return Wk;Dz=1;var e=nNe(),t=rNe(),n=iNe(),r=aNe(),i=sNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Wk=a,Wk}var Gk,Lz;function lNe(){if(Lz)return Gk;Lz=1;function e(){this.__data__=[],this.size=0}return Gk=e,Gk}var qk,Pz;function FM(){if(Pz)return qk;Pz=1;function e(t,n){return t===n||t!==t&&n!==n}return qk=e,qk}var Kk,Mz;function iw(){if(Mz)return Kk;Mz=1;var e=FM();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Kk=t,Kk}var Yk,jz;function uNe(){if(jz)return Yk;jz=1;var e=iw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return Yk=r,Yk}var Xk,Fz;function cNe(){if(Fz)return Xk;Fz=1;var e=iw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return Xk=t,Xk}var Zk,Bz;function dNe(){if(Bz)return Zk;Bz=1;var e=iw();function t(n){return e(this.__data__,n)>-1}return Zk=t,Zk}var Qk,Uz;function fNe(){if(Uz)return Qk;Uz=1;var e=iw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return Qk=t,Qk}var Jk,$z;function aw(){if($z)return Jk;$z=1;var e=lNe(),t=uNe(),n=cNe(),r=dNe(),i=fNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Jk=a,Jk}var eO,Hz;function BM(){if(Hz)return eO;Hz=1;var e=Zf(),t=ml(),n=e(t,"Map");return eO=n,eO}var tO,zz;function hNe(){if(zz)return tO;zz=1;var e=oNe(),t=aw(),n=BM();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return tO=r,tO}var nO,Vz;function pNe(){if(Vz)return nO;Vz=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return nO=e,nO}var rO,Wz;function sw(){if(Wz)return rO;Wz=1;var e=pNe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return rO=t,rO}var iO,Gz;function mNe(){if(Gz)return iO;Gz=1;var e=sw();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return iO=t,iO}var aO,qz;function gNe(){if(qz)return aO;qz=1;var e=sw();function t(n){return e(this,n).get(n)}return aO=t,aO}var sO,Kz;function bNe(){if(Kz)return sO;Kz=1;var e=sw();function t(n){return e(this,n).has(n)}return sO=t,sO}var oO,Yz;function vNe(){if(Yz)return oO;Yz=1;var e=sw();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return oO=t,oO}var lO,Xz;function UM(){if(Xz)return lO;Xz=1;var e=hNe(),t=mNe(),n=gNe(),r=bNe(),i=vNe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,lO=a,lO}var uO,Zz;function jie(){if(Zz)return uO;Zz=1;var e=UM(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,uO=n,uO}var cO,Qz;function yNe(){if(Qz)return cO;Qz=1;var e=jie(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return cO=n,cO}var dO,Jz;function _Ne(){if(Jz)return dO;Jz=1;var e=yNe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return dO=r,dO}var fO,eV;function $M(){if(eV)return fO;eV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return fO=e,fO}var hO,tV;function ENe(){if(tV)return hO;tV=1;var e=qy(),t=$M(),n=Da(),r=Pm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return hO=s,hO}var pO,nV;function Fie(){if(nV)return pO;nV=1;var e=ENe();function t(n){return n==null?"":e(n)}return pO=t,pO}var mO,rV;function Bie(){if(rV)return mO;rV=1;var e=Da(),t=MM(),n=_Ne(),r=Fie();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return mO=i,mO}var gO,iV;function ow(){if(iV)return gO;iV=1;var e=Pm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return gO=t,gO}var bO,aV;function HM(){if(aV)return bO;aV=1;var e=Bie(),t=ow();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return bO=n,bO}var vO,sV;function Uie(){if(sV)return vO;sV=1;var e=HM();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return vO=t,vO}var SNe=Uie();const Fs=Sn(SNe);var yO,oV;function xNe(){if(oV)return yO;oV=1;function e(t){return t==null}return yO=e,yO}var wNe=xNe();const fn=Sn(wNe);var _O,lV;function TNe(){if(lV)return _O;lV=1;var e=Au(),t=Da(),n=ku(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return _O=i,_O}var CNe=TNe();const Nf=Sn(CNe);var ANe=jM();const zt=Sn(ANe);var kNe=sd();const Mm=Sn(kNe);var EO={exports:{}},Pn={};var uV;function ONe(){if(uV)return Pn;uV=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),S;S=Symbol.for("react.module.reference");function _(g){if(typeof g=="object"&&g!==null){var E=g.$$typeof;switch(E){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return E}}case t:return E}}}return Pn.ContextConsumer=s,Pn.ContextProvider=a,Pn.Element=e,Pn.ForwardRef=l,Pn.Fragment=n,Pn.Lazy=p,Pn.Memo=d,Pn.Portal=t,Pn.Profiler=i,Pn.StrictMode=r,Pn.Suspense=u,Pn.SuspenseList=f,Pn.isAsyncMode=function(){return!1},Pn.isConcurrentMode=function(){return!1},Pn.isContextConsumer=function(g){return _(g)===s},Pn.isContextProvider=function(g){return _(g)===a},Pn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Pn.isForwardRef=function(g){return _(g)===l},Pn.isFragment=function(g){return _(g)===n},Pn.isLazy=function(g){return _(g)===p},Pn.isMemo=function(g){return _(g)===d},Pn.isPortal=function(g){return _(g)===t},Pn.isProfiler=function(g){return _(g)===i},Pn.isStrictMode=function(g){return _(g)===r},Pn.isSuspense=function(g){return _(g)===u},Pn.isSuspenseList=function(g){return _(g)===f},Pn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===S||g.getModuleId!==void 0)},Pn.typeOf=_,Pn}var cV;function RNe(){return cV||(cV=1,EO.exports=ONe()),EO.exports}var INe=RNe(),SO,dV;function $ie(){if(dV)return SO;dV=1;var e=Au(),t=ku(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return SO=r,SO}var xO,fV;function NNe(){if(fV)return xO;fV=1;var e=$ie();function t(n){return e(n)&&n!=+n}return xO=t,xO}var DNe=NNe();const jm=Sn(DNe);var LNe=$ie();const PNe=Sn(LNe);var xa=function(t){return t===0?0:t>0?1:-1},Xd=function(t){return Nf(t)&&t.indexOf("%")===t.length-1},at=function(t){return PNe(t)&&!jm(t)},MNe=function(t){return fn(t)},Jr=function(t){return at(t)||Nf(t)},jNe=0,Ky=function(t){var n=++jNe;return"".concat(t||"").concat(n)},oo=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Nf(t))return r;var a;if(Xd(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return jm(a)&&(a=r),i&&a>n&&(a=n),a},mc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},FNe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},Zi=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function VE(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Fs(r,t))===n})}var BNe=function(t,n){return at(t)&&at(n)?t-n:Nf(t)&&Nf(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Sp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function fD(e){"@babel/helpers - typeof";return fD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fD(e)}var UNe=["viewBox","children"],$Ne=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],hV=["points","pathLength"],wO={svg:UNe,polygon:hV,polyline:hV},zM=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],WE=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Mm(r))return null;var i={};return Object.keys(r).forEach(function(a){zM.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},HNe=function(t,n,r){return function(i){return t(n,r,i),null}},Yc=function(t,n,r){if(!Mm(t)||fD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];zM.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=HNe(s,n,r))}),i},zNe=["children"],VNe=["children"];function pV(e,t){if(e==null)return{};var n=WNe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function WNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hD(e){"@babel/helpers - typeof";return hD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hD(e)}var mV={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},ou=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},gV=null,TO=null,VM=function e(t){if(t===gV&&Array.isArray(TO))return TO;var n=[];return k.Children.forEach(t,function(r){fn(r)||(INe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),TO=n,gV=t,n};function Bs(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return ou(i)}):r=[ou(t)],VM(e).forEach(function(i){var a=Fs(i,"type.displayName")||Fs(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function Ya(e,t){var n=Bs(e,t);return n&&n[0]}var bV=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},GNe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],qNe=function(t){return t&&t.type&&Nf(t.type)&&GNe.indexOf(t.type)>=0},KNe=function(t){return t&&hD(t)==="object"&&"clipDot"in t},YNe=function(t,n,r,i){var a,s=(a=wO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!zt(t)&&(i&&s.includes(n)||$Ne.includes(n))||r&&zM.includes(n)},It=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Mm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;YNe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},pD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return vV(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!vV(a,s))return!1}return!0},vV=function(t,n){if(fn(t)&&fn(n))return!0;if(!fn(t)&&!fn(n)){var r=t.props||{},i=r.children,a=pV(r,zNe),s=n.props||{},o=s.children,l=pV(s,VNe);return i&&o?Sp(a,l)&&pD(i,o):!i&&!o?Sp(a,l):!1}return!1},yV=function(t,n){var r=[],i={};return VM(t).forEach(function(a,s){if(qNe(a))r.push(a);else if(a){var o=ou(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},XNe=function(t){var n=t&&t.type;return n&&mV[n]?mV[n]:null},ZNe=function(t,n){return VM(n).indexOf(t)},QNe=["children","width","height","viewBox","className","style","title","desc"];function mD(){return mD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mD.apply(this,arguments)}function JNe(e,t){if(e==null)return{};var n=eDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gD(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=JNe(e,QNe),f=i||{width:n,height:r,x:0,y:0},d=Xt("recharts-surface",a);return oe.createElement("svg",mD({},It(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var tDe=["children","className"];function bD(){return bD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bD.apply(this,arguments)}function nDe(e,t){if(e==null)return{};var n=rDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var wn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=nDe(e,tDe),a=Xt("recharts-layer",r);return oe.createElement("g",bD({className:a},It(i,!0),{ref:t}),n)}),lu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},CO,_V;function iDe(){if(_V)return CO;_V=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return CO=e,CO}var AO,EV;function aDe(){if(EV)return AO;EV=1;var e=iDe();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return AO=t,AO}var kO,SV;function Hie(){if(SV)return kO;SV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return kO=l,kO}var OO,xV;function sDe(){if(xV)return OO;xV=1;function e(t){return t.split("")}return OO=e,OO}var RO,wV;function oDe(){if(wV)return RO;wV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",S=u+"?",_="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+_+S+")*",E=_+S+g,b="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+b+E,"g");function T(w){return w.match(x)||[]}return RO=T,RO}var IO,TV;function lDe(){if(TV)return IO;TV=1;var e=sDe(),t=Hie(),n=oDe();function r(i){return t(i)?n(i):e(i)}return IO=r,IO}var NO,CV;function uDe(){if(CV)return NO;CV=1;var e=aDe(),t=Hie(),n=lDe(),r=Fie();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return NO=i,NO}var DO,AV;function cDe(){if(AV)return DO;AV=1;var e=uDe(),t=e("toUpperCase");return DO=t,DO}var dDe=cDe();const lw=Sn(dDe);function Zn(e){return function(){return e}}const zie=Math.cos,GE=Math.sin,wo=Math.sqrt,qE=Math.PI,uw=2*qE,vD=Math.PI,yD=2*vD,jd=1e-6,fDe=yD-jd;function Vie(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function hDe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Vie;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class pDe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Vie:hDe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>jd)if(!(Math.abs(d*l-u*f)>jd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,S=i-o,_=l*l+u*u,g=m*m+S*S,E=Math.sqrt(_),b=Math.sqrt(p),x=a*Math.tan((vD-Math.acos((_+p-g)/(2*E*b)))/2),T=x/b,w=x/E;Math.abs(T-1)>jd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*S)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>jd||Math.abs(this._y1-f)>jd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%yD+yD),p>fDe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>jd&&this._append`A${r},${r},0,${+(p>=vD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function WM(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new pDe(t)}function GM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wie(e){this._context=e}Wie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function cw(e){return new Wie(e)}function Gie(e){return e[0]}function qie(e){return e[1]}function Kie(e,t){var n=Zn(!0),r=null,i=cw,a=null,s=WM(o);e=typeof e=="function"?e:e===void 0?Gie:Zn(e),t=typeof t=="function"?t:t===void 0?qie:Zn(t);function o(l){var u,f=(l=GM(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function c_(e,t,n){var r=null,i=Zn(!0),a=null,s=cw,o=null,l=WM(u);e=typeof e=="function"?e:e===void 0?Gie:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?qie:Zn(+n);function u(d){var p,m,S,_=(d=GM(d)).length,g,E=!1,b,x=new Array(_),T=new Array(_);for(a==null&&(o=s(b=l())),p=0;p<=_;++p){if(!(p<_&&i(g=d[p],p,d))===E)if(E=!E)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),S=p-1;S>=m;--S)o.point(x[S],T[S]);o.lineEnd(),o.areaEnd()}E&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(b)return o=null,b+""||null}function f(){return Kie().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class Yie{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function mDe(e){return new Yie(e,!0)}function gDe(e){return new Yie(e,!1)}const qM={draw(e,t){const n=wo(t/qE);e.moveTo(n,0),e.arc(0,0,n,0,uw)}},bDe={draw(e,t){const n=wo(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Xie=wo(1/3),vDe=Xie*2,yDe={draw(e,t){const n=wo(t/vDe),r=n*Xie;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},_De={draw(e,t){const n=wo(t),r=-n/2;e.rect(r,r,n,n)}},EDe=.8908130915292852,Zie=GE(qE/10)/GE(7*qE/10),SDe=GE(uw/10)*Zie,xDe=-zie(uw/10)*Zie,wDe={draw(e,t){const n=wo(t*EDe),r=SDe*n,i=xDe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=uw*a/5,o=zie(s),l=GE(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},LO=wo(3),TDe={draw(e,t){const n=-wo(t/(LO*3));e.moveTo(0,n*2),e.lineTo(-LO*n,-n),e.lineTo(LO*n,-n),e.closePath()}},_s=-.5,Es=wo(3)/2,_D=1/wo(12),CDe=(_D/2+1)*3,ADe={draw(e,t){const n=wo(t/CDe),r=n/2,i=n*_D,a=r,s=n*_D+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(_s*r-Es*i,Es*r+_s*i),e.lineTo(_s*a-Es*s,Es*a+_s*s),e.lineTo(_s*o-Es*l,Es*o+_s*l),e.lineTo(_s*r+Es*i,_s*i-Es*r),e.lineTo(_s*a+Es*s,_s*s-Es*a),e.lineTo(_s*o+Es*l,_s*l-Es*o),e.closePath()}};function kDe(e,t){let n=null,r=WM(i);e=typeof e=="function"?e:Zn(e||qM),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function KE(){}function YE(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Qie(e){this._context=e}Qie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:YE(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ODe(e){return new Qie(e)}function Jie(e){this._context=e}Jie.prototype={areaStart:KE,areaEnd:KE,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RDe(e){return new Jie(e)}function eae(e){this._context=e}eae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:YE(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IDe(e){return new eae(e)}function tae(e){this._context=e}tae.prototype={areaStart:KE,areaEnd:KE,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function NDe(e){return new tae(e)}function kV(e){return e<0?-1:1}function OV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(kV(a)+kV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function RV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function PO(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function XE(e){this._context=e}XE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:PO(this,this._t0,RV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,PO(this,RV(this,n=OV(this,e,t)),n);break;default:PO(this,this._t0,n=OV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function nae(e){this._context=new rae(e)}(nae.prototype=Object.create(XE.prototype)).point=function(e,t){XE.prototype.point.call(this,t,e)};function rae(e){this._context=e}rae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function DDe(e){return new XE(e)}function LDe(e){return new nae(e)}function iae(e){this._context=e}iae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=IV(e),i=IV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function IV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function PDe(e){return new iae(e)}function dw(e,t){this._context=e,this._t=t}dw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function MDe(e){return new dw(e,.5)}function jDe(e){return new dw(e,0)}function FDe(e){return new dw(e,1)}function Wp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ED(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function BDe(e,t){return e[t]}function UDe(e){const t=[];return t.key=e,t}function $De(){var e=Zn([]),t=ED,n=Wp,r=BDe;function i(a){var s=Array.from(e.apply(this,arguments),UDe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=GM(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ED:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Wp,i):n},i}function HDe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Wp(e,t)}}function zDe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Wp(e,t)}}function VDe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,S=0;S<o;++S){var _=e[t[S]],g=_[r][1]||0,E=_[r-1][1]||0;m+=g-E}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Wp(e,t)}}function Tv(e){"@babel/helpers - typeof";return Tv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tv(e)}var WDe=["type","size","sizeType"];function SD(){return SD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SD.apply(this,arguments)}function NV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function DV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NV(Object(n),!0).forEach(function(r){GDe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function GDe(e,t,n){return t=qDe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qDe(e){var t=KDe(e,"string");return Tv(t)=="symbol"?t:t+""}function KDe(e,t){if(Tv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Tv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function YDe(e,t){if(e==null)return{};var n=XDe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XDe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var aae={symbolCircle:qM,symbolCross:bDe,symbolDiamond:yDe,symbolSquare:_De,symbolStar:wDe,symbolTriangle:TDe,symbolWye:ADe},ZDe=Math.PI/180,QDe=function(t){var n="symbol".concat(lw(t));return aae[n]||qM},JDe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*ZDe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},eLe=function(t,n){aae["symbol".concat(lw(t))]=n},KM=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=YDe(t,WDe),u=DV(DV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=QDe(r),E=kDe().type(g).size(JDe(a,o,r));return E()},d=u.className,p=u.cx,m=u.cy,S=It(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",SD({},S,{className:Xt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};KM.registerSymbol=eLe;function Gp(e){"@babel/helpers - typeof";return Gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gp(e)}function xD(){return xD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xD.apply(this,arguments)}function LV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tLe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LV(Object(n),!0).forEach(function(r){Cv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nLe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rLe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oae(r.key),r)}}function iLe(e,t,n){return t&&rLe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aLe(e,t,n){return t=ZE(t),sLe(e,sae()?Reflect.construct(t,n||[],ZE(e).constructor):t.apply(e,n))}function sLe(e,t){if(t&&(Gp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oLe(e)}function oLe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sae=function(){return!!e})()}function ZE(e){return ZE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ZE(e)}function lLe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wD(e,t)}function wD(e,t){return wD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},wD(e,t)}function Cv(e,t,n){return t=oae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oae(e){var t=uLe(e,"string");return Gp(t)=="symbol"?t:t+""}function uLe(e,t){if(Gp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ss=32,YM=(function(e){function t(){return nLe(this,t),aLe(this,t,arguments)}return lLe(t,e),iLe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=Ss/2,s=Ss/6,o=Ss/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:Ss,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
|
|
45
45
|
A`).concat(s,",").concat(s,",0,1,1,").concat(2*o,",").concat(a,`
|
|
46
46
|
H`).concat(Ss,"M").concat(2*o,",").concat(a,`
|
|
47
47
|
A`).concat(s,",").concat(s,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return oe.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Ss/8,"h").concat(Ss,"v").concat(Ss*3/4,"h").concat(-Ss,"z"),className:"recharts-legend-icon"});if(oe.isValidElement(r.legendIcon)){var u=tLe({},r);return delete u.legendIcon,oe.cloneElement(r.legendIcon,u)}return oe.createElement(KM,{fill:l,cx:a,cy:a,size:Ss,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,a=i.payload,s=i.iconSize,o=i.layout,l=i.formatter,u=i.inactiveColor,f={x:0,y:0,width:Ss,height:Ss},d={display:o==="horizontal"?"inline-block":"block",marginRight:10},p={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(m,S){var _=m.formatter||l,g=Xt(Cv(Cv({"recharts-legend-item":!0},"legend-item-".concat(S),!0),"inactive",m.inactive));if(m.type==="none")return null;var E=zt(m.value)?null:m.value;lu(!zt(m.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=m.inactive?u:m.color;return oe.createElement("li",xD({className:g,style:d,key:"legend-item-".concat(S)},Yc(r.props,m,S)),oe.createElement(gD,{width:s,height:s,viewBox:f,style:p},r.renderIcon(m)),oe.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},_?_(E,m,S):E))})}},{key:"render",value:function(){var r=this.props,i=r.payload,a=r.layout,s=r.align;if(!i||!i.length)return null;var o={padding:0,margin:0,textAlign:a==="horizontal"?s:"left"};return oe.createElement("ul",{className:"recharts-default-legend",style:o},this.renderItems())}}])})(k.PureComponent);Cv(YM,"displayName","Legend");Cv(YM,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var MO,PV;function cLe(){if(PV)return MO;PV=1;var e=aw();function t(){this.__data__=new e,this.size=0}return MO=t,MO}var jO,MV;function dLe(){if(MV)return jO;MV=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return jO=e,jO}var FO,jV;function fLe(){if(jV)return FO;jV=1;function e(t){return this.__data__.get(t)}return FO=e,FO}var BO,FV;function hLe(){if(FV)return BO;FV=1;function e(t){return this.__data__.has(t)}return BO=e,BO}var UO,BV;function pLe(){if(BV)return UO;BV=1;var e=aw(),t=BM(),n=UM(),r=200;function i(a,s){var o=this.__data__;if(o instanceof e){var l=o.__data__;if(!t||l.length<r-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new n(l)}return o.set(a,s),this.size=o.size,this}return UO=i,UO}var $O,UV;function lae(){if(UV)return $O;UV=1;var e=aw(),t=cLe(),n=dLe(),r=fLe(),i=hLe(),a=pLe();function s(o){var l=this.__data__=new e(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=n,s.prototype.get=r,s.prototype.has=i,s.prototype.set=a,$O=s,$O}var HO,$V;function mLe(){if($V)return HO;$V=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return HO=t,HO}var zO,HV;function gLe(){if(HV)return zO;HV=1;function e(t){return this.__data__.has(t)}return zO=e,zO}var VO,zV;function uae(){if(zV)return VO;zV=1;var e=UM(),t=mLe(),n=gLe();function r(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new e;++a<s;)this.add(i[a])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,VO=r,VO}var WO,VV;function cae(){if(VV)return WO;VV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return WO=e,WO}var GO,WV;function dae(){if(WV)return GO;WV=1;function e(t,n){return t.has(n)}return GO=e,GO}var qO,GV;function fae(){if(GV)return qO;GV=1;var e=uae(),t=cae(),n=dae(),r=1,i=2;function a(s,o,l,u,f,d){var p=l&r,m=s.length,S=o.length;if(m!=S&&!(p&&S>m))return!1;var _=d.get(s),g=d.get(o);if(_&&g)return _==o&&g==s;var E=-1,b=!0,x=l&i?new e:void 0;for(d.set(s,o),d.set(o,s);++E<m;){var T=s[E],w=o[E];if(u)var A=p?u(w,T,E,o,s,d):u(T,w,E,s,o,d);if(A!==void 0){if(A)continue;b=!1;break}if(x){if(!t(o,function(R,O){if(!n(x,O)&&(T===R||f(T,R,l,u,d)))return x.push(O)})){b=!1;break}}else if(!(T===w||f(T,w,l,u,d))){b=!1;break}}return d.delete(s),d.delete(o),b}return qO=a,qO}var KO,qV;function bLe(){if(qV)return KO;qV=1;var e=ml(),t=e.Uint8Array;return KO=t,KO}var YO,KV;function vLe(){if(KV)return YO;KV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,a){r[++n]=[a,i]}),r}return YO=e,YO}var XO,YV;function XM(){if(YV)return XO;YV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return XO=e,XO}var ZO,XV;function yLe(){if(XV)return ZO;XV=1;var e=qy(),t=bLe(),n=FM(),r=fae(),i=vLe(),a=XM(),s=1,o=2,l="[object Boolean]",u="[object Date]",f="[object Error]",d="[object Map]",p="[object Number]",m="[object RegExp]",S="[object Set]",_="[object String]",g="[object Symbol]",E="[object ArrayBuffer]",b="[object DataView]",x=e?e.prototype:void 0,T=x?x.valueOf:void 0;function w(A,R,O,I,D,P,H){switch(O){case b:if(A.byteLength!=R.byteLength||A.byteOffset!=R.byteOffset)return!1;A=A.buffer,R=R.buffer;case E:return!(A.byteLength!=R.byteLength||!P(new t(A),new t(R)));case l:case u:case p:return n(+A,+R);case f:return A.name==R.name&&A.message==R.message;case m:case _:return A==R+"";case d:var M=i;case S:var W=I&s;if(M||(M=a),A.size!=R.size&&!W)return!1;var V=H.get(A);if(V)return V==R;I|=o,H.set(A,R);var $=r(M(A),M(R),I,D,P,H);return H.delete(A),$;case g:if(T)return T.call(A)==T.call(R)}return!1}return ZO=w,ZO}var QO,ZV;function hae(){if(ZV)return QO;ZV=1;function e(t,n){for(var r=-1,i=n.length,a=t.length;++r<i;)t[a+r]=n[r];return t}return QO=e,QO}var JO,QV;function _Le(){if(QV)return JO;QV=1;var e=hae(),t=Da();function n(r,i,a){var s=i(r);return t(r)?s:e(s,a(r))}return JO=n,JO}var eR,JV;function ELe(){if(JV)return eR;JV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=0,s=[];++r<i;){var o=t[r];n(o,r,t)&&(s[a++]=o)}return s}return eR=e,eR}var tR,eW;function SLe(){if(eW)return tR;eW=1;function e(){return[]}return tR=e,tR}var nR,tW;function xLe(){if(tW)return nR;tW=1;var e=ELe(),t=SLe(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),e(i(s),function(o){return r.call(s,o)}))}:t;return nR=a,nR}var rR,nW;function wLe(){if(nW)return rR;nW=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return rR=e,rR}var iR,rW;function TLe(){if(rW)return iR;rW=1;var e=Au(),t=ku(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return iR=r,iR}var aR,iW;function ZM(){if(iW)return aR;iW=1;var e=TLe(),t=ku(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&r.call(s,"callee")&&!i.call(s,"callee")};return aR=a,aR}var Tb={exports:{}},sR,aW;function CLe(){if(aW)return sR;aW=1;function e(){return!1}return sR=e,sR}Tb.exports;var sW;function pae(){return sW||(sW=1,(function(e,t){var n=ml(),r=CLe(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===i,o=s?n.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||r;e.exports=u})(Tb,Tb.exports)),Tb.exports}var oR,oW;function QM(){if(oW)return oR;oW=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var a=typeof r;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return oR=n,oR}var lR,lW;function JM(){if(lW)return lR;lW=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return lR=t,lR}var uR,uW;function ALe(){if(uW)return uR;uW=1;var e=Au(),t=JM(),n=ku(),r="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",f="[object Number]",d="[object Object]",p="[object RegExp]",m="[object Set]",S="[object String]",_="[object WeakMap]",g="[object ArrayBuffer]",E="[object DataView]",b="[object Float32Array]",x="[object Float64Array]",T="[object Int8Array]",w="[object Int16Array]",A="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",I="[object Uint16Array]",D="[object Uint32Array]",P={};P[b]=P[x]=P[T]=P[w]=P[A]=P[R]=P[O]=P[I]=P[D]=!0,P[r]=P[i]=P[g]=P[a]=P[E]=P[s]=P[o]=P[l]=P[u]=P[f]=P[d]=P[p]=P[m]=P[S]=P[_]=!1;function H(M){return n(M)&&t(M.length)&&!!P[e(M)]}return uR=H,uR}var cR,cW;function mae(){if(cW)return cR;cW=1;function e(t){return function(n){return t(n)}}return cR=e,cR}var Cb={exports:{}};Cb.exports;var dW;function kLe(){return dW||(dW=1,(function(e,t){var n=Pie(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===r,s=a&&n.process,o=(function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=o})(Cb,Cb.exports)),Cb.exports}var dR,fW;function gae(){if(fW)return dR;fW=1;var e=ALe(),t=mae(),n=kLe(),r=n&&n.isTypedArray,i=r?t(r):e;return dR=i,dR}var fR,hW;function OLe(){if(hW)return fR;hW=1;var e=wLe(),t=ZM(),n=Da(),r=pae(),i=QM(),a=gae(),s=Object.prototype,o=s.hasOwnProperty;function l(u,f){var d=n(u),p=!d&&t(u),m=!d&&!p&&r(u),S=!d&&!p&&!m&&a(u),_=d||p||m||S,g=_?e(u.length,String):[],E=g.length;for(var b in u)(f||o.call(u,b))&&!(_&&(b=="length"||m&&(b=="offset"||b=="parent")||S&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,E)))&&g.push(b);return g}return fR=l,fR}var hR,pW;function RLe(){if(pW)return hR;pW=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return hR=t,hR}var pR,mW;function bae(){if(mW)return pR;mW=1;function e(t,n){return function(r){return t(n(r))}}return pR=e,pR}var mR,gW;function ILe(){if(gW)return mR;gW=1;var e=bae(),t=e(Object.keys,Object);return mR=t,mR}var gR,bW;function NLe(){if(bW)return gR;bW=1;var e=RLe(),t=ILe(),n=Object.prototype,r=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var s=[];for(var o in Object(a))r.call(a,o)&&o!="constructor"&&s.push(o);return s}return gR=i,gR}var bR,vW;function Yy(){if(vW)return bR;vW=1;var e=jM(),t=JM();function n(r){return r!=null&&t(r.length)&&!e(r)}return bR=n,bR}var vR,yW;function fw(){if(yW)return vR;yW=1;var e=OLe(),t=NLe(),n=Yy();function r(i){return n(i)?e(i):t(i)}return vR=r,vR}var yR,_W;function DLe(){if(_W)return yR;_W=1;var e=_Le(),t=xLe(),n=fw();function r(i){return e(i,n,t)}return yR=r,yR}var _R,EW;function LLe(){if(EW)return _R;EW=1;var e=DLe(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(a,s,o,l,u,f){var d=o&t,p=e(a),m=p.length,S=e(s),_=S.length;if(m!=_&&!d)return!1;for(var g=m;g--;){var E=p[g];if(!(d?E in s:r.call(s,E)))return!1}var b=f.get(a),x=f.get(s);if(b&&x)return b==s&&x==a;var T=!0;f.set(a,s),f.set(s,a);for(var w=d;++g<m;){E=p[g];var A=a[E],R=s[E];if(l)var O=d?l(R,A,E,s,a,f):l(A,R,E,a,s,f);if(!(O===void 0?A===R||u(A,R,o,l,f):O)){T=!1;break}w||(w=E=="constructor")}if(T&&!w){var I=a.constructor,D=s.constructor;I!=D&&"constructor"in a&&"constructor"in s&&!(typeof I=="function"&&I instanceof I&&typeof D=="function"&&D instanceof D)&&(T=!1)}return f.delete(a),f.delete(s),T}return _R=i,_R}var ER,SW;function PLe(){if(SW)return ER;SW=1;var e=Zf(),t=ml(),n=e(t,"DataView");return ER=n,ER}var SR,xW;function MLe(){if(xW)return SR;xW=1;var e=Zf(),t=ml(),n=e(t,"Promise");return SR=n,SR}var xR,wW;function vae(){if(wW)return xR;wW=1;var e=Zf(),t=ml(),n=e(t,"Set");return xR=n,xR}var wR,TW;function jLe(){if(TW)return wR;TW=1;var e=Zf(),t=ml(),n=e(t,"WeakMap");return wR=n,wR}var TR,CW;function FLe(){if(CW)return TR;CW=1;var e=PLe(),t=BM(),n=MLe(),r=vae(),i=jLe(),a=Au(),s=Mie(),o="[object Map]",l="[object Object]",u="[object Promise]",f="[object Set]",d="[object WeakMap]",p="[object DataView]",m=s(e),S=s(t),_=s(n),g=s(r),E=s(i),b=a;return(e&&b(new e(new ArrayBuffer(1)))!=p||t&&b(new t)!=o||n&&b(n.resolve())!=u||r&&b(new r)!=f||i&&b(new i)!=d)&&(b=function(x){var T=a(x),w=T==l?x.constructor:void 0,A=w?s(w):"";if(A)switch(A){case m:return p;case S:return o;case _:return u;case g:return f;case E:return d}return T}),TR=b,TR}var CR,AW;function BLe(){if(AW)return CR;AW=1;var e=lae(),t=fae(),n=yLe(),r=LLe(),i=FLe(),a=Da(),s=pae(),o=gae(),l=1,u="[object Arguments]",f="[object Array]",d="[object Object]",p=Object.prototype,m=p.hasOwnProperty;function S(_,g,E,b,x,T){var w=a(_),A=a(g),R=w?f:i(_),O=A?f:i(g);R=R==u?d:R,O=O==u?d:O;var I=R==d,D=O==d,P=R==O;if(P&&s(_)){if(!s(g))return!1;w=!0,I=!1}if(P&&!I)return T||(T=new e),w||o(_)?t(_,g,E,b,x,T):n(_,g,R,E,b,x,T);if(!(E&l)){var H=I&&m.call(_,"__wrapped__"),M=D&&m.call(g,"__wrapped__");if(H||M){var W=H?_.value():_,V=M?g.value():g;return T||(T=new e),x(W,V,E,b,T)}}return P?(T||(T=new e),r(_,g,E,b,x,T)):!1}return CR=S,CR}var AR,kW;function e3(){if(kW)return AR;kW=1;var e=BLe(),t=ku();function n(r,i,a,s,o){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,a,s,n,o)}return AR=n,AR}var kR,OW;function ULe(){if(OW)return kR;OW=1;var e=lae(),t=e3(),n=1,r=2;function i(a,s,o,l){var u=o.length,f=u,d=!l;if(a==null)return!f;for(a=Object(a);u--;){var p=o[u];if(d&&p[2]?p[1]!==a[p[0]]:!(p[0]in a))return!1}for(;++u<f;){p=o[u];var m=p[0],S=a[m],_=p[1];if(d&&p[2]){if(S===void 0&&!(m in a))return!1}else{var g=new e;if(l)var E=l(S,_,m,a,s,g);if(!(E===void 0?t(_,S,n|r,l,g):E))return!1}}return!0}return kR=i,kR}var OR,RW;function yae(){if(RW)return OR;RW=1;var e=sd();function t(n){return n===n&&!e(n)}return OR=t,OR}var RR,IW;function $Le(){if(IW)return RR;IW=1;var e=yae(),t=fw();function n(r){for(var i=t(r),a=i.length;a--;){var s=i[a],o=r[s];i[a]=[s,o,e(o)]}return i}return RR=n,RR}var IR,NW;function _ae(){if(NW)return IR;NW=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return IR=e,IR}var NR,DW;function HLe(){if(DW)return NR;DW=1;var e=ULe(),t=$Le(),n=_ae();function r(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(s){return s===i||e(s,i,a)}}return NR=r,NR}var DR,LW;function zLe(){if(LW)return DR;LW=1;function e(t,n){return t!=null&&n in Object(t)}return DR=e,DR}var LR,PW;function VLe(){if(PW)return LR;PW=1;var e=Bie(),t=ZM(),n=Da(),r=QM(),i=JM(),a=ow();function s(o,l,u){l=e(l,o);for(var f=-1,d=l.length,p=!1;++f<d;){var m=a(l[f]);if(!(p=o!=null&&u(o,m)))break;o=o[m]}return p||++f!=d?p:(d=o==null?0:o.length,!!d&&i(d)&&r(m,d)&&(n(o)||t(o)))}return LR=s,LR}var PR,MW;function WLe(){if(MW)return PR;MW=1;var e=zLe(),t=VLe();function n(r,i){return r!=null&&t(r,i,e)}return PR=n,PR}var MR,jW;function GLe(){if(jW)return MR;jW=1;var e=e3(),t=Uie(),n=WLe(),r=MM(),i=yae(),a=_ae(),s=ow(),o=1,l=2;function u(f,d){return r(f)&&i(d)?a(s(f),d):function(p){var m=t(p,f);return m===void 0&&m===d?n(p,f):e(d,m,o|l)}}return MR=u,MR}var jR,FW;function Fm(){if(FW)return jR;FW=1;function e(t){return t}return jR=e,jR}var FR,BW;function qLe(){if(BW)return FR;BW=1;function e(t){return function(n){return n?.[t]}}return FR=e,FR}var BR,UW;function KLe(){if(UW)return BR;UW=1;var e=HM();function t(n){return function(r){return e(r,n)}}return BR=t,BR}var UR,$W;function YLe(){if($W)return UR;$W=1;var e=qLe(),t=KLe(),n=MM(),r=ow();function i(a){return n(a)?e(r(a)):t(a)}return UR=i,UR}var $R,HW;function gl(){if(HW)return $R;HW=1;var e=HLe(),t=GLe(),n=Fm(),r=Da(),i=YLe();function a(s){return typeof s=="function"?s:s==null?n:typeof s=="object"?r(s)?t(s[0],s[1]):e(s):i(s)}return $R=a,$R}var HR,zW;function Eae(){if(zW)return HR;zW=1;function e(t,n,r,i){for(var a=t.length,s=r+(i?1:-1);i?s--:++s<a;)if(n(t[s],s,t))return s;return-1}return HR=e,HR}var zR,VW;function XLe(){if(VW)return zR;VW=1;function e(t){return t!==t}return zR=e,zR}var VR,WW;function ZLe(){if(WW)return VR;WW=1;function e(t,n,r){for(var i=r-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return VR=e,VR}var WR,GW;function QLe(){if(GW)return WR;GW=1;var e=Eae(),t=XLe(),n=ZLe();function r(i,a,s){return a===a?n(i,a,s):e(i,t,s)}return WR=r,WR}var GR,qW;function JLe(){if(qW)return GR;qW=1;var e=QLe();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return GR=t,GR}var qR,KW;function ePe(){if(KW)return qR;KW=1;function e(t,n,r){for(var i=-1,a=t==null?0:t.length;++i<a;)if(r(n,t[i]))return!0;return!1}return qR=e,qR}var KR,YW;function tPe(){if(YW)return KR;YW=1;function e(){}return KR=e,KR}var YR,XW;function nPe(){if(XW)return YR;XW=1;var e=vae(),t=tPe(),n=XM(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(a){return new e(a)}:t;return YR=i,YR}var XR,ZW;function rPe(){if(ZW)return XR;ZW=1;var e=uae(),t=JLe(),n=ePe(),r=dae(),i=nPe(),a=XM(),s=200;function o(l,u,f){var d=-1,p=t,m=l.length,S=!0,_=[],g=_;if(f)S=!1,p=n;else if(m>=s){var E=u?null:i(l);if(E)return a(E);S=!1,p=r,g=new e}else g=u?[]:_;e:for(;++d<m;){var b=l[d],x=u?u(b):b;if(b=f||b!==0?b:0,S&&x===x){for(var T=g.length;T--;)if(g[T]===x)continue e;u&&g.push(x),_.push(b)}else p(g,x,f)||(g!==_&&g.push(x),_.push(b))}return _}return XR=o,XR}var ZR,QW;function iPe(){if(QW)return ZR;QW=1;var e=gl(),t=rPe();function n(r,i){return r&&r.length?t(r,e(i,2)):[]}return ZR=n,ZR}var aPe=iPe();const JW=Sn(aPe);function Sae(e,t,n){return t===!0?JW(e,n):zt(t)?JW(e,t):e}function qp(e){"@babel/helpers - typeof";return qp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qp(e)}var sPe=["ref"];function eG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eG(Object(n),!0).forEach(function(r){hw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eG(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tG(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wae(r.key),r)}}function lPe(e,t,n){return t&&tG(e.prototype,t),n&&tG(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function uPe(e,t,n){return t=QE(t),cPe(e,xae()?Reflect.construct(t,n||[],QE(e).constructor):t.apply(e,n))}function cPe(e,t){if(t&&(qp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dPe(e)}function dPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xae=function(){return!!e})()}function QE(e){return QE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},QE(e)}function fPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&TD(e,t)}function TD(e,t){return TD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},TD(e,t)}function hw(e,t,n){return t=wae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wae(e){var t=hPe(e,"string");return qp(t)=="symbol"?t:t+""}function hPe(e,t){if(qp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function pPe(e,t){if(e==null)return{};var n=mPe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gPe(e){return e.value}function bPe(e,t){if(oe.isValidElement(e))return oe.cloneElement(e,t);if(typeof e=="function")return oe.createElement(e,t);t.ref;var n=pPe(t,sPe);return oe.createElement(YM,n)}var nG=1,xp=(function(e){function t(){var n;oPe(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=uPe(this,t,[].concat(i)),hw(n,"lastBoundingBox",{width:-1,height:-1}),n}return fPe(t,e),lPe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>nG||Math.abs(i.height-this.lastBoundingBox.height)>nG)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Wl({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,a=i.layout,s=i.align,o=i.verticalAlign,l=i.margin,u=i.chartWidth,f=i.chartHeight,d,p;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&a==="vertical"){var m=this.getBBoxSnapshot();d={left:((u||0)-m.width)/2}}else d=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(o==="middle"){var S=this.getBBoxSnapshot();p={top:((f||0)-S.height)/2}}else p=o==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Wl(Wl({},d),p)}},{key:"render",value:function(){var r=this,i=this.props,a=i.content,s=i.width,o=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,f=i.payload,d=Wl(Wl({position:"absolute",width:s||"auto",height:o||"auto"},this.getDefaultPosition(l)),l);return oe.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(m){r.wrapperNode=m}},bPe(a,Wl(Wl({},this.props),{},{payload:Sae(f,u,gPe)})))}}],[{key:"getWithHeight",value:function(r,i){var a=Wl(Wl({},this.defaultProps),r.props),s=a.layout;return s==="vertical"&&at(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])})(k.PureComponent);hw(xp,"displayName","Legend");hw(xp,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var QR,rG;function vPe(){if(rG)return QR;rG=1;var e=qy(),t=ZM(),n=Da(),r=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(r&&a&&a[r])}return QR=i,QR}var JR,iG;function Tae(){if(iG)return JR;iG=1;var e=hae(),t=vPe();function n(r,i,a,s,o){var l=-1,u=r.length;for(a||(a=t),o||(o=[]);++l<u;){var f=r[l];i>0&&a(f)?i>1?n(f,i-1,a,s,o):e(o,f):s||(o[o.length]=f)}return o}return JR=n,JR}var e2,aG;function yPe(){if(aG)return e2;aG=1;function e(t){return function(n,r,i){for(var a=-1,s=Object(n),o=i(n),l=o.length;l--;){var u=o[t?l:++a];if(r(s[u],u,s)===!1)break}return n}}return e2=e,e2}var t2,sG;function _Pe(){if(sG)return t2;sG=1;var e=yPe(),t=e();return t2=t,t2}var n2,oG;function Cae(){if(oG)return n2;oG=1;var e=_Pe(),t=fw();function n(r,i){return r&&e(r,i,t)}return n2=n,n2}var r2,lG;function EPe(){if(lG)return r2;lG=1;var e=Yy();function t(n,r){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var s=i.length,o=r?s:-1,l=Object(i);(r?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return r2=t,r2}var i2,uG;function t3(){if(uG)return i2;uG=1;var e=Cae(),t=EPe(),n=t(e);return i2=n,i2}var a2,cG;function Aae(){if(cG)return a2;cG=1;var e=t3(),t=Yy();function n(r,i){var a=-1,s=t(r)?Array(r.length):[];return e(r,function(o,l,u){s[++a]=i(o,l,u)}),s}return a2=n,a2}var s2,dG;function SPe(){if(dG)return s2;dG=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return s2=e,s2}var o2,fG;function xPe(){if(fG)return o2;fG=1;var e=Pm();function t(n,r){if(n!==r){var i=n!==void 0,a=n===null,s=n===n,o=e(n),l=r!==void 0,u=r===null,f=r===r,d=e(r);if(!u&&!d&&!o&&n>r||o&&l&&f&&!u&&!d||a&&l&&f||!i&&f||!s)return 1;if(!a&&!o&&!d&&n<r||d&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!f)return-1}return 0}return o2=t,o2}var l2,hG;function wPe(){if(hG)return l2;hG=1;var e=xPe();function t(n,r,i){for(var a=-1,s=n.criteria,o=r.criteria,l=s.length,u=i.length;++a<l;){var f=e(s[a],o[a]);if(f){if(a>=u)return f;var d=i[a];return f*(d=="desc"?-1:1)}}return n.index-r.index}return l2=t,l2}var u2,pG;function TPe(){if(pG)return u2;pG=1;var e=$M(),t=HM(),n=gl(),r=Aae(),i=SPe(),a=mae(),s=wPe(),o=Fm(),l=Da();function u(f,d,p){d.length?d=e(d,function(_){return l(_)?function(g){return t(g,_.length===1?_[0]:_)}:_}):d=[o];var m=-1;d=e(d,a(n));var S=r(f,function(_,g,E){var b=e(d,function(x){return x(_)});return{criteria:b,index:++m,value:_}});return i(S,function(_,g){return s(_,g,p)})}return u2=u,u2}var c2,mG;function CPe(){if(mG)return c2;mG=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return c2=e,c2}var d2,gG;function APe(){if(gG)return d2;gG=1;var e=CPe(),t=Math.max;function n(r,i,a){return i=t(i===void 0?r.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var f=Array(i+1);++o<i;)f[o]=s[o];return f[i]=a(u),e(r,this,f)}}return d2=n,d2}var f2,bG;function kPe(){if(bG)return f2;bG=1;function e(t){return function(){return t}}return f2=e,f2}var h2,vG;function kae(){if(vG)return h2;vG=1;var e=Zf(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return h2=t,h2}var p2,yG;function OPe(){if(yG)return p2;yG=1;var e=kPe(),t=kae(),n=Fm(),r=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return p2=r,p2}var m2,_G;function RPe(){if(_G)return m2;_G=1;var e=800,t=16,n=Date.now;function r(i){var a=0,s=0;return function(){var o=n(),l=t-(o-s);if(s=o,l>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return m2=r,m2}var g2,EG;function IPe(){if(EG)return g2;EG=1;var e=OPe(),t=RPe(),n=t(e);return g2=n,g2}var b2,SG;function NPe(){if(SG)return b2;SG=1;var e=Fm(),t=APe(),n=IPe();function r(i,a){return n(t(i,a,e),i+"")}return b2=r,b2}var v2,xG;function pw(){if(xG)return v2;xG=1;var e=FM(),t=Yy(),n=QM(),r=sd();function i(a,s,o){if(!r(o))return!1;var l=typeof s;return(l=="number"?t(o)&&n(s,o.length):l=="string"&&s in o)?e(o[s],a):!1}return v2=i,v2}var y2,wG;function DPe(){if(wG)return y2;wG=1;var e=Tae(),t=TPe(),n=NPe(),r=pw(),i=n(function(a,s){if(a==null)return[];var o=s.length;return o>1&&r(a,s[0],s[1])?s=[]:o>2&&r(s[0],s[1],s[2])&&(s=[s[0]]),t(a,e(s,1),[])});return y2=i,y2}var LPe=DPe();const n3=Sn(LPe);function Av(e){"@babel/helpers - typeof";return Av=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Av(e)}function CD(){return CD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CD.apply(this,arguments)}function PPe(e,t){return BPe(e)||FPe(e,t)||jPe(e,t)||MPe()}function MPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/jpeg" href="/logo-dark.jpg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vibora</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DixQWEwY.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-tawAaPZP.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -22002,8 +22002,8 @@ var terminalWebSocketHandlers = {
|
|
|
22002
22002
|
const success = tabManager2.reorder(tabId, position);
|
|
22003
22003
|
if (success) {
|
|
22004
22004
|
broadcast({
|
|
22005
|
-
type: "
|
|
22006
|
-
payload: {
|
|
22005
|
+
type: "tabs:list",
|
|
22006
|
+
payload: { tabs: tabManager2.list() }
|
|
22007
22007
|
});
|
|
22008
22008
|
} else {
|
|
22009
22009
|
log2.ws.warn("tab:reorder failed - tab not found", { tabId, position, clientId: clientData.id });
|