claudekit-cli 3.41.0-dev.2 → 3.41.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.
@@ -18,7 +18,7 @@ var z1=Object.defineProperty;var H1=(t,e,n)=>e in t?z1(t,e,{enumerable:!0,config
18
18
  */var Kg=t=>{throw TypeError(t)},Y1=(t,e,n)=>e.has(t)||Kg("Cannot "+n),uc=(t,e,n)=>(Y1(t,e,"read from private field"),n?n.call(t):e.get(t)),J1=(t,e,n)=>e.has(t)?Kg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),qu="popstate";function Q1(t={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return vs("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Mn(i)}return Z1(e,n,null,t)}function ge(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function $e(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function X1(){return Math.random().toString(36).substring(2,10)}function Yu(t,e){return{usr:t.state,key:t.key,idx:e}}function vs(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?mr(e):e,state:n,key:e&&e.key||r||X1()}}function Mn({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function mr(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function Z1(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=h();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function h(){return(o.state||{idx:null}).idx}function u(){a="POP";let x=h(),w=x==null?null:x-c;c=x,l&&l({action:a,location:b.location,delta:w})}function f(x,w){a="PUSH";let v=vs(b.location,x,w);c=h()+1;let k=Yu(v,c),j=b.createHref(v);try{o.pushState(k,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(j)}s&&l&&l({action:a,location:b.location,delta:1})}function p(x,w){a="REPLACE";let v=vs(b.location,x,w);c=h();let k=Yu(v,c),j=b.createHref(v);o.replaceState(k,"",j),s&&l&&l({action:a,location:b.location,delta:0})}function g(x){return Gg(x)}let b={get action(){return a},get location(){return t(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(qu,u),l=x,()=>{i.removeEventListener(qu,u),l=null}},createHref(x){return e(i,x)},createURL:g,encodeLocation(x){let w=g(x);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:f,replace:p,go(x){return o.go(x)}};return b}function Gg(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ge(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Mn(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var ns,Ju=class{constructor(t){if(J1(this,ns,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(uc(this,ns).has(t))return uc(this,ns).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){uc(this,ns).set(t,e)}};ns=new WeakMap;var ev=new Set(["lazy","caseSensitive","path","id","index","children"]);function tv(t){return ev.has(t)}var nv=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function rv(t){return nv.has(t)}function iv(t){return t.index===!0}function ws(t,e,n=[],r={},i=!1){return t.map((s,o)=>{let a=[...n,String(o)],l=typeof s.id=="string"?s.id:a.join("-");if(ge(s.index!==!0||!s.children,"Cannot specify children on an index route"),ge(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),iv(s)){let c={...s,id:l};return r[l]=Qu(c,e(c)),c}else{let c={...s,id:l,children:void 0};return r[l]=Qu(c,e(c)),s.children&&(c.children=ws(s.children,e,a,r,i)),c}})}function Qu(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function Xn(t,e,n="/"){return rs(t,e,n,!1)}function rs(t,e,n,r){let i=typeof e=="string"?mr(e):e,s=Xt(i.pathname||"/",n);if(s==null)return null;let o=qg(t);ov(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=bv(s);a=mv(o[l],c,r)}return a}function sv(t,e){let{route:n,pathname:r,params:i}=t;return{id:n.id,pathname:r,params:i,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function qg(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let h={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&l)return;ge(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let u=Dn([r,h.relativePath]),f=n.concat(h);o.children&&o.children.length>0&&(ge(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),qg(o.children,e,f,u,l)),!(o.path==null&&!o.index)&&e.push({path:u,score:fv(u,o.index),routesMeta:f})};return t.forEach((o,a)=>{if(o.path===""||!o.path?.includes("?"))s(o,a);else for(let l of Yg(o.path))s(o,a,!0,l)}),e}function Yg(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=Yg(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function ov(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:pv(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var av=/^:[\w-]+$/,lv=3,cv=2,dv=1,hv=10,uv=-2,Xu=t=>t==="*";function fv(t,e){let n=t.split("/"),r=n.length;return n.some(Xu)&&(r+=uv),e&&(r+=cv),n.filter(i=>!Xu(i)).reduce((i,s)=>i+(av.test(s)?lv:s===""?dv:hv),r)}function pv(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function mv(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,h=s==="/"?e:e.slice(s.length)||"/",u=tl({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},h),f=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=tl({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},h)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Dn([s,u.pathname]),pathnameBase:vv(Dn([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=Dn([s,u.pathnameBase]))}return o}function tl(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=gv(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:h,isOptional:u},f)=>{if(h==="*"){let g=a[f]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const p=a[f];return u&&!p?c[h]=void 0:c[h]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function gv(t,e=!1,n=!0){$e(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function bv(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return $e(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Xt(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function xv({basename:t,pathname:e}){return e==="/"?t:Dn([t,e])}var Jg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Bl=t=>Jg.test(t);function yv(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?mr(t):t,s;if(n)if(Bl(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),$e(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?s=Zu(n.substring(1),"/"):s=Zu(n,e)}else s=e;return{pathname:s,search:wv(r),hash:Sv(i)}}function Zu(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function fc(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Qg(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Fl(t){let e=Qg(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function zl(t,e,n,r=!1){let i;typeof t=="string"?i=mr(t):(i={...t},ge(!i.pathname||!i.pathname.includes("?"),fc("?","pathname","search",i)),ge(!i.pathname||!i.pathname.includes("#"),fc("#","pathname","hash",i)),ge(!i.search||!i.search.includes("#"),fc("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let u=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}a=u>=0?e[u]:"/"}let l=yv(i,a),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||h)&&(l.pathname+="/"),l}var Dn=t=>t.join("/").replace(/\/\/+/g,"/"),vv=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wv=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Sv=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Do=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ss(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Ao(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Xg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zg(t,e){let n=t;if(typeof n!="string"||!Jg.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Xg)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=Xt(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{$e(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var nr=Symbol("Uninstrumented");function kv(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(i=>i({id:e.id,index:e.index,path:e.path,instrument(s){let o=Object.keys(n);for(let a of o)s[a]&&n[a].push(s[a])}}));let r={};if(typeof e.lazy=="function"&&n.lazy.length>0){let i=ti(n.lazy,e.lazy,()=>{});i&&(r.lazy=i)}if(typeof e.lazy=="object"){let i=e.lazy;["middleware","loader","action"].forEach(s=>{let o=i[s],a=n[`lazy.${s}`];if(typeof o=="function"&&a.length>0){let l=ti(a,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[s]:l}))}})}return["loader","action"].forEach(i=>{let s=e[i];if(typeof s=="function"&&n[i].length>0){let o=s[nr]??s,a=ti(n[i],o,(...l)=>ef(l[0]));a&&(a[nr]=o,r[i]=a)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(r.middleware=e.middleware.map(i=>{let s=i[nr]??i,o=ti(n.middleware,s,(...a)=>ef(a[0]));return o?(o[nr]=s,o):i})),r}function Cv(t,e){let n={navigate:[],fetch:[]};if(e.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let o of s)i[o]&&n[o].push(i[o])}})),n.navigate.length>0){let r=t.navigate[nr]??t.navigate,i=ti(n.navigate,r,(...s)=>{let[o,a]=s;return{to:typeof o=="number"||typeof o=="string"?o:o?Mn(o):".",...tf(t,a??{})}});i&&(i[nr]=r,t.navigate=i)}if(n.fetch.length>0){let r=t.fetch[nr]??t.fetch,i=ti(n.fetch,r,(...s)=>{let[o,,a,l]=s;return{href:a??".",fetcherKey:o,...tf(t,l??{})}});i&&(i[nr]=r,t.fetch=i)}return t}function ti(t,e,n){return t.length===0?null:async(...r)=>{let i=await e0(t,n(...r),()=>e(...r),t.length-1);if(i.type==="error")throw i.value;return i.value}}async function e0(t,e,n,r){let i=t[r],s;if(i){let o,a=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=e0(t,e,n,r-1),s=await o,ge(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await i(a,e)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await a(),await o}else try{s={type:"success",value:await n()}}catch(o){s={type:"error",value:o}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function ef(t){let{request:e,context:n,params:r,unstable_pattern:i}=t;return{request:jv(e),params:{...r},unstable_pattern:i,context:Ov(n)}}function tf(t,e){return{currentUrl:Mn(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function jv(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function Ov(t){if(Nv(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var Pv=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nv(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===Pv}var t0=["POST","PUT","PATCH","DELETE"],Dv=new Set(t0),Av=["GET",...t0],Mv=new Set(Av),n0=new Set([301,302,303,307,308]),Tv=new Set([307,308]),pc={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ev={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_i={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Rv=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),r0="remix-router-transitions",i0=Symbol("ResetLoaderData");function Lv(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";ge(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=t.hydrationRouteProperties||[],i=t.mapRouteProperties||Rv,s=i;if(t.unstable_instrumentations){let O=t.unstable_instrumentations;s=D=>({...i(D),...kv(O.map(M=>M.route).filter(Boolean),D)})}let o={},a=ws(t.routes,s,void 0,o),l,c=t.basename||"/";c.startsWith("/")||(c=`/${c}`);let h=t.dataStrategy||zv,u={...t.future},f=null,p=new Set,g=null,b=null,x=null,w=t.hydrationData!=null,v=Xn(a,t.history.location,c),k=!1,j=null,S;if(v==null&&!t.patchRoutesOnNavigation){let O=Wt(404,{pathname:t.history.location.pathname}),{matches:D,route:M}=oa(a);S=!0,v=D,j={[M.id]:O}}else if(v&&!t.hydrationData&&Xe(v,a,t.history.location.pathname).active&&(v=null),v)if(v.some(O=>O.route.lazy))S=!1;else if(!v.some(O=>Th(O.route)))S=!0;else{let O=t.hydrationData?t.hydrationData.loaderData:null,D=t.hydrationData?t.hydrationData.errors:null;if(D){let M=v.findIndex(B=>D[B.route.id]!==void 0);S=v.slice(0,M+1).every(B=>!Pd(B.route,O,D))}else S=v.every(M=>!Pd(M.route,O,D))}else{S=!1,v=[];let O=Xe(null,a,t.history.location.pathname);O.active&&O.matches&&(k=!0,v=O.matches)}let C,y={historyAction:t.history.action,location:t.history.location,matches:v,initialized:S,navigation:pc,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||j,fetchers:new Map,blockers:new Map},N="POP",A=null,T=!1,P,R=!1,z=new Map,I=null,F=!1,G=!1,ae=new Set,X=new Map,Q=0,le=-1,fe=new Map,W=new Set,se=new Map,ue=new Map,xe=new Set,Pe=new Map,Qe,U=null;function ve(){if(f=t.history.listen(({action:O,location:D,delta:M})=>{if(Qe){Qe(),Qe=void 0;return}$e(Pe.size===0||M!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let B=na({currentLocation:y.location,nextLocation:D,historyAction:O});if(B&&M!=null){let H=new Promise(Z=>{Qe=Z});t.history.go(M*-1),qr(B,{state:"blocked",location:D,proceed(){qr(B,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),H.then(()=>t.history.go(M))},reset(){let Z=new Map(y.blockers);Z.set(B,_i),pe({blockers:Z})}}),A?.resolve(),A=null;return}return ce(O,D)}),n){iw(e,z);let O=()=>sw(e,z);e.addEventListener("pagehide",O),I=()=>e.removeEventListener("pagehide",O)}return y.initialized||ce("POP",y.location,{initialHydration:!0}),C}function ee(){f&&f(),I&&I(),p.clear(),P&&P.abort(),y.fetchers.forEach((O,D)=>Kr(D)),y.blockers.forEach((O,D)=>ta(D))}function Ae(O){return p.add(O),()=>p.delete(O)}function pe(O,D={}){O.matches&&(O.matches=O.matches.map(H=>{let Z=o[H.route.id],J=H.route;return J.element!==Z.element||J.errorElement!==Z.errorElement||J.hydrateFallbackElement!==Z.hydrateFallbackElement?{...H,route:Z}:H})),y={...y,...O};let M=[],B=[];y.fetchers.forEach((H,Z)=>{H.state==="idle"&&(xe.has(Z)?M.push(Z):B.push(Z))}),xe.forEach(H=>{!y.fetchers.has(H)&&!X.has(H)&&M.push(H)}),[...p].forEach(H=>H(y,{deletedFetchers:M,newErrors:O.errors??null,viewTransitionOpts:D.viewTransitionOpts,flushSync:D.flushSync===!0})),M.forEach(H=>Kr(H)),B.forEach(H=>y.fetchers.delete(H))}function _e(O,D,{flushSync:M}={}){let B=y.actionData!=null&&y.navigation.formMethod!=null&&dt(y.navigation.formMethod)&&y.navigation.state==="loading"&&O.state?._isRedirect!==!0,H;D.actionData?Object.keys(D.actionData).length>0?H=D.actionData:H=null:B?H=y.actionData:H=null;let Z=D.loaderData?uf(y.loaderData,D.loaderData,D.matches||[],D.errors):y.loaderData,J=y.blockers;J.size>0&&(J=new Map(J),J.forEach((de,re)=>J.set(re,_i)));let te=F?!1:bt(O,D.matches||y.matches),ne=T===!0||y.navigation.formMethod!=null&&dt(y.navigation.formMethod)&&O.state?._isRedirect!==!0;l&&(a=l,l=void 0),F||N==="POP"||(N==="PUSH"?t.history.push(O,O.state):N==="REPLACE"&&t.history.replace(O,O.state));let oe;if(N==="POP"){let de=z.get(y.location.pathname);de&&de.has(O.pathname)?oe={currentLocation:y.location,nextLocation:O}:z.has(O.pathname)&&(oe={currentLocation:O,nextLocation:y.location})}else if(R){let de=z.get(y.location.pathname);de?de.add(O.pathname):(de=new Set([O.pathname]),z.set(y.location.pathname,de)),oe={currentLocation:y.location,nextLocation:O}}pe({...D,actionData:H,loaderData:Z,historyAction:N,location:O,initialized:!0,navigation:pc,revalidation:"idle",restoreScrollPosition:te,preventScrollReset:ne,blockers:J},{viewTransitionOpts:oe,flushSync:M===!0}),N="POP",T=!1,R=!1,F=!1,G=!1,A?.resolve(),A=null,U?.resolve(),U=null}async function $(O,D){if(A?.resolve(),A=null,typeof O=="number"){A||(A=gf());let je=A.promise;return t.history.go(O),je}let M=Od(y.location,y.matches,c,O,D?.fromRouteId,D?.relative),{path:B,submission:H,error:Z}=nf(!1,M,D),J=y.location,te=vs(y.location,B,D&&D.state);te={...te,...t.history.encodeLocation(te)};let ne=D&&D.replace!=null?D.replace:void 0,oe="PUSH";ne===!0?oe="REPLACE":ne===!1||H!=null&&dt(H.formMethod)&&H.formAction===y.location.pathname+y.location.search&&(oe="REPLACE");let de=D&&"preventScrollReset"in D?D.preventScrollReset===!0:void 0,re=(D&&D.flushSync)===!0,Ce=na({currentLocation:J,nextLocation:te,historyAction:oe});if(Ce){qr(Ce,{state:"blocked",location:te,proceed(){qr(Ce,{state:"proceeding",proceed:void 0,reset:void 0,location:te}),$(O,D)},reset(){let je=new Map(y.blockers);je.set(Ce,_i),pe({blockers:je})}});return}await ce(oe,te,{submission:H,pendingError:Z,preventScrollReset:de,replace:D&&D.replace,enableViewTransition:D&&D.viewTransition,flushSync:re,callSiteDefaultShouldRevalidate:D&&D.unstable_defaultShouldRevalidate})}function K(){U||(U=gf()),pn(),pe({revalidation:"loading"});let O=U.promise;return y.navigation.state==="submitting"?O:y.navigation.state==="idle"?(ce(y.historyAction,y.location,{startUninterruptedRevalidation:!0}),O):(ce(N||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:R===!0}),O)}async function ce(O,D,M){P&&P.abort(),P=null,N=O,F=(M&&M.startUninterruptedRevalidation)===!0,gn(y.location,y.matches),T=(M&&M.preventScrollReset)===!0,R=(M&&M.enableViewTransition)===!0;let B=l||a,H=M&&M.overrideNavigation,Z=M?.initialHydration&&y.matches&&y.matches.length>0&&!k?y.matches:Xn(B,D,c),J=(M&&M.flushSync)===!0;if(Z&&y.initialized&&!G&&qv(y.location,D)&&!(M&&M.submission&&dt(M.submission.formMethod))){_e(D,{matches:Z},{flushSync:J});return}let te=Xe(Z,B,D.pathname);if(te.active&&te.matches&&(Z=te.matches),!Z){let{error:Ze,notFoundMatches:yt,route:De}=We(D.pathname);_e(D,{matches:yt,loaderData:{},errors:{[De.id]:Ze}},{flushSync:J});return}P=new AbortController;let ne=Xr(t.history,D,P.signal,M&&M.submission),oe=t.getContext?await t.getContext():new Ju,de;if(M&&M.pendingError)de=[Zn(Z).route.id,{type:"error",error:M.pendingError}];else if(M&&M.submission&&dt(M.submission.formMethod)){let Ze=await Ne(ne,D,M.submission,Z,oe,te.active,M&&M.initialHydration===!0,{replace:M.replace,flushSync:J});if(Ze.shortCircuited)return;if(Ze.pendingActionResult){let[yt,De]=Ze.pendingActionResult;if($t(De)&&Ss(De.error)&&De.error.status===404){P=null,_e(D,{matches:Ze.matches,loaderData:{},errors:{[yt]:De.error}});return}}Z=Ze.matches||Z,de=Ze.pendingActionResult,H=mc(D,M.submission),J=!1,te.active=!1,ne=Xr(t.history,ne.url,ne.signal)}let{shortCircuited:re,matches:Ce,loaderData:je,errors:nt}=await Tt(ne,D,Z,oe,te.active,H,M&&M.submission,M&&M.fetcherSubmission,M&&M.replace,M&&M.initialHydration===!0,J,de,M&&M.callSiteDefaultShouldRevalidate);re||(P=null,_e(D,{matches:Ce||Z,...ff(de),loaderData:je,errors:nt}))}async function Ne(O,D,M,B,H,Z,J,te={}){pn();let ne=nw(D,M);if(pe({navigation:ne},{flushSync:te.flushSync===!0}),Z){let re=await xt(B,D.pathname,O.signal);if(re.type==="aborted")return{shortCircuited:!0};if(re.type==="error"){if(re.partialMatches.length===0){let{matches:je,route:nt}=oa(a);return{matches:je,pendingActionResult:[nt.id,{type:"error",error:re.error}]}}let Ce=Zn(re.partialMatches).route.id;return{matches:re.partialMatches,pendingActionResult:[Ce,{type:"error",error:re.error}]}}else if(re.matches)B=re.matches;else{let{notFoundMatches:Ce,error:je,route:nt}=We(D.pathname);return{matches:Ce,pendingActionResult:[nt.id,{type:"error",error:je}]}}}let oe,de=Ha(B,D);if(!de.route.action&&!de.route.lazy)oe={type:"error",error:Wt(405,{method:O.method,pathname:D.pathname,routeId:de.route.id})};else{let re=ai(s,o,O,B,de,J?[]:r,H),Ce=await yr(O,re,H,null);if(oe=Ce[de.route.id],!oe){for(let je of B)if(Ce[je.route.id]){oe=Ce[je.route.id];break}}if(O.signal.aborted)return{shortCircuited:!0}}if(Ar(oe)){let re;return te&&te.replace!=null?re=te.replace:re=cf(oe.response.headers.get("Location"),new URL(O.url),c)===y.location.pathname+y.location.search,await fn(O,oe,!0,{submission:M,replace:re}),{shortCircuited:!0}}if($t(oe)){let re=Zn(B,de.route.id);return(te&&te.replace)!==!0&&(N="PUSH"),{matches:B,pendingActionResult:[re.route.id,oe,de.route.id]}}return{matches:B,pendingActionResult:[de.route.id,oe]}}async function Tt(O,D,M,B,H,Z,J,te,ne,oe,de,re,Ce){let je=Z||mc(D,J),nt=J||te||mf(je),Ze=!F&&!oe;if(H){if(Ze){let ct=Un(re);pe({navigation:je,...ct!==void 0?{actionData:ct}:{}},{flushSync:de})}let ke=await xt(M,D.pathname,O.signal);if(ke.type==="aborted")return{shortCircuited:!0};if(ke.type==="error"){if(ke.partialMatches.length===0){let{matches:Yr,route:Sr}=oa(a);return{matches:Yr,loaderData:{},errors:{[Sr.id]:ke.error}}}let ct=Zn(ke.partialMatches).route.id;return{matches:ke.partialMatches,loaderData:{},errors:{[ct]:ke.error}}}else if(ke.matches)M=ke.matches;else{let{error:ct,notFoundMatches:Yr,route:Sr}=We(D.pathname);return{matches:Yr,loaderData:{},errors:{[Sr.id]:ct}}}}let yt=l||a,{dsMatches:De,revalidatingFetchers:Vt}=rf(O,B,s,o,t.history,y,M,nt,D,oe?[]:r,oe===!0,G,ae,xe,se,W,yt,c,t.patchRoutesOnNavigation!=null,re,Ce);if(le=++Q,!t.dataStrategy&&!De.some(ke=>ke.shouldLoad)&&!De.some(ke=>ke.route.middleware&&ke.route.middleware.length>0)&&Vt.length===0){let ke=zi();return _e(D,{matches:M,loaderData:{},errors:re&&$t(re[1])?{[re[0]]:re[1].error}:null,...ff(re),...ke?{fetchers:new Map(y.fetchers)}:{}},{flushSync:de}),{shortCircuited:!0}}if(Ze){let ke={};if(!H){ke.navigation=je;let ct=Un(re);ct!==void 0&&(ke.actionData=ct)}Vt.length>0&&(ke.fetchers=Ct(Vt)),pe(ke,{flushSync:de})}Vt.forEach(ke=>{nn(ke.key),ke.controller&&X.set(ke.key,ke.controller)});let vr=()=>Vt.forEach(ke=>nn(ke.key));P&&P.signal.addEventListener("abort",vr);let{loaderResults:Hi,fetcherResults:Kn}=await Xo(De,Vt,O,B);if(O.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",vr),Vt.forEach(ke=>X.delete(ke.key));let xn=aa(Hi);if(xn)return await fn(O,xn.result,!0,{replace:ne}),{shortCircuited:!0};if(xn=aa(Kn),xn)return W.add(xn.key),await fn(O,xn.result,!0,{replace:ne}),{shortCircuited:!0};let{loaderData:hc,errors:Vi}=hf(y,M,Hi,re,Vt,Kn);oe&&y.errors&&(Vi={...y.errors,...Vi});let wr=zi(),ra=Zo(le),ia=wr||ra||Vt.length>0;return{matches:M,loaderData:hc,errors:Vi,...ia?{fetchers:new Map(y.fetchers)}:{}}}function Un(O){if(O&&!$t(O[1]))return{[O[0]]:O[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function Ct(O){return O.forEach(D=>{let M=y.fetchers.get(D.key),B=Wi(void 0,M?M.data:void 0);y.fetchers.set(D.key,B)}),new Map(y.fetchers)}async function Wr(O,D,M,B){nn(O);let H=(B&&B.flushSync)===!0,Z=l||a,J=Od(y.location,y.matches,c,M,D,B?.relative),te=Xn(Z,J,c),ne=Xe(te,Z,J);if(ne.active&&ne.matches&&(te=ne.matches),!te){mt(O,D,Wt(404,{pathname:J}),{flushSync:H});return}let{path:oe,submission:de,error:re}=nf(!0,J,B);if(re){mt(O,D,re,{flushSync:H});return}let Ce=t.getContext?await t.getContext():new Ju,je=(B&&B.preventScrollReset)===!0;if(de&&dt(de.formMethod)){await Ur(O,D,oe,te,Ce,ne.active,H,je,de,B&&B.unstable_defaultShouldRevalidate);return}se.set(O,{routeId:D,path:oe}),await Qo(O,D,oe,te,Ce,ne.active,H,je,de)}async function Ur(O,D,M,B,H,Z,J,te,ne,oe){pn(),se.delete(O);let de=y.fetchers.get(O);at(O,rw(ne,de),{flushSync:J});let re=new AbortController,Ce=Xr(t.history,M,re.signal,ne);if(Z){let Be=await xt(B,new URL(Ce.url).pathname,Ce.signal,O);if(Be.type==="aborted")return;if(Be.type==="error"){mt(O,D,Be.error,{flushSync:J});return}else if(Be.matches)B=Be.matches;else{mt(O,D,Wt(404,{pathname:M}),{flushSync:J});return}}let je=Ha(B,M);if(!je.route.action&&!je.route.lazy){let Be=Wt(405,{method:ne.formMethod,pathname:M,routeId:D});mt(O,D,Be,{flushSync:J});return}X.set(O,re);let nt=Q,Ze=ai(s,o,Ce,B,je,r,H),yt=await yr(Ce,Ze,H,O),De=yt[je.route.id];if(!De){for(let Be of Ze)if(yt[Be.route.id]){De=yt[Be.route.id];break}}if(Ce.signal.aborted){X.get(O)===re&&X.delete(O);return}if(xe.has(O)){if(Ar(De)||$t(De)){at(O,Bn(void 0));return}}else{if(Ar(De))if(X.delete(O),le>nt){at(O,Bn(void 0));return}else return W.add(O),at(O,Wi(ne)),fn(Ce,De,!1,{fetcherSubmission:ne,preventScrollReset:te});if($t(De)){mt(O,D,De.error);return}}let Vt=y.navigation.location||y.location,vr=Xr(t.history,Vt,re.signal),Hi=l||a,Kn=y.navigation.state!=="idle"?Xn(Hi,y.navigation.location,c):y.matches;ge(Kn,"Didn't find any matches after fetcher action");let xn=++Q;fe.set(O,xn);let hc=Wi(ne,De.data);y.fetchers.set(O,hc);let{dsMatches:Vi,revalidatingFetchers:wr}=rf(vr,H,s,o,t.history,y,Kn,ne,Vt,r,!1,G,ae,xe,se,W,Hi,c,t.patchRoutesOnNavigation!=null,[je.route.id,De],oe);wr.filter(Be=>Be.key!==O).forEach(Be=>{let sa=Be.key,Uu=y.fetchers.get(sa),F1=Wi(void 0,Uu?Uu.data:void 0);y.fetchers.set(sa,F1),nn(sa),Be.controller&&X.set(sa,Be.controller)}),pe({fetchers:new Map(y.fetchers)});let ra=()=>wr.forEach(Be=>nn(Be.key));re.signal.addEventListener("abort",ra);let{loaderResults:ia,fetcherResults:ke}=await Xo(Vi,wr,vr,H);if(re.signal.aborted)return;if(re.signal.removeEventListener("abort",ra),fe.delete(O),X.delete(O),wr.forEach(Be=>X.delete(Be.key)),y.fetchers.has(O)){let Be=Bn(De.data);y.fetchers.set(O,Be)}let ct=aa(ia);if(ct)return fn(vr,ct.result,!1,{preventScrollReset:te});if(ct=aa(ke),ct)return W.add(ct.key),fn(vr,ct.result,!1,{preventScrollReset:te});let{loaderData:Yr,errors:Sr}=hf(y,Kn,ia,void 0,wr,ke);Zo(xn),y.navigation.state==="loading"&&xn>le?(ge(N,"Expected pending action"),P&&P.abort(),_e(y.navigation.location,{matches:Kn,loaderData:Yr,errors:Sr,fetchers:new Map(y.fetchers)})):(pe({errors:Sr,loaderData:uf(y.loaderData,Yr,Kn,Sr),fetchers:new Map(y.fetchers)}),G=!1)}async function Qo(O,D,M,B,H,Z,J,te,ne){let oe=y.fetchers.get(O);at(O,Wi(ne,oe?oe.data:void 0),{flushSync:J});let de=new AbortController,re=Xr(t.history,M,de.signal);if(Z){let De=await xt(B,new URL(re.url).pathname,re.signal,O);if(De.type==="aborted")return;if(De.type==="error"){mt(O,D,De.error,{flushSync:J});return}else if(De.matches)B=De.matches;else{mt(O,D,Wt(404,{pathname:M}),{flushSync:J});return}}let Ce=Ha(B,M);X.set(O,de);let je=Q,nt=ai(s,o,re,B,Ce,r,H),yt=(await yr(re,nt,H,O))[Ce.route.id];if(X.get(O)===de&&X.delete(O),!re.signal.aborted){if(xe.has(O)){at(O,Bn(void 0));return}if(Ar(yt))if(le>je){at(O,Bn(void 0));return}else{W.add(O),await fn(re,yt,!1,{preventScrollReset:te});return}if($t(yt)){mt(O,D,yt.error);return}at(O,Bn(yt.data))}}async function fn(O,D,M,{submission:B,fetcherSubmission:H,preventScrollReset:Z,replace:J}={}){M||(A?.resolve(),A=null),D.response.headers.has("X-Remix-Revalidate")&&(G=!0);let te=D.response.headers.get("Location");ge(te,"Expected a Location header on the redirect Response"),te=cf(te,new URL(O.url),c);let ne=vs(y.location,te,{_isRedirect:!0});if(n){let nt=!1;if(D.response.headers.has("X-Remix-Reload-Document"))nt=!0;else if(Bl(te)){const Ze=Gg(te,!0);nt=Ze.origin!==e.location.origin||Xt(Ze.pathname,c)==null}if(nt){J?e.location.replace(te):e.location.assign(te);return}}P=null;let oe=J===!0||D.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:de,formAction:re,formEncType:Ce}=y.navigation;!B&&!H&&de&&re&&Ce&&(B=mf(y.navigation));let je=B||H;if(Tv.has(D.response.status)&&je&&dt(je.formMethod))await ce(oe,ne,{submission:{...je,formAction:te},preventScrollReset:Z||T,enableViewTransition:M?R:void 0});else{let nt=mc(ne,B);await ce(oe,ne,{overrideNavigation:nt,fetcherSubmission:H,preventScrollReset:Z||T,enableViewTransition:M?R:void 0})}}async function yr(O,D,M,B){let H,Z={};try{H=await Vv(h,O,D,B,M,!1)}catch(J){return D.filter(te=>te.shouldLoad).forEach(te=>{Z[te.route.id]={type:"error",error:J}}),Z}if(O.signal.aborted)return Z;if(!dt(O.method))for(let J of D){if(H[J.route.id]?.type==="error")break;!H.hasOwnProperty(J.route.id)&&!y.loaderData.hasOwnProperty(J.route.id)&&(!y.errors||!y.errors.hasOwnProperty(J.route.id))&&J.shouldCallHandler()&&(H[J.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${J.route.id}`)})}for(let[J,te]of Object.entries(H))if(Xv(te)){let ne=te.result;Z[J]={type:"redirect",response:Kv(ne,O,J,D,c)}}else Z[J]=await Uv(te);return Z}async function Xo(O,D,M,B){let H=yr(M,O,B,null),Z=Promise.all(D.map(async ne=>{if(ne.matches&&ne.match&&ne.request&&ne.controller){let de=(await yr(ne.request,ne.matches,B,ne.key))[ne.match.route.id];return{[ne.key]:de}}else return Promise.resolve({[ne.key]:{type:"error",error:Wt(404,{pathname:ne.path})}})})),J=await H,te=(await Z).reduce((ne,oe)=>Object.assign(ne,oe),{});return{loaderResults:J,fetcherResults:te}}function pn(){G=!0,se.forEach((O,D)=>{X.has(D)&&ae.add(D),nn(D)})}function at(O,D,M={}){y.fetchers.set(O,D),pe({fetchers:new Map(y.fetchers)},{flushSync:(M&&M.flushSync)===!0})}function mt(O,D,M,B={}){let H=Zn(y.matches,D);Kr(O),pe({errors:{[H.route.id]:M},fetchers:new Map(y.fetchers)},{flushSync:(B&&B.flushSync)===!0})}function Fi(O){return ue.set(O,(ue.get(O)||0)+1),xe.has(O)&&xe.delete(O),y.fetchers.get(O)||Ev}function mn(O,D){nn(O,D?.reason),at(O,Bn(null))}function Kr(O){let D=y.fetchers.get(O);X.has(O)&&!(D&&D.state==="loading"&&fe.has(O))&&nn(O),se.delete(O),fe.delete(O),W.delete(O),xe.delete(O),ae.delete(O),y.fetchers.delete(O)}function dc(O){let D=(ue.get(O)||0)-1;D<=0?(ue.delete(O),xe.add(O)):ue.set(O,D),pe({fetchers:new Map(y.fetchers)})}function nn(O,D){let M=X.get(O);M&&(M.abort(D),X.delete(O))}function Gr(O){for(let D of O){let M=Fi(D),B=Bn(M.data);y.fetchers.set(D,B)}}function zi(){let O=[],D=!1;for(let M of W){let B=y.fetchers.get(M);ge(B,`Expected fetcher: ${M}`),B.state==="loading"&&(W.delete(M),O.push(M),D=!0)}return Gr(O),D}function Zo(O){let D=[];for(let[M,B]of fe)if(B<O){let H=y.fetchers.get(M);ge(H,`Expected fetcher: ${M}`),H.state==="loading"&&(nn(M),fe.delete(M),D.push(M))}return Gr(D),D.length>0}function ea(O,D){let M=y.blockers.get(O)||_i;return Pe.get(O)!==D&&Pe.set(O,D),M}function ta(O){y.blockers.delete(O),Pe.delete(O)}function qr(O,D){let M=y.blockers.get(O)||_i;ge(M.state==="unblocked"&&D.state==="blocked"||M.state==="blocked"&&D.state==="blocked"||M.state==="blocked"&&D.state==="proceeding"||M.state==="blocked"&&D.state==="unblocked"||M.state==="proceeding"&&D.state==="unblocked",`Invalid blocker state transition: ${M.state} -> ${D.state}`);let B=new Map(y.blockers);B.set(O,D),pe({blockers:B})}function na({currentLocation:O,nextLocation:D,historyAction:M}){if(Pe.size===0)return;Pe.size>1&&$e(!1,"A router only supports one blocker at a time");let B=Array.from(Pe.entries()),[H,Z]=B[B.length-1],J=y.blockers.get(H);if(!(J&&J.state==="proceeding")&&Z({currentLocation:O,nextLocation:D,historyAction:M}))return H}function We(O){let D=Wt(404,{pathname:O}),M=l||a,{matches:B,route:H}=oa(M);return{notFoundMatches:B,route:H,error:D}}function gt(O,D,M){if(g=O,x=D,b=M||null,!w&&y.navigation===pc){w=!0;let B=bt(y.location,y.matches);B!=null&&pe({restoreScrollPosition:B})}return()=>{g=null,x=null,b=null}}function lt(O,D){return b&&b(O,D.map(B=>sv(B,y.loaderData)))||O.key}function gn(O,D){if(g&&x){let M=lt(O,D);g[M]=x()}}function bt(O,D){if(g){let M=lt(O,D),B=g[M];if(typeof B=="number")return B}return null}function Xe(O,D,M){if(t.patchRoutesOnNavigation)if(O){if(Object.keys(O[0].params).length>0)return{active:!0,matches:rs(D,M,c,!0)}}else return{active:!0,matches:rs(D,M,c,!0)||[]};return{active:!1,matches:null}}async function xt(O,D,M,B){if(!t.patchRoutesOnNavigation)return{type:"success",matches:O};let H=O;for(;;){let Z=l==null,J=l||a,te=o;try{await t.patchRoutesOnNavigation({signal:M,path:D,matches:H,fetcherKey:B,patch:(de,re)=>{M.aborted||sf(de,re,J,te,s,!1)}})}catch(de){return{type:"error",error:de,partialMatches:H}}finally{Z&&!M.aborted&&(a=[...a])}if(M.aborted)return{type:"aborted"};let ne=Xn(J,D,c),oe=null;if(ne){if(Object.keys(ne[0].params).length===0)return{type:"success",matches:ne};if(oe=rs(J,D,c,!0),!(oe&&H.length<oe.length&&In(H,oe.slice(0,H.length))))return{type:"success",matches:ne}}if(oe||(oe=rs(J,D,c,!0)),!oe||In(H,oe))return{type:"success",matches:null};H=oe}}function In(O,D){return O.length===D.length&&O.every((M,B)=>M.route.id===D[B].route.id)}function Ke(O){o={},l=ws(O,s,void 0,o)}function bn(O,D,M=!1){let B=l==null;sf(O,D,l||a,o,s,M),B&&(a=[...a],pe({}))}return C={get basename(){return c},get future(){return u},get state(){return y},get routes(){return a},get window(){return e},initialize:ve,subscribe:Ae,enableScrollRestoration:gt,navigate:$,fetch:Wr,revalidate:K,createHref:O=>t.history.createHref(O),encodeLocation:O=>t.history.encodeLocation(O),getFetcher:Fi,resetFetcher:mn,deleteFetcher:dc,dispose:ee,getBlocker:ea,deleteBlocker:ta,patchRoutes:bn,_internalFetchControllers:X,_internalSetRoutes:Ke,_internalSetStateDoNotUseOrYouWillBreakYourApp(O){pe(O)}},t.unstable_instrumentations&&(C=Cv(C,t.unstable_instrumentations.map(O=>O.router).filter(Boolean))),C}function Iv(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Od(t,e,n,r,i,s){let o,a;if(i){o=[];for(let c of e)if(o.push(c),c.route.id===i){a=c;break}}else o=e,a=e[e.length-1];let l=zl(r||".",Fl(o),Xt(t.pathname,n)||t.pathname,s==="path");if(r==null&&(l.search=t.search,l.hash=t.hash),(r==null||r===""||r===".")&&a){let c=Rh(l.search);if(a.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!a.route.index&&c){let h=new URLSearchParams(l.search),u=h.getAll("index");h.delete("index"),u.filter(p=>p).forEach(p=>h.append("index",p));let f=h.toString();l.search=f?`?${f}`:""}}return n!=="/"&&(l.pathname=xv({basename:n,pathname:l.pathname})),Mn(l)}function nf(t,e,n){if(!n||!Iv(n))return{path:e};if(n.formMethod&&!tw(n.formMethod))return{path:e,error:Wt(405,{method:n.formMethod})};let r=()=>({path:e,error:Wt(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),o=d0(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!dt(s))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[p,g])=>`${f}${p}=${g}
19
19
  `,""):String(n.body);return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!dt(s))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:s,formAction:o,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}ge(typeof FormData=="function","FormData is not available in this environment");let a,l;if(n.formData)a=Dd(n.formData),l=n.formData;else if(n.body instanceof FormData)a=Dd(n.body),l=n.body;else if(n.body instanceof URLSearchParams)a=n.body,l=df(a);else if(n.body==null)a=new URLSearchParams,l=new FormData;else try{a=new URLSearchParams(n.body),l=df(a)}catch{return r()}let c={formMethod:s,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(dt(c.formMethod))return{path:e,submission:c};let h=mr(e);return t&&h.search&&Rh(h.search)&&a.append("index",""),h.search=`?${a}`,{path:Mn(h),submission:c}}function rf(t,e,n,r,i,s,o,a,l,c,h,u,f,p,g,b,x,w,v,k,j){let S=k?$t(k[1])?k[1].error:k[1].data:void 0,C=i.createURL(s.location),y=i.createURL(l),N;if(h&&s.errors){let F=Object.keys(s.errors)[0];N=o.findIndex(G=>G.route.id===F)}else if(k&&$t(k[1])){let F=k[0];N=o.findIndex(G=>G.route.id===F)-1}let A=k?k[1].statusCode:void 0,T=A&&A>=400,P={currentUrl:C,currentParams:s.matches[0]?.params||{},nextUrl:y,nextParams:o[0].params,...a,actionResult:S,actionStatus:A},R=Ao(o),z=o.map((F,G)=>{let{route:ae}=F,X=null;if(N!=null&&G>N?X=!1:ae.lazy?X=!0:Th(ae)?h?X=Pd(ae,s.loaderData,s.errors):$v(s.loaderData,s.matches[G],F)&&(X=!0):X=!1,X!==null)return Nd(n,r,t,R,F,c,e,X);let Q=!1;typeof j=="boolean"?Q=j:T?Q=!1:(u||C.pathname+C.search===y.pathname+y.search||C.search!==y.search||Bv(s.matches[G],F))&&(Q=!0);let le={...P,defaultShouldRevalidate:Q},fe=ls(F,le);return Nd(n,r,t,R,F,c,e,fe,le,j)}),I=[];return g.forEach((F,G)=>{if(h||!o.some(ue=>ue.route.id===F.routeId)||p.has(G))return;let ae=s.fetchers.get(G),X=ae&&ae.state!=="idle"&&ae.data===void 0,Q=Xn(x,F.path,w);if(!Q){if(v&&X)return;I.push({key:G,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(b.has(G))return;let le=Ha(Q,F.path),fe=new AbortController,W=Xr(i,F.path,fe.signal),se=null;if(f.has(G))f.delete(G),se=ai(n,r,W,Q,le,c,e);else if(X)u&&(se=ai(n,r,W,Q,le,c,e));else{let ue;typeof j=="boolean"?ue=j:T?ue=!1:ue=u;let xe={...P,defaultShouldRevalidate:ue};ls(le,xe)&&(se=ai(n,r,W,Q,le,c,e,xe))}se&&I.push({key:G,routeId:F.routeId,path:F.path,matches:se,match:le,request:W,controller:fe})}),{dsMatches:z,revalidatingFetchers:I}}function Th(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function Pd(t,e,n){if(t.lazy)return!0;if(!Th(t))return!1;let r=e!=null&&t.id in e,i=n!=null&&n[t.id]!==void 0;return!r&&i?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!r&&!i}function $v(t,e,n){let r=!e||n.route.id!==e.route.id,i=!t.hasOwnProperty(n.route.id);return r||i}function Bv(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function ls(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function sf(t,e,n,r,i,s){let o;if(t){let c=r[t];ge(c,`No route found to patch children into: routeId = ${t}`),c.children||(c.children=[]),o=c.children}else o=n;let a=[],l=[];if(e.forEach(c=>{let h=o.find(u=>s0(c,u));h?l.push({existingRoute:h,newRoute:c}):a.push(c)}),a.length>0){let c=ws(a,i,[t||"_","patch",String(o?.length||"0")],r);o.push(...c)}if(s&&l.length>0)for(let c=0;c<l.length;c++){let{existingRoute:h,newRoute:u}=l[c],f=h,[p]=ws([u],i,[],{},!0);Object.assign(f,{element:p.element?p.element:f.element,errorElement:p.errorElement?p.errorElement:f.errorElement,hydrateFallbackElement:p.hydrateFallbackElement?p.hydrateFallbackElement:f.hydrateFallbackElement})}}function s0(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,r)=>e.children?.some(i=>s0(n,i))):!1}var of=new WeakMap,o0=({key:t,route:e,manifest:n,mapRouteProperties:r})=>{let i=n[e.id];if(ge(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[t];if(!s)return;let o=of.get(i);o||(o={},of.set(i,o));let a=o[t];if(a)return a;let l=(async()=>{let c=tv(t),u=i[t]!==void 0&&t!=="hasErrorBoundary";if(c)$e(!c,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(u)$e(!1,`Route "${i.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(i,{[t]:f}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[t]=void 0,Object.values(i.lazy).every(f=>f===void 0)&&(i.lazy=void 0))})();return o[t]=l,l},af=new WeakMap;function Fv(t,e,n,r,i){let s=n[t.id];if(ge(s,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let h=af.get(s);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let u=(async()=>{ge(typeof t.lazy=="function","No lazy route function found");let f=await t.lazy(),p={};for(let g in f){let b=f[g];if(b===void 0)continue;let x=rv(g),v=s[g]!==void 0&&g!=="hasErrorBoundary";x?$e(!x,"Route property "+g+" is not a supported property to be returned from a lazy route function. This property will be ignored."):v?$e(!v,`Route "${s.id}" has a static property "${g}" defined but its lazy function is also returning a value for this property. The lazy route property "${g}" will be ignored.`):p[g]=b}Object.assign(s,p),Object.assign(s,{...r(s),lazy:void 0})})();return af.set(s,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(t.lazy),a=[],l;for(let h of o){if(i&&i.includes(h))continue;let u=o0({key:h,route:t,manifest:n,mapRouteProperties:r});u&&(a.push(u),h===e&&(l=u))}let c=a.length>0?Promise.all(a).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function lf(t){let e=t.matches.filter(i=>i.shouldLoad),n={};return(await Promise.all(e.map(i=>i.resolve()))).forEach((i,s)=>{n[e[s].route.id]=i}),n}async function zv(t){return t.matches.some(e=>e.route.middleware)?a0(t,()=>lf(t)):lf(t)}function a0(t,e){return Hv(t,e,r=>{if(ew(r))throw r;return r},Jv,n);function n(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:o}=t,a=Math.min(Math.max(o.findIndex(c=>c.route.id===i),0),Math.max(o.findIndex(c=>c.shouldCallHandler()),0)),l=Zn(o,o[a].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function Hv(t,e,n,r,i){let{matches:s,request:o,params:a,context:l,unstable_pattern:c}=t,h=s.flatMap(f=>f.route.middleware?f.route.middleware.map(p=>[f.route.id,p]):[]);return await l0({request:o,params:a,context:l,unstable_pattern:c},h,e,n,r,i)}async function l0(t,e,n,r,i,s,o=0){let{request:a}=t;if(a.signal.aborted)throw a.signal.reason??new Error(`Request aborted: ${a.method} ${a.url}`);let l=e[o];if(!l)return await n();let[c,h]=l,u,f=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await l0(t,e,n,r,i,s,o+1)},u.value}catch(p){return u={value:await s(p,c,u)},u.value}};try{let p=await h(t,f),g=p!=null?r(p):void 0;return i(g)?g:u?g??u.value:(u={value:await f()},u.value)}catch(p){return await s(p,c,u)}}function c0(t,e,n,r,i){let s=o0({key:"middleware",route:r.route,manifest:e,mapRouteProperties:t}),o=Fv(r.route,dt(n.method)?"action":"loader",e,t,i);return{middleware:s,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Nd(t,e,n,r,i,s,o,a,l=null,c){let h=!1,u=c0(t,e,n,i,s);return{...i,_lazyPromises:u,shouldLoad:a,shouldRevalidateArgs:l,shouldCallHandler(f){return h=!0,l?typeof c=="boolean"?ls(i,{...l,defaultShouldRevalidate:c}):typeof f=="boolean"?ls(i,{...l,defaultShouldRevalidate:f}):ls(i,l):a},resolve(f){let{lazy:p,loader:g,middleware:b}=i.route,x=h||a||f&&!dt(n.method)&&(p||g),w=b&&b.length>0&&!g&&!p;return x&&(dt(n.method)||!w)?_v({request:n,unstable_pattern:r,match:i,lazyHandlerPromise:u?.handler,lazyRoutePromise:u?.route,handlerOverride:f,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function ai(t,e,n,r,i,s,o,a=null){return r.map(l=>l.route.id!==i.route.id?{...l,shouldLoad:!1,shouldRevalidateArgs:a,shouldCallHandler:()=>!1,_lazyPromises:c0(t,e,n,l,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Nd(t,e,n,Ao(r),l,s,o,!0,a))}async function Vv(t,e,n,r,i,s){n.some(c=>c._lazyPromises?.middleware)&&await Promise.all(n.map(c=>c._lazyPromises?.middleware));let o={request:e,unstable_pattern:Ao(n),params:n[0].params,context:i,matches:n},l=await t({...o,fetcherKey:r,runClientMiddleware:c=>{let h=o;return a0(h,()=>c({...h,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function _v({request:t,unstable_pattern:e,match:n,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:o}){let a,l,c=dt(t.method),h=c?"action":"loader",u=f=>{let p,g=new Promise((w,v)=>p=v);l=()=>p(),t.signal.addEventListener("abort",l);let b=w=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${n.route.id}]`)):f({request:t,unstable_pattern:e,params:n.params,context:o},...w!==void 0?[w]:[]),x=(async()=>{try{return{type:"data",result:await(s?s(v=>b(v)):b())}}catch(w){return{type:"error",result:w}}})();return Promise.race([x,g])};try{let f=c?n.route.action:n.route.loader;if(r||i)if(f){let p,[g]=await Promise.all([u(f).catch(b=>{p=b}),r,i]);if(p!==void 0)throw p;a=g}else{await r;let p=c?n.route.action:n.route.loader;if(p)[a]=await Promise.all([u(p),i]);else if(h==="action"){let g=new URL(t.url),b=g.pathname+g.search;throw Wt(405,{method:t.method,pathname:b,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)a=await u(f);else{let p=new URL(t.url),g=p.pathname+p.search;throw Wt(404,{pathname:g})}}catch(f){return{type:"error",result:f}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function Wv(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function Uv(t){let{result:e,type:n}=t;if(Eh(e)){let r;try{r=await Wv(e)}catch(i){return{type:"error",error:i}}return n==="error"?{type:"error",error:new Do(e.status,e.statusText,r),statusCode:e.status,headers:e.headers}:{type:"data",data:r,statusCode:e.status,headers:e.headers}}return n==="error"?pf(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:Yv(e),statusCode:Ss(e)?e.status:void 0,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Ss(e)?e.status:void 0}:pf(e)?{type:"data",data:e.data,statusCode:e.init?.status,headers:e.init?.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function Kv(t,e,n,r,i){let s=t.headers.get("Location");if(ge(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bl(s)){let o=r.slice(0,r.findIndex(a=>a.route.id===n)+1);s=Od(new URL(e.url),o,i,s),t.headers.set("Location",s)}return t}function cf(t,e,n){if(Bl(t)){let r=t,i=r.startsWith("//")?new URL(e.protocol+r):new URL(r),s=Xt(i.pathname,n)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function Xr(t,e,n,r){let i=t.createURL(d0(e)).toString(),s={signal:n};if(r&&dt(r.formMethod)){let{formMethod:o,formEncType:a}=r;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(r.json)):a==="text/plain"?s.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?s.body=Dd(r.formData):s.body=r.formData}return new Request(i,s)}function Dd(t){let e=new URLSearchParams;for(let[n,r]of t.entries())e.append(n,typeof r=="string"?r:r.name);return e}function df(t){let e=new FormData;for(let[n,r]of t.entries())e.append(n,r);return e}function Gv(t,e,n,r=!1,i=!1){let s={},o=null,a,l=!1,c={},h=n&&$t(n[1])?n[1].error:void 0;return t.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,p=e[f];if(ge(!Ar(p),"Cannot handle redirect results in processLoaderData"),$t(p)){let g=p.error;if(h!==void 0&&(g=h,h=void 0),o=o||{},i)o[f]=g;else{let b=Zn(t,f);o[b.route.id]==null&&(o[b.route.id]=g)}r||(s[f]=i0),l||(l=!0,a=Ss(p.error)?p.error.status:500),p.headers&&(c[f]=p.headers)}else s[f]=p.data,p.statusCode&&p.statusCode!==200&&!l&&(a=p.statusCode),p.headers&&(c[f]=p.headers)}),h!==void 0&&n&&(o={[n[0]]:h},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function hf(t,e,n,r,i,s){let{loaderData:o,errors:a}=Gv(e,n,r);return i.filter(l=>!l.matches||l.matches.some(c=>c.shouldLoad)).forEach(l=>{let{key:c,match:h,controller:u}=l;if(u&&u.signal.aborted)return;let f=s[c];if(ge(f,"Did not find corresponding fetcher result"),$t(f)){let p=Zn(t.matches,h?.route.id);a&&a[p.route.id]||(a={...a,[p.route.id]:f.error}),t.fetchers.delete(c)}else if(Ar(f))ge(!1,"Unhandled fetcher revalidation redirect");else{let p=Bn(f.data);t.fetchers.set(c,p)}}),{loaderData:o,errors:a}}function uf(t,e,n,r){let i=Object.entries(e).filter(([,s])=>s!==i0).reduce((s,[o,a])=>(s[o]=a,s),{});for(let s of n){let o=s.route.id;if(!e.hasOwnProperty(o)&&t.hasOwnProperty(o)&&s.route.loader&&(i[o]=t[o]),r&&r.hasOwnProperty(o))break}return i}function ff(t){return t?$t(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Zn(t,e){return(e?t.slice(0,t.findIndex(r=>r.route.id===e)+1):[...t]).reverse().find(r=>r.route.hasErrorBoundary===!0)||t[0]}function oa(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Wt(t,{pathname:e,routeId:n,method:r,type:i,message:s}={}){let o="Unknown Server Error",a="Unknown @remix-run/router error";return t===400?(o="Bad Request",r&&e&&n?a=`You made a ${r} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i==="invalid-body"&&(a="Unable to encode submission body")):t===403?(o="Forbidden",a=`Route "${n}" does not match URL "${e}"`):t===404?(o="Not Found",a=`No route matches URL "${e}"`):t===405&&(o="Method Not Allowed",r&&e&&n?a=`You made a ${r.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(a=`Invalid request method "${r.toUpperCase()}"`)),new Do(t||500,o,new Error(a),!0)}function aa(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[r,i]=e[n];if(Ar(i))return{key:r,result:i}}}function d0(t){let e=typeof t=="string"?mr(t):t;return Mn({...e,hash:""})}function qv(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Yv(t){return new Do(t.init?.status??500,t.init?.statusText??"Internal Server Error",t.data)}function Jv(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&Qv(n))}function Qv(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function Xv(t){return Eh(t.result)&&n0.has(t.result.status)}function $t(t){return t.type==="error"}function Ar(t){return(t&&t.type)==="redirect"}function pf(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Eh(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Zv(t){return n0.has(t)}function ew(t){return Eh(t)&&Zv(t.status)&&t.headers.has("Location")}function tw(t){return Mv.has(t.toUpperCase())}function dt(t){return Dv.has(t.toUpperCase())}function Rh(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function Ha(t,e){let n=typeof e=="string"?mr(e).search:e.search;if(t[t.length-1].route.index&&Rh(n||""))return t[t.length-1];let r=Qg(t);return r[r.length-1]}function mf(t){let{formMethod:e,formAction:n,formEncType:r,text:i,formData:s,json:o}=t;if(!(!e||!n||!r)){if(i!=null)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function mc(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function nw(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Wi(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function rw(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function Bn(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function iw(t,e){try{let n=t.sessionStorage.getItem(r0);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function sw(t,e){if(e.size>0){let n={};for(let[r,i]of e)n[r]=[...i];try{t.sessionStorage.setItem(r0,JSON.stringify(n))}catch(r){$e(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function gf(){let t,e,n=new Promise((r,i)=>{t=async s=>{r(s);try{await n}catch{}},e=async s=>{i(s);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var zr=m.createContext(null);zr.displayName="DataRouter";var Mo=m.createContext(null);Mo.displayName="DataRouterState";var h0=m.createContext(!1);function ow(){return m.useContext(h0)}var Lh=m.createContext({isTransitioning:!1});Lh.displayName="ViewTransition";var u0=m.createContext(new Map);u0.displayName="Fetchers";var aw=m.createContext(null);aw.displayName="Await";var Ft=m.createContext(null);Ft.displayName="Navigation";var Hl=m.createContext(null);Hl.displayName="Location";var en=m.createContext({outlet:null,matches:[],isDataRoute:!1});en.displayName="Route";var Ih=m.createContext(null);Ih.displayName="RouteError";var f0="REACT_ROUTER_ERROR",lw="REDIRECT",cw="ROUTE_ERROR_RESPONSE";function dw(t){if(t.startsWith(`${f0}:${lw}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function hw(t){if(t.startsWith(`${f0}:${cw}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Do(e.status,e.statusText,e.data)}catch{}}function uw(t,{relative:e}={}){ge(ji(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(Ft),{hash:i,pathname:s,search:o}=To(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:Dn([n,s])),r.createHref({pathname:a,search:o,hash:i})}function ji(){return m.useContext(Hl)!=null}function dn(){return ge(ji(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(Hl).location}var p0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function m0(t){m.useContext(Ft).static||m.useLayoutEffect(t)}function Tn(){let{isDataRoute:t}=m.useContext(en);return t?Pw():fw()}function fw(){ge(ji(),"useNavigate() may be used only in the context of a <Router> component.");let t=m.useContext(zr),{basename:e,navigator:n}=m.useContext(Ft),{matches:r}=m.useContext(en),{pathname:i}=dn(),s=JSON.stringify(Fl(r)),o=m.useRef(!1);return m0(()=>{o.current=!0}),m.useCallback((l,c={})=>{if($e(o.current,p0),!o.current)return;if(typeof l=="number"){n.go(l);return}let h=zl(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Dn([e,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[e,n,s,i,t])}var g0=m.createContext(null);function pw(){return m.useContext(g0)}function mw(t){let e=m.useContext(en).outlet;return m.useMemo(()=>e&&m.createElement(g0.Provider,{value:t},e),[e,t])}function b0(){let{matches:t}=m.useContext(en),e=t[t.length-1];return e?e.params:{}}function To(t,{relative:e}={}){let{matches:n}=m.useContext(en),{pathname:r}=dn(),i=JSON.stringify(Fl(n));return m.useMemo(()=>zl(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function gw(t,e,n,r,i){ge(ji(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=m.useContext(Ft),{matches:o}=m.useContext(en),a=o[o.length-1],l=a?a.params:{},c=a?a.pathname:"/",h=a?a.pathnameBase:"/",u=a&&a.route;{let v=u&&u.path||"";y0(c,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${v}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
20
20
 
21
- Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let f=dn(),p;p=f;let g=p.pathname||"/",b=g;if(h!=="/"){let v=h.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let x=Xn(t,{pathname:b});return $e(u||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),$e(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),ww(x&&x.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Dn([h,s.encodeLocation?s.encodeLocation(v.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?h:Dn([h,s.encodeLocation?s.encodeLocation(v.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),o,n,r,i)}function bw(){let t=Ow(),e=Ss(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:s},"ErrorBoundary")," or"," ",m.createElement("code",{style:s},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),n?m.createElement("pre",{style:i},n):null,o)}var xw=m.createElement(bw,null),x0=class extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=hw(t.digest);n&&(t=n)}let e=t!==void 0?m.createElement(en.Provider,{value:this.props.routeContext},m.createElement(Ih.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?m.createElement(yw,{error:t},e):e}};x0.contextType=h0;var gc=new WeakMap;function yw({children:t,error:e}){let{basename:n}=m.useContext(Ft);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=dw(e.digest);if(r){let i=gc.get(e);if(i)throw i;let s=Zg(r.location,n);if(Xg&&!gc.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw gc.set(e,o),o}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function vw({routeContext:t,match:e,children:n}){let r=m.useContext(zr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),m.createElement(en.Provider,{value:t},n)}function ww(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=n?.errors;if(o!=null){let h=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);ge(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let a=!1,l=-1;if(n)for(let h=0;h<s.length;h++){let u=s[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=h),u.route.id){let{loaderData:f,errors:p}=n,g=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||g){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=n&&r?(h,u)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Ao(n.matches),errorInfo:u})}:void 0;return s.reduceRight((h,u,f)=>{let p,g=!1,b=null,x=null;n&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||xw,a&&(l<0&&f===0?(y0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,x=null):l===f&&(g=!0,x=u.route.hydrateFallbackElement||null)));let w=e.concat(s.slice(0,f+1)),v=()=>{let k;return p?k=b:g?k=x:u.route.Component?k=m.createElement(u.route.Component,null):u.route.element?k=u.route.element:k=h,m.createElement(vw,{match:u,routeContext:{outlet:h,matches:w,isDataRoute:n!=null},children:k})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?m.createElement(x0,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):v()},null)}function $h(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sw(t){let e=m.useContext(zr);return ge(e,$h(t)),e}function kw(t){let e=m.useContext(Mo);return ge(e,$h(t)),e}function Cw(t){let e=m.useContext(en);return ge(e,$h(t)),e}function Bh(t){let e=Cw(t),n=e.matches[e.matches.length-1];return ge(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function jw(){return Bh("useRouteId")}function Ow(){let t=m.useContext(Ih),e=kw("useRouteError"),n=Bh("useRouteError");return t!==void 0?t:e.errors?.[n]}function Pw(){let{router:t}=Sw("useNavigate"),e=Bh("useNavigate"),n=m.useRef(!1);return m0(()=>{n.current=!0}),m.useCallback(async(i,s={})=>{$e(n.current,p0),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var bf={};function y0(t,e,n){!e&&!bf[t]&&(bf[t]=!0,$e(!1,n))}var xf={};function yf(t,e){!t&&!xf[e]&&(xf[e]=!0,console.warn(e))}var Nw="useOptimistic",vf=V1[Nw],Dw=()=>{};function Aw(t){return vf?vf(t):[t,Dw]}function Mw(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&$e(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:m.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&$e(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:m.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&$e(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:m.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var Tw=["HydrateFallback","hydrateFallbackElement"],Ew=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function Rw({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=ow()||r;let[s,o]=m.useState(t.state),[a,l]=Aw(s),[c,h]=m.useState(),[u,f]=m.useState({isTransitioning:!1}),[p,g]=m.useState(),[b,x]=m.useState(),[w,v]=m.useState(),k=m.useRef(new Map),j=m.useCallback((N,{deletedFetchers:A,newErrors:T,flushSync:P,viewTransitionOpts:R})=>{T&&n&&Object.values(T).forEach(I=>n(I,{location:N.location,params:N.matches[0]?.params??{},unstable_pattern:Ao(N.matches)})),N.fetchers.forEach((I,F)=>{I.data!==void 0&&k.current.set(F,I.data)}),A.forEach(I=>k.current.delete(I)),yf(P===!1||e!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let z=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(yf(R==null||z,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!R||!z){e&&P?e(()=>o(N)):r===!1?o(N):m.startTransition(()=>{r===!0&&l(I=>wf(I,N)),o(N)});return}if(e&&P){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation})});let I=t.window.document.startViewTransition(()=>{e(()=>o(N))});I.finished.finally(()=>{e(()=>{g(void 0),x(void 0),h(void 0),f({isTransitioning:!1})})}),e(()=>x(I));return}b?(p?.resolve(),b.skipTransition(),v({state:N,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(h(N),f({isTransitioning:!0,flushSync:!1,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[t.window,e,b,p,r,l,n]);m.useLayoutEffect(()=>t.subscribe(j),[t,j]),m.useEffect(()=>{u.isTransitioning&&!u.flushSync&&g(new Ew)},[u]),m.useEffect(()=>{if(p&&c&&t.window){let N=c,A=p.promise,T=t.window.document.startViewTransition(async()=>{r===!1?o(N):m.startTransition(()=>{r===!0&&l(P=>wf(P,N)),o(N)}),await A});T.finished.finally(()=>{g(void 0),x(void 0),h(void 0),f({isTransitioning:!1})}),x(T)}},[c,p,t.window,r,l]),m.useEffect(()=>{p&&c&&a.location.key===c.location.key&&p.resolve()},[p,b,a.location,c]),m.useEffect(()=>{!u.isTransitioning&&w&&(h(w.state),f({isTransitioning:!0,flushSync:!1,currentLocation:w.currentLocation,nextLocation:w.nextLocation}),v(void 0))},[u.isTransitioning,w]);let S=m.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:N=>t.navigate(N),push:(N,A,T)=>t.navigate(N,{state:A,preventScrollReset:T?.preventScrollReset}),replace:(N,A,T)=>t.navigate(N,{replace:!0,state:A,preventScrollReset:T?.preventScrollReset})}),[t]),C=t.basename||"/",y=m.useMemo(()=>({router:t,navigator:S,static:!1,basename:C,onError:n}),[t,S,C,n]);return m.createElement(m.Fragment,null,m.createElement(zr.Provider,{value:y},m.createElement(Mo.Provider,{value:a},m.createElement(u0.Provider,{value:k.current},m.createElement(Lh.Provider,{value:u},m.createElement(Bw,{basename:C,location:a.location,navigationType:a.historyAction,navigator:S,unstable_useTransitions:r},m.createElement(Lw,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function wf(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var Lw=m.memo(Iw);function Iw({routes:t,future:e,state:n,onError:r}){return gw(t,void 0,n,r,e)}function bc({to:t,replace:e,state:n,relative:r}){ge(ji(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=m.useContext(Ft);$e(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=m.useContext(en),{pathname:o}=dn(),a=Tn(),l=zl(t,Fl(s),o,r==="path"),c=JSON.stringify(l);return m.useEffect(()=>{a(JSON.parse(c),{replace:e,state:n,relative:r})},[a,c,r,e,n]),null}function $w(t){return mw(t.context)}function Bw({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){ge(!ji(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=m.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=mr(n));let{pathname:c="/",search:h="",hash:u="",state:f=null,key:p="default"}=n,g=m.useMemo(()=>{let b=Xt(c,a);return b==null?null:{location:{pathname:b,search:h,hash:u,state:f,key:p},navigationType:r}},[a,c,h,u,f,p,r]);return $e(g!=null,`<Router basename="${a}"> is not able to match the URL "${c}${h}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:m.createElement(Ft.Provider,{value:l},m.createElement(Hl.Provider,{children:e,value:g}))}var Va="get",_a="application/x-www-form-urlencoded";function Vl(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Fw(t){return Vl(t)&&t.tagName.toLowerCase()==="button"}function zw(t){return Vl(t)&&t.tagName.toLowerCase()==="form"}function Hw(t){return Vl(t)&&t.tagName.toLowerCase()==="input"}function Vw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _w(t,e){return t.button===0&&(!e||e==="_self")&&!Vw(t)}function Ad(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Ww(t,e){let n=Ad(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var la=null;function Uw(){if(la===null)try{new FormData(document.createElement("form"),0),la=!1}catch{la=!0}return la}var Kw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xc(t){return t!=null&&!Kw.has(t)?($e(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_a}"`),null):t}function Gw(t,e){let n,r,i,s,o;if(zw(t)){let a=t.getAttribute("action");r=a?Xt(a,e):null,n=t.getAttribute("method")||Va,i=xc(t.getAttribute("enctype"))||_a,s=new FormData(t)}else if(Fw(t)||Hw(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?Xt(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||Va,i=xc(t.getAttribute("formenctype"))||xc(a.getAttribute("enctype"))||_a,s=new FormData(a,t),!Uw()){let{name:c,type:h,value:u}=t;if(h==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,u)}}else{if(Vl(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Va,r=null,i=_a,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Fh(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function qw(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Xt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function Yw(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Jw(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Qw(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await Yw(s,n);return o.links?o.links():[]}return[]}));return t2(r.flat(1).filter(Jw).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Sf(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{let h=r.routes[l.route.id];if(!h||!h.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function Xw(t,e,{includeHydrateFallback:n}={}){return Zw(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function Zw(t){return[...new Set(t)]}function e2(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function t2(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(e2(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function v0(){let t=m.useContext(zr);return Fh(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function n2(){let t=m.useContext(Mo);return Fh(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var zh=m.createContext(void 0);zh.displayName="FrameworkContext";function w0(){let t=m.useContext(zh);return Fh(t,"You must render this element inside a <HydratedRouter> element"),t}function r2(t,e){let n=m.useContext(zh),[r,i]=m.useState(!1),[s,o]=m.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:h,onTouchStart:u}=e,f=m.useRef(null);m.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let b=w=>{w.forEach(v=>{o(v.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return f.current&&x.observe(f.current),()=>{x.disconnect()}}},[t]),m.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},g=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,f,{}]:[s,f,{onFocus:Ui(a,p),onBlur:Ui(l,g),onMouseEnter:Ui(c,p),onMouseLeave:Ui(h,g),onTouchStart:Ui(u,p)}]:[!1,f,{}]}function Ui(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function i2({page:t,...e}){let{router:n}=v0(),r=m.useMemo(()=>Xn(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?m.createElement(o2,{page:t,matches:r,...e}):null}function s2(t){let{manifest:e,routeModules:n}=w0(),[r,i]=m.useState([]);return m.useEffect(()=>{let s=!1;return Qw(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function o2({page:t,matches:e,...n}){let r=dn(),{manifest:i,routeModules:s}=w0(),{basename:o}=v0(),{loaderData:a,matches:l}=n2(),c=m.useMemo(()=>Sf(t,e,l,i,r,"data"),[t,e,l,i,r]),h=m.useMemo(()=>Sf(t,e,l,i,r,"assets"),[t,e,l,i,r]),u=m.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,b=!1;if(e.forEach(w=>{let v=i.routes[w.route.id];!v||!v.hasLoader||(!c.some(k=>k.route.id===w.route.id)&&w.route.id in a&&s[w.route.id]?.shouldRevalidate||v.hasClientLoader?b=!0:g.add(w.route.id))}),g.size===0)return[];let x=qw(t,o,"data");return b&&g.size>0&&x.searchParams.set("_routes",e.filter(w=>g.has(w.route.id)).map(w=>w.route.id).join(",")),[x.pathname+x.search]},[o,a,r,i,c,e,t,s]),f=m.useMemo(()=>Xw(h,i),[h,i]),p=s2(h);return m.createElement(m.Fragment,null,u.map(g=>m.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>m.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:b})=>m.createElement("link",{key:g,nonce:n.nonce,...b})))}function a2(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var l2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{l2&&(window.__reactRouterVersion="7.11.0")}catch{}function c2(t,e){return Lv({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Q1({window:e?.window}),hydrationData:d2(),routes:t,mapRouteProperties:Mw,hydrationRouteProperties:Tw,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function d2(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:h2(t.errors)}),t}function h2(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")n[r]=new Do(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let o=new s(i.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}var S0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,k0=m.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g){let{basename:b,unstable_useTransitions:x}=m.useContext(Ft),w=typeof c=="string"&&S0.test(c),v=Zg(c,b);c=v.to;let k=uw(c,{relative:i}),[j,S,C]=r2(r,p),y=m2(c,{replace:o,state:a,target:l,preventScrollReset:h,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function N(T){e&&e(T),T.defaultPrevented||y(T)}let A=m.createElement("a",{...p,...C,href:v.absoluteURL||k,onClick:v.isExternal||s?e:N,ref:a2(g,S),target:l,"data-discover":!w&&n==="render"?"true":void 0});return j&&!w?m.createElement(m.Fragment,null,A,m.createElement(i2,{page:k})):A});k0.displayName="Link";var u2=m.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},h){let u=To(o,{relative:c.relative}),f=dn(),p=m.useContext(Mo),{navigator:g,basename:b}=m.useContext(Ft),x=p!=null&&w2(u)&&a===!0,w=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,v=f.pathname,k=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(v=v.toLowerCase(),k=k?k.toLowerCase():null,w=w.toLowerCase()),k&&b&&(k=Xt(k,b)||k);const j=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let S=v===w||!i&&v.startsWith(w)&&v.charAt(j)==="/",C=k!=null&&(k===w||!i&&k.startsWith(w)&&k.charAt(w.length)==="/"),y={isActive:S,isPending:C,isTransitioning:x},N=S?e:void 0,A;typeof r=="function"?A=r(y):A=[r,S?"active":null,C?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let T=typeof s=="function"?s(y):s;return m.createElement(k0,{...c,"aria-current":N,className:A,ref:h,style:T,to:o,viewTransition:a},typeof l=="function"?l(y):l)});u2.displayName="NavLink";var f2=m.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=Va,action:a,onSubmit:l,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g)=>{let{unstable_useTransitions:b}=m.useContext(Ft),x=y2(),w=v2(a,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",k=typeof a=="string"&&S0.test(a),j=S=>{if(l&&l(S),S.defaultPrevented)return;S.preventDefault();let C=S.nativeEvent.submitter,y=C?.getAttribute("formmethod")||o,N=()=>x(C||S.currentTarget,{fetcherKey:e,method:y,navigate:n,replace:i,state:s,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&n!==!1?m.startTransition(()=>N()):N()};return m.createElement("form",{ref:g,method:v,action:w,onSubmit:r?l:j,...p,"data-discover":!k&&t==="render"?"true":void 0})});f2.displayName="Form";function p2(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C0(t){let e=m.useContext(zr);return ge(e,p2(t)),e}function m2(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=Tn(),h=dn(),u=To(t,{relative:s});return m.useCallback(f=>{if(_w(f,e)){f.preventDefault();let p=n!==void 0?n:Mn(h)===Mn(u),g=()=>c(t,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?m.startTransition(()=>g()):g()}},[h,c,u,n,r,e,t,i,s,o,a,l])}function g2(t){$e(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=m.useRef(Ad(t)),n=m.useRef(!1),r=dn(),i=m.useMemo(()=>Ww(r.search,n.current?null:e.current),[r.search]),s=Tn(),o=m.useCallback((a,l)=>{const c=Ad(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var b2=0,x2=()=>`__${String(++b2)}__`;function y2(){let{router:t}=C0("useSubmit"),{basename:e}=m.useContext(Ft),n=jw(),r=t.fetch,i=t.navigate;return m.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:h,body:u}=Gw(s,e);if(o.navigate===!1){let f=o.fetcherKey||x2();await r(f,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function v2(t,{relative:e}={}){let{basename:n}=m.useContext(Ft),r=m.useContext(en);ge(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...To(t||".",{relative:e})},o=dn();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(h=>h==="")){a.delete("index"),l.filter(u=>u).forEach(u=>a.append("index",u));let h=a.toString();s.search=h?`?${h}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Dn([n,s.pathname])),Mn(s)}function w2(t,{relative:e}={}){let n=m.useContext(Lh);ge(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=C0("useViewTransitionState"),i=To(t,{relative:e});if(!n.isTransitioning)return!1;let s=Xt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Xt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tl(i.pathname,o)!=null||tl(i.pathname,s)!=null}function S2(t){return m.createElement(Rw,{flushSync:Dr.flushSync,...t})}const k2={en:{loading:"Loading...",error:"Error",selectProject:"Select a project to view dashboard",controlCenter:"Control Center",settings:"Settings",sync:"Sync",offline:"Offline",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode",settingsSection:"Settings",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"Skills",health:"Health",collapse:"Collapse",expand:"Expand",installing:"Installing...",manage:"Manage",uninstall:"Uninstall",installGlobally:"Install Globally",installGloballyDesc:"Available to all projects instead of current project only",selectAtLeastOneAgent:"Please select at least one agent",installationFailed:"Installation failed",allSkills:"All Skills",refresh:"Refresh",browseAndManageSkills:"Browse and manage skills for your agents",detected:"Detected",notDetected:"Not detected",sessions:"sessions",noSessions:"No sessions",terminal:"Terminal",terminalSub:"Open bash at path",editor:"Editor",editorSub:"Open in VS Code",useGlobalFallback:"Use global fallback",openAtPath:"Open at project path",openAppOnly:"Open app only",actionOptionsLoadFailed:"Could not load editor/terminal options",launch:"Launch",launchSub:"Start Claude Code",config:"Config",configSub:"Manage project settings",recentSessions:"Recent Sessions",viewAllHistory:"View All History",showLess:"Show Less",actionFailed:"Action failed",loadingSessions:"Loading sessions...",noSessionsFound:"No sessions found",configuration:"Claude Settings",activeKit:"Active Kit",aiModel:"Model",hooks:"Hooks",active:"active",mcpServers:"MCP Servers",connected:"connected",editProjectConfig:"Edit Project Config",globalSettings:"(Global)",globalSkills:"Global Skills",loadingSkills:"Loading skills...",noDescription:"No description",browseSkillsMarketplace:"Browse Skills Marketplace",backToDashboard:"Back to Dashboard",educationalConfigEditor:"Educational Config Editor",discard:"Discard",saveChanges:"Save Changes",mergedView:"Merged View",localConfig:"Local (.ck.json)",globalConfig:"Global",syntaxValid:"Syntax Valid",configurationHelp:"Configuration Help",field:"Field",type:"Type",default:"Default",description:"Description",validValues:"Valid Values",systemEffect:"System Effect",exampleUsage:"Example Usage",knowledgeBase:"Knowledge Base",clickToSeeHelp:"Click on any configuration field to see detailed documentation and usage examples.",extractedFrom:"Extracted from ClaudeKit v2.x Specification",resetToDefault:"Reset",saving:"Saving...",saved:"Saved",confirmReset:"Reset to Default?",confirmResetMessage:"All changes will be lost and replaced with default values.",confirm:"Confirm",saveFailed:"Save failed",configTab:"Config",systemTab:"System",formTab:"Form",jsonTab:"JSON",readOnly:"Read-only",installedKit:"Installed Kit",kitVersion:"Kit Version",installedOn:"Installed On",noKitInstalled:"No kit installed",components:"Components",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"File Ownership",ownershipCk:"kit-managed",ownershipUser:"user-owned",ownershipModified:"modified",componentInventory:"Component Inventory",installedHooks:"Installed Hooks",installedMcpServers:"MCP Servers",lastChecked:"Last update check",staleIndicator:"Stale",skippedVersion:"Skipped",filesModifiedFromDefaults:"files modified from kit defaults",cliCard:"ClaudeKit CLI",checkForUpdates:"Check for Updates",checking:"Checking...",upToDate:"Up to date",updateAvailable:"Update available",updateNow:"Update Now",updating:"Updating...",updateSuccess:"Update Complete!",updateFailed:"Update Failed",closeModal:"Close",showDetails:"Show Details",hideDetails:"Hide Details",environment:"Environment",claudeConfigPath:"Claude config",nodeVersion:"Node",bunVersion:"Bun",osVersion:"OS",channelStable:"Stable",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Latest",selectVersion:"Select version",loadingVersions:"Loading versions...",prereleaseLabel:"Pre",currentVersionLabel:"Current",checkAll:"Check All",checkingAll:"Checking...",updateAll:"Update All",updatesAvailable:"{count} updates available",allUpToDate:"All up to date",systemControlTower:"System Control Tower",systemOverviewTitle:"Update & Runtime Overview",systemOverviewDesc:"Track CLI and kit health, then run upgrades from one place.",installedComponentsHeading:"Installed Components",updateReadiness:"Update Readiness",checkedComponents:"Checked",activeChannel:"Channel",readyToScan:"Ready to scan",noTrackedFiles:"No tracked files detected",kitsLabel:"Kits",componentFilterAll:"All",componentFilterUpdates:"Updates",componentFilterUpdatesCount:"Updates ({count})",componentFilterUpToDate:"Up to date",componentFilterUpToDateCount:"Up to date ({count})",componentFilterCli:"CLI",componentFilterKits:"Kits",noComponentsMatchFilter:"No components match the current filter.",runCheckAllForFilter:"Run Check All to populate this filter.",noUpdatesFound:"No updates found. Checked components are up to date.",noUpToDateYet:"No components are up to date yet.",configWorkspaceHint:"Edit configuration or manage system updates from one workspace.",settingsJsonHeading:"Claude Settings JSON",settingsJsonMissing:"No settings file found at ~/.claude/settings.json.",settingsJsonLoadFailed:"Failed to load ~/.claude/settings.json.",settingsBackupSaved:"Backup saved",hookDiagnosticsTitle:"Hook Diagnostics",hookDiagnosticsDesc:"Inspect recent hook activity and failures without opening JSONL files manually.",hookDiagnosticsPathPending:"Resolving log path...",hookDiagnosticsScopeGlobal:"Global hooks",hookDiagnosticsEntries:"Entries",hookDiagnosticsCrashes:"Crashes",hookDiagnosticsWarnings:"Warnings",hookDiagnosticsBlocks:"Blocks",hookDiagnosticsLastEvent:"Last event",hookDiagnosticsLoading:"Loading hook diagnostics...",hookDiagnosticsLoadFailed:"Failed to load hook diagnostics",hookDiagnosticsMissing:"No hook log file found for this scope yet.",hookDiagnosticsEmpty:"Hook log is present but contains no readable entries.",hookDiagnosticsParseErrorsNotice:"Skipped {count} malformed log line(s) while loading diagnostics.",hookDiagnosticsTruncatedNotice:"Showing a bounded recent window to keep diagnostics responsive on large logs.",hookDiagnosticsToolLabel:"tool",hookDiagnosticsTargetLabel:"target",hookDiagnosticsUnknown:"Unknown",addProjectTitle:"Add Project",addProjectDescription:"Add a new ClaudeKit project to the control center",projectPath:"Project Path",pathPlaceholder:"/path/to/project",alias:"Alias",aliasOptional:"(optional)",aliasPlaceholder:"my-project",aliasDescription:"Custom display name for the project",pathRequired:"Path is required",failedToAdd:"Failed to add project",cancel:"Cancel",adding:"Adding...",somethingWentWrong:"Something went wrong",reloadApp:"Reload App",serverNotRunning:"Server Not Running",startServerMessage:"The Config UI requires the backend server to be running.",runThisCommand:"Run this command",tryAgain:"Try Again",projectConfig:"Project Config",inheritedFromGlobal:"Inherited from Global",localOverride:"Local Override",viewGlobalConfig:"This field inherits from global config. View",onboardingTitle:"Welcome to ClaudeKit",onboardingSubtitle:"Choose your kit and get started in minutes",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"AI-powered coding with skills, hooks, and multi-agent workflows",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Content automation: campaigns, social media, analytics",featureAgents:"AI Agents",featureAgentsDesc:"Specialized agents for different tasks",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Customize Claude's behavior at key moments",featureSkills:"Skills Library",featureSkillsDesc:"Pre-built capabilities you can activate",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Coordinate multiple agents for complex tasks",featureContent:"Content Generation",featureContentDesc:"Automated content creation and optimization",featureSocial:"Social Media Tools",featureSocialDesc:"Scheduling, analytics, and engagement automation",stepChooseKit:"Choose Kit",stepConfigure:"Configure",stepInstall:"Install",back:"Back",next:"Next",install:"Install",installSuccess:"Installation Complete!",installSuccessDesc:"{kit} is ready to use",getStarted:"Get Started",goToDashboard:"Go to Dashboard",kitConfig:"Kit Config",kitConfigSubtitle:"Configure ClaudeKit Engineer settings",scopeGlobal:"Global",scopeProject:"Project",sectionGeneral:"General",sectionPaths:"Paths",sectionPrivacy:"Privacy & Trust",sectionProject:"Project Detection",sectionIntegrations:"Integrations",sectionHooks:"Hooks",sectionAdvanced:"Advanced",fieldCodingLevel:"Coding Level",fieldCodingLevelDesc:"Your coding experience level (-1=auto, 0=beginner, 1=intermediate, 2=advanced, 3=expert, 4=tech-lead, 5=god-mode)",fieldStatusline:"Statusline Mode",fieldStatuslineDesc:"How much info to show in the status line",fieldStatuslineColors:"Statusline Colors",fieldStatuslineColorsDesc:"Enable ANSI color output in the statusline",fieldStatuslineQuota:"Statusline Quota Display",fieldStatuslineQuotaDesc:"Show the 5h / wk quota chips in the statusline",fieldThinkingLanguage:"Thinking Language",fieldThinkingLanguageDesc:"Language for Claude's internal reasoning (null=English)",fieldResponseLanguage:"Response Language",fieldResponseLanguageDesc:"Language for Claude's responses (null=match user)",fieldDocsPath:"Docs Directory",fieldDocsPathDesc:"Path to documentation directory",fieldPlansPath:"Plans Directory",fieldPlansPathDesc:"Path to plans directory",fieldPrivacyBlock:"Privacy Block",fieldPrivacyBlockDesc:"Block access to sensitive files (.env, credentials)",fieldTrustEnabled:"Trust Mode",fieldTrustEnabledDesc:"Enable auto-approval for tool calls",fieldTrustPassphrase:"Trust Passphrase",fieldTrustPassphraseDesc:"Passphrase to enable trust mode",fieldProjectType:"Project Type",fieldProjectTypeDesc:"Override auto-detected project type",fieldPackageManager:"Package Manager",fieldPackageManagerDesc:"Override auto-detected package manager",fieldFramework:"Framework",fieldFrameworkDesc:"Override auto-detected framework",fieldGeminiModel:"Gemini Model",fieldGeminiModelDesc:"Gemini model for CLI commands; legacy gemini-3.0-* ids auto-map",geminiModel25Flash:"Gemini 2.5 Flash — All tiers",geminiModel25Pro:"Gemini 2.5 Pro — May hit capacity limits",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Pro/Ultra only",geminiModel3ProPreview:"Gemini 3 Pro Preview — Pro/Ultra only",fieldResearchUseGemini:"Use Gemini for Research",fieldResearchUseGeminiDesc:"Use Gemini CLI instead of WebSearch",fieldDocsMaxLoc:"Max Lines per Doc",fieldDocsMaxLocDesc:"Maximum lines of code per documentation file",fieldPlanNamingFormat:"Plan Naming Format",fieldPlanNamingFormatDesc:"Format for plan directory names",fieldPlanDateFormat:"Plan Date Format",fieldPlanDateFormatDesc:"Date format for plan names (moment.js)",fieldPlanValidationMode:"Validation Mode",fieldPlanValidationModeDesc:"How to validate plans before implementation",fieldPlanMinQuestions:"Min Questions",fieldPlanMinQuestionsDesc:"Minimum validation questions",fieldPlanMaxQuestions:"Max Questions",fieldPlanMaxQuestionsDesc:"Maximum validation questions",fieldAssertions:"Assertions",fieldAssertionsDesc:"Code assertions and rules to enforce",fieldHookSessionInit:"Session Init",fieldHookSessionInitDesc:"Project detection and environment setup",fieldHookSubagentInit:"Subagent Init",fieldHookSubagentInitDesc:"Inject context to subagents",fieldHookDescriptiveName:"Descriptive Name",fieldHookDescriptiveNameDesc:"Enforce kebab-case descriptive file naming for scripts",fieldHookDevRulesReminder:"Dev Rules Reminder",fieldHookDevRulesReminderDesc:"Inject development rules context",fieldHookUsageContextAwareness:"Usage Prompt Awareness",fieldHookUsageContextAwarenessDesc:"Inject usage-limit awareness into prompts",fieldHookContextTracking:"Context Tracking",fieldHookContextTrackingDesc:"Context window tracking (% used, token counts)",fieldHookScoutBlock:"Scout Block",fieldHookScoutBlockDesc:"Block heavy directories from exploration",fieldHookPrivacyBlock:"Privacy Block Hook",fieldHookPrivacyBlockDesc:"Block sensitive files from reading",fieldHookPostEditSimplify:"Post-Edit Simplify",fieldHookPostEditSimplifyDesc:"Simplify reminder after edits",sectionUpdatePipeline:"Update Pipeline",fieldAutoInitAfterUpdate:"Auto Init After Update",fieldAutoInitAfterUpdateDesc:"Automatically run ck init after ck update when kit has new version",fieldAutoMigrateAfterUpdate:"Auto Migrate After Update",fieldAutoMigrateAfterUpdateDesc:"Automatically run ck migrate after ck update (independent of init)",fieldMigrateProviders:"Migrate Providers",fieldMigrateProvidersDesc:"Which providers to auto-migrate. Use 'auto' to scan filesystem or a comma-separated list.",skillsPageTitle:"Skills Management",skillsPageDesc:"Install ClaudeKit skills to your coding agents",availableSkills:"Available Skills",installedSkills:"Installed Skills",noSkillsFound:"No skills found",installSkill:"Install",uninstallSkill:"Uninstall",manageSkill:"Manage",syncRegistry:"Sync",installSkillTitle:"Install Skill",selectAgents:"Select target agents",installLocation:"Installation location",globalInstall:"Global",projectInstall:"Project",confirmInstall:"Install to selected agents",installingSkill:"Installing...",skillInstallSuccess:"Skill installed successfully",skillInstallFailed:"Installation failed",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Installed",notInstalled:"Not installed",allAgents:"All Agents",filterByAgent:"Filter by agent",skillsTitle:"Skills",skillsSubtitle:"Browse, install, and manage skills for your coding agents",availableCount:"Available",installedCount:"Installed",agentsCount:"Agents",searchSkills:"Search skills...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Category",sortInstalledFirst:"Installed first",listView:"List view",gridView:"Grid view",categoryAll:"All",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Security",categoryDevOps:"DevOps",categoryDatabase:"Database",categoryDevelopment:"Development",categoryResearch:"Research",categoryGeneral:"General",categoryCore:"Core",categoryDocumentation:"Documentation",categoryTooling:"Tooling",categoryMedia:"Media",categoryFrameworks:"Frameworks",skillsCountLabel:"{count} skills",installToAll:"Install to All Detected",scopeLabel:"Installation Scope",agentInstalled:"Installed",agentNotInstalled:"Not installed",skillSource:"Source location",skillSourceBadge:"Source",detailPanelClose:"Close",versionLabel:"v{version}",installAllToAllAgents:"Install All to All Agents",bulkInstallFailed:"Bulk install failed",noAgentsDetected:"No agents detected",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Customized",installedVersionLabel:"Installed Version",installedAtLabel:"Installed At",sourceTimestampLabel:"Source Date",kitLabel:"Kit",skillMetadata:"Skill Info",migrate:"Migrate",migrateTitle:"Migrate",migrateSubtitle:"Migrate your Claude Code stack to other providers",migrateDetectedProviders:"Detected",migrateSelectedProviders:"Selected",migrateDiscovering:"Discovering migration sources...",migrateRefresh:"Refresh Discovery",migrateRun:"Run Migration",migrateRunning:"Migrating...",migrateSourceSummary:"Source Summary",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"All Detected",migrateScope:"Scope",migrateScopeProject:"Project",migrateScopeGlobal:"Global",migrateTypes:"Portable Types",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Search providers...",migrateSelectVisible:"Select Visible",migrateClearSelection:"Clear Selection",migrateProvidersHeading:"Target Providers",migrateProvidersCountSuffix:"providers",migrateNoProvidersMatch:"No providers match current filters.",migrateSelectButton:"Select",migrateSelectedButton:"Selected",migrateSelectProviderAction:"Select Provider",migrateUnselectProvider:"Unselect Provider",migrateCapabilitiesLabel:"types",migrateCapabilitiesSection:"Capability Matrix",migrateSupported:"Supported",migrateUnsupportedShort:"Unsupported",migrateIncludedEnabled:"Enabled",migrateIncludedDisabled:"Disabled",migrateLatestTarget:"Latest Target",migrateNoResultForProvider:"No migration result for this provider yet.",migrateActionSummaryTitle:"Ready to Migrate",migrateGlobalOnlyCommandsShort:"Commands global-only",migrateNoProviders:"No providers available.",migrateUnsupported:"Will be skipped (unsupported)",migrateGlobalForced:"Codex commands are global-only. Scope will be forced to global.",migrateResults:"Migration Results",migrateInstalled:"Installed",migrateSkipped:"Skipped",migrateFailed:"Failed",migrateProvider:"Provider",migrateStatus:"Status",migratePath:"Path",migrateError:"Error",migrateStatusInstalled:"Installed",migrateStatusSkipped:"Skipped",migrateStatusFailed:"Failed",migrateNoResults:"No migration results yet.",migrateDetectFailed:"Failed to discover migration data",migrateExecuteFailed:"Migration execution failed",migrateSelectProvider:"Select at least one provider",migrateNoTypesEnabled:"Enable at least one portable type",migrateDetectedTag:"Detected",migrateNotDetectedTag:"Not detected",migrateFilterRecommended:"Recommended",migrateActionInstall:"Install",migrateActionUpdate:"Update",migrateActionSkip:"Skip",migrateActionConflict:"Conflict",migrateActionDelete:"Delete",migrateUnchanged:"unchanged",migrateConflictSectionTitle:"Conflicts",migrateConflictUseCK:"Use CK",migrateConflictKeepMine:"Keep Mine",migrateConflictSmartMerge:"Smart Merge",migrateConflictShowDiff:"Show Diff",migrateConflictHideDiff:"Hide Diff",migrateConflictResolved:"Resolved",migrateConflictManual:"Manual",migrateConflictOverwriteAll:"Overwrite All",migrateConflictKeepAll:"Keep All",migrateSummaryTitle:"Migration Complete",migrateSummaryNewMigration:"New Migration",migrateType:"Type",migrateItem:"Item",migrateReconciling:"Analyzing changes...",migrateReviewPlan:"Review Plan",migrateExecutePlan:"Execute Migration",migrateExecuting:"Executing migration...",migrateResolveConflicts:"Resolve all conflicts before executing",migrateSummarySubtitle:"items migrated",migrateSummarySearchPlaceholder:"Search items...",migrateSummaryFilterAll:"All",migrateSummaryCollapseAll:"Collapse all",migrateSummaryExpandAll:"Expand all",migrateSummaryNoResults:"No items match your search",migrateSummaryProviders:"Providers",migrateTypeUnknown:"Other",kanbanTitle:"Plan Kanban",kanbanNoFile:"No plan file specified. Use ?file= parameter.",kanbanNoPhases:"No phases detected in this plan",kanbanError400:"Invalid request — missing file parameter",kanbanError403:"Access denied — file is outside the project directory",kanbanError404:"Plan file not found",kanbanComplete:"complete",kanbanStatus_pending:"Pending","kanbanStatus_in-progress":"In Progress",kanbanStatus_completed:"Completed",kanbanPhases:"phases",kanbanProgress:"Progress",kanbanLoadError:"Failed to load plan data",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier",statuslineBuilder:"Status Line Builder",statuslineBuilderDescription:"Visually design your Claude Code status-line using drag-and-drop",statuslineSections:"Sections",statuslinePreview:"Preview",statuslineTheme:"Color Theme",statuslineSettings:"General Settings",statuslineResetDefaults:"Reset to Defaults",statuslineSave:"Save",statuslineBaseMode:"Base Mode",statuslineBreakpoint:"Responsive Breakpoint",statuslineMaxAgents:"Max Agent Rows",statuslineTodoTruncation:"Todo Truncation",statuslineEnable:"Enable",statuslineDisable:"Disable",statuslineDragHint:"Drag to reorder, toggle to enable/disable sections",statuslinePresetDefault:"Default",statuslinePresetMonochrome:"Monochrome",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Stealth",statuslinePresetHacker:"Hacker",statuslineSaved:"Saved successfully",statuslineSaveError:"Save failed",statusline:"Status Line",statuslineCollapseSettings:"Collapse settings",statuslineExpandSettings:"Expand settings",statuslineIconOverride:"Icon override",statuslineLabelOverride:"Label override",statuslineMaxWidth:"Max width (chars)",statuslineIconPlaceholder:"e.g. 🤖",statuslineMaxWidthPlaceholder:"auto",statuslineCustomColors:"Custom colors",statuslineColorContextGroup:"Context Window",statuslineColorQuotaGroup:"Usage Quota",statuslineColorGeneralGroup:"General",statuslineColorSectionGroup:"Section Colors",statuslineColorContextLow:"Low (<50%)",statuslineColorContextMid:"Mid (50-75%)",statuslineColorContextHigh:"High (>75%)",statuslineColorAccent:"Accent",statuslineColorMuted:"Muted",statuslineColorSeparator:"Separator",statuslineModeFullDesc:"All sections visible",statuslineModeCompactDesc:"Condensed display",statuslineModeMinimalDesc:"Essential info only",statuslineModeNoneDesc:"Disabled",statuslinePreviewTitle:"Claude Code — statusline preview",statuslinePreviewEmptyLine:"(empty line)",statuslinePreviewNoLines:"(no lines configured)",statuslineSectionModelLabel:"Model",statuslineSectionContextLabel:"Context Window",statuslineSectionQuotaLabel:"Usage Quota",statuslineSectionDirectoryLabel:"Directory",statuslineSectionGitLabel:"Git Status",statuslineSectionCostLabel:"Cost",statuslineSectionChangesLabel:"Changes",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Tasks",statuslineSectionModelDesc:"AI model name and provider",statuslineSectionContextDesc:"Context window usage bar",statuslineSectionQuotaDesc:"5-hour and weekly usage quota",statuslineSectionDirectoryDesc:"Current working directory",statuslineSectionGitDesc:"Git branch, staged/unstaged changes",statuslineSectionCostDesc:"Session cost estimate",statuslineSectionChangesDesc:"Lines added and removed",statuslineSectionAgentsDesc:"Recent agent activity",statuslineSectionTodosDesc:"Current task progress",statuslineSectionsVisible:"sections visible",statuslineLoadErrorSaveDisabled:"Could not load saved layout. Saving is disabled to prevent data loss.",statuslineAddLine:"Add Line",statuslineRemoveLine:"Remove",statuslineHiddenSections:"Hidden Sections",statuslineDragToLine:"Drag sections to a line to show them",statuslineQuotaLow:"Quota Low",statuslineQuotaHigh:"Quota High",statuslineLine:"Line"},vi:{loading:"Đang tải...",error:"Lỗi",selectProject:"Chọn dự án để xem bảng điều khiển",controlCenter:"Trung tâm điều khiển",settings:"Cài đặt",sync:"Đồng bộ",offline:"Ngoại tuyến",switchToLight:"Chuyển sang chế độ sáng",switchToDark:"Chuyển sang chế độ tối",settingsSection:"Cài đặt",configEditor:"Trình chỉnh sửa cấu hình",projects:"Dự án",addProject:"Thêm dự án",global:"Toàn cục",skills:"Kỹ năng",health:"Sức khỏe",collapse:"Thu gọn",expand:"Mở rộng",installing:"Đang cài đặt...",manage:"Quản lý",uninstall:"Gỡ cài đặt",installGlobally:"Cài đặt toàn cục",installGloballyDesc:"Khả dụng cho tất cả dự án thay vì chỉ dự án hiện tại",selectAtLeastOneAgent:"Vui lòng chọn ít nhất một agent",installationFailed:"Cài đặt thất bại",allSkills:"Tất cả kỹ năng",refresh:"Làm mới",browseAndManageSkills:"Duyệt và quản lý kỹ năng cho agents của bạn",detected:"Đã phát hiện",notDetected:"Chưa phát hiện",sessions:"phiên",noSessions:"Không có phiên",terminal:"Terminal",terminalSub:"Mở bash tại đường dẫn",editor:"Trình soạn thảo",editorSub:"Mở trong VS Code",useGlobalFallback:"Dùng fallback global",openAtPath:"Mở tại đường dẫn dự án",openAppOnly:"Chỉ mở ứng dụng",actionOptionsLoadFailed:"Không thể tải tùy chọn editor/terminal",launch:"Khởi chạy",launchSub:"Bắt đầu Claude Code",config:"Cấu hình",configSub:"Quản lý cài đặt dự án",recentSessions:"Phiên gần đây",viewAllHistory:"Xem tất cả lịch sử",showLess:"Thu gọn",actionFailed:"Thao tác thất bại",loadingSessions:"Đang tải phiên...",noSessionsFound:"Không tìm thấy phiên nào",configuration:"Cài đặt Claude",activeKit:"Kit hoạt động",aiModel:"Mô hình",hooks:"Hooks",active:"hoạt động",mcpServers:"Máy chủ MCP",connected:"kết nối",editProjectConfig:"Chỉnh sửa cấu hình dự án",globalSettings:"(Toàn cục)",globalSkills:"Kỹ năng toàn cục",loadingSkills:"Đang tải kỹ năng...",noDescription:"Không có mô tả",browseSkillsMarketplace:"Duyệt Skills Marketplace",backToDashboard:"Quay lại bảng điều khiển",educationalConfigEditor:"Trình chỉnh sửa cấu hình hướng dẫn",discard:"Hủy bỏ",saveChanges:"Lưu thay đổi",mergedView:"Chế độ gộp",localConfig:"Cục bộ (.ck.json)",globalConfig:"Toàn cục",syntaxValid:"Cú pháp hợp lệ",configurationHelp:"Hướng dẫn cấu hình",field:"Trường",type:"Kiểu",default:"Mặc định",description:"Mô tả",validValues:"Giá trị hợp lệ",systemEffect:"Hiệu ứng hệ thống",exampleUsage:"Ví dụ sử dụng",knowledgeBase:"Cơ sở kiến thức",clickToSeeHelp:"Nhấp vào bất kỳ trường cấu hình nào để xem tài liệu chi tiết và ví dụ sử dụng.",extractedFrom:"Trích xuất từ ClaudeKit v2.x Specification",resetToDefault:"Đặt lại",saving:"Đang lưu...",saved:"Đã lưu",confirmReset:"Đặt lại về mặc định?",confirmResetMessage:"Tất cả thay đổi sẽ bị mất và được thay thế bằng giá trị mặc định.",confirm:"Xác nhận",saveFailed:"Lưu thất bại",configTab:"Cấu hình",systemTab:"Hệ thống",formTab:"Biểu mẫu",jsonTab:"JSON",readOnly:"Chỉ đọc",installedKit:"Kit đã cài",kitVersion:"Phiên bản Kit",installedOn:"Cài đặt vào",noKitInstalled:"Chưa cài kit",components:"Thành phần",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"Quyền sở hữu tệp",ownershipCk:"do kit quản lý",ownershipUser:"do người dùng",ownershipModified:"đã chỉnh sửa",componentInventory:"Thành phần đã cài",installedHooks:"Hooks đã cài",installedMcpServers:"MCP Servers",lastChecked:"Kiểm tra cập nhật",staleIndicator:"Cũ",skippedVersion:"Đã bỏ qua",filesModifiedFromDefaults:"tệp đã sửa so với mặc định",cliCard:"ClaudeKit CLI",checkForUpdates:"Kiểm tra cập nhật",checking:"Đang kiểm tra...",upToDate:"Đã cập nhật",updateAvailable:"Có bản cập nhật",updateNow:"Cập nhật ngay",updating:"Đang cập nhật...",updateSuccess:"Cập nhật hoàn tất!",updateFailed:"Cập nhật thất bại",closeModal:"Đóng",showDetails:"Xem chi tiết",hideDetails:"Ẩn chi tiết",environment:"Môi trường",claudeConfigPath:"Cấu hình Claude",nodeVersion:"Node",bunVersion:"Bun",osVersion:"Hệ điều hành",channelStable:"Ổn định",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Mới nhất",selectVersion:"Chọn phiên bản",loadingVersions:"Đang tải...",prereleaseLabel:"Thử nghiệm",currentVersionLabel:"Hiện tại",checkAll:"Kiểm tra tất cả",checkingAll:"Đang kiểm tra...",updateAll:"Cập nhật tất cả",updatesAvailable:"{count} bản cập nhật",allUpToDate:"Tất cả đã cập nhật",systemControlTower:"Trung tâm hệ thống",systemOverviewTitle:"Tổng quan cập nhật & môi trường",systemOverviewDesc:"Theo dõi CLI và kit, rồi nâng cấp từ một nơi.",installedComponentsHeading:"Thành phần đã cài",updateReadiness:"Mức sẵn sàng cập nhật",checkedComponents:"Đã kiểm tra",activeChannel:"Kênh",readyToScan:"Sẵn sàng kiểm tra",noTrackedFiles:"Không phát hiện tệp theo dõi",kitsLabel:"Kit",componentFilterAll:"Tất cả",componentFilterUpdates:"Bản cập nhật",componentFilterUpdatesCount:"Bản cập nhật ({count})",componentFilterUpToDate:"Đã cập nhật",componentFilterUpToDateCount:"Đã cập nhật ({count})",componentFilterCli:"CLI",componentFilterKits:"Kit",noComponentsMatchFilter:"Không có thành phần phù hợp bộ lọc hiện tại.",runCheckAllForFilter:"Hãy chạy Kiểm tra tất cả để nạp dữ liệu cho bộ lọc này.",noUpdatesFound:"Không có bản cập nhật. Các thành phần đã kiểm tra đều mới nhất.",noUpToDateYet:"Chưa có thành phần nào ở trạng thái đã cập nhật.",configWorkspaceHint:"Chỉnh sửa cấu hình hoặc quản lý cập nhật hệ thống trong một màn hình.",settingsJsonHeading:"JSON Cài đặt Claude",settingsJsonMissing:"Không tìm thấy tệp ~/.claude/settings.json.",settingsJsonLoadFailed:"Không thể tải ~/.claude/settings.json.",settingsBackupSaved:"Đã lưu bản sao lưu",hookDiagnosticsTitle:"Chẩn đoán Hook",hookDiagnosticsDesc:"Xem hoạt động hook gần đây và lỗi mà không cần mở tệp JSONL thủ công.",hookDiagnosticsPathPending:"Đang xác định đường dẫn log...",hookDiagnosticsScopeGlobal:"Hook toàn cục",hookDiagnosticsEntries:"Bản ghi",hookDiagnosticsCrashes:"Sự cố",hookDiagnosticsWarnings:"Cảnh báo",hookDiagnosticsBlocks:"Chặn",hookDiagnosticsLastEvent:"Sự kiện cuối",hookDiagnosticsLoading:"Đang tải chẩn đoán hook...",hookDiagnosticsLoadFailed:"Không thể tải chẩn đoán hook",hookDiagnosticsMissing:"Chưa tìm thấy tệp log hook cho phạm vi này.",hookDiagnosticsEmpty:"Tệp log hook có tồn tại nhưng không có bản ghi đọc được.",hookDiagnosticsParseErrorsNotice:"Đã bỏ qua {count} dòng log bị lỗi khi tải chẩn đoán.",hookDiagnosticsTruncatedNotice:"Đang hiển thị cửa sổ bản ghi gần đây để giữ giao diện phản hồi tốt với log lớn.",hookDiagnosticsToolLabel:"công cụ",hookDiagnosticsTargetLabel:"mục tiêu",hookDiagnosticsUnknown:"Không rõ",addProjectTitle:"Thêm dự án",addProjectDescription:"Thêm dự án ClaudeKit mới vào trung tâm điều khiển",projectPath:"Đường dẫn dự án",pathPlaceholder:"/đường/dẫn/dự/án",alias:"Bí danh",aliasOptional:"(tùy chọn)",aliasPlaceholder:"dự-án-của-tôi",aliasDescription:"Tên hiển thị tùy chỉnh cho dự án",pathRequired:"Đường dẫn bắt buộc",failedToAdd:"Không thể thêm dự án",cancel:"Hủy",adding:"Đang thêm...",somethingWentWrong:"Đã xảy ra lỗi",reloadApp:"Tải lại ứng dụng",serverNotRunning:"Máy chủ không chạy",startServerMessage:"Config UI yêu cầu máy chủ backend đang chạy.",runThisCommand:"Chạy lệnh này",tryAgain:"Thử lại",projectConfig:"Cấu hình dự án",inheritedFromGlobal:"Kế thừa từ toàn cục",localOverride:"Ghi đè cục bộ",viewGlobalConfig:"Trường này kế thừa từ cấu hình toàn cục. Xem",onboardingTitle:"Chào mừng đến ClaudeKit",onboardingSubtitle:"Chọn kit của bạn và bắt đầu trong vài phút",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"Lập trình AI với skills, hooks và multi-agent",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Tự động hóa nội dung: chiến dịch, mạng xã hội, phân tích",featureAgents:"AI Agents",featureAgentsDesc:"Các agent chuyên biệt cho từng tác vụ",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Tùy chỉnh hành vi của Claude tại các thời điểm quan trọng",featureSkills:"Thư viện Skills",featureSkillsDesc:"Các khả năng có sẵn bạn có thể kích hoạt",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Phối hợp nhiều agent cho các tác vụ phức tạp",featureContent:"Tạo nội dung",featureContentDesc:"Tự động tạo và tối ưu nội dung",featureSocial:"Công cụ mạng xã hội",featureSocialDesc:"Lên lịch, phân tích và tự động tương tác",stepChooseKit:"Chọn Kit",stepConfigure:"Cấu hình",stepInstall:"Cài đặt",back:"Quay lại",next:"Tiếp theo",install:"Cài đặt",installSuccess:"Cài đặt hoàn tất!",installSuccessDesc:"{kit} đã sẵn sàng sử dụng",getStarted:"Bắt đầu",goToDashboard:"Đi đến Dashboard",kitConfig:"Cấu hình Kit",kitConfigSubtitle:"Cấu hình ClaudeKit Engineer",scopeGlobal:"Toàn cục",scopeProject:"Dự án",sectionGeneral:"Cài đặt chung",sectionPaths:"Đường dẫn",sectionPrivacy:"Bảo mật & Tin cậy",sectionProject:"Phát hiện dự án",sectionIntegrations:"Tích hợp",sectionHooks:"Hooks",sectionAdvanced:"Nâng cao",fieldCodingLevel:"Cấp độ lập trình",fieldCodingLevelDesc:"Cấp độ kinh nghiệm (-1=tự động, 0=mới bắt đầu, 1=trung cấp, 2=nâng cao, 3=chuyên gia, 4=tech-lead, 5=thần)",fieldStatusline:"Chế độ thanh trạng thái",fieldStatuslineDesc:"Lượng thông tin hiển thị trên thanh trạng thái",fieldStatuslineColors:"Màu thanh trạng thái",fieldStatuslineColorsDesc:"Bật màu ANSI trong thanh trạng thái",fieldStatuslineQuota:"Hiển thị Quota Statusline",fieldStatuslineQuotaDesc:"Hiển thị các nhãn quota 5h / wk trong statusline",fieldThinkingLanguage:"Ngôn ngữ suy nghĩ",fieldThinkingLanguageDesc:"Ngôn ngữ cho suy luận nội bộ của Claude (null=Tiếng Anh)",fieldResponseLanguage:"Ngôn ngữ phản hồi",fieldResponseLanguageDesc:"Ngôn ngữ cho phản hồi của Claude (null=theo người dùng)",fieldDocsPath:"Thư mục tài liệu",fieldDocsPathDesc:"Đường dẫn đến thư mục tài liệu",fieldPlansPath:"Thư mục kế hoạch",fieldPlansPathDesc:"Đường dẫn đến thư mục kế hoạch",fieldPrivacyBlock:"Chặn quyền riêng tư",fieldPrivacyBlockDesc:"Chặn truy cập file nhạy cảm (.env, credentials)",fieldTrustEnabled:"Chế độ tin cậy",fieldTrustEnabledDesc:"Tự động phê duyệt các tool calls",fieldTrustPassphrase:"Mật khẩu tin cậy",fieldTrustPassphraseDesc:"Mật khẩu để bật chế độ tin cậy",fieldProjectType:"Loại dự án",fieldProjectTypeDesc:"Ghi đè loại dự án tự động phát hiện",fieldPackageManager:"Trình quản lý gói",fieldPackageManagerDesc:"Ghi đè trình quản lý gói tự động phát hiện",fieldFramework:"Framework",fieldFrameworkDesc:"Ghi đè framework tự động phát hiện",fieldGeminiModel:"Mô hình Gemini",fieldGeminiModelDesc:"Mô hình Gemini cho các lệnh CLI; id gemini-3.0-* cũ sẽ tự động ánh xạ",geminiModel25Flash:"Gemini 2.5 Flash — Mọi tài khoản",geminiModel25Pro:"Gemini 2.5 Pro — Có thể bị giới hạn dung lượng",geminiModel3FlashPreview:"Gemini 3 Flash Preview — Chỉ Pro/Ultra",geminiModel3ProPreview:"Gemini 3 Pro Preview — Chỉ Pro/Ultra",fieldResearchUseGemini:"Dùng Gemini cho nghiên cứu",fieldResearchUseGeminiDesc:"Dùng Gemini CLI thay vì WebSearch",fieldDocsMaxLoc:"Số dòng tối đa/tài liệu",fieldDocsMaxLocDesc:"Số dòng code tối đa cho mỗi file tài liệu",fieldPlanNamingFormat:"Định dạng tên kế hoạch",fieldPlanNamingFormatDesc:"Định dạng cho tên thư mục kế hoạch",fieldPlanDateFormat:"Định dạng ngày kế hoạch",fieldPlanDateFormatDesc:"Định dạng ngày cho tên kế hoạch (moment.js)",fieldPlanValidationMode:"Chế độ xác thực",fieldPlanValidationModeDesc:"Cách xác thực kế hoạch trước khi triển khai",fieldPlanMinQuestions:"Số câu hỏi tối thiểu",fieldPlanMinQuestionsDesc:"Số câu hỏi xác thực tối thiểu",fieldPlanMaxQuestions:"Số câu hỏi tối đa",fieldPlanMaxQuestionsDesc:"Số câu hỏi xác thực tối đa",fieldAssertions:"Assertions",fieldAssertionsDesc:"Các assertions và quy tắc cần thực thi",fieldHookSessionInit:"Khởi tạo phiên",fieldHookSessionInitDesc:"Phát hiện dự án và thiết lập môi trường",fieldHookSubagentInit:"Khởi tạo subagent",fieldHookSubagentInitDesc:"Inject context vào subagents",fieldHookDescriptiveName:"Tên mô tả",fieldHookDescriptiveNameDesc:"Bắt buộc đặt tên file dạng kebab-case mô tả cho scripts",fieldHookDevRulesReminder:"Nhắc nhở quy tắc dev",fieldHookDevRulesReminderDesc:"Inject context quy tắc phát triển",fieldHookUsageContextAwareness:"Nhận thức sử dụng cho prompt",fieldHookUsageContextAwarenessDesc:"Inject nhận thức giới hạn sử dụng vào prompt",fieldHookContextTracking:"Theo dõi ngữ cảnh",fieldHookContextTrackingDesc:"Theo dõi cửa sổ ngữ cảnh (% đã dùng, số token)",fieldHookScoutBlock:"Chặn Scout",fieldHookScoutBlockDesc:"Chặn thư mục nặng khỏi việc khám phá",fieldHookPrivacyBlock:"Hook chặn quyền riêng tư",fieldHookPrivacyBlockDesc:"Chặn đọc file nhạy cảm",fieldHookPostEditSimplify:"Đơn giản sau chỉnh sửa",fieldHookPostEditSimplifyDesc:"Nhắc đơn giản sau khi chỉnh sửa",sectionUpdatePipeline:"Pipeline Cập nhật",fieldAutoInitAfterUpdate:"Tự động Init sau Update",fieldAutoInitAfterUpdateDesc:"Tự động chạy ck init sau ck update khi kit có phiên bản mới",fieldAutoMigrateAfterUpdate:"Tự động Migrate sau Update",fieldAutoMigrateAfterUpdateDesc:"Tự động chạy ck migrate sau ck update (độc lập với init)",fieldMigrateProviders:"Provider Migrate",fieldMigrateProvidersDesc:"Provider nào tự động migrate. Dùng 'auto' để quét hệ thống hoặc danh sách phân cách bằng dấu phẩy.",skillsPageTitle:"Quản lý Kỹ năng",skillsPageDesc:"Cài đặt kỹ năng ClaudeKit cho các agent lập trình",availableSkills:"Kỹ năng có sẵn",installedSkills:"Kỹ năng đã cài",noSkillsFound:"Không tìm thấy kỹ năng",installSkill:"Cài đặt",uninstallSkill:"Gỡ cài đặt",manageSkill:"Quản lý",syncRegistry:"Đồng bộ",installSkillTitle:"Cài đặt Kỹ năng",selectAgents:"Chọn agent đích",installLocation:"Vị trí cài đặt",globalInstall:"Toàn cục",projectInstall:"Dự án",confirmInstall:"Cài đặt cho các agent đã chọn",installingSkill:"Đang cài đặt...",skillInstallSuccess:"Cài đặt kỹ năng thành công",skillInstallFailed:"Cài đặt thất bại",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Đã cài",notInstalled:"Chưa cài",allAgents:"Tất cả Agent",filterByAgent:"Lọc theo agent",skillsTitle:"Kỹ năng",skillsSubtitle:"Duyệt, cài đặt và quản lý kỹ năng cho coding agents",availableCount:"Có sẵn",installedCount:"Đã cài",agentsCount:"Agents",searchSkills:"Tìm kiếm kỹ năng...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Danh mục",sortInstalledFirst:"Đã cài trước",listView:"Dạng danh sách",gridView:"Dạng lưới",categoryAll:"Tất cả",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Bảo mật",categoryDevOps:"DevOps",categoryDatabase:"Cơ sở dữ liệu",categoryDevelopment:"Phát triển",categoryResearch:"Nghiên cứu",categoryGeneral:"Tổng quát",categoryCore:"Cốt lõi",categoryDocumentation:"Tài liệu",categoryTooling:"Công cụ",categoryMedia:"Phương tiện",categoryFrameworks:"Framework",skillsCountLabel:"{count} kỹ năng",installToAll:"Cài cho tất cả đã phát hiện",scopeLabel:"Phạm vi cài đặt",agentInstalled:"Đã cài",agentNotInstalled:"Chưa cài",skillSource:"Vị trí nguồn",skillSourceBadge:"Nguồn",detailPanelClose:"Đóng",versionLabel:"v{version}",installAllToAllAgents:"Cài tất cả cho tất cả Agent",bulkInstallFailed:"Cài hàng loạt thất bại",noAgentsDetected:"Không phát hiện agent nào",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Đã tùy chỉnh",installedVersionLabel:"Phiên bản cài đặt",installedAtLabel:"Cài đặt lúc",sourceTimestampLabel:"Ngày nguồn",kitLabel:"Kit",skillMetadata:"Thông tin Skill",migrate:"Di trú",migrateTitle:"Di trú",migrateSubtitle:"Chuyển toàn bộ stack Claude Code sang provider khác",migrateDetectedProviders:"Đã phát hiện",migrateSelectedProviders:"Đã chọn",migrateDiscovering:"Đang quét nguồn di trú...",migrateRefresh:"Làm mới quét",migrateRun:"Chạy di trú",migrateRunning:"Đang di trú...",migrateSourceSummary:"Tổng quan nguồn",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"Tất cả đã phát hiện",migrateScope:"Phạm vi",migrateScopeProject:"Dự án",migrateScopeGlobal:"Toàn cục",migrateTypes:"Loại di trú",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Tìm provider...",migrateSelectVisible:"Chọn phần đang hiện",migrateClearSelection:"Bỏ chọn tất cả",migrateProvidersHeading:"Provider đích",migrateProvidersCountSuffix:"provider",migrateNoProvidersMatch:"Không có provider khớp bộ lọc hiện tại.",migrateSelectButton:"Chọn",migrateSelectedButton:"Đã chọn",migrateSelectProviderAction:"Chọn provider",migrateUnselectProvider:"Bỏ chọn provider",migrateCapabilitiesLabel:"loại",migrateCapabilitiesSection:"Ma trận khả năng",migrateSupported:"Hỗ trợ",migrateUnsupportedShort:"Không hỗ trợ",migrateIncludedEnabled:"Đang bật",migrateIncludedDisabled:"Đang tắt",migrateLatestTarget:"Đích gần nhất",migrateNoResultForProvider:"Chưa có kết quả di trú cho provider này.",migrateActionSummaryTitle:"Sẵn sàng di trú",migrateGlobalOnlyCommandsShort:"Commands chỉ global",migrateNoProviders:"Không có provider khả dụng.",migrateUnsupported:"Sẽ bỏ qua (không hỗ trợ)",migrateGlobalForced:"Lệnh Codex chỉ hỗ trợ global. Phạm vi sẽ tự chuyển global.",migrateResults:"Kết quả di trú",migrateInstalled:"Đã cài",migrateSkipped:"Đã bỏ qua",migrateFailed:"Lỗi",migrateProvider:"Provider",migrateStatus:"Trạng thái",migratePath:"Đường dẫn",migrateError:"Lỗi",migrateStatusInstalled:"Đã cài",migrateStatusSkipped:"Đã bỏ qua",migrateStatusFailed:"Lỗi",migrateNoResults:"Chưa có kết quả di trú.",migrateDetectFailed:"Không thể quét dữ liệu di trú",migrateExecuteFailed:"Chạy di trú thất bại",migrateSelectProvider:"Vui lòng chọn ít nhất một provider",migrateNoTypesEnabled:"Bật ít nhất một loại di trú",migrateDetectedTag:"Đã phát hiện",migrateNotDetectedTag:"Chưa phát hiện",migrateFilterRecommended:"Đề xuất",migrateActionInstall:"Cài",migrateActionUpdate:"Cập nhật",migrateActionSkip:"Bỏ qua",migrateActionConflict:"Xung đột",migrateActionDelete:"Xóa",migrateUnchanged:"chưa thay đổi",migrateConflictSectionTitle:"Xung đột",migrateConflictUseCK:"Dùng CK",migrateConflictKeepMine:"Giữ của tôi",migrateConflictSmartMerge:"Merge thông minh",migrateConflictShowDiff:"Hiện diff",migrateConflictHideDiff:"Ẩn diff",migrateConflictResolved:"Đã giải quyết",migrateConflictManual:"Thủ công",migrateConflictOverwriteAll:"Ghi đè tất cả",migrateConflictKeepAll:"Giữ tất cả",migrateSummaryTitle:"Di trú hoàn tất",migrateSummaryNewMigration:"Di trú mới",migrateType:"Loại",migrateItem:"Mục",migrateReconciling:"Đang phân tích thay đổi...",migrateReviewPlan:"Xem kế hoạch",migrateExecutePlan:"Thực hiện di trú",migrateExecuting:"Đang thực hiện di trú...",migrateResolveConflicts:"Giải quyết xung đột trước khi thực hiện",migrateSummarySubtitle:"mục đã di trú",migrateSummarySearchPlaceholder:"Tìm kiếm...",migrateSummaryFilterAll:"Tất cả",migrateSummaryCollapseAll:"Thu gọn",migrateSummaryExpandAll:"Mở rộng",migrateSummaryNoResults:"Không tìm thấy mục nào",migrateSummaryProviders:"Provider",migrateTypeUnknown:"Khác",kanbanTitle:"Bảng Kanban Kế hoạch",kanbanNoFile:"Chưa chọn file kế hoạch. Dùng tham số ?file=.",kanbanNoPhases:"Không phát hiện giai đoạn nào trong kế hoạch này",kanbanError400:"Yêu cầu không hợp lệ — thiếu tham số file",kanbanError403:"Truy cập bị từ chối — file nằm ngoài thư mục dự án",kanbanError404:"Không tìm thấy file kế hoạch",kanbanComplete:"hoàn thành",kanbanStatus_pending:"Chờ xử lý","kanbanStatus_in-progress":"Đang thực hiện",kanbanStatus_completed:"Hoàn thành",kanbanPhases:"giai đoạn",kanbanProgress:"Tiến độ",kanbanLoadError:"Không thể tải dữ liệu kế hoạch",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ",statuslineBuilder:"Trình tạo dòng trạng thái",statuslineBuilderDescription:"Thiết kế bố cục dòng trạng thái bằng kéo và thả",statuslineSections:"Các mục",statuslinePreview:"Xem trước",statuslineTheme:"Giao diện màu sắc",statuslineSettings:"Cài đặt chung",statuslineResetDefaults:"Đặt lại mặc định",statuslineSave:"Lưu",statuslineBaseMode:"Chế độ cơ bản",statuslineBreakpoint:"Điểm ngắt responsive",statuslineMaxAgents:"Số agent tối đa",statuslineTodoTruncation:"Cắt ngắn task",statuslineEnable:"Bật",statuslineDisable:"Tắt",statuslineDragHint:"Kéo để thay đổi thứ tự, bật/tắt từng mục",statuslinePresetDefault:"Mặc định",statuslinePresetMonochrome:"Đơn sắc",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Ẩn mình",statuslinePresetHacker:"Hacker",statuslineSaved:"Đã lưu thành công",statuslineSaveError:"Lưu thất bại",statusline:"Dòng trạng thái",statuslineCollapseSettings:"Thu gọn cài đặt",statuslineExpandSettings:"Mở rộng cài đặt",statuslineIconOverride:"Ghi đè biểu tượng",statuslineLabelOverride:"Ghi đè nhãn",statuslineMaxWidth:"Chiều rộng tối đa (ký tự)",statuslineIconPlaceholder:"vd. 🤖",statuslineMaxWidthPlaceholder:"tự động",statuslineCustomColors:"Màu tùy chỉnh",statuslineColorContextGroup:"Cửa sổ ngữ cảnh",statuslineColorQuotaGroup:"Hạn mức sử dụng",statuslineColorGeneralGroup:"Chung",statuslineColorSectionGroup:"Màu từng mục",statuslineColorContextLow:"Thấp (<50%)",statuslineColorContextMid:"Trung (50-75%)",statuslineColorContextHigh:"Cao (>75%)",statuslineColorAccent:"Nhấn mạnh",statuslineColorMuted:"Giảm nhạt",statuslineColorSeparator:"Dấu phân cách",statuslineModeFullDesc:"Hiển thị tất cả các mục",statuslineModeCompactDesc:"Hiển thị thu gọn",statuslineModeMinimalDesc:"Chỉ thông tin cần thiết",statuslineModeNoneDesc:"Đã tắt",statuslinePreviewTitle:"Claude Code — xem trước dòng trạng thái",statuslinePreviewEmptyLine:"(dòng trống)",statuslinePreviewNoLines:"(chưa cấu hình dòng nào)",statuslineSectionModelLabel:"Mô hình",statuslineSectionContextLabel:"Cửa sổ ngữ cảnh",statuslineSectionQuotaLabel:"Hạn mức sử dụng",statuslineSectionDirectoryLabel:"Thư mục",statuslineSectionGitLabel:"Trạng thái Git",statuslineSectionCostLabel:"Chi phí",statuslineSectionChangesLabel:"Thay đổi",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Nhiệm vụ",statuslineSectionModelDesc:"Tên mô hình AI và nhà cung cấp",statuslineSectionContextDesc:"Thanh sử dụng cửa sổ ngữ cảnh",statuslineSectionQuotaDesc:"Hạn mức sử dụng 5 giờ và hàng tuần",statuslineSectionDirectoryDesc:"Thư mục làm việc hiện tại",statuslineSectionGitDesc:"Nhánh Git, thay đổi đã/chưa staged",statuslineSectionCostDesc:"Ước tính chi phí phiên",statuslineSectionChangesDesc:"Dòng thêm và xóa",statuslineSectionAgentsDesc:"Hoạt động agent gần đây",statuslineSectionTodosDesc:"Tiến độ tác vụ hiện tại",statuslineSectionsVisible:"mục hiển thị",statuslineLoadErrorSaveDisabled:"Không thể tải bố cục đã lưu. Tính năng lưu đã bị tắt để tránh mất dữ liệu.",statuslineAddLine:"Thêm dòng",statuslineRemoveLine:"Xóa",statuslineHiddenSections:"Mục ẩn",statuslineDragToLine:"Kéo mục vào dòng để hiển thị",statuslineQuotaLow:"Hạn mức thấp",statuslineQuotaHigh:"Hạn mức cao",statuslineLine:"Dòng"}},Hh=m.createContext(null),j0="ck-dashboard-lang";function C2(){const t=localStorage.getItem(j0);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function j2({children:t}){const[e,n]=m.useState(C2),r=m.useCallback(o=>{localStorage.setItem(j0,o),n(o)},[]),i=m.useCallback(o=>k2[e][o],[e]),s=m.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return d.jsx(Hh.Provider,{value:s,children:t})}function he(){const t=m.useContext(Hh);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class O2 extends m.Component{constructor(){super(...arguments);Ku(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return d.jsx(Hh.Consumer,{children:r=>d.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:d.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:n?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-orange-500/10 border border-orange-500/30 flex items-center justify-center text-3xl",children:"🔌"}),d.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),d.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[d.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),d.jsx("code",{className:"block text-sm text-dash-accent font-mono bg-dash-bg px-3 py-2 rounded border border-dash-border",children:"ck config"})]}),d.jsx("button",{onClick:()=>window.location.reload(),className:"px-6 py-2 bg-dash-accent text-dash-bg rounded-lg font-bold hover:bg-dash-accent-hover transition-colors",children:r?.t("tryAgain")??"Try Again"})]}):d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),d.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),d.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dash-accent text-white rounded-md hover:opacity-90",children:r?.t("reloadApp")??"Reload App"})]})})})})}return this.props.children}}const rr=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return d.jsx("div",{onMouseDown:n,className:`
21
+ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let f=dn(),p;p=f;let g=p.pathname||"/",b=g;if(h!=="/"){let v=h.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let x=Xn(t,{pathname:b});return $e(u||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),$e(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),ww(x&&x.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Dn([h,s.encodeLocation?s.encodeLocation(v.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?h:Dn([h,s.encodeLocation?s.encodeLocation(v.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),o,n,r,i)}function bw(){let t=Ow(),e=Ss(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:s},"ErrorBoundary")," or"," ",m.createElement("code",{style:s},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),n?m.createElement("pre",{style:i},n):null,o)}var xw=m.createElement(bw,null),x0=class extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=hw(t.digest);n&&(t=n)}let e=t!==void 0?m.createElement(en.Provider,{value:this.props.routeContext},m.createElement(Ih.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?m.createElement(yw,{error:t},e):e}};x0.contextType=h0;var gc=new WeakMap;function yw({children:t,error:e}){let{basename:n}=m.useContext(Ft);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=dw(e.digest);if(r){let i=gc.get(e);if(i)throw i;let s=Zg(r.location,n);if(Xg&&!gc.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw gc.set(e,o),o}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function vw({routeContext:t,match:e,children:n}){let r=m.useContext(zr);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),m.createElement(en.Provider,{value:t},n)}function ww(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=n?.errors;if(o!=null){let h=s.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);ge(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let a=!1,l=-1;if(n)for(let h=0;h<s.length;h++){let u=s[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=h),u.route.id){let{loaderData:f,errors:p}=n,g=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!p||p[u.route.id]===void 0);if(u.route.lazy||g){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=n&&r?(h,u)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Ao(n.matches),errorInfo:u})}:void 0;return s.reduceRight((h,u,f)=>{let p,g=!1,b=null,x=null;n&&(p=o&&u.route.id?o[u.route.id]:void 0,b=u.route.errorElement||xw,a&&(l<0&&f===0?(y0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,x=null):l===f&&(g=!0,x=u.route.hydrateFallbackElement||null)));let w=e.concat(s.slice(0,f+1)),v=()=>{let k;return p?k=b:g?k=x:u.route.Component?k=m.createElement(u.route.Component,null):u.route.element?k=u.route.element:k=h,m.createElement(vw,{match:u,routeContext:{outlet:h,matches:w,isDataRoute:n!=null},children:k})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?m.createElement(x0,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:c}):v()},null)}function $h(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sw(t){let e=m.useContext(zr);return ge(e,$h(t)),e}function kw(t){let e=m.useContext(Mo);return ge(e,$h(t)),e}function Cw(t){let e=m.useContext(en);return ge(e,$h(t)),e}function Bh(t){let e=Cw(t),n=e.matches[e.matches.length-1];return ge(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function jw(){return Bh("useRouteId")}function Ow(){let t=m.useContext(Ih),e=kw("useRouteError"),n=Bh("useRouteError");return t!==void 0?t:e.errors?.[n]}function Pw(){let{router:t}=Sw("useNavigate"),e=Bh("useNavigate"),n=m.useRef(!1);return m0(()=>{n.current=!0}),m.useCallback(async(i,s={})=>{$e(n.current,p0),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var bf={};function y0(t,e,n){!e&&!bf[t]&&(bf[t]=!0,$e(!1,n))}var xf={};function yf(t,e){!t&&!xf[e]&&(xf[e]=!0,console.warn(e))}var Nw="useOptimistic",vf=V1[Nw],Dw=()=>{};function Aw(t){return vf?vf(t):[t,Dw]}function Mw(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&$e(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:m.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&$e(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:m.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&$e(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:m.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var Tw=["HydrateFallback","hydrateFallbackElement"],Ew=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function Rw({router:t,flushSync:e,onError:n,unstable_useTransitions:r}){r=ow()||r;let[s,o]=m.useState(t.state),[a,l]=Aw(s),[c,h]=m.useState(),[u,f]=m.useState({isTransitioning:!1}),[p,g]=m.useState(),[b,x]=m.useState(),[w,v]=m.useState(),k=m.useRef(new Map),j=m.useCallback((N,{deletedFetchers:A,newErrors:T,flushSync:P,viewTransitionOpts:R})=>{T&&n&&Object.values(T).forEach(I=>n(I,{location:N.location,params:N.matches[0]?.params??{},unstable_pattern:Ao(N.matches)})),N.fetchers.forEach((I,F)=>{I.data!==void 0&&k.current.set(F,I.data)}),A.forEach(I=>k.current.delete(I)),yf(P===!1||e!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let z=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(yf(R==null||z,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!R||!z){e&&P?e(()=>o(N)):r===!1?o(N):m.startTransition(()=>{r===!0&&l(I=>wf(I,N)),o(N)});return}if(e&&P){e(()=>{b&&(p?.resolve(),b.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:R.currentLocation,nextLocation:R.nextLocation})});let I=t.window.document.startViewTransition(()=>{e(()=>o(N))});I.finished.finally(()=>{e(()=>{g(void 0),x(void 0),h(void 0),f({isTransitioning:!1})})}),e(()=>x(I));return}b?(p?.resolve(),b.skipTransition(),v({state:N,currentLocation:R.currentLocation,nextLocation:R.nextLocation})):(h(N),f({isTransitioning:!0,flushSync:!1,currentLocation:R.currentLocation,nextLocation:R.nextLocation}))},[t.window,e,b,p,r,l,n]);m.useLayoutEffect(()=>t.subscribe(j),[t,j]),m.useEffect(()=>{u.isTransitioning&&!u.flushSync&&g(new Ew)},[u]),m.useEffect(()=>{if(p&&c&&t.window){let N=c,A=p.promise,T=t.window.document.startViewTransition(async()=>{r===!1?o(N):m.startTransition(()=>{r===!0&&l(P=>wf(P,N)),o(N)}),await A});T.finished.finally(()=>{g(void 0),x(void 0),h(void 0),f({isTransitioning:!1})}),x(T)}},[c,p,t.window,r,l]),m.useEffect(()=>{p&&c&&a.location.key===c.location.key&&p.resolve()},[p,b,a.location,c]),m.useEffect(()=>{!u.isTransitioning&&w&&(h(w.state),f({isTransitioning:!0,flushSync:!1,currentLocation:w.currentLocation,nextLocation:w.nextLocation}),v(void 0))},[u.isTransitioning,w]);let S=m.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:N=>t.navigate(N),push:(N,A,T)=>t.navigate(N,{state:A,preventScrollReset:T?.preventScrollReset}),replace:(N,A,T)=>t.navigate(N,{replace:!0,state:A,preventScrollReset:T?.preventScrollReset})}),[t]),C=t.basename||"/",y=m.useMemo(()=>({router:t,navigator:S,static:!1,basename:C,onError:n}),[t,S,C,n]);return m.createElement(m.Fragment,null,m.createElement(zr.Provider,{value:y},m.createElement(Mo.Provider,{value:a},m.createElement(u0.Provider,{value:k.current},m.createElement(Lh.Provider,{value:u},m.createElement(Bw,{basename:C,location:a.location,navigationType:a.historyAction,navigator:S,unstable_useTransitions:r},m.createElement(Lw,{routes:t.routes,future:t.future,state:a,onError:n})))))),null)}function wf(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var Lw=m.memo(Iw);function Iw({routes:t,future:e,state:n,onError:r}){return gw(t,void 0,n,r,e)}function bc({to:t,replace:e,state:n,relative:r}){ge(ji(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=m.useContext(Ft);$e(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=m.useContext(en),{pathname:o}=dn(),a=Tn(),l=zl(t,Fl(s),o,r==="path"),c=JSON.stringify(l);return m.useEffect(()=>{a(JSON.parse(c),{replace:e,state:n,relative:r})},[a,c,r,e,n]),null}function $w(t){return mw(t.context)}function Bw({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){ge(!ji(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=m.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=mr(n));let{pathname:c="/",search:h="",hash:u="",state:f=null,key:p="default"}=n,g=m.useMemo(()=>{let b=Xt(c,a);return b==null?null:{location:{pathname:b,search:h,hash:u,state:f,key:p},navigationType:r}},[a,c,h,u,f,p,r]);return $e(g!=null,`<Router basename="${a}"> is not able to match the URL "${c}${h}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:m.createElement(Ft.Provider,{value:l},m.createElement(Hl.Provider,{children:e,value:g}))}var Va="get",_a="application/x-www-form-urlencoded";function Vl(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Fw(t){return Vl(t)&&t.tagName.toLowerCase()==="button"}function zw(t){return Vl(t)&&t.tagName.toLowerCase()==="form"}function Hw(t){return Vl(t)&&t.tagName.toLowerCase()==="input"}function Vw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _w(t,e){return t.button===0&&(!e||e==="_self")&&!Vw(t)}function Ad(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Ww(t,e){let n=Ad(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var la=null;function Uw(){if(la===null)try{new FormData(document.createElement("form"),0),la=!1}catch{la=!0}return la}var Kw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xc(t){return t!=null&&!Kw.has(t)?($e(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_a}"`),null):t}function Gw(t,e){let n,r,i,s,o;if(zw(t)){let a=t.getAttribute("action");r=a?Xt(a,e):null,n=t.getAttribute("method")||Va,i=xc(t.getAttribute("enctype"))||_a,s=new FormData(t)}else if(Fw(t)||Hw(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?Xt(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||Va,i=xc(t.getAttribute("formenctype"))||xc(a.getAttribute("enctype"))||_a,s=new FormData(a,t),!Uw()){let{name:c,type:h,value:u}=t;if(h==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,u)}}else{if(Vl(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Va,r=null,i=_a,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Fh(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function qw(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Xt(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function Yw(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Jw(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Qw(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await Yw(s,n);return o.links?o.links():[]}return[]}));return t2(r.flat(1).filter(Jw).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Sf(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{let h=r.routes[l.route.id];if(!h||!h.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function Xw(t,e,{includeHydrateFallback:n}={}){return Zw(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function Zw(t){return[...new Set(t)]}function e2(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function t2(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(e2(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function v0(){let t=m.useContext(zr);return Fh(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function n2(){let t=m.useContext(Mo);return Fh(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var zh=m.createContext(void 0);zh.displayName="FrameworkContext";function w0(){let t=m.useContext(zh);return Fh(t,"You must render this element inside a <HydratedRouter> element"),t}function r2(t,e){let n=m.useContext(zh),[r,i]=m.useState(!1),[s,o]=m.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:h,onTouchStart:u}=e,f=m.useRef(null);m.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let b=w=>{w.forEach(v=>{o(v.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return f.current&&x.observe(f.current),()=>{x.disconnect()}}},[t]),m.useEffect(()=>{if(r){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{i(!0)},g=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,f,{}]:[s,f,{onFocus:Ui(a,p),onBlur:Ui(l,g),onMouseEnter:Ui(c,p),onMouseLeave:Ui(h,g),onTouchStart:Ui(u,p)}]:[!1,f,{}]}function Ui(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function i2({page:t,...e}){let{router:n}=v0(),r=m.useMemo(()=>Xn(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?m.createElement(o2,{page:t,matches:r,...e}):null}function s2(t){let{manifest:e,routeModules:n}=w0(),[r,i]=m.useState([]);return m.useEffect(()=>{let s=!1;return Qw(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function o2({page:t,matches:e,...n}){let r=dn(),{manifest:i,routeModules:s}=w0(),{basename:o}=v0(),{loaderData:a,matches:l}=n2(),c=m.useMemo(()=>Sf(t,e,l,i,r,"data"),[t,e,l,i,r]),h=m.useMemo(()=>Sf(t,e,l,i,r,"assets"),[t,e,l,i,r]),u=m.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,b=!1;if(e.forEach(w=>{let v=i.routes[w.route.id];!v||!v.hasLoader||(!c.some(k=>k.route.id===w.route.id)&&w.route.id in a&&s[w.route.id]?.shouldRevalidate||v.hasClientLoader?b=!0:g.add(w.route.id))}),g.size===0)return[];let x=qw(t,o,"data");return b&&g.size>0&&x.searchParams.set("_routes",e.filter(w=>g.has(w.route.id)).map(w=>w.route.id).join(",")),[x.pathname+x.search]},[o,a,r,i,c,e,t,s]),f=m.useMemo(()=>Xw(h,i),[h,i]),p=s2(h);return m.createElement(m.Fragment,null,u.map(g=>m.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>m.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:b})=>m.createElement("link",{key:g,nonce:n.nonce,...b})))}function a2(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var l2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{l2&&(window.__reactRouterVersion="7.11.0")}catch{}function c2(t,e){return Lv({basename:e?.basename,getContext:e?.getContext,future:e?.future,history:Q1({window:e?.window}),hydrationData:d2(),routes:t,mapRouteProperties:Mw,hydrationRouteProperties:Tw,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window,unstable_instrumentations:e?.unstable_instrumentations}).initialize()}function d2(){let t=window?.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:h2(t.errors)}),t}function h2(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,i]of e)if(i&&i.__type==="RouteErrorResponse")n[r]=new Do(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let o=new s(i.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}var S0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,k0=m.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g){let{basename:b,unstable_useTransitions:x}=m.useContext(Ft),w=typeof c=="string"&&S0.test(c),v=Zg(c,b);c=v.to;let k=uw(c,{relative:i}),[j,S,C]=r2(r,p),y=m2(c,{replace:o,state:a,target:l,preventScrollReset:h,relative:i,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function N(T){e&&e(T),T.defaultPrevented||y(T)}let A=m.createElement("a",{...p,...C,href:v.absoluteURL||k,onClick:v.isExternal||s?e:N,ref:a2(g,S),target:l,"data-discover":!w&&n==="render"?"true":void 0});return j&&!w?m.createElement(m.Fragment,null,A,m.createElement(i2,{page:k})):A});k0.displayName="Link";var u2=m.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},h){let u=To(o,{relative:c.relative}),f=dn(),p=m.useContext(Mo),{navigator:g,basename:b}=m.useContext(Ft),x=p!=null&&w2(u)&&a===!0,w=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,v=f.pathname,k=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(v=v.toLowerCase(),k=k?k.toLowerCase():null,w=w.toLowerCase()),k&&b&&(k=Xt(k,b)||k);const j=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let S=v===w||!i&&v.startsWith(w)&&v.charAt(j)==="/",C=k!=null&&(k===w||!i&&k.startsWith(w)&&k.charAt(w.length)==="/"),y={isActive:S,isPending:C,isTransitioning:x},N=S?e:void 0,A;typeof r=="function"?A=r(y):A=[r,S?"active":null,C?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let T=typeof s=="function"?s(y):s;return m.createElement(k0,{...c,"aria-current":N,className:A,ref:h,style:T,to:o,viewTransition:a},typeof l=="function"?l(y):l)});u2.displayName="NavLink";var f2=m.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=Va,action:a,onSubmit:l,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f,...p},g)=>{let{unstable_useTransitions:b}=m.useContext(Ft),x=y2(),w=v2(a,{relative:c}),v=o.toLowerCase()==="get"?"get":"post",k=typeof a=="string"&&S0.test(a),j=S=>{if(l&&l(S),S.defaultPrevented)return;S.preventDefault();let C=S.nativeEvent.submitter,y=C?.getAttribute("formmethod")||o,N=()=>x(C||S.currentTarget,{fetcherKey:e,method:y,navigate:n,replace:i,state:s,relative:c,preventScrollReset:h,viewTransition:u,unstable_defaultShouldRevalidate:f});b&&n!==!1?m.startTransition(()=>N()):N()};return m.createElement("form",{ref:g,method:v,action:w,onSubmit:r?l:j,...p,"data-discover":!k&&t==="render"?"true":void 0})});f2.displayName="Form";function p2(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C0(t){let e=m.useContext(zr);return ge(e,p2(t)),e}function m2(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=Tn(),h=dn(),u=To(t,{relative:s});return m.useCallback(f=>{if(_w(f,e)){f.preventDefault();let p=n!==void 0?n:Mn(h)===Mn(u),g=()=>c(t,{replace:p,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?m.startTransition(()=>g()):g()}},[h,c,u,n,r,e,t,i,s,o,a,l])}function g2(t){$e(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=m.useRef(Ad(t)),n=m.useRef(!1),r=dn(),i=m.useMemo(()=>Ww(r.search,n.current?null:e.current),[r.search]),s=Tn(),o=m.useCallback((a,l)=>{const c=Ad(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var b2=0,x2=()=>`__${String(++b2)}__`;function y2(){let{router:t}=C0("useSubmit"),{basename:e}=m.useContext(Ft),n=jw(),r=t.fetch,i=t.navigate;return m.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:h,body:u}=Gw(s,e);if(o.navigate===!1){let f=o.fetcherKey||x2();await r(f,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:u,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function v2(t,{relative:e}={}){let{basename:n}=m.useContext(Ft),r=m.useContext(en);ge(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...To(t||".",{relative:e})},o=dn();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(h=>h==="")){a.delete("index"),l.filter(u=>u).forEach(u=>a.append("index",u));let h=a.toString();s.search=h?`?${h}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Dn([n,s.pathname])),Mn(s)}function w2(t,{relative:e}={}){let n=m.useContext(Lh);ge(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=C0("useViewTransitionState"),i=To(t,{relative:e});if(!n.isTransitioning)return!1;let s=Xt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Xt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tl(i.pathname,o)!=null||tl(i.pathname,s)!=null}function S2(t){return m.createElement(Rw,{flushSync:Dr.flushSync,...t})}const k2={en:{loading:"Loading...",error:"Error",selectProject:"Select a project to view dashboard",controlCenter:"Control Center",settings:"Settings",sync:"Sync",offline:"Offline",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode",settingsSection:"Settings",configEditor:"Config Editor",projects:"Projects",addProject:"Add Project",global:"Global",skills:"Skills",health:"Health",collapse:"Collapse",expand:"Expand",installing:"Installing...",manage:"Manage",uninstall:"Uninstall",installGlobally:"Install Globally",installGloballyDesc:"Available to all projects instead of current project only",selectAtLeastOneAgent:"Please select at least one agent",installationFailed:"Installation failed",allSkills:"All Skills",refresh:"Refresh",browseAndManageSkills:"Browse and manage skills for your agents",detected:"Detected",notDetected:"Not detected",sessions:"sessions",noSessions:"No sessions",terminal:"Terminal",terminalSub:"Open bash at path",editor:"Editor",editorSub:"Open in VS Code",useGlobalFallback:"Use global fallback",openAtPath:"Open at project path",openAppOnly:"Open app only",actionOptionsLoadFailed:"Could not load editor/terminal options",launch:"Launch",launchSub:"Start Claude Code",config:"Config",configSub:"Manage project settings",recentSessions:"Recent Sessions",viewAllHistory:"View All History",showLess:"Show Less",actionFailed:"Action failed",loadingSessions:"Loading sessions...",noSessionsFound:"No sessions found",configuration:"Claude Settings",activeKit:"Active Kit",aiModel:"Model",hooks:"Hooks",active:"active",mcpServers:"MCP Servers",connected:"connected",editProjectConfig:"Edit Project Config",globalSettings:"(Global)",globalSkills:"Global Skills",loadingSkills:"Loading skills...",noDescription:"No description",browseSkillsMarketplace:"Browse Skills Marketplace",backToDashboard:"Back to Dashboard",educationalConfigEditor:"Educational Config Editor",discard:"Discard",saveChanges:"Save Changes",mergedView:"Merged View",localConfig:"Local (.ck.json)",globalConfig:"Global",syntaxValid:"Syntax Valid",configurationHelp:"Configuration Help",field:"Field",type:"Type",default:"Default",description:"Description",validValues:"Valid Values",systemEffect:"System Effect",exampleUsage:"Example Usage",knowledgeBase:"Knowledge Base",clickToSeeHelp:"Click on any configuration field to see detailed documentation and usage examples.",extractedFrom:"Extracted from ClaudeKit v2.x Specification",resetToDefault:"Reset",saving:"Saving...",saved:"Saved",confirmReset:"Reset to Default?",confirmResetMessage:"All changes will be lost and replaced with default values.",confirm:"Confirm",saveFailed:"Save failed",configTab:"Config",systemTab:"System",formTab:"Form",jsonTab:"JSON",readOnly:"Read-only",installedKit:"Installed Kit",kitVersion:"Kit Version",installedOn:"Installed On",noKitInstalled:"No kit installed",components:"Components",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"File Ownership",ownershipCk:"kit-managed",ownershipUser:"user-owned",ownershipModified:"modified",componentInventory:"Component Inventory",installedHooks:"Installed Hooks",installedMcpServers:"MCP Servers",lastChecked:"Last update check",staleIndicator:"Stale",skippedVersion:"Skipped",filesModifiedFromDefaults:"files modified from kit defaults",cliCard:"ClaudeKit CLI",checkForUpdates:"Check for Updates",checking:"Checking...",upToDate:"Up to date",updateAvailable:"Update available",updateNow:"Update Now",updating:"Updating...",updateSuccess:"Update Complete!",updateFailed:"Update Failed",closeModal:"Close",showDetails:"Show Details",hideDetails:"Hide Details",environment:"Environment",claudeConfigPath:"Claude config",nodeVersion:"Node",bunVersion:"Bun",osVersion:"OS",channelStable:"Stable",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Latest",selectVersion:"Select version",loadingVersions:"Loading versions...",prereleaseLabel:"Pre",currentVersionLabel:"Current",checkAll:"Check All",checkingAll:"Checking...",updateAll:"Update All",updatesAvailable:"{count} updates available",allUpToDate:"All up to date",systemControlTower:"System Control Tower",systemOverviewTitle:"Update & Runtime Overview",systemOverviewDesc:"Track CLI and kit health, then run upgrades from one place.",installedComponentsHeading:"Installed Components",updateReadiness:"Update Readiness",checkedComponents:"Checked",activeChannel:"Channel",readyToScan:"Ready to scan",noTrackedFiles:"No tracked files detected",kitsLabel:"Kits",componentFilterAll:"All",componentFilterUpdates:"Updates",componentFilterUpdatesCount:"Updates ({count})",componentFilterUpToDate:"Up to date",componentFilterUpToDateCount:"Up to date ({count})",componentFilterCli:"CLI",componentFilterKits:"Kits",noComponentsMatchFilter:"No components match the current filter.",runCheckAllForFilter:"Run Check All to populate this filter.",noUpdatesFound:"No updates found. Checked components are up to date.",noUpToDateYet:"No components are up to date yet.",configWorkspaceHint:"Edit configuration or manage system updates from one workspace.",settingsJsonHeading:"Claude Settings JSON",settingsJsonMissing:"No settings file found at ~/.claude/settings.json.",settingsJsonLoadFailed:"Failed to load ~/.claude/settings.json.",settingsBackupSaved:"Backup saved",hookDiagnosticsTitle:"Hook Diagnostics",hookDiagnosticsDesc:"Inspect recent hook activity and failures without opening JSONL files manually.",hookDiagnosticsPathPending:"Resolving log path...",hookDiagnosticsScopeGlobal:"Global hooks",hookDiagnosticsEntries:"Entries",hookDiagnosticsCrashes:"Crashes",hookDiagnosticsWarnings:"Warnings",hookDiagnosticsBlocks:"Blocks",hookDiagnosticsLastEvent:"Last event",hookDiagnosticsLoading:"Loading hook diagnostics...",hookDiagnosticsLoadFailed:"Failed to load hook diagnostics",hookDiagnosticsMissing:"No hook log file found for this scope yet.",hookDiagnosticsEmpty:"Hook log is present but contains no readable entries.",hookDiagnosticsParseErrorsNotice:"Skipped {count} malformed log line(s) while loading diagnostics.",hookDiagnosticsTruncatedNotice:"Showing a bounded recent window to keep diagnostics responsive on large logs.",hookDiagnosticsToolLabel:"tool",hookDiagnosticsTargetLabel:"target",hookDiagnosticsUnknown:"Unknown",addProjectTitle:"Add Project",addProjectDescription:"Add a new ClaudeKit project to the control center",projectPath:"Project Path",pathPlaceholder:"/path/to/project",alias:"Alias",aliasOptional:"(optional)",aliasPlaceholder:"my-project",aliasDescription:"Custom display name for the project",pathRequired:"Path is required",failedToAdd:"Failed to add project",cancel:"Cancel",adding:"Adding...",somethingWentWrong:"Something went wrong",reloadApp:"Reload App",serverNotRunning:"Server Not Running",startServerMessage:"The Config UI requires the backend server to be running.",runThisCommand:"Run this command",tryAgain:"Try Again",projectConfig:"Project Config",inheritedFromGlobal:"Inherited from Global",localOverride:"Local Override",viewGlobalConfig:"This field inherits from global config. View",onboardingTitle:"Welcome to ClaudeKit",onboardingSubtitle:"Choose your kit and get started in minutes",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"AI-powered coding with skills, hooks, and multi-agent workflows",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Content automation: campaigns, social media, analytics",featureAgents:"AI Agents",featureAgentsDesc:"Specialized agents for different tasks",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Customize Claude's behavior at key moments",featureSkills:"Skills Library",featureSkillsDesc:"Pre-built capabilities you can activate",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Coordinate multiple agents for complex tasks",featureContent:"Content Generation",featureContentDesc:"Automated content creation and optimization",featureSocial:"Social Media Tools",featureSocialDesc:"Scheduling, analytics, and engagement automation",stepChooseKit:"Choose Kit",stepConfigure:"Configure",stepInstall:"Install",back:"Back",next:"Next",install:"Install",installSuccess:"Installation Complete!",installSuccessDesc:"{kit} is ready to use",getStarted:"Get Started",goToDashboard:"Go to Dashboard",kitConfig:"Kit Config",kitConfigSubtitle:"Configure ClaudeKit Engineer settings",scopeGlobal:"Global",scopeProject:"Project",sectionGeneral:"General",sectionPaths:"Paths",sectionPrivacy:"Privacy & Trust",sectionProject:"Project Detection",sectionIntegrations:"Integrations",sectionHooks:"Hooks",sectionAdvanced:"Advanced",fieldCodingLevel:"Coding Level",fieldCodingLevelDesc:"Your coding experience level (-1=auto, 0=beginner, 1=intermediate, 2=advanced, 3=expert, 4=tech-lead, 5=god-mode)",fieldStatusline:"Statusline Mode",fieldStatuslineDesc:"How much info to show in the status line",fieldStatuslineColors:"Statusline Colors",fieldStatuslineColorsDesc:"Enable ANSI color output in the statusline",fieldStatuslineQuota:"Statusline Quota Display",fieldStatuslineQuotaDesc:"Show the 5h / wk quota chips in the statusline",fieldThinkingLanguage:"Thinking Language",fieldThinkingLanguageDesc:"Language for Claude's internal reasoning (null=English)",fieldResponseLanguage:"Response Language",fieldResponseLanguageDesc:"Language for Claude's responses (null=match user)",fieldDocsPath:"Docs Directory",fieldDocsPathDesc:"Path to documentation directory",fieldPlansPath:"Plans Directory",fieldPlansPathDesc:"Path to plans directory",fieldPrivacyBlock:"Privacy Block",fieldPrivacyBlockDesc:"Block access to sensitive files (.env, credentials)",fieldTrustEnabled:"Trust Mode",fieldTrustEnabledDesc:"Enable auto-approval for tool calls",fieldTrustPassphrase:"Trust Passphrase",fieldTrustPassphraseDesc:"Passphrase to enable trust mode",fieldProjectType:"Project Type",fieldProjectTypeDesc:"Override auto-detected project type",fieldPackageManager:"Package Manager",fieldPackageManagerDesc:"Override auto-detected package manager",fieldFramework:"Framework",fieldFrameworkDesc:"Override auto-detected framework",fieldGeminiModel:"Gemini Model",fieldGeminiModelDesc:"Gemini model for CLI commands; legacy gemini-3.0-* ids auto-map",fieldResearchUseGemini:"Use Gemini for Research",fieldResearchUseGeminiDesc:"Use Gemini CLI instead of WebSearch",fieldDocsMaxLoc:"Max Lines per Doc",fieldDocsMaxLocDesc:"Maximum lines of code per documentation file",fieldPlanNamingFormat:"Plan Naming Format",fieldPlanNamingFormatDesc:"Format for plan directory names",fieldPlanDateFormat:"Plan Date Format",fieldPlanDateFormatDesc:"Date format for plan names (moment.js)",fieldPlanValidationMode:"Validation Mode",fieldPlanValidationModeDesc:"How to validate plans before implementation",fieldPlanMinQuestions:"Min Questions",fieldPlanMinQuestionsDesc:"Minimum validation questions",fieldPlanMaxQuestions:"Max Questions",fieldPlanMaxQuestionsDesc:"Maximum validation questions",fieldAssertions:"Assertions",fieldAssertionsDesc:"Code assertions and rules to enforce",fieldHookSessionInit:"Session Init",fieldHookSessionInitDesc:"Project detection and environment setup",fieldHookSubagentInit:"Subagent Init",fieldHookSubagentInitDesc:"Inject context to subagents",fieldHookDescriptiveName:"Descriptive Name",fieldHookDescriptiveNameDesc:"Enforce kebab-case descriptive file naming for scripts",fieldHookDevRulesReminder:"Dev Rules Reminder",fieldHookDevRulesReminderDesc:"Inject development rules context",fieldHookUsageContextAwareness:"Usage Prompt Awareness",fieldHookUsageContextAwarenessDesc:"Inject usage-limit awareness into prompts",fieldHookContextTracking:"Context Tracking",fieldHookContextTrackingDesc:"Context window tracking (% used, token counts)",fieldHookScoutBlock:"Scout Block",fieldHookScoutBlockDesc:"Block heavy directories from exploration",fieldHookPrivacyBlock:"Privacy Block Hook",fieldHookPrivacyBlockDesc:"Block sensitive files from reading",fieldHookPostEditSimplify:"Post-Edit Simplify",fieldHookPostEditSimplifyDesc:"Simplify reminder after edits",sectionUpdatePipeline:"Update Pipeline",fieldAutoInitAfterUpdate:"Auto Init After Update",fieldAutoInitAfterUpdateDesc:"Automatically run ck init after ck update when kit has new version",fieldAutoMigrateAfterUpdate:"Auto Migrate After Update",fieldAutoMigrateAfterUpdateDesc:"Automatically run ck migrate after ck update (independent of init)",fieldMigrateProviders:"Migrate Providers",fieldMigrateProvidersDesc:"Which providers to auto-migrate. Use 'auto' to scan filesystem or a comma-separated list.",skillsPageTitle:"Skills Management",skillsPageDesc:"Install ClaudeKit skills to your coding agents",availableSkills:"Available Skills",installedSkills:"Installed Skills",noSkillsFound:"No skills found",installSkill:"Install",uninstallSkill:"Uninstall",manageSkill:"Manage",syncRegistry:"Sync",installSkillTitle:"Install Skill",selectAgents:"Select target agents",installLocation:"Installation location",globalInstall:"Global",projectInstall:"Project",confirmInstall:"Install to selected agents",installingSkill:"Installing...",skillInstallSuccess:"Skill installed successfully",skillInstallFailed:"Installation failed",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Installed",notInstalled:"Not installed",allAgents:"All Agents",filterByAgent:"Filter by agent",skillsTitle:"Skills",skillsSubtitle:"Browse, install, and manage skills for your coding agents",availableCount:"Available",installedCount:"Installed",agentsCount:"Agents",searchSkills:"Search skills...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Category",sortInstalledFirst:"Installed first",listView:"List view",gridView:"Grid view",categoryAll:"All",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Security",categoryDevOps:"DevOps",categoryDatabase:"Database",categoryDevelopment:"Development",categoryResearch:"Research",categoryGeneral:"General",categoryCore:"Core",categoryDocumentation:"Documentation",categoryTooling:"Tooling",categoryMedia:"Media",categoryFrameworks:"Frameworks",skillsCountLabel:"{count} skills",installToAll:"Install to All Detected",scopeLabel:"Installation Scope",agentInstalled:"Installed",agentNotInstalled:"Not installed",skillSource:"Source location",skillSourceBadge:"Source",detailPanelClose:"Close",versionLabel:"v{version}",installAllToAllAgents:"Install All to All Agents",bulkInstallFailed:"Bulk install failed",noAgentsDetected:"No agents detected",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Customized",installedVersionLabel:"Installed Version",installedAtLabel:"Installed At",sourceTimestampLabel:"Source Date",kitLabel:"Kit",skillMetadata:"Skill Info",migrate:"Migrate",migrateTitle:"Migrate",migrateSubtitle:"Migrate your Claude Code stack to other providers",migrateDetectedProviders:"Detected",migrateSelectedProviders:"Selected",migrateDiscovering:"Discovering migration sources...",migrateRefresh:"Refresh Discovery",migrateRun:"Run Migration",migrateRunning:"Migrating...",migrateSourceSummary:"Source Summary",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"All Detected",migrateScope:"Scope",migrateScopeProject:"Project",migrateScopeGlobal:"Global",migrateTypes:"Portable Types",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Search providers...",migrateSelectVisible:"Select Visible",migrateClearSelection:"Clear Selection",migrateProvidersHeading:"Target Providers",migrateProvidersCountSuffix:"providers",migrateNoProvidersMatch:"No providers match current filters.",migrateSelectButton:"Select",migrateSelectedButton:"Selected",migrateSelectProviderAction:"Select Provider",migrateUnselectProvider:"Unselect Provider",migrateCapabilitiesLabel:"types",migrateCapabilitiesSection:"Capability Matrix",migrateSupported:"Supported",migrateUnsupportedShort:"Unsupported",migrateIncludedEnabled:"Enabled",migrateIncludedDisabled:"Disabled",migrateLatestTarget:"Latest Target",migrateNoResultForProvider:"No migration result for this provider yet.",migrateActionSummaryTitle:"Ready to Migrate",migrateGlobalOnlyCommandsShort:"Commands global-only",migrateNoProviders:"No providers available.",migrateUnsupported:"Will be skipped (unsupported)",migrateGlobalForced:"Codex commands are global-only. Scope will be forced to global.",migrateResults:"Migration Results",migrateInstalled:"Installed",migrateSkipped:"Skipped",migrateFailed:"Failed",migrateProvider:"Provider",migrateStatus:"Status",migratePath:"Path",migrateError:"Error",migrateStatusInstalled:"Installed",migrateStatusSkipped:"Skipped",migrateStatusFailed:"Failed",migrateNoResults:"No migration results yet.",migrateDetectFailed:"Failed to discover migration data",migrateExecuteFailed:"Migration execution failed",migrateSelectProvider:"Select at least one provider",migrateNoTypesEnabled:"Enable at least one portable type",migrateDetectedTag:"Detected",migrateNotDetectedTag:"Not detected",migrateFilterRecommended:"Recommended",migrateActionInstall:"Install",migrateActionUpdate:"Update",migrateActionSkip:"Skip",migrateActionConflict:"Conflict",migrateActionDelete:"Delete",migrateUnchanged:"unchanged",migrateConflictSectionTitle:"Conflicts",migrateConflictUseCK:"Use CK",migrateConflictKeepMine:"Keep Mine",migrateConflictSmartMerge:"Smart Merge",migrateConflictShowDiff:"Show Diff",migrateConflictHideDiff:"Hide Diff",migrateConflictResolved:"Resolved",migrateConflictManual:"Manual",migrateConflictOverwriteAll:"Overwrite All",migrateConflictKeepAll:"Keep All",migrateSummaryTitle:"Migration Complete",migrateSummaryNewMigration:"New Migration",migrateType:"Type",migrateItem:"Item",migrateReconciling:"Analyzing changes...",migrateReviewPlan:"Review Plan",migrateExecutePlan:"Execute Migration",migrateExecuting:"Executing migration...",migrateResolveConflicts:"Resolve all conflicts before executing",migrateSummarySubtitle:"items migrated",migrateSummarySearchPlaceholder:"Search items...",migrateSummaryFilterAll:"All",migrateSummaryCollapseAll:"Collapse all",migrateSummaryExpandAll:"Expand all",migrateSummaryNoResults:"No items match your search",migrateSummaryProviders:"Providers",migrateTypeUnknown:"Other",kanbanTitle:"Plan Kanban",kanbanNoFile:"No plan file specified. Use ?file= parameter.",kanbanNoPhases:"No phases detected in this plan",kanbanError400:"Invalid request — missing file parameter",kanbanError403:"Access denied — file is outside the project directory",kanbanError404:"Plan file not found",kanbanComplete:"complete",kanbanStatus_pending:"Pending","kanbanStatus_in-progress":"In Progress",kanbanStatus_completed:"Completed",kanbanPhases:"phases",kanbanProgress:"Progress",kanbanLoadError:"Failed to load plan data",developmentFeature:"Development",betaFeature:"Beta",experimentalFeature:"Experimental",sectionModelTaxonomy:"Model Taxonomy",taxonomyDescription:"Customize model mappings for portable migration to other coding agents.",taxonomyTierHeavy:"Heavy (opus)",taxonomyTierBalanced:"Balanced (sonnet)",taxonomyTierLight:"Light (haiku)",taxonomyModel:"Model",taxonomyEffort:"Effort",taxonomyResetProvider:"Reset",taxonomyTier:"Tier",statuslineBuilder:"Status Line Builder",statuslineBuilderDescription:"Visually design your Claude Code status-line using drag-and-drop",statuslineSections:"Sections",statuslinePreview:"Preview",statuslineTheme:"Color Theme",statuslineSettings:"General Settings",statuslineResetDefaults:"Reset to Defaults",statuslineSave:"Save",statuslineBaseMode:"Base Mode",statuslineBreakpoint:"Responsive Breakpoint",statuslineMaxAgents:"Max Agent Rows",statuslineTodoTruncation:"Todo Truncation",statuslineEnable:"Enable",statuslineDisable:"Disable",statuslineDragHint:"Drag to reorder, toggle to enable/disable sections",statuslinePresetDefault:"Default",statuslinePresetMonochrome:"Monochrome",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Stealth",statuslinePresetHacker:"Hacker",statuslineSaved:"Saved successfully",statuslineSaveError:"Save failed",statusline:"Status Line",statuslineCollapseSettings:"Collapse settings",statuslineExpandSettings:"Expand settings",statuslineIconOverride:"Icon override",statuslineLabelOverride:"Label override",statuslineMaxWidth:"Max width (chars)",statuslineIconPlaceholder:"e.g. 🤖",statuslineMaxWidthPlaceholder:"auto",statuslineCustomColors:"Custom colors",statuslineColorContextGroup:"Context Window",statuslineColorQuotaGroup:"Usage Quota",statuslineColorGeneralGroup:"General",statuslineColorSectionGroup:"Section Colors",statuslineColorContextLow:"Low (<50%)",statuslineColorContextMid:"Mid (50-75%)",statuslineColorContextHigh:"High (>75%)",statuslineColorAccent:"Accent",statuslineColorMuted:"Muted",statuslineColorSeparator:"Separator",statuslineModeFullDesc:"All sections visible",statuslineModeCompactDesc:"Condensed display",statuslineModeMinimalDesc:"Essential info only",statuslineModeNoneDesc:"Disabled",statuslinePreviewTitle:"Claude Code — statusline preview",statuslinePreviewEmptyLine:"(empty line)",statuslinePreviewNoLines:"(no lines configured)",statuslineSectionModelLabel:"Model",statuslineSectionContextLabel:"Context Window",statuslineSectionQuotaLabel:"Usage Quota",statuslineSectionDirectoryLabel:"Directory",statuslineSectionGitLabel:"Git Status",statuslineSectionCostLabel:"Cost",statuslineSectionChangesLabel:"Changes",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Tasks",statuslineSectionModelDesc:"AI model name and provider",statuslineSectionContextDesc:"Context window usage bar",statuslineSectionQuotaDesc:"5-hour and weekly usage quota",statuslineSectionDirectoryDesc:"Current working directory",statuslineSectionGitDesc:"Git branch, staged/unstaged changes",statuslineSectionCostDesc:"Session cost estimate",statuslineSectionChangesDesc:"Lines added and removed",statuslineSectionAgentsDesc:"Recent agent activity",statuslineSectionTodosDesc:"Current task progress",statuslineSectionsVisible:"sections visible",statuslineLoadErrorSaveDisabled:"Could not load saved layout. Saving is disabled to prevent data loss.",statuslineAddLine:"Add Line",statuslineRemoveLine:"Remove",statuslineHiddenSections:"Hidden Sections",statuslineDragToLine:"Drag sections to a line to show them",statuslineQuotaLow:"Quota Low",statuslineQuotaHigh:"Quota High",statuslineLine:"Line"},vi:{loading:"Đang tải...",error:"Lỗi",selectProject:"Chọn dự án để xem bảng điều khiển",controlCenter:"Trung tâm điều khiển",settings:"Cài đặt",sync:"Đồng bộ",offline:"Ngoại tuyến",switchToLight:"Chuyển sang chế độ sáng",switchToDark:"Chuyển sang chế độ tối",settingsSection:"Cài đặt",configEditor:"Trình chỉnh sửa cấu hình",projects:"Dự án",addProject:"Thêm dự án",global:"Toàn cục",skills:"Kỹ năng",health:"Sức khỏe",collapse:"Thu gọn",expand:"Mở rộng",installing:"Đang cài đặt...",manage:"Quản lý",uninstall:"Gỡ cài đặt",installGlobally:"Cài đặt toàn cục",installGloballyDesc:"Khả dụng cho tất cả dự án thay vì chỉ dự án hiện tại",selectAtLeastOneAgent:"Vui lòng chọn ít nhất một agent",installationFailed:"Cài đặt thất bại",allSkills:"Tất cả kỹ năng",refresh:"Làm mới",browseAndManageSkills:"Duyệt và quản lý kỹ năng cho agents của bạn",detected:"Đã phát hiện",notDetected:"Chưa phát hiện",sessions:"phiên",noSessions:"Không có phiên",terminal:"Terminal",terminalSub:"Mở bash tại đường dẫn",editor:"Trình soạn thảo",editorSub:"Mở trong VS Code",useGlobalFallback:"Dùng fallback global",openAtPath:"Mở tại đường dẫn dự án",openAppOnly:"Chỉ mở ứng dụng",actionOptionsLoadFailed:"Không thể tải tùy chọn editor/terminal",launch:"Khởi chạy",launchSub:"Bắt đầu Claude Code",config:"Cấu hình",configSub:"Quản lý cài đặt dự án",recentSessions:"Phiên gần đây",viewAllHistory:"Xem tất cả lịch sử",showLess:"Thu gọn",actionFailed:"Thao tác thất bại",loadingSessions:"Đang tải phiên...",noSessionsFound:"Không tìm thấy phiên nào",configuration:"Cài đặt Claude",activeKit:"Kit hoạt động",aiModel:"Mô hình",hooks:"Hooks",active:"hoạt động",mcpServers:"Máy chủ MCP",connected:"kết nối",editProjectConfig:"Chỉnh sửa cấu hình dự án",globalSettings:"(Toàn cục)",globalSkills:"Kỹ năng toàn cục",loadingSkills:"Đang tải kỹ năng...",noDescription:"Không có mô tả",browseSkillsMarketplace:"Duyệt Skills Marketplace",backToDashboard:"Quay lại bảng điều khiển",educationalConfigEditor:"Trình chỉnh sửa cấu hình hướng dẫn",discard:"Hủy bỏ",saveChanges:"Lưu thay đổi",mergedView:"Chế độ gộp",localConfig:"Cục bộ (.ck.json)",globalConfig:"Toàn cục",syntaxValid:"Cú pháp hợp lệ",configurationHelp:"Hướng dẫn cấu hình",field:"Trường",type:"Kiểu",default:"Mặc định",description:"Mô tả",validValues:"Giá trị hợp lệ",systemEffect:"Hiệu ứng hệ thống",exampleUsage:"Ví dụ sử dụng",knowledgeBase:"Cơ sở kiến thức",clickToSeeHelp:"Nhấp vào bất kỳ trường cấu hình nào để xem tài liệu chi tiết và ví dụ sử dụng.",extractedFrom:"Trích xuất từ ClaudeKit v2.x Specification",resetToDefault:"Đặt lại",saving:"Đang lưu...",saved:"Đã lưu",confirmReset:"Đặt lại về mặc định?",confirmResetMessage:"Tất cả thay đổi sẽ bị mất và được thay thế bằng giá trị mặc định.",confirm:"Xác nhận",saveFailed:"Lưu thất bại",configTab:"Cấu hình",systemTab:"Hệ thống",formTab:"Biểu mẫu",jsonTab:"JSON",readOnly:"Chỉ đọc",installedKit:"Kit đã cài",kitVersion:"Phiên bản Kit",installedOn:"Cài đặt vào",noKitInstalled:"Chưa cài kit",components:"Thành phần",agents:"Agents",commands:"Commands",workflows:"Workflows",kitSkills:"Skills",fileOwnership:"Quyền sở hữu tệp",ownershipCk:"do kit quản lý",ownershipUser:"do người dùng",ownershipModified:"đã chỉnh sửa",componentInventory:"Thành phần đã cài",installedHooks:"Hooks đã cài",installedMcpServers:"MCP Servers",lastChecked:"Kiểm tra cập nhật",staleIndicator:"Cũ",skippedVersion:"Đã bỏ qua",filesModifiedFromDefaults:"tệp đã sửa so với mặc định",cliCard:"ClaudeKit CLI",checkForUpdates:"Kiểm tra cập nhật",checking:"Đang kiểm tra...",upToDate:"Đã cập nhật",updateAvailable:"Có bản cập nhật",updateNow:"Cập nhật ngay",updating:"Đang cập nhật...",updateSuccess:"Cập nhật hoàn tất!",updateFailed:"Cập nhật thất bại",closeModal:"Đóng",showDetails:"Xem chi tiết",hideDetails:"Ẩn chi tiết",environment:"Môi trường",claudeConfigPath:"Cấu hình Claude",nodeVersion:"Node",bunVersion:"Bun",osVersion:"Hệ điều hành",channelStable:"Ổn định",channelBeta:"Beta",betaBadge:"Beta",latestVersion:"Mới nhất",selectVersion:"Chọn phiên bản",loadingVersions:"Đang tải...",prereleaseLabel:"Thử nghiệm",currentVersionLabel:"Hiện tại",checkAll:"Kiểm tra tất cả",checkingAll:"Đang kiểm tra...",updateAll:"Cập nhật tất cả",updatesAvailable:"{count} bản cập nhật",allUpToDate:"Tất cả đã cập nhật",systemControlTower:"Trung tâm hệ thống",systemOverviewTitle:"Tổng quan cập nhật & môi trường",systemOverviewDesc:"Theo dõi CLI và kit, rồi nâng cấp từ một nơi.",installedComponentsHeading:"Thành phần đã cài",updateReadiness:"Mức sẵn sàng cập nhật",checkedComponents:"Đã kiểm tra",activeChannel:"Kênh",readyToScan:"Sẵn sàng kiểm tra",noTrackedFiles:"Không phát hiện tệp theo dõi",kitsLabel:"Kit",componentFilterAll:"Tất cả",componentFilterUpdates:"Bản cập nhật",componentFilterUpdatesCount:"Bản cập nhật ({count})",componentFilterUpToDate:"Đã cập nhật",componentFilterUpToDateCount:"Đã cập nhật ({count})",componentFilterCli:"CLI",componentFilterKits:"Kit",noComponentsMatchFilter:"Không có thành phần phù hợp bộ lọc hiện tại.",runCheckAllForFilter:"Hãy chạy Kiểm tra tất cả để nạp dữ liệu cho bộ lọc này.",noUpdatesFound:"Không có bản cập nhật. Các thành phần đã kiểm tra đều mới nhất.",noUpToDateYet:"Chưa có thành phần nào ở trạng thái đã cập nhật.",configWorkspaceHint:"Chỉnh sửa cấu hình hoặc quản lý cập nhật hệ thống trong một màn hình.",settingsJsonHeading:"JSON Cài đặt Claude",settingsJsonMissing:"Không tìm thấy tệp ~/.claude/settings.json.",settingsJsonLoadFailed:"Không thể tải ~/.claude/settings.json.",settingsBackupSaved:"Đã lưu bản sao lưu",hookDiagnosticsTitle:"Chẩn đoán Hook",hookDiagnosticsDesc:"Xem hoạt động hook gần đây và lỗi mà không cần mở tệp JSONL thủ công.",hookDiagnosticsPathPending:"Đang xác định đường dẫn log...",hookDiagnosticsScopeGlobal:"Hook toàn cục",hookDiagnosticsEntries:"Bản ghi",hookDiagnosticsCrashes:"Sự cố",hookDiagnosticsWarnings:"Cảnh báo",hookDiagnosticsBlocks:"Chặn",hookDiagnosticsLastEvent:"Sự kiện cuối",hookDiagnosticsLoading:"Đang tải chẩn đoán hook...",hookDiagnosticsLoadFailed:"Không thể tải chẩn đoán hook",hookDiagnosticsMissing:"Chưa tìm thấy tệp log hook cho phạm vi này.",hookDiagnosticsEmpty:"Tệp log hook có tồn tại nhưng không có bản ghi đọc được.",hookDiagnosticsParseErrorsNotice:"Đã bỏ qua {count} dòng log bị lỗi khi tải chẩn đoán.",hookDiagnosticsTruncatedNotice:"Đang hiển thị cửa sổ bản ghi gần đây để giữ giao diện phản hồi tốt với log lớn.",hookDiagnosticsToolLabel:"công cụ",hookDiagnosticsTargetLabel:"mục tiêu",hookDiagnosticsUnknown:"Không rõ",addProjectTitle:"Thêm dự án",addProjectDescription:"Thêm dự án ClaudeKit mới vào trung tâm điều khiển",projectPath:"Đường dẫn dự án",pathPlaceholder:"/đường/dẫn/dự/án",alias:"Bí danh",aliasOptional:"(tùy chọn)",aliasPlaceholder:"dự-án-của-tôi",aliasDescription:"Tên hiển thị tùy chỉnh cho dự án",pathRequired:"Đường dẫn bắt buộc",failedToAdd:"Không thể thêm dự án",cancel:"Hủy",adding:"Đang thêm...",somethingWentWrong:"Đã xảy ra lỗi",reloadApp:"Tải lại ứng dụng",serverNotRunning:"Máy chủ không chạy",startServerMessage:"Config UI yêu cầu máy chủ backend đang chạy.",runThisCommand:"Chạy lệnh này",tryAgain:"Thử lại",projectConfig:"Cấu hình dự án",inheritedFromGlobal:"Kế thừa từ toàn cục",localOverride:"Ghi đè cục bộ",viewGlobalConfig:"Trường này kế thừa từ cấu hình toàn cục. Xem",onboardingTitle:"Chào mừng đến ClaudeKit",onboardingSubtitle:"Chọn kit của bạn và bắt đầu trong vài phút",kitEngineerName:"ClaudeKit Engineer",kitEngineerTagline:"Lập trình AI với skills, hooks và multi-agent",kitMarketingName:"ClaudeKit Marketing",kitMarketingTagline:"Tự động hóa nội dung: chiến dịch, mạng xã hội, phân tích",featureAgents:"AI Agents",featureAgentsDesc:"Các agent chuyên biệt cho từng tác vụ",featureHooks:"Lifecycle Hooks",featureHooksDesc:"Tùy chỉnh hành vi của Claude tại các thời điểm quan trọng",featureSkills:"Thư viện Skills",featureSkillsDesc:"Các khả năng có sẵn bạn có thể kích hoạt",featureMultiAgent:"Multi-Agent Workflows",featureMultiAgentDesc:"Phối hợp nhiều agent cho các tác vụ phức tạp",featureContent:"Tạo nội dung",featureContentDesc:"Tự động tạo và tối ưu nội dung",featureSocial:"Công cụ mạng xã hội",featureSocialDesc:"Lên lịch, phân tích và tự động tương tác",stepChooseKit:"Chọn Kit",stepConfigure:"Cấu hình",stepInstall:"Cài đặt",back:"Quay lại",next:"Tiếp theo",install:"Cài đặt",installSuccess:"Cài đặt hoàn tất!",installSuccessDesc:"{kit} đã sẵn sàng sử dụng",getStarted:"Bắt đầu",goToDashboard:"Đi đến Dashboard",kitConfig:"Cấu hình Kit",kitConfigSubtitle:"Cấu hình ClaudeKit Engineer",scopeGlobal:"Toàn cục",scopeProject:"Dự án",sectionGeneral:"Cài đặt chung",sectionPaths:"Đường dẫn",sectionPrivacy:"Bảo mật & Tin cậy",sectionProject:"Phát hiện dự án",sectionIntegrations:"Tích hợp",sectionHooks:"Hooks",sectionAdvanced:"Nâng cao",fieldCodingLevel:"Cấp độ lập trình",fieldCodingLevelDesc:"Cấp độ kinh nghiệm (-1=tự động, 0=mới bắt đầu, 1=trung cấp, 2=nâng cao, 3=chuyên gia, 4=tech-lead, 5=thần)",fieldStatusline:"Chế độ thanh trạng thái",fieldStatuslineDesc:"Lượng thông tin hiển thị trên thanh trạng thái",fieldStatuslineColors:"Màu thanh trạng thái",fieldStatuslineColorsDesc:"Bật màu ANSI trong thanh trạng thái",fieldStatuslineQuota:"Hiển thị Quota Statusline",fieldStatuslineQuotaDesc:"Hiển thị các nhãn quota 5h / wk trong statusline",fieldThinkingLanguage:"Ngôn ngữ suy nghĩ",fieldThinkingLanguageDesc:"Ngôn ngữ cho suy luận nội bộ của Claude (null=Tiếng Anh)",fieldResponseLanguage:"Ngôn ngữ phản hồi",fieldResponseLanguageDesc:"Ngôn ngữ cho phản hồi của Claude (null=theo người dùng)",fieldDocsPath:"Thư mục tài liệu",fieldDocsPathDesc:"Đường dẫn đến thư mục tài liệu",fieldPlansPath:"Thư mục kế hoạch",fieldPlansPathDesc:"Đường dẫn đến thư mục kế hoạch",fieldPrivacyBlock:"Chặn quyền riêng tư",fieldPrivacyBlockDesc:"Chặn truy cập file nhạy cảm (.env, credentials)",fieldTrustEnabled:"Chế độ tin cậy",fieldTrustEnabledDesc:"Tự động phê duyệt các tool calls",fieldTrustPassphrase:"Mật khẩu tin cậy",fieldTrustPassphraseDesc:"Mật khẩu để bật chế độ tin cậy",fieldProjectType:"Loại dự án",fieldProjectTypeDesc:"Ghi đè loại dự án tự động phát hiện",fieldPackageManager:"Trình quản lý gói",fieldPackageManagerDesc:"Ghi đè trình quản lý gói tự động phát hiện",fieldFramework:"Framework",fieldFrameworkDesc:"Ghi đè framework tự động phát hiện",fieldGeminiModel:"Mô hình Gemini",fieldGeminiModelDesc:"Mô hình Gemini cho các lệnh CLI; id gemini-3.0-* cũ sẽ tự động ánh xạ",fieldResearchUseGemini:"Dùng Gemini cho nghiên cứu",fieldResearchUseGeminiDesc:"Dùng Gemini CLI thay vì WebSearch",fieldDocsMaxLoc:"Số dòng tối đa/tài liệu",fieldDocsMaxLocDesc:"Số dòng code tối đa cho mỗi file tài liệu",fieldPlanNamingFormat:"Định dạng tên kế hoạch",fieldPlanNamingFormatDesc:"Định dạng cho tên thư mục kế hoạch",fieldPlanDateFormat:"Định dạng ngày kế hoạch",fieldPlanDateFormatDesc:"Định dạng ngày cho tên kế hoạch (moment.js)",fieldPlanValidationMode:"Chế độ xác thực",fieldPlanValidationModeDesc:"Cách xác thực kế hoạch trước khi triển khai",fieldPlanMinQuestions:"Số câu hỏi tối thiểu",fieldPlanMinQuestionsDesc:"Số câu hỏi xác thực tối thiểu",fieldPlanMaxQuestions:"Số câu hỏi tối đa",fieldPlanMaxQuestionsDesc:"Số câu hỏi xác thực tối đa",fieldAssertions:"Assertions",fieldAssertionsDesc:"Các assertions và quy tắc cần thực thi",fieldHookSessionInit:"Khởi tạo phiên",fieldHookSessionInitDesc:"Phát hiện dự án và thiết lập môi trường",fieldHookSubagentInit:"Khởi tạo subagent",fieldHookSubagentInitDesc:"Inject context vào subagents",fieldHookDescriptiveName:"Tên mô tả",fieldHookDescriptiveNameDesc:"Bắt buộc đặt tên file dạng kebab-case mô tả cho scripts",fieldHookDevRulesReminder:"Nhắc nhở quy tắc dev",fieldHookDevRulesReminderDesc:"Inject context quy tắc phát triển",fieldHookUsageContextAwareness:"Nhận thức sử dụng cho prompt",fieldHookUsageContextAwarenessDesc:"Inject nhận thức giới hạn sử dụng vào prompt",fieldHookContextTracking:"Theo dõi ngữ cảnh",fieldHookContextTrackingDesc:"Theo dõi cửa sổ ngữ cảnh (% đã dùng, số token)",fieldHookScoutBlock:"Chặn Scout",fieldHookScoutBlockDesc:"Chặn thư mục nặng khỏi việc khám phá",fieldHookPrivacyBlock:"Hook chặn quyền riêng tư",fieldHookPrivacyBlockDesc:"Chặn đọc file nhạy cảm",fieldHookPostEditSimplify:"Đơn giản sau chỉnh sửa",fieldHookPostEditSimplifyDesc:"Nhắc đơn giản sau khi chỉnh sửa",sectionUpdatePipeline:"Pipeline Cập nhật",fieldAutoInitAfterUpdate:"Tự động Init sau Update",fieldAutoInitAfterUpdateDesc:"Tự động chạy ck init sau ck update khi kit có phiên bản mới",fieldAutoMigrateAfterUpdate:"Tự động Migrate sau Update",fieldAutoMigrateAfterUpdateDesc:"Tự động chạy ck migrate sau ck update (độc lập với init)",fieldMigrateProviders:"Provider Migrate",fieldMigrateProvidersDesc:"Provider nào tự động migrate. Dùng 'auto' để quét hệ thống hoặc danh sách phân cách bằng dấu phẩy.",skillsPageTitle:"Quản lý Kỹ năng",skillsPageDesc:"Cài đặt kỹ năng ClaudeKit cho các agent lập trình",availableSkills:"Kỹ năng có sẵn",installedSkills:"Kỹ năng đã cài",noSkillsFound:"Không tìm thấy kỹ năng",installSkill:"Cài đặt",uninstallSkill:"Gỡ cài đặt",manageSkill:"Quản lý",syncRegistry:"Đồng bộ",installSkillTitle:"Cài đặt Kỹ năng",selectAgents:"Chọn agent đích",installLocation:"Vị trí cài đặt",globalInstall:"Toàn cục",projectInstall:"Dự án",confirmInstall:"Cài đặt cho các agent đã chọn",installingSkill:"Đang cài đặt...",skillInstallSuccess:"Cài đặt kỹ năng thành công",skillInstallFailed:"Cài đặt thất bại",agentClaudeCode:"Claude Code",agentCursor:"Cursor",agentCodex:"Codex",agentOpencode:"OpenCode",agentGoose:"Goose",agentGeminiCli:"Gemini CLI",agentAntigravity:"Antigravity",agentGithubCopilot:"GitHub Copilot",agentAmp:"Amp",agentKilo:"Kilo",agentRoo:"Roo",agentWindsurf:"Windsurf",agentCline:"Cline",agentOpenhands:"OpenHands",installed:"Đã cài",notInstalled:"Chưa cài",allAgents:"Tất cả Agent",filterByAgent:"Lọc theo agent",skillsTitle:"Kỹ năng",skillsSubtitle:"Duyệt, cài đặt và quản lý kỹ năng cho coding agents",availableCount:"Có sẵn",installedCount:"Đã cài",agentsCount:"Agents",searchSkills:"Tìm kiếm kỹ năng...",searchShortcut:"/",sortAZ:"A-Z",sortCategory:"Danh mục",sortInstalledFirst:"Đã cài trước",listView:"Dạng danh sách",gridView:"Dạng lưới",categoryAll:"Tất cả",categoryAI:"AI",categoryUIUX:"UI/UX",categoryBackend:"Backend",categorySecurity:"Bảo mật",categoryDevOps:"DevOps",categoryDatabase:"Cơ sở dữ liệu",categoryDevelopment:"Phát triển",categoryResearch:"Nghiên cứu",categoryGeneral:"Tổng quát",categoryCore:"Cốt lõi",categoryDocumentation:"Tài liệu",categoryTooling:"Công cụ",categoryMedia:"Phương tiện",categoryFrameworks:"Framework",skillsCountLabel:"{count} kỹ năng",installToAll:"Cài cho tất cả đã phát hiện",scopeLabel:"Phạm vi cài đặt",agentInstalled:"Đã cài",agentNotInstalled:"Chưa cài",skillSource:"Vị trí nguồn",skillSourceBadge:"Nguồn",detailPanelClose:"Đóng",versionLabel:"v{version}",installAllToAllAgents:"Cài tất cả cho tất cả Agent",bulkInstallFailed:"Cài hàng loạt thất bại",noAgentsDetected:"Không phát hiện agent nào",kitBadgeEngineer:"Engineer",kitBadgeMarketing:"Marketing",customizedBadge:"Đã tùy chỉnh",installedVersionLabel:"Phiên bản cài đặt",installedAtLabel:"Cài đặt lúc",sourceTimestampLabel:"Ngày nguồn",kitLabel:"Kit",skillMetadata:"Thông tin Skill",migrate:"Di trú",migrateTitle:"Di trú",migrateSubtitle:"Chuyển toàn bộ stack Claude Code sang provider khác",migrateDetectedProviders:"Đã phát hiện",migrateSelectedProviders:"Đã chọn",migrateDiscovering:"Đang quét nguồn di trú...",migrateRefresh:"Làm mới quét",migrateRun:"Chạy di trú",migrateRunning:"Đang di trú...",migrateSourceSummary:"Tổng quan nguồn",migratePresetCodex:"Codex",migratePresetAntigravity:"Antigravity",migratePresetCore:"Codex + Antigravity + Droid",migratePresetDetected:"Tất cả đã phát hiện",migrateScope:"Phạm vi",migrateScopeProject:"Dự án",migrateScopeGlobal:"Toàn cục",migrateTypes:"Loại di trú",migrateTypeAgents:"Subagents",migrateTypeCommands:"Commands",migrateTypeSkills:"Skills",migrateTypeConfig:"Config",migrateTypeRules:"Rules",migrateTypeHooks:"Hooks",migrateSearchProviders:"Tìm provider...",migrateSelectVisible:"Chọn phần đang hiện",migrateClearSelection:"Bỏ chọn tất cả",migrateProvidersHeading:"Provider đích",migrateProvidersCountSuffix:"provider",migrateNoProvidersMatch:"Không có provider khớp bộ lọc hiện tại.",migrateSelectButton:"Chọn",migrateSelectedButton:"Đã chọn",migrateSelectProviderAction:"Chọn provider",migrateUnselectProvider:"Bỏ chọn provider",migrateCapabilitiesLabel:"loại",migrateCapabilitiesSection:"Ma trận khả năng",migrateSupported:"Hỗ trợ",migrateUnsupportedShort:"Không hỗ trợ",migrateIncludedEnabled:"Đang bật",migrateIncludedDisabled:"Đang tắt",migrateLatestTarget:"Đích gần nhất",migrateNoResultForProvider:"Chưa có kết quả di trú cho provider này.",migrateActionSummaryTitle:"Sẵn sàng di trú",migrateGlobalOnlyCommandsShort:"Commands chỉ global",migrateNoProviders:"Không có provider khả dụng.",migrateUnsupported:"Sẽ bỏ qua (không hỗ trợ)",migrateGlobalForced:"Lệnh Codex chỉ hỗ trợ global. Phạm vi sẽ tự chuyển global.",migrateResults:"Kết quả di trú",migrateInstalled:"Đã cài",migrateSkipped:"Đã bỏ qua",migrateFailed:"Lỗi",migrateProvider:"Provider",migrateStatus:"Trạng thái",migratePath:"Đường dẫn",migrateError:"Lỗi",migrateStatusInstalled:"Đã cài",migrateStatusSkipped:"Đã bỏ qua",migrateStatusFailed:"Lỗi",migrateNoResults:"Chưa có kết quả di trú.",migrateDetectFailed:"Không thể quét dữ liệu di trú",migrateExecuteFailed:"Chạy di trú thất bại",migrateSelectProvider:"Vui lòng chọn ít nhất một provider",migrateNoTypesEnabled:"Bật ít nhất một loại di trú",migrateDetectedTag:"Đã phát hiện",migrateNotDetectedTag:"Chưa phát hiện",migrateFilterRecommended:"Đề xuất",migrateActionInstall:"Cài",migrateActionUpdate:"Cập nhật",migrateActionSkip:"Bỏ qua",migrateActionConflict:"Xung đột",migrateActionDelete:"Xóa",migrateUnchanged:"chưa thay đổi",migrateConflictSectionTitle:"Xung đột",migrateConflictUseCK:"Dùng CK",migrateConflictKeepMine:"Giữ của tôi",migrateConflictSmartMerge:"Merge thông minh",migrateConflictShowDiff:"Hiện diff",migrateConflictHideDiff:"Ẩn diff",migrateConflictResolved:"Đã giải quyết",migrateConflictManual:"Thủ công",migrateConflictOverwriteAll:"Ghi đè tất cả",migrateConflictKeepAll:"Giữ tất cả",migrateSummaryTitle:"Di trú hoàn tất",migrateSummaryNewMigration:"Di trú mới",migrateType:"Loại",migrateItem:"Mục",migrateReconciling:"Đang phân tích thay đổi...",migrateReviewPlan:"Xem kế hoạch",migrateExecutePlan:"Thực hiện di trú",migrateExecuting:"Đang thực hiện di trú...",migrateResolveConflicts:"Giải quyết xung đột trước khi thực hiện",migrateSummarySubtitle:"mục đã di trú",migrateSummarySearchPlaceholder:"Tìm kiếm...",migrateSummaryFilterAll:"Tất cả",migrateSummaryCollapseAll:"Thu gọn",migrateSummaryExpandAll:"Mở rộng",migrateSummaryNoResults:"Không tìm thấy mục nào",migrateSummaryProviders:"Provider",migrateTypeUnknown:"Khác",kanbanTitle:"Bảng Kanban Kế hoạch",kanbanNoFile:"Chưa chọn file kế hoạch. Dùng tham số ?file=.",kanbanNoPhases:"Không phát hiện giai đoạn nào trong kế hoạch này",kanbanError400:"Yêu cầu không hợp lệ — thiếu tham số file",kanbanError403:"Truy cập bị từ chối — file nằm ngoài thư mục dự án",kanbanError404:"Không tìm thấy file kế hoạch",kanbanComplete:"hoàn thành",kanbanStatus_pending:"Chờ xử lý","kanbanStatus_in-progress":"Đang thực hiện",kanbanStatus_completed:"Hoàn thành",kanbanPhases:"giai đoạn",kanbanProgress:"Tiến độ",kanbanLoadError:"Không thể tải dữ liệu kế hoạch",developmentFeature:"Đang phát triển",betaFeature:"Beta",experimentalFeature:"Thử nghiệm",sectionModelTaxonomy:"Phân loại mô hình",taxonomyDescription:"Tuỳ chỉnh ánh xạ mô hình cho migration portable sang coding agent khác.",taxonomyTierHeavy:"Nặng (opus)",taxonomyTierBalanced:"Cân bằng (sonnet)",taxonomyTierLight:"Nhẹ (haiku)",taxonomyModel:"Mô hình",taxonomyEffort:"Mức nỗ lực",taxonomyResetProvider:"Đặt lại",taxonomyTier:"Cấp độ",statuslineBuilder:"Trình tạo dòng trạng thái",statuslineBuilderDescription:"Thiết kế bố cục dòng trạng thái bằng kéo và thả",statuslineSections:"Các mục",statuslinePreview:"Xem trước",statuslineTheme:"Giao diện màu sắc",statuslineSettings:"Cài đặt chung",statuslineResetDefaults:"Đặt lại mặc định",statuslineSave:"Lưu",statuslineBaseMode:"Chế độ cơ bản",statuslineBreakpoint:"Điểm ngắt responsive",statuslineMaxAgents:"Số agent tối đa",statuslineTodoTruncation:"Cắt ngắn task",statuslineEnable:"Bật",statuslineDisable:"Tắt",statuslineDragHint:"Kéo để thay đổi thứ tự, bật/tắt từng mục",statuslinePresetDefault:"Mặc định",statuslinePresetMonochrome:"Đơn sắc",statuslinePresetSolarized:"Solarized",statuslinePresetNord:"Nord",statuslinePresetDracula:"Dracula",statuslinePresetCatppuccin:"Catppuccin",statuslinePresetGruvbox:"Gruvbox",statuslinePresetTokyoNight:"Tokyo Night",statuslinePresetRosePine:"Rosé Pine",statuslinePresetOneDark:"One Dark",statuslinePresetAyu:"Ayu",statuslinePresetKanagawa:"Kanagawa",statuslinePresetStealth:"Ẩn mình",statuslinePresetHacker:"Hacker",statuslineSaved:"Đã lưu thành công",statuslineSaveError:"Lưu thất bại",statusline:"Dòng trạng thái",statuslineCollapseSettings:"Thu gọn cài đặt",statuslineExpandSettings:"Mở rộng cài đặt",statuslineIconOverride:"Ghi đè biểu tượng",statuslineLabelOverride:"Ghi đè nhãn",statuslineMaxWidth:"Chiều rộng tối đa (ký tự)",statuslineIconPlaceholder:"vd. 🤖",statuslineMaxWidthPlaceholder:"tự động",statuslineCustomColors:"Màu tùy chỉnh",statuslineColorContextGroup:"Cửa sổ ngữ cảnh",statuslineColorQuotaGroup:"Hạn mức sử dụng",statuslineColorGeneralGroup:"Chung",statuslineColorSectionGroup:"Màu từng mục",statuslineColorContextLow:"Thấp (<50%)",statuslineColorContextMid:"Trung (50-75%)",statuslineColorContextHigh:"Cao (>75%)",statuslineColorAccent:"Nhấn mạnh",statuslineColorMuted:"Giảm nhạt",statuslineColorSeparator:"Dấu phân cách",statuslineModeFullDesc:"Hiển thị tất cả các mục",statuslineModeCompactDesc:"Hiển thị thu gọn",statuslineModeMinimalDesc:"Chỉ thông tin cần thiết",statuslineModeNoneDesc:"Đã tắt",statuslinePreviewTitle:"Claude Code — xem trước dòng trạng thái",statuslinePreviewEmptyLine:"(dòng trống)",statuslinePreviewNoLines:"(chưa cấu hình dòng nào)",statuslineSectionModelLabel:"Mô hình",statuslineSectionContextLabel:"Cửa sổ ngữ cảnh",statuslineSectionQuotaLabel:"Hạn mức sử dụng",statuslineSectionDirectoryLabel:"Thư mục",statuslineSectionGitLabel:"Trạng thái Git",statuslineSectionCostLabel:"Chi phí",statuslineSectionChangesLabel:"Thay đổi",statuslineSectionAgentsLabel:"Agents",statuslineSectionTodosLabel:"Nhiệm vụ",statuslineSectionModelDesc:"Tên mô hình AI và nhà cung cấp",statuslineSectionContextDesc:"Thanh sử dụng cửa sổ ngữ cảnh",statuslineSectionQuotaDesc:"Hạn mức sử dụng 5 giờ và hàng tuần",statuslineSectionDirectoryDesc:"Thư mục làm việc hiện tại",statuslineSectionGitDesc:"Nhánh Git, thay đổi đã/chưa staged",statuslineSectionCostDesc:"Ước tính chi phí phiên",statuslineSectionChangesDesc:"Dòng thêm và xóa",statuslineSectionAgentsDesc:"Hoạt động agent gần đây",statuslineSectionTodosDesc:"Tiến độ tác vụ hiện tại",statuslineSectionsVisible:"mục hiển thị",statuslineLoadErrorSaveDisabled:"Không thể tải bố cục đã lưu. Tính năng lưu đã bị tắt để tránh mất dữ liệu.",statuslineAddLine:"Thêm dòng",statuslineRemoveLine:"Xóa",statuslineHiddenSections:"Mục ẩn",statuslineDragToLine:"Kéo mục vào dòng để hiển thị",statuslineQuotaLow:"Hạn mức thấp",statuslineQuotaHigh:"Hạn mức cao",statuslineLine:"Dòng"}},Hh=m.createContext(null),j0="ck-dashboard-lang";function C2(){const t=localStorage.getItem(j0);return t==="en"||t==="vi"?t:navigator.language.startsWith("vi")?"vi":"en"}function j2({children:t}){const[e,n]=m.useState(C2),r=m.useCallback(o=>{localStorage.setItem(j0,o),n(o)},[]),i=m.useCallback(o=>k2[e][o],[e]),s=m.useMemo(()=>({lang:e,setLang:r,t:i}),[e,r,i]);return d.jsx(Hh.Provider,{value:s,children:t})}function he(){const t=m.useContext(Hh);if(!t)throw new Error("useI18n must be used within I18nProvider");return t}class O2 extends m.Component{constructor(){super(...arguments);Ku(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("App error:",n,r.componentStack)}render(){if(this.state.hasError){const n=this.state.error?.name==="ServerUnavailableError";return d.jsx(Hh.Consumer,{children:r=>d.jsx("div",{className:"flex h-screen items-center justify-center bg-dash-bg",children:d.jsx("div",{className:"text-center space-y-4 max-w-md px-6",children:n?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-orange-500/10 border border-orange-500/30 flex items-center justify-center text-3xl",children:"🔌"}),d.jsx("h1",{className:"text-2xl font-bold text-orange-500",children:r?.t("serverNotRunning")??"Server Not Running"}),d.jsx("p",{className:"text-dash-text-secondary",children:r?.t("startServerMessage")??"The Config UI requires the backend server to be running."}),d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg p-4",children:[d.jsx("p",{className:"text-xs text-dash-text-muted uppercase tracking-widest mb-2 font-bold",children:r?.t("runThisCommand")??"Run this command"}),d.jsx("code",{className:"block text-sm text-dash-accent font-mono bg-dash-bg px-3 py-2 rounded border border-dash-border",children:"ck config"})]}),d.jsx("button",{onClick:()=>window.location.reload(),className:"px-6 py-2 bg-dash-accent text-dash-bg rounded-lg font-bold hover:bg-dash-accent-hover transition-colors",children:r?.t("tryAgain")??"Try Again"})]}):d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"text-2xl font-bold text-red-500",children:r?.t("somethingWentWrong")??"Something went wrong"}),d.jsx("p",{className:"text-dash-text-muted",children:this.state.error?.message}),d.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dash-accent text-white rounded-md hover:opacity-90",children:r?.t("reloadApp")??"Reload App"})]})})})})}return this.props.children}}const rr=({direction:t="horizontal",isDragging:e=!1,onMouseDown:n})=>{const r=t==="horizontal";return d.jsx("div",{onMouseDown:n,className:`
22
22
  group flex items-center justify-center shrink-0
23
23
  ${r?"w-2 cursor-col-resize":"h-2 cursor-row-resize"}
24
24
  ${e?"bg-dash-accent/20":"hover:bg-dash-surface-hover/50"}
@@ -123,7 +123,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
123
123
  "docs": {
124
124
  "maxLoc": 1000
125
125
  }
126
- }`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations. Pick a known model or type any valid model ID. Legacy gemini-3.0-* ids are auto-mapped on load.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu. Chọn model có sẵn hoặc nhập ID model bất kỳ. Các id gemini-3.0-* cũ sẽ được tự động ánh xạ khi tải.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
126
+ }`},gemini:{path:"gemini",type:"object",default:"{}",description:"Configuration for Google Gemini API integration used for CLI commands and research tasks.",descriptionVi:"Cấu hình tích hợp Google Gemini API dùng cho lệnh CLI và tác vụ nghiên cứu.",effect:"Controls which Gemini model is used for research, web search, and other AI-powered CLI operations.",effectVi:"Điều khiển model Gemini nào được dùng cho nghiên cứu, tìm kiếm web và các thao tác CLI hỗ trợ AI khác."},"gemini.model":{path:"gemini.model",type:"string",default:'"gemini-3-flash-preview"',validValues:["gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview","gemini-3-flash-preview"],description:"Gemini model used for CLI commands and research operations. Legacy gemini-3.0-* ids are auto-mapped on load.",descriptionVi:"Model Gemini dùng cho lệnh CLI và thao tác nghiên cứu. Các id gemini-3.0-* cũ sẽ được tự động ánh xạ khi tải.",effect:"Determines which Gemini model handles research, web search, and other auxiliary tasks. Flash models are faster but less capable than Pro models.",effectVi:"Xác định model Gemini nào xử lý nghiên cứu, tìm kiếm web và các tác vụ phụ trợ khác. Model Flash nhanh hơn nhưng kém khả năng hơn model Pro.",example:`{
127
127
  "gemini": {
128
128
  "model": "gemini-2.5-pro"
129
129
  }
@@ -207,15 +207,11 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
207
207
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50
208
208
  disabled:opacity-50 disabled:cursor-not-allowed
209
209
  ${i?"bg-dash-accent":"bg-dash-border"}`,children:d.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform
210
- ${i?"translate-x-6":"translate-x-1"}`})})},tS=({value:t,onChange:e,onFocus:n,schema:r,disabled:i,enumLabels:s,editable:o})=>{const a=r.enum||[],l=`enum-list-${a.join("-").slice(0,32)}`;if(o){const c=u=>s?.[String(u)]??String(u),h=t!=null?c(t):"";return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",list:l,value:h,onChange:u=>{const f=u.target.value,p=a.find(g=>c(g)===f);e(p!=null?String(p):f===""?null:f)},onFocus:n,disabled:i,placeholder:"Select or type a model...",className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
211
- text-dash-text
212
- focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
213
- disabled:opacity-50 disabled:cursor-not-allowed
214
- transition-colors`}),d.jsx("datalist",{id:l,children:a.map(u=>{const f=c(u);return d.jsx("option",{value:f},String(u))})})]})}return d.jsxs("select",{value:t!=null?String(t):"",onChange:c=>{const h=c.target.value;h===""?e(null):a.includes(Number(h))?e(Number(h)):e(h)},onFocus:n,disabled:i,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
210
+ ${i?"translate-x-6":"translate-x-1"}`})})},tS=({value:t,onChange:e,onFocus:n,schema:r,disabled:i})=>{const s=r.enum||[];return d.jsxs("select",{value:t!=null?String(t):"",onChange:o=>{const a=o.target.value;a===""?e(null):s.includes(Number(a))?e(Number(a)):e(a)},onFocus:n,disabled:i,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
215
211
  text-dash-text
216
212
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
217
213
  disabled:opacity-50 disabled:cursor-not-allowed
218
- transition-colors appearance-none cursor-pointer`,children:[d.jsx("option",{value:"",children:"-- Select --"}),a.map(c=>d.jsx("option",{value:String(c),children:s?.[String(c)]??String(c)},String(c)))]})},nS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[i,s]=m.useState(()=>Ki(t)),[o,a]=m.useState(!1);return m.useEffect(()=>{o||s(Ki(t))},[o,t]),d.jsx("input",{type:"text",value:o?i:Ki(t),onChange:l=>{const c=l.target.value;s(c);const h=Q2(c);h!==null&&e(h)},onFocus:()=>{a(!0),s(Ki(t)),n?.()},onBlur:l=>{const c=l.target.value,h=M0(c);a(!1),s(Ki(h)),e(h)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
214
+ transition-colors appearance-none cursor-pointer`,children:[d.jsx("option",{value:"",children:"-- Select --"}),s.map(o=>d.jsx("option",{value:String(o),children:String(o)},String(o)))]})},nS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[i,s]=m.useState(()=>Ki(t)),[o,a]=m.useState(!1);return m.useEffect(()=>{o||s(Ki(t))},[o,t]),d.jsx("input",{type:"text",value:o?i:Ki(t),onChange:l=>{const c=l.target.value;s(c);const h=Q2(c);h!==null&&e(h)},onFocus:()=>{a(!0),s(Ki(t)),n?.()},onBlur:l=>{const c=l.target.value,h=M0(c);a(!1),s(Ki(h)),e(h)},disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
219
215
  text-dash-text placeholder-dash-text-muted
220
216
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
221
217
  disabled:opacity-50 disabled:cursor-not-allowed
@@ -225,7 +221,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
225
221
  text-dash-text placeholder-dash-text-muted
226
222
  focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
227
223
  disabled:opacity-50 disabled:cursor-not-allowed
228
- transition-colors`,placeholder:"Enter passphrase..."}),d.jsx("button",{type:"button",onClick:()=>s(!i),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:i?d.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):d.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})},sS={default:"bg-gray-500/10 text-gray-500 dark:bg-gray-400/10 dark:text-gray-400",project:"bg-orange-500/10 text-orange-600 dark:text-orange-400",global:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},oS=({source:t})=>{const{t:e}=he(),n=()=>{switch(t){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return d.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${sS[t]}`,children:n()})};function aS(t,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(Array.isArray(t.oneOf)&&t.oneOf.some(r=>r.const==="auto")&&t.oneOf.some(r=>r.type==="array"&&r.items?.type==="string"))return"string-array-union";if(t.enum&&t.enum.length>0)return"enum";switch(Array.isArray(t.type)?t.type.find(r=>r!=="null")||"string":t.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const lS=({fieldPath:t,label:e,description:n,schema:r,value:i,source:s,onChange:o,onFocus:a,disabled:l,enumLabels:c,editable:h})=>{const u=aS(r,t),f=()=>{const p={value:i,onChange:o,onFocus:a,schema:r,disabled:l};switch(u){case"boolean":return d.jsx(eS,{...p});case"number":return d.jsx(Z2,{...p});case"enum":return d.jsx(tS,{...p,enumLabels:c,editable:h});case"string-array-union":return d.jsx(nS,{...p});case"array":return d.jsx(rS,{...p});case"password":return d.jsx(iS,{...p});case"object":return null;default:return d.jsx(X2,{...p})}};return u==="object"?null:d.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),d.jsx(oS,{source:s})]}),n&&d.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),d.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),d.jsx("div",{className:u==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:f()})]})})},cS=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[i,s]=m.useState(n);return d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:()=>s(!i),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!i,"aria-controls":`section-${t}`,children:[d.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),d.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${i?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d.jsx("div",{id:`section-${t}`,className:`transition-all duration-200 ease-in-out ${i?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:d.jsx("div",{className:"px-4 py-2",children:r})})]})},dS=({schema:t,value:e,sources:n,sections:r,onChange:i,onFieldFocus:s,disabled:o})=>d.jsx("div",{className:"space-y-4",children:r.map((a,l)=>d.jsx(cS,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(c=>{const h=A0(t,c.path),u=Md(e,c.path),f=n[c.path]||"default";return d.jsx(lS,{fieldPath:c.path,label:c.label,description:c.description||h.description,schema:h,value:u,source:f,onChange:p=>i(c.path,p),onFocus:()=>s?.(c.path),disabled:o,enumLabels:c.enumLabels,editable:c.editable},c.path)})},a.id))}),T0=({width:t,isLoading:e,schema:n,config:r,sources:i,sections:s,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:c}=he(),h=m.useRef(null),u=m.useRef(null),f=m.useRef(null),p=m.useRef(null);return m.useEffect(()=>{if(!l)return;const g=()=>{const x=u.current?.getBoundingClientRect().height??0,w=f.current;if(!w){l(Math.ceil(x));return}const v=window.getComputedStyle(w),k=Number.parseFloat(v.paddingTop||"0"),j=Number.parseFloat(v.paddingBottom||"0"),S=p.current?.getBoundingClientRect().height??0;l(Math.ceil(x+k+j+S))};if(g(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{g()});return h.current&&b.observe(h.current),u.current&&b.observe(u.current),f.current&&b.observe(f.current),p.current&&b.observe(p.current),()=>b.disconnect()},[l]),d.jsxs("div",{ref:h,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[d.jsx("div",{ref:u,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:c("formTab")})}),d.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:d.jsx("div",{ref:p,"data-form-panel-content":!0,children:e?d.jsx("div",{className:"h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:c("loading")})}):n?d.jsx(dS,{schema:n,value:r,sources:i,sections:s,onChange:o,onFieldFocus:a}):null})})]})},E0=1024;let hS=0,wc=class{constructor(e,n){this.from=e,this.to=n}};class be{constructor(e={}){this.id=hS++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Mt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}be.closedBy=new be({deserialize:t=>t.split(" ")});be.openedBy=new be({deserialize:t=>t.split(" ")});be.group=new be({deserialize:t=>t.split(" ")});be.isolate=new be({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});be.contextHash=new be({perNode:!0});be.lookAhead=new be({perNode:!0});be.mounted=new be({perNode:!0});class cs{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[be.mounted.id]}}const uS=Object.create(null);class Mt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):uS,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Mt(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(be.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(be.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Mt.none=new Mt("",Object.create(null),0,8);class Wh{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}n.push(i?new Mt(r.name,i,r.id,r.flags):r)}return new Wh(n)}}const ca=new WeakMap,Cf=new WeakMap;var Fe;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Fe||(Fe={}));class He{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=cs.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Ed(this.topNode,e)}cursorAt(e,n=0,r=0){let i=ca.get(this)||this.topNode,s=new Ed(i);return s.moveTo(e,n),ca.set(this,s._tree),s}get topNode(){return new Qt(this,0,0,null)}resolve(e,n=0){let r=ks(ca.get(this)||this.topNode,e,n,!1);return ca.set(this,r),r}resolveInner(e,n=0){let r=ks(Cf.get(this)||this.topNode,e,n,!0);return Cf.set(this,r),r}resolveStack(e,n=0){return mS(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Fe.IncludeAnonymous)>0;for(let l=this.cursor(o|Fe.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Gh(Mt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new He(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new He(Mt.none,n,r,i)))}static build(e){return gS(e)}}He.empty=new He(Mt.none,[],[],0);class Uh{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Uh(this.buffer,this.index)}}class lr{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Mt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(R0(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new lr(s,o,this.set)}}function R0(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function ks(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Qt&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Fe.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Qt&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class L0{cursor(e=0){return new Ed(this,e)}getChild(e,n=null,r=null){let i=jf(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return jf(this,e,n,r)}resolve(e,n=0){return ks(this,e,n,!1)}resolveInner(e,n=0){return ks(this,e,n,!0)}matchContext(e){return Td(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Qt extends L0{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,h=n>0?l.length:-1;e!=h;e+=n){let u=l[e],f=c[e]+a.from;if(!(!(s&Fe.EnterBracketed&&u instanceof He&&((o=cs.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!R0(i,r,f,f+u.length))){if(u instanceof lr){if(s&Fe.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,i);if(p>-1)return new ir(new fS(a,u,e,f),null,p)}else if(s&Fe.IncludeAnonymous||!u.type.isAnonymous||Kh(u)){let p;if(!(s&Fe.IgnoreMounts)&&(p=cs.get(u))&&!p.overlay)return new Qt(p.tree,f,e,a);let g=new Qt(u,f,e,a);return s&Fe.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&Fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Fe.IgnoreOverlays)&&(i=cs.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Fe.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((n>0||o?a<=s:a<s)&&(n<0||o?l>=s:l>s))return new Qt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function jf(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Td(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class fS{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class ir extends L0{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new ir(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&Fe.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new ir(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ir(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ir(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new He(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function I0(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Qt&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new pS(i,n)}class pS{constructor(e,n){this.heads=e,this.node=n}get next(){return I0(this.heads)}}function mS(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Qt?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=cs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Qt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(ks(a,e,n,!1))}}return i?I0(i):r}class Ed{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Fe.EnterBracketed,e instanceof Qt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Qt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Fe.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Fe.IncludeAnonymous||a instanceof lr||!a.type.isAnonymous||Kh(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new ir(this.buffer,n,this.stack[i]);return this.bufferNode=new ir(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Td(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Td(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Kh(t){return t.children.some(e=>e instanceof lr||!e.type.isAnonymous||Kh(e))}function gS(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=E0,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new Uh(n,n.length):n,l=r.types,c=0,h=0;function u(S,C,y,N,A,T){let{id:P,start:R,end:z,size:I}=a,F=h,G=c;if(I<0)if(a.next(),I==-1){let fe=s[P];y.push(fe),N.push(R-S);return}else if(I==-3){c=P;return}else if(I==-4){h=P;return}else throw new RangeError(`Unrecognized record size: ${I}`);let ae=l[P],X,Q,le=R-S;if(z-R<=i&&(Q=x(a.pos-C,A))){let fe=new Uint16Array(Q.size-Q.skip),W=a.pos-Q.size,se=fe.length;for(;a.pos>W;)se=w(Q.start,fe,se);X=new lr(fe,z-Q.start,r),le=Q.start-S}else{let fe=a.pos-I;a.next();let W=[],se=[],ue=P>=o?P:-1,xe=0,Pe=z;for(;a.pos>fe;)ue>=0&&a.id==ue&&a.size>=0?(a.end<=Pe-i&&(g(W,se,R,xe,a.end,Pe,ue,F,G),xe=W.length,Pe=a.end),a.next()):T>2500?f(R,fe,W,se):u(R,fe,W,se,ue,T+1);if(ue>=0&&xe>0&&xe<W.length&&g(W,se,R,xe,R,Pe,ue,F,G),W.reverse(),se.reverse(),ue>-1&&xe>0){let Qe=p(ae,G);X=Gh(ae,W,se,0,W.length,0,z-R,Qe,Qe)}else X=b(ae,W,se,z-R,F-z,G)}y.push(X),N.push(le)}function f(S,C,y,N){let A=[],T=0,P=-1;for(;a.pos>C;){let{id:R,start:z,end:I,size:F}=a;if(F>4)a.next();else{if(P>-1&&z<P)break;P<0&&(P=I-i),A.push(R,z,I),T++,a.next()}}if(T){let R=new Uint16Array(T*4),z=A[A.length-2];for(let I=A.length-3,F=0;I>=0;I-=3)R[F++]=A[I],R[F++]=A[I+1]-z,R[F++]=A[I+2]-z,R[F++]=F;y.push(new lr(R,A[2]-z,r)),N.push(z-S)}}function p(S,C){return(y,N,A)=>{let T=0,P=y.length-1,R,z;if(P>=0&&(R=y[P])instanceof He){if(!P&&R.type==S&&R.length==A)return R;(z=R.prop(be.lookAhead))&&(T=N[P]+R.length+z)}return b(S,y,N,A,T,C)}}function g(S,C,y,N,A,T,P,R,z){let I=[],F=[];for(;S.length>N;)I.push(S.pop()),F.push(C.pop()+y-A);S.push(b(r.types[P],I,F,T-A,R-T,z)),C.push(A-y)}function b(S,C,y,N,A,T,P){if(T){let R=[be.contextHash,T];P=P?[R].concat(P):[R]}if(A>25){let R=[be.lookAhead,A];P=P?[R].concat(P):[R]}return new He(S,C,y,N,P)}function x(S,C){let y=a.fork(),N=0,A=0,T=0,P=y.end-i,R={size:0,start:0,skip:0};e:for(let z=y.pos-S;y.pos>z;){let I=y.size;if(y.id==C&&I>=0){R.size=N,R.start=A,R.skip=T,T+=4,N+=4,y.next();continue}let F=y.pos-I;if(I<0||F<z||y.start<P)break;let G=y.id>=o?4:0,ae=y.start;for(y.next();y.pos>F;){if(y.size<0)if(y.size==-3||y.size==-4)G+=4;else break e;else y.id>=o&&(G+=4);y.next()}A=ae,N+=I,T+=G}return(C<0||N==S)&&(R.size=N,R.start=A,R.skip=T),R.size>4?R:void 0}function w(S,C,y){let{id:N,start:A,end:T,size:P}=a;if(a.next(),P>=0&&N<o){let R=y;if(P>4){let z=a.pos-(P-4);for(;a.pos>z;)y=w(S,C,y)}C[--y]=R,C[--y]=T-S,C[--y]=A-S,C[--y]=N}else P==-3?c=N:P==-4&&(h=N);return y}let v=[],k=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,v,k,-1,0);let j=(e=t.length)!==null&&e!==void 0?e:v.length?k[0]+v[0].length:0;return new He(l[t.topID],v.reverse(),k.reverse(),j)}const Of=new WeakMap;function Wa(t,e){if(!t.isAnonymous||e instanceof lr||e.type!=t)return 1;let n=Of.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof He)){n=1;break}n+=Wa(t,r)}Of.set(e,n)}return n}function Gh(t,e,n,r,i,s,o,a,l){let c=0;for(let g=r;g<i;g++)c+=Wa(t,e[g]);let h=Math.ceil(c*1.5/8),u=[],f=[];function p(g,b,x,w,v){for(let k=x;k<w;){let j=k,S=b[k],C=Wa(t,g[k]);for(k++;k<w;k++){let y=Wa(t,g[k]);if(C+y>=h)break;C+=y}if(k==j+1){if(C>h){let y=g[j];p(y.children,y.positions,0,y.children.length,b[j]+v);continue}u.push(g[j])}else{let y=b[k-1]+g[k-1].length-S;u.push(Gh(t,g,b,j,k,S,y,null,l))}f.push(S+v-s)}}return p(e,n,r,i,0),(a||l)(u,f,o)}class Rr{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Rr(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<n.length?n[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||c){let p=Math.max(f.from,l)-c,g=Math.min(f.to,u)-c;f=p>=g?null:new Rr(p,g,f.tree,f.offset+c,a>0,!!h)}if(f&&i.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return i}}class $0{startParse(e,n,r){return typeof e=="string"&&(e=new bS(e)),r=r?r.length?r.map(i=>new wc(i.from,i.to)):[new wc(0,0)]:[new wc(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class bS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new be({perNode:!0});var Pf={};class nl{constructor(e,n,r,i,s,o,a,l,c,h=0,u){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new nl(e,[],n,r,r,0,[],0,i?new Nf(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new nl(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new xS(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new Nf(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Nf{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class xS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class rl{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new rl(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new rl(this.stack,this.pos,this.index)}}function da(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Ua{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Df=new Ua;class yS{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Df,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=Df,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class li{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;vS(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}li.prototype.contextual=li.prototype.fallback=li.prototype.extend=!1;li.prototype.fallback=li.prototype.extend=!1;function vS(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let g=t[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||wS(g,e.token.value,i,s))){e.acceptToken(g);break}}let h=e.next,u=0,f=t[o+2];if(e.next<0&&f>u&&t[c+f*3-3]==65535){o=t[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,g=c+p+(p<<1),b=t[g],x=t[g+1]||65536;if(h<b)f=p;else if(h>=x)u=p+1;else{o=t[g+2],e.advance();continue e}}break}}function Af(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function wS(t,e,n,r){let i=Af(n,r,e);return i<0||Af(n,r,t)<i}const Et=typeof process<"u"&&Pf&&/\bparse\b/.test(Pf.LOG);let Sc=null;function Mf(t,e,n){let r=t.cursor(Fe.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class SS{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Mf(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Mf(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof He){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(be.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class kS{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ua)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let h=s[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!h.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Ua,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ua,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Fn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Fn(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Fn(a,c+1),n,r,i))}return i}}class CS{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new yS(n,i),this.tokens=new kS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[nl.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new SS(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&OS(i);if(o)return Et&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Et&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return Et&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:s}=this,o=Et?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(i);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(be.contextHash)||0)==h))return e.useNode(u,f),Et&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof He)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof He&&u.positions[0]==0)u=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Et&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],f=l[c++],p=c==l.length||!r,g=p?e:e.split(),b=this.tokens.mainToken;if(g.apply(h,u,b?b.start:g.pos,f),Et&&console.log(o+this.stackID(g)+` (via ${h&65536?`reduce of ${s.getName(h&65535)}`:"shift"} for ${s.getName(u)} @ ${i}${g==e?"":", split"})`),p)return!0;g.pos>i?n.push(g):r.push(g)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Tf(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(o<<1)+1],h=Et?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Et&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=h;for(let p=0;p<10&&u.forceReduce()&&(Et&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)Et&&(f=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))Et&&console.log(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Et&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Tf(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),He.build({buffer:rl.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(Sc||(Sc=new WeakMap)).get(e);return n||Sc.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Tf(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class jS{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class il extends $0{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=be[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)s(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new Wh(n.map((a,l)=>Mt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=E0;let o=da(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Ef),this.states=da(e.states,Uint32Array),this.data=da(e.stateData),this.goto=da(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new li(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new CS(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Fn(r,s+2)];else{if(r[s+1]==2)return Fn(r,s+2);break}if(o==n||o==0)return Fn(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Fn(this.data,s+2);else break;i=n(Fn(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Fn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(il.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=Ef(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new jS(e,r,i)}static deserialize(e){return new il(e)}}function Fn(t,e){return t[e]|t[e+1]<<16}function OS(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function Ef(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let PS=0;class Gt{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=PS++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Gt&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new Gt(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new sl(e);return r=>r.modified.indexOf(n)>-1?r:sl.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let NS=0;class sl{constructor(e){this.name=e,this.instances=[],this.id=NS++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&DS(n,a.modified));if(r)return r;let i=[],s=new Gt(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=AS(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(sl.get(a,l));return s}}function DS(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function AS(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function B0(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let u=0;;){if(a=="..."&&u>0&&u+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==i.length)break;let p=i[u++];if(u==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let h=new Cs(r,o,l>0?s.slice(0,l):null);e[c]=h.sort(e[c])}}return F0.add(e)}const F0=new be({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Cs(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Cs{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Cs.empty=new Cs([],2,null);function z0(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function MS(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function TS(t,e,n,r=0,i=t.length){let s=new ES(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class ES{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,h=RS(e)||Cs.empty,u=MS(s,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(n,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(be.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(x=>!x.scope||x.scope(f.tree.type)),b=e.firstChild();for(let x=0,w=a;;x++){let v=x<f.overlay.length?f.overlay[x]:null,k=v?v.from+a:l,j=Math.max(n,w),S=Math.min(r,k);if(j<S&&b)for(;e.from<S&&(this.highlightRange(e,j,S,i,s),this.startSpan(Math.min(S,e.to),c),!(e.to>=k||!e.nextSibling())););if(!v||k>r)break;w=v.to+a,w>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+a),Math.min(r,w),"",g),this.startSpan(Math.min(r,w),c))}b&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function RS(t){let e=t.type.prop(F0);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const V=Gt.define,ha=V(),qn=V(),Rf=V(qn),Lf=V(qn),Yn=V(),ua=V(Yn),kc=V(Yn),Sn=V(),kr=V(Sn),yn=V(),vn=V(),Rd=V(),Gi=V(Rd),fa=V(),E={comment:ha,lineComment:V(ha),blockComment:V(ha),docComment:V(ha),name:qn,variableName:V(qn),typeName:Rf,tagName:V(Rf),propertyName:Lf,attributeName:V(Lf),className:V(qn),labelName:V(qn),namespace:V(qn),macroName:V(qn),literal:Yn,string:ua,docString:V(ua),character:V(ua),attributeValue:V(ua),number:kc,integer:V(kc),float:V(kc),bool:V(Yn),regexp:V(Yn),escape:V(Yn),color:V(Yn),url:V(Yn),keyword:yn,self:V(yn),null:V(yn),atom:V(yn),unit:V(yn),modifier:V(yn),operatorKeyword:V(yn),controlKeyword:V(yn),definitionKeyword:V(yn),moduleKeyword:V(yn),operator:vn,derefOperator:V(vn),arithmeticOperator:V(vn),logicOperator:V(vn),bitwiseOperator:V(vn),compareOperator:V(vn),updateOperator:V(vn),definitionOperator:V(vn),typeOperator:V(vn),controlOperator:V(vn),punctuation:Rd,separator:V(Rd),bracket:Gi,angleBracket:V(Gi),squareBracket:V(Gi),paren:V(Gi),brace:V(Gi),content:Sn,heading:kr,heading1:V(kr),heading2:V(kr),heading3:V(kr),heading4:V(kr),heading5:V(kr),heading6:V(kr),contentSeparator:V(Sn),list:V(Sn),quote:V(Sn),emphasis:V(Sn),strong:V(Sn),link:V(Sn),monospace:V(Sn),strikethrough:V(Sn),inserted:V(),deleted:V(),changed:V(),invalid:V(),meta:fa,documentMeta:V(fa),annotation:V(fa),processingInstruction:V(fa),definition:Gt.defineModifier("definition"),constant:Gt.defineModifier("constant"),function:Gt.defineModifier("function"),standard:Gt.defineModifier("standard"),local:Gt.defineModifier("local"),special:Gt.defineModifier("special")};for(let t in E){let e=E[t];e instanceof Gt&&(e.name=t)}z0([{tag:E.link,class:"tok-link"},{tag:E.heading,class:"tok-heading"},{tag:E.emphasis,class:"tok-emphasis"},{tag:E.strong,class:"tok-strong"},{tag:E.keyword,class:"tok-keyword"},{tag:E.atom,class:"tok-atom"},{tag:E.bool,class:"tok-bool"},{tag:E.url,class:"tok-url"},{tag:E.labelName,class:"tok-labelName"},{tag:E.inserted,class:"tok-inserted"},{tag:E.deleted,class:"tok-deleted"},{tag:E.literal,class:"tok-literal"},{tag:E.string,class:"tok-string"},{tag:E.number,class:"tok-number"},{tag:[E.regexp,E.escape,E.special(E.string)],class:"tok-string2"},{tag:E.variableName,class:"tok-variableName"},{tag:E.local(E.variableName),class:"tok-variableName tok-local"},{tag:E.definition(E.variableName),class:"tok-variableName tok-definition"},{tag:E.special(E.variableName),class:"tok-variableName2"},{tag:E.definition(E.propertyName),class:"tok-propertyName tok-definition"},{tag:E.typeName,class:"tok-typeName"},{tag:E.namespace,class:"tok-namespace"},{tag:E.className,class:"tok-className"},{tag:E.macroName,class:"tok-macroName"},{tag:E.propertyName,class:"tok-propertyName"},{tag:E.operator,class:"tok-operator"},{tag:E.comment,class:"tok-comment"},{tag:E.meta,class:"tok-meta"},{tag:E.invalid,class:"tok-invalid"},{tag:E.punctuation,class:"tok-punctuation"}]);const LS=B0({String:E.string,Number:E.number,"True False":E.bool,PropertyName:E.propertyName,Null:E.null,", :":E.separator,"[ ]":E.squareBracket,"{ }":E.brace}),IS=il.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[LS],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Ld=[],H0=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?H0:Ld).push(n=n+t[e])})();function $S(t){if(t<768)return!1;for(let e=0,n=Ld.length;;){let r=e+n>>1;if(t<Ld[r])n=r;else if(t>=H0[r])e=r+1;else return!0;if(e==n)return!1}}function If(t){return t>=127462&&t<=127487}const $f=8205;function BS(t,e,n=!0,r=!0){return(n?V0:FS)(t,e,r)}function V0(t,e,n){if(e==t.length)return e;e&&_0(t.charCodeAt(e))&&W0(t.charCodeAt(e-1))&&e--;let r=Cc(t,e);for(e+=Bf(r);e<t.length;){let i=Cc(t,e);if(r==$f||i==$f||n&&$S(i))e+=Bf(i),r=i;else if(If(i)){let s=0,o=e-2;for(;o>=0&&If(Cc(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function FS(t,e,n){for(;e>0;){let r=V0(t,e-2,n);if(r<e)return r;e--}return 0}function Cc(t,e){let n=t.charCodeAt(e);if(!W0(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return _0(r)?(n-55296<<10)+(r-56320)+65536:n}function _0(t){return t>=56320&&t<57344}function W0(t){return t>=55296&&t<56320}function Bf(t){return t<65536?1:2}class Oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=bi(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Cn.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=bi(this,e,n);let r=[];return this.decompose(e,n,r,0),Cn.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ds(this),s=new ds(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new ds(this,e)}iterRange(e,n=this.length){return new U0(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new K0(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Oe.empty:e.length<=32?new ze(e):Cn.from(ze.split(e,[]))}}class ze extends Oe{constructor(e,n=zS(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new HS(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new ze(Ff(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Ka(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new ze(a,o.length+s.length));else{let l=a.length>>1;r.push(new ze(a.slice(0,l)),new ze(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof ze))return super.replace(e,n,r);[e,n]=bi(this,e,n);let i=Ka(this.text,Ka(r.text,Ff(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new ze(i,s):Cn.from(ze.split(i,[]),s)}sliceString(e,n=this.length,r=`
224
+ transition-colors`,placeholder:"Enter passphrase..."}),d.jsx("button",{type:"button",onClick:()=>s(!i),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dash-text-muted hover:text-dash-text transition-colors",children:i?d.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):d.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})},sS={default:"bg-gray-500/10 text-gray-500 dark:bg-gray-400/10 dark:text-gray-400",project:"bg-orange-500/10 text-orange-600 dark:text-orange-400",global:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},oS=({source:t})=>{const{t:e}=he(),n=()=>{switch(t){case"default":return e("default");case"project":return e("scopeProject");case"global":return e("scopeGlobal")}};return d.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${sS[t]}`,children:n()})};function aS(t,e){if(e.includes("passphrase")||e.includes("password"))return"password";if(Array.isArray(t.oneOf)&&t.oneOf.some(r=>r.const==="auto")&&t.oneOf.some(r=>r.type==="array"&&r.items?.type==="string"))return"string-array-union";if(t.enum&&t.enum.length>0)return"enum";switch(Array.isArray(t.type)?t.type.find(r=>r!=="null")||"string":t.type||"string"){case"boolean":return"boolean";case"integer":case"number":return"number";case"array":return"array";case"object":return"object";default:return"string"}}const lS=({fieldPath:t,label:e,description:n,schema:r,value:i,source:s,onChange:o,onFocus:a,disabled:l})=>{const c=aS(r,t),h=()=>{const u={value:i,onChange:o,onFocus:a,schema:r,disabled:l};switch(c){case"boolean":return d.jsx(eS,{...u});case"number":return d.jsx(Z2,{...u});case"enum":return d.jsx(tS,{...u});case"string-array-union":return d.jsx(nS,{...u});case"array":return d.jsx(rS,{...u});case"password":return d.jsx(iS,{...u});case"object":return null;default:return d.jsx(X2,{...u})}};return c==="object"?null:d.jsx("div",{className:"py-3 border-b border-dash-border/50 last:border-b-0",children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-dash-text",children:e}),d.jsx(oS,{source:s})]}),n&&d.jsx("p",{className:"text-xs text-dash-text-muted mb-2 leading-relaxed",children:n}),d.jsx("p",{className:"text-[10px] text-dash-text-muted/50 font-mono mb-2",children:t})]}),d.jsx("div",{className:c==="boolean"?"shrink-0":"w-1/2 max-w-xs",children:h()})]})})},cS=({id:t,title:e,defaultCollapsed:n=!1,children:r})=>{const[i,s]=m.useState(n);return d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:()=>s(!i),className:"w-full flex items-center justify-between px-4 py-3 bg-dash-surface-hover/30 hover:bg-dash-surface-hover/50 transition-colors","aria-expanded":!i,"aria-controls":`section-${t}`,children:[d.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:e}),d.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${i?"":"rotate-180"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d.jsx("div",{id:`section-${t}`,className:`transition-all duration-200 ease-in-out ${i?"max-h-0 overflow-hidden":"max-h-[2000px]"}`,children:d.jsx("div",{className:"px-4 py-2",children:r})})]})},dS=({schema:t,value:e,sources:n,sections:r,onChange:i,onFieldFocus:s,disabled:o})=>d.jsx("div",{className:"space-y-4",children:r.map((a,l)=>d.jsx(cS,{id:a.id,title:a.title,defaultCollapsed:a.defaultCollapsed??l>1,children:a.fields.map(c=>{const h=A0(t,c.path),u=Md(e,c.path),f=n[c.path]||"default";return d.jsx(lS,{fieldPath:c.path,label:c.label,description:c.description||h.description,schema:h,value:u,source:f,onChange:p=>i(c.path,p),onFocus:()=>s?.(c.path),disabled:o},c.path)})},a.id))}),T0=({width:t,isLoading:e,schema:n,config:r,sources:i,sections:s,onChange:o,onFieldFocus:a,onNaturalHeightChange:l})=>{const{t:c}=he(),h=m.useRef(null),u=m.useRef(null),f=m.useRef(null),p=m.useRef(null);return m.useEffect(()=>{if(!l)return;const g=()=>{const x=u.current?.getBoundingClientRect().height??0,w=f.current;if(!w){l(Math.ceil(x));return}const v=window.getComputedStyle(w),k=Number.parseFloat(v.paddingTop||"0"),j=Number.parseFloat(v.paddingBottom||"0"),S=p.current?.getBoundingClientRect().height??0;l(Math.ceil(x+k+j+S))};if(g(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(()=>{g()});return h.current&&b.observe(h.current),u.current&&b.observe(u.current),f.current&&b.observe(f.current),p.current&&b.observe(p.current),()=>b.disconnect()},[l]),d.jsxs("div",{ref:h,"data-form-panel":!0,style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden flex flex-col shadow-sm min-w-0 h-full",children:[d.jsx("div",{ref:u,"data-form-panel-header":!0,className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:c("formTab")})}),d.jsx("div",{ref:f,"data-form-panel-scroll":!0,className:"flex-1 overflow-auto p-4",children:d.jsx("div",{ref:p,"data-form-panel-content":!0,children:e?d.jsx("div",{className:"h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:c("loading")})}):n?d.jsx(dS,{schema:n,value:r,sources:i,sections:s,onChange:o,onFieldFocus:a}):null})})]})},E0=1024;let hS=0,wc=class{constructor(e,n){this.from=e,this.to=n}};class be{constructor(e={}){this.id=hS++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Mt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}be.closedBy=new be({deserialize:t=>t.split(" ")});be.openedBy=new be({deserialize:t=>t.split(" ")});be.group=new be({deserialize:t=>t.split(" ")});be.isolate=new be({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});be.contextHash=new be({perNode:!0});be.lookAhead=new be({perNode:!0});be.mounted=new be({perNode:!0});class cs{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[be.mounted.id]}}const uS=Object.create(null);class Mt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):uS,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Mt(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(be.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(be.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Mt.none=new Mt("",Object.create(null),0,8);class Wh{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}n.push(i?new Mt(r.name,i,r.id,r.flags):r)}return new Wh(n)}}const ca=new WeakMap,Cf=new WeakMap;var Fe;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Fe||(Fe={}));class He{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=cs.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Ed(this.topNode,e)}cursorAt(e,n=0,r=0){let i=ca.get(this)||this.topNode,s=new Ed(i);return s.moveTo(e,n),ca.set(this,s._tree),s}get topNode(){return new Qt(this,0,0,null)}resolve(e,n=0){let r=ks(ca.get(this)||this.topNode,e,n,!1);return ca.set(this,r),r}resolveInner(e,n=0){let r=ks(Cf.get(this)||this.topNode,e,n,!0);return Cf.set(this,r),r}resolveStack(e,n=0){return mS(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Fe.IncludeAnonymous)>0;for(let l=this.cursor(o|Fe.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Gh(Mt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new He(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new He(Mt.none,n,r,i)))}static build(e){return gS(e)}}He.empty=new He(Mt.none,[],[],0);class Uh{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Uh(this.buffer,this.index)}}class lr{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Mt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(R0(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new lr(s,o,this.set)}}function R0(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function ks(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Qt&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:Fe.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Qt&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class L0{cursor(e=0){return new Ed(this,e)}getChild(e,n=null,r=null){let i=jf(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return jf(this,e,n,r)}resolve(e,n=0){return ks(this,e,n,!1)}resolveInner(e,n=0){return ks(this,e,n,!0)}matchContext(e){return Td(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Qt extends L0{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){var o;for(let a=this;;){for(let{children:l,positions:c}=a._tree,h=n>0?l.length:-1;e!=h;e+=n){let u=l[e],f=c[e]+a.from;if(!(!(s&Fe.EnterBracketed&&u instanceof He&&((o=cs.get(u))===null||o===void 0?void 0:o.overlay)===null&&(f>=r||f+u.length<=r))&&!R0(i,r,f,f+u.length))){if(u instanceof lr){if(s&Fe.ExcludeBuffers)continue;let p=u.findChild(0,u.buffer.length,n,r-f,i);if(p>-1)return new ir(new fS(a,u,e,f),null,p)}else if(s&Fe.IncludeAnonymous||!u.type.isAnonymous||Kh(u)){let p;if(!(s&Fe.IgnoreMounts)&&(p=cs.get(u))&&!p.overlay)return new Qt(p.tree,f,e,a);let g=new Qt(u,f,e,a);return s&Fe.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&Fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Fe.IgnoreOverlays)&&(i=cs.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Fe.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((n>0||o?a<=s:a<s)&&(n<0||o?l>=s:l>s))return new Qt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function jf(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Td(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class fS{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class ir extends L0{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new ir(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&Fe.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new ir(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ir(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ir(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new He(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function I0(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Qt&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new pS(i,n)}class pS{constructor(e,n){this.heads=e,this.node=n}get next(){return I0(this.heads)}}function mS(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Qt?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=cs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Qt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(ks(a,e,n,!1))}}return i?I0(i):r}class Ed{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Fe.EnterBracketed,e instanceof Qt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Qt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Fe.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Fe.IncludeAnonymous||a instanceof lr||!a.type.isAnonymous||Kh(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new ir(this.buffer,n,this.stack[i]);return this.bufferNode=new ir(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Td(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Td(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Kh(t){return t.children.some(e=>e instanceof lr||!e.type.isAnonymous||Kh(e))}function gS(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=E0,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new Uh(n,n.length):n,l=r.types,c=0,h=0;function u(S,C,y,N,A,T){let{id:P,start:R,end:z,size:I}=a,F=h,G=c;if(I<0)if(a.next(),I==-1){let fe=s[P];y.push(fe),N.push(R-S);return}else if(I==-3){c=P;return}else if(I==-4){h=P;return}else throw new RangeError(`Unrecognized record size: ${I}`);let ae=l[P],X,Q,le=R-S;if(z-R<=i&&(Q=x(a.pos-C,A))){let fe=new Uint16Array(Q.size-Q.skip),W=a.pos-Q.size,se=fe.length;for(;a.pos>W;)se=w(Q.start,fe,se);X=new lr(fe,z-Q.start,r),le=Q.start-S}else{let fe=a.pos-I;a.next();let W=[],se=[],ue=P>=o?P:-1,xe=0,Pe=z;for(;a.pos>fe;)ue>=0&&a.id==ue&&a.size>=0?(a.end<=Pe-i&&(g(W,se,R,xe,a.end,Pe,ue,F,G),xe=W.length,Pe=a.end),a.next()):T>2500?f(R,fe,W,se):u(R,fe,W,se,ue,T+1);if(ue>=0&&xe>0&&xe<W.length&&g(W,se,R,xe,R,Pe,ue,F,G),W.reverse(),se.reverse(),ue>-1&&xe>0){let Qe=p(ae,G);X=Gh(ae,W,se,0,W.length,0,z-R,Qe,Qe)}else X=b(ae,W,se,z-R,F-z,G)}y.push(X),N.push(le)}function f(S,C,y,N){let A=[],T=0,P=-1;for(;a.pos>C;){let{id:R,start:z,end:I,size:F}=a;if(F>4)a.next();else{if(P>-1&&z<P)break;P<0&&(P=I-i),A.push(R,z,I),T++,a.next()}}if(T){let R=new Uint16Array(T*4),z=A[A.length-2];for(let I=A.length-3,F=0;I>=0;I-=3)R[F++]=A[I],R[F++]=A[I+1]-z,R[F++]=A[I+2]-z,R[F++]=F;y.push(new lr(R,A[2]-z,r)),N.push(z-S)}}function p(S,C){return(y,N,A)=>{let T=0,P=y.length-1,R,z;if(P>=0&&(R=y[P])instanceof He){if(!P&&R.type==S&&R.length==A)return R;(z=R.prop(be.lookAhead))&&(T=N[P]+R.length+z)}return b(S,y,N,A,T,C)}}function g(S,C,y,N,A,T,P,R,z){let I=[],F=[];for(;S.length>N;)I.push(S.pop()),F.push(C.pop()+y-A);S.push(b(r.types[P],I,F,T-A,R-T,z)),C.push(A-y)}function b(S,C,y,N,A,T,P){if(T){let R=[be.contextHash,T];P=P?[R].concat(P):[R]}if(A>25){let R=[be.lookAhead,A];P=P?[R].concat(P):[R]}return new He(S,C,y,N,P)}function x(S,C){let y=a.fork(),N=0,A=0,T=0,P=y.end-i,R={size:0,start:0,skip:0};e:for(let z=y.pos-S;y.pos>z;){let I=y.size;if(y.id==C&&I>=0){R.size=N,R.start=A,R.skip=T,T+=4,N+=4,y.next();continue}let F=y.pos-I;if(I<0||F<z||y.start<P)break;let G=y.id>=o?4:0,ae=y.start;for(y.next();y.pos>F;){if(y.size<0)if(y.size==-3||y.size==-4)G+=4;else break e;else y.id>=o&&(G+=4);y.next()}A=ae,N+=I,T+=G}return(C<0||N==S)&&(R.size=N,R.start=A,R.skip=T),R.size>4?R:void 0}function w(S,C,y){let{id:N,start:A,end:T,size:P}=a;if(a.next(),P>=0&&N<o){let R=y;if(P>4){let z=a.pos-(P-4);for(;a.pos>z;)y=w(S,C,y)}C[--y]=R,C[--y]=T-S,C[--y]=A-S,C[--y]=N}else P==-3?c=N:P==-4&&(h=N);return y}let v=[],k=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,v,k,-1,0);let j=(e=t.length)!==null&&e!==void 0?e:v.length?k[0]+v[0].length:0;return new He(l[t.topID],v.reverse(),k.reverse(),j)}const Of=new WeakMap;function Wa(t,e){if(!t.isAnonymous||e instanceof lr||e.type!=t)return 1;let n=Of.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof He)){n=1;break}n+=Wa(t,r)}Of.set(e,n)}return n}function Gh(t,e,n,r,i,s,o,a,l){let c=0;for(let g=r;g<i;g++)c+=Wa(t,e[g]);let h=Math.ceil(c*1.5/8),u=[],f=[];function p(g,b,x,w,v){for(let k=x;k<w;){let j=k,S=b[k],C=Wa(t,g[k]);for(k++;k<w;k++){let y=Wa(t,g[k]);if(C+y>=h)break;C+=y}if(k==j+1){if(C>h){let y=g[j];p(y.children,y.positions,0,y.children.length,b[j]+v);continue}u.push(g[j])}else{let y=b[k-1]+g[k-1].length-S;u.push(Gh(t,g,b,j,k,S,y,null,l))}f.push(S+v-s)}}return p(e,n,r,i,0),(a||l)(u,f,o)}class Rr{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Rr(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<n.length?n[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||c){let p=Math.max(f.from,l)-c,g=Math.min(f.to,u)-c;f=p>=g?null:new Rr(p,g,f.tree,f.offset+c,a>0,!!h)}if(f&&i.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return i}}class $0{startParse(e,n,r){return typeof e=="string"&&(e=new bS(e)),r=r?r.length?r.map(i=>new wc(i.from,i.to)):[new wc(0,0)]:[new wc(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class bS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new be({perNode:!0});var Pf={};class nl{constructor(e,n,r,i,s,o,a,l,c,h=0,u){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new nl(e,[],n,r,r,0,[],0,i?new Nf(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new nl(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new xS(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((a,l)=>l&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new Nf(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Nf{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class xS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class rl{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new rl(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new rl(this.stack,this.pos,this.index)}}function da(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Ua{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Df=new Ua;class yS{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Df,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=Df,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class li{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;vS(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}li.prototype.contextual=li.prototype.fallback=li.prototype.extend=!1;li.prototype.fallback=li.prototype.extend=!1;function vS(t,e,n,r,i,s){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let g=t[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||wS(g,e.token.value,i,s))){e.acceptToken(g);break}}let h=e.next,u=0,f=t[o+2];if(e.next<0&&f>u&&t[c+f*3-3]==65535){o=t[c+f*3-1];continue e}for(;u<f;){let p=u+f>>1,g=c+p+(p<<1),b=t[g],x=t[g+1]||65536;if(h<b)f=p;else if(h>=x)u=p+1;else{o=t[g+2],e.advance();continue e}}break}}function Af(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function wS(t,e,n,r){let i=Af(n,r,e);return i<0||Af(n,r,t)<i}const Et=typeof process<"u"&&Pf&&/\bparse\b/.test(Pf.LOG);let Sc=null;function Mf(t,e,n){let r=t.cursor(Fe.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class SS{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Mf(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Mf(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof He){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(be.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class kS{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Ua)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let h=s[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!h.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Ua,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Ua,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Fn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Fn(a,c+2),n,r,i));break}a[c]==n&&(i=this.putAction(Fn(a,c+1),n,r,i))}return i}}class CS{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new yS(n,i),this.tokens=new kS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[nl.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new SS(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&OS(i);if(o)return Et&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Et&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return Et&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:s}=this,o=Et?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(i);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(be.contextHash)||0)==h))return e.useNode(u,f),Et&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof He)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof He&&u.positions[0]==0)u=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Et&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],f=l[c++],p=c==l.length||!r,g=p?e:e.split(),b=this.tokens.mainToken;if(g.apply(h,u,b?b.start:g.pos,f),Et&&console.log(o+this.stackID(g)+` (via ${h&65536?`reduce of ${s.getName(h&65535)}`:"shift"} for ${s.getName(u)} @ ${i}${g==e?"":", split"})`),p)return!0;g.pos>i?n.push(g):r.push(g)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Tf(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=n[o<<1],c=n[(o<<1)+1],h=Et?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Et&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=h;for(let p=0;p<10&&u.forceReduce()&&(Et&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)Et&&(f=this.stackID(u)+" -> ");for(let p of a.recoverByInsert(l))Et&&console.log(h+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Et&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Tf(a,r)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),He.build({buffer:rl.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(Sc||(Sc=new WeakMap)).get(e);return n||Sc.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Tf(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class jS{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class il extends $0{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<n.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=be[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)s(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new Wh(n.map((a,l)=>Mt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=E0;let o=da(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Ef),this.states=da(e.states,Uint32Array),this.data=da(e.stateData),this.goto=da(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new li(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new CS(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Fn(r,s+2)];else{if(r[s+1]==2)return Fn(r,s+2);break}if(o==n||o==0)return Fn(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Fn(this.data,s+2);else break;i=n(Fn(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Fn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(il.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=Ef(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new jS(e,r,i)}static deserialize(e){return new il(e)}}function Fn(t,e){return t[e]|t[e+1]<<16}function OS(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function Ef(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}let PS=0;class Gt{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=PS++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Gt&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new Gt(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new sl(e);return r=>r.modified.indexOf(n)>-1?r:sl.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let NS=0;class sl{constructor(e){this.name=e,this.instances=[],this.id=NS++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&DS(n,a.modified));if(r)return r;let i=[],s=new Gt(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=AS(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(sl.get(a,l));return s}}function DS(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function AS(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function B0(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let u=0;;){if(a=="..."&&u>0&&u+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==i.length)break;let p=i[u++];if(u==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let h=new Cs(r,o,l>0?s.slice(0,l):null);e[c]=h.sort(e[c])}}return F0.add(e)}const F0=new be({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Cs(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Cs{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Cs.empty=new Cs([],2,null);function z0(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function MS(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function TS(t,e,n,r=0,i=t.length){let s=new ES(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class ES{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,h=RS(e)||Cs.empty,u=MS(s,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(i+=(i?" ":"")+u)),this.startSpan(Math.max(n,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(be.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(x=>!x.scope||x.scope(f.tree.type)),b=e.firstChild();for(let x=0,w=a;;x++){let v=x<f.overlay.length?f.overlay[x]:null,k=v?v.from+a:l,j=Math.max(n,w),S=Math.min(r,k);if(j<S&&b)for(;e.from<S&&(this.highlightRange(e,j,S,i,s),this.startSpan(Math.min(S,e.to),c),!(e.to>=k||!e.nextSibling())););if(!v||k>r)break;w=v.to+a,w>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+a),Math.min(r,w),"",g),this.startSpan(Math.min(r,w),c))}b&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function RS(t){let e=t.type.prop(F0);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const V=Gt.define,ha=V(),qn=V(),Rf=V(qn),Lf=V(qn),Yn=V(),ua=V(Yn),kc=V(Yn),Sn=V(),kr=V(Sn),yn=V(),vn=V(),Rd=V(),Gi=V(Rd),fa=V(),E={comment:ha,lineComment:V(ha),blockComment:V(ha),docComment:V(ha),name:qn,variableName:V(qn),typeName:Rf,tagName:V(Rf),propertyName:Lf,attributeName:V(Lf),className:V(qn),labelName:V(qn),namespace:V(qn),macroName:V(qn),literal:Yn,string:ua,docString:V(ua),character:V(ua),attributeValue:V(ua),number:kc,integer:V(kc),float:V(kc),bool:V(Yn),regexp:V(Yn),escape:V(Yn),color:V(Yn),url:V(Yn),keyword:yn,self:V(yn),null:V(yn),atom:V(yn),unit:V(yn),modifier:V(yn),operatorKeyword:V(yn),controlKeyword:V(yn),definitionKeyword:V(yn),moduleKeyword:V(yn),operator:vn,derefOperator:V(vn),arithmeticOperator:V(vn),logicOperator:V(vn),bitwiseOperator:V(vn),compareOperator:V(vn),updateOperator:V(vn),definitionOperator:V(vn),typeOperator:V(vn),controlOperator:V(vn),punctuation:Rd,separator:V(Rd),bracket:Gi,angleBracket:V(Gi),squareBracket:V(Gi),paren:V(Gi),brace:V(Gi),content:Sn,heading:kr,heading1:V(kr),heading2:V(kr),heading3:V(kr),heading4:V(kr),heading5:V(kr),heading6:V(kr),contentSeparator:V(Sn),list:V(Sn),quote:V(Sn),emphasis:V(Sn),strong:V(Sn),link:V(Sn),monospace:V(Sn),strikethrough:V(Sn),inserted:V(),deleted:V(),changed:V(),invalid:V(),meta:fa,documentMeta:V(fa),annotation:V(fa),processingInstruction:V(fa),definition:Gt.defineModifier("definition"),constant:Gt.defineModifier("constant"),function:Gt.defineModifier("function"),standard:Gt.defineModifier("standard"),local:Gt.defineModifier("local"),special:Gt.defineModifier("special")};for(let t in E){let e=E[t];e instanceof Gt&&(e.name=t)}z0([{tag:E.link,class:"tok-link"},{tag:E.heading,class:"tok-heading"},{tag:E.emphasis,class:"tok-emphasis"},{tag:E.strong,class:"tok-strong"},{tag:E.keyword,class:"tok-keyword"},{tag:E.atom,class:"tok-atom"},{tag:E.bool,class:"tok-bool"},{tag:E.url,class:"tok-url"},{tag:E.labelName,class:"tok-labelName"},{tag:E.inserted,class:"tok-inserted"},{tag:E.deleted,class:"tok-deleted"},{tag:E.literal,class:"tok-literal"},{tag:E.string,class:"tok-string"},{tag:E.number,class:"tok-number"},{tag:[E.regexp,E.escape,E.special(E.string)],class:"tok-string2"},{tag:E.variableName,class:"tok-variableName"},{tag:E.local(E.variableName),class:"tok-variableName tok-local"},{tag:E.definition(E.variableName),class:"tok-variableName tok-definition"},{tag:E.special(E.variableName),class:"tok-variableName2"},{tag:E.definition(E.propertyName),class:"tok-propertyName tok-definition"},{tag:E.typeName,class:"tok-typeName"},{tag:E.namespace,class:"tok-namespace"},{tag:E.className,class:"tok-className"},{tag:E.macroName,class:"tok-macroName"},{tag:E.propertyName,class:"tok-propertyName"},{tag:E.operator,class:"tok-operator"},{tag:E.comment,class:"tok-comment"},{tag:E.meta,class:"tok-meta"},{tag:E.invalid,class:"tok-invalid"},{tag:E.punctuation,class:"tok-punctuation"}]);const LS=B0({String:E.string,Number:E.number,"True False":E.bool,PropertyName:E.propertyName,Null:E.null,", :":E.separator,"[ ]":E.squareBracket,"{ }":E.brace}),IS=il.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[LS],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Ld=[],H0=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?H0:Ld).push(n=n+t[e])})();function $S(t){if(t<768)return!1;for(let e=0,n=Ld.length;;){let r=e+n>>1;if(t<Ld[r])n=r;else if(t>=H0[r])e=r+1;else return!0;if(e==n)return!1}}function If(t){return t>=127462&&t<=127487}const $f=8205;function BS(t,e,n=!0,r=!0){return(n?V0:FS)(t,e,r)}function V0(t,e,n){if(e==t.length)return e;e&&_0(t.charCodeAt(e))&&W0(t.charCodeAt(e-1))&&e--;let r=Cc(t,e);for(e+=Bf(r);e<t.length;){let i=Cc(t,e);if(r==$f||i==$f||n&&$S(i))e+=Bf(i),r=i;else if(If(i)){let s=0,o=e-2;for(;o>=0&&If(Cc(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function FS(t,e,n){for(;e>0;){let r=V0(t,e-2,n);if(r<e)return r;e--}return 0}function Cc(t,e){let n=t.charCodeAt(e);if(!W0(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return _0(r)?(n-55296<<10)+(r-56320)+65536:n}function _0(t){return t>=56320&&t<57344}function W0(t){return t>=55296&&t<56320}function Bf(t){return t<65536?1:2}class Oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=bi(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Cn.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=bi(this,e,n);let r=[];return this.decompose(e,n,r,0),Cn.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ds(this),s=new ds(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new ds(this,e)}iterRange(e,n=this.length){return new U0(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new K0(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Oe.empty:e.length<=32?new ze(e):Cn.from(ze.split(e,[]))}}class ze extends Oe{constructor(e,n=zS(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new HS(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new ze(Ff(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=Ka(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new ze(a,o.length+s.length));else{let l=a.length>>1;r.push(new ze(a.slice(0,l)),new ze(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof ze))return super.replace(e,n,r);[e,n]=bi(this,e,n);let i=Ka(this.text,Ka(r.text,Ff(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new ze(i,s):Cn.from(ze.split(i,[]),s)}sliceString(e,n=this.length,r=`
229
225
  `){[e,n]=bi(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new ze(r,i)),r=[],i=-1);return i>-1&&n.push(new ze(r,i)),n}}class Cn extends Oe{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&n>=o){let c=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!c?r.push(a):a.decompose(e-o,n-o,r,c)}o=l+1}}replace(e,n,r){if([e,n]=bi(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&n<=a){let l=o.replace(e-s,n-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[i]=l,new Cn(h,this.length-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
230
226
  `){[e,n]=bi(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Cn))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new ze(p,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,h=[];function u(p){let g;if(p.lines>s&&p instanceof Cn)for(let b of p.children)u(b);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof ze&&l&&(g=h[h.length-1])instanceof ze&&p.lines+g.lines<=32?(l+=p.lines,c+=p.length+1,h[h.length-1]=new ze(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>i&&f(),l+=p.lines,c+=p.length+1,h.push(p))}function f(){l!=0&&(a.push(h.length==1?h[0]:Cn.from(h,c)),c=-1,l=h.length=0)}for(let p of e)u(p);return f(),a.length==1?a[0]:new Cn(a,n)}}Oe.empty=new ze([""],0);function zS(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Ka(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let a=t[s],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function Ff(t,e,n){return Ka(t,[""],e,n)}class ds{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof ze?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof ze?i.text.length:i.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
231
227
  `,this;e--}else if(i instanceof ze){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof ze?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class U0{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ds(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class K0{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Oe.prototype[Symbol.iterator]=function(){return this.iter()},ds.prototype[Symbol.iterator]=U0.prototype[Symbol.iterator]=K0.prototype[Symbol.iterator]=function(){return this});class HS{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function bi(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Ye(t,e,n=!0,r=!0){return BS(t,e,n,r)}function VS(t){return t>=56320&&t<57344}function _S(t){return t>=55296&&t<56320}function Ot(t,e){let n=t.charCodeAt(e);if(!_S(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return VS(r)?(n-55296<<10)+(r-56320)+65536:n}function qh(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function jn(t){return t<65536?1:2}const Id=/\r\n?|\n/;var wt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(wt||(wt={}));class An{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){$d(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new An(e)}composeDesc(e){return this.empty?e:e.empty?this:G0(this,e)}mapDesc(e,n=!1){return e.empty?this:Bd(this,e,n)}mapPos(e,n=-1,r=wt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=wt.Simple&&c>=e&&(r==wt.TrackDel&&i<e&&c>e||r==wt.TrackBefore&&i<e||r==wt.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new An(e)}static create(e){return new An(e)}}class Ge extends An{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return $d(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return Bd(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(Oe.empty);r.push(o?e.slice(s,s+o):Oe.empty)}s+=o}return new Ge(n,r)}compose(e){return this.empty?e:e.empty?this:G0(this,e,!0)}map(e,n=!1){return e.empty?this:Bd(this,e,n,!0)}iterChanges(e,n=!1){$d(this,e,n)}get desc(){return An.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new js(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,l-a);ht(i,h,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;ht(n,h,u),u>0&&sr(r,n,s.text),s.forward(h),a+=h}let c=e[o++];for(;a<c;){if(s.done)break e;let h=Math.min(s.len,c-a);ht(n,h,-1),ht(i,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),a+=h}}return{changes:new Ge(n,r),filtered:An.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(h=!1){if(!h&&!i.length)return;o<n&&ht(i,n-o,-1);let u=new Ge(i,s);a=a?a.compose(u.map(a)):u,i=[],s=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof Ge){if(h.length!=n)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${n})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:f=u,insert:p}=h;if(u>f||u<0||f>n)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${n})`);let g=p?typeof p=="string"?Oe.of(p.split(r||Id)):p:Oe.empty,b=g.length;if(u==f&&b==0)return;u<o&&l(),u>o&&ht(i,u-o,-1),ht(i,f-u,b),sr(s,i,g),o=f}}return c(e),l(!a),a}static empty(e){return new Ge(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(Oe.empty);r[i]=Oe.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new Ge(n,r)}static createSet(e,n){return new Ge(e,n)}}function ht(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function sr(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Oe.empty);t.push(n)}}function $d(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,h=s,u=Oe.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,h,u),i=c,s=h}}}function Bd(t,e,n,r=!1){let i=[],s=r?[]:null,o=new js(t),a=new js(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);ht(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(ht(i,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(ht(i,0,o.ins),s&&sr(s,i,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;ht(i,c,l<o.i?o.ins:0),s&&l<o.i&&sr(s,i,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return s?Ge.createSet(i,s):An.create(i);throw new Error("Mismatched change set lengths")}}}function G0(t,e,n=!1){let r=[],i=n?[]:null,s=new js(t),o=new js(e);for(let a=!1;;){if(s.done&&o.done)return i?Ge.createSet(r,i):An.create(r);if(s.ins==0)ht(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)ht(r,0,o.ins,a),i&&sr(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;ht(r,l,h,a),i&&h&&sr(i,r,o.text)}else o.ins==-1?(ht(r,s.off?0:s.len,l,a),i&&sr(i,r,s.textBit(l))):(ht(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&sr(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class js{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Oe.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Oe.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Mr{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Mr(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return L.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return L.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return L.range(e.anchor,e.head)}static create(e,n,r){return new Mr(e,n,r)}}class L{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:L.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new L([this.main],0)}addRange(e,n=!0){return L.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,L.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new L(e.ranges.map(n=>Mr.fromJSON(n)),e.main)}static single(e,n=e){return new L([L.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return L.normalized(e.slice(),n);r=s.to}return new L(e,n)}static cursor(e,n=0,r,i){return Mr.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?Mr.create(n,e,48|s):Mr.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?L.range(l,a):L.range(a,l))}}return new L(e,n)}}function q0(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Yh=0;class Y{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Yh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Y(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Jh),!!e.static,e.enables)}of(e){return new Ga([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ga(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ga(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Jh(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Ga{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Yh++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:((n=e[u.id])!==null&&n!==void 0?n:1)&1||h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Fd(u,h)){let p=r(u);if(a?!zf(p,u.values[o],i):!i(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,f)=>{let p,g=f.config.address[s];if(g!=null){let b=al(f,g);if(this.dependencies.every(x=>x instanceof Y?f.facet(x)===u.facet(x):x instanceof ot?f.field(x,!1)==u.field(x,!1):!0)||(a?zf(p=r(u),b,i):i(p=r(u),b)))return u.values[o]=b,0}else p=r(u);return u.values[o]=p,1}}}}function zf(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Fd(t,e){let n=!1;for(let r of e)hs(t,r)&1&&(n=!0);return n}function WS(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=al(l,r[h]);if(i[h]==2)for(let f of u)c.push(f);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)hs(l,c);return l.values[o]=a(l),1},update(l,c){if(!Fd(l,s))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=Fd(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!h&&Jh(n,u))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const pa=Y.define({static:!0});class ot{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new ot(Yh++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(pa).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(pa),o=i.facet(pa),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,pa.of({field:this,create:e})]}get extension(){return this}}const jr={lowest:4,low:3,default:2,high:1,highest:0};function qi(t){return e=>new Y0(e,t)}const Hr={highest:qi(jr.highest),high:qi(jr.high),default:qi(jr.default),low:qi(jr.low),lowest:qi(jr.lowest)};class Y0{constructor(e,n){this.inner=e,this.prec=n}}class _l{of(e){return new zd(this,e)}reconfigure(e){return _l.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class zd{constructor(e,n){this.compartment=e,this.inner=n}}class ol{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let f of US(e,n,o))f instanceof ot?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of i)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let h=r?.config.facets;for(let f in s){let p=s[f],g=p[0].facet,b=h&&h[f]||[];if(p.every(x=>x.type==0))if(a[g.id]=l.length<<1|1,Jh(b,p))l.push(r.facet(g));else{let x=g.combine(p.map(w=>w.value));l.push(r&&g.compare(x,r.facet(g))?r.facet(g):x)}else{for(let x of p)x.type==0?(a[x.id]=l.length<<1|1,l.push(x.value)):(a[x.id]=c.length<<1,c.push(w=>x.dynamicSlot(w)));a[g.id]=c.length<<1,c.push(x=>WS(x,g,p))}}let u=c.map(f=>f(a));return new ol(e,o,u,a,l,s)}}function US(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof zd&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof zd){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof Y0)s(o.inner,o.prec);else if(o instanceof ot)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Ga)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,jr.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(t,jr.default),r.reduce((o,a)=>o.concat(a))}function hs(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function al(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const J0=Y.define(),Hd=Y.define({combine:t=>t.some(e=>e),static:!0}),Q0=Y.define({combine:t=>t.length?t[0]:void 0,static:!0}),X0=Y.define(),Z0=Y.define(),eb=Y.define(),tb=Y.define({combine:t=>t.length?t[0]:!1});class En{constructor(e,n){this.type=e,this.value=n}static define(){return new KS}}class KS{of(e){return new En(this,e)}}class GS{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new me(this.type,n)}is(e){return this.type==e}static define(e={}){return new GS(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}me.reconfigure=me.define();me.appendConfig=me.define();class Je{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&q0(r,n.newLength),s.some(a=>a.type==Je.time)||(this.annotations=s.concat(Je.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Je(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Je.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Je.time=En.define();Je.userEvent=En.define();Je.addToHistory=En.define();Je.remote=En.define();function qS(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function nb(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=Ge.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:me.mapEffects(t.effects,i).concat(me.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Vd(t,e,n){let r=e.selection,i=ci(e.annotations);return e.userEvent&&(i=i.concat(Je.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ge?e.changes:Ge.of(e.changes||[],n,t.facet(Q0)),selection:r&&(r instanceof L?r:L.single(r.anchor,r.head)),effects:ci(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function rb(t,e,n){let r=Vd(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=nb(r,Vd(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=Je.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return JS(n?YS(i):i)}function YS(t){let e=t.startState,n=!0;for(let i of e.facet(X0)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:qS(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=Ge.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Je.create(e,i,t.selection&&t.selection.map(s),me.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(Z0);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Je?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Je?t=s[0]:t=rb(e,ci(s),!1)}return t}function JS(t){let e=t.startState,n=e.facet(eb),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=nb(r,Vd(e,s,t.changes.newLength),!0))}return r==t?t:Je.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const QS=[];function ci(t){return t==null?QS:Array.isArray(t)?t:[t]}var Ie=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ie||(Ie={}));const XS=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let _d;try{_d=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ZS(t){if(_d)return _d.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||XS.test(n)))return!0}return!1}function ek(t){return e=>{if(!/\S/.test(e))return Ie.Space;if(ZS(e))return Ie.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Ie.Word;return Ie.Other}}class Se{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)hs(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return hs(this,r),al(this,r)}update(...e){return rb(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(_l.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(me.reconfigure)?(n=null,r=a.value):a.is(me.appendConfig)&&(n=null,r=ci(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=ol.resolve(r,i,this),s=new Se(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Hd)?e.newSelection:e.newSelection.asSingle();new Se(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:L.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=ci(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),h=c.map(i);for(let f=0;f<a;f++)s[f]=s[f].map(h);let u=i.mapDesc(c,!0);s.push(l.range.map(u)),i=i.compose(h),o=me.mapEffects(o,h).concat(me.mapEffects(ci(l.effects),u))}return{changes:i,selection:L.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Ge?e:Ge.of(e,this.doc.length,this.facet(Se.lineSeparator))}toText(e){return Oe.of(e.split(this.facet(Se.lineSeparator)||Id))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(hs(this,n),al(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof ot&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Se.create({doc:e.doc,selection:L.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=ol.resolve(e.extensions||[],new Map),r=e.doc instanceof Oe?e.doc:Oe.of((e.doc||"").split(n.staticFacet(Se.lineSeparator)||Id)),i=e.selection?e.selection instanceof L?e.selection:L.single(e.selection.anchor,e.selection.head):L.single(0);return q0(i,r.length),n.staticFacet(Hd)||(i=i.asSingle()),new Se(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Se.tabSize)}get lineBreak(){return this.facet(Se.lineSeparator)||`
@@ -244,7 +240,7 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
244
240
  bg-transparent border border-amber-500/30 rounded px-2 py-1
245
241
  focus:outline-none focus:ring-2 focus:ring-amber-500/50
246
242
  cursor-pointer appearance-none`,title:s("selectVersion"),children:o.map(p=>{const g=p.version===r,b=p.version===n,x=`v${p.version.replace(/^v/,"")}${g?` (${s("latestVersion")})`:""}${p.isPrerelease?` [${s("prereleaseLabel")}]`:""}${b?` - ${s("currentVersionLabel")}`:""}`;return d.jsx("option",{value:p.version,disabled:b,children:x},p.version)})})},nP=({version:t,installedAt:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[l,c]=m.useState("idle"),[h,u]=m.useState(null),[f,p]=m.useState(!1),[g,b]=m.useState(null),x=r??l,w=i??h,v=async()=>{const j=C=>{s||c(C)},S=C=>{s||u(C)};j("checking"),s&&s("checking",null);try{const y=await(await fetch(`/api/system/check-updates?target=cli&channel=${n}`)).json();y.updateAvailable?(j("update-available"),S(y.latest),s&&s("update-available",y.latest)):(j("up-to-date"),s&&s("up-to-date",null))}catch{j("idle"),s&&s("idle",null)}},k=async()=>{window.location.reload()};return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"dash-panel p-5 transition-colors hover:border-dash-accent/30",children:d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx(Ny,{status:x,ariaLabel:a(x==="up-to-date"?"upToDate":x==="update-available"?"updateAvailable":"checking")}),d.jsx("h3",{className:"text-base font-semibold text-dash-text",children:a("cliCard")}),n==="beta"&&d.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:a("betaBadge")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[d.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",t.replace(/^v/,"")]}),e&&d.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e).toLocaleDateString()})]}),x==="update-available"&&w&&d.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",t.replace(/^v/,"")," ","->"," v",w.replace(/^v/,"")]})]}),d.jsx(rP,{status:x,currentVersion:t,latestVersion:w,onCheck:v,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]})}),d.jsx(Ou,{isOpen:f,onClose:()=>p(!1),target:"cli",targetVersion:g??w??void 0,onComplete:k})]})},rP=({status:t,currentVersion:e,latestVersion:n,onCheck:r,onUpdate:i,onVersionSelect:s,disabled:o})=>{const{t:a}=he();return t==="checking"?d.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),a("checking")]}):t==="up-to-date"?d.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:a("upToDate")}):t==="update-available"&&n?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(Dy,{target:"cli",currentVersion:e,latestVersion:n,onVersionSelect:l=>{s(l),i()}})}):d.jsx("button",{type:"button",onClick:r,disabled:o,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:a("checkForUpdates")})},iP=({configPath:t,nodeVersion:e,bunVersion:n,os:r})=>{const{t:i}=he();return d.jsxs("div",{className:"dash-panel p-5",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text mb-3",children:i("environment")}),d.jsxs("div",{className:"grid grid-cols-1 gap-2 text-sm md:grid-cols-2",children:[d.jsx(Ea,{label:i("claudeConfigPath"),value:t,mono:!0}),d.jsx(Ea,{label:i("osVersion"),value:r}),d.jsx(Ea,{label:i("nodeVersion"),value:e,mono:!0}),n&&d.jsx(Ea,{label:i("bunVersion"),value:n,mono:!0})]})]})},Ea=({label:t,value:e,mono:n})=>d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 p-2.5",children:[d.jsx("p",{className:"text-dash-text-muted text-[11px] uppercase tracking-wide mb-1",children:t}),d.jsx("p",{className:`text-dash-text-secondary break-all ${n?"mono text-xs":"text-sm"}`,children:e})]}),sP={ok:"bg-emerald-500/10 text-emerald-500 border-emerald-500/20",skip:"bg-slate-500/10 text-slate-300 border-slate-500/20",warn:"bg-amber-500/10 text-amber-400 border-amber-500/20",block:"bg-orange-500/10 text-orange-400 border-orange-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",crash:"bg-red-500/10 text-red-400 border-red-500/20"};function Om(t,e){if(!t)return e;try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(t))}catch{return t}}const oP=()=>{const{t}=he(),[e,n]=m.useState([]),[r,i]=m.useState("global"),[s,o]=m.useState(null),[a,l]=m.useState(!0),[c,h]=m.useState(null),u=m.useRef(0),f=m.useRef(null),p=m.useCallback(async v=>{u.current+=1;const k=u.current;f.current?.abort();const j=new AbortController;f.current=j,l(!0),h(null);try{const S=await I2(v==="global"?{scope:"global",limit:40,signal:j.signal}:{scope:"project",projectId:v,limit:40,signal:j.signal});if(k!==u.current)return;o(S)}catch(S){if(j.signal.aborted||k!==u.current)return;o(null),h(S instanceof Error?S.message:t("hookDiagnosticsLoadFailed"))}finally{k===u.current&&(l(!1),f.current=null)}},[t]);m.useEffect(()=>{let v=!1;return _h().then(k=>{v||n(k.map(j=>({id:j.id,name:j.name})))}).catch(()=>{v||n([])}),()=>{v=!0}},[]),m.useEffect(()=>{p(r)},[p,r]),m.useEffect(()=>()=>{f.current?.abort()},[]);const g=s?.summary,b=g?.statusCounts??{},x=s?.entries??[],w=m.useMemo(()=>[{label:t("hookDiagnosticsEntries"),value:String(g?.total??0)},{label:t("hookDiagnosticsCrashes"),value:String(b.crash??0)},{label:t("hookDiagnosticsWarnings"),value:String(b.warn??0)},{label:t("hookDiagnosticsBlocks"),value:String(b.block??0)}],[g?.total,b.block,b.crash,b.warn,t]);return d.jsxs("section",{className:"dash-panel p-4 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[d.jsxs("div",{className:"space-y-1 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:t("hookDiagnosticsTitle")}),d.jsx("p",{className:"text-xs text-dash-text-secondary",children:t("hookDiagnosticsDesc")}),d.jsx("p",{className:"mono text-[11px] text-dash-text-muted break-all",children:s?.path??t("hookDiagnosticsPathPending")})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("select",{value:r,onChange:v=>i(v.target.value),className:"rounded-lg border border-dash-border bg-dash-bg px-3 py-2 text-xs text-dash-text",children:[d.jsx("option",{value:"global",children:t("hookDiagnosticsScopeGlobal")}),e.map(v=>d.jsx("option",{value:v.id,children:v.name},v.id))]}),d.jsx("button",{type:"button",onClick:()=>void p(r),className:"rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs font-semibold text-dash-text-secondary hover:bg-dash-surface-hover",children:t("refresh")})]})]}),d.jsx("div",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4",children:w.map(v=>d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/60 px-3 py-2",children:[d.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:v.label}),d.jsx("p",{className:"mono mt-1 text-lg font-semibold text-dash-text",children:v.value})]},v.label))}),g?.lastEventAt&&d.jsxs("p",{className:"text-xs text-dash-text-muted",children:[t("hookDiagnosticsLastEvent"),":"," ",Om(g.lastEventAt,t("hookDiagnosticsUnknown"))]}),g&&(g.parseErrors>0||g.truncated)&&d.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200",children:[g.parseErrors>0&&d.jsx("p",{children:t("hookDiagnosticsParseErrorsNotice").replace("{count}",String(g.parseErrors))}),g.truncated&&d.jsx("p",{children:t("hookDiagnosticsTruncatedNotice")})]}),a&&d.jsx("p",{className:"text-sm text-dash-text-muted",children:t("hookDiagnosticsLoading")}),c&&d.jsx("p",{className:"text-sm text-red-400",children:c}),!a&&!c&&s&&!s.exists&&d.jsx("p",{className:"text-sm text-dash-text-muted",children:t("hookDiagnosticsMissing")}),!a&&!c&&s?.exists&&d.jsx("div",{className:"space-y-2",children:x.length===0?d.jsx("p",{className:"text-sm text-dash-text-muted",children:t("hookDiagnosticsEmpty")}):x.map((v,k)=>d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-3",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"mono text-[11px] text-dash-text-muted",children:Om(v.ts,t("hookDiagnosticsUnknown"))}),d.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase ${sP[v.status]??"bg-dash-surface text-dash-text border-dash-border"}`,children:v.status}),d.jsx("span",{className:"text-sm font-medium text-dash-text",children:v.hook}),v.event&&d.jsx("span",{className:"text-xs text-dash-text-muted",children:v.event}),v.tool&&d.jsxs("span",{className:"text-xs text-dash-text-muted",children:[t("hookDiagnosticsToolLabel"),": ",v.tool]})]}),(v.note||v.target||v.error)&&d.jsxs("div",{className:"mt-2 space-y-1 text-xs text-dash-text-secondary",children:[v.note&&d.jsx("p",{children:v.note}),v.target&&d.jsxs("p",{className:"mono",children:[t("hookDiagnosticsTargetLabel"),": ",v.target]}),v.error&&d.jsx("p",{className:"text-red-400",children:v.error})]})]},`${v.ts}-${v.hook}-${k}`))})]})};function aP(t){let e=0,n=0,r=0;for(const i of t)i.ownership==="ck"?e++:i.ownership==="user"?n++:i.ownership==="ck-modified"&&r++;return{ck:e,user:n,modified:r}}function lP(t){const e={skills:0,commands:0,rules:0,hooks:0,settings:0,other:0};for(const n of t){const r=n.path;r.startsWith("skills/")?e.skills++:r.startsWith("commands/")?e.commands++:r.startsWith("rules/")?e.rules++:r.startsWith("hooks/")||r==="hooks.json"?e.hooks++:r.startsWith("settings/")||r==="settings.json"?e.settings++:e.other++}return e}const cP=({kitName:t,kit:e,channel:n="stable",externalStatus:r,externalLatestVersion:i,onStatusChange:s,disabled:o})=>{const{t:a}=he(),[l,c]=m.useState("idle"),[h,u]=m.useState(null),[f,p]=m.useState(!1),[g,b]=m.useState(null),x=r??l,w=i??h,v=e.files??[],k=aP(v),j=lP(v),S=async()=>{const y=A=>{s||c(A)},N=A=>{s||u(A)};y("checking"),s&&s("checking",null);try{const T=await(await fetch(`/api/system/check-updates?target=kit&kit=${t}&channel=${n}`)).json();T.updateAvailable?(y("update-available"),N(T.latest),s&&s("update-available",T.latest)):(y("up-to-date"),s&&s("up-to-date",null))}catch{y("idle"),s&&s("idle",null)}},C=async()=>{window.location.reload()};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-5 space-y-4 transition-colors hover:border-dash-accent/30",children:[d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx(Ny,{status:x,ariaLabel:a(x==="up-to-date"?"upToDate":x==="update-available"?"updateAvailable":"checking")}),d.jsxs("h3",{className:"text-base font-semibold text-dash-text capitalize",children:[t," Kit"]}),n==="beta"&&d.jsx("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/15 text-amber-500 rounded border border-amber-500/20",children:a("betaBadge")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-secondary",children:[d.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("currentVersionLabel"),": v",(e.version??"?").replace(/^v/,"")]}),e.installedAt&&d.jsx("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 text-dash-text-muted",children:new Date(e.installedAt).toLocaleDateString()}),d.jsxs("span",{className:"px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70 mono",children:[a("components"),": ",v.length]})]}),x==="update-available"&&w&&d.jsxs("div",{className:"inline-flex items-center rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-1 text-xs text-amber-500 font-medium",children:["v",(e.version??"?").replace(/^v/,"")," ","->"," v",w.replace(/^v/,"")]})]}),d.jsx(dP,{status:x,currentVersion:e.version??"0.0.0",latestVersion:w,kitName:t,onCheck:S,onUpdate:()=>p(!0),onVersionSelect:b,disabled:o})]}),v.length>0&&d.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2 xl:grid-cols-3",children:Object.entries(j).filter(([,y])=>y>0).map(([y,N])=>d.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 bg-dash-bg/70 border border-dash-border rounded-lg text-xs",children:[d.jsx("span",{className:"text-dash-text-secondary capitalize",children:y}),d.jsx("span",{className:"font-bold mono text-dash-text",children:N})]},y))}),v.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-dash-text-muted",children:[d.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 shrink-0"}),k.ck," ",a("ownershipCk")]}),k.user>0&&d.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0"}),k.user," ",a("ownershipUser")]}),k.modified>0&&d.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[d.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 shrink-0"}),k.modified," ",a("ownershipModified")]})]}),v.length===0&&d.jsx("p",{className:"text-xs text-dash-text-muted",children:a("noTrackedFiles")})]}),d.jsx(Ou,{isOpen:f,onClose:()=>p(!1),target:"kit",kitName:t,targetVersion:g??w??void 0,onComplete:C})]})},dP=({status:t,currentVersion:e,latestVersion:n,kitName:r,onCheck:i,onUpdate:s,onVersionSelect:o,disabled:a})=>{const{t:l}=he();return t==="checking"?d.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5 px-2 py-1 rounded-md border border-dash-border bg-dash-bg/70",children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),l("checking")]}):t==="up-to-date"?d.jsx("span",{className:"px-2.5 py-1 text-xs rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-500 font-semibold",children:l("upToDate")}):t==="update-available"&&n?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(Dy,{target:"kit",kitName:r,currentVersion:e,latestVersion:n,onVersionSelect:c=>{o(c),s()}})}):d.jsx("button",{type:"button",onClick:i,disabled:a,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-accent hover:text-dash-accent-hover hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l("checkForUpdates")})},Pm="claudekit-update-channel",Nm="claudekit-system-filter",hP=t=>/-(alpha|beta|rc|dev|next)/.test(t),uP=t=>t==="all"||t==="updates"||t==="up-to-date"||t==="cli"||t==="kits"?t:"all",Dm=t=>t==="update-available"?0:t==="checking"?1:t==="idle"?2:3,fP=({metadata:t})=>{const{t:e}=he(),[n,r]=m.useState(null),[i,s]=m.useState([]),[o,a]=m.useState(!1),[l,c]=m.useState(!1),[h,u]=m.useState(!1),[f,p]=m.useState("stable"),[g,b]=m.useState(()=>uP(localStorage.getItem(Nm))),x=m.useRef(!1),w=m.useRef(0),v=m.useMemo(()=>!t.kits||typeof t.kits!="object"?[]:Object.entries(t.kits),[t.kits]),k=v.length>0,j=t.name,S=t.version,C=t.installedAt,y=v.length>0||j;m.useEffect(()=>{if(!n)return;const U=[];if(U.push({id:"cli",type:"cli",status:"idle",currentVersion:n.cliVersion,latestVersion:null}),k&&v.length>0)for(const[ve,ee]of v){const Ae=ee;U.push({id:ve,type:"kit",status:"idle",currentVersion:Ae.version??"?",latestVersion:null})}else j&&U.push({id:j,type:"kit",status:"idle",currentVersion:S??"?",latestVersion:null});s(U)},[n,k,v,j,S]),m.useEffect(()=>{fetch("/api/system/info").then(U=>U.json()).then(r).catch(()=>r(null))},[]),m.useEffect(()=>{const U=localStorage.getItem(Pm);U==="stable"||U==="beta"?p(U):n?.cliVersion&&p(hP(n.cliVersion)?"beta":"stable")},[n?.cliVersion]);const N=U=>{p(U),localStorage.setItem(Pm,U)};m.useEffect(()=>{localStorage.setItem(Nm,g)},[g]);const A=(U,ve,ee)=>{s(Ae=>Ae.map(pe=>pe.id===U?{...pe,status:ve,latestVersion:ee}:pe))},T=m.useCallback(async()=>{if(i.length===0)return;const U=w.current+1;w.current=U,a(!0),s(ve=>ve.map(ee=>ee.status==="checking"&&ee.latestVersion===null?ee:{...ee,status:"checking",latestVersion:null}));try{const ve=i.map(async Ae=>{try{const pe=Ae.type==="cli"?`target=cli&channel=${f}`:`target=kit&kit=${Ae.id}&channel=${f}`,$=await(await fetch(`/api/system/check-updates?${pe}`)).json();return{id:Ae.id,status:$.updateAvailable?"update-available":"up-to-date",latestVersion:$.latest}}catch{return{id:Ae.id,status:"idle",latestVersion:null}}}),ee=await Promise.all(ve);if(w.current!==U)return;s(Ae=>Ae.map(pe=>{const _e=ee.find($=>$.id===pe.id);return _e?{...pe,status:_e.status,latestVersion:_e.latestVersion}:pe}))}finally{w.current===U&&a(!1)}},[f,i]),P=U=>{b(U),(U==="updates"||U==="up-to-date")&&!o&&!l&&i.length>0&&i.every(ee=>ee.status==="idle")&&(x.current=!0,T())},R=()=>{u(!0)},z=()=>{window.location.reload()},I=i.filter(U=>U.status==="update-available").length,F=i.filter(U=>U.status==="up-to-date").length,G=i.filter(U=>U.status==="up-to-date"||U.status==="update-available").length,ae=i.some(U=>U.status==="checking"),X=k&&v.length>0?v.length:j?1:0,Q=i.find(U=>U.id==="cli")?.status??"idle",le=m.useMemo(()=>k&&v.length>0?v.map(([U,ve])=>({id:U,kitName:U,kit:ve})):j?[{id:j,kitName:j,kit:{version:S,installedAt:C}}]:[],[k,v,j,S,C]),fe=m.useMemo(()=>{const ve=[...le.map(ee=>({...ee,status:i.find(Ae=>Ae.id===ee.id)?.status??"idle"}))].sort((ee,Ae)=>{const pe=Dm(ee.status)-Dm(Ae.status);return pe!==0?pe:ee.kitName.localeCompare(Ae.kitName)});return g==="updates"?ve.filter(ee=>ee.status==="update-available"):g==="up-to-date"?ve.filter(ee=>ee.status==="up-to-date"):g==="cli"?[]:ve},[le,i,g]),W=g==="all"||g==="cli"||g==="updates"&&Q==="update-available"||g==="up-to-date"&&Q==="up-to-date",se=(W?1:0)+fe.length;m.useEffect(()=>{if(!(!(g==="updates"||g==="up-to-date")||x.current)&&!(o||l||i.length===0)){if(!i.every(ve=>ve.status==="idle")){x.current=!0;return}x.current=!0,T()}},[T,o,l,i,g]);const ue=m.useMemo(()=>se!==0?"":(g==="updates"||g==="up-to-date")&&ae?e("checkingAll"):(g==="updates"||g==="up-to-date")&&G===0?e("runCheckAllForFilter"):g==="updates"&&G>0&&I===0?e("noUpdatesFound"):g==="up-to-date"&&G>0&&F===0?e("noUpToDateYet"):e("noComponentsMatchFilter"),[se,g,ae,G,I,F,e]),xe=!y&&g!=="cli",Pe=e("componentFilterUpdatesCount").replace("{count}",I.toString()),Qe=e("componentFilterUpToDateCount").replace("{count}",F.toString());return d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[d.jsx("div",{className:"absolute -top-20 -right-8 h-56 w-56 rounded-full bg-dash-accent/10 blur-3xl"}),d.jsx("div",{className:"absolute -bottom-24 -left-10 h-64 w-64 rounded-full bg-dash-accent/5 blur-3xl"})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsx("section",{className:"dash-panel dash-sticky-glass p-4 md:p-5 sticky top-0 z-10",children:d.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"mono text-[10px] uppercase tracking-[0.16em] text-dash-text-muted",children:e("systemControlTower")}),d.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:e("systemOverviewTitle")}),d.jsx("p",{className:"text-sm text-dash-text-secondary max-w-2xl",children:e("systemOverviewDesc")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(eP,{value:f,onChange:N,disabled:o||l}),i.length>0&&d.jsx(ZO,{components:i,isChecking:o,isUpdating:l,onCheckAll:T,onUpdateAll:R})]})]})}),d.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-5",children:[d.jsx(Xi,{label:e("components"),value:i.length.toString()}),d.jsx(Xi,{label:e("kitsLabel"),value:X.toString()}),d.jsx(Xi,{label:e("updateAvailable"),value:I.toString(),tone:"accent"}),d.jsx(Xi,{label:e("upToDate"),value:F.toString(),tone:"success"}),d.jsx(Xi,{label:e("checkedComponents"),value:G.toString()})]}),d.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]",children:[d.jsxs("div",{className:"space-y-3 min-w-0",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-1",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("installedComponentsHeading")}),d.jsxs("fieldset",{className:"flex items-center gap-2",children:[d.jsx("legend",{className:"sr-only",children:e("installedComponentsHeading")}),d.jsx(Zi,{label:e("componentFilterAll"),value:g,activeValue:"all",onClick:()=>P("all")}),d.jsx(Zi,{label:Pe,value:g,activeValue:"updates",onClick:()=>P("updates")}),d.jsx(Zi,{label:Qe,value:g,activeValue:"up-to-date",onClick:()=>P("up-to-date")}),d.jsx(Zi,{label:e("componentFilterCli"),value:g,activeValue:"cli",onClick:()=>P("cli")}),d.jsx(Zi,{label:e("componentFilterKits"),value:g,activeValue:"kits",onClick:()=>P("kits")})]})]}),W&&d.jsx(nP,{version:n?.cliVersion??"...",installedAt:void 0,externalStatus:i.find(U=>U.id==="cli")?.status,externalLatestVersion:i.find(U=>U.id==="cli")?.latestVersion??null,onStatusChange:(U,ve)=>A("cli",U,ve),disabled:o||l,channel:f}),fe.map(U=>{const ve=i.find(ee=>ee.id===U.id);return d.jsx(cP,{kitName:U.kitName,kit:U.kit,externalStatus:ve?.status,externalLatestVersion:ve?.latestVersion??null,onStatusChange:(ee,Ae)=>A(U.id,ee,Ae),disabled:o||l,channel:f},U.id)}),xe&&d.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:d.jsx("p",{className:"text-sm text-dash-text-secondary",children:e("noKitInstalled")})}),!xe&&se===0&&d.jsx("div",{className:"dash-panel-muted p-6 text-center opacity-80",children:d.jsx("p",{className:"text-sm text-dash-text-secondary",children:ue})})]}),d.jsxs("aside",{className:"space-y-3 xl:sticky xl:top-20 self-start",children:[d.jsxs("div",{className:"dash-panel p-4 space-y-3",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:e("updateReadiness")}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Ra,{label:e("updateAvailable"),value:I.toString(),tone:I>0?"accent":"default"}),d.jsx(Ra,{label:e("upToDate"),value:F.toString(),tone:"success"}),d.jsx(Ra,{label:e("checkedComponents"),value:G.toString()}),d.jsx(Ra,{label:e("activeChannel"),value:e(f==="beta"?"channelBeta":"channelStable")})]})]}),n&&d.jsx(iP,{configPath:n.configPath,nodeVersion:n.nodeVersion,bunVersion:n.bunVersion,os:n.os}),d.jsx(oP,{})]})]})]}),d.jsx(Ou,{isOpen:h,onClose:()=>u(!1),target:"cli",mode:"batch",components:i.filter(U=>U.status==="update-available").map(U=>({id:U.id,name:U.id==="cli"?"CLI":`${U.id} Kit`})),onComplete:z})]})},Xi=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-emerald-500":"text-dash-text";return d.jsxs("div",{className:"dash-panel p-3",children:[d.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t}),d.jsx("p",{className:`mt-1 mono text-xl font-semibold ${r}`,children:e})]})},Ra=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-emerald-500":"text-dash-text-secondary";return d.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2",children:[d.jsx("span",{className:"text-xs text-dash-text-muted",children:t}),d.jsx("span",{className:`mono text-xs font-semibold ${r}`,children:e})]})},Zi=({label:t,value:e,activeValue:n,onClick:r})=>{const i=e===n;return d.jsx("button",{type:"button",onClick:r,"aria-pressed":i,className:`dash-focus-ring px-2.5 py-1.5 rounded-lg text-[11px] font-semibold border transition-colors ${i?"border-dash-accent/30 bg-dash-accent-subtle text-dash-accent":"border-dash-border bg-dash-surface text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t})},Xc="~/.claude/settings.json",La="{}",pP=()=>{const{t}=he(),[e,n]=m.useState(!0),[r,i]=m.useState(Xc),[s,o]=m.useState(La),[a,l]=m.useState(La),[c,h]=m.useState(0),[u,f]=m.useState(!1),[p,g]=m.useState(!1),[b,x]=m.useState("idle"),[w,v]=m.useState(null),[k,j]=m.useState(null);m.useEffect(()=>{let A=!1;return(async()=>{n(!0),g(!1);try{const P=await R2();if(A)return;const R=JSON.stringify(P.settings??{},null,2);i(P.path||Xc),f(!!P.exists),o(R),l(R),v(null)}catch{if(A)return;g(!0),f(!1),i(Xc),o(La),l(La)}finally{A||n(!1)}})(),()=>{A=!0}},[]);const S=A=>{l(A),j(null);try{JSON.parse(A),v(null)}catch(T){v(T instanceof Error?T.message:"Invalid JSON")}},C=()=>{l(s),v(null),j(null),x("idle")},y=async()=>{if(!(e||w)){x("saving"),j(null);try{const A=JSON.parse(a),T=JSON.stringify(A,null,2),P=await L2(A);o(T),l(T),f(!0),x("saved"),j(P.backupPath?`${t("settingsBackupSaved")}: ${P.backupPath}`:t("saved")),setTimeout(()=>x("idle"),2e3)}catch(A){x("error"),j(A instanceof Error?A.message:t("saveFailed")),setTimeout(()=>x("idle"),3e3)}}},N=a!==s;return d.jsxs("section",{className:"h-full min-h-0 flex flex-col rounded-xl border border-dash-border bg-dash-surface p-3 shadow-sm",children:[d.jsxs("div",{className:"mb-2 flex items-end justify-between gap-3 px-1",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-dash-text",children:t("settingsJsonHeading")}),d.jsx("p",{className:"mono text-[11px] text-dash-text-muted truncate",children:r})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:C,disabled:e||!N||b==="saving",className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border disabled:opacity-50 disabled:cursor-not-allowed",children:t("discard")}),d.jsx("button",{type:"button",onClick:y,disabled:e||b==="saving"||!!w||!N,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase disabled:opacity-50 disabled:cursor-not-allowed ${b==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":b==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:t(b==="saving"?"saving":b==="saved"?"saved":b==="error"?"saveFailed":"saveChanges")})]})]}),d.jsx("div",{className:"flex-1 min-h-0",children:d.jsx(ju,{width:100,isLoading:e,jsonText:a,cursorLine:c,syntaxError:w,onChange:S,onCursorLineChange:h})}),k&&d.jsx("p",{className:`mt-2 px-1 text-xs ${b==="error"?"text-red-500":"text-dash-text-muted"}`,children:k}),!e&&!p&&!u&&d.jsx("p",{className:"mt-2 px-1 text-xs text-dash-text-muted",children:t("settingsJsonMissing")}),!e&&p&&d.jsx("p",{className:"mt-2 px-1 text-xs text-red-500",children:t("settingsJsonLoadFailed")})]})},mP=(t,e)=>{const[n,r]=m.useState(null);return m.useEffect(()=>{const i=t.split(`
247
- `),s=[];let o=null;for(let a=0;a<=Math.min(e,i.length-1);a++){const l=i[a].trim(),c=l.match(/"([^"]+)"\s*:\s*{/);if(c){s.push(c[1]),a===e&&(o=s.join("."));continue}if(l==="}"||l==="},"){s.pop();continue}const h=l.match(/"([^"]+)"\s*:/);if(h){const u=h[1];if(a===e){o=s.length>0?`${s.join(".")}.${u}`:u;break}}}r(o)},[t,e]),n};function Ay(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:i,onReset:s}=t,[o,a]=m.useState("{}"),[l,c]=m.useState(0),[h,u]=m.useState(null),[f,p]=m.useState(null),[g,b]=m.useState({}),[x,w]=m.useState({}),[v,k]=m.useState({}),[j,S]=m.useState(!0),[C,y]=m.useState("idle"),[N,A]=m.useState(!1),[T,P]=m.useState(null),[R,z]=m.useState(null),I=mP(o,l),F=q2(R,I),G=m.useMemo(()=>G2(F,f),[F,f]);m.useEffect(()=>{(async()=>{try{const[se,ue]=await Promise.all([n(),r()]),xe=se.local??se.config;b(xe),w(se.global??{}),k(se.sources),p(ue),a(JSON.stringify(xe,null,2))}catch(se){console.error("Failed to load config data:",se)}finally{S(!1)}})()},[n,r]),m.useEffect(()=>{try{JSON.parse(o),u(null)}catch(W){u(W instanceof Error?W.message:"Invalid JSON")}},[o]),m.useEffect(()=>{if(T==="json")try{const W=JSON.parse(o);b(W)}catch{}},[o,T]);const ae=m.useCallback(W=>{z(null),P("json"),a(W)},[]),X=m.useCallback(()=>{z(null)},[]),Q=m.useCallback((W,se)=>{z(W),P("form"),b(ue=>{const xe=U2(ue,W,se);return a(JSON.stringify(xe,null,2)),xe}),k(ue=>({...ue,[W]:e}))},[e]),le=m.useCallback(async()=>{if(!h){y("saving");try{const W=JSON.parse(o),ue=await i(W)??W;b(ue),a(JSON.stringify(ue,null,2)),y("saved"),setTimeout(()=>y("idle"),2e3)}catch{y("error"),setTimeout(()=>y("idle"),3e3)}}},[o,h,i]),fe=m.useCallback(async()=>{if(A(!1),s){S(!0);try{const W=await s(),se=W.local??W.config;b(se),k(W.sources),a(JSON.stringify(se,null,2))}catch(W){console.error("Failed to reset:",W)}finally{S(!1)}}else{const W={};b(W),a(JSON.stringify(W,null,2))}},[s]);return{jsonText:o,config:g,globalConfig:x,sources:v,schema:f,isLoading:j,saveStatus:C,syntaxError:h,cursorLine:l,showResetConfirm:N,activeFieldPath:F,fieldDoc:G,handleJsonChange:ae,handleJsonEditorFocus:X,handleFormChange:Q,handleSave:le,handleReset:fe,setCursorLine:c,setFocusedFieldPath:z,setShowResetConfirm:A}}function Oh({storageKey:t,defaultSizes:e,minSizes:n}){const[r,i]=m.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(t);if(c)try{const h=JSON.parse(c);if(Array.isArray(h)&&h.length===e.length){const u=h.reduce((f,p)=>f+p,0);if(Math.abs(u-100)<1)return h}}catch{}return e}),[s,o]=m.useState(!1);m.useEffect(()=>{localStorage.setItem(t,JSON.stringify(r))},[r,t]);const a=m.useCallback((c,h)=>{h.preventDefault(),o(!0);const u=h.target.parentElement;if(!u)return;const p=u.getBoundingClientRect().width,g=h.clientX,b=[...r],x=v=>{const j=(v.clientX-g)/p*100,S=[...b],C=c,y=c+1;let N=b[C]+j,A=b[y]-j;N<n[C]&&(N=n[C],A=b[C]+b[y]-N),A<n[y]&&(A=n[y],N=b[C]+b[y]-A),S[C]=N,S[y]=A,i(S)},w=()=>{o(!1),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",x),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,n]),l=m.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const zo="/api";async function Am(t){const e=`${zo}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function Mm(t,e){const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${zo}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function My(t){const e=await fetch(`${zo}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(n.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function Ty(){const t=await fetch(`${zo}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}async function gP(t,e,n,r){const i=await fetch(`${zo}/ck-config/field`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n,projectId:r,fieldPath:t,value:e})});if(!i.ok){const s=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Failed to update field: ${i.status}`)}}const bP=.58,es=280,Ph=240,xP=80;function yP(t,e,n){return Math.min(Math.max(t,e),n)}function vP(t,e){if(typeof window>"u")return e;const n=localStorage.getItem(t);if(!n)return e;const r=Number.parseFloat(n);if(Number.isNaN(r))return e;if(r>0&&r<1)return r;if(r>=1){const i=Math.max(window.innerHeight-220,r+Ph);return Math.min(.75,Math.max(.35,r/i))}return e}function wP(t,e,n,r){const[i,s]=m.useState(()=>typeof window>"u"?e:vP(t,e)),[o,a]=m.useState(!1),l=m.useCallback(c=>{c.preventDefault(),a(!0);const h=c.target.closest("[data-vresize-container]");if(!h)return;const u=p=>{const g=h.getBoundingClientRect(),b=g.height||1,x=(p.clientY-g.top)/b,w=n/b,v=Math.max(w,1-r/b);s(Math.max(w,Math.min(v,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[r,n]);return m.useEffect(()=>{localStorage.setItem(t,String(i))},[t,i]),{topRatio:i,isDragging:o,startDrag:l}}function SP(){const[t,e]=m.useState(null),[n,r]=m.useState(0),i=m.useCallback(s=>{e(s)},[]);return m.useEffect(()=>{if(!t)return;const s=()=>{r(t.getBoundingClientRect().height)};if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{s()});return o.observe(t),()=>o.disconnect()},[t]),{ref:i,height:n}}const kP=()=>{const{t}=he(),e=Tn(),[n,r]=m.useState("config"),[i,s]=m.useState({}),[o,a]=m.useState(es),[l,c]=m.useState(!1),{sizes:h,isDragging:u,startDrag:f}=Oh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:p,isDragging:g,startDrag:b}=Oh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),x=wP("claudekit-form-taxonomy-px",bP,es,Ph),{ref:w,height:v}=SP(),k=m.useCallback(async()=>{const[I,F]=await Promise.all([Am(),F2()]);return s(F),I},[]),j=m.useCallback(async I=>(await My({scope:"global",config:I})).config,[]),S=m.useCallback(async()=>await Am(),[]),C=Ay({scope:"global",fetchConfig:k,fetchSchema:Ty,saveConfig:j,onReset:S}),y=m.useMemo(()=>[{id:"general",title:t("sectionGeneral"),fields:[{path:"codingLevel",label:t("fieldCodingLevel"),description:t("fieldCodingLevelDesc")},{path:"statusline",label:t("fieldStatusline"),description:t("fieldStatuslineDesc")},{path:"statuslineColors",label:t("fieldStatuslineColors"),description:t("fieldStatuslineColorsDesc")},{path:"statuslineQuota",label:t("fieldStatuslineQuota"),description:t("fieldStatuslineQuotaDesc")},{path:"locale.thinkingLanguage",label:t("fieldThinkingLanguage"),description:t("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:t("fieldResponseLanguage"),description:t("fieldResponseLanguageDesc")}]},{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:t("fieldTrustEnabled"),description:t("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:t("fieldTrustPassphrase"),description:t("fieldTrustPassphraseDesc")}]},{id:"project",title:t("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"integrations",title:t("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:t("fieldGeminiModel"),description:t("fieldGeminiModelDesc"),editable:!0,enumLabels:{"gemini-2.5-flash":t("geminiModel25Flash"),"gemini-2.5-pro":t("geminiModel25Pro"),"gemini-3-flash-preview":t("geminiModel3FlashPreview"),"gemini-3-pro-preview":t("geminiModel3ProPreview")}},{path:"skills.research.useGemini",label:t("fieldResearchUseGemini"),description:t("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:t("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:t("fieldHookSessionInit"),description:t("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:t("fieldHookSubagentInit"),description:t("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:t("fieldHookDescriptiveName"),description:t("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:t("fieldHookDevRulesReminder"),description:t("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:t("fieldHookUsageContextAwareness"),description:t("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:t("fieldHookContextTracking"),description:t("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:t("fieldHookScoutBlock"),description:t("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:t("fieldHookPrivacyBlock"),description:t("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:t("fieldHookPostEditSimplify"),description:t("fieldHookPostEditSimplifyDesc")}]},{id:"updatePipeline",title:t("sectionUpdatePipeline"),defaultCollapsed:!0,fields:[{path:"updatePipeline.autoInitAfterUpdate",label:t("fieldAutoInitAfterUpdate"),description:t("fieldAutoInitAfterUpdateDesc")},{path:"updatePipeline.autoMigrateAfterUpdate",label:t("fieldAutoMigrateAfterUpdate"),description:t("fieldAutoMigrateAfterUpdateDesc")},{path:"updatePipeline.migrateProviders",label:t("fieldMigrateProviders"),description:t("fieldMigrateProvidersDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:t("fieldPlanDateFormat"),description:t("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:t("fieldPlanValidationMode"),description:t("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:t("fieldPlanMinQuestions"),description:t("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:t("fieldPlanMaxQuestions"),description:t("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:t("fieldAssertions"),description:t("fieldAssertionsDesc")}]}],[t]),N=m.useMemo(()=>{if(v<=0)return null;const I=Math.max(es,v-Ph);return yP(x.topRatio*v,es,I)},[x.topRatio,v]),A=m.useMemo(()=>l||N===null?null:Math.min(N,o),[o,l,N]),T=m.useMemo(()=>{if(!l||v<=0)return null;const I=Math.max(es,v-xP);return Math.min(o,I)},[o,l,v]),P=l?T:A,R=!C.isLoading&&!l&&A!==null,z=C.showResetConfirm?d.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[d.jsx("span",{className:"text-xs text-red-500 font-medium",children:t("confirmReset")}),d.jsx("button",{type:"button",onClick:C.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),d.jsx("button",{type:"button",onClick:()=>C.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>C.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),d.jsx("button",{type:"button",onClick:C.handleSave,disabled:!!C.syntaxError||C.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${C.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":C.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":C.saveStatus==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:C.saveStatus==="saving"?t("saving"):C.saveStatus==="saved"?t("saved"):C.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return d.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[d.jsx(N0,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:C.handleSave,onReset:C.handleReset,saveStatus:C.saveStatus,syntaxError:C.syntaxError,showResetConfirm:C.showResetConfirm,setShowResetConfirm:C.setShowResetConfirm,showActions:!1,showFilePath:!1}),d.jsxs("div",{className:"mb-3 shrink-0 flex items-center justify-between gap-3",children:[d.jsxs("div",{role:"tablist","aria-label":t("globalConfig"),className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 shadow-sm",children:[d.jsx("button",{role:"tab","aria-selected":n==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("configTab")}),d.jsx("button",{role:"tab","aria-selected":n==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("systemTab")})]}),d.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:t("configWorkspaceHint")})]}),d.jsxs("div",{className:"flex-1 flex min-h-0",children:[n==="config"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{ref:w,"data-vresize-container":!0,style:{width:`${h[0]}%`},className:"flex flex-col min-w-0 min-h-0 h-full",children:[d.jsx("div",{style:P!==null?{height:`${P}px`}:void 0,className:`min-h-0 ${P!==null?"shrink-0":"flex-1"}`,children:d.jsx(T0,{width:100,isLoading:C.isLoading,schema:C.schema,config:C.config,sources:C.sources,sections:y,onChange:C.handleFormChange,onFieldFocus:C.setFocusedFieldPath,onNaturalHeightChange:a})}),!C.isLoading&&d.jsxs(d.Fragment,{children:[l&&P!==null&&d.jsx("div",{className:"flex-1"}),R&&d.jsx(rr,{direction:"vertical",isDragging:x.isDragging,onMouseDown:x.startDrag}),d.jsx("div",{className:l?"shrink-0":"flex-1 min-h-0 overflow-hidden",children:d.jsx(XO,{config:C.config,onChange:C.handleFormChange,isCollapsed:l,onCollapsedChange:c})})]})]}),d.jsx(rr,{direction:"horizontal",isDragging:u,onMouseDown:I=>f(0,I)}),d.jsx(ju,{width:h[1],isLoading:C.isLoading,jsonText:C.jsonText,cursorLine:C.cursorLine,syntaxError:C.syntaxError,onChange:C.handleJsonChange,onEditorFocus:C.handleJsonEditorFocus,onCursorLineChange:C.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:z}),d.jsx(rr,{direction:"horizontal",isDragging:u,onMouseDown:I=>f(1,I)}),d.jsx(Py,{width:h[2],fieldDoc:C.fieldDoc,activeFieldPath:C.activeFieldPath})]}),n==="metadata"&&d.jsxs("div",{className:"flex-1 min-h-0 flex",children:[d.jsx("div",{style:{width:`${p[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:C.isLoading?d.jsx("div",{className:"dash-panel h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:t("loading")})}):d.jsx(fP,{metadata:i})}),d.jsx(rr,{direction:"horizontal",isDragging:g,onMouseDown:I=>b(0,I)}),d.jsx("div",{style:{width:`${p[1]}%`},className:"min-w-0 h-full overflow-hidden",children:d.jsx(pP,{})})]})]})]})};function CP({phase:t}){const e=t.status==="completed"?"border-green-500":t.status==="in-progress"?"border-blue-500":"border-amber-400";return d.jsx("div",{className:`rounded border-l-4 ${e} bg-white dark:bg-gray-800 p-3 shadow-sm`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:t.phaseId}),d.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:t.name})]})})}function Zc({title:t,phases:e,borderColor:n}){return d.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${t} phases`,children:[d.jsxs("div",{className:`rounded-t border-t-2 ${n} bg-gray-50 dark:bg-gray-900 px-3 py-2`,children:[d.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:t}),d.jsx("span",{className:"ml-2 text-xs text-gray-400",children:e.length})]}),d.jsx("div",{className:"flex flex-col gap-2 px-1",children:e.map((r,i)=>d.jsx(CP,{phase:r},`${r.phaseId}-${i}`))})]})}function jP({completed:t,total:e}){const{t:n}=he(),r=e===0?0:Math.round(t/e*100);return d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs("div",{className:"flex justify-between text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{children:n("kanbanProgress")}),d.jsxs("span",{children:[t,"/",e," ",n("kanbanPhases")," — ",r,"% ",n("kanbanComplete")]})]}),d.jsx("div",{className:"h-2 w-full rounded bg-gray-200 dark:bg-gray-700",children:d.jsx("div",{className:"h-2 rounded bg-green-500 transition-all",style:{width:`${r}%`}})})]})}function OP(){const{t}=he(),[e]=g2(),n=e.get("file")??"",[r,i]=m.useState([]),[s,o]=m.useState(!1),[a,l]=m.useState(null);if(m.useEffect(()=>{n&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(n)}`).then(p=>{if(!p.ok){const g={400:"kanbanError400",403:"kanbanError403",404:"kanbanError404"};throw new Error(g[p.status]??`error:HTTP:${p.status}`)}return p.json()}).then(p=>i(p.phases)).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>o(!1)))},[n]),!n)return d.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoFile")});let c=[],h=[],u=[],f=null;try{c=r.filter(p=>p.status==="pending"),h=r.filter(p=>p.status==="in-progress"),u=r.filter(p=>p.status==="completed")}catch(p){f=p instanceof Error?p.message:String(p)}return f?d.jsx("div",{className:"flex h-full items-center justify-center text-red-500 dark:text-red-400",children:t("kanbanLoadError")}):d.jsxs("div",{className:"flex h-full flex-col gap-4 p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:t("kanbanTitle")}),d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:n,children:n.replaceAll("\\","/")})]}),r.length>0&&d.jsx(jP,{completed:u.length,total:r.length}),s&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:t("loading")}),a&&d.jsxs("div",{className:"rounded border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400",children:[t("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?t(a):a]}),!s&&!a&&r.length===0&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoPhases")}),!s&&!a&&r.length>0&&d.jsxs("section",{"aria-label":t("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[d.jsx(Zc,{title:t("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),d.jsx(Zc,{title:t("kanbanStatus_in-progress"),phases:h,borderColor:"border-blue-500"}),d.jsx(Zc,{title:t("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const Tm=[{key:"agent",labelKey:"migrateTypeAgents",badgeClass:"border-dash-accent/30 text-dash-accent"},{key:"command",labelKey:"migrateTypeCommands",badgeClass:"border-yellow-500/30 text-yellow-400"},{key:"skill",labelKey:"migrateTypeSkills",badgeClass:"border-purple-500/30 text-purple-400"},{key:"config",labelKey:"migrateTypeConfig",badgeClass:"border-teal-500/30 text-teal-400"},{key:"rules",labelKey:"migrateTypeRules",badgeClass:"border-rose-500/30 text-rose-400"},{key:"hooks",labelKey:"migrateTypeHooks",badgeClass:"border-cyan-500/30 text-cyan-400"}],PP=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function NP(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||PP.has(t)}function Pr(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(NP(r)||(e+=n))}return e}function Em(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const i=(n.index??0)+n[0].length-n[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function oi(t){return t.success?t.skipped?"skipped":"installed":"failed"}function DP(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=oi(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function Ey(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function AP(t,e){switch(t){case"failed":return{label:e("migrateStatusFailed"),className:"border-red-500/30 bg-red-500/10 text-red-400"};case"skipped":return{label:e("migrateStatusSkipped"),className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"};default:return{label:e("migrateStatusInstalled"),className:"border-green-500/30 bg-green-500/10 text-green-400"}}}function MP(t){const e=new Map;for(const n of t){const r=Ey(n.portableType),i=e.get(r)||[];i.push(n),e.set(r,i)}return e}function TP(t){return[Ey(t.portableType),t.provider,t.providerDisplayName,t.itemName,t.path,t.success,t.skipped,t.overwritten,t.error,t.skipReason].map(n=>n===void 0?"":String(n)).join("|")}function EP(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const mi=({label:t,count:e,className:n})=>e<=0?null:d.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[d.jsx("span",{className:"font-semibold",children:e}),d.jsx("span",{children:t})]}),Rm=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=he(),a=n.filter(f=>oi(f)==="installed").length,l=n.filter(f=>oi(f)==="skipped").length,c=n.filter(f=>oi(f)==="failed").length,h=s?"md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.35fr)_auto_minmax(0,1fr)]":"md:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,1.2fr)_auto_minmax(0,1fr)]",u=new Map;return d.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:i,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[d.jsx("svg",{className:`w-3.5 h-3.5 text-dash-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{d:"M9 5l7 7-7 7"})}),d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(t)}),d.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.length}),d.jsx("span",{className:"hidden sm:block flex-1"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[d.jsx(mi,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(mi,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(mi,{label:o("migrateStatusFailed"),count:c,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&d.jsxs("div",{className:"border-t border-dash-border/80",children:[d.jsxs("div",{className:`hidden md:grid ${h} items-center gap-3 px-4 py-2 border-b border-dash-border/70 text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted`,children:[d.jsx("p",{children:o("migrateItem")}),!s&&d.jsx("p",{children:o("migrateProvider")}),d.jsx("p",{children:o("migratePath")}),d.jsx("p",{children:o("migrateStatus")}),d.jsx("p",{children:o("migrateError")})]}),d.jsx("div",{className:"divide-y divide-dash-border/70",children:n.map(f=>{const p=TP(f),g=u.get(p)??0;u.set(p,g+1);const b=g===0?p:`${p}#${g}`,x=oi(f),w=AP(x,o),v=Pr(f.itemName||Em(f.path)),k=Pr(f.providerDisplayName||f.provider||""),j=Pr(f.path||""),S=Pr(Em(f.path)),C=Pr(f.error||f.skipReason||"");return d.jsxs("div",{className:`grid gap-1.5 ${h} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:v,children:v}),d.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!s&&d.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:k}),d.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:j,children:S}),C&&d.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:C,children:C})]})]}),!s&&d.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:k}),d.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:j,children:S}),d.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${w.className}`,children:w.label}),d.jsx("p",{className:`hidden md:block text-[11px] truncate ${C?"text-red-400/80":"text-dash-text-muted"}`,title:C,children:C||"-"})]},b)})})]})]})},RP=({results:t,onReset:e})=>{const{t:n}=he(),[r,i]=m.useState(""),s=m.useDeferredValue(r),[o,a]=m.useState("all"),[l,c]=m.useState(()=>new Set(Tm.map(j=>j.key))),h=m.useMemo(()=>{const j=s.trim().toLowerCase();return t.results.filter(S=>{if(o!=="all"&&oi(S)!==o)return!1;if(!j)return!0;const C=(S.itemName||"").toLowerCase(),y=(S.path||"").toLowerCase(),N=(S.providerDisplayName||S.provider||"").toLowerCase();return C.includes(j)||y.includes(j)||N.includes(j)})},[t.results,s,o]),u=m.useMemo(()=>EP(h),[h]),f=m.useMemo(()=>{if(!u||h.length===0)return"";const j=Array.from(new Set(h.map(S=>S.providerDisplayName?.trim()||"").filter(S=>S.length>0)));return j.length===1?j[0]:h[0]?.provider||""},[h,u]),p=m.useMemo(()=>MP(h),[h]),g=m.useMemo(()=>DP(t.results),[t.results]),b=m.useMemo(()=>[...p.keys()],[p]),x=g.installed+g.skipped+g.failed,w=b.length>0&&b.every(j=>l.has(j)),v=j=>{c(S=>{const C=new Set(S);return C.has(j)?C.delete(j):C.add(j),C})},k=()=>{if(w){c(new Set);return}c(new Set(b))};return d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[n("migrateSummaryTitle"),u&&f&&d.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Pr(f)]})]}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[x," ",n("migrateSummarySubtitle")]})]}),d.jsx("button",{type:"button",onClick:e,className:"dash-focus-ring px-4 py-2 text-sm font-semibold rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n("migrateSummaryNewMigration")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[d.jsx(mi,{label:n("migrateStatusInstalled"),count:g.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(mi,{label:n("migrateStatusSkipped"),count:g.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(mi,{label:n("migrateStatusFailed"),count:g.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&d.jsx("div",{className:"space-y-2",children:t.warnings.map((j,S)=>d.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Pr(j)},S))}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"relative",children:[d.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),d.jsx("input",{type:"text",value:r,onChange:j=>i(j.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(j=>{const S=j==="all"?"migrateSummaryFilterAll":j==="installed"?"migrateStatusInstalled":j==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return d.jsx("button",{type:"button",onClick:()=>a(j),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===j?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:n(S)},j)}),d.jsx("button",{type:"button",onClick:k,className:"dash-focus-ring ml-1 px-3 py-1 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n(w?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),h.length===0?d.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):d.jsxs("div",{className:"space-y-2.5",children:[Tm.map(j=>{const S=p.get(j.key);return!S||S.length===0?null:d.jsx(Rm,{labelKey:j.labelKey,badgeClass:j.badgeClass,items:S,isExpanded:l.has(j.key),onToggle:()=>v(j.key),singleProvider:u},j.key)}),(()=>{const j=p.get("unknown");return!j||j.length===0?null:d.jsx(Rm,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:j,isExpanded:l.has("unknown"),onToggle:()=>v("unknown"),singleProvider:u})})()]})]})},LP=500;function IP(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function $P(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(IP(r)||(e+=n))}return e}const BP=({diff:t,className:e=""})=>{const n=t.split(`
243
+ `),s=[];let o=null;for(let a=0;a<=Math.min(e,i.length-1);a++){const l=i[a].trim(),c=l.match(/"([^"]+)"\s*:\s*{/);if(c){s.push(c[1]),a===e&&(o=s.join("."));continue}if(l==="}"||l==="},"){s.pop();continue}const h=l.match(/"([^"]+)"\s*:/);if(h){const u=h[1];if(a===e){o=s.length>0?`${s.join(".")}.${u}`:u;break}}}r(o)},[t,e]),n};function Ay(t){const{scope:e,fetchConfig:n,fetchSchema:r,saveConfig:i,onReset:s}=t,[o,a]=m.useState("{}"),[l,c]=m.useState(0),[h,u]=m.useState(null),[f,p]=m.useState(null),[g,b]=m.useState({}),[x,w]=m.useState({}),[v,k]=m.useState({}),[j,S]=m.useState(!0),[C,y]=m.useState("idle"),[N,A]=m.useState(!1),[T,P]=m.useState(null),[R,z]=m.useState(null),I=mP(o,l),F=q2(R,I),G=m.useMemo(()=>G2(F,f),[F,f]);m.useEffect(()=>{(async()=>{try{const[se,ue]=await Promise.all([n(),r()]),xe=se.local??se.config;b(xe),w(se.global??{}),k(se.sources),p(ue),a(JSON.stringify(xe,null,2))}catch(se){console.error("Failed to load config data:",se)}finally{S(!1)}})()},[n,r]),m.useEffect(()=>{try{JSON.parse(o),u(null)}catch(W){u(W instanceof Error?W.message:"Invalid JSON")}},[o]),m.useEffect(()=>{if(T==="json")try{const W=JSON.parse(o);b(W)}catch{}},[o,T]);const ae=m.useCallback(W=>{z(null),P("json"),a(W)},[]),X=m.useCallback(()=>{z(null)},[]),Q=m.useCallback((W,se)=>{z(W),P("form"),b(ue=>{const xe=U2(ue,W,se);return a(JSON.stringify(xe,null,2)),xe}),k(ue=>({...ue,[W]:e}))},[e]),le=m.useCallback(async()=>{if(!h){y("saving");try{const W=JSON.parse(o),ue=await i(W)??W;b(ue),a(JSON.stringify(ue,null,2)),y("saved"),setTimeout(()=>y("idle"),2e3)}catch{y("error"),setTimeout(()=>y("idle"),3e3)}}},[o,h,i]),fe=m.useCallback(async()=>{if(A(!1),s){S(!0);try{const W=await s(),se=W.local??W.config;b(se),k(W.sources),a(JSON.stringify(se,null,2))}catch(W){console.error("Failed to reset:",W)}finally{S(!1)}}else{const W={};b(W),a(JSON.stringify(W,null,2))}},[s]);return{jsonText:o,config:g,globalConfig:x,sources:v,schema:f,isLoading:j,saveStatus:C,syntaxError:h,cursorLine:l,showResetConfirm:N,activeFieldPath:F,fieldDoc:G,handleJsonChange:ae,handleJsonEditorFocus:X,handleFormChange:Q,handleSave:le,handleReset:fe,setCursorLine:c,setFocusedFieldPath:z,setShowResetConfirm:A}}function Oh({storageKey:t,defaultSizes:e,minSizes:n}){const[r,i]=m.useState(()=>{if(typeof window>"u")return e;const c=localStorage.getItem(t);if(c)try{const h=JSON.parse(c);if(Array.isArray(h)&&h.length===e.length){const u=h.reduce((f,p)=>f+p,0);if(Math.abs(u-100)<1)return h}}catch{}return e}),[s,o]=m.useState(!1);m.useEffect(()=>{localStorage.setItem(t,JSON.stringify(r))},[r,t]);const a=m.useCallback((c,h)=>{h.preventDefault(),o(!0);const u=h.target.parentElement;if(!u)return;const p=u.getBoundingClientRect().width,g=h.clientX,b=[...r],x=v=>{const j=(v.clientX-g)/p*100,S=[...b],C=c,y=c+1;let N=b[C]+j,A=b[y]-j;N<n[C]&&(N=n[C],A=b[C]+b[y]-N),A<n[y]&&(A=n[y],N=b[C]+b[y]-A),S[C]=N,S[y]=A,i(S)},w=()=>{o(!1),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",x),document.addEventListener("mouseup",w),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[r,n]),l=m.useCallback(()=>{i(e)},[e]);return{sizes:r,isDragging:s,startDrag:a,reset:l}}const zo="/api";async function Am(t){const e=`${zo}/ck-config`,n=await fetch(e);if(!n.ok)throw new Error(`Failed to fetch ck-config: ${n.status}`);return n.json()}async function Mm(t,e){const n=new URLSearchParams({scope:t});e&&n.set("projectId",e);const r=await fetch(`${zo}/ck-config?${n}`);if(!r.ok)throw new Error(`Failed to fetch ck-config: ${r.status}`);return r.json()}async function My(t){const e=await fetch(`${zo}/ck-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(n.error||`Failed to save ck-config: ${e.status}`)}return e.json()}async function Ty(){const t=await fetch(`${zo}/ck-config/schema`);if(!t.ok)throw new Error(`Failed to fetch schema: ${t.status}`);return t.json()}async function gP(t,e,n,r){const i=await fetch(`${zo}/ck-config/field`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n,projectId:r,fieldPath:t,value:e})});if(!i.ok){const s=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Failed to update field: ${i.status}`)}}const bP=.58,es=280,Ph=240,xP=80;function yP(t,e,n){return Math.min(Math.max(t,e),n)}function vP(t,e){if(typeof window>"u")return e;const n=localStorage.getItem(t);if(!n)return e;const r=Number.parseFloat(n);if(Number.isNaN(r))return e;if(r>0&&r<1)return r;if(r>=1){const i=Math.max(window.innerHeight-220,r+Ph);return Math.min(.75,Math.max(.35,r/i))}return e}function wP(t,e,n,r){const[i,s]=m.useState(()=>typeof window>"u"?e:vP(t,e)),[o,a]=m.useState(!1),l=m.useCallback(c=>{c.preventDefault(),a(!0);const h=c.target.closest("[data-vresize-container]");if(!h)return;const u=p=>{const g=h.getBoundingClientRect(),b=g.height||1,x=(p.clientY-g.top)/b,w=n/b,v=Math.max(w,1-r/b);s(Math.max(w,Math.min(v,x)))},f=()=>{a(!1),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",f),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",u),document.addEventListener("mouseup",f),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[r,n]);return m.useEffect(()=>{localStorage.setItem(t,String(i))},[t,i]),{topRatio:i,isDragging:o,startDrag:l}}function SP(){const[t,e]=m.useState(null),[n,r]=m.useState(0),i=m.useCallback(s=>{e(s)},[]);return m.useEffect(()=>{if(!t)return;const s=()=>{r(t.getBoundingClientRect().height)};if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{s()});return o.observe(t),()=>o.disconnect()},[t]),{ref:i,height:n}}const kP=()=>{const{t}=he(),e=Tn(),[n,r]=m.useState("config"),[i,s]=m.useState({}),[o,a]=m.useState(es),[l,c]=m.useState(!1),{sizes:h,isDragging:u,startDrag:f}=Oh({storageKey:"claudekit-global-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),{sizes:p,isDragging:g,startDrag:b}=Oh({storageKey:"claudekit-global-system-panels",defaultSizes:[70,30],minSizes:[45,20]}),x=wP("claudekit-form-taxonomy-px",bP,es,Ph),{ref:w,height:v}=SP(),k=m.useCallback(async()=>{const[I,F]=await Promise.all([Am(),F2()]);return s(F),I},[]),j=m.useCallback(async I=>(await My({scope:"global",config:I})).config,[]),S=m.useCallback(async()=>await Am(),[]),C=Ay({scope:"global",fetchConfig:k,fetchSchema:Ty,saveConfig:j,onReset:S}),y=m.useMemo(()=>[{id:"general",title:t("sectionGeneral"),fields:[{path:"codingLevel",label:t("fieldCodingLevel"),description:t("fieldCodingLevelDesc")},{path:"statusline",label:t("fieldStatusline"),description:t("fieldStatuslineDesc")},{path:"statuslineColors",label:t("fieldStatuslineColors"),description:t("fieldStatuslineColorsDesc")},{path:"statuslineQuota",label:t("fieldStatuslineQuota"),description:t("fieldStatuslineQuotaDesc")},{path:"locale.thinkingLanguage",label:t("fieldThinkingLanguage"),description:t("fieldThinkingLanguageDesc")},{path:"locale.responseLanguage",label:t("fieldResponseLanguage"),description:t("fieldResponseLanguageDesc")}]},{id:"paths",title:t("sectionPaths"),fields:[{path:"paths.docs",label:t("fieldDocsPath"),description:t("fieldDocsPathDesc")},{path:"paths.plans",label:t("fieldPlansPath"),description:t("fieldPlansPathDesc")}]},{id:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")},{path:"trust.enabled",label:t("fieldTrustEnabled"),description:t("fieldTrustEnabledDesc")},{path:"trust.passphrase",label:t("fieldTrustPassphrase"),description:t("fieldTrustPassphraseDesc")}]},{id:"project",title:t("sectionProject"),defaultCollapsed:!0,fields:[{path:"project.type",label:t("fieldProjectType"),description:t("fieldProjectTypeDesc")},{path:"project.packageManager",label:t("fieldPackageManager"),description:t("fieldPackageManagerDesc")},{path:"project.framework",label:t("fieldFramework"),description:t("fieldFrameworkDesc")}]},{id:"integrations",title:t("sectionIntegrations"),defaultCollapsed:!0,fields:[{path:"gemini.model",label:t("fieldGeminiModel"),description:t("fieldGeminiModelDesc")},{path:"skills.research.useGemini",label:t("fieldResearchUseGemini"),description:t("fieldResearchUseGeminiDesc")}]},{id:"hooks",title:t("sectionHooks"),defaultCollapsed:!0,fields:[{path:"hooks.session-init",label:t("fieldHookSessionInit"),description:t("fieldHookSessionInitDesc")},{path:"hooks.subagent-init",label:t("fieldHookSubagentInit"),description:t("fieldHookSubagentInitDesc")},{path:"hooks.descriptive-name",label:t("fieldHookDescriptiveName"),description:t("fieldHookDescriptiveNameDesc")},{path:"hooks.dev-rules-reminder",label:t("fieldHookDevRulesReminder"),description:t("fieldHookDevRulesReminderDesc")},{path:"hooks.usage-context-awareness",label:t("fieldHookUsageContextAwareness"),description:t("fieldHookUsageContextAwarenessDesc")},{path:"hooks.context-tracking",label:t("fieldHookContextTracking"),description:t("fieldHookContextTrackingDesc")},{path:"hooks.scout-block",label:t("fieldHookScoutBlock"),description:t("fieldHookScoutBlockDesc")},{path:"hooks.privacy-block",label:t("fieldHookPrivacyBlock"),description:t("fieldHookPrivacyBlockDesc")},{path:"hooks.post-edit-simplify-reminder",label:t("fieldHookPostEditSimplify"),description:t("fieldHookPostEditSimplifyDesc")}]},{id:"updatePipeline",title:t("sectionUpdatePipeline"),defaultCollapsed:!0,fields:[{path:"updatePipeline.autoInitAfterUpdate",label:t("fieldAutoInitAfterUpdate"),description:t("fieldAutoInitAfterUpdateDesc")},{path:"updatePipeline.autoMigrateAfterUpdate",label:t("fieldAutoMigrateAfterUpdate"),description:t("fieldAutoMigrateAfterUpdateDesc")},{path:"updatePipeline.migrateProviders",label:t("fieldMigrateProviders"),description:t("fieldMigrateProvidersDesc")}]},{id:"advanced",title:t("sectionAdvanced"),defaultCollapsed:!0,fields:[{path:"docs.maxLoc",label:t("fieldDocsMaxLoc"),description:t("fieldDocsMaxLocDesc")},{path:"plan.namingFormat",label:t("fieldPlanNamingFormat"),description:t("fieldPlanNamingFormatDesc")},{path:"plan.dateFormat",label:t("fieldPlanDateFormat"),description:t("fieldPlanDateFormatDesc")},{path:"plan.validation.mode",label:t("fieldPlanValidationMode"),description:t("fieldPlanValidationModeDesc")},{path:"plan.validation.minQuestions",label:t("fieldPlanMinQuestions"),description:t("fieldPlanMinQuestionsDesc")},{path:"plan.validation.maxQuestions",label:t("fieldPlanMaxQuestions"),description:t("fieldPlanMaxQuestionsDesc")},{path:"assertions",label:t("fieldAssertions"),description:t("fieldAssertionsDesc")}]}],[t]),N=m.useMemo(()=>{if(v<=0)return null;const I=Math.max(es,v-Ph);return yP(x.topRatio*v,es,I)},[x.topRatio,v]),A=m.useMemo(()=>l||N===null?null:Math.min(N,o),[o,l,N]),T=m.useMemo(()=>{if(!l||v<=0)return null;const I=Math.max(es,v-xP);return Math.min(o,I)},[o,l,v]),P=l?T:A,R=!C.isLoading&&!l&&A!==null,z=C.showResetConfirm?d.jsxs("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-2 py-1 animate-in fade-in duration-200",children:[d.jsx("span",{className:"text-xs text-red-500 font-medium",children:t("confirmReset")}),d.jsx("button",{type:"button",onClick:C.handleReset,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:t("confirm")}),d.jsx("button",{type:"button",onClick:()=>C.setShowResetConfirm(!1),className:"px-2 py-0.5 rounded bg-dash-surface text-dash-text-secondary text-xs font-bold hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("cancel")})]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>C.setShowResetConfirm(!0),className:"px-3 py-1.5 rounded-lg bg-dash-surface text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:t("resetToDefault")}),d.jsx("button",{type:"button",onClick:C.handleSave,disabled:!!C.syntaxError||C.saveStatus==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${C.syntaxError?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":C.saveStatus==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":C.saveStatus==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:C.saveStatus==="saving"?t("saving"):C.saveStatus==="saved"?t("saved"):C.saveStatus==="error"?t("saveFailed"):t("saveChanges")})]});return d.jsxs("div",{className:"animate-in fade-in duration-300 w-full h-full flex flex-col transition-colors",children:[d.jsx(N0,{title:t("globalConfig"),filePath:"~/.claude/.ck.json",onBack:()=>e(-1),onSave:C.handleSave,onReset:C.handleReset,saveStatus:C.saveStatus,syntaxError:C.syntaxError,showResetConfirm:C.showResetConfirm,setShowResetConfirm:C.setShowResetConfirm,showActions:!1,showFilePath:!1}),d.jsxs("div",{className:"mb-3 shrink-0 flex items-center justify-between gap-3",children:[d.jsxs("div",{role:"tablist","aria-label":t("globalConfig"),className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 shadow-sm",children:[d.jsx("button",{role:"tab","aria-selected":n==="config",onClick:()=>r("config"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="config"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("configTab")}),d.jsx("button",{role:"tab","aria-selected":n==="metadata",onClick:()=>r("metadata"),className:`dash-focus-ring px-4 py-2 rounded-lg text-sm font-semibold transition-colors ${n==="metadata"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-muted hover:text-dash-text hover:bg-dash-surface-hover"}`,children:t("systemTab")})]}),d.jsx("p",{className:"hidden lg:block text-xs text-dash-text-muted",children:t("configWorkspaceHint")})]}),d.jsxs("div",{className:"flex-1 flex min-h-0",children:[n==="config"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{ref:w,"data-vresize-container":!0,style:{width:`${h[0]}%`},className:"flex flex-col min-w-0 min-h-0 h-full",children:[d.jsx("div",{style:P!==null?{height:`${P}px`}:void 0,className:`min-h-0 ${P!==null?"shrink-0":"flex-1"}`,children:d.jsx(T0,{width:100,isLoading:C.isLoading,schema:C.schema,config:C.config,sources:C.sources,sections:y,onChange:C.handleFormChange,onFieldFocus:C.setFocusedFieldPath,onNaturalHeightChange:a})}),!C.isLoading&&d.jsxs(d.Fragment,{children:[l&&P!==null&&d.jsx("div",{className:"flex-1"}),R&&d.jsx(rr,{direction:"vertical",isDragging:x.isDragging,onMouseDown:x.startDrag}),d.jsx("div",{className:l?"shrink-0":"flex-1 min-h-0 overflow-hidden",children:d.jsx(XO,{config:C.config,onChange:C.handleFormChange,isCollapsed:l,onCollapsedChange:c})})]})]}),d.jsx(rr,{direction:"horizontal",isDragging:u,onMouseDown:I=>f(0,I)}),d.jsx(ju,{width:h[1],isLoading:C.isLoading,jsonText:C.jsonText,cursorLine:C.cursorLine,syntaxError:C.syntaxError,onChange:C.handleJsonChange,onEditorFocus:C.handleJsonEditorFocus,onCursorLineChange:C.setCursorLine,headerPath:"~/.claude/.ck.json",headerActions:z}),d.jsx(rr,{direction:"horizontal",isDragging:u,onMouseDown:I=>f(1,I)}),d.jsx(Py,{width:h[2],fieldDoc:C.fieldDoc,activeFieldPath:C.activeFieldPath})]}),n==="metadata"&&d.jsxs("div",{className:"flex-1 min-h-0 flex",children:[d.jsx("div",{style:{width:`${p[0]}%`},className:"min-w-0 h-full overflow-auto pr-1",children:C.isLoading?d.jsx("div",{className:"dash-panel h-full flex items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted text-sm",children:t("loading")})}):d.jsx(fP,{metadata:i})}),d.jsx(rr,{direction:"horizontal",isDragging:g,onMouseDown:I=>b(0,I)}),d.jsx("div",{style:{width:`${p[1]}%`},className:"min-w-0 h-full overflow-hidden",children:d.jsx(pP,{})})]})]})]})};function CP({phase:t}){const e=t.status==="completed"?"border-green-500":t.status==="in-progress"?"border-blue-500":"border-amber-400";return d.jsx("div",{className:`rounded border-l-4 ${e} bg-white dark:bg-gray-800 p-3 shadow-sm`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:t.phaseId}),d.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:t.name})]})})}function Zc({title:t,phases:e,borderColor:n}){return d.jsxs("div",{className:"flex flex-1 flex-col gap-3 min-w-0","aria-label":`${t} phases`,children:[d.jsxs("div",{className:`rounded-t border-t-2 ${n} bg-gray-50 dark:bg-gray-900 px-3 py-2`,children:[d.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:t}),d.jsx("span",{className:"ml-2 text-xs text-gray-400",children:e.length})]}),d.jsx("div",{className:"flex flex-col gap-2 px-1",children:e.map((r,i)=>d.jsx(CP,{phase:r},`${r.phaseId}-${i}`))})]})}function jP({completed:t,total:e}){const{t:n}=he(),r=e===0?0:Math.round(t/e*100);return d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs("div",{className:"flex justify-between text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{children:n("kanbanProgress")}),d.jsxs("span",{children:[t,"/",e," ",n("kanbanPhases")," — ",r,"% ",n("kanbanComplete")]})]}),d.jsx("div",{className:"h-2 w-full rounded bg-gray-200 dark:bg-gray-700",children:d.jsx("div",{className:"h-2 rounded bg-green-500 transition-all",style:{width:`${r}%`}})})]})}function OP(){const{t}=he(),[e]=g2(),n=e.get("file")??"",[r,i]=m.useState([]),[s,o]=m.useState(!1),[a,l]=m.useState(null);if(m.useEffect(()=>{n&&(o(!0),l(null),i([]),fetch(`/api/plan/parse?file=${encodeURIComponent(n)}`).then(p=>{if(!p.ok){const g={400:"kanbanError400",403:"kanbanError403",404:"kanbanError404"};throw new Error(g[p.status]??`error:HTTP:${p.status}`)}return p.json()}).then(p=>i(p.phases)).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>o(!1)))},[n]),!n)return d.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoFile")});let c=[],h=[],u=[],f=null;try{c=r.filter(p=>p.status==="pending"),h=r.filter(p=>p.status==="in-progress"),u=r.filter(p=>p.status==="completed")}catch(p){f=p instanceof Error?p.message:String(p)}return f?d.jsx("div",{className:"flex h-full items-center justify-center text-red-500 dark:text-red-400",children:t("kanbanLoadError")}):d.jsxs("div",{className:"flex h-full flex-col gap-4 p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:t("kanbanTitle")}),d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate max-w-xs",title:n,children:n.replaceAll("\\","/")})]}),r.length>0&&d.jsx(jP,{completed:u.length,total:r.length}),s&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400",children:t("loading")}),a&&d.jsxs("div",{className:"rounded border border-red-300 bg-red-50 dark:bg-red-900/20 p-4 text-red-600 dark:text-red-400",children:[t("error"),":"," ",a in{kanbanError400:"",kanbanError403:"",kanbanError404:""}?t(a):a]}),!s&&!a&&r.length===0&&d.jsx("div",{className:"flex flex-1 items-center justify-center text-gray-400 dark:text-gray-500",children:t("kanbanNoPhases")}),!s&&!a&&r.length>0&&d.jsxs("section",{"aria-label":t("kanbanTitle"),className:"flex flex-1 flex-col gap-4 overflow-auto md:flex-row",children:[d.jsx(Zc,{title:t("kanbanStatus_pending"),phases:c,borderColor:"border-amber-400"}),d.jsx(Zc,{title:t("kanbanStatus_in-progress"),phases:h,borderColor:"border-blue-500"}),d.jsx(Zc,{title:t("kanbanStatus_completed"),phases:u,borderColor:"border-green-500"})]})]})}const Tm=[{key:"agent",labelKey:"migrateTypeAgents",badgeClass:"border-dash-accent/30 text-dash-accent"},{key:"command",labelKey:"migrateTypeCommands",badgeClass:"border-yellow-500/30 text-yellow-400"},{key:"skill",labelKey:"migrateTypeSkills",badgeClass:"border-purple-500/30 text-purple-400"},{key:"config",labelKey:"migrateTypeConfig",badgeClass:"border-teal-500/30 text-teal-400"},{key:"rules",labelKey:"migrateTypeRules",badgeClass:"border-rose-500/30 text-rose-400"},{key:"hooks",labelKey:"migrateTypeHooks",badgeClass:"border-cyan-500/30 text-cyan-400"}],PP=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function NP(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||PP.has(t)}function Pr(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(NP(r)||(e+=n))}return e}function Em(t){if(!t)return"-";const e=t.replace(/\\/g,"/"),n=e.match(/.*\/(\.[^/]+\/)/);if(n?.[1]){const i=(n.index??0)+n[0].length-n[1].length;return e.slice(i)}const r=e.split("/");return r.length>3?`.../${r.slice(-3).join("/")}`:e}function oi(t){return t.success?t.skipped?"skipped":"installed":"failed"}function DP(t){const e={installed:0,skipped:0,failed:0};for(const n of t){const r=oi(n);r==="installed"?e.installed+=1:r==="skipped"?e.skipped+=1:e.failed+=1}return e}function Ey(t){switch(t){case"agent":case"command":case"skill":case"config":case"rules":case"hooks":case"unknown":return t;default:return"unknown"}}function AP(t,e){switch(t){case"failed":return{label:e("migrateStatusFailed"),className:"border-red-500/30 bg-red-500/10 text-red-400"};case"skipped":return{label:e("migrateStatusSkipped"),className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"};default:return{label:e("migrateStatusInstalled"),className:"border-green-500/30 bg-green-500/10 text-green-400"}}}function MP(t){const e=new Map;for(const n of t){const r=Ey(n.portableType),i=e.get(r)||[];i.push(n),e.set(r,i)}return e}function TP(t){return[Ey(t.portableType),t.provider,t.providerDisplayName,t.itemName,t.path,t.success,t.skipped,t.overwritten,t.error,t.skipReason].map(n=>n===void 0?"":String(n)).join("|")}function EP(t){if(t.length===0)return!0;const e=t[0].provider;return t.every(n=>n.provider===e)}const mi=({label:t,count:e,className:n})=>e<=0?null:d.jsxs("span",{className:`inline-flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs ${n}`,children:[d.jsx("span",{className:"font-semibold",children:e}),d.jsx("span",{children:t})]}),Rm=({labelKey:t,badgeClass:e,items:n,isExpanded:r,onToggle:i,singleProvider:s})=>{const{t:o}=he(),a=n.filter(f=>oi(f)==="installed").length,l=n.filter(f=>oi(f)==="skipped").length,c=n.filter(f=>oi(f)==="failed").length,h=s?"md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.35fr)_auto_minmax(0,1fr)]":"md:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,1.2fr)_auto_minmax(0,1fr)]",u=new Map;return d.jsxs("div",{className:"rounded-xl border border-dash-border bg-dash-surface overflow-hidden",children:[d.jsxs("button",{type:"button",onClick:i,className:"w-full flex flex-wrap items-center gap-2 px-4 py-3 text-left hover:bg-dash-surface-hover transition-colors",children:[d.jsx("svg",{className:`w-3.5 h-3.5 text-dash-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{d:"M9 5l7 7-7 7"})}),d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:o(t)}),d.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold ${e}`,children:n.length}),d.jsx("span",{className:"hidden sm:block flex-1"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px]",children:[d.jsx(mi,{label:o("migrateStatusInstalled"),count:a,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(mi,{label:o("migrateStatusSkipped"),count:l,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(mi,{label:o("migrateStatusFailed"),count:c,className:"border-red-500/30 bg-red-500/10 text-red-400"})]})]}),r&&d.jsxs("div",{className:"border-t border-dash-border/80",children:[d.jsxs("div",{className:`hidden md:grid ${h} items-center gap-3 px-4 py-2 border-b border-dash-border/70 text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted`,children:[d.jsx("p",{children:o("migrateItem")}),!s&&d.jsx("p",{children:o("migrateProvider")}),d.jsx("p",{children:o("migratePath")}),d.jsx("p",{children:o("migrateStatus")}),d.jsx("p",{children:o("migrateError")})]}),d.jsx("div",{className:"divide-y divide-dash-border/70",children:n.map(f=>{const p=TP(f),g=u.get(p)??0;u.set(p,g+1);const b=g===0?p:`${p}#${g}`,x=oi(f),w=AP(x,o),v=Pr(f.itemName||Em(f.path)),k=Pr(f.providerDisplayName||f.provider||""),j=Pr(f.path||""),S=Pr(Em(f.path)),C=Pr(f.error||f.skipReason||"");return d.jsxs("div",{className:`grid gap-1.5 ${h} items-start px-4 py-2.5 hover:bg-dash-bg/60 transition-colors`,children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-xs font-semibold text-dash-text truncate",title:v,children:v}),d.jsxs("div",{className:"mt-0.5 space-y-0.5 md:hidden",children:[!s&&d.jsx("p",{className:"text-[11px] text-dash-text-secondary truncate",children:k}),d.jsx("p",{className:"font-mono text-[11px] text-dash-text-muted truncate",title:j,children:S}),C&&d.jsx("p",{className:"text-[11px] text-red-400/80 line-clamp-2",title:C,children:C})]})]}),!s&&d.jsx("p",{className:"hidden md:block text-[11px] text-dash-text-secondary truncate",children:k}),d.jsx("p",{className:"hidden md:block font-mono text-[11px] text-dash-text-muted truncate",title:j,children:S}),d.jsx("span",{className:`inline-flex w-fit items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${w.className}`,children:w.label}),d.jsx("p",{className:`hidden md:block text-[11px] truncate ${C?"text-red-400/80":"text-dash-text-muted"}`,title:C,children:C||"-"})]},b)})})]})]})},RP=({results:t,onReset:e})=>{const{t:n}=he(),[r,i]=m.useState(""),s=m.useDeferredValue(r),[o,a]=m.useState("all"),[l,c]=m.useState(()=>new Set(Tm.map(j=>j.key))),h=m.useMemo(()=>{const j=s.trim().toLowerCase();return t.results.filter(S=>{if(o!=="all"&&oi(S)!==o)return!1;if(!j)return!0;const C=(S.itemName||"").toLowerCase(),y=(S.path||"").toLowerCase(),N=(S.providerDisplayName||S.provider||"").toLowerCase();return C.includes(j)||y.includes(j)||N.includes(j)})},[t.results,s,o]),u=m.useMemo(()=>EP(h),[h]),f=m.useMemo(()=>{if(!u||h.length===0)return"";const j=Array.from(new Set(h.map(S=>S.providerDisplayName?.trim()||"").filter(S=>S.length>0)));return j.length===1?j[0]:h[0]?.provider||""},[h,u]),p=m.useMemo(()=>MP(h),[h]),g=m.useMemo(()=>DP(t.results),[t.results]),b=m.useMemo(()=>[...p.keys()],[p]),x=g.installed+g.skipped+g.failed,w=b.length>0&&b.every(j=>l.has(j)),v=j=>{c(S=>{const C=new Set(S);return C.has(j)?C.delete(j):C.add(j),C})},k=()=>{if(w){c(new Set);return}c(new Set(b))};return d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-dash-text",children:[n("migrateSummaryTitle"),u&&f&&d.jsxs("span",{className:"text-dash-text-muted font-normal",children:[" ","· ",Pr(f)]})]}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[x," ",n("migrateSummarySubtitle")]})]}),d.jsx("button",{type:"button",onClick:e,className:"dash-focus-ring px-4 py-2 text-sm font-semibold rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n("migrateSummaryNewMigration")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[d.jsx(mi,{label:n("migrateStatusInstalled"),count:g.installed,className:"border-green-500/30 bg-green-500/10 text-green-400"}),d.jsx(mi,{label:n("migrateStatusSkipped"),count:g.skipped,className:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400"}),d.jsx(mi,{label:n("migrateStatusFailed"),count:g.failed,className:"border-red-500/30 bg-red-500/10 text-red-400"})]}),t.warnings.length>0&&d.jsx("div",{className:"space-y-2",children:t.warnings.map((j,S)=>d.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded-md text-xs text-yellow-400",children:Pr(j)},S))}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"relative",children:[d.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 stroke-dash-text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),d.jsx("input",{type:"text",value:r,onChange:j=>i(j.target.value),placeholder:n("migrateSummarySearchPlaceholder"),className:"dash-focus-ring w-full pl-9 pr-3 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[["all","installed","skipped","failed"].map(j=>{const S=j==="all"?"migrateSummaryFilterAll":j==="installed"?"migrateStatusInstalled":j==="skipped"?"migrateStatusSkipped":"migrateStatusFailed";return d.jsx("button",{type:"button",onClick:()=>a(j),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-colors ${o===j?"bg-dash-accent/10 border-dash-accent text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:n(S)},j)}),d.jsx("button",{type:"button",onClick:k,className:"dash-focus-ring ml-1 px-3 py-1 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:n(w?"migrateSummaryCollapseAll":"migrateSummaryExpandAll")})]})]}),h.length===0?d.jsx("div",{className:"text-center py-8 text-sm text-dash-text-muted",children:n("migrateSummaryNoResults")}):d.jsxs("div",{className:"space-y-2.5",children:[Tm.map(j=>{const S=p.get(j.key);return!S||S.length===0?null:d.jsx(Rm,{labelKey:j.labelKey,badgeClass:j.badgeClass,items:S,isExpanded:l.has(j.key),onToggle:()=>v(j.key),singleProvider:u},j.key)}),(()=>{const j=p.get("unknown");return!j||j.length===0?null:d.jsx(Rm,{labelKey:"migrateTypeUnknown",badgeClass:"border-dash-border text-dash-text-muted",items:j,isExpanded:l.has("unknown"),onToggle:()=>v("unknown"),singleProvider:u})})()]})]})},LP=500;function IP(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function $P(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(IP(r)||(e+=n))}return e}const BP=({diff:t,className:e=""})=>{const n=t.split(`
248
244
  `),r=n.slice(0,LP),i=n.length-r.length;return d.jsxs("pre",{className:`text-xs font-mono overflow-x-auto p-3 rounded bg-dash-bg border border-dash-border ${e}`,children:[r.map((s,o)=>{const a=$P(s);let l="text-dash-text";return a.startsWith("+")?l="text-green-400 bg-green-500/10":a.startsWith("-")?l="text-red-400 bg-red-500/10":a.startsWith("@@")&&(l="text-blue-400"),d.jsx("div",{className:l,children:a},`${o}:${a.slice(0,24)}`)}),i>0&&d.jsxs("div",{className:"text-dash-text-muted",children:["... truncated ",i," additional line(s)"]})]})};function FP(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function ts(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(FP(r)||(e+=n))}return e}const zP=({action:t,resolution:e,onResolve:n})=>{const{t:r}=he(),[i,s]=m.useState(!1),o=t.ownedSections&&t.ownedSections.length>0;return d.jsxs("div",{className:"border border-dash-border rounded-lg p-4 mb-3 bg-dash-surface",children:[d.jsxs("div",{className:"flex justify-between items-start gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"font-mono text-sm text-dash-text truncate",children:[ts(t.provider),"/",ts(t.type),"/",ts(t.item)]}),d.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:ts(t.reason)}),t.targetPath&&d.jsx("p",{className:"text-xs text-dash-text-secondary mt-1 font-mono truncate",children:ts(t.targetPath)})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[d.jsx("button",{type:"button",onClick:()=>n({type:"overwrite"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="overwrite"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictUseCK")}),d.jsx("button",{type:"button",onClick:()=>n({type:"keep"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="keep"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictKeepMine")}),o&&d.jsx("button",{type:"button",onClick:()=>n({type:"smart-merge"}),className:`dash-focus-ring px-3 py-1.5 text-xs font-semibold rounded-md transition-colors ${e?.type==="smart-merge"?"bg-dash-accent text-white":"bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover"}`,children:r("migrateConflictSmartMerge")}),t.diff&&d.jsx("button",{type:"button",onClick:()=>s(!i),className:"dash-focus-ring px-3 py-1.5 text-xs font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:r(i?"migrateConflictHideDiff":"migrateConflictShowDiff")})]})]}),i&&t.diff&&d.jsx(BP,{diff:t.diff,className:"mt-3"}),e&&d.jsxs("div",{className:"mt-2 text-xs text-green-400 flex items-center gap-1.5",children:[d.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),d.jsxs("span",{children:[r("migrateConflictResolved"),": ",HP(e.type,r)]})]})]})};function HP(t,e){switch(t){case"overwrite":return e("migrateConflictUseCK");case"keep":return e("migrateConflictKeepMine");case"smart-merge":return e("migrateConflictSmartMerge");case"resolved":return e("migrateConflictManual");default:return String(t)}}const VP=[{key:"install",labelKey:"migrateActionInstall",activeClass:"border-green-400 text-green-400",badgeClass:"bg-green-500/10 border-green-500/30 text-green-400"},{key:"update",labelKey:"migrateActionUpdate",activeClass:"border-yellow-400 text-yellow-400",badgeClass:"bg-yellow-500/10 border-yellow-500/30 text-yellow-400"},{key:"conflict",labelKey:"migrateActionConflict",activeClass:"border-red-400 text-red-400",badgeClass:"bg-red-500/10 border-red-500/30 text-red-400"},{key:"delete",labelKey:"migrateActionDelete",activeClass:"border-dash-text-secondary text-dash-text-secondary",badgeClass:"bg-dash-bg border-dash-border text-dash-text-secondary"},{key:"skip",labelKey:"migrateActionSkip",activeClass:"border-dash-text-muted text-dash-text-muted",badgeClass:"bg-dash-bg border-dash-border text-dash-text-muted"}],Lm=["agent","command","skill","config","rules","hooks"],_P={agent:"migrateTypeAgents",command:"migrateTypeCommands",skill:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},WP={agent:"border-dash-accent/30 text-dash-accent",command:"border-yellow-500/30 text-yellow-400",skill:"border-purple-500/30 text-purple-400",config:"border-teal-500/30 text-teal-400",rules:"border-rose-500/30 text-rose-400",hooks:"border-cyan-500/30 text-cyan-400"},Jr=200;function UP(t){return t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159}function Ia(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(UP(r)||(e+=n))}return e}function KP(t){const e={install:[],update:[],skip:[],conflict:[],delete:[]};for(const n of t)e[n.action].push(n);return e}function GP(t){const e=new Map;for(const n of t){const r=e.get(n.type)||[];r.push(n),e.set(n.type,r)}return e}const qP=({plan:t,resolutions:e,onResolve:n,actionKey:r})=>{const{t:i}=he(),s=m.useMemo(()=>KP(t.actions),[t.actions]),o=m.useMemo(()=>VP.filter(f=>s[f.key].length>0),[s]),[a,l]=m.useState(()=>s.conflict.length>0?"conflict":s.install.length>0?"install":o[0]?.key??"install");m.useEffect(()=>{s[a]?.length===0&&o.length>0&&l(o[0].key)},[s,a,o]);const c=m.useMemo(()=>s[a]??[],[s,a]),h=m.useMemo(()=>GP(c),[c]),u=f=>{for(const p of s.conflict)n(p,{type:f})};return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[t.summary.install>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-green-500/10 border border-green-500/30 text-green-400",children:[t.summary.install," ",i("migrateActionInstall")]}),t.summary.update>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-yellow-500/10 border border-yellow-500/30 text-yellow-400",children:[t.summary.update," ",i("migrateActionUpdate")]}),t.summary.skip>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-muted",children:[t.summary.skip," ",i("migrateActionSkip")]}),t.summary.conflict>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-red-500/10 border border-red-500/30 text-red-400",children:[t.summary.conflict," ",i("migrateActionConflict")]}),t.summary.delete>0&&d.jsxs("div",{className:"px-2.5 py-1 rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary",children:[t.summary.delete," ",i("migrateActionDelete")]})]}),o.length>1&&d.jsx("div",{className:"flex gap-1 border-b border-dash-border",children:o.map(f=>{const p=a===f.key;return d.jsxs("button",{type:"button",onClick:()=>l(f.key),className:`px-3 py-2 text-xs font-medium border-b-2 transition-colors ${p?f.activeClass:"border-transparent text-dash-text-muted hover:text-dash-text-secondary"}`,children:[i(f.labelKey)," ",d.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded text-[10px] border ${f.badgeClass}`,children:s[f.key].length})]},f.key)})}),a==="conflict"&&s.conflict.length>0&&d.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d.jsxs("h3",{className:"text-sm font-semibold text-red-400",children:[i("migrateConflictSectionTitle")," (",s.conflict.length,")"]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"button",onClick:()=>u("overwrite"),className:"dash-focus-ring px-3 py-1 text-xs font-medium rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:i("migrateConflictOverwriteAll")}),d.jsx("button",{type:"button",onClick:()=>u("keep"),className:"dash-focus-ring px-3 py-1 text-xs font-medium rounded-md bg-dash-bg border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:i("migrateConflictKeepAll")})]})]}),a==="conflict"?Lm.map(f=>{const p=h.get(f);return!p||p.length===0?null:d.jsxs(Im,{type:f,count:p.length,children:[p.slice(0,Jr).map(g=>d.jsx(zP,{action:g,resolution:e.get(r(g))||null,onResolve:b=>n(g,b)},r(g))),p.length>Jr&&d.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-Jr," more"]})]},`${a}:${f}`)}):Lm.map(f=>{const p=h.get(f);return!p||p.length===0?null:d.jsxs(Im,{type:f,count:p.length,defaultExpanded:a!=="skip",children:[p.slice(0,Jr).map(g=>d.jsx(YP,{action:g},`${g.provider}:${g.type}:${g.item}:${g.global}:${g.action}`)),p.length>Jr&&d.jsxs("div",{className:"text-xs text-dash-text-muted",children:["... ",p.length-Jr," more"]})]},`${a}:${f}`)})]})},Im=({type:t,count:e,defaultExpanded:n=!0,children:r})=>{const{t:i}=he(),[s,o]=m.useState(n),a=WP[t],l=i(_P[t]);return d.jsxs("div",{className:"border border-dash-border rounded-lg bg-dash-surface",children:[d.jsxs("button",{type:"button","aria-expanded":s,onClick:()=>o(!s),className:"w-full px-4 py-2.5 flex items-center justify-between text-left hover:bg-dash-surface-hover transition-colors",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-dash-text",children:l}),d.jsx("span",{className:`px-2 py-0.5 text-xs rounded-md border ${a}`,children:e})]}),d.jsx("svg",{"aria-hidden":"true",className:`w-4 h-4 text-dash-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&d.jsx("div",{className:"px-4 pt-1 pb-4 space-y-2",children:r})]})},YP=({action:t})=>d.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border",children:[d.jsxs("div",{className:"font-mono text-xs text-dash-text",children:[Ia(t.provider),"/",Ia(t.item)]}),d.jsx("div",{className:"text-xs text-dash-text-muted mt-1",children:Ia(t.reason)}),t.targetPath&&d.jsx("div",{className:"text-xs text-dash-text-secondary mt-0.5 font-mono truncate",children:Ia(t.targetPath)})]});var JP=function(e){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(e,")")):{matches:!1}},ed,QP=m.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(ed=JP("dark"))!==null&&ed!==void 0&&ed.matches?"dark":"light"}),XP=function(){return m.useContext(QP)};const Ry=(t,e)=>{if(e)return"row";switch(t){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},ZP=t=>{if(t)return["space-between","space-around","space-evenly"].includes(t)},e6=(t,e)=>Ry(t,e)==="row",Qr=t=>typeof t=="number"?`${t}px`:t,t6=({visible:t,flex:e,gap:n,direction:r,horizontal:i,align:s,justify:o,distribution:a,height:l,width:c,padding:h,paddingInline:u,paddingBlock:f,prefixCls:p,as:g="div",className:b,style:x,children:w,wrap:v,ref:k,...j})=>{const S=o||a,y=e6(r,i)&&!c&&ZP(S)?"100%":Qr(c),N={...e!==void 0?{"--lobe-flex":String(e)}:{},...r||i?{"--lobe-flex-direction":Ry(r,i)}:{},...v!==void 0?{"--lobe-flex-wrap":v}:{},...S!==void 0?{"--lobe-flex-justify":S}:{},...s!==void 0?{"--lobe-flex-align":s}:{},...y!==void 0?{"--lobe-flex-width":y}:{},...l!==void 0?{"--lobe-flex-height":Qr(l)}:{},...h!==void 0?{"--lobe-flex-padding":Qr(h)}:{},...u!==void 0?{"--lobe-flex-padding-inline":Qr(u)}:{},...f!==void 0?{"--lobe-flex-padding-block":Qr(f)}:{},...n!==void 0?{"--lobe-flex-gap":Qr(n)}:{},...x},A="lobe-flex",T=[A,t===!1?`${A}--hidden`:void 0,p?`${p}-flex`:void 0,b].filter(Boolean).join(" ");return d.jsx(g,{ref:k,...j,className:T,style:N,children:w})};var Ly=m.memo(t6);const n6=({children:t,ref:e,...n})=>d.jsx(Ly,{...n,align:"center",justify:"center",ref:e,children:t});var r6=n6;const i6=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function s6(t){return Array.from(t.match(i6)??[])}function o6(t){return s6(t).map(n=>n.toLowerCase()).join("-")}function a6(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const ic=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ai(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Pu(t){return"nodeType"in t}function kt(t){var e,n;return t?Ai(t)?t:Pu(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Nu(t){const{Document:e}=kt(t);return t instanceof e}function Ho(t){return Ai(t)?!1:t instanceof kt(t).HTMLElement}function Iy(t){return t instanceof kt(t).SVGElement}function Mi(t){return t?Ai(t)?t.document:Pu(t)?Nu(t)?t:Ho(t)||Iy(t)?t.ownerDocument:document:document:document}const ln=ic?m.useLayoutEffect:m.useEffect;function sc(t){const e=m.useRef(t);return ln(()=>{e.current=t}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function l6(){const t=m.useRef(null),e=m.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=m.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function _s(t,e){e===void 0&&(e=[t]);const n=m.useRef(t);return ln(()=>{n.current!==t&&(n.current=t)},e),n}function Vo(t,e){const n=m.useRef();return m.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Dl(t){const e=sc(t),n=m.useRef(null),r=m.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Al(t){const e=m.useRef();return m.useEffect(()=>{e.current=t},[t]),e.current}let td={};function _o(t,e){return m.useMemo(()=>{if(e)return e;const n=td[t]==null?0:td[t]+1;return td[t]=n,t+"-"+n},[t,e])}function $y(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,c]of a){const h=s[l];h!=null&&(s[l]=h+t*c)}return s},{...e})}}const gi=$y(1),Ws=$y(-1);function c6(t){return"clientX"in t&&"clientY"in t}function oc(t){if(!t)return!1;const{KeyboardEvent:e}=kt(t.target);return e&&t instanceof e}function d6(t){if(!t)return!1;const{TouchEvent:e}=kt(t.target);return e&&t instanceof e}function Ml(t){if(d6(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return c6(t)?{x:t.clientX,y:t.clientY}:null}const pr=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[pr.Translate.toString(t),pr.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),$m="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function h6(t){return t.matches($m)?t:t.querySelector($m)}const u6={display:"none"};function f6(t){let{id:e,value:n}=t;return Le.createElement("div",{id:e,style:u6},n)}function p6(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Le.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function m6(){const[t,e]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const By=m.createContext(null);function g6(t){const e=m.useContext(By);m.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function b6(){const[t]=m.useState(()=>new Set),e=m.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[m.useCallback(r=>{let{type:i,event:s}=r;t.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const x6={draggable:`
249
245
  To pick up a draggable item, press the space bar.
250
246
  While dragging, use the arrow keys to move the item.