claudekit-cli 3.41.3 → 3.41.4-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +32372 -28954
- package/dist/ui/assets/core-B8a0kdWx.js +1 -0
- package/dist/ui/assets/event-BR0sBAas.js +1 -0
- package/dist/ui/assets/index-Bnd1bUG3.js +1 -0
- package/dist/ui/assets/index-DxBGb68M.js +261 -0
- package/dist/ui/assets/index-oW0QypIz.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +6 -1
- package/dist/ui/assets/index-BzNW50gy.js +0 -249
- package/dist/ui/assets/index-QUag--Eo.css +0 -1
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
var z1=Object.defineProperty;var H1=(t,e,n)=>e in t?z1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ku=(t,e,n)=>H1(t,typeof e!="symbol"?e+"":e,n);import{r as m,a as Dr,R as V1,b as Le}from"./vendor-DNUgy55u.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Wg={exports:{}},$l={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var _1=m,W1=Symbol.for("react.element"),U1=Symbol.for("react.fragment"),K1=Object.prototype.hasOwnProperty,G1=_1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,q1={key:!0,ref:!0,__self:!0,__source:!0};function Ug(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)K1.call(e,r)&&!q1.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:W1,type:t,key:s,ref:o,props:i,_owner:G1.current}}$l.Fragment=U1;$l.jsx=Ug;$l.jsxs=Ug;Wg.exports=$l;var d=Wg.exports,jd={},Gu=Dr;jd.createRoot=Gu.createRoot,jd.hydrateRoot=Gu.hydrateRoot;/**
|
|
10
|
-
* react-router v7.11.0
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) Remix Software Inc.
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the MIT license found in the
|
|
15
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
* @license MIT
|
|
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
|
-
`,""):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
|
-
|
|
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
|
-
group flex items-center justify-center shrink-0
|
|
23
|
-
${r?"w-2 cursor-col-resize":"h-2 cursor-row-resize"}
|
|
24
|
-
${e?"bg-dash-accent/20":"hover:bg-dash-surface-hover/50"}
|
|
25
|
-
transition-colors
|
|
26
|
-
`,children:d.jsx("div",{className:`
|
|
27
|
-
rounded-full transition-all
|
|
28
|
-
${r?"w-0.5 h-8":"h-0.5 w-8"}
|
|
29
|
-
${e?"bg-dash-accent":"bg-dash-border group-hover:bg-dash-text-muted"}
|
|
30
|
-
`})})};var er=(t=>(t.HEALTHY="healthy",t.WARNING="warning",t.ERROR="error",t.LOADING="loading",t.UNKNOWN="unknown",t))(er||{}),kn=(t=>(t.ENGINEER="engineer",t.MARKETING="marketing",t.ARCHITECT="architect",t.RESEARCHER="researcher",t.DEVOP="devops",t))(kn||{});const P2=({isOpen:t,onClose:e,onAdd:n})=>{const{t:r}=he(),[i,s]=m.useState(""),[o,a]=m.useState(""),[l,c]=m.useState(!1),[h,u]=m.useState(null);m.useEffect(()=>{t||(s(""),a(""),u(null),c(!1))},[t]),m.useEffect(()=>{if(!t)return;const p=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t]),m.useEffect(()=>{if(!t)return;const p=document.activeElement;return document.querySelector("#project-path")?.focus(),()=>{p?.focus()}},[t]);const f=async p=>{if(p.preventDefault(),!i.trim()){u(r("pathRequired"));return}try{c(!0),u(null);const g={path:i.trim(),...o.trim()&&{alias:o.trim()}};await n(g),e()}catch(g){u(g instanceof Error?g.message:r("failedToAdd"))}finally{c(!1)}};return t?d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-xl max-w-md w-full mx-4",onClick:p=>p.stopPropagation(),children:[d.jsxs("div",{className:"px-6 py-4 border-b border-dash-border",children:[d.jsx("h2",{className:"text-lg font-bold text-dash-text",children:r("addProjectTitle")}),d.jsx("p",{className:"text-sm text-dash-text-muted mt-1",children:r("addProjectDescription")})]}),d.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[d.jsxs("div",{children:[d.jsxs("label",{htmlFor:"project-path",className:"block text-sm font-medium text-dash-text mb-2",children:[r("projectPath")," ",d.jsx("span",{className:"text-red-500",children:"*"})]}),d.jsx("input",{id:"project-path",type:"text",value:i,onChange:p=>s(p.target.value),placeholder:r("pathPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]}),d.jsxs("div",{children:[d.jsxs("label",{htmlFor:"project-alias",className:"block text-sm font-medium text-dash-text mb-2",children:[r("alias")," ",r("aliasOptional")]}),d.jsx("input",{id:"project-alias",type:"text",value:o,onChange:p=>a(p.target.value),placeholder:r("aliasPlaceholder"),disabled:l,className:"w-full px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-dash-text placeholder-dash-text-muted focus:outline-none focus:ring-2 focus:ring-dash-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"}),d.jsx("p",{className:"text-xs text-dash-text-muted mt-1",children:r("aliasDescription")})]}),h&&d.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/20 rounded-md",children:d.jsx("p",{className:"text-sm text-red-500",children:h})}),d.jsxs("div",{className:"flex gap-3 pt-2",children:[d.jsx("button",{type:"button",onClick:e,disabled:l,className:"flex-1 px-4 py-2 border border-dash-border rounded-md text-dash-text-secondary hover:bg-dash-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r("cancel")}),d.jsx("button",{type:"submit",disabled:l||!i.trim(),className:"flex-1 px-4 py-2 bg-dash-accent text-white rounded-md hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(l?"adding":"addProject")})]})]})]})}):null},N2=({vertical:t=!1})=>{const{lang:e,setLang:n}=he();return d.jsxs("div",{className:`flex ${t?"flex-col":""} items-center rounded-lg border border-dash-border overflow-hidden`,children:[d.jsx("button",{onClick:()=>n("en"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="en"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"English",children:"EN"}),d.jsx("button",{onClick:()=>n("vi"),className:`px-2 py-1 text-xs font-medium transition-colors ${e==="vi"?"bg-dash-accent text-dash-bg":"text-dash-text-muted hover:bg-dash-surface-hover"}`,title:"Tiếng Việt",children:"VI"})]})},D2=({projects:t,currentProjectId:e,isCollapsed:n,width:r,isConnected:i,theme:s,onSwitchProject:o,onToggle:a,onAddProject:l,onToggleTheme:c})=>{const{t:h}=he(),u=Tn(),f=dn(),[p,g]=m.useState(!1),b=f.pathname==="/config/global",x=f.pathname==="/migrate"||f.pathname==="/skills",w=f.pathname==="/statusline",v=[...t].filter(C=>!C.path.endsWith("/.claude")&&C.path!=="~/.claude").sort((C,y)=>C.pinned&&!y.pinned?-1:!C.pinned&&y.pinned?1:C.name.localeCompare(y.name)),k=r?{width:`${r}px`}:void 0,j=r?"":n?"w-14":"w-72",S=r?r>=160:!n;return d.jsxs("aside",{style:k,className:`${j} bg-dash-surface border-r border-dash-border flex flex-col transition-all duration-300 ease-in-out z-20 h-full overflow-hidden`,children:[d.jsxs("div",{className:`flex items-center ${S?"p-6 gap-3":"p-2 justify-center"}`,children:[d.jsx("img",{src:"/images/logo-transparent-32.png",alt:"ClaudeKit",className:"w-8 h-8 shrink-0"}),S&&d.jsxs("div",{className:"overflow-hidden",children:[d.jsx("h1",{className:"text-sm font-bold truncate tracking-tight text-dash-text",children:"ClaudeKit"}),d.jsx("p",{className:"text-[10px] text-dash-text-muted font-medium uppercase tracking-wider",children:h("controlCenter")})]})]}),d.jsxs("div",{className:`${S?"px-4":"px-2"} py-2 space-y-1`,children:[S&&d.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("settingsSection")}),d.jsx(yc,{icon:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/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:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),label:h("configEditor"),isCollapsed:!S,active:b,onClick:()=>u("/config/global")}),d.jsx(yc,{icon:d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),label:h("statusline"),isCollapsed:!S,active:w,onClick:()=>u("/statusline")}),d.jsx(yc,{icon:d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),label:h("migrate"),isCollapsed:!S,active:x,onClick:()=>u("/migrate")})]}),d.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden ${S?"px-4":"px-2"} py-2 space-y-1 border-t border-dash-border`,children:[S&&d.jsx("p",{className:"px-2 pb-2 pt-2 text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h("projects")}),v.map(C=>{const y=f.pathname.endsWith("/config"),N=e===C.id&&!b&&!y&&!x&&!w;return d.jsxs("button",{onClick:()=>o(C.id),className:`w-full group relative flex items-center ${S?"gap-3 p-2.5":"justify-center p-2"} rounded-md transition-colors ${N?"bg-dash-accent-subtle text-dash-accent border border-dash-accent/10":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text border border-transparent"}`,children:[d.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${C.health===er.HEALTHY?"bg-dash-accent":C.health===er.WARNING?"bg-orange-400":"bg-red-500"} ${N?"animate-pulse":""}`}),S&&d.jsxs(d.Fragment,{children:[C.pinned&&d.jsx("span",{className:"text-xs",children:"📌"}),d.jsx("span",{className:"text-sm font-medium truncate",children:C.name})]}),!S&&d.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:[C.pinned&&"📌 ",C.name]})]},C.id)}),d.jsxs("button",{onClick:()=>g(!0),className:`w-full flex items-center ${S?"gap-3 p-2.5":"justify-center p-2"} rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text-secondary transition-colors mt-4`,children:[d.jsx("div",{className:`${S?"w-5 h-5":""} flex items-center justify-center`,children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M12 4v16m8-8H4"})})}),S&&d.jsx("span",{className:"text-sm font-medium",children:h("addProject")})]})]}),d.jsx(P2,{isOpen:p,onClose:()=>g(!1),onAdd:l}),d.jsx("div",{className:"border-t border-dash-border",children:d.jsxs("div",{className:`py-3 flex items-center ${S?"px-3 justify-between":"justify-center flex-col gap-2"}`,children:[d.jsxs("div",{className:"flex items-center gap-2",title:h(i?"sync":"offline"),children:[d.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${i?"bg-dash-accent shadow-[0_0_8px_var(--dash-accent-glow)]":"bg-red-500"}`}),S&&d.jsx("span",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest",children:h(i?"sync":"offline")})]}),d.jsxs("div",{className:`flex items-center gap-1 ${S?"":"flex-col"}`,children:[d.jsx(N2,{vertical:!S}),d.jsx("button",{onClick:c,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:h(s==="dark"?"switchToLight":"switchToDark"),children:s==="dark"?d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364-6.364l-.707.707M6.343 17.657l-.707.707M17.657 17.657l-.707-.707M6.343 6.343l-.707-.707M12 5a7 7 0 100 14 7 7 0 000-14z"})}):d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})}),d.jsx("button",{onClick:a,className:"w-8 h-8 rounded-lg flex items-center justify-center text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",title:h(n?"expand":"collapse"),children:n?d.jsx("svg",{xmlns:"http://www.w3.org/2000/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 5l7 7-7 7M5 5l7 7-7 7"})}):d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]})]})})]})},yc=({icon:t,label:e,badge:n,badgeColor:r="bg-dash-accent-subtle text-dash-accent",isCollapsed:i,active:s,onClick:o,disabled:a})=>d.jsxs("button",{onClick:o,disabled:a,className:`w-full group relative flex items-center ${i?"justify-center p-2":"gap-3 p-2"} rounded-md transition-colors ${a?"opacity-50 cursor-not-allowed":s?"bg-dash-surface-hover text-dash-text":"text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:[d.jsx("div",{className:`${i?"":"w-5 h-5"} flex items-center justify-center`,children:t}),!i&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm font-medium flex-1 text-left",children:e}),n&&d.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${r}`,children:n})]}),i&&d.jsx("div",{className:"absolute left-14 px-2 py-1 bg-dash-text text-dash-bg text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none border border-dash-border z-50",children:e})]}),ut="/api";class vc extends Error{constructor(){super("Backend server is not running. Start it with: ck config"),this.name="ServerUnavailableError"}}async function zt(){try{if(!(await fetch(`${ut}/health`,{method:"GET"})).ok)throw new vc}catch(t){throw t instanceof vc?t:new vc}}function Vh(t){return{id:t.id,name:t.name,path:t.path,health:t.health,kitType:t.kitType||"engineer",model:t.model,activeHooks:t.activeHooks,mcpServers:t.mcpServers,skills:t.skills,pinned:t.pinned,tags:t.tags,addedAt:t.addedAt,lastOpened:t.lastOpened,preferences:t.preferences}}async function _h(){await zt();const t=await fetch(`${ut}/projects`);if(!t.ok)throw new Error("Failed to fetch projects");return(await t.json()).map(Vh)}async function A2(){await zt();const t=await fetch(`${ut}/skills`);if(!t.ok)throw new Error("Failed to fetch skills");return t.json()}async function M2(t,e){try{await zt();const n=e!==void 0?`?limit=${e}`:"",r=await fetch(`${ut}/sessions/${encodeURIComponent(t)}${n}`);return r.ok?r.json():[]}catch{return[]}}async function T2(t,e){await zt();const n=new URLSearchParams;t&&n.set("projectId",t);const r=await fetch(`${ut}/actions/options?${n.toString()}`,{signal:e});if(!r.ok)throw new Error("Failed to fetch action options");return r.json()}async function E2(t,e,n,r){await zt();const i=await fetch(`${ut}/actions/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t,path:e,appId:n,projectId:r})});if(!i.ok){const s=await i.json().catch(()=>({error:"Action failed"}));throw new Error(s.error||"Action failed")}}async function R2(){await zt();try{const r=await fetch(`${ut}/settings/raw`);if(r.ok)return r.json()}catch{}const t=await fetch(`${ut}/settings`);if(!t.ok)throw new Error("Failed to fetch settings file");const e=await t.json(),n=e.settings&&typeof e.settings=="object"?e.settings:{model:e.model,permissions:e.permissions,hookCount:e.hookCount,mcpServerCount:e.mcpServerCount};return{path:e.settingsPath??"~/.claude/settings.json",exists:e.settingsExists??!0,settings:n}}async function L2(t){await zt();const e=await fetch(`${ut}/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:t})});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to save settings file"}));throw new Error(n.error||"Failed to save settings file")}return e.json()}async function I2(t){await zt();const e=new URLSearchParams;t?.scope&&e.set("scope",t.scope),t?.projectId&&e.set("projectId",t.projectId),e.set("limit",String(t.limit));const n=e.toString(),r=await fetch(`${ut}/system/hook-diagnostics${n?`?${n}`:""}`,{signal:t?.signal});if(!r.ok){const i=await r.json().catch(()=>({error:"Failed to fetch hook diagnostics"}));throw new Error(i.error||"Failed to fetch hook diagnostics")}return r.json()}async function $2(t){await zt();const e=await fetch(`${ut}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const r=await e.text();throw new Error(r||"Failed to add project")}const n=await e.json();return Vh(n)}async function B2(t){await zt();const e=await fetch(`${ut}/projects/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok){const n=await e.text();throw new Error(n||"Failed to remove project")}}async function O0(t,e){await zt();const n=await fetch(`${ut}/projects/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const i=await n.text();throw new Error(i||"Failed to update project")}const r=await n.json();return Vh(r)}async function F2(){const t=await fetch(`${ut}/metadata/global`);return t.ok?t.json():(console.error("Failed to fetch global metadata"),{})}async function z2(){await zt();const t=await fetch(`${ut}/migrate/providers`);if(!t.ok)throw new Error("Failed to fetch migration providers");return t.json()}async function kf(){await zt();const t=await fetch(`${ut}/migrate/discovery`);if(!t.ok)throw new Error("Failed to discover migration items");return t.json()}function H2(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),s(null);const a=await A2();e(a)}catch(a){s(a instanceof Error?a.message:"Failed to load skills")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),{skills:t,loading:n,error:i,reload:o}}function V2(t){const[e,n]=m.useState([]),[r,i]=m.useState(!1),[s,o]=m.useState(null),a=m.useCallback(async()=>{if(!t){n([]);return}try{i(!0),o(null);const l=await M2(t,999);n(l)}catch(l){o(l instanceof Error?l.message:"Failed to load sessions")}finally{i(!1)}},[t]);return m.useEffect(()=>{a()},[a]),{sessions:e,loading:r,error:s,reload:a}}function _2(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[i,s]=m.useState(null),o=m.useCallback(async()=>{try{r(!0),s(null);const h=await _h();e(h)}catch(h){s(h instanceof Error?h.message:"Failed to load projects")}finally{r(!1)}},[]),a=m.useCallback(async h=>{const u=await $2(h);return await o(),u},[o]),l=m.useCallback(async h=>{await B2(h),await o()},[o]),c=m.useCallback(async(h,u)=>{const f=await O0(h,u);return await o(),f},[o]);return m.useEffect(()=>{o()},[o]),{projects:t,loading:n,error:i,reload:o,addProject:a,removeProject:l,updateProject:c}}function P0({storageKey:t,defaultSize:e,minSize:n,maxSize:r,direction:i="horizontal",invert:s=!1}){const[o,a]=m.useState(()=>{if(typeof window>"u")return e;const p=localStorage.getItem(t);if(p){const g=Number.parseInt(p,10);if(!Number.isNaN(g)&&g>=n&&g<=r)return g}return e}),[l,c]=m.useState(!1);m.useEffect(()=>{localStorage.setItem(t,String(o))},[o,t]);const h=m.useCallback(p=>{p.preventDefault(),c(!0);const g=i==="horizontal"?p.clientX:p.clientY,b=o,x=v=>{const j=((i==="horizontal"?v.clientX:v.clientY)-g)*(s?-1:1),S=Math.max(n,Math.min(r,b+j));a(S)},w=()=>{c(!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=i==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[o,n,r,i,s]),u=m.useCallback(()=>{a(e)},[e]),f=m.useCallback(p=>{a(Math.max(n,Math.min(r,p)))},[n,r]);return{size:o,isDragging:l,startDrag:h,setSize:f,reset:u}}const W2=()=>{const{t}=he(),e=Tn(),n=dn(),{projectId:r}=b0(),[i,s]=m.useState(null);m.useEffect(()=>{r&&s(r)},[r]);const[o,a]=m.useState(()=>typeof window<"u"&&localStorage.getItem("claudekit-theme")||"dark"),[l]=m.useState(!0),{size:c,isDragging:h,startDrag:u,setSize:f}=P0({storageKey:"claudekit-sidebar-width",defaultSize:288,minSize:56,maxSize:400}),p=c<=56,{projects:g,loading:b,error:x,addProject:w}=_2(),v=async y=>{await w(y)};m.useEffect(()=>{const y=n.pathname.startsWith("/project/");g.length===0||r||!y||e(`/project/${g[0].id}`,{replace:!0})},[g,r,e,n.pathname]),m.useEffect(()=>{const y=window.document.documentElement;o==="dark"?(y.classList.add("dark"),y.setAttribute("data-theme","dark")):(y.classList.remove("dark"),y.setAttribute("data-theme","light")),localStorage.setItem("claudekit-theme",o)},[o]);const k=()=>a(y=>y==="light"?"dark":"light"),j=m.useMemo(()=>g.find(y=>y.id===i)||null,[g,i]),S=y=>{e(`/project/${y}`)},C=()=>{f(p?288:56)};return b?d.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:d.jsx("div",{className:"animate-pulse text-dash-text-muted",children:t("loading")})}):x?d.jsx("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text items-center justify-center",children:d.jsxs("div",{className:"text-red-500",children:[t("error"),": ",x]})}):d.jsxs("div",{className:"flex h-screen w-full bg-dash-bg text-dash-text overflow-hidden font-sans transition-colors duration-300",children:[d.jsx(D2,{projects:g,currentProjectId:i,isCollapsed:p,width:c,isConnected:l,theme:o,onSwitchProject:S,onToggle:C,onAddProject:v,onToggleTheme:k}),d.jsx(rr,{direction:"horizontal",isDragging:h,onMouseDown:u}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0 h-full relative",children:d.jsx("main",{className:"flex-1 flex flex-col overflow-hidden p-4 md:p-6",children:d.jsx($w,{context:{project:j,isConnected:l,theme:o,onToggleTheme:k}})})})]})},N0=({title:t,filePath:e,onBack:n,onSave:r,onReset:i,saveStatus:s,syntaxError:o,showResetConfirm:a,setShowResetConfirm:l,badge:c,showActions:h=!0,showFilePath:u=!0})=>{const{t:f}=he();return d.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("button",{onClick:n,className:"px-2 py-1 rounded-lg bg-dash-surface hover:bg-dash-surface-hover border border-dash-border text-sm text-dash-text-secondary hover:text-dash-text flex items-center group transition-all font-medium shadow-sm",title:f("backToDashboard"),children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 group-hover:-translate-x-0.5 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),d.jsx("h1",{className:"text-xl font-bold tracking-tight text-dash-text",children:t}),c,u&&d.jsx("span",{className:"text-xs text-dash-text-muted mono",children:e})]}),h&&d.jsxs("div",{className:"flex items-center gap-2 relative",children:[a?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:f("confirmReset")}),d.jsx("button",{onClick:i,className:"px-2 py-0.5 rounded bg-red-500 text-white text-xs font-bold hover:bg-red-600 transition-colors",children:f("confirm")}),d.jsx("button",{onClick:()=>l(!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:f("cancel")})]}):d.jsx("button",{onClick:()=>l(!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:f("resetToDefault")}),d.jsx("button",{onClick:r,disabled:!!o||s==="saving",className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all tracking-widest uppercase ${o?"bg-dash-surface text-dash-text-muted cursor-not-allowed border border-dash-border":s==="saved"?"bg-green-500 text-white shadow-lg shadow-green-500/20":s==="error"?"bg-red-500 text-white":"bg-dash-accent text-dash-bg hover:bg-dash-accent-hover shadow-lg shadow-dash-accent/20"}`,children:f(s==="saving"?"saving":s==="saved"?"saved":s==="error"?"saveFailed":"saveChanges")})]})]})},D0={plan:{path:"plan",type:"object",default:"{}",description:"Configuration for plan management including naming conventions, resolution strategies, and validation workflows.",descriptionVi:"Cấu hình quản lý kế hoạch bao gồm quy ước đặt tên, chiến lược giải quyết và quy trình xác thực.",effect:"Controls how plans are created (namingFormat), located (resolution), and reviewed (validation) during development.",effectVi:"Điều khiển cách tạo kế hoạch (namingFormat), định vị (resolution) và xem xét (validation) trong quá trình phát triển."},"plan.resolution":{path:"plan.resolution",type:"object",default:"{}",description:"Settings for resolving which plan is currently active. Uses cascading resolution: session state (explicit) → branch name matching (suggested).",descriptionVi:"Cài đặt để xác định kế hoạch đang hoạt động. Sử dụng giải quyết theo tầng: trạng thái phiên (rõ ràng) → khớp tên nhánh (gợi ý).",effect:"'session' = ACTIVE (explicitly set via set-active-plan). 'branch' = SUGGESTED (hint from git branch name). 'mostRecent' was removed to avoid stale plan pollution.",effectVi:"'session' = ĐANG HOẠT ĐỘNG (đặt rõ ràng qua set-active-plan). 'branch' = GỢI Ý (từ tên nhánh git). 'mostRecent' đã bị xóa để tránh ô nhiễm kế hoạch cũ."},"plan.validation":{path:"plan.validation",type:"object",default:"{}",description:"Settings for the plan validation interview that reviews assumptions, risks, and architecture decisions.",descriptionVi:"Cài đặt cho phỏng vấn xác thực kế hoạch để xem xét giả định, rủi ro và quyết định kiến trúc.",effect:"Runs validation interview based on mode: 'prompt' (ask first), 'auto' (run automatically), 'strict' (enforce validation), 'none' (skip). Questions focus on configured areas.",effectVi:"Chạy phỏng vấn xác thực dựa trên chế độ: 'prompt' (hỏi trước), 'auto' (tự chạy), 'strict' (bắt buộc xác thực), 'none' (bỏ qua). Câu hỏi tập trung vào các lĩnh vực đã cấu hình."},paths:{path:"paths",type:"object",default:"{}",description:"Custom paths for project directories. Supports relative paths (from project root) or absolute paths for consolidated setups.",descriptionVi:"Đường dẫn tùy chỉnh cho các thư mục dự án. Hỗ trợ đường dẫn tương đối (từ thư mục gốc) hoặc tuyệt đối cho thiết lập tập trung.",effect:"Relative paths are resolved from project root. Absolute paths allow consolidated plans across repos.",effectVi:"Đường dẫn tương đối được giải quyết từ thư mục gốc dự án. Đường dẫn tuyệt đối cho phép kế hoạch tập trung giữa các repo."},locale:{path:"locale",type:"object",default:"{}",description:"Language settings separating internal AI reasoning from user-facing output for optimal precision.",descriptionVi:"Cài đặt ngôn ngữ tách suy luận AI nội bộ khỏi đầu ra cho người dùng để có độ chính xác tối ưu.",effect:"thinkingLanguage: for reasoning/logic (recommended: 'en'). responseLanguage: for user output (e.g., 'vi' for Vietnamese responses).",effectVi:"thinkingLanguage: cho suy luận/logic (khuyến nghị: 'en'). responseLanguage: cho đầu ra người dùng (vd: 'vi' cho phản hồi tiếng Việt)."},trust:{path:"trust",type:"object",default:"{}",description:"Trusted execution mode for bypassing certain security confirmations in controlled environments.",descriptionVi:"Chế độ thực thi tin cậy để bỏ qua một số xác nhận bảo mật trong môi trường được kiểm soát.",effect:"When trust.enabled=true, security prompts may be skipped. passphrase is used for context injection testing.",effectVi:"Khi trust.enabled=true, các lời nhắc bảo mật có thể bị bỏ qua. passphrase dùng để kiểm tra tiêm ngữ cảnh."},project:{path:"project",type:"object",default:"{}",description:"Override automatic project detection. Set to 'auto' for automatic detection or specify exact values.",descriptionVi:"Ghi đè phát hiện dự án tự động. Đặt 'auto' để tự động phát hiện hoặc chỉ định giá trị cụ thể.",effect:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/etc.",effectVi:"type: single-repo/monorepo/library. packageManager: npm/yarn/pnpm/bun. framework: next/nuxt/astro/v.v."},codingLevel:{path:"codingLevel",type:"number",default:"-1",validValues:["-1","0","1","2","3","4","5"],description:"Controls the communication style and depth of explanations based on user's coding experience level.",descriptionVi:"Điều khiển phong cách giao tiếp và độ sâu giải thích dựa trên trình độ lập trình của người dùng.",effect:"Loads corresponding output style and injects it into the session context. Changes how Claude explains code and structures responses.",effectVi:"Tải phong cách đầu ra tương ứng và đưa vào ngữ cảnh phiên. Thay đổi cách Claude giải thích code và cấu trúc phản hồi.",example:`{
|
|
31
|
-
"codingLevel": 1
|
|
32
|
-
}`},privacyBlock:{path:"privacyBlock",type:"boolean",default:"true",description:"Enables or disables the privacy protection hook that blocks access to sensitive files and domains.",descriptionVi:"Bật hoặc tắt hook bảo vệ quyền riêng tư, chặn truy cập vào các tệp và domain nhạy cảm.",effect:"When true, blocks reading files like .env, passwords, credentials, SSH keys, and API tokens.",effectVi:"Khi bật, chặn đọc các tệp như .env, mật khẩu, thông tin xác thực, SSH keys và API tokens.",example:`{
|
|
33
|
-
"privacyBlock": false
|
|
34
|
-
}`},"plan.namingFormat":{path:"plan.namingFormat",type:"string",default:'"{date}-{issue}-{slug}"',description:"Template for naming plan directories. Uses placeholder tokens that get replaced at runtime.",descriptionVi:"Mẫu đặt tên thư mục kế hoạch. Sử dụng các token placeholder được thay thế khi chạy.",effect:"{date} is replaced with formatted date, {issue} is extracted from branch, {slug} is for agent substitution.",effectVi:"{date} được thay bằng ngày đã định dạng, {issue} trích xuất từ branch, {slug} cho agent thay thế.",example:`{
|
|
35
|
-
"plan": {
|
|
36
|
-
"namingFormat": "{date}-{slug}"
|
|
37
|
-
}
|
|
38
|
-
}`},"plan.dateFormat":{path:"plan.dateFormat",type:"string",default:'"YYMMDD-HHmm"',description:"Date format string for {date} token in naming pattern.",descriptionVi:"Chuỗi định dạng ngày cho token {date} trong mẫu đặt tên.",example:`{
|
|
39
|
-
"plan": {
|
|
40
|
-
"dateFormat": "YYMMDD"
|
|
41
|
-
}
|
|
42
|
-
}`},"plan.issuePrefix":{path:"plan.issuePrefix",type:"string | null",default:"null",description:"Prefix to prepend to extracted issue numbers in plan naming (e.g., 'GH-', 'JIRA-').",descriptionVi:"Tiền tố thêm vào số issue trích xuất trong đặt tên kế hoạch (vd: 'GH-', 'JIRA-').",example:`{
|
|
43
|
-
"plan": {
|
|
44
|
-
"issuePrefix": "GH-"
|
|
45
|
-
}
|
|
46
|
-
}`},"plan.reportsDir":{path:"plan.reportsDir",type:"string",default:'"reports"',description:"Subdirectory name within plan directory for storing reports.",descriptionVi:"Tên thư mục con trong thư mục kế hoạch để lưu trữ báo cáo.",example:`{
|
|
47
|
-
"plan": {
|
|
48
|
-
"reportsDir": "reports"
|
|
49
|
-
}
|
|
50
|
-
}`},"plan.resolution.order":{path:"plan.resolution.order",type:"string[]",default:'["session", "branch"]',validValues:["session","branch","directory"],description:"Order of resolution methods to try when finding the active plan.",descriptionVi:"Thứ tự các phương thức giải quyết để tìm kế hoạch đang hoạt động.",example:`{
|
|
51
|
-
"plan": {
|
|
52
|
-
"resolution": {
|
|
53
|
-
"order": ["session", "branch"]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}`},"plan.resolution.branchPattern":{path:"plan.resolution.branchPattern",type:"string (regex)",default:'"(?:feat|fix|chore|refactor|docs)/(?:[^/]+/)?(.+)"',description:"Regex pattern for extracting plan slug from git branch name. Capture group 1 is used as the slug.",descriptionVi:"Mẫu regex để trích xuất slug kế hoạch từ tên nhánh git. Nhóm bắt 1 được dùng làm slug.",example:`{
|
|
57
|
-
"plan": {
|
|
58
|
-
"resolution": {
|
|
59
|
-
"branchPattern": "(?:feat|fix)/(.+)"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}`},"plan.validation.mode":{path:"plan.validation.mode",type:"string",default:'"prompt"',validValues:["prompt","auto","strict","none"],description:"Controls when plan validation interview runs.",descriptionVi:"Điều khiển thời điểm chạy phỏng vấn xác thực kế hoạch.",example:`{
|
|
63
|
-
"plan": {
|
|
64
|
-
"validation": {
|
|
65
|
-
"mode": "auto"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}`},"plan.validation.minQuestions":{path:"plan.validation.minQuestions",type:"number",default:"3",description:"Minimum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối thiểu trong quá trình xem xét kế hoạch.",example:`{
|
|
69
|
-
"plan": {
|
|
70
|
-
"validation": {
|
|
71
|
-
"minQuestions": 5
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}`},"plan.validation.maxQuestions":{path:"plan.validation.maxQuestions",type:"number",default:"8",description:"Maximum number of validation questions to ask during plan review.",descriptionVi:"Số câu hỏi xác thực tối đa trong quá trình xem xét kế hoạch.",example:`{
|
|
75
|
-
"plan": {
|
|
76
|
-
"validation": {
|
|
77
|
-
"maxQuestions": 10
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}`},"plan.validation.focusAreas":{path:"plan.validation.focusAreas",type:"string[]",default:'["assumptions", "risks", "tradeoffs", "architecture"]',description:"Categories of questions to focus on during validation interview.",descriptionVi:"Các danh mục câu hỏi tập trung trong phỏng vấn xác thực.",example:`{
|
|
81
|
-
"plan": {
|
|
82
|
-
"validation": {
|
|
83
|
-
"focusAreas": ["security", "performance"]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}`},"paths.docs":{path:"paths.docs",type:"string",default:'"docs"',description:"Path to documentation directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục tài liệu (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
87
|
-
"paths": {
|
|
88
|
-
"docs": "docs"
|
|
89
|
-
}
|
|
90
|
-
}`},"paths.plans":{path:"paths.plans",type:"string",default:'"plans"',description:"Path to plans directory (relative to project root or absolute).",descriptionVi:"Đường dẫn thư mục kế hoạch (tương đối với thư mục gốc hoặc tuyệt đối).",example:`{
|
|
91
|
-
"paths": {
|
|
92
|
-
"plans": "plans"
|
|
93
|
-
}
|
|
94
|
-
}`},"locale.thinkingLanguage":{path:"locale.thinkingLanguage",type:"string | null",default:"null",description:"Language for internal reasoning and logic. Recommended: 'en' for precision.",descriptionVi:"Ngôn ngữ suy luận nội bộ và logic. Khuyến nghị: 'en' để chính xác.",example:`{
|
|
95
|
-
"locale": {
|
|
96
|
-
"thinkingLanguage": "en"
|
|
97
|
-
}
|
|
98
|
-
}`},"locale.responseLanguage":{path:"locale.responseLanguage",type:"string | null",default:"null",description:"Language for user-facing output (responses, explanations, comments).",descriptionVi:"Ngôn ngữ cho đầu ra người dùng (phản hồi, giải thích, nhận xét).",example:`{
|
|
99
|
-
"locale": {
|
|
100
|
-
"responseLanguage": "fr"
|
|
101
|
-
}
|
|
102
|
-
}`},"trust.enabled":{path:"trust.enabled",type:"boolean",default:"false",description:"Enables trusted execution mode. When enabled, bypasses certain security prompts.",descriptionVi:"Bật chế độ thực thi tin cậy. Khi bật, bỏ qua một số lời nhắc bảo mật.",example:`{
|
|
103
|
-
"trust": {
|
|
104
|
-
"enabled": true
|
|
105
|
-
}
|
|
106
|
-
}`},"trust.passphrase":{path:"trust.passphrase",type:"string | null",default:"null",description:"Secret passphrase for testing context injection and trust verification.",descriptionVi:"Cụm mật khẩu bí mật để kiểm tra tiêm ngữ cảnh và xác minh tin cậy.",example:`{
|
|
107
|
-
"trust": {
|
|
108
|
-
"passphrase": "super-secret-key"
|
|
109
|
-
}
|
|
110
|
-
}`},"project.type":{path:"project.type",type:"string",default:'"auto"',validValues:["auto","library","application","monorepo","cli","api","web","mobile"],description:"Override automatic project type detection.",descriptionVi:"Ghi đè phát hiện loại dự án tự động.",example:`{
|
|
111
|
-
"project": {
|
|
112
|
-
"type": "monorepo"
|
|
113
|
-
}
|
|
114
|
-
}`},"project.packageManager":{path:"project.packageManager",type:"string",default:'"auto"',validValues:["auto","npm","yarn","pnpm","bun"],description:"Override automatic package manager detection.",descriptionVi:"Ghi đè phát hiện trình quản lý gói tự động.",example:`{
|
|
115
|
-
"project": {
|
|
116
|
-
"packageManager": "pnpm"
|
|
117
|
-
}
|
|
118
|
-
}`},"project.framework":{path:"project.framework",type:"string",default:'"auto"',validValues:["auto","react","vue","angular","svelte","nextjs","nuxt","express","nestjs","fastify","none"],description:"Override automatic framework detection.",descriptionVi:"Ghi đè phát hiện framework tự động.",example:`{
|
|
119
|
-
"project": {
|
|
120
|
-
"framework": "nextjs"
|
|
121
|
-
}
|
|
122
|
-
}`},docs:{path:"docs",type:"object",default:"{}",description:"Configuration for documentation management including file size limits and splitting behavior.",descriptionVi:"Cấu hình quản lý tài liệu bao gồm giới hạn kích thước tệp và hành vi chia nhỏ.",effect:"Controls how documentation files are processed and split when they exceed size limits.",effectVi:"Điều khiển cách các tệp tài liệu được xử lý và chia nhỏ khi vượt quá giới hạn kích thước."},"docs.maxLoc":{path:"docs.maxLoc",type:"number",default:"800",description:"Maximum lines of code per documentation file before automatic splitting is triggered.",descriptionVi:"Số dòng code tối đa mỗi tệp tài liệu trước khi tự động chia nhỏ được kích hoạt.",effect:"When a documentation file exceeds this line count, the system will suggest or automatically split it into smaller files for better readability and maintenance.",effectVi:"Khi tệp tài liệu vượt quá số dòng này, hệ thống sẽ đề xuất hoặc tự động chia nhỏ thành các tệp nhỏ hơn để dễ đọc và bảo trì hơn.",example:`{
|
|
123
|
-
"docs": {
|
|
124
|
-
"maxLoc": 1000
|
|
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. 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
|
-
"gemini": {
|
|
128
|
-
"model": "gemini-2.5-pro"
|
|
129
|
-
}
|
|
130
|
-
}`},skills:{path:"skills",type:"object",default:"{}",description:"Configuration for skills system including research behavior and custom skill settings.",descriptionVi:"Cấu hình hệ thống kỹ năng bao gồm hành vi nghiên cứu và cài đặt kỹ năng tùy chỉnh.",effect:"Controls how skills are executed, particularly research operations and their AI provider choices.",effectVi:"Điều khiển cách các kỹ năng được thực thi, đặc biệt là thao tác nghiên cứu và lựa chọn nhà cung cấp AI."},"skills.research":{path:"skills.research",type:"object",default:"{}",description:"Configuration specific to the research skill behavior and AI provider selection.",descriptionVi:"Cấu hình riêng cho hành vi kỹ năng nghiên cứu và lựa chọn nhà cung cấp AI.",effect:"Determines whether research operations use Gemini CLI or Claude's built-in WebSearch tool.",effectVi:"Xác định liệu thao tác nghiên cứu có dùng Gemini CLI hay công cụ WebSearch tích hợp của Claude."},"skills.research.useGemini":{path:"skills.research.useGemini",type:"boolean",default:"true",description:"When enabled, uses Gemini CLI for research operations instead of Claude's WebSearch tool.",descriptionVi:"Khi bật, dùng Gemini CLI cho thao tác nghiên cứu thay vì công cụ WebSearch của Claude.",effect:"Gemini CLI offers faster search results and lower token costs for research, but requires Gemini API setup. WebSearch is built-in but more expensive.",effectVi:"Gemini CLI cung cấp kết quả tìm kiếm nhanh hơn và chi phí token thấp hơn cho nghiên cứu, nhưng cần thiết lập Gemini API. WebSearch tích hợp sẵn nhưng đắt hơn.",example:`{
|
|
131
|
-
"skills": {
|
|
132
|
-
"research": {
|
|
133
|
-
"useGemini": false
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}`},hooks:{path:"hooks",type:"object",default:"{}",description:"Configuration for lifecycle hooks that inject context, enforce rules, and enhance safety throughout the development workflow.",descriptionVi:"Cấu hình các hook vòng đời tiêm ngữ cảnh, thực thi quy tắc và tăng cường an toàn trong suốt quy trình phát triển.",effect:"Controls which hooks are active. Each hook fires at specific points in the workflow to inject context or enforce guardrails.",effectVi:"Điều khiển hook nào đang hoạt động. Mỗi hook kích hoạt tại các điểm cụ thể trong quy trình để tiêm ngữ cảnh hoặc thực thi bảo vệ."},"hooks.session-init":{path:"hooks.session-init",type:"boolean",default:"true",description:"Runs project detection and environment setup at the start of every Claude Code session.",descriptionVi:"Chạy phát hiện dự án và thiết lập môi trường khi bắt đầu mỗi phiên Claude Code.",effect:"When enabled, automatically detects project type, framework, package manager, and injects relevant context into the session.",effectVi:"Khi bật, tự động phát hiện loại dự án, framework, trình quản lý gói và tiêm ngữ cảnh liên quan vào phiên.",example:`{
|
|
137
|
-
"hooks": {
|
|
138
|
-
"session-init": false
|
|
139
|
-
}
|
|
140
|
-
}`},"hooks.subagent-init":{path:"hooks.subagent-init",type:"boolean",default:"true",description:"Injects context (paths, plans, reports) into spawned subagents to ensure consistency.",descriptionVi:"Tiêm ngữ cảnh (đường dẫn, kế hoạch, báo cáo) vào các subagent được tạo để đảm bảo nhất quán.",effect:"Ensures subagents inherit work context, know where to save reports, and follow the same plan structure as the parent agent.",effectVi:"Đảm bảo subagent kế thừa ngữ cảnh làm việc, biết nơi lưu báo cáo và tuân theo cùng cấu trúc kế hoạch với agent cha.",example:`{
|
|
141
|
-
"hooks": {
|
|
142
|
-
"subagent-init": false
|
|
143
|
-
}
|
|
144
|
-
}`},"hooks.descriptive-name":{path:"hooks.descriptive-name",type:"boolean",default:"true",description:"Injects descriptive naming context so agents generate meaningful, self-documenting file and variable names.",descriptionVi:"Tiêm ngữ cảnh đặt tên mô tả để agent tạo tên tệp và biến có ý nghĩa, tự tài liệu hóa.",effect:"When enabled, reminds the agent to use long, descriptive kebab-case names for files and clear variable naming conventions.",effectVi:"Khi bật, nhắc nhở agent sử dụng tên kebab-case dài, mô tả cho tệp và quy ước đặt tên biến rõ ràng.",example:`{
|
|
145
|
-
"hooks": {
|
|
146
|
-
"descriptive-name": false
|
|
147
|
-
}
|
|
148
|
-
}`},"hooks.dev-rules-reminder":{path:"hooks.dev-rules-reminder",type:"boolean",default:"true",description:"Injects development rules context before tool execution to maintain coding standards.",descriptionVi:"Tiêm ngữ cảnh quy tắc phát triển trước khi thực thi công cụ để duy trì chuẩn code.",effect:"Reminds the agent of coding standards, file naming conventions, and project-specific rules before file operations.",effectVi:"Nhắc nhở agent về chuẩn code, quy ước đặt tên tệp và quy tắc riêng của dự án trước thao tác tệp.",example:`{
|
|
149
|
-
"hooks": {
|
|
150
|
-
"dev-rules-reminder": false
|
|
151
|
-
}
|
|
152
|
-
}`},"hooks.usage-context-awareness":{path:"hooks.usage-context-awareness",type:"boolean",default:"true",description:"Injects usage-limit awareness into prompt context so the agent can react before overruns.",descriptionVi:"Tiêm nhận biết giới hạn sử dụng vào ngữ cảnh prompt để agent phản ứng trước khi vượt quá.",effect:"When enabled, reminder context can warn the agent to stay concise or split work when usage windows are tight.",effectVi:"Khi bật, ngữ cảnh nhắc nhở có thể cảnh báo agent nên ngắn gọn hơn hoặc chia nhỏ công việc khi cửa sổ sử dụng trở nên chặt.",example:`{
|
|
153
|
-
"hooks": {
|
|
154
|
-
"usage-context-awareness": false
|
|
155
|
-
}
|
|
156
|
-
}`},"hooks.context-tracking":{path:"hooks.context-tracking",type:"boolean",default:"true",description:"Tracks context window usage and injects awareness data so agents can optimize token consumption.",descriptionVi:"Theo dõi sử dụng cửa sổ ngữ cảnh và tiêm dữ liệu nhận biết để agent tối ưu hóa tiêu thụ token.",effect:"When enabled, monitors context percentage and remaining capacity, warning the agent when approaching limits to prevent truncation.",effectVi:"Khi bật, giám sát phần trăm ngữ cảnh và dung lượng còn lại, cảnh báo agent khi tiến gần giới hạn để ngăn cắt xén.",example:`{
|
|
157
|
-
"hooks": {
|
|
158
|
-
"context-tracking": false
|
|
159
|
-
}
|
|
160
|
-
}`},"hooks.scout-block":{path:"hooks.scout-block",type:"boolean",default:"true",description:"Blocks heavy directories (node_modules, .git, dist) from exploration to save tokens.",descriptionVi:"Chặn các thư mục nặng (node_modules, .git, dist) khỏi khám phá để tiết kiệm token.",effect:"Prevents the agent from reading irrelevant or large directories that waste tokens and context window space.",effectVi:"Ngăn agent đọc các thư mục không liên quan hoặc lớn lãng phí token và không gian cửa sổ ngữ cảnh.",example:`{
|
|
161
|
-
"hooks": {
|
|
162
|
-
"scout-block": false
|
|
163
|
-
}
|
|
164
|
-
}`},"hooks.privacy-block":{path:"hooks.privacy-block",type:"boolean",default:"true",description:"Blocks reading sensitive files (.env, credentials, secrets) to protect user privacy.",descriptionVi:"Chặn đọc các tệp nhạy cảm (.env, thông tin xác thực, bí mật) để bảo vệ quyền riêng tư người dùng.",effect:"When enabled, prompts user for permission before accessing files that may contain API keys, passwords, or other secrets.",effectVi:"Khi bật, nhắc người dùng cho phép trước khi truy cập tệp có thể chứa API keys, mật khẩu hoặc bí mật khác.",example:`{
|
|
165
|
-
"hooks": {
|
|
166
|
-
"privacy-block": false
|
|
167
|
-
}
|
|
168
|
-
}`},"hooks.post-edit-simplify-reminder":{path:"hooks.post-edit-simplify-reminder",type:"boolean",default:"true",description:"Reminds the agent to simplify code after file edits to maintain readability and prevent bloat.",descriptionVi:"Nhắc nhở agent đơn giản hóa code sau khi chỉnh sửa tệp để duy trì khả năng đọc và ngăn phình to.",effect:"After editing files, suggests reviewing for unnecessary complexity, redundant code, or opportunities to refactor.",effectVi:"Sau khi chỉnh sửa tệp, đề xuất xem xét độ phức tạp không cần thiết, code dư thừa hoặc cơ hội refactor.",example:`{
|
|
169
|
-
"hooks": {
|
|
170
|
-
"post-edit-simplify-reminder": false
|
|
171
|
-
}
|
|
172
|
-
}`},"updatePipeline.autoInitAfterUpdate":{path:"updatePipeline.autoInitAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck init` after `ck update` when the installed kit content has a newer version.",descriptionVi:"Tự động chạy `ck init` sau `ck update` khi nội dung kit đã cài có phiên bản mới hơn.",effect:"Power users can reduce the update flow to one command. This setting is read from global config for update runs.",effectVi:"Người dùng nâng cao có thể rút gọn quy trình cập nhật còn một lệnh. Thiết lập này được đọc từ global config trong lúc update.",example:`{
|
|
173
|
-
"updatePipeline": {
|
|
174
|
-
"autoInitAfterUpdate": true,
|
|
175
|
-
"autoMigrateAfterUpdate": true,
|
|
176
|
-
"migrateProviders": ["codex"]
|
|
177
|
-
}
|
|
178
|
-
}`},"updatePipeline.autoMigrateAfterUpdate":{path:"updatePipeline.autoMigrateAfterUpdate",type:"boolean",default:"false",description:"Automatically runs `ck migrate` as an independent step after `ck update` for detected or configured providers.",descriptionVi:"Tự động chạy `ck migrate` như bước độc lập sau `ck update` cho các provider được phát hiện hoặc đã cấu hình.",effect:"Runs independently of kit init — even if kit is already at latest, providers can still be synced.",effectVi:"Chạy độc lập với kit init — ngay cả khi kit đã ở phiên bản mới nhất, provider vẫn có thể được đồng bộ.",example:`{
|
|
179
|
-
"updatePipeline": {
|
|
180
|
-
"autoInitAfterUpdate": true,
|
|
181
|
-
"autoMigrateAfterUpdate": true,
|
|
182
|
-
"migrateProviders": ["codex"]
|
|
183
|
-
}
|
|
184
|
-
}`},"updatePipeline.migrateProviders":{path:"updatePipeline.migrateProviders",type:'"auto" | string[]',default:'"auto"',validValues:["auto"],description:'Choose which providers are auto-migrated. Use `auto` to scan the filesystem, enter a comma-separated list such as `codex, cursor`, or paste a JSON array like `["codex"]` and the form will normalize it.',descriptionVi:'Chọn provider nào sẽ được auto-migrate. Dùng `auto` để quét hệ thống tệp, nhập danh sách phân tách bằng dấu phẩy như `codex, cursor`, hoặc dán JSON array như `["codex"]` và form sẽ tự chuẩn hóa.',effect:"`auto` targets every detected provider. A specific list limits the auto-migrate step to those providers only.",effectVi:"`auto` nhắm đến mọi provider được phát hiện. Danh sách cụ thể sẽ giới hạn bước auto-migrate chỉ còn các provider đó.",example:`{
|
|
185
|
-
"updatePipeline": {
|
|
186
|
-
"autoInitAfterUpdate": true,
|
|
187
|
-
"autoMigrateAfterUpdate": true,
|
|
188
|
-
"migrateProviders": ["codex"]
|
|
189
|
-
}
|
|
190
|
-
}`},statusline:{path:"statusline",type:"string",default:'"full"',validValues:["full","compact","minimal","none"],description:"Controls how much information is displayed in the Claude Code status line during operations.",descriptionVi:"Điều khiển lượng thông tin hiển thị trong dòng trạng thái Claude Code trong khi thao tác.",effect:"'full' shows all details (tokens, model, cost). 'compact' shows summary. 'minimal' shows only critical info. 'none' hides status line.",effectVi:"'full' hiển thị tất cả chi tiết (token, model, chi phí). 'compact' hiển thị tóm tắt. 'minimal' chỉ hiển thị thông tin quan trọng. 'none' ẩn dòng trạng thái.",example:`{
|
|
191
|
-
"statusline": "compact"
|
|
192
|
-
}`},statuslineColors:{path:"statuslineColors",type:"boolean",default:"true",description:"Controls whether the statusline uses ANSI color codes. When false, renders plain text. NO_COLOR/FORCE_COLOR env vars are also respected.",descriptionVi:"Kiểm soát việc thanh trạng thái sử dụng mã màu ANSI. Khi tắt, hiển thị văn bản thuần. Biến môi trường NO_COLOR/FORCE_COLOR cũng được hỗ trợ.",effect:"When enabled, statusline elements are colorized (model=cyan, dir=yellow, branch=magenta, context=threshold). When disabled, all output is plain text.",effectVi:"Khi bật, các phần tử thanh trạng thái được tô màu (model=xanh lam, thư mục=vàng, nhánh=tím, ngữ cảnh=theo ngưỡng). Khi tắt, tất cả đầu ra là văn bản thuần.",example:`{
|
|
193
|
-
"statuslineColors": false
|
|
194
|
-
}`},statuslineQuota:{path:"statuslineQuota",type:"boolean",default:"true",description:"Controls whether the cosmetic 5h / wk quota chips are shown in the statusline.",descriptionVi:"Kiểm soát việc các nhãn quota 5h / wk mang tính thẩm mỹ có được hiển thị trong thanh trạng thái hay không.",effect:"When enabled, the statusline shows cached 5h and weekly quota percentages. When disabled, the rest of the statusline stays intact and only the quota chips are hidden.",effectVi:"Khi bật, thanh trạng thái hiển thị phần trăm quota 5h và hàng tuần từ cache. Khi tắt, phần còn lại của thanh trạng thái vẫn giữ nguyên và chỉ ẩn các nhãn quota.",example:`{
|
|
195
|
-
"statuslineQuota": false
|
|
196
|
-
}`},assertions:{path:"assertions",type:"string[]",default:"[]",description:"List of user-defined assertions that are injected at the start of every session.",descriptionVi:"Danh sách các khẳng định do người dùng định nghĩa, được tiêm vào đầu mỗi phiên.",example:`{
|
|
197
|
-
"assertions": ["Use strict mode", "No console.logs"]
|
|
198
|
-
}`}};function U2(t,e,n){const r={...t},i=e.split(".");let s=r;for(let o=0;o<i.length-1;o++){const a=i[o];!(a in s)||typeof s[a]!="object"||s[a]===null?s[a]={}:s[a]={...s[a]},s=s[a]}return s[i[i.length-1]]=n,r}function Md(t,e){const n=e.split(".");let r=t;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}function A0(t,e){const n=e.split(".");let r=t;for(const i of n){if(!r.properties)return{};const s=r.properties;if(!s[i])return{};r=s[i]}return r}function K2(t){if(Array.isArray(t.oneOf)){const e=t.oneOf.map(n=>{if(!n||typeof n!="object")return null;const r=n;return r.const!==void 0?JSON.stringify(r.const):r.type==="array"&&r.items?"string[]":Array.isArray(r.type)?r.type.join(" | "):typeof r.type=="string"?r.type:null}).filter(n=>!!n);return e.length>0?e.join(" | "):"unknown"}return Array.isArray(t.type)?t.type.join(" | "):typeof t.type=="string"?t.type:"unknown"}function G2(t,e){if(!t)return null;const n=D0[t];if(n)return n;if(!e)return null;const r=A0(e,t);if(Object.keys(r).length===0)return null;const i=Array.isArray(r.enum)?r.enum.map(s=>String(s)):Array.isArray(r.oneOf)?r.oneOf.map(s=>{if(!s||typeof s!="object")return null;const o=s;return o.const!==void 0?String(o.const):null}).filter(s=>!!s):void 0;return{path:t,type:K2(r),default:r.default!==void 0?JSON.stringify(r.default):"n/a",validValues:i&&i.length>0?i:void 0,description:typeof r.description=="string"?r.description:"Schema-derived help is available for this field.",descriptionVi:typeof r.description=="string"?r.description:"Trường này đang hiển thị mô tả được suy ra từ schema."}}function q2(t,e){return t??e??null}function Ki(t){return t==="auto"?"auto":Array.isArray(t)?t.join(", "):typeof t=="string"?t:""}function Y2(t){const e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e).trim().toLowerCase()}function J2(t){const e=t.trim();if(!e)return[];try{const n=JSON.parse(e);if(typeof n=="string"||Array.isArray(n))return n}catch{}return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean):e}function M0(t){const e=J2(t),n=(Array.isArray(e)?e:String(e).split(",")).map(Y2).filter(Boolean).filter((r,i,s)=>s.indexOf(r)===i);return n.length===0||n.length===1&&n[0]==="auto"?"auto":n.filter(r=>r!=="auto")}function Q2(t){return t.trim()===""?null:M0(t)}const X2=({value:t,onChange:e,onFocus:n,disabled:r})=>d.jsx("input",{type:"text",value:t??"",onChange:i=>e(i.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
199
|
-
text-dash-text placeholder-dash-text-muted
|
|
200
|
-
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
201
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
202
|
-
transition-colors`,placeholder:"Enter value..."}),Z2=({value:t,onChange:e,onFocus:n,schema:r,disabled:i})=>d.jsx("input",{type:"number",value:t!=null?String(t):"",onChange:s=>{const o=s.target.value;if(o==="")e(null);else{const a=r.type==="integer"?Number.parseInt(o,10):Number.parseFloat(o);Number.isNaN(a)||e(a)}},onFocus:n,min:r.minimum,max:r.maximum,disabled:i,className:`w-full px-3 py-2 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
203
|
-
text-dash-text placeholder-dash-text-muted
|
|
204
|
-
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
205
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
206
|
-
transition-colors`}),eS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const i=t===!0;return d.jsx("button",{type:"button",role:"switch","aria-checked":i,onClick:()=>e(!i),onFocus:n,disabled:r,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors
|
|
207
|
-
focus:outline-none focus:ring-2 focus:ring-dash-accent/50
|
|
208
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
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})=>{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
|
|
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 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
|
|
215
|
-
text-dash-text placeholder-dash-text-muted
|
|
216
|
-
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
217
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
218
|
-
transition-colors`,placeholder:"auto or codex, cursor"})},rS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const i=Array.isArray(t)?t:[],[s,o]=m.useState(""),a=()=>{s.trim()&&(e([...i,s.trim()]),o(""))},l=c=>{const h=i.filter((u,f)=>f!==c);e(h.length>0?h:[])};return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map((c,h)=>d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-dash-bg border border-dash-border rounded text-xs text-dash-text",children:[String(c),!r&&d.jsx("button",{type:"button",onClick:()=>l(h),className:"text-dash-text-muted hover:text-red-500 transition-colors",children:d.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))}),!r&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:s,onChange:c=>o(c.target.value),onFocus:n,onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),a())},placeholder:"Add item...",className:`flex-1 px-2 py-1 text-xs bg-dash-bg border border-dash-border rounded
|
|
219
|
-
text-dash-text placeholder-dash-text-muted
|
|
220
|
-
focus:outline-none focus:ring-1 focus:ring-dash-accent/50`}),d.jsx("button",{type:"button",onClick:a,className:"px-2 py-1 text-xs bg-dash-accent text-white rounded hover:bg-dash-accent-hover transition-colors",children:"+"})]})]})},iS=({value:t,onChange:e,onFocus:n,disabled:r})=>{const[i,s]=m.useState(!1);return d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:i?"text":"password",value:t??"",onChange:o=>e(o.target.value||null),onFocus:n,disabled:r,className:`w-full px-3 py-2 pr-10 text-sm bg-dash-bg border border-dash-border rounded-lg
|
|
221
|
-
text-dash-text placeholder-dash-text-muted
|
|
222
|
-
focus:outline-none focus:ring-2 focus:ring-dash-accent/50 focus:border-dash-accent
|
|
223
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
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=`
|
|
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=`
|
|
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=`
|
|
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)||`
|
|
228
|
-
`}get readOnly(){return this.facet(tb)}phrase(e,...n){for(let r of this.facet(Se.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(J0))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return ek(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ye(n,o,!1);if(s(n.slice(l,o))!=Ie.Word)break;o=l}for(;a<i;){let l=Ye(n,a);if(s(n.slice(a,l))!=Ie.Word)break;a=l}return o==a?null:L.range(o+r,a+r)}}Se.allowMultipleSelections=Hd;Se.tabSize=Y.define({combine:t=>t.length?t[0]:4});Se.lineSeparator=Q0;Se.readOnly=tb;Se.phrases=Y.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});Se.languageData=J0;Se.changeFilter=X0;Se.transactionFilter=Z0;Se.transactionExtender=eb;_l.reconfigure=me.define();function Rn(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class cr{eq(e){return this==e}range(e,n=e){return Os.create(e,n,this)}}cr.prototype.startSide=cr.prototype.endSide=0;cr.prototype.point=!1;cr.prototype.mapMode=wt.TrackDel;function Qh(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class Os{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Os(e,n,r)}}function Wd(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Xh{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,f,p;if(h==u){let g=n.mapPos(h,c.startSide,c.mapMode);if(g==null||(f=p=g,c.startSide!=c.endSide&&(p=n.mapPos(h,c.endSide),p<f)))continue}else if(f=n.mapPos(h,c.startSide),p=n.mapPos(u,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),r.push(c),i.push(f-o),s.push(p-o))}return{mapped:r.length?new Xh(i,s,r,a):null,pos:o}}}class ye{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new ye(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Wd)),this.isEmpty)return n.length?ye.of(n):this;let a=new ib(this,null,-1).goto(0),l=0,c=[],h=new Vn;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let u=n[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push(Os.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?ye.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),n.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(i=Math.max(i,h.maxPoint),n.push(h),r.push(u))}}let s=this.nextLayer.map(e);return n.length==0?s:new ye(r,n,s||ye.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Ps.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Ps.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=n.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=Hf(o,a,r),c=new Yi(o,l,s),h=new Yi(a,l,s);r.iterGaps((u,f,p)=>Vf(c,u,h,f,p,i)),r.empty&&r.length==0&&Vf(c,0,h,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),o=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=Hf(s,o),l=new Yi(s,a,0).goto(r),c=new Yi(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Ud(l.active,c.active)||l.point&&(!c.point||!Qh(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let o=new Yi(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<n?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);i.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new Vn;for(let i of e instanceof Os?[e]:n?tk(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return ye.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=ye.empty;i=i.nextLayer)n=new ye(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}ye.empty=new ye([],[],null,-1);function tk(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Wd(e,r)>0)return t.slice().sort(Wd);e=r}return t}ye.empty.nextLayer=ye.empty;class Vn{finishChunk(e){this.chunks.push(new Xh(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new Vn)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(ye.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ye.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Hf(t,e,n){let r=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(n?n.mapPos(a):a)==s.chunkPos[o]&&!n?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class ib{constructor(e,n,r,i=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Ps{constructor(e){this.heap=e}static from(e,n=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new ib(o,n,r,s));return i.length==1?i[0]:new Ps(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)jc(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)jc(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),jc(this.heap,0)}}}function jc(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Yi{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ps.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){ma(this.active,e),ma(this.activeTo,e),ma(this.activeRank,e),this.minActive=_f(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;ga(this.active,n,r),ga(this.activeTo,n,i),ga(this.activeRank,n,s),e&&ga(e,n,this.cursor.from),this.minActive=_f(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&ma(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Vf(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let h=!1;;){let u=t.to+l-n.to,f=u||t.endSide-n.endSide,p=f<0?t.to+l:n.to,g=Math.min(p,o);if(t.point||n.point?(t.point&&n.point&&Qh(t.point,n.point)&&Ud(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,g,t.point,n.point),h=!1):(h&&s.boundChange(a),g>a&&!Ud(t.active,n.active)&&s.compareRange(a,g,t.active,n.active),c&&g<o&&(u||t.openEnd(p)!=n.openEnd(p))&&(h=!0)),p>o)break;a=p,f<=0&&t.next(),f>=0&&n.next()}}function Ud(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Qh(t[n],e[n]))return!1;return!0}function ma(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function ga(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function _f(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function Oi(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Ye(t,i));return r}function Kd(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=Ye(t,i)}return r===!0?-1:t.length}const Gd="ͼ",Wf=typeof Symbol>"u"?"__"+Gd:Symbol.for(Gd),qd=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class dr{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(b=>o.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),g,l);else if(g&&typeof g=="object"){if(!u)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),g,h,f)}else g!=null&&h.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(h.length||f)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
229
|
-
`)}static newName(){let e=Uf[Wf]||1;return Uf[Wf]=e+1,Gd+e.toString(36)}static mount(e,n,r){let i=e[qd],s=r&&r.nonce;i?s&&i.setNonce(s):i=new nk(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Kf=new Map;class nk{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Kf.get(r);if(s)return e[qd]=s;this.sheet=new i.CSSStyleSheet,Kf.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[qd]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
230
|
-
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var hr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ns={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rk=typeof navigator<"u"&&/Mac/.test(navigator.platform),ik=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var it=0;it<10;it++)hr[48+it]=hr[96+it]=String(it);for(var it=1;it<=24;it++)hr[it+111]="F"+it;for(var it=65;it<=90;it++)hr[it]=String.fromCharCode(it+32),Ns[it]=String.fromCharCode(it);for(var Oc in hr)Ns.hasOwnProperty(Oc)||(Ns[Oc]=hr[Oc]);function sk(t){var e=rk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ik&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ns:hr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Me(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)sb(t,arguments[e]);return t}function sb(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)sb(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let vt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Yd=typeof document<"u"?document:{documentElement:{style:{}}};const Jd=/Edge\/(\d+)/.exec(vt.userAgent),ob=/MSIE \d/.test(vt.userAgent),Qd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vt.userAgent),Wl=!!(ob||Qd||Jd),Gf=!Wl&&/gecko\/(\d+)/i.test(vt.userAgent),Pc=!Wl&&/Chrome\/(\d+)/.exec(vt.userAgent),ok="webkitFontSmoothing"in Yd.documentElement.style,Xd=!Wl&&/Apple Computer/.test(vt.vendor),qf=Xd&&(/Mobile\/\w+/.test(vt.userAgent)||vt.maxTouchPoints>2);var q={mac:qf||/Mac/.test(vt.platform),windows:/Win/.test(vt.platform),linux:/Linux|X11/.test(vt.platform),ie:Wl,ie_version:ob?Yd.documentMode||6:Qd?+Qd[1]:Jd?+Jd[1]:0,gecko:Gf,gecko_version:Gf?+(/Firefox\/(\d+)/.exec(vt.userAgent)||[0,0])[1]:0,chrome:!!Pc,chrome_version:Pc?+Pc[1]:0,ios:qf,android:/Android\b/.test(vt.userAgent),webkit_version:ok?+(/\bAppleWebKit\/(\d+)/.exec(vt.userAgent)||[0,0])[1]:0,safari:Xd,safari_version:Xd?+(/\bVersion\/(\d+(\.\d+)?)/.exec(vt.userAgent)||[0,0])[1]:0,tabSize:Yd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Zh(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const ll=Object.create(null);function eu(t,e,n){if(t==e)return!0;t||(t=ll),e||(e=ll);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function ak(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Yf(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function lk(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class Ln{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var st=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(st||(st={}));class ie extends cr{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Eo(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Ir(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=ab(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Ir(e,r,i,n,e.widget||null,!0)}static line(e){return new Ro(e)}static set(e,n=!1){return ye.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ie.none=ye.empty;class Eo extends ie{constructor(e){let{start:n,end:r}=ab(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Zh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ll}eq(e){return this==e||e instanceof Eo&&this.tagName==e.tagName&&eu(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}Eo.prototype.point=!1;class Ro extends ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ro&&this.spec.class==e.spec.class&&eu(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Ro.prototype.mapMode=wt.TrackBefore;Ro.prototype.point=!0;class Ir extends ie{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?wt.TrackBefore:wt.TrackAfter:wt.TrackDel}get type(){return this.startSide!=this.endSide?st.WidgetRange:this.startSide<=0?st.WidgetBefore:st.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ir&&ck(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Ir.prototype.point=!0;function ab(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function ck(t,e){return t==e||!!(t&&e&&t.compare(e))}function di(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Ds extends cr{constructor(e,n){super(),this.tagName=e,this.attributes=n}eq(e){return e==this||e instanceof Ds&&this.tagName==e.tagName&&eu(this.attributes,e.attributes)}static create(e){return new Ds(e.tagName,e.attributes||ll)}static set(e,n=!1){return ye.of(e,n)}}Ds.prototype.startSide=Ds.prototype.endSide=-1;function As(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Zd(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function qa(t,e){if(!e.anchorNode)return!1;try{return Zd(t,e.anchorNode)}catch{return!1}}function us(t){return t.nodeType==3?Ts(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function fs(t,e,n,r){return n?Jf(t,e,n,r,-1)||Jf(t,e,n,r,1):!1}function ur(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function cl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Jf(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:_n(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=ur(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?_n(t):0}else return!1}}function _n(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ms(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function dk(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function lb(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function hk(t,e,n,r,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let h=t,u=!1;h&&!u;)if(h.nodeType==1){let f,p=h==l.body,g=1,b=1;if(p)f=dk(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let v=h.getBoundingClientRect();({scaleX:g,scaleY:b}=lb(h,v)),f={left:v.left,right:v.left+h.clientWidth*g,top:v.top,bottom:v.top+h.clientHeight*b}}let x=0,w=0;if(i=="nearest")e.top<f.top?(w=e.top-(f.top+o),n>0&&e.bottom>f.bottom+w&&(w=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(w=e.bottom-f.bottom+o,n<0&&e.top-w<f.top&&(w=e.top-(f.top+o)));else{let v=e.bottom-e.top,k=f.bottom-f.top;w=(i=="center"&&v<=k?e.top+v/2-k/2:i=="start"||i=="center"&&n<0?e.top-o:e.bottom-k+o)-f.top}if(r=="nearest"?e.left<f.left?(x=e.left-(f.left+s),n>0&&e.right>f.right+x&&(x=e.right-f.right+s)):e.right>f.right&&(x=e.right-f.right+s,n<0&&e.left<f.left+x&&(x=e.left-(f.left+s))):x=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,x||w)if(p)c.scrollBy(x,w);else{let v=0,k=0;if(w){let j=h.scrollTop;h.scrollTop+=w/b,k=(h.scrollTop-j)*b}if(x){let j=h.scrollLeft;h.scrollLeft+=x/g,v=(h.scrollLeft-j)*g}e={left:e.left-v,top:e.top-k,right:e.right-v,bottom:e.bottom-k},v&&Math.abs(v-x)<1&&(r="nearest"),k&&Math.abs(k-w)<1&&(i="nearest")}if(p)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function uk(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class fk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?_n(n):0),r,Math.min(e.focusOffset,r?_n(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Cr=null;q.safari&&q.safari_version>=26&&(Cr=!1);function cb(t){if(t.setActive)return t.setActive();if(Cr)return t.focus(Cr);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Cr==null?{get preventScroll(){return Cr={preventScroll:!0},!0}}:void 0),!Cr){Cr=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Qf;function Ts(t,e,n=e){let r=Qf||(Qf=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function hi(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function pk(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function mk(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,_n(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=_n(n))}else{if(n==t)return!0;r=ur(n),n=n.parentNode}}function db(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function hb(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=_n(n)}else if(n.parentNode&&!cl(n))r=ur(n),n=n.parentNode;else return null}}function ub(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!cl(n))r=ur(n)+1,n=n.parentNode;else return null}}class sn{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new sn(e.parentNode,ur(e),n)}static after(e,n){return new sn(e.parentNode,ur(e)+1,n)}}var Ee=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ee||(Ee={}));const $r=Ee.LTR,tu=Ee.RTL;function fb(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const gk=fb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),bk=fb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),eh=Object.create(null),wn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);eh[e]=n,eh[n]=-e}function pb(t){return t<=247?gk[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?bk[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const xk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Hn{get dir(){return this.level%2?tu:$r}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<n:a.to>n:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function mb(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!mb(r.inner,i.inner))return!1}return!0}const Te=[];function yk(t,e,n,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:n,l=s?256:i;for(let c=o,h=l,u=l;c<a;c++){let f=pb(t.charCodeAt(c));f==512?f=h:f==8&&u==4&&(f=16),Te[c]=f==4?2:f,f&7&&(u=f),h=f}for(let c=o,h=l,u=l;c<a;c++){let f=Te[c];if(f==128)c<a-1&&h==Te[c+1]&&h&24?f=Te[c]=h:Te[c]=256;else if(f==64){let p=c+1;for(;p<a&&Te[p]==64;)p++;let g=c&&h==8||p<n&&Te[p]==8?u==1?1:8:256;for(let b=c;b<p;b++)Te[b]=g;c=p-1}else f==8&&u==1&&(Te[c]=1);h=f,f&7&&(u=f)}}}function vk(t,e,n,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:n;for(let u=c,f,p,g;u<h;u++)if(p=eh[f=t.charCodeAt(u)])if(p<0){for(let b=a-3;b>=0;b-=3)if(wn[b+1]==-p){let x=wn[b+2],w=x&2?i:x&4?x&1?s:i:0;w&&(Te[u]=Te[wn[b]]=w),a=b;break}}else{if(wn.length==189)break;wn[a++]=u,wn[a++]=f,wn[a++]=l}else if((g=Te[u])==2||g==1){let b=g==i;l=b?0:1;for(let x=a-3;x>=0;x-=3){let w=wn[x+2];if(w&2)break;if(b)wn[x+2]|=2;else{if(w&4)break;wn[x+2]|=4}}}}}function wk(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=i<n.length?n[i].from:e;for(let l=o;l<a;){let c=Te[l];if(c==256){let h=l+1;for(;;)if(h==a){if(i==n.length)break;h=n[i++].to,a=i<n.length?n[i].from:e}else if(Te[h]==256)h++;else break;let u=s==1,f=(h<e?Te[h]:r)==1,p=u==f?u?1:2:r;for(let g=h,b=i,x=b?n[b-1].to:t;g>l;)g==x&&(g=n[--b].from,x=b?n[b-1].to:t),Te[--g]=p;l=h}else s=c,l++}}}function th(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let h=!0,u=!1;if(c==s.length||l<s[c].from){let b=Te[l];b!=a&&(h=!1,u=b==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,g=l;e:for(;;)if(c<s.length&&g==s[c].from){if(u)break e;let b=s[c];if(!h)for(let x=b.to,w=c+1;;){if(x==n)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(Te[x]==a)break e;break}}if(c++,f)f.push(b);else{b.from>l&&o.push(new Hn(l,b.from,p));let x=b.direction==$r!=!(p%2);nh(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.to}g=b.to}else{if(g==n||(h?Te[g]!=a:Te[g]==a))break;g++}f?th(t,l,g,r+1,i,f,o):l<g&&o.push(new Hn(l,g,p)),l=g}else for(let l=n,c=s.length;l>e;){let h=!0,u=!1;if(!c||l>s[c-1].to){let b=Te[l-1];b!=a&&(h=!1,u=b==16)}let f=!h&&a==1?[]:null,p=h?r:r+1,g=l;e:for(;;)if(c&&g==s[c-1].to){if(u)break e;let b=s[--c];if(!h)for(let x=b.from,w=c;;){if(x==e)break e;if(w&&s[w-1].to==x)x=s[--w].from;else{if(Te[x-1]==a)break e;break}}if(f)f.push(b);else{b.to<l&&o.push(new Hn(b.to,l,p));let x=b.direction==$r!=!(p%2);nh(t,x?r+1:r,i,b.inner,b.from,b.to,o),l=b.from}g=b.from}else{if(g==e||(h?Te[g-1]!=a:Te[g-1]==a))break;g--}f?th(t,g,l,r+1,i,f,o):g<l&&o.push(new Hn(g,l,p)),l=g}}function nh(t,e,n,r,i,s,o){let a=e%2?2:1;yk(t,i,s,r,a),vk(t,i,s,r,a),wk(i,s,r,a),th(t,i,s,e,n,r,o)}function Sk(t,e,n){if(!t)return[new Hn(0,0,e==tu?1:0)];if(e==$r&&!n.length&&!xk.test(t))return gb(t.length);if(n.length)for(;t.length>Te.length;)Te[Te.length]=256;let r=[],i=e==$r?0:1;return nh(t,i,i,n,0,t.length,r),r}function gb(t){return[new Hn(0,t,0)]}let bb="";function kk(t,e,n,r,i){var s;let o=r.head-t.from,a=Hn.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,n);if(o==c){let f=a+=i?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!i,n),c=l.side(i,n)}let h=Ye(t.text,o,l.forward(i,n));(h<l.from||h>l.to)&&(h=c),bb=t.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?L.cursor(u.side(!i,n)+t.from,u.forward(i,n)?1:-1,u.level):L.cursor(h+t.from,l.forward(i,n)?-1:1,l.level)}function Ck(t,e,n){for(let r=e;r<n;r++){let i=pb(t.charCodeAt(r));if(i==1)return $r;if(i==2||i==4)return tu}return $r}const xb=Y.define(),yb=Y.define(),vb=Y.define(),wb=Y.define(),rh=Y.define(),Sb=Y.define(),kb=Y.define(),nu=Y.define(),ru=Y.define(),Cb=Y.define({combine:t=>t.some(e=>e)}),jb=Y.define({combine:t=>t.some(e=>e)}),Ob=Y.define();class ui{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new ui(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ui(L.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ba=me.define({map:(t,e)=>t.map(e)}),Pb=me.define();function Dt(t,e,n){let r=t.facet(wb);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const zn=Y.define({combine:t=>t.length?t[0]:!0});let jk=0;const ni=Y.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Ve{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(ni.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(ni.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new Ve(jk++,e,r,i,a=>{let l=[];return o&&l.push(Es.of(c=>{let h=c.plugin(a);return h?o(h):ie.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return Ve.define((r,i)=>new e(r,i),n)}}class Nc{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Dt(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Dt(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Dt(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Nb=Y.define(),iu=Y.define(),Es=Y.define(),Db=Y.define(),Ab=Y.define(),Lo=Y.define(),Mb=Y.define();function Xf(t,e){let n=t.state.facet(Mb);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return ye.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,h=o-e.from,u=i;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,g;if(p==null&&(p=Ck(e.text,c,h)),l>0&&u.length&&(g=u[u.length-1]).to==c&&g.direction==p)g.to=h,u=g.inner;else{let b={from:c,to:h,direction:p,inner:[]};u.push(b),u=b.inner}}}}),i}const Tb=Y.define();function su(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Tb)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const is=Y.define();class qt{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new qt(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<n.length?n[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let h=c+o,u=c,f=h;for(;;)if(s<n.length&&n[s]<=u){let p=n[s+1];s+=2,u=Math.max(u,p);for(let g=i;g<e.length&&e[g].fromB<=u;g++)o=e[g].toA-e[g].toB;f=Math.max(f,p+o)}else if(i<e.length&&e[i].fromB<=u){let p=e[i++];u=Math.max(u,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new qt(h,f,c,u))}return r}}class dl{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Ge.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new qt(s,o,a,l))),this.changedRanges=i}static create(e,n,r){return new dl(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ok=[];class Ue{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ok}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&ak(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n){return null}domPosFor(e,n){let r=ur(this.dom),i=this.length?e>0:n>0;return new sn(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Kl)return e;return null}static get(e){return e.cmTile}}class Ul extends Ue{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=e?.node==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==n)for(;i&&i!=a.dom;)i=Zf(i);else n.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=Zf(i);this.length=o}}function Zf(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Kl extends Ul{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=Ue.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof or)n.push(i),r=o,i=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(n>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class or extends Ul{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new or(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class xi extends Ul{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new xi(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,a=-1;function l(h,u){for(let f=0,p=0;f<h.children.length&&p<=u;f++){let g=h.children[f],b=p+g.length;b>=u&&(g.isComposite()?l(g,u-p):(!o||o.isHidden&&(n>0||r&&Nk(o,g)))&&(b>u||g.flags&32)?(o=g,a=u-p):(p<u||g.flags&16&&!g.isHidden)&&(i=g,s=u-p)),p=b}}l(this,e);let c=(n<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Pk(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new sn(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new sn(l.dom,0);l==r.tile&&(a=!0)}}return new sn(this.dom,0)}}function Pk(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=us(e);return n[n.length-1]||null}function Nk(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Nt extends Ul{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new Nt(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Tr extends Ue{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?q.chrome||q.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let a=Ts(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return q.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Ms(l,o<0):l||null}static of(e,n){let r=new Tr(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class yi extends Ue{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Ms(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return Ms(o,!a)}}get overrideDOMText(){if(!this.length)return Oe.empty;let{root:e}=this;if(!e)return Oe.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new yi(s,r,e,i)}}class hl extends Ue{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!1}get overrideDOMText(){return Oe.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Dk{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(n>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let l=Math.min(e,i.length-s);r&&r.skip(i,s,s+l),e-=l,s+=l}else break;return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Ak{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class Mk{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Tr(a.dom,a.text+e);l.parent=o}else o.append(i||Tr.of(e,(s=this.cache.find(Tr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?Dc(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=i.lastChild;if(c instanceof Nt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(Dc(l.dom)),i=c;else{if(this.cache.reused.get(l)){let u=Ue.get(l.dom);u&&u.setDOM(Dc(l.dom))}let h=Nt.of(l.mark,l.dom);i.append(h),i=h}this.cache.reused.set(l,2)}let s=Ue.get(e.text);s&&this.cache.reused.set(s,2);let o=new Tr(e.text,e.text.nodeValue);o.flags|=8,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=Eb);let i=xi.start(e,n||((r=this.cache.find(xi))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(n>0&&(a=i.lastChild)&&a instanceof Nt&&a.mark.eq(o))i=a,n--;else{let l=Nt.of(o,(r=this.cache.find(Nt,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!ep(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(q.ios&&ep(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ac,0,32)||new yi(Ac.toDOM(),0,Ac,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=new Ak(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof or&&i.wrapper.eq(r.wrapper))n=i;else{let s=or.of(r.wrapper,(e=this.cache.find(or,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(hl,void 0,1);return r&&(r.flags=n),r||new hl(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Tk{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const ul=[yi,xi,Tr,Nt,hl,or,Kl];for(let t=0;t<ul.length;t++)ul[t].bucket=t;class Ek{constructor(e){this.view=e,this.buckets=ul.map(()=>[]),this.index=ul.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let l=(a+o)%s.length,c=s[l];if((!n||n(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,n,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,this.reused.set(a,1),a.length=n,a.flags=a.flags&-498|r,a}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}}class Rk{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Ek(e),this.text=new Tk(e.state.doc),this.builder=new Mk(this.cache,new Kl(e,e.contentDOM),ye.iter(r)),this.cache.reused.set(n,2),this.old=new Dk(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!o,!a),i=l,s+=c}if(!a)break;this.forward(a.fromA,a.toA),n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.emit(s,n.range.fromB),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.emit(n.range.toB,a.toB)):this.emit(s,a.toB),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=$k(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?yi.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof hl)this.cache.add(o);else if(o instanceof Nt)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Nt&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof Nt&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=0,o=ye.spans(this.decorations,e,n,{point:(a,l,c,h,u,f)=>{if(c instanceof Ir){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=h.length,u>h.length)i.continueWidget(l-a);else{let p=c.widget||(c.block?vi.block:vi.inline),g=Lk(c),b=this.cache.findWidget(p,l-a,g)||yi.of(p,this.view,l-a,g);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,h,u))}r=null}else r=Ik(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,h)=>{for(let u=a;u<l;){let f=this.text.next(Math.min(512,l-u));f==null?(i.addLineStartIfNotCovered(r),i.addBreak(),u++):(i.ensureLine(r),i.addText(f,c,h),u+=f.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,n){n-e<=10?this.old.advance(n-e,1,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,1,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=Ue.get(i);if(i==this.view.contentDOM)break;s instanceof Nt?n.push(s):s?.isLine()?r=s:i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new xi(i,Eb):n.push(Nt.of(new Eo({tagName:i.nodeName.toLowerCase(),attributes:lk(i)}),i))}return{line:r,marks:n}}}function ep(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function Lk(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Eb={class:"cm-line"};function Ik(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Zh(n,t),r&&(t.class+=" "+r)),t}function $k(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof Nt&&e.push(r.mark)}return e}function Dc(t){let e=Ue.get(t);return e&&e.setDOM(t.cloneNode()),t}class vi extends Ln{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}vi.inline=new vi("span");vi.block=new vi("div");const Ac=new class extends Ln{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class tp{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ie.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Kl(e,e.contentDOM),this.updateInner([new qt(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:u})=>u<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!Kk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Fk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:u}=this.hasComposition;r=new qt(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(q.ie||q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=Vk(o,this.decorations,e.changes);l.length&&(r=qt.extendWithRanges(r,l));let c=Wk(a,this.blockWrappers,e.changes);return c.length&&(r=qt.extendWithRanges(r,c)),s&&!r.some(h=>h.fromA<=s.range.fromA&&h.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new Rk(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,n),ih(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=q.chrome||q.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Mc&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Pb)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(zn)||r.tabIndex>-1)&&qa(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,h;if(l.empty?h=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(h=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),q.gecko&&l.empty&&!this.hasComposition&&Bk(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=h=new sn(f,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!fs(c.node,c.offset,u.anchorNode,u.anchorOffset)||!fs(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&r.contains(u.focusNode)&&Uk(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=As(this.view.root);if(f)if(l.empty){if(q.gecko){let p=zk(c.node,c.offset);if(p&&p!=3){let g=(p==1?hb:ub)(c.node,c.offset);g&&(c=new sn(g.node,g.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new sn(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new sn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&fs(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=As(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(h.node,h.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=_n(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!Ue.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,h)=>{if(c.isWidget()){if(c.flags&32&&h>=e)return!0;c.flags&16&&(s=!0)}else{let u=h+c.length;if(h<=e&&(r=c,i=e-h,s=u<e),u>=e&&!o&&(o=c,a=e-h,l=h>e),h>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof Mc?null:r.coordsInWidget(i,n,!0):r.coordsIn(i,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=i(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Ye(s.text,o);if(a==o)return null;let l=Ts(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(c==l.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return i(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Ee.LTR,c=0,h=(u,f,p)=>{for(let g=0;g<u.children.length&&!(f>i);g++){let b=u.children[g],x=f+b.length,w=b.dom.getBoundingClientRect(),{height:v}=w;if(p&&!g&&(c+=w.top-p.top),b instanceof or)x>r&&h(b,f,w);else if(f>=r&&(c>0&&n.push(-c),n.push(v+c),c=0,o)){let k=b.dom.lastChild,j=k?us(k):[];if(j.length){let S=j[j.length-1],C=l?S.right-w.left:w.right-S.left;C>a&&(a=C,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=x)}}p&&g==u.children.length-1&&(c+=p.bottom-w.bottom),f=x+b.breakAfter}};return h(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Ee.RTL:Ee.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let h=us(c.dom);if(h.length!=1)return;a+=h[0].width,l=h[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=us(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ie.replace({widget:new Mc(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return ie.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Es).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Ab).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(ye.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Db).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(Ob))try{if(c(this.view,e.range,e))return!0}catch(h){Dt(this.view.state,h,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=su(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;hk(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Ee.LTR)}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){ih(this.tile)}}function ih(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)ih(r,e)}}function Bk(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Rb(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=hb(n.focusNode,n.focusOffset),i=ub(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=Ue.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let l=Ue.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Fk(t,e,n){let r=Rb(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new qt(l.mapPos(s),l.mapPos(o),s,o),text:i}}function zk(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let Hk=class{constructor(){this.changes=[]}compareRange(e,n){di(e,n,this.changes)}comparePoint(e,n){di(e,n,this.changes)}boundChange(e){di(e,e,this.changes)}};function Vk(t,e,n){let r=new Hk;return ye.compare(t,e,n,r),r.changes}class _k{constructor(){this.changes=[]}compareRange(e,n){di(e,n,this.changes)}comparePoint(){}boundChange(e){di(e,e,this.changes)}}function Wk(t,e,n){let r=new _k;return ye.compare(t,e,n,r),r.changes}function Uk(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Kk(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class Mc extends Ln{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Gk(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return L.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<0?o=Ye(i.text,s,!1):a=Ye(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=Ye(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ye(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return L.range(o+i.from,a+i.from)}function qk(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+Kd(o,s,t.state.tabSize)}function sh(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==st.Text&&(i.type!=s.type||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Yk(t,e,n,r){let i=sh(t,e.head,e.assoc||-1),s=!r||i.type!=st.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==Ee.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return L.cursor(l,n?-1:1)}return L.cursor(n?i.to:i.from,n?-1:1)}function np(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=kk(i,s,o,a,n),h=bb;if(!c){if(i.number==(n?t.state.doc.lines:1))return a;h=`
|
|
231
|
-
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function Jk(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Ie.Space&&(i=o),i==o}}function Qk(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return L.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),h=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+h}let u=l.left+o,f=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let g=a+(f+p)*s,b=oh(t,{x:u,y:g},!1,s);return L.cursor(b.pos,b.assoc,void 0,o)}}function ps(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Lb(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=ps(t,i.from,0);o!=i.from&&(s=L.cursor(o,-1))}else{let o=ps(t,i.from,-1),a=ps(t,i.to,1);(o!=i.from||a!=i.to)&&(s=L.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?L.create(n,e.mainIndex):e}function Tc(t,e,n){let r=ps(t.state.facet(Lo).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:L.cursor(r,r<n.from?1:-1)}class On{constructor(e,n){this.pos=e,this.assoc=n}}function oh(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new On(0,1);if(l>t.viewState.docHeight)return new On(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==st.Text){let f=t.docView.coordsAt(r<0?c.from:c.to,r);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let u=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==st.Text){let u=qk(t,i,c,o,a);return new On(u,u==c.from?1:-1)}}if(c.type!=st.Text)return l<(c.top+c.bottom)/2?new On(c.from,1):new On(c.to,-1);let h=t.docView.lineAt(c.from,2);return(!h||h.length!=c.length)&&(h=t.docView.lineAt(c.from,-2)),Ib(t,h,c.from,o,a)}function Ib(t,e,n,r,i){let s=-1,o=null,a=1e9,l=1e9,c=i,h=i,u=(f,p)=>{for(let g=0;g<f.length;g++){let b=f[g];if(b.top==b.bottom)continue;let x=b.left>r?b.left-r:b.right<r?r-b.right:0,w=b.top>i?b.top-i:b.bottom<i?i-b.bottom:0;b.top<=h&&b.bottom>=c&&(c=Math.min(b.top,c),h=Math.max(b.bottom,h),w=0),(s<0||(w-l||x-a)<0)&&(s>=0&&l&&a<x&&o.top<=h-2&&o.bottom>=c+2?l=0:(s=p,a=x,l=w,o=b))}};if(e.isText()){for(let p=0;p<e.length;){let g=Ye(e.text,p);if(u(Ts(e.dom,p,g).getClientRects(),p),!a&&!l)break;p=g}return r>(o.left+o.right)/2==(rp(t,s+n)==Ee.LTR)?new On(n+Ye(e.text,s),-1):new On(n+s,1)}else{if(!e.length)return new On(n,1);for(let b=0;b<e.children.length;b++){let x=e.children[b];if(x.flags&48)continue;let w=(x.dom.nodeType==1?x.dom:Ts(x.dom,0,x.length)).getClientRects();if(u(w,b),!a&&!l)break}let f=e.children[s],p=e.posBefore(f,n);return f.isComposite()||f.isText()?Ib(t,f,p,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(rp(t,s+n)==Ee.LTR)?new On(p+f.length,-1):new On(p,1)}}function rp(t,e){let n=t.state.doc.lineAt(e);return t.bidiSpans(n)[Hn.find(t.bidiSpans(n),e-n.from,-1,1)].dir}const ss="";class Xk{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Se.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ss}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=Ue.get(i),a=i.nextSibling;if(a==n){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ue.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:cl(i))||cl(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!eC(a,n)&&this.lineBreak(),i=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){let n=Ue.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Zk(e,r.node,r.offset)?n:0))}}function Zk(t,e,n){for(;;){if(!e||n<_n(e))return!1;if(e==t)return!0;n=ur(e)+1,e=e.parentNode}}function eC(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Ue.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class ip{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class tC{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=$b(e.docView.tile,n,r,0))){let a=s||o?[]:rC(e),l=new Xk(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=iC(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Zd(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Zd(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),f=Math.max(l,c),p=h.from-u,g=h.to-f;(p==0||p==1||u==0)&&(g==0||g==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(L.range(c,l)):this.newSel=L.single(c,l)}}}function $b(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<t.children.length;l++){let u=t.children[l],f=c+u.length;if(c<e&&f>n)return $b(u,e,n,c);if(f>=e&&i==-1&&(i=l,s=c),c>n&&u.dom.parentNode==t.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:s,to:a<0?r+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Bb(t,e){let n,{newSel:r}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||q.android&&e.text.length<a-o)&&(l=i.to,c="end");let h=Fb(t.state.doc.sliceString(o,a,ss),e.text,l-o,c);h&&(q.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==ss+ss&&h.toB--,n={from:o+h.from,to:o+h.toA,insert:Oe.of(e.text.slice(h.from,h.toB).split(ss))})}else r&&(!t.hasFocus&&t.state.facet(zn)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:(q.mac||q.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=L.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Oe.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:t.state.doc.lineAt(i.from).to<i.to&&t.docView.lineHasWidget(i.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:t.state.toText(t.inputState.insertingText)}:q.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
|
|
232
|
-
`&&t.lineWrapping&&(r&&(r=L.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Oe.of([" "])}),n)return ou(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Lb(t.state.facet(Lo).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function ou(t,e,n,r=-1){if(q.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(q.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&hi(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&hi(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&hi(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=nC(t,e,n));return t.state.facet(Sb).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function nC(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,h=ps(i.facet(Lo).map(u=>u(t)),c,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:L.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let h=t.state.sliceDoc(e.from,e.to),u,f=n&&Rb(t,n.main.head);if(f){let g=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-g}}else u=t.state.doc.lineAt(s.head);let p=s.to-e.to;r=i.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:l,range:c||g.map(l)};let b=g.to-p,x=b-h.length;if(t.state.sliceDoc(x,b)!=h||b>=u.from&&x<=u.to)return{range:g};let w=i.changes({from:x,to:b,insert:e.insert}),v=g.to-s.to;return{changes:w,range:c?L.range(Math.max(0,c.anchor+v),Math.max(0,c.head+v)):g.map(w)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function Fb(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function rC(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new ip(n,r)),(i!=n||s!=r)&&e.push(new ip(i,s))),e}function iC(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?L.single(n+e,r+e):null}class sC{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&vC(e.contentDOM.ownerDocument)}handleEvent(e){!fC(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=oC(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Hb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=zb.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||aC.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,hi(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:q.safari&&!q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function sp(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Dt(n.state,i)}}}function oC(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&n(a).handlers.push(sp(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(sp(r.value,l))}}for(let r in an)n(r).handlers.push(an[r]);for(let r in Zt)n(r).observers.push(Zt[r]);return e}const zb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],aC="dthko",Hb=[16,17,18,20,91,92,224,225],xa=6;function ya(t){return Math.max(0,t)*.7+8}function lC(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class cC{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=uk(e.contentDOM),this.atoms=e.state.facet(Lo).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Se.allowMultipleSelections)&&dC(e,n),this.dragging=uC(e,n)&&Wb(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&lC(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=su(this.view);e.clientX-l.left<=i+xa?n=-ya(i-e.clientX):e.clientX+l.right>=o-xa&&(n=ya(e.clientX-o)),e.clientY-l.top<=s+xa?r=-ya(s-e.clientY):e.clientY+l.bottom>=a-xa&&(r=ya(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=Lb(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function dC(t,e){let n=t.state.facet(xb);return n.length?n[0](e):q.mac?e.metaKey:e.ctrlKey}function hC(t,e){let n=t.state.facet(yb);return n.length?n[0](e):q.mac?!e.altKey:!e.ctrlKey}function uC(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=As(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function fC(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ue.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const an=Object.create(null),Zt=Object.create(null),Vb=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function pC(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),_b(t,n.value)},50)}function Gl(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function _b(t,e){e=Gl(t.state,nu,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(ah!=null&&n.selection.ranges.every(l=>l.empty)&&ah==s.toString()){let l=-1;r=n.changeByRange(c=>{let h=n.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:u},range:L.cursor(c.from+u.length)}})}else o?r=n.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:L.cursor(l.from+c.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Zt.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};an.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Zt.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Zt.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};an.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(vb))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=gC(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new cC(t,e,n,r)),r&&t.observer.ignore(()=>{cb(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function op(t,e,n,r){if(r==1)return L.cursor(e,n);if(r==2)return Gk(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,L.range(o,a)}}const mC=q.ie&&q.ie_version<=11;let ap=null,lp=0,cp=0;function Wb(t){if(!mC)return t.detail;let e=ap,n=cp;return ap=t,cp=Date.now(),lp=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(lp+1)%3:1}function gC(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Wb(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,h=op(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let u=op(t,n.pos,n.assoc,r),f=Math.min(u.from,h.from),p=Math.max(u.to,h.to);h=f<h.from?L.range(f,p):L.range(p,f)}return o?i.replaceRange(i.main.extend(h.from,h.to)):a&&r==1&&i.ranges.length>1&&(c=bC(i,l.pos))?c:a?i.addRange(h):L.create([h])}}}function bC(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return L.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}an.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=L.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Gl(t.state,ru,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};an.dragend=t=>(t.inputState.draggedContent=null,!1);function dp(t,e,n,r){if(n=Gl(t.state,nu,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&hC(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}an.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&dp(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return dp(t,e,r,!0),!0}return!1};an.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Vb?null:e.clipboardData;return n?(_b(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(pC(t),!1)};function xC(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function yC(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Gl(t,ru,e.join(t.lineBreak)),ranges:n,linewise:r}}let ah=null;an.copy=an.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=yC(t.state);if(!n&&!i)return!1;ah=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Vb?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(xC(t,n),!1)};const Ub=En.define();function Kb(t,e){let n=[];for(let r of t.facet(kb)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:Ub.of(!0)}):null}function Gb(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=Kb(t.state,e);n?t.dispatch(n):t.update([])}},10)}Zt.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Gb(t)};Zt.blur=t=>{t.observer.clearSelectionRange(),Gb(t)};Zt.compositionstart=Zt.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Zt.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,q.chrome&&q.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Zt.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};an.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return ou(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(q.chrome&&q.android&&(i=zb.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Zt.compositionend(t,e),20),!1};const hp=new Set;function vC(t){hp.has(t)||(hp.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const up=["pre-wrap","normal","pre-line","break-spaces"];let wi=!1;function fp(){wi=!1}class wC{constructor(e){this.lineWrapping=e,this.doc=Oe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return up.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=up.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}}class SC{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class rn{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?st.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ir?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new rn(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Re=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Re||(Re={}));const Ya=.001;class St{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ya&&(wi=!0),this.height=e)}replace(e,n,r){return St.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=i[a],f=s.lineAt(l,Re.ByPosNoHeight,r.setDoc(n),0,0),p=f.to>=c?f:s.lineAt(c,Re.ByPosNoHeight,r,0,0);for(u+=p.to-c,c=p.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,h=i[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,Re.ByPosNoHeight,r,0,0));h+=f.from-l,l=f.from;let g=au.build(r.setDoc(o),e,h,u);s=fl(s,s.replace(l,c,g))}return s.updateHeight(r,0)}static empty(){return new It(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new CC(St.of(e.slice(0,n)),o,St.of(e.slice(r)))}}function fl(t,e){return t==e?t:(t.constructor!=e.constructor&&(wi=!0),e)}St.prototype.size=1;const kC=ie.replace({});class qb extends St{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new rn(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new rn(i,0,r,this.spaceAbove,kC):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,Re.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class It extends qb{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new rn(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof It||i instanceof rt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof rt?i=new It(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):St.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class rt extends St{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=n.doc.lineAt(c),u=a+h.length*l,f=Math.max(r,e-u/2);return new rn(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:h,length:u}=n.doc.line(s+c);return new rn(h,u,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==Re.ByHeight)return this.blockAt(e,r,i,s);if(n==Re.ByPosNoHeight){let{from:p,to:g}=r.doc.lineAt(e);return new rn(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=i+a*u+l*(c.from-s-u);return new rn(c.from,c.length,Math.max(i,Math.min(f,i+this.height-h)),h,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let h=e,u=i;h<=n;){let f=r.doc.lineAt(h);if(h==e){let g=f.number-a;u+=l*g+c*(e-s-g)}let p=l+c*f.length;o(new rn(f.from,f.length,u,p,0)),u+=p,h=f.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof rt?r[r.length-1]=new rt(s.length+i):r.push(null,new rt(i-1))}if(e>0){let s=r[0];s instanceof rt?r[0]=new rt(e+s.length):r.unshift(new rt(e-1),null)}return St.of(r)}decomposeLeft(e,n){n.push(new rt(e-1),null)}decomposeRight(e,n){n.push(null,new rt(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new rt(i.from-n-1).updateHeight(e,n));a<=s&&i.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=i.heights[i.index++],f=0;u<0&&(f=-u,u=i.heights[i.index++]),l==-1?l=u:Math.abs(u-l)>=Ya&&(l=-2);let p=new It(h,u,f);p.outdated=!1,o.push(p),a+=h+1}a<=s&&o.push(null,new rt(s-a).updateHeight(e,a));let c=St.of(o);return(l<0||Math.abs(c.height-this.height)>=Ya||Math.abs(l-this.heightMetrics(e,n).perLine)>=Ya)&&(wi=!0),fl(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class CC extends St{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==Re.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=n==Re.ByPosNoHeight?Re.ByPosNoHeight:Re.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,i,s).join(c)}forEachLine(e,n,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,Re.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&pp(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),pp(s,a)}return St.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?St.of(this.break?[e,null,n]:[e,n]):(this.left=fl(this.left,e),this.right=fl(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function pp(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof rt&&(r=t[e+1])instanceof rt&&t.splice(e-1,3,new rt(n.length+1+r.length))}const jC=5;class au{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof It?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new It(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new qb(o,i,r)):(o||s||i>=jC)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new It(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new rt(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof It)return e;let n=new It(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof It)&&!this.isCovered?this.nodes.push(new It(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof It&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new au(r,e);return ye.spans(n,r,i,s,0),s.finish(r)}}function OC(t,e,n){let r=new PC;return ye.compare(t,e,n,r,0),r.changes}class PC{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&di(e,n,this.changes,5)}}function NC(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==t.parentNode?i.innerHeight:l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function DC(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function AC(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ec{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return ie.replace({widget:new MC(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class MC extends Ln{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class mp{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=gp,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ee.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(iu).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new wC(n),this.stateDeco=e.facet(Es).filter(r=>typeof r!="function"),this.heightMap=St.empty().applyChanges(this.stateDeco,Oe.empty,this.heightOracle.setDoc(e.doc),[new qt(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ie.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new va(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?gp:new lu(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(os(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Es).filter(h=>typeof h!="function");let i=e.changedRanges,s=qt.extendWithRanges(i,OC(r,this.stateDeco,e?e.changes:Ge.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);fp(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||wi)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(jb)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ee.RTL:Ee.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:j,scaleY:S}=lb(n,a);(j>.005&&Math.abs(this.scaleX-j)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=j,this.scaleY=S,c|=16,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=db(e.scrollDOM);let g=(this.printing?AC:NC)(n,this.paddingTop),b=g.top-this.pixelViewport.top,x=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget&&!DC(e.dom))return 0;let v=a.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let j=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(j)&&(o=!0),o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:S,charWidth:C,textHeight:y}=e.docView.measureTextSize();o=S>0&&i.refresh(s,S,C,y,Math.max(5,v/C),j),o&&(e.docView.minWidth=0,c|=16)}b>0&&x>0?h=Math.max(b,x):b<0&&x<0&&(h=Math.min(b,x)),fp();for(let S of this.viewports){let C=S.from==this.viewport.from?j:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?St.empty().applyChanges(this.stateDeco,Oe.empty,this.heightOracle,[new qt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new SC(S.from,C))}wi&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new va(i.lineAt(o-r*1e3,Re.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Re.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=i.lineAt(c,Re.ByPos,s,0,0),f;n.y=="center"?f=(u.top+u.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-h,l=new va(i.lineAt(f-1e3/2,Re.ByHeight,s,0,0).from,i.lineAt(f+h+1e3/2,Re.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new va(this.heightMap.lineAt(r,Re.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Re.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Re.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Re.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new Ec(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Ee.LTR&&!r)return[];let a=[],l=(h,u,f,p)=>{if(u-h<s)return;let g=this.state.selection.main,b=[g.from];g.empty||b.push(g.to);for(let w of b)if(w>h&&w<u){l(h,w-10,f,p),l(w+10,u,f,p);return}let x=EC(e,w=>w.from>=f.from&&w.to<=f.to&&Math.abs(w.from-h)<s&&Math.abs(w.to-u)<s&&!b.some(v=>w.from<v&&w.to>v));if(!x){if(u<f.to&&n&&r&&n.visibleRanges.some(k=>k.from<=u&&k.to>=u)){let k=n.moveToLineBoundary(L.cursor(u),!1,!0).head;k>h&&(u=k)}let w=this.gapSize(f,h,u,p),v=r||w<2e6?w:2e6;x=new Ec(h,u,w,v)}a.push(x)},c=h=>{if(h.length<o||h.type!=st.Text)return;let u=TC(h.from,h.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,w;if(f!=null){let v=Sa(u,f),k=((this.visibleBottom-this.visibleTop)/2+b)/h.height;x=v-k,w=v+k}else x=(this.visibleTop-h.top-b)/h.height,w=(this.visibleBottom-h.top+b)/h.height;p=wa(u,x),g=wa(u,w)}else{let b=u.total*this.heightOracle.charWidth,x=i*this.heightOracle.charWidth,w=0;if(b>2e6)for(let C of e)C.from>=h.from&&C.from<h.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=C.size-C.displaySize);let v=this.pixelViewport.left+w,k=this.pixelViewport.right+w,j,S;if(f!=null){let C=Sa(u,f),y=((k-v)/2+x)/b;j=C-y,S=C+y}else j=(v-x)/b,S=(k+x)/b;p=wa(u,j),g=wa(u,S)}p>h.from&&l(h.from,p,h,u),g<h.to&&l(g,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,n,r,i){let s=Sa(i,r)-Sa(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){Ec.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ie.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ye.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||os(this.heightMap.lineAt(e,Re.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||os(this.heightMap.lineAt(this.scaler.fromDOM(e),Re.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return os(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class va{constructor(e,n){this.from=e,this.to=n}}function TC(t,e,n){let r=[],i=t,s=0;return ye.spans(n,t,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function wa({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function Sa(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function EC(t,e){for(let n of t)if(e(n))return n}const gp={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class lu{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Re.ByPos,e,0,0).top,h=n.lineAt(l,Re.ByPos,e,0,0).bottom;return i+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof lu?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function os(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new rn(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>os(i,e)):t._content)}const ka=Y.define({combine:t=>t.join(" ")}),lh=Y.define({combine:t=>t.indexOf(!0)>-1}),ch=dr.newName(),Yb=dr.newName(),Jb=dr.newName(),Qb={"&light":"."+Yb,"&dark":"."+Jb};function dh(t,e,n){return new dr(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const RC=dh("."+ch,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qb),LC={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Rc=q.ie&&q.ie_version<=11;class IC{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fk,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new BC(e),e.state.facet(zn)&&(e.contentDOM.editContext=this.editContext.editContext)),Rc&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(zn)?r.root.activeElement!=this.dom:!qa(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!r.state.selection.main.empty&&i.focusNode&&fs(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=As(e.root);if(!n)return!1;let r=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&$C(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=qa(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&mk(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,LC),Rc&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Rc&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&hi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&qa(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new tC(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Bb(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=bp(n,e.previousSibling||e.target.previousSibling,-1),i=bp(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(zn)!=e.state.facet(zn)&&(e.view.contentDOM.editContext=e.state.facet(zn)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function bp(t,e,n){for(;e;){let r=Ue.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function xp(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return fs(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function $C(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return xp(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?xp(t,n):null}class BC{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let h=Fb(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!h){let f=L.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(i)||e.dispatch({selection:f,userEvent:"select"});return}let u={from:h.from+a,to:h.toA+a,insert:Oe.of(r.text.slice(h.from,h.toB).split(`
|
|
233
|
-
`))};if((q.mac||q.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:Oe.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);ou(e,u,L.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(ie.mark({attributes:{style:h}}).range(l,c))}}}e.dispatch({effects:Pb.of(ie.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=As(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let h=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=h,this.to+=h;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=h}n+=h}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class _{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||pk(e.parent)||document,this.viewState=new mp(e.state||Se.create(e)),e.scrollTo&&e.scrollTo.is(ba)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ni).map(i=>new Nc(i));for(let i of this.plugins)i.update(this);this.observer=new IC(this),this.inputState=new sC(this),this.inputState.ensureHandlers(this.plugins),this.docView=new tp(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Je?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(Ub))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Kb(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(Se.phrases)!=this.state.facet(Se.phrases))return this.setState(s);i=dl.create(this,s,e),i.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection;u=new ui(p.empty?p:L.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of f.effects)p.is(ba)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=pl.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(is)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(ka)!=i.state.facet(ka)&&(this.viewState.mustMeasureContent=!0),(n||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(rh))try{f(i)}catch(p){Dt(this.state,p,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Bb(this,h)&&c.force&&hi(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new mp(e),this.plugins=e.facet(ni).map(r=>new Nc(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new tp(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(ni),r=e.state.facet(ni);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new Nc(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Dt(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(db(r))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(p=>{try{return p.read(this)}catch(g){return Dt(this.state,g),yp}}),u=dl.create(this,this.state,[]),f=!1;u.flags|=l,n?n.flags|=l:n=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let p=0;p<c.length;p++)if(h[p]!=yp)try{let g=c[p];g.write&&g.write(h[p],this)}catch(g){Dt(this.state,g)}if(f&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(g>1||g<-1){i=i+g,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(rh))a(n)}get themeClasses(){return ch+" "+(this.state.facet(lh)?Jb:Yb)+" "+this.state.facet(ka)}updateAttrs(){let e=vp(this,Nb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(zn)?"true":"false",class:"cm-content",style:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),vp(this,iu,n);let r=this.observer.ignore(()=>{let i=Yf(this.contentDOM,this.contentAttrs,n),s=Yf(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(_.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(is);let e=this.state.facet(_.cspNonce);dr.mount(this.root,this.styleModules.concat(RC).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Tc(this,e,np(this,e,n,r))}moveByGroup(e,n){return Tc(this,e,np(this,e,n,r=>Jk(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return L.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Yk(this,e,n,r)}moveVertically(e,n,r){return Tc(this,e,Qk(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=oh(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),oh(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Hn.find(s,e-i.from,-1,n)];return Ms(r,o.dir==Ee.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Cb)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>FC)return gb(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||mb(s.isolates,r=Xf(this,e))))return s.order;r||(r=Xf(this,e));let i=Sk(e.text,n,r);return this.bidiCache.push(new pl(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{cb(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return ba.of(new ui(typeof e=="number"?L.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return ba.of(new ui(L.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ve.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ve.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=dr.newName(),i=[ka.of(r),is.of(dh(`.${r}`,e))];return n&&n.dark&&i.push(lh.of(!0)),i}static baseTheme(e){return Hr.lowest(is.of(dh("."+ch,e,Qb)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Ue.get(r)||Ue.get(e);return((n=i?.root)===null||n===void 0?void 0:n.view)||null}}_.styleModule=is;_.inputHandler=Sb;_.clipboardInputFilter=nu;_.clipboardOutputFilter=ru;_.scrollHandler=Ob;_.focusChangeEffect=kb;_.perLineTextDirection=Cb;_.exceptionSink=wb;_.updateListener=rh;_.editable=zn;_.mouseSelectionStyle=vb;_.dragMovesSelection=yb;_.clickAddsSelectionRange=xb;_.decorations=Es;_.blockWrappers=Db;_.outerDecorations=Ab;_.atomicRanges=Lo;_.bidiIsolatedRanges=Mb;_.scrollMargins=Tb;_.darkTheme=lh;_.cspNonce=Y.define({combine:t=>t.length?t[0]:""});_.contentAttributes=iu;_.editorAttributes=Nb;_.lineWrapping=_.contentAttributes.of({class:"cm-lineWrapping"});_.announce=me.define();const FC=4096,yp={};class pl{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ee.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new pl(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function vp(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&Zh(o,n)}return n}const zC=q.mac?"mac":q.windows?"win":q.linux?"linux":"key";function HC(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Ca(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const VC=Hr.default(_.domEventHandlers({keydown(t,e){return Zb(Xb(e.state),t,e,"editor")}})),ql=Y.define({enables:VC}),wp=new WeakMap;function Xb(t){let e=t.facet(ql),n=wp.get(e);return n||wp.set(e,n=UC(e.reduce((r,i)=>r.concat(i),[]))),n}function _C(t,e,n){return Zb(Xb(t.state),e,t,n)}let tr=null;const WC=4e3;function UC(t,e=zC){let n=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,h)=>{var u,f;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(w=>HC(w,e));for(let w=1;w<g.length;w++){let v=g.slice(0,w).join(" ");i(v,!0),p[v]||(p[v]={preventDefault:!0,stopPropagation:!1,run:[k=>{let j=tr={view:k,prefix:v,scope:o};return setTimeout(()=>{tr==j&&(tr=null)},WC),!0}]})}let b=g.join(" ");i(b,!1);let x=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((f=(u=p._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&x.run.push(l),c&&(x.preventDefault=!0),h&&(x.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=n[c]||(n[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let f in h)h[f].run.push(p=>u(p,hh))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let hh=null;function Zb(t,e,n,r){hh=e;let i=sk(e),s=Ot(i,0),o=jn(s)==i.length&&i!=" ",a="",l=!1,c=!1,h=!1;tr&&tr.view==n&&tr.scope==r&&(a=tr.prefix+" ",Hb.indexOf(e.keyCode)<0&&(c=!0,tr=null));let u=new Set,f=x=>{if(x){for(let w of x.run)if(!u.has(w)&&(u.add(w),w(n)))return x.stopPropagation&&(h=!0),!0;x.preventDefault&&(x.stopPropagation&&(h=!0),c=!0)}return!1},p=t[r],g,b;return p&&(f(p[a+Ca(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(q.windows&&e.ctrlKey&&e.altKey)&&!(q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(g=hr[e.keyCode])&&g!=i?(f(p[a+Ca(g,e,!0)])||e.shiftKey&&(b=Ns[e.keyCode])!=i&&b!=g&&f(p[a+Ca(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+Ca(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),hh=null,l}class Io{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=ex(e);return[new Io(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return KC(e,n,r)}}function ex(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ee.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Sp(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function KC(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Ee.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=ex(t),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),p=sh(t,r,1),g=sh(t,i,-1),b=p.type==st.Text?p:null,x=g.type==st.Text?g:null;if(b&&(t.lineWrapping||p.widgetLineBreaks)&&(b=Sp(t,r,1,b)),x&&(t.lineWrapping||g.widgetLineBreaks)&&(x=Sp(t,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return v(k(n.from,n.to,b));{let S=b?k(n.from,null,b):j(p,!1),C=x?k(null,n.to,x):j(g,!0),y=[];return(b||p).to<(x||g).from-(b&&x?1:0)||p.widgetLineBreaks>1&&S.bottom+t.defaultLineHeight/2<C.top?y.push(w(u,S.bottom,f,C.top)):S.bottom<C.top&&t.elementAtHeight((S.bottom+C.top)/2).type==st.Text&&(S.bottom=C.top=(S.bottom+C.top)/2),v(S).concat(y).concat(v(C))}function w(S,C,y,N){return new Io(e,S-l.left,C-l.top,y-S,N-C)}function v({top:S,bottom:C,horizontal:y}){let N=[];for(let A=0;A<y.length;A+=2)N.push(w(y[A],S,y[A+1],C));return N}function k(S,C,y){let N=1e9,A=-1e9,T=[];function P(I,F,G,ae,X){let Q=t.coordsAtPos(I,I==y.to?-2:2),le=t.coordsAtPos(G,G==y.from?2:-2);!Q||!le||(N=Math.min(Q.top,le.top,N),A=Math.max(Q.bottom,le.bottom,A),X==Ee.LTR?T.push(s&&F?u:Q.left,s&&ae?f:le.right):T.push(!s&&ae?u:le.left,!s&&F?f:Q.right))}let R=S??y.from,z=C??y.to;for(let I of t.visibleRanges)if(I.to>R&&I.from<z)for(let F=Math.max(I.from,R),G=Math.min(I.to,z);;){let ae=t.state.doc.lineAt(F);for(let X of t.bidiSpans(ae)){let Q=X.from+ae.from,le=X.to+ae.from;if(Q>=G)break;le>F&&P(Math.max(Q,F),S==null&&Q<=R,Math.min(le,G),C==null&&le>=z,X.dir)}if(F=ae.to+1,F>=G)break}return T.length==0&&P(R,S==null,z,C==null,t.textDirection),{top:N,bottom:A,horizontal:T}}function j(S,C){let y=a.top+(C?S.top:S.bottom);return{top:y,bottom:y,horizontal:[]}}}function GC(t,e){return t.constructor==e.constructor&&t.eq(e)}class qC{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Ja)!=e.state.facet(Ja)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Ja);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!GC(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,q.safari&&q.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ja=Y.define();function tx(t){return[Ve.define(e=>new qC(e,t)),Ja.of(t)]}const Rs=Y.define({combine(t){return Rn(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function YC(t={}){return[Rs.of(t),JC,QC,XC,jb.of(!0)]}function nx(t){return t.startState.facet(Rs)!=t.state.facet(Rs)}const JC=tx({above:!0,markers(t){let{state:e}=t,n=e.facet(Rs),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:L.cursor(i.head,i.head>i.anchor?-1:1);for(let l of Io.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=nx(t);return n&&kp(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){kp(e.state,t)},class:"cm-cursorLayer"});function kp(t,e){e.style.animationDuration=t.facet(Rs).cursorBlinkRate+"ms"}const QC=tx({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Io.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||nx(t)},class:"cm-selectionLayer"}),XC=Hr.highest(_.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),rx=me.define({map(t,e){return t==null?null:e.mapPos(t)}}),as=ot.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(rx)?r.value:n,t)}}),ZC=Ve.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(as);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(as)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(as),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(as)!=t&&this.view.dispatch({effects:rx.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function e3(){return[as,ZC]}function Cp(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function t3(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class n3{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(a,l,c,h)=>i(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new Vn,r=n.add.bind(n);for(let{from:i,to:s}of t3(e,this.maxLength))Cp(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(s.from,l.from),u=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let f=[],p,g=(b,x,w)=>f.push(w.range(b,x));if(l==c)for(this.regexp.lastIndex=h-l.from;(p=this.regexp.exec(l.text))&&p.index<u-l.from;)this.addMatch(p,e,p.index+l.from,g);else Cp(e.state.doc,this.regexp,h,u,(b,x)=>this.addMatch(x,e,b,g));n=n.update({filterFrom:h,filterTo:u,filter:(b,x)=>b<h||x>u,add:f})}}return n}}const uh=/x/.unicode!=null?"gu":"g",r3=new RegExp(`[\0-\b
|
|
234
|
-
--\u2028\u2029\uFEFF-]`,uh),i3={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Lc=null;function s3(){var t;if(Lc==null&&typeof document<"u"&&document.body){let e=document.body.style;Lc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Lc||!1}const Qa=Y.define({combine(t){let e=Rn(t,{render:null,specialChars:r3,addSpecialChars:null});return(e.replaceTabs=!s3())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,uh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,uh)),e}});function o3(t={}){return[Qa.of(t),a3()]}let jp=null;function a3(){return jp||(jp=Ve.fromClass(class{constructor(t){this.view=t,this.decorations=ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Qa)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new n3({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=Ot(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Oi(o.text,a,r-o.from);return ie.replace({widget:new h3((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ie.replace({widget:new d3(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Qa);t.startState.facet(Qa)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const l3="•";function c3(t){return t>=32?l3:t==10?"":String.fromCharCode(9216+t)}class d3 extends Ln{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=c3(this.code),r=e.state.phrase("Control character")+" "+(i3[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class h3 extends Ln{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function u3(){return p3}const f3=ie.line({class:"cm-activeLine"}),p3=Ve.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(f3.range(i.from)),e=i.from)}return ie.set(n)}},{decorations:t=>t.decorations});class m3 extends Ln{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?us(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Ms(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function g3(t){let e=Ve.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ie.set([ie.widget({widget:new m3(t),side:1}).range(0)]):ie.none}get decorations(){return this.view.state.doc.length?ie.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,_.contentAttributes.of({"aria-placeholder":t})]:e}const fh=2e3;function b3(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>fh||n.off>fh||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(L.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),h=Kd(c.text,o,t.tabSize,!0);if(h<0)s.push(L.cursor(c.to));else{let u=Kd(c.text,a,t.tabSize);s.push(L.range(c.from+h,c.from+u))}}}return s}function x3(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Op(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>fh?-1:i==r.length?x3(t,e.clientX):Oi(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function y3(t,e){let n=Op(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=Op(t,i);if(!a)return r;let l=b3(t.state,n,a);return l.length?o?L.create(l.concat(r.ranges)):L.create(l):r}}:null}function v3(t){let e=n=>n.altKey&&n.button==0;return _.mouseSelectionStyle.of((n,r)=>e(r)?y3(n,r):null)}const w3={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},S3={style:"cursor: crosshair"};function k3(t={}){let[e,n]=w3[t.key||"Alt"],r=Ve.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,_.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?S3:null})]}const ja="-10000px";class ix{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=n[h]),u.update&&u.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function C3(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Ic=Y.define({combine:t=>{var e,n,r;return{position:q.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||C3}}}),Pp=new WeakMap,cu=Ve.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Ic);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new ix(t,du,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Ic);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=ja,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(q.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=su(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Ic).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=t.pos[a],f=t.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=ja;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=f.right-f.left,x=(e=Pp.get(c))!==null&&e!==void 0?e:f.bottom-f.top,w=c.offset||O3,v=this.view.textDirection==Ee.LTR,k=f.width>r.right-r.left?v?r.left:r.right-f.width:v?Math.max(r.left,Math.min(u.left-(p?14:0)+w.x,r.right-b)):Math.min(Math.max(r.left,u.left-b+(p?14:0)-w.x),r.right-b),j=this.above[a];!l.strictSide&&(j?u.top-x-g-w.y<r.top:u.bottom+x+g+w.y>r.bottom)&&j==r.bottom-u.bottom>u.top-r.top&&(j=this.above[a]=!j);let S=(j?u.top-r.top:r.bottom-u.bottom)-g;if(S<x&&c.resize!==!1){if(S<this.view.defaultLineHeight){h.style.top=ja;continue}Pp.set(c,x),h.style.height=(x=S)/s+"px"}else h.style.height&&(h.style.height="");let C=j?u.top-x-g-w.y:u.bottom+g+w.y,y=k+b;if(c.overlap!==!0)for(let N of o)N.left<y&&N.right>k&&N.top<C+x&&N.bottom>C&&(C=j?N.top-x-2-g:N.bottom+g+2);if(this.position=="absolute"?(h.style.top=(C-t.parent.top)/s+"px",Np(h,(k-t.parent.left)/i)):(h.style.top=C/s+"px",Np(h,k/i)),p){let N=u.left+(v?w.x:-w.x)-(k+14-7);p.style.left=N/i+"px"}c.overlap!==!0&&o.push({left:k,top:C,right:y,bottom:C+x}),h.classList.toggle("cm-tooltip-above",j),h.classList.toggle("cm-tooltip-below",!j),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ja}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Np(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const j3=_.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),O3={x:0,y:0},du=Y.define({enables:[cu,j3]}),ml=Y.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Yl{static create(e){return new Yl(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ix(e,ml,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const P3=du.compute([ml],t=>{let e=t.facet(ml);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Yl.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class N3{constructor(e,n,r,i,s){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let a=e.coordsAtPos(i);if(!a||n.y<a.top||n.y>a.bottom||n.x<a.left-e.defaultCharacterWidth||n.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(h=>h.from<=i&&h.to>=i),c=l&&l.dir==Ee.RTL?-1:1;s=n.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Dt(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(cu),n=e?e.manager.tooltips.findIndex(r=>r.create==Yl.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!D3(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!A3(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Oa=4;function D3(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-Oa&&e.clientX<=r+Oa&&e.clientY>=i-Oa&&e.clientY<=s+Oa}function A3(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function M3(t,e={}){let n=me.define(),r=ot.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of i){let l=s.changes.mapPos(a.pos,-1,wt.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(T3)&&(i=[]);return i},provide:i=>ml.from(i)});return{active:r,extension:[r,Ve.define(i=>new N3(i,t,r,n,e.hoverTime||300)),P3]}}function sx(t,e){let n=t.plugin(cu);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const T3=me.define(),Dp=Y.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Ls(t,e){let n=t.plugin(ox),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const ox=Ve.fromClass(class{constructor(t){this.input=t.state.facet(Is),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Dp);this.top=new Pa(t,!0,e.topContainer),this.bottom=new Pa(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Dp);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Pa(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Pa(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Is);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(t.view),a.push(h)):(h=this.panels[c],h.update&&h.update(t)),i.push(h),(h.top?s:o).push(h)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Pa{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Ap(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Ap(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Ap(t){let e=t.nextSibling;return t.remove(),e}const Is=Y.define({enables:ox});class Wn extends cr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Wn.prototype.elementClass="";Wn.prototype.toDOM=void 0;Wn.prototype.mapMode=wt.TrackBefore;Wn.prototype.startSide=Wn.prototype.endSide=-1;Wn.prototype.point=!0;const Xa=Y.define(),E3=Y.define(),R3={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ye.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ms=Y.define();function L3(t){return[ax(),ms.of({...R3,...t})]}const Mp=Y.define({combine:t=>t.some(e=>e)});function ax(t){return[I3]}const I3=Ve.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ms).map(e=>new Ep(t,e)),this.fixed=!t.state.facet(Mp);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Mp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ye.iter(this.view.state.facet(Xa),this.view.viewport.from),r=[],i=this.gutters.map(s=>new $3(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==st.Text&&o){ph(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==st.Text){ph(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(ms),n=t.state.facet(ms),r=t.docChanged||t.heightChanged||t.viewportChanged||!ye.eq(t.startState.facet(Xa),t.state.facet(Xa),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new Ep(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>_.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ee.LTR?{left:r,right:i}:{right:r,left:i}})});function Tp(t){return Array.isArray(t)?t:[t]}function ph(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class $3{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ye.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new lx(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];ph(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(E3)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Ep{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=Tp(n.markers(e)),n.initialSpacer&&(this.spacer=new lx(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Tp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!ye.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class lx{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),B3(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[s++]:null,c=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(i);let u=i.nextSibling;i.remove(),i=u}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function B3(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const F3=Y.define(),z3=Y.define(),ri=Y.define({combine(t){return Rn(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class $c extends Wn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Bc(t,e){return t.state.facet(ri).formatNumber(e,t.state)}const H3=ms.compute([ri],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(F3)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new $c(Bc(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(z3)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(ri)!=e.state.facet(ri),initialSpacer(e){return new $c(Bc(e,Rp(e.state.doc.lines)))},updateSpacer(e,n){let r=Bc(n.view,Rp(n.view.state.doc.lines));return r==e.number?e:new $c(r)},domEventHandlers:t.facet(ri).domEventHandlers,side:"before"}));function V3(t={}){return[ri.of(t),ax(),H3]}function Rp(t){let e=9;for(;e<t;)e=e*10+9;return e}const _3=new class extends Wn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},W3=Xa.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(_3.range(i)))}return ye.of(e)});function U3(){return W3}var Fc;const ii=new be;function K3(t){return Y.define({combine:t?e=>e.concat(t):void 0})}const G3=new be;class on{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Se.prototype.hasOwnProperty("tree")||Object.defineProperty(Se.prototype,"tree",{get(){return ft(this)}}),this.parser=n,this.extension=[fr.of(this),Se.languageData.of((s,o,a)=>{let l=Lp(s,o,a),c=l.type.prop(ii);if(!c)return[];let h=s.facet(c),u=l.type.prop(G3);if(u){let f=l.resolve(o-l.from,a);for(let p of u)if(p.test(f,s)){let g=s.facet(p.facet);return p.type=="replace"?g:g.concat(h)}}return h})].concat(r)}isActiveAt(e,n,r=-1){return Lp(e,n,r).type.prop(ii)==this.data}findRegions(e){let n=e.facet(fr);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(ii)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(be.mounted);if(a){if(a.tree.prop(ii)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof He&&i(c,s.positions[l]+o)}};return i(ft(e),0),r}get allowsNesting(){return!0}}on.setState=me.define();function Lp(t,e,n){let r=t.facet(fr),i=ft(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,Fe.ExcludeBuffers|Fe.EnterBracketed))s.type.isTop&&(i=s);return i}class gl extends on{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=K3(e.languageData);return new gl(n,e.parser.configure({props:[ii.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new gl(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ft(t){let e=t.field(on.state,!1);return e?e.tree:He.empty}class q3{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Ji=null;class bl{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new bl(e,n,[],He.empty,0,r,[],null)}startParse(){return this.parser.startParse(new q3(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=He.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Rr.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Ji;Ji=this;try{return e()}finally{Ji=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Ip(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),r=Rr.applyChanges(r,l),i=He.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new bl(this.parser,n,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=Ip(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends $0{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=Ji;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new He(Mt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Ji}}function Ip(t,e,n){return Rr.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Si{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Si(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=bl.create(e.facet(fr).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Si(r)}}on.state=ot.define({create:Si.init,update(t,e){for(let n of e.effects)if(n.is(on.setState))return n.value;return e.startState.facet(fr)!=e.state.facet(fr)?Si.init(e.state):t.apply(e)}});let cx=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(cx=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const zc=typeof navigator<"u"&&(!((Fc=navigator.scheduling)===null||Fc===void 0)&&Fc.isInputPending)?()=>navigator.scheduling.isInputPending():null,Y3=Ve.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(on.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(on.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=cx(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(on.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!zc?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>zc&&zc()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:on.setState.of(new Si(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Dt(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),fr=Y.define({combine(t){return t.length?t[0]:null},enables:t=>[on.state,Y3,_.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class J3{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Q3=Y.define(),Jl=Y.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function xl(t){let e=t.facet(Jl);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function $s(t,e){let n="",r=t.tabSize,i=t.facet(Jl)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function hu(t,e){t instanceof Se&&(t=new Ql(t));for(let r of t.state.facet(Q3)){let i=r(t,e);if(i!==void 0)return i}let n=ft(t.state);return n.length>=e?X3(t,n,e):null}class Ql{constructor(e,n={}){this.state=e,this.options=n,this.unit=xl(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return Oi(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const dx=new be;function X3(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return hx(r,t,n)}function hx(t,e,n){for(let r=t;r;r=r.next){let i=e4(r.node);if(i)return i(uu.create(e,n,r))}return 0}function Z3(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function e4(t){let e=t.type.prop(dx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(be.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>i4(o,!0,1,void 0,s&&!Z3(o)?i.from:void 0)}return t.parent==null?t4:null}function t4(){return 0}class uu extends Ql{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new uu(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(n4(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return hx(this.context.next,this.base,this.pos)}}function n4(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function r4(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function i4(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=r4(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}function $p({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const s4=200;function o4(){return Se.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+s4)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=hu(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],p=$s(o,u);f!=p&&l.push({from:h.from,to:h.from+f.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const a4=Y.define(),ux=new be;function l4(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function c4(t,e,n){let r=ft(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(ux);if(l&&(a.to<r.length-50||r.length==t.doc.length||!d4(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function d4(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function yl(t,e,n){for(let r of t.facet(a4)){let i=r(t,e,n);if(i)return i}return c4(t,e,n)}function fx(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Xl=me.define({map:fx}),$o=me.define({map:fx});function px(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Br=ot.define({create(){return ie.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=Bp(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Xl)&&!h4(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(bx),i=r?ie.replace({widget:new x4(r(e.state,n.value))}):Fp;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is($o)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=Bp(t,e.selection.main.head)),t},provide:t=>_.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Fp.range(r,i))}return ie.set(e,!0)}});function Bp(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function vl(t,e,n){var r;let i=null;return(r=t.field(Br,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function h4(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function mx(t,e){return t.field(Br,!1)?e:e.concat(me.appendConfig.of(xx()))}const u4=t=>{for(let e of px(t)){let n=yl(t.state,e.from,e.to);if(n)return t.dispatch({effects:mx(t.state,[Xl.of(n),gx(t,n)])}),!0}return!1},f4=t=>{if(!t.state.field(Br,!1))return!1;let e=[];for(let n of px(t)){let r=vl(t.state,n.from,n.to);r&&e.push($o.of(r),gx(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function gx(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return _.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const p4=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=yl(e,i.from,i.to);s&&n.push(Xl.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:mx(t.state,n)}),!!n.length},m4=t=>{let e=t.state.field(Br,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push($o.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},g4=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u4},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:f4},{key:"Ctrl-Alt-[",run:p4},{key:"Ctrl-Alt-]",run:m4}],b4={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bx=Y.define({combine(t){return Rn(t,b4)}});function xx(t){return[Br,w4]}function yx(t,e){let{state:n}=t,r=n.facet(bx),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=vl(t.state,a.from,a.to);l&&t.dispatch({effects:$o.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Fp=ie.replace({widget:new class extends Ln{toDOM(t){return yx(t,null)}}});class x4 extends Ln{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return yx(e,this.value)}}const y4={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Hc extends Wn{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function v4(t={}){let e={...y4,...t},n=new Hc(e,!0),r=new Hc(e,!1),i=Ve.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(fr)!=o.state.facet(fr)||o.startState.field(Br,!1)!=o.state.field(Br,!1)||ft(o.startState)!=ft(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Vn;for(let l of o.viewportLineBlocks){let c=vl(o.state,l.from,l.to)?r:yl(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,L3({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||ye.empty},initialSpacer(){return new Hc(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=vl(o.state,a.from,a.to);if(c)return o.dispatch({effects:$o.of(c)}),!0;let h=yl(o.state,a.from,a.to);return h?(o.dispatch({effects:Xl.of(h)}),!0):!1}}}),xx()]}const w4=_.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Pi{constructor(e,n){this.specs=e;let r;function i(a){let l=dr.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof on?a=>a.prop(ii)==o.data:o?a=>a==o:void 0,this.style=z0(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new dr(r):null,this.themeType=n.themeType}static define(e,n){return new Pi(e,n||{})}}const mh=Y.define(),vx=Y.define({combine(t){return t.length?[t[0]]:null}});function Vc(t){let e=t.facet(mh);return e.length?e:t.facet(vx)}function fu(t,e){let n=[k4],r;return t instanceof Pi&&(t.module&&n.push(_.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(vx.of(t)):r?n.push(mh.computeN([_.darkTheme],i=>i.facet(_.darkTheme)==(r=="dark")?[t]:[])):n.push(mh.of(t)),n}class S4{constructor(e){this.markCache=Object.create(null),this.tree=ft(e.state),this.decorations=this.buildDeco(e,Vc(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ft(e.state),r=Vc(e.state),i=r!=Vc(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return ie.none;let r=new Vn;for(let{from:i,to:s}of e.visibleRanges)TS(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ie.mark({class:l})))},i,s);return r.finish()}}const k4=Hr.high(Ve.fromClass(S4,{decorations:t=>t.decorations})),C4=Pi.define([{tag:E.meta,color:"#404740"},{tag:E.link,textDecoration:"underline"},{tag:E.heading,textDecoration:"underline",fontWeight:"bold"},{tag:E.emphasis,fontStyle:"italic"},{tag:E.strong,fontWeight:"bold"},{tag:E.strikethrough,textDecoration:"line-through"},{tag:E.keyword,color:"#708"},{tag:[E.atom,E.bool,E.url,E.contentSeparator,E.labelName],color:"#219"},{tag:[E.literal,E.inserted],color:"#164"},{tag:[E.string,E.deleted],color:"#a11"},{tag:[E.regexp,E.escape,E.special(E.string)],color:"#e40"},{tag:E.definition(E.variableName),color:"#00f"},{tag:E.local(E.variableName),color:"#30a"},{tag:[E.typeName,E.namespace],color:"#085"},{tag:E.className,color:"#167"},{tag:[E.special(E.variableName),E.macroName],color:"#256"},{tag:E.definition(E.propertyName),color:"#00c"},{tag:E.comment,color:"#940"},{tag:E.invalid,color:"#f00"}]),j4=_.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),wx=1e4,Sx="()[]{}",kx=Y.define({combine(t){return Rn(t,{afterCursor:!0,brackets:Sx,maxScanDistance:wx,renderMatch:N4})}}),O4=ie.mark({class:"cm-matchingBracket"}),P4=ie.mark({class:"cm-nonmatchingBracket"});function N4(t){let e=[],n=t.matched?O4:P4;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const D4=ot.define({create(){return ie.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(kx);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=Pn(e.state,i.head,-1,r)||i.head>0&&Pn(e.state,i.head-1,1,r)||r.afterCursor&&(Pn(e.state,i.head,1,r)||i.head<e.state.doc.length&&Pn(e.state,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,e.state)))}return ie.set(n,!0)},provide:t=>_.decorations.from(t)}),A4=[D4,j4];function M4(t={}){return[kx.of(t),A4]}const T4=new be;function gh(t,e,n){let r=t.prop(e<0?be.openedBy:be.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function bh(t){let e=t.type.prop(T4);return e?e(t.node):t}function Pn(t,e,n,r={}){let i=r.maxScanDistance||wx,s=r.brackets||Sx,o=ft(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=gh(l.type,n,s);if(c&&l.from<l.to){let h=bh(l);if(h&&(n>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return E4(t,e,n,l,h,c,s)}}return R4(t,e,n,o,a.type,i,s)}function E4(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,h=a?.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do if(n<0?h.to<=r.from:h.from>=r.to){if(c==0&&s.indexOf(h.type.name)>-1&&h.from<h.to){let u=bh(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(gh(h.type,n,o))c++;else if(gh(h.type,-n,o)){if(c==0){let u=bh(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function R4(t,e,n,r,i,s,o){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=s;){let p=h.value;n<0&&(f+=p.length);let g=e+f*n;for(let b=n>0?0:p.length-1,x=n>0?p.length:-1;b!=x;b+=n){let w=o.indexOf(p[b]);if(!(w<0||r.resolveInner(g+b,1).type!=i))if(w%2==0==n>0)u++;else{if(u==1)return{start:c,end:{from:g+b,to:g+b+1},matched:w>>1==l>>1};u--}}n>0&&(f+=p.length)}return h.done?{start:c,matched:!1}:null}const L4=Object.create(null),zp=[Mt.none],Hp=[],Vp=Object.create(null),I4=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])I4[t]=$4(L4,e);function _c(t,e){Hp.indexOf(t)>-1||(Hp.push(t),console.warn(e))}function $4(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=t[c]||E[c];h?typeof h=="function"?l.length?l=l.map(h):_c(c,`Modifier ${c} used at start of tag`):l.length?_c(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:_c(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=Vp[i];if(s)return s.id;let o=Vp[i]=Mt.define({id:zp.length,name:r,props:[B0({[r]:n})]});return zp.push(o),o.id}Ee.RTL,Ee.LTR;const B4=gl.define({name:"json",parser:IS.configure({props:[dx.add({Object:$p({except:/^\s*\}/}),Array:$p({except:/^\s*\]/})}),ux.add({"Object Array":l4})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function F4(){return new J3(B4)}function xh(){return xh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xh.apply(null,arguments)}function z4(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}const H4=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=mu(t.state,n.from);return r.line?V4(t):r.block?W4(t):!1};function pu(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const V4=pu(G4,0),_4=pu(Cx,0),W4=pu((t,e)=>Cx(t,e,K4(e)),0);function mu(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Qi=50;function U4(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Qi,r),o=t.sliceDoc(i,i+Qi),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let h,u;i-r<=2*Qi?h=u=t.sliceDoc(r,i):(h=t.sliceDoc(r,r+Qi),u=t.sliceDoc(i-Qi,i));let f=/^\s*/.exec(h)[0].length,p=/\s*$/.exec(u)[0].length,g=u.length-p-n.length;return h.slice(f,f+e.length)==e&&u.slice(g,g+n.length)==n?{open:{pos:r+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(u.charAt(g-1))?1:0}}:null}function K4(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function Cx(t,e,n=e.selection.ranges){let r=n.map(s=>mu(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>U4(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:h}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:s}}return null}function G4(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of n){let a=r.length,l=1e9,c=mu(e,s).line;if(c){for(let h=s;h<=o;){let u=e.doc.lineAt(h);if(u.from>i&&(s==o||o>u.from)){i=u.from;let f=/^\s*/.exec(u.text)[0].length,p=f==u.length,g=u.text.slice(f,f+c.length)==c?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:g,token:c,indent:f,empty:p,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,s.push({from:c,to:h})}return{changes:s}}return null}const yh=En.define(),q4=En.define(),Y4=Y.define(),jx=Y.define({combine(t){return Rn(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),Ox=ot.define({create(){return Nn.empty},update(t,e){let n=e.state.facet(jx),r=e.annotation(yh);if(r){let l=At.fromTransaction(e,r.selection),c=r.side,h=c==0?t.undone:t.done;return l?h=wl(h,h.length,n.minDepth,l):h=Dx(h,e.startState.selection),new Nn(c==0?r.rest:h,c==0?h:r.rest)}let i=e.annotation(q4);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Je.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=At.fromTransaction(e),o=e.annotation(Je.time),a=e.annotation(Je.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Nn(t.done.map(At.fromJSON),t.undone.map(At.fromJSON))}});function J4(t={}){return[Ox,jx.of(t),_.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Px:e.inputType=="historyRedo"?vh:null;return r?(e.preventDefault(),r(n)):!1}})]}function Zl(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(Ox,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const Px=Zl(0,!1),vh=Zl(1,!1),Q4=Zl(0,!0),X4=Zl(1,!0);class At{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new At(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new At(e.changes&&Ge.fromJSON(e.changes),[],e.mapped&&An.fromJSON(e.mapped),e.startSelection&&L.fromJSON(e.startSelection),e.selectionsAfter.map(L.fromJSON))}static fromTransaction(e,n){let r=Yt;for(let i of e.startState.facet(Y4)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new At(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Yt)}static selection(e){return new At(void 0,Yt,void 0,void 0,e)}}function wl(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Z4(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],h=n[l++];a>=c&&o<=h&&(r=!0)}}),r}function e5(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Nx(t,e){return t.length?e.length?t.concat(e):t:e}const Yt=[],t5=200;function Dx(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-t5));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),wl(t,t.length-1,1e9,n.setSelAfter(r)))}else return[At.selection([e])]}function n5(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Wc(t,e){if(!t.length)return t;let n=t.length,r=Yt;for(;n;){let i=r5(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[At.selection(r)]:Yt}function r5(t,e,n){let r=Nx(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Yt,n);if(!t.changes)return At.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new At(i,me.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const i5=/^(input\.type|delete)($|\.)/;class Nn{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Nn(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||i5.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Z4(a.changes,e.changes))||r=="input.type.compose")?o=wl(o,o.length-1,i.minDepth,new At(e.changes.compose(a.changes),Nx(me.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Yt)):o=wl(o,o.length,i.minDepth,e),new Nn(o,Yt,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Yt;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&e5(s[s.length-1],e)?this:new Nn(Dx(this.done,e),this.undone,n,r)}addMapping(e){return new Nn(Wc(this.done,e),Wc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:yh.of({side:e,rest:n5(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Yt:i.slice(0,i.length-1);return s.mapped&&(a=Wc(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:yh.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Nn.empty=new Nn(Yt,Yt);const s5=[{key:"Mod-z",run:Px,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:vh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:vh,preventDefault:!0},{key:"Mod-u",run:Q4,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:X4,preventDefault:!0}];function Ni(t,e){return L.create(t.ranges.map(e),t.mainIndex)}function hn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function un({state:t,dispatch:e},n){let r=Ni(t.selection,n);return r.eq(t.selection,!0)?!1:(e(hn(t,r)),!0)}function ec(t,e){return L.cursor(e?t.to:t.from)}function Ax(t,e){return un(t,n=>n.empty?t.moveByChar(n,e):ec(n,e))}function pt(t){return t.textDirectionAt(t.state.selection.main.head)==Ee.LTR}const Mx=t=>Ax(t,!pt(t)),Tx=t=>Ax(t,pt(t));function Ex(t,e){return un(t,n=>n.empty?t.moveByGroup(n,e):ec(n,e))}const o5=t=>Ex(t,!pt(t)),a5=t=>Ex(t,pt(t));function l5(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function tc(t,e,n){let r=ft(t).resolveInner(e.head),i=n?be.closedBy:be.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;l5(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?Pn(t,r.from,1):Pn(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,L.cursor(a,n?-1:1)}const c5=t=>un(t,e=>tc(t.state,e,!pt(t))),d5=t=>un(t,e=>tc(t.state,e,pt(t)));function Rx(t,e){return un(t,n=>{if(!n.empty)return ec(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Lx=t=>Rx(t,!1),Ix=t=>Rx(t,!0);function $x(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(_.scrollMargins)){let o=s(t);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function Bx(t,e){let n=$x(t),{state:r}=t,i=Ni(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):ec(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=_.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(hn(r,i),{effects:s}),!0}const _p=t=>Bx(t,!1),wh=t=>Bx(t,!0);function gr(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=L.cursor(r.from+s))}return i}const h5=t=>un(t,e=>gr(t,e,!0)),u5=t=>un(t,e=>gr(t,e,!1)),f5=t=>un(t,e=>gr(t,e,!pt(t))),p5=t=>un(t,e=>gr(t,e,pt(t))),m5=t=>un(t,e=>L.cursor(t.lineBlockAt(e.head).from,1)),g5=t=>un(t,e=>L.cursor(t.lineBlockAt(e.head).to,-1));function b5(t,e,n){let r=!1,i=Ni(t.selection,s=>{let o=Pn(t,s.head,-1)||Pn(t,s.head,1)||s.head>0&&Pn(t,s.head-1,1)||s.head<t.doc.length&&Pn(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return L.cursor(a)});return r?(e(hn(t,i)),!0):!1}const x5=({state:t,dispatch:e})=>b5(t,e);function tn(t,e){let n=Ni(t.state.selection,r=>{let i=e(r);return L.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(hn(t.state,n)),!0)}function Fx(t,e){return tn(t,n=>t.moveByChar(n,e))}const zx=t=>Fx(t,!pt(t)),Hx=t=>Fx(t,pt(t));function Vx(t,e){return tn(t,n=>t.moveByGroup(n,e))}const y5=t=>Vx(t,!pt(t)),v5=t=>Vx(t,pt(t)),w5=t=>tn(t,e=>tc(t.state,e,!pt(t))),S5=t=>tn(t,e=>tc(t.state,e,pt(t)));function _x(t,e){return tn(t,n=>t.moveVertically(n,e))}const Wx=t=>_x(t,!1),Ux=t=>_x(t,!0);function Kx(t,e){return tn(t,n=>t.moveVertically(n,e,$x(t).height))}const Wp=t=>Kx(t,!1),Up=t=>Kx(t,!0),k5=t=>tn(t,e=>gr(t,e,!0)),C5=t=>tn(t,e=>gr(t,e,!1)),j5=t=>tn(t,e=>gr(t,e,!pt(t))),O5=t=>tn(t,e=>gr(t,e,pt(t))),P5=t=>tn(t,e=>L.cursor(t.lineBlockAt(e.head).from)),N5=t=>tn(t,e=>L.cursor(t.lineBlockAt(e.head).to)),Kp=({state:t,dispatch:e})=>(e(hn(t,{anchor:0})),!0),Gp=({state:t,dispatch:e})=>(e(hn(t,{anchor:t.doc.length})),!0),qp=({state:t,dispatch:e})=>(e(hn(t,{anchor:t.selection.main.anchor,head:0})),!0),Yp=({state:t,dispatch:e})=>(e(hn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),D5=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),A5=({state:t,dispatch:e})=>{let n=nc(t).map(({from:r,to:i})=>L.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:L.create(n),userEvent:"select"})),!0},M5=({state:t,dispatch:e})=>{let n=Ni(t.selection,r=>{let i=ft(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return L.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(hn(t,n)),!0)};function Gx(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(t.dispatch(hn(n,L.create(i,i.length-1))),!0)}const T5=t=>Gx(t,!1),E5=t=>Gx(t,!0),R5=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=L.create([n.main]):n.main.empty||(r=L.create([L.cursor(n.main.head)])),r?(e(hn(t,r)),!0):!1};function Bo(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=Na(t,l,!1)):l>o&&(n="delete.forward",l=Na(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Na(t,o,!1),a=Na(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:L.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?_.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Na(t,e,n){if(t instanceof _)for(let r of t.state.facet(_.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const qx=(t,e,n)=>Bo(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=Oi(a,s.tabSize),h=c%xl(s)||xl(s);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)i--;l=i}else l=Ye(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=Ye(o.text,l-o.from,!1,!1)+o.from);return l}),Sh=t=>qx(t,!1,!0),Yx=t=>qx(t,!0,!1),Jx=(t,e)=>Bo(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=Ye(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=n.head)&&(a=h),r=l}return r}),Qx=t=>Jx(t,!1),L5=t=>Jx(t,!0),I5=t=>Bo(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),$5=t=>Bo(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),B5=t=>Bo(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),F5=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Oe.of(["",""])},range:L.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},z5=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:Ye(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ye(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:L.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function nc(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function Xx(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of nc(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(L.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(L.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:L.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const H5=({state:t,dispatch:e})=>Xx(t,e,!1),V5=({state:t,dispatch:e})=>Xx(t,e,!0);function Zx(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of nc(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const _5=({state:t,dispatch:e})=>Zx(t,e,!1),W5=({state:t,dispatch:e})=>Zx(t,e,!0),U5=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(nc(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Ni(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function K5(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ft(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(be.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Jp=ey(!1),G5=ey(!0);function ey(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&K5(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Ql(e,{simulateBreak:s,simulateDoubleBreak:!!l}),h=hu(c,s);for(h==null&&(h=Oi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let u=["",$s(e,h)];return l&&u.push($s(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Oe.of(u)},range:L.cursor(s+1+u[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function gu(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:L.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const q5=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ql(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=gu(t,(s,o,a)=>{let l=hu(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],h=$s(t,l);(c!=h||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:h}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},ty=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(gu(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Jl)})}),{userEvent:"input.indent"})),!0),ny=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(gu(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Oi(i,t.tabSize),o=0,a=$s(t,Math.max(0,s-xl(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),Y5=t=>(t.setTabFocusMode(),!0),J5=[{key:"Ctrl-b",run:Mx,shift:zx,preventDefault:!0},{key:"Ctrl-f",run:Tx,shift:Hx},{key:"Ctrl-p",run:Lx,shift:Wx},{key:"Ctrl-n",run:Ix,shift:Ux},{key:"Ctrl-a",run:m5,shift:P5},{key:"Ctrl-e",run:g5,shift:N5},{key:"Ctrl-d",run:Yx},{key:"Ctrl-h",run:Sh},{key:"Ctrl-k",run:I5},{key:"Ctrl-Alt-h",run:Qx},{key:"Ctrl-o",run:F5},{key:"Ctrl-t",run:z5},{key:"Ctrl-v",run:wh}],Q5=[{key:"ArrowLeft",run:Mx,shift:zx,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:o5,shift:y5,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:f5,shift:j5,preventDefault:!0},{key:"ArrowRight",run:Tx,shift:Hx,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:a5,shift:v5,preventDefault:!0},{mac:"Cmd-ArrowRight",run:p5,shift:O5,preventDefault:!0},{key:"ArrowUp",run:Lx,shift:Wx,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Kp,shift:qp},{mac:"Ctrl-ArrowUp",run:_p,shift:Wp},{key:"ArrowDown",run:Ix,shift:Ux,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Gp,shift:Yp},{mac:"Ctrl-ArrowDown",run:wh,shift:Up},{key:"PageUp",run:_p,shift:Wp},{key:"PageDown",run:wh,shift:Up},{key:"Home",run:u5,shift:C5,preventDefault:!0},{key:"Mod-Home",run:Kp,shift:qp},{key:"End",run:h5,shift:k5,preventDefault:!0},{key:"Mod-End",run:Gp,shift:Yp},{key:"Enter",run:Jp,shift:Jp},{key:"Mod-a",run:D5},{key:"Backspace",run:Sh,shift:Sh,preventDefault:!0},{key:"Delete",run:Yx,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Qx,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:L5,preventDefault:!0},{mac:"Mod-Backspace",run:$5,preventDefault:!0},{mac:"Mod-Delete",run:B5,preventDefault:!0}].concat(J5.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),X5=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:c5,shift:w5},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:d5,shift:S5},{key:"Alt-ArrowUp",run:H5},{key:"Shift-Alt-ArrowUp",run:_5},{key:"Alt-ArrowDown",run:V5},{key:"Shift-Alt-ArrowDown",run:W5},{key:"Mod-Alt-ArrowUp",run:T5},{key:"Mod-Alt-ArrowDown",run:E5},{key:"Escape",run:R5},{key:"Mod-Enter",run:G5},{key:"Alt-l",mac:"Ctrl-l",run:A5},{key:"Mod-i",run:M5,preventDefault:!0},{key:"Mod-[",run:ny},{key:"Mod-]",run:ty},{key:"Mod-Alt-\\",run:q5},{key:"Shift-Mod-k",run:U5},{key:"Shift-Mod-\\",run:x5},{key:"Mod-/",run:H4},{key:"Alt-A",run:_4},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Y5}].concat(Q5),Z5={key:"Tab",run:ty,shift:ny},Qp=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class ki{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(Qp(a)):Qp,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ot(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=qh(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=jn(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r;;s++){let a=i.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(l)return this.value=l,this;break}o==r&&s<n.length&&n.charCodeAt(s)==a&&o++}}}match(e,n,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:n,to:r}:this.matches.push(1,n)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(ki.prototype[Symbol.iterator]=function(){return this});const ry={from:-1,to:-1,match:/.*/.exec("")},bu="gm"+(/x/.unicode==null?"":"u");class iy{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=ry,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new sy(e,n,r,i,s);this.re=new RegExp(n,bu+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=Sl(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=Sl(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Uc=new WeakMap;class fi{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=Uc.get(e);if(!i||i.from>=r||i.to<=n){let a=new fi(n,e.sliceString(n,r));return Uc.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),Uc.set(e,new fi(o,s)),new fi(n,s.slice(n-o,r-o))}}class sy{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=ry,this.matchPos=Sl(e,i),this.re=new RegExp(n,bu+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=fi.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=Sl(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(iy.prototype[Symbol.iterator]=sy.prototype[Symbol.iterator]=function(){return this});function ej(t){try{return new RegExp(t,bu),!0}catch{return!1}}function Sl(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function kh(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Me("input",{class:"cm-textfield",name:"line",value:e}),r=Me("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:gs.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Me("label",t.state.phrase("Go to line"),": ",n)," ",Me("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Me("button",{name:"close",onclick:()=>{t.dispatch({effects:gs.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,c,h,u]=s,f=h?+h.slice(1):0,p=c?+c:a.number;if(c&&u){let x=p/100;l&&(x=x*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*x)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),b=L.cursor(g.from+Math.max(0,Math.min(f,g.length)));t.dispatch({effects:[gs.of(!1),_.scrollIntoView(b.from,{y:"center"})],selection:b}),t.focus()}return{dom:r}}const gs=me.define(),Xp=ot.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(gs)&&(t=n.value);return t},provide:t=>Is.from(t,e=>e?kh:null)}),tj=t=>{let e=Ls(t,kh);if(!e){let n=[gs.of(!0)];t.state.field(Xp,!1)==null&&n.push(me.appendConfig.of([Xp,nj])),t.dispatch({effects:n}),e=Ls(t,kh)}return e&&e.dom.querySelector("input").select(),!0},nj=_.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),rj={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ij=Y.define({combine(t){return Rn(t,rj,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function sj(t){return[dj,cj]}const oj=ie.mark({class:"cm-selectionMatch"}),aj=ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Zp(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Ie.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Ie.Word)}function lj(t,e,n,r){return t(e.sliceDoc(n,n+1))==Ie.Word&&t(e.sliceDoc(r-1,r))==Ie.Word}const cj=Ve.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(ij),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ie.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ie.none;let l=n.wordAt(i.head);if(!l)return ie.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ie.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Zp(o,n,i.from,i.to)&&lj(o,n,i.from,i.to)))return ie.none}else if(s=n.sliceDoc(i.from,i.to),!s)return ie.none}let a=[];for(let l of t.visibleRanges){let c=new ki(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||Zp(o,n,h,u))&&(i.empty&&h<=i.from&&u>=i.to?a.push(aj.range(h,u)):(h>=i.to||u<=i.from)&&a.push(oj.range(h,u)),a.length>e.maxMatches))return ie.none}}return ie.set(a)}},{decorations:t=>t.decorations}),dj=_.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),hj=({state:t,dispatch:e})=>{let{selection:n}=t,r=L.create(n.ranges.map(i=>t.wordAt(i.head)||L.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function uj(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new ki(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new ki(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const fj=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return hj({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=uj(t,r);return i?(e(t.update({selection:t.selection.addRange(L.range(i.from,i.to),!1),effects:_.scrollIntoView(i.to)})),!0):!1},Di=Y.define({combine(t){return Rn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new jj(e),scrollToMatch:e=>_.scrollIntoView(e)})}});class oy{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||ej(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
235
|
-
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new bj(this):new mj(this)}getCursor(e,n=0,r){let i=e.doc?e:Se.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?ei(this,i,n,r):Zr(this,i,n,r)}}class ay{constructor(e){this.spec=e}}function Zr(t,e,n,r){return new ki(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?pj(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function pj(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(kl(i,n-s))!=Ie.Word||e(Cl(i,n-s))!=Ie.Word)&&(e(Cl(i,r-s))!=Ie.Word||e(kl(i,r-s))!=Ie.Word))}class mj extends ay{constructor(e){super(e)}nextMatch(e,n,r){let i=Zr(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=Zr(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=Zr(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Zr(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Zr(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ei(t,e,n,r){return new iy(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?gj(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function kl(t,e){return t.slice(Ye(t,e,!1),e)}function Cl(t,e){return t.slice(e,Ye(t,e))}function gj(t){return(e,n,r)=>!r[0].length||(t(kl(r.input,r.index))!=Ie.Word||t(Cl(r.input,r.index))!=Ie.Word)&&(t(Cl(r.input,r.index+r[0].length))!=Ie.Word||t(kl(r.input,r.index+r[0].length))!=Ie.Word)}class bj extends ay{nextMatch(e,n,r){let i=ei(this.spec,e,r,e.doc.length).next();return i.done&&(i=ei(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=ei(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return n})}matchAll(e,n){let r=ei(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=ei(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Bs=me.define(),xu=me.define(),ar=ot.define({create(t){return new Kc(Ch(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Bs)?t=new Kc(n.value.create(),t.panel):n.is(xu)&&(t=new Kc(t.query,n.value?yu:null));return t},provide:t=>Is.from(t,e=>e.panel)});class Kc{constructor(e,n){this.query=e,this.panel=n}}const xj=ie.mark({class:"cm-searchMatch"}),yj=ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),vj=Ve.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ar))}update(t){let e=t.state.field(ar);(e!=t.startState.field(ar)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ie.none;let{view:n}=this,r=new Vn;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(n.state,a,l,(c,h)=>{let u=n.state.selection.ranges.some(f=>f.from==c&&f.to==h);r.add(c,h,u?yj:xj)})}return r.finish()}},{decorations:t=>t.decorations});function Fo(t){return e=>{let n=e.state.field(ar,!1);return n&&n.query.spec.valid?t(e,n):dy(e)}}const jl=Fo((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=L.single(r.from,r.to),s=t.state.facet(Di);return t.dispatch({selection:i,effects:[vu(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),cy(t),!0}),Ol=Fo((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=L.single(i.from,i.to),o=t.state.facet(Di);return t.dispatch({selection:s,effects:[vu(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),cy(t),!0}),wj=Fo((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:L.create(n.map(r=>L.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Sj=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new ki(t.doc,t.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(L.range(a.value.from,a.value.to))}return e(t.update({selection:L.create(s,o),userEvent:"select.search.matches"})),!0},em=Fo((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,c,h=[];o.from==r&&o.to==i&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),h.push(_.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=t.state.changes(a);return o&&(l=L.single(o.from,o.to).map(u),h.push(vu(t,o)),h.push(n.facet(Di).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),kj=Fo((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:_.announce.of(r),userEvent:"input.replace.all"}),!0});function yu(t){return t.state.facet(Di).createPanel(t)}function Ch(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Di);return new oy({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function ly(t){let e=Ls(t,yu);return e&&e.dom.querySelector("[main-field]")}function cy(t){let e=ly(t);e&&e==t.root.activeElement&&e.select()}const dy=t=>{let e=t.state.field(ar,!1);if(e&&e.panel){let n=ly(t);if(n&&n!=t.root.activeElement){let r=Ch(t.state,e.query.spec);r.valid&&t.dispatch({effects:Bs.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[xu.of(!0),e?Bs.of(Ch(t.state,e.query.spec)):me.appendConfig.of(Pj)]});return!0},hy=t=>{let e=t.state.field(ar,!1);if(!e||!e.panel)return!1;let n=Ls(t,yu);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:xu.of(!1)}),!0},Cj=[{key:"Mod-f",run:dy,scope:"editor search-panel"},{key:"F3",run:jl,shift:Ol,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:jl,shift:Ol,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:hy,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Sj},{key:"Mod-Alt-g",run:tj},{key:"Mod-d",run:fj,preventDefault:!0}];class jj{constructor(e){this.view=e;let n=this.query=e.state.field(ar).query.spec;this.commit=this.commit.bind(this),this.searchField=Me("input",{value:n.search,placeholder:Rt(e,"Find"),"aria-label":Rt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Me("input",{value:n.replace,placeholder:Rt(e,"Replace"),"aria-label":Rt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Me("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Me("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Me("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Me("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Me("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>jl(e),[Rt(e,"next")]),r("prev",()=>Ol(e),[Rt(e,"previous")]),r("select",()=>wj(e),[Rt(e,"all")]),Me("label",null,[this.caseField,Rt(e,"match case")]),Me("label",null,[this.reField,Rt(e,"regexp")]),Me("label",null,[this.wordField,Rt(e,"by word")]),...e.state.readOnly?[]:[Me("br"),this.replaceField,r("replace",()=>em(e),[Rt(e,"replace")]),r("replaceAll",()=>kj(e),[Rt(e,"replace all")])],Me("button",{name:"close",onclick:()=>hy(e),"aria-label":Rt(e,"close"),type:"button"},["×"])])}commit(){let e=new oy({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Bs.of(e)}))}keydown(e){_C(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ol:jl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),em(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Bs)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Di).top}}function Rt(t,e){return t.state.phrase(e)}const Da=30,Aa=/[\s\.,:;?!]/;function vu(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-Da),o=Math.min(i,n+Da),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Da;l++)if(!Aa.test(a[l+1])&&Aa.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Da;l--)if(!Aa.test(a[l-1])&&Aa.test(a[l])){a=a.slice(0,l);break}}return _.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const Oj=_.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Pj=[ar,Hr.low(vj),Oj];class uy{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ft(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(fy(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function tm(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Nj(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=tm(e)+tm(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Dj(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Nj(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class nm{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Lr(t){return t.selection.main.from}function fy(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const py=En.define();function Aj(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:L.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const rm=new WeakMap;function Mj(t){if(!Array.isArray(t))return t;let e=rm.get(t);return e||rm.set(t,e=Dj(t)),e}const Pl=me.define(),Fs=me.define();class Tj{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=Ot(e,n),i=jn(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(Ot(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let v=Ot(e,0),k=jn(v),j=k==e.length?0:-100;if(v!=n[0])if(v==r[0])j+=-200;else return null;return this.ret(j,[0,k])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let v=0,k=Math.min(e.length,200);v<k&&c<l;){let j=Ot(e,v);(j==n[c]||j==r[c])&&(i[c++]=v),v+=jn(j)}if(c<l)return null}let h=0,u=0,f=!1,p=0,g=-1,b=-1,x=/[a-z]/.test(e),w=!0;for(let v=0,k=Math.min(e.length,200),j=0;v<k&&u<l;){let S=Ot(e,v);a<0&&(h<l&&S==n[h]&&(s[h++]=v),p<l&&(S==n[p]||S==r[p]?(p==0&&(g=v),b=v+1,p++):p=0));let C,y=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(C=qh(S))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!v||y==1&&x||j==0&&y!=0)&&(n[u]==S||r[u]==S&&(f=!0)?o[u++]=v:o.length&&(w=!1)),j=y,v+=jn(S)}return u==l&&o[0]==0&&w?this.result(-100+(f?-200:0),o,e):p==l&&g==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[g,b]):u==l?this.result(-100+(f?-200:0)+-700+(w?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let a=o+(this.astral?jn(Ot(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class Ej{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const tt=Y.define({combine(t){return Rn(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Rj,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>im(e(r),n(r)),optionClass:(e,n)=>r=>im(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function im(t,e){return t?e?t+" "+e:t:e}function Rj(t,e,n,r,i,s){let o=t.textDirection==Ee.RTL,a=o,l=!1,c="top",h,u,f=e.left-i.left,p=i.right-e.right,g=r.right-r.left,b=r.bottom-r.top;if(a&&f<Math.min(g,p)?a=!1:!a&&p<Math.min(g,f)&&(a=!0),g<=(a?f:p))h=Math.max(i.top,Math.min(n.top,i.bottom-b))-e.top,u=Math.min(400,a?f:p);else{l=!0,u=Math.min(400,(o?e.right:i.right-e.left)-30);let v=i.bottom-e.bottom;v>=b||v>e.top?h=n.bottom-e.top:(c="bottom",h=e.bottom-n.top)}let x=(e.bottom-e.top)/s.offsetHeight,w=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${h/x}px; max-width: ${u/w}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function Lj(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let h=s[c++],u=s[c++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(h,u))),f.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Gc(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Ij{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(tt);this.optionContent=Lj(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Gc(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(tt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Fs.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=Gc(s.length,o,e.state.facet(tt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Gc(n.options.length,n.selected,this.view.state.facet(tt).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>Dt(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&Bj(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(tt).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=f}}const h=i.appendChild(document.createElement("li"));h.id=n+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&h.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function $j(t,e){return n=>new Ij(n,t,e)}function Bj(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function sm(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Fj(t,e){let n=[],r=null,i=null,s=h=>{n.push(h);let{section:u}=h.completion;if(u){r||(r=[]);let f=typeof u=="string"?u:u.name;r.some(p=>p.name==f)||r.push(typeof u=="string"?{name:f}:u)}},o=e.facet(tt);for(let h of t)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)s(new nm(f,h.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(h.from,h.to),p,g=o.filterStrict?new Ej(f):new Tj(f);for(let b of h.result.options)if(p=g.match(b.label)){let x=b.displayLabel?u?u(b,p.matched):[]:p.matched,w=p.score+(b.boost||0);if(s(new nm(b,h.source,x,w)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;i||(i=Object.create(null)),i[v]=Math.max(w,i[v]||-1e9)}}}}if(r){let h=Object.create(null),u=0,f=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?i[g.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of r.sort(f))u-=1e5,h[p.name]=u;for(let p of n){let{section:g}=p.completion;g&&(p.score+=h[typeof g=="string"?g:g.name])}}let a=[],l=null,c=o.compareCompletions;for(let h of n.sort((u,f)=>f.score-u.score||c(u.completion,f.completion))){let u=h.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(h):sm(h.completion)>sm(l)&&(a[a.length-1]=h),l=h.completion}return a}class si{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new si(this.options,om(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=Fj(e,n);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(tt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==c){l=h;break}}return new si(a,om(r,l),{pos:e.reduce((c,h)=>h.hasResult()?Math.min(c,h.from):c,1e8),create:Uj,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new si(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new si(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Nl{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Nl(_j,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(tt),s=(r.override||n.languageDataAt("autocomplete",Lr(n)).map(Mj)).map(l=>(this.active.find(h=>h.source==l)||new Jt(l,this.active.some(h=>h.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(wu));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!zj(s,this.active)||a?o=si.build(s,n,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Jt(l.source,0):l));for(let l of e.effects)l.is(gy)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new Nl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Hj:Vj}}function zj(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const Hj={"aria-autocomplete":"list"},Vj={};function om(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const _j=[];function my(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(py);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Jt{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=my(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Jt(i.source,0)),r&4&&i.state==0&&(i=new Jt(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(Pl))i=new Jt(i.source,1,s.value);else if(s.is(Fs))i=new Jt(i.source,0);else if(s.is(wu))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Lr(e.state))}}class pi extends Jt{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Lr(e.state);if(a>o||!i||n&2&&(Lr(e.startState)==this.from||a<this.limit))return new Jt(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return Wj(i.validFor,e.state,s,o)?new pi(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new uy(e.state,a,!1)))?new pi(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Lr(e.state)):new Jt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new pi(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Jt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Wj(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):fy(t,!0).test(i)}const wu=me.define({map(t,e){return t.map(n=>n.map(e))}}),gy=me.define(),Pt=ot.define({create(){return Nl.start()},update(t,e){return t.update(e)},provide:t=>[du.from(t,e=>e.tooltip),_.contentAttributes.from(t,e=>e.attrs)]});function Su(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Pt).active.find(i=>i.source==e.source);return r instanceof pi?(typeof n=="string"?t.dispatch({...Aj(t.state,n,r.from,r.to),annotations:py.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Uj=$j(Pt,Su);function Ma(t,e="option"){return n=>{let r=n.state.field(Pt,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(tt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=sx(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:gy.of(a)}),!0}}const Kj=t=>{let e=t.state.field(Pt,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(tt).interactionDelay?!1:Su(t,e.open.options[e.open.selected])},qc=t=>t.state.field(Pt,!1)?(t.dispatch({effects:Pl.of(!0)}),!0):!1,Gj=t=>{let e=t.state.field(Pt,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Fs.of(null)}),!0)};class qj{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Yj=50,Jj=1e3,Qj=Ve.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Pt).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Pt),n=t.state.facet(tt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Pt)==e)return;let r=t.transactions.some(s=>{let o=my(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>Yj&&Date.now()-o.time>Jj){for(let a of o.context.abortListeners)try{a()}catch(l){Dt(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(Pl)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Pt);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(tt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Lr(e),r=new uy(e,n,t.explicit,this.view),i=new qj(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Fs.of(null)}),Dt(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(tt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(tt),r=this.view.state.field(Pt);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=Lr(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new pi(s.active.source,s.active.explicit,l,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:a);for(let h of s.updates)c=c.update(h,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new Jt(s.active.source,0);for(let l of s.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:wu.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Pt,!1);if(e&&e.tooltip&&this.view.state.facet(tt).closeOnBlur){let n=e.open&&sx(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Fs.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Pl.of(!1)}),20),this.composing=0}}}),Xj=typeof navigator=="object"&&/Win/.test(navigator.platform),Zj=Hr.highest(_.domEventHandlers({keydown(t,e){let n=e.state.field(Pt,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Xj&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&Su(e,r),!1}})),eO=_.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),zs={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Er=me.define({map(t,e){let n=e.mapPos(t,-1,wt.TrackAfter);return n??void 0}}),ku=new class extends cr{};ku.startSide=1;ku.endSide=-1;const by=ot.define({create(){return ye.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Er)&&(t=t.update({add:[ku.range(n.value,n.value+1)]}));return t}});function tO(){return[rO,by]}const Yc="()[]{}<>«»»«[]{}";function xy(t){for(let e=0;e<Yc.length;e+=2)if(Yc.charCodeAt(e)==t)return Yc.charAt(e+1);return qh(t<128?t:t+1)}function yy(t,e){return t.languageDataAt("closeBrackets",e)[0]||zs}const nO=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),rO=_.inputHandler.of((t,e,n,r)=>{if((nO?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&jn(Ot(r,0))==1||e!=i.from||n!=i.to)return!1;let s=oO(t.state,r);return s?(t.dispatch(s),!0):!1}),iO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=yy(t,t.selection.main.head).brackets||zs.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=aO(t.doc,o.head);for(let l of r)if(l==a&&rc(t.doc,o.head)==xy(Ot(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:L.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},sO=[{key:"Backspace",run:iO}];function oO(t,e){let n=yy(t,t.selection.main.head),r=n.brackets||zs.brackets;for(let i of r){let s=xy(Ot(i,0));if(e==i)return s==i?dO(t,i,r.indexOf(i+i+i)>-1,n):lO(t,i,s,n.before||zs.before);if(e==s&&vy(t,t.selection.main.from))return cO(t,i,s)}return null}function vy(t,e){let n=!1;return t.field(by).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function rc(t,e){let n=t.sliceString(e,e+2);return n.slice(0,jn(Ot(n,0)))}function aO(t,e){let n=t.sliceString(e-2,e);return jn(Ot(n,0))==n.length?n:n.slice(1)}function lO(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Er.of(o.to+e.length),range:L.range(o.anchor+e.length,o.head+e.length)};let a=rc(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Er.of(o.head+e.length),range:L.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function cO(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&rc(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:L.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function dO(t,e,n,r){let i=r.stringPrefixes||zs.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Er.of(a.to+e.length),range:L.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=rc(t.doc,l),h;if(c==e){if(am(t,l))return{changes:{insert:e+e,from:l},effects:Er.of(l+e.length),range:L.cursor(l+e.length)};if(vy(t,l)){let f=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:L.cursor(l+f.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=lm(t,l-2*e.length,i))>-1&&am(t,h))return{changes:{insert:e+e+e+e,from:l},effects:Er.of(l+e.length),range:L.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Ie.Word&&lm(t,l,i)>-1&&!hO(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Er.of(l+e.length),range:L.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function am(t,e){let n=ft(t).resolveInner(e+1);return n.parent&&n.from==e}function hO(t,e,n,r){let i=ft(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=i.firstChild;for(;h&&h.from==i.from&&h.to-h.from>n.length+l;){if(t.sliceDoc(h.to-n.length,h.to)==n)return!1;h=h.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function lm(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ie.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Ie.Word)return s}return-1}function uO(t={}){return[Zj,Pt,tt.of(t),Qj,fO,eO]}const wy=[{key:"Ctrl-Space",run:qc},{mac:"Alt-`",run:qc},{mac:"Alt-i",run:qc},{key:"Escape",run:Gj},{key:"ArrowDown",run:Ma(!0)},{key:"ArrowUp",run:Ma(!1)},{key:"PageDown",run:Ma(!0,"page")},{key:"PageUp",run:Ma(!1,"page")},{key:"Enter",run:Kj}],fO=Hr.highest(ql.computeN([tt],t=>t.facet(tt).defaultKeymap?[wy]:[]));class cm{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Or{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Hs).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Vn,a=[],l=0,c=r.doc.iter(),h=0,u=r.doc.length;for(let p=0;;){let g=p==s.length?null:s[p];if(!g&&!a.length)break;let b,x;if(a.length)b=l,x=a.reduce((k,j)=>Math.min(k,j.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>u)break;x=g.to,a.push(g),p++}for(;p<s.length;){let k=s[p];if(k.from==b&&(k.to>k.from||k.to==b))a.push(k),p++,x=Math.min(k.to,x);else{x=Math.min(k.from,x);break}}x=Math.min(x,u);let w=!1;if(a.some(k=>k.from==b&&(k.to==x||x==u))&&(w=b==x,!w&&x-b<10)){let k=b-(h+c.value.length);k>0&&(c.next(k),h=b);for(let j=b;;){if(j>=x){w=!0;break}if(!c.lineBreak&&h+c.value.length>j)break;j=h+c.value.length,h+=c.value.length,c.next()}}let v=OO(a);if(w)o.add(b,b,ie.widget({widget:new SO(v),diagnostics:a.slice()}));else{let k=a.reduce((j,S)=>S.markClass?j+" "+S.markClass:j,"");o.add(b,x,ie.mark({class:"cm-lintRange cm-lintRange-"+v+k,diagnostics:a.slice(),inclusiveEnd:a.some(j=>j.to>x)}))}if(l=x,l==u)break;for(let k=0;k<a.length;k++)a[k].to<=l&&a.splice(k--,1)}let f=o.finish();return new Or(f,n,Ci(f))}}function Ci(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new cm(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new cm(r.from,s,r.diagnostic)}}),r}function pO(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Hs).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(Sy))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function mO(t,e){return t.field(Bt,!1)?e:e.concat(me.appendConfig.of(PO))}const Sy=me.define(),Cu=me.define(),ky=me.define(),Bt=ot.define({create(){return new Or(ie.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=Ci(n,t.selected.diagnostic,s)||Ci(n,null,s)}!n.size&&i&&e.state.facet(Hs).autoPanel&&(i=null),t=new Or(n,i,r)}for(let n of e.effects)if(n.is(Sy)){let r=e.state.facet(Hs).autoPanel?n.value.length?Vs.open:null:t.panel;t=Or.init(n.value,r,e.state)}else n.is(Cu)?t=new Or(t.diagnostics,n.value?Vs.open:null,t.selected):n.is(ky)&&(t=new Or(t.diagnostics,t.panel,n.value));return t},provide:t=>[Is.from(t,e=>e.panel),_.decorations.from(t,e=>e.diagnostics)]}),gO=ie.mark({class:"cm-lintRange cm-lintRange-active"});function bO(t,e,n){let{diagnostics:r}=t.state.field(Bt),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:h})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=h.diagnostics,s=l,o=c,!1});let a=t.state.facet(Hs).tooltipFilter;return i&&a&&(i=a(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:xO(t,i)}}}:null}function xO(t,e){return Me("ul",{class:"cm-tooltip-lint"},e.map(n=>jy(t,n,!1)))}const yO=t=>{let e=t.state.field(Bt,!1);(!e||!e.panel)&&t.dispatch({effects:mO(t.state,[Cu.of(!0)])});let n=Ls(t,Vs.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},dm=t=>{let e=t.state.field(Bt,!1);return!e||!e.panel?!1:(t.dispatch({effects:Cu.of(!1)}),!0)},vO=t=>{let e=t.state.field(Bt,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},wO=[{key:"Mod-Shift-m",run:yO,preventDefault:!0},{key:"F8",run:vO}],Hs=Y.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Rn(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:hm,tooltipFilter:hm,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function hm(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Cy(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function jy(t,e,n){var r;let i=n?Cy(e.actions):[];return Me("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Me("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=Ci(t.state.field(Bt).diagnostics,e);g&&s.apply(t,g.from,g.to)},{name:c}=s,h=i[o]?c.indexOf(i[o]):-1,u=h<0?c:[c.slice(0,h),Me("u",c.slice(h,h+1)),c.slice(h+1)],f=s.markClass?" "+s.markClass:"";return Me("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${i[o]})"`}.`},u)}),e.source&&Me("div",{class:"cm-diagnosticSource"},e.source))}class SO extends Ln{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Me("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class um{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=jy(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Vs{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)dm(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Cy(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=Ci(this.view.state.field(Bt).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=Me("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Me("div",{class:"cm-panel-lint"},this.list,Me("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>dm(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Bt).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Bt),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let h of c.diagnostics){if(o.has(h))continue;o.add(h);let u=-1,f;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==h){u=p;break}u<0?(f=new um(this.view,h),this.items.splice(r,0,f),i=!0):(f=this.items[u],u>r&&(this.items.splice(r,u-r),i=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new um(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Bt),r=Ci(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:ky.of(r)})}static open(e){return new Vs(e)}}function kO(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Ta(t){return kO(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const CO=_.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ta("#d11")},".cm-lintRange-warning":{backgroundImage:Ta("orange")},".cm-lintRange-info":{backgroundImage:Ta("#999")},".cm-lintRange-hint":{backgroundImage:Ta("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function jO(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function OO(t){let e="hint",n=1;for(let r of t){let i=jO(r.severity);i>n&&(n=i,e=r.severity)}return e}const PO=[Bt,_.decorations.compute([Bt],t=>{let{selected:e,panel:n}=t.field(Bt);return!e||!n||e.from==e.to?ie.none:ie.set([gO.range(e.from,e.to)])}),M3(bO,{hideOn:pO}),CO];var fm=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(sO)),e.defaultKeymap!==!1&&(r=r.concat(X5)),e.searchKeymap!==!1&&(r=r.concat(Cj)),e.historyKeymap!==!1&&(r=r.concat(s5)),e.foldKeymap!==!1&&(r=r.concat(g4)),e.completionKeymap!==!1&&(r=r.concat(wy)),e.lintKeymap!==!1&&(r=r.concat(wO));var i=[];return e.lineNumbers!==!1&&i.push(V3()),e.highlightActiveLineGutter!==!1&&i.push(U3()),e.highlightSpecialChars!==!1&&i.push(o3()),e.history!==!1&&i.push(J4()),e.foldGutter!==!1&&i.push(v4()),e.drawSelection!==!1&&i.push(YC()),e.dropCursor!==!1&&i.push(e3()),e.allowMultipleSelections!==!1&&i.push(Se.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(o4()),e.syntaxHighlighting!==!1&&i.push(fu(C4,{fallback:!0})),e.bracketMatching!==!1&&i.push(M4()),e.closeBrackets!==!1&&i.push(tO()),e.autocompletion!==!1&&i.push(uO()),e.rectangularSelection!==!1&&i.push(v3()),n!==!1&&i.push(k3()),e.highlightActiveLine!==!1&&i.push(u3()),e.highlightSelectionMatches!==!1&&i.push(sj()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Jl.of(" ".repeat(e.tabSize))),i.concat([ql.of(r.flat())]).filter(Boolean)};const NO="#e5c07b",pm="#e06c75",DO="#56b6c2",AO="#ffffff",Za="#abb2bf",jh="#7d8799",MO="#61afef",TO="#98c379",mm="#d19a66",EO="#c678dd",RO="#21252b",gm="#2c313a",bm="#282c34",Jc="#353a42",LO="#3E4451",xm="#528bff",IO=_.theme({"&":{color:Za,backgroundColor:bm},".cm-content":{caretColor:xm},".cm-cursor, .cm-dropCursor":{borderLeftColor:xm},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:LO},".cm-panels":{backgroundColor:RO,color:Za},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:bm,color:jh,border:"none"},".cm-activeLineGutter":{backgroundColor:gm},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Jc},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Jc,borderBottomColor:Jc},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gm,color:Za}}},{dark:!0}),$O=Pi.define([{tag:E.keyword,color:EO},{tag:[E.name,E.deleted,E.character,E.propertyName,E.macroName],color:pm},{tag:[E.function(E.variableName),E.labelName],color:MO},{tag:[E.color,E.constant(E.name),E.standard(E.name)],color:mm},{tag:[E.definition(E.name),E.separator],color:Za},{tag:[E.typeName,E.className,E.number,E.changed,E.annotation,E.modifier,E.self,E.namespace],color:NO},{tag:[E.operator,E.operatorKeyword,E.url,E.escape,E.regexp,E.link,E.special(E.string)],color:DO},{tag:[E.meta,E.comment],color:jh},{tag:E.strong,fontWeight:"bold"},{tag:E.emphasis,fontStyle:"italic"},{tag:E.strikethrough,textDecoration:"line-through"},{tag:E.link,color:jh,textDecoration:"underline"},{tag:E.heading,fontWeight:"bold",color:pm},{tag:[E.atom,E.bool,E.special(E.variableName)],color:mm},{tag:[E.processingInstruction,E.string,E.inserted],color:TO},{tag:E.invalid,color:AO}]),BO=[IO,fu($O)];var FO=_.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),zO=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(ql.of([Z5])),a&&(typeof a=="boolean"?l.unshift(fm()):l.unshift(fm(a))),o&&l.unshift(g3(o)),s){case"light":l.push(FO);break;case"dark":l.push(BO);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(_.editable.of(!1)),i&&l.push(Se.readOnly.of(!0)),[...l]},HO=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class VO{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class ym{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Qc=null,_O=()=>typeof window>"u"?new ym:(Qc||(Qc=new ym),Qc),vm=En.define(),WO=200,UO=[];function KO(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=UO,autoFocus:l,theme:c="light",height:h=null,minHeight:u=null,maxHeight:f=null,width:p=null,minWidth:g=null,maxWidth:b=null,placeholder:x="",editable:w=!0,readOnly:v=!1,indentWithTab:k=!0,basicSetup:j=!0,root:S,initialState:C}=t,[y,N]=m.useState(),[A,T]=m.useState(),[P,R]=m.useState(),z=m.useState(()=>({current:null}))[0],I=m.useState(()=>({current:null}))[0],F=_.theme({"&":{height:h,minHeight:u,maxHeight:f,width:p,minWidth:g,maxWidth:b},"& .cm-scroller":{height:"100% !important"}}),G=_.updateListener.of(Q=>{if(Q.docChanged&&typeof r=="function"&&!Q.transactions.some(W=>W.annotation(vm))){z.current?z.current.reset():(z.current=new VO(()=>{if(I.current){var W=I.current;I.current=null,W()}z.current=null},WO),_O().add(z.current));var le=Q.state.doc,fe=le.toString();r(fe,Q)}i&&i(HO(Q))}),ae=zO({theme:c,editable:w,readOnly:v,placeholder:x,indentWithTab:k,basicSetup:j}),X=[G,F,...ae];return o&&typeof o=="function"&&X.push(_.updateListener.of(o)),X=X.concat(a),m.useLayoutEffect(()=>{if(y&&!P){var Q={doc:e,selection:n,extensions:X},le=C?Se.fromJSON(C.json,Q,C.fields):Se.create(Q);if(R(le),!A){var fe=new _({state:le,parent:y,root:S});T(fe),s&&s(fe,le)}}return()=>{A&&(R(void 0),T(void 0))}},[y,P]),m.useEffect(()=>{t.container&&N(t.container)},[t.container]),m.useEffect(()=>()=>{A&&(A.destroy(),T(void 0)),z.current&&(z.current.cancel(),z.current=null)},[A]),m.useEffect(()=>{l&&A&&A.focus()},[l,A]),m.useEffect(()=>{A&&A.dispatch({effects:me.reconfigure.of(X)})},[c,a,h,u,f,p,g,b,x,w,v,k,j,r,o]),m.useEffect(()=>{if(e!==void 0){var Q=A?A.state.doc.toString():"";if(A&&e!==Q){var le=z.current&&!z.current.isDone,fe=()=>{A&&e!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:e||""},annotations:[vm.of(!0)]})};le?I.current=fe:fe()}}},[e,A]),{state:P,setState:R,view:A,setView:T,container:y,setContainer:N}}var GO=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Oy=m.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:h,theme:u="light",height:f,minHeight:p,maxHeight:g,width:b,minWidth:x,maxWidth:w,basicSetup:v,placeholder:k,indentWithTab:j,editable:S,readOnly:C,root:y,initialState:N}=t,A=z4(t,GO),T=m.useRef(null),{state:P,view:R,container:z,setContainer:I}=KO({root:y,value:r,autoFocus:h,theme:u,height:f,minHeight:p,maxHeight:g,width:b,minWidth:x,maxWidth:w,basicSetup:v,placeholder:k,indentWithTab:j,editable:S,readOnly:C,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:N});m.useImperativeHandle(e,()=>({editor:T.current,state:P,view:R}),[T,z,P,R]);var F=m.useCallback(ae=>{T.current=ae,I(ae)},[I]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var G=typeof u=="string"?"cm-theme-"+u:"cm-theme";return d.jsx("div",xh({ref:F,className:""+G+(n?" "+n:"")},A))});Oy.displayName="CodeMirror";const qO=()=>{const t=_.theme({"&":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text)",height:"100%"},".cm-editor":{height:"100% !important"},".cm-content":{caretColor:"var(--dash-accent)",fontFamily:"'JetBrains Mono', Menlo, monospace",padding:"1rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--dash-accent)"},"& ::selection":{backgroundColor:"var(--dash-accent-selection) !important",color:"inherit !important"},".cm-gutters":{backgroundColor:"var(--dash-surface)",color:"var(--dash-text-muted)",border:"none",borderRight:"1px solid var(--dash-border)",paddingRight:"0.5rem"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 1rem",minWidth:"3rem"},".cm-activeLineGutter":{backgroundColor:"var(--dash-accent-subtle)",color:"var(--dash-accent)",fontWeight:"600"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--dash-accent) 8%, transparent)"},".cm-matchingBracket":{backgroundColor:"var(--dash-accent-subtle)",outline:"1px solid var(--dash-accent)"},".cm-scroller":{overflow:"auto !important",height:"100%",maxHeight:"100%"}}),e=Pi.define([{tag:E.propertyName,color:"var(--dash-accent)"},{tag:E.string,color:"color-mix(in srgb, var(--dash-accent) 70%, var(--dash-text))"},{tag:E.number,color:"var(--dash-accent-hover)"},{tag:E.bool,color:"var(--dash-accent-hover)"},{tag:E.null,color:"var(--dash-text-muted)"},{tag:E.punctuation,color:"var(--dash-text-secondary)"},{tag:E.brace,color:"var(--dash-text-secondary)"},{tag:E.bracket,color:"var(--dash-text-secondary)"}]);return[t,fu(e)]},YO=({value:t,onChange:e,onCursorLineChange:n,onEditorFocus:r,height:i="100%",readOnly:s=!1,className:o})=>{const a=m.useMemo(()=>[F4(),_.lineWrapping,...qO()],[]),l=m.useMemo(()=>{if(n)return c=>{const h=c.state.selection.main.head,u=c.view.state.doc.lineAt(h).number-1;n(u)}},[n]);return d.jsx("div",{className:`h-full [&_.cm-editor]:h-full [&_.cm-editor]:outline-none [&_.cm-focused]:outline-none ${o??""}`.trim(),children:d.jsx(Oy,{value:t,height:i,extensions:a,onChange:e,onFocus:r,onUpdate:l,theme:"none",readOnly:s,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!1,dropCursor:!0,drawSelection:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!1,rectangularSelection:!1,crosshairCursor:!1,highlightSelectionMatches:!0}})})},ju=({width:t,isLoading:e,jsonText:n,cursorLine:r,syntaxError:i,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l=!1,headerTitle:c,headerPath:h,headerActions:u})=>{const{t:f}=he(),p=g=>{if(l||!g.target.closest(".cm-editor"))return;const x=g.currentTarget;x.scrollHeight<=x.clientHeight||(x.scrollTop+=g.deltaY)};return d.jsxs("div",{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",{className:"p-3 border-b border-dash-border bg-dash-surface-hover/50 shrink-0",children:d.jsxs("div",{className:"flex items-end justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-xs font-bold text-dash-text-secondary uppercase tracking-widest",children:c??f("jsonTab")}),h&&d.jsx("p",{className:"mt-1 mono text-[11px] text-dash-text-muted truncate",children:h})]}),u&&d.jsx("div",{className:"flex items-center gap-2 shrink-0",children:u})]})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",onWheelCapture:p,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:f("loading")})}):l?d.jsx("pre",{className:"h-full overflow-auto p-4 font-mono text-xs leading-4 text-dash-text whitespace-pre m-0",children:n}):d.jsx(YO,{value:n,onChange:s,onEditorFocus:o,onCursorLineChange:a,readOnly:l,className:"[&_.cm-content]:text-xs [&_.cm-content]:leading-4 [&_.cm-gutters]:text-xs [&_.cm-gutters]:leading-4"})}),d.jsxs("div",{className:"px-4 py-2 bg-dash-surface-hover/30 border-t border-dash-border text-[10px] text-dash-text-muted flex justify-between uppercase tracking-widest font-bold",children:[d.jsxs("div",{className:"flex gap-4",children:[d.jsx("span",{children:"UTF-8"}),d.jsx("span",{children:"JSON"}),d.jsxs("span",{children:["L:",r+1]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[l&&d.jsx("span",{children:f("readOnly")}),i?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),d.jsx("span",{className:"text-red-500 normal-case",children:i})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),f("syntaxValid")]})]})]})]})},wm=({label:t,value:e})=>d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-dash-bg border border-dash-border rounded-md",children:[d.jsxs("span",{className:"text-[9px] font-bold text-dash-text-muted uppercase",children:[t,":"]}),d.jsx("span",{className:"text-[10px] mono font-bold text-dash-text-secondary",children:e})]}),Py=({width:t,fieldDoc:e,activeFieldPath:n,extraContent:r,overrideBadge:i})=>{const{t:s,lang:o}=he(),a=e??(n?D0[n]??{path:n,type:"unknown",default:"n/a",description:"Help is being resolved for this field. Try editing the value or switching to the JSON view for schema-based details.",descriptionVi:"Đang tải trợ giúp cho trường này. Hãy thử chỉnh sửa giá trị hoặc chuyển sang chế độ JSON để xem mô tả suy ra từ schema."}:null);return d.jsxs("div",{style:{width:`${t}%`},className:"bg-dash-surface border border-dash-border rounded-xl flex flex-col shadow-sm overflow-hidden min-w-0",children:[d.jsx("div",{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:s("configurationHelp")})}),d.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a?d.jsxs("div",{className:"space-y-5 animate-in fade-in duration-500",children:[d.jsxs("header",{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[d.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded font-mono uppercase font-bold",children:s("field")}),d.jsx("h2",{className:"text-base font-bold text-dash-text mono break-all",children:a.path}),i]}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[d.jsx(wm,{label:s("type"),value:a.type}),d.jsx(wm,{label:s("default"),value:a.default})]})]}),d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("description")}),d.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed italic",children:o==="vi"?a.descriptionVi:a.description})]}),a.validValues&&d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("validValues")}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.validValues.map(l=>d.jsx("span",{className:"px-2 py-0.5 bg-dash-bg border border-dash-border rounded text-[11px] mono text-dash-text",children:l},l))})]}),a.effect&&d.jsxs("section",{className:"bg-dash-accent-subtle/30 p-3 rounded-lg border border-dash-accent/10",children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-accent uppercase tracking-widest mb-1",children:s("systemEffect")}),d.jsx("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:o==="vi"&&a.effectVi?a.effectVi:a.effect})]}),a.example&&d.jsxs("section",{children:[d.jsx("h4",{className:"text-[10px] font-bold text-dash-text-muted uppercase tracking-widest mb-2",children:s("exampleUsage")}),d.jsx("div",{className:"bg-dash-bg p-3 rounded-lg border border-dash-border overflow-hidden",children:d.jsx("pre",{className:"text-[11px] mono text-dash-text-secondary whitespace-pre overflow-x-auto",children:a.example})})]}),r]}):d.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center opacity-40 space-y-4",children:[d.jsx("div",{className:"w-10 h-10 rounded-full bg-dash-bg border border-dash-border flex items-center justify-center text-lg",children:"?"}),d.jsxs("div",{className:"max-w-[180px]",children:[d.jsx("p",{className:"text-sm font-bold text-dash-text mb-1 italic",children:s("knowledgeBase")}),d.jsx("p",{className:"text-xs text-dash-text-secondary",children:s("clickToSeeHelp")})]})]})}),a&&d.jsx("div",{className:"p-3 bg-dash-surface-hover/20 border-t border-dash-border shrink-0",children:d.jsxs("p",{className:"text-[10px] text-dash-text-muted font-medium flex items-center gap-1.5 italic",children:[d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),s("extractedFrom")]})})]})},JO=({variant:t="development"})=>{const{t:e}=he(),n={development:e("developmentFeature"),beta:e("betaFeature"),experimental:e("experimentalFeature")};return d.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-2 py-0.5 rounded-full font-bold border border-orange-500/30 uppercase tracking-wider",children:n[t]})},Sm={codex:{heavy:{model:"gpt-5.4",effort:"xhigh"},balanced:{model:"gpt-5.4",effort:"high"},light:{model:"gpt-5.4-mini",effort:"medium"}},"gemini-cli":{heavy:{model:"gemini-3.1-pro-preview"},balanced:{model:"gemini-3.1-pro-preview"},light:{model:"gemini-3-flash-preview"}}},QO={codex:"Codex","gemini-cli":"Gemini CLI"},km=["heavy","balanced","light"];function Cm(t,e){return e.split(".").reduce((n,r)=>{if(n!=null&&typeof n=="object"&&r in n)return n[r]},t)}const jm="bg-transparent border border-dash-border rounded px-2 py-1 text-sm text-dash-text placeholder:text-dash-text-muted focus:border-dash-accent focus:outline-none w-full",XO=({config:t,onChange:e,isCollapsed:n,onCollapsedChange:r})=>{const{t:i}=he(),[s,o]=m.useState(!1),a=n??s,l=f=>{r?.(f),n===void 0&&o(f)},c=(f,p,g,b)=>{const x=`modelTaxonomy.${f}.${p}.${g}`;e(x,b===""?void 0:b)},h=f=>{for(const p of km)e(`modelTaxonomy.${f}.${p}.model`,void 0),Sm[f]?.[p]?.effort!==void 0&&e(`modelTaxonomy.${f}.${p}.effort`,void 0)},u=f=>i(f==="heavy"?"taxonomyTierHeavy":f==="balanced"?"taxonomyTierBalanced":"taxonomyTierLight");return d.jsxs("div",{"data-model-taxonomy":!0,className:`bg-dash-surface border border-dash-border rounded-lg overflow-hidden ${a?"shrink-0":"h-full min-h-0 flex flex-col"}`,children:[d.jsxs("button",{type:"button",onClick:()=>l(!a),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":!a,"aria-controls":"section-model-taxonomy",children:[d.jsx("h3",{className:"text-sm font-bold text-dash-text uppercase tracking-wider",children:i("sectionModelTaxonomy")}),d.jsx("svg",{className:`w-4 h-4 text-dash-text-muted transition-transform duration-200 ${a?"":"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"})})]}),!a&&d.jsx("div",{id:"section-model-taxonomy","data-model-taxonomy-content":!0,className:"flex-1 min-h-0 overflow-y-auto",children:d.jsxs("div",{className:"px-4 py-3 space-y-4 h-full",children:[d.jsx("p",{className:"text-xs text-dash-text-secondary",children:i("taxonomyDescription")}),Object.entries(Sm).map(([f,p])=>{const g=Object.values(p).some(b=>b.effort!==void 0);return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs font-semibold text-dash-text uppercase tracking-wider",children:QO[f]??f}),d.jsx("button",{type:"button",onClick:()=>h(f),className:"text-xs text-dash-text-muted hover:text-dash-text px-2 py-0.5 rounded border border-dash-border hover:border-dash-accent transition-colors",children:i("taxonomyResetProvider")})]}),d.jsx("div",{className:"overflow-hidden rounded border border-dash-border",children:d.jsxs("table",{className:"w-full text-xs",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-dash-surface-hover/40 border-b border-dash-border",children:[d.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyTier")}),d.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium",children:i("taxonomyModel")}),g&&d.jsx("th",{className:"text-left px-3 py-2 text-dash-text-secondary font-medium w-1/4",children:i("taxonomyEffort")})]})}),d.jsx("tbody",{children:km.map(b=>{const x=p[b],w=Cm(t,`modelTaxonomy.${f}.${b}.model`),v=Cm(t,`modelTaxonomy.${f}.${b}.effort`);return d.jsxs("tr",{className:"border-b border-dash-border last:border-0",children:[d.jsx("td",{className:"px-3 py-2 text-dash-text-secondary",children:u(b)}),d.jsx("td",{className:"px-3 py-2",children:d.jsx("input",{type:"text",className:jm,placeholder:x?.model??"",value:w??"",onChange:k=>c(f,b,"model",k.target.value)})}),g&&d.jsx("td",{className:"px-3 py-2",children:x?.effort!==void 0?d.jsx("input",{type:"text",className:jm,placeholder:x.effort,value:v??"",onChange:k=>c(f,b,"effort",k.target.value)}):null})]},b)})})]})})]},f)})]})})]})},ZO=({components:t,isChecking:e,isUpdating:n,onCheckAll:r,onUpdateAll:i,className:s})=>{const{t:o}=he(),a=t.filter(h=>h.status==="update-available").length,l=t.length>0&&t.every(h=>h.status==="up-to-date"||h.status==="idle"),c=t.filter(h=>h.status==="up-to-date").length;return d.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${s??""}`,children:[d.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-dash-border bg-dash-surface px-3 py-2 text-xs",children:[d.jsx("output",{className:"inline-flex items-center gap-2","aria-live":"polite","aria-atomic":"true",children:e?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),d.jsx("span",{className:"text-dash-text-secondary",children:o("checkingAll")})]}):a>0?d.jsx("span",{className:"text-amber-500 font-semibold",children:o("updatesAvailable").replace("{count}",a.toString())}):l?d.jsx("span",{className:"text-emerald-500 font-semibold",children:o("allUpToDate")}):d.jsx("span",{className:"text-dash-text-secondary font-medium",children:o("readyToScan")})}),c>0&&d.jsx("span",{className:"mono text-dash-text-muted border-l border-dash-border pl-2",children:c})]}),d.jsx("button",{type:"button",onClick:r,disabled:e||n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold border border-dash-border bg-dash-surface text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("checkAll")}),a>0&&d.jsx("button",{type:"button",onClick:i,disabled:n,className:"dash-focus-ring px-3 py-2 rounded-lg text-xs font-semibold bg-dash-accent text-dash-bg hover:bg-dash-accent-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o("updateAll")})]})},eP=({value:t,onChange:e,disabled:n=!1})=>{const{t:r}=he();return d.jsxs("fieldset",{className:"inline-flex items-center rounded-xl border border-dash-border bg-dash-surface p-1 gap-1",role:"radiogroup","aria-label":"Update channel",children:[d.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="stable"?"bg-dash-accent-subtle text-dash-accent":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("input",{type:"radio",name:"channel",value:"stable",checked:t==="stable",onChange:()=>e("stable"),disabled:n,className:"sr-only"}),r("channelStable")]}),d.jsxs("label",{className:`dash-focus-ring px-3.5 py-2 text-xs font-semibold rounded-lg transition-colors cursor-pointer ${t==="beta"?"bg-amber-500/15 text-amber-500":"text-dash-text-secondary hover:text-dash-text hover:bg-dash-surface-hover"} ${n?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("input",{type:"radio",name:"channel",value:"beta",checked:t==="beta",onChange:()=>e("beta"),disabled:n,className:"sr-only"}),r("channelBeta")]})]})},tP={idle:{color:"bg-dash-text-muted",pulse:!1},checking:{color:"bg-dash-text-muted",pulse:!0},"up-to-date":{color:"bg-emerald-500",pulse:!1},"update-available":{color:"bg-amber-500",pulse:!1}},Ny=({status:t,ariaLabel:e,size:n="sm"})=>{const r=tP[t],i=n==="sm"?"w-2 h-2":"w-2.5 h-2.5";return d.jsx("span",{className:`
|
|
236
|
-
inline-block rounded-full ${i} ${r.color}
|
|
237
|
-
${r.pulse?"animate-pulse motion-reduce:animate-none":""}
|
|
238
|
-
`,role:"status","aria-label":e})},Ou=({isOpen:t,onClose:e,target:n,kitName:r,targetVersion:i,onComplete:s,mode:o="single",components:a=[]})=>{const{t:l}=he(),[c,h]=m.useState("running"),[u,f]=m.useState([]),[p,g]=m.useState([]),[b,x]=m.useState(!1),[w,v]=m.useState(0),k=m.useRef(null),j=m.useRef(null);m.useEffect(()=>{b&&j.current&&j.current.scrollIntoView({behavior:"smooth"})},[b]);const S=m.useCallback(async()=>{if(a.length===0){h("success");return}for(let y=0;y<a.length;y++){v(y);const N=a[y];try{const A=N.id==="cli",T=new URLSearchParams({target:A?"cli":"kit"});A||T.set("kit",N.id);const P=new EventSource(`/api/system/update?${T}`);k.current=P,await new Promise((R,z)=>{P.onmessage=I=>{try{const F=JSON.parse(I.data);F.type==="phase"&&F.name&&f(G=>[...G,`[${N.name}] ${F.name}`]),F.type==="output"&&F.text&&g(G=>[...G,F.text]),F.type==="error"&&(h("error"),g(G=>[...G,`[ERROR ${N.name}] ${F.message||"Unknown error"}`]),P.close(),z()),F.type==="complete"&&(F.code===0?(P.close(),R()):(h("error"),P.close(),z()))}catch(F){console.error("Failed to parse SSE message:",F),P.close(),z(F)}},P.onerror=()=>{h("error"),g(I=>[...I,`[ERROR ${N.name}] Connection lost`]),P.close(),z()}})}catch(A){console.error(`Failed to update ${N.name}:`,A)}}h("success"),s()},[a,s]);m.useEffect(()=>{if(t)if(o==="batch")S();else{const y=new URLSearchParams({target:n});r&&y.set("kit",r),i&&y.set("version",i);const N=new EventSource(`/api/system/update?${y}`);return k.current=N,N.onmessage=A=>{try{const T=JSON.parse(A.data);T.type==="phase"&&T.name&&f(P=>[...P,T.name]),T.type==="output"&&T.text&&g(P=>[...P,T.text]),T.type==="error"&&(h("error"),g(P=>[...P,`[ERROR] ${T.message||"Unknown error"}`])),T.type==="complete"&&(h(T.code===0?"success":"error"),N.close(),T.code===0&&s())}catch(T){console.error("Failed to parse SSE message:",T)}},N.onerror=()=>{h("error"),g(A=>[...A,"[ERROR] Connection lost"]),N.close()},()=>{N.close()}}},[t,n,r,i,s,o,S]);const C=()=>{c!=="running"&&(h("running"),f([]),g([]),x(!1),v(0),e())};return t?d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-lg shadow-lg w-full max-w-2xl max-h-[80vh] flex flex-col",children:[d.jsx("div",{className:"px-6 py-4 border-b border-dash-border",children:d.jsx("h2",{className:"text-lg font-bold text-dash-text",children:l(c==="running"?"updating":c==="success"?"updateSuccess":"updateFailed")})}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[o==="batch"&&a.length>0&&d.jsxs("div",{className:"text-sm text-dash-text-secondary",children:[c==="running"&&d.jsxs("span",{children:["Updating ",w+1," of ",a.length,":"," ",a[w]?.name]}),c==="success"&&d.jsxs("span",{className:"text-emerald-500",children:["All ",a.length," components updated"]})]}),u.length>0&&d.jsx("div",{className:"space-y-2",children:u.map((y,N)=>d.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-secondary",children:[d.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-dash-accent"}),d.jsx("span",{children:y})]},`${y}-${N}`))}),c==="running"&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-dash-text-muted",children:[d.jsx("span",{className:"w-4 h-4 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),d.jsx("span",{children:l("updating")})]}),p.length>0&&d.jsxs("div",{children:[d.jsx("button",{type:"button",onClick:()=>x(!b),className:"text-xs text-dash-accent hover:text-dash-accent-hover transition-colors",children:l(b?"hideDetails":"showDetails")}),b&&d.jsxs("div",{className:"mt-2 bg-dash-bg border border-dash-border rounded p-3 max-h-64 overflow-y-auto",children:[d.jsx("pre",{className:"text-xs mono text-dash-text whitespace-pre-wrap",children:p.join(`
|
|
239
|
-
`)}),d.jsx("div",{ref:j})]})]})]}),d.jsx("div",{className:"px-6 py-4 border-t border-dash-border flex justify-end",children:d.jsx("button",{type:"button",onClick:C,disabled:c==="running",className:`px-4 py-2 rounded text-sm font-medium transition-colors ${c==="running"?"bg-dash-bg text-dash-text-muted cursor-not-allowed":"bg-dash-accent text-white hover:bg-dash-accent-hover"}`,children:l("closeModal")})})]})}):null},Dy=({target:t,kitName:e,currentVersion:n,latestVersion:r,onVersionSelect:i})=>{const{t:s}=he(),[o,a]=m.useState([]),[l,c]=m.useState(!1),[h,u]=m.useState(r);m.useEffect(()=>{(async()=>{c(!0);try{const g=new URLSearchParams({target:t});e&&g.set("kit",e);const x=await(await fetch(`/api/system/versions?${g}`)).json();x.versions&&a(x.versions)}catch(g){console.error("Failed to fetch versions:",g)}finally{c(!1)}})()},[t,e]);const f=p=>{u(p),i(p)};return l?d.jsxs("span",{className:"text-xs text-dash-text-muted flex items-center gap-1.5",children:[d.jsx("span",{className:"w-3 h-3 border-2 border-dash-text-muted border-t-transparent rounded-full animate-spin"}),s("loadingVersions")]}):d.jsx("select",{value:h,onChange:p=>f(p.target.value),className:`text-xs text-amber-500 hover:text-amber-600 font-medium transition-colors
|
|
240
|
-
bg-transparent border border-amber-500/30 rounded px-2 py-1
|
|
241
|
-
focus:outline-none focus:ring-2 focus:ring-amber-500/50
|
|
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(`
|
|
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(`
|
|
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:`
|
|
245
|
-
To pick up a draggable item, press the space bar.
|
|
246
|
-
While dragging, use the arrow keys to move the item.
|
|
247
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
248
|
-
`},y6={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function v6(t){let{announcements:e=y6,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=x6}=t;const{announce:s,announcement:o}=m6(),a=_o("DndLiveRegion"),[l,c]=m.useState(!1);if(m.useEffect(()=>{c(!0)},[]),g6(m.useMemo(()=>({onDragStart(u){let{active:f}=u;s(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&s(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;s(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;s(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;s(e.onDragCancel({active:f,over:p}))}}),[s,e])),!l)return null;const h=Le.createElement(Le.Fragment,null,Le.createElement(f6,{id:r,value:i.draggable}),Le.createElement(p6,{id:a,announcement:o}));return n?Dr.createPortal(h,n):h}var qe;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(qe||(qe={}));function Tl(){}function Bm(t,e){return m.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function w6(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const cn=Object.freeze({x:0,y:0});function Fy(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function S6(t,e){const n=Ml(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function zy(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function k6(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Fm(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function Hy(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function zm(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const C6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=zm(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=Fy(zm(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(zy)},j6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=Fm(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=Fm(l),h=i.reduce((f,p,g)=>f+Fy(c[g],p),0),u=Number((h/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:u}})}}return s.sort(zy)};function O6(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=i-r,a=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,h=o*a,u=h/(l+c-h);return Number(u.toFixed(4))}return 0}const P6=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:o}=s,a=n.get(o);if(a){const l=O6(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(k6)};function N6(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function Vy(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:cn}function D6(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const A6=D6(1);function _y(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function M6(t,e,n){const r=_y(e);if(!r)return t;const{scaleX:i,scaleY:s,x:o,y:a}=r,l=t.left-o-(1-i)*parseFloat(n),c=t.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),h=i?t.width/i:t.width,u=s?t.height/s:t.height;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l}}const T6={ignoreTransform:!1};function Ti(t,e){e===void 0&&(e=T6);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:h}=kt(t).getComputedStyle(t);c&&(n=M6(n,c,h))}const{top:r,left:i,width:s,height:o,bottom:a,right:l}=n;return{top:r,left:i,width:s,height:o,bottom:a,right:l}}function Hm(t){return Ti(t,{ignoreTransform:!0})}function E6(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function R6(t,e){return e===void 0&&(e=kt(t).getComputedStyle(t)),e.position==="fixed"}function L6(t,e){e===void 0&&(e=kt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=e[i];return typeof s=="string"?n.test(s):!1})}function ac(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(Nu(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ho(i)||Iy(i)||n.includes(i))return n;const s=kt(t).getComputedStyle(i);return i!==t&&L6(i,s)&&n.push(i),R6(i,s)?n:r(i.parentNode)}return t?r(t):n}function Wy(t){const[e]=ac(t,1);return e??null}function nd(t){return!ic||!t?null:Ai(t)?t:Pu(t)?Nu(t)||t===Mi(t).scrollingElement?window:Ho(t)?t:null:null}function Uy(t){return Ai(t)?t.scrollX:t.scrollLeft}function Ky(t){return Ai(t)?t.scrollY:t.scrollTop}function Nh(t){return{x:Uy(t),y:Ky(t)}}var et;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(et||(et={}));function Gy(t){return!ic||!t?!1:t===document.scrollingElement}function qy(t){const e={x:0,y:0},n=Gy(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const I6={x:.2,y:.2};function $6(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=I6);const{isTop:c,isBottom:h,isLeft:u,isRight:f}=qy(t),p={x:0,y:0},g={x:0,y:0},b={height:e.height*i.y,width:e.width*i.x};return!c&&s<=e.top+b.height?(p.y=et.Backward,g.y=r*Math.abs((e.top+b.height-s)/b.height)):!h&&l>=e.bottom-b.height&&(p.y=et.Forward,g.y=r*Math.abs((e.bottom-b.height-l)/b.height)),!f&&a>=e.right-b.width?(p.x=et.Forward,g.x=r*Math.abs((e.right-b.width-a)/b.width)):!u&&o<=e.left+b.width&&(p.x=et.Backward,g.x=r*Math.abs((e.left+b.width-o)/b.width)),{direction:p,speed:g}}function B6(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function Yy(t){return t.reduce((e,n)=>gi(e,Nh(n)),cn)}function F6(t){return t.reduce((e,n)=>e+Uy(n),0)}function z6(t){return t.reduce((e,n)=>e+Ky(n),0)}function Jy(t,e){if(e===void 0&&(e=Ti),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);Wy(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const H6=[["x",["left","right"],F6],["y",["top","bottom"],z6]];class Du{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ac(n),i=Yy(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of H6)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),h=i[s]-c;return this.rect[l]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class bs{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function V6(t){const{EventTarget:e}=kt(t);return t instanceof e?t:Mi(t)}function rd(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Ut;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Ut||(Ut={}));function Vm(t){t.preventDefault()}function _6(t){t.stopPropagation()}var we;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(we||(we={}));const Qy={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},W6=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case we.Right:return{...n,x:n.x+25};case we.Left:return{...n,x:n.x-25};case we.Down:return{...n,y:n.y+25};case we.Up:return{...n,y:n.y-25}}};class Au{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new bs(Mi(n)),this.windowListeners=new bs(kt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Jy(r),n(cn)}handleKeyDown(e){if(oc(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=Qy,coordinateGetter:o=W6,scrollBehavior:a="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,h=c?{x:c.left,y:c.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=h);const u=o(e,{active:n,context:r.current,currentCoordinates:h});if(u){const f=Ws(u,h),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const b of g){const x=e.code,{isTop:w,isRight:v,isLeft:k,isBottom:j,maxScroll:S,minScroll:C}=qy(b),y=B6(b),N={x:Math.min(x===we.Right?y.right-y.width/2:y.right,Math.max(x===we.Right?y.left:y.left+y.width/2,u.x)),y:Math.min(x===we.Down?y.bottom-y.height/2:y.bottom,Math.max(x===we.Down?y.top:y.top+y.height/2,u.y))},A=x===we.Right&&!v||x===we.Left&&!k,T=x===we.Down&&!j||x===we.Up&&!w;if(A&&N.x!==u.x){const P=b.scrollLeft+f.x,R=x===we.Right&&P<=S.x||x===we.Left&&P>=C.x;if(R&&!f.y){b.scrollTo({left:P,behavior:a});return}R?p.x=b.scrollLeft-P:p.x=x===we.Right?b.scrollLeft-S.x:b.scrollLeft-C.x,p.x&&b.scrollBy({left:-p.x,behavior:a});break}else if(T&&N.y!==u.y){const P=b.scrollTop+f.y,R=x===we.Down&&P<=S.y||x===we.Up&&P>=C.y;if(R&&!f.x){b.scrollTo({top:P,behavior:a});return}R?p.y=b.scrollTop-P:p.y=x===we.Down?b.scrollTop-S.y:b.scrollTop-C.y,p.y&&b.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,gi(Ws(u,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Au.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=Qy,onActivation:i}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=s.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function _m(t){return!!(t&&"distance"in t)}function Wm(t){return!!(t&&"delay"in t)}class Mu{constructor(e,n,r){var i;r===void 0&&(r=V6(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:o}=s;this.props=e,this.events=n,this.document=Mi(o),this.documentListeners=new bs(this.document),this.listeners=new bs(r),this.windowListeners=new bs(kt(o)),this.initialCoordinates=(i=Ml(s))!=null?i:cn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,Vm),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,Vm),this.documentListeners.add(Ut.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Wm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(_m(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ut.Click,_6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!i)return;const l=(n=Ml(e))!=null?n:cn,c=Ws(i,l);if(!r&&a){if(_m(a)){if(a.tolerance!=null&&rd(c,a.tolerance))return this.handleCancel();if(rd(c,a.distance))return this.handleStart()}if(Wm(a)&&rd(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===we.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const U6={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Tu extends Mu{constructor(e){const{event:n}=e,r=Mi(n.target);super(e,U6,r)}}Tu.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const K6={move:{name:"mousemove"},end:{name:"mouseup"}};var Dh;(function(t){t[t.RightClick=2]="RightClick"})(Dh||(Dh={}));class G6 extends Mu{constructor(e){super(e,K6,Mi(e.event.target))}}G6.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Dh.RightClick?!1:(r?.({event:n}),!0)}}];const id={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class q6 extends Mu{constructor(e){super(e,id)}static setup(){return window.addEventListener(id.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(id.move.name,e)};function e(){}}}q6.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var xs;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(xs||(xs={}));var El;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(El||(El={}));function Y6(t){let{acceleration:e,activator:n=xs.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=El.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:h,delta:u,threshold:f}=t;const p=Q6({delta:u,disabled:!s}),[g,b]=l6(),x=m.useRef({x:0,y:0}),w=m.useRef({x:0,y:0}),v=m.useMemo(()=>{switch(n){case xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case xs.DraggableRect:return i}},[n,i,l]),k=m.useRef(null),j=m.useCallback(()=>{const C=k.current;if(!C)return;const y=x.current.x*w.current.x,N=x.current.y*w.current.y;C.scrollBy(y,N)},[]),S=m.useMemo(()=>a===El.TreeOrder?[...c].reverse():c,[a,c]);m.useEffect(()=>{if(!s||!c.length||!v){b();return}for(const C of S){if(r?.(C)===!1)continue;const y=c.indexOf(C),N=h[y];if(!N)continue;const{direction:A,speed:T}=$6(C,N,v,e,f);for(const P of["x","y"])p[P][A[P]]||(T[P]=0,A[P]=0);if(T.x>0||T.y>0){b(),k.current=C,g(j,o),x.current=T,w.current=A;return}}x.current={x:0,y:0},w.current={x:0,y:0},b()},[e,j,r,b,s,o,JSON.stringify(v),JSON.stringify(p),g,c,S,h,JSON.stringify(f)])}const J6={x:{[et.Backward]:!1,[et.Forward]:!1},y:{[et.Backward]:!1,[et.Forward]:!1}};function Q6(t){let{delta:e,disabled:n}=t;const r=Al(e);return Vo(i=>{if(n||!r||!i)return J6;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[et.Backward]:i.x[et.Backward]||s.x===-1,[et.Forward]:i.x[et.Forward]||s.x===1},y:{[et.Backward]:i.y[et.Backward]||s.y===-1,[et.Forward]:i.y[et.Forward]||s.y===1}}},[n,e,r])}function X6(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Vo(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function Z6(t,e){return m.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var Us;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Us||(Us={}));var Ah;(function(t){t.Optimized="optimized"})(Ah||(Ah={}));const Um=new Map;function e7(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=m.useState(null),{frequency:a,measure:l,strategy:c}=i,h=m.useRef(t),u=x(),f=_s(u),p=m.useCallback(function(w){w===void 0&&(w=[]),!f.current&&o(v=>v===null?w:v.concat(w.filter(k=>!v.includes(k))))},[f]),g=m.useRef(null),b=Vo(w=>{if(u&&!n)return Um;if(!w||w===Um||h.current!==t||s!=null){const v=new Map;for(let k of t){if(!k)continue;if(s&&s.length>0&&!s.includes(k.id)&&k.rect.current){v.set(k.id,k.rect.current);continue}const j=k.node.current,S=j?new Du(l(j),j):null;k.rect.current=S,S&&v.set(k.id,S)}return v}return w},[t,s,n,u,l]);return m.useEffect(()=>{h.current=t},[t]),m.useEffect(()=>{u||p()},[n,u]),m.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),m.useEffect(()=>{u||typeof a!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},a))},[a,u,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:s!=null};function x(){switch(c){case Us.Always:return!1;case Us.BeforeDragging:return n;default:return!n}}}function Eu(t,e){return Vo(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function t7(t,e){return Eu(t,e)}function n7(t){let{callback:e,disabled:n}=t;const r=sc(e),i=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return m.useEffect(()=>()=>i?.disconnect(),[i]),i}function lc(t){let{callback:e,disabled:n}=t;const r=sc(e),i=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return m.useEffect(()=>()=>i?.disconnect(),[i]),i}function r7(t){return new Du(Ti(t),t)}function Km(t,e,n){e===void 0&&(e=r7);const[r,i]=m.useState(null);function s(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const h=e(t);return JSON.stringify(l)===JSON.stringify(h)?l:h})}const o=n7({callback(l){if(t)for(const c of l){const{type:h,target:u}=c;if(h==="childList"&&u instanceof HTMLElement&&u.contains(t)){s();break}}}}),a=lc({callback:s});return ln(()=>{s(),t?(a?.observe(t),o?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),o?.disconnect())},[t]),r}function i7(t){const e=Eu(t);return Vy(t,e)}const Gm=[];function s7(t){const e=m.useRef(t),n=Vo(r=>t?r&&r!==Gm&&t&&e.current&&t.parentNode===e.current.parentNode?r:ac(t):Gm,[t]);return m.useEffect(()=>{e.current=t},[t]),n}function o7(t){const[e,n]=m.useState(null),r=m.useRef(t),i=m.useCallback(s=>{const o=nd(s.target);o&&n(a=>a?(a.set(o,Nh(o)),new Map(a)):null)},[]);return m.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=nd(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Nh(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(s)};function o(a){a.forEach(l=>{const c=nd(l);c?.removeEventListener("scroll",i)})}},[i,t]),m.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>gi(s,o),cn):Yy(t):cn,[t,e])}function qm(t,e){e===void 0&&(e=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},e),m.useEffect(()=>{const r=t!==cn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Ws(t,n.current):cn}function a7(t){m.useEffect(()=>{if(!ic)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function l7(t,e){return m.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function Xy(t){return m.useMemo(()=>t?E6(t):null,[t])}const Ym=[];function c7(t,e){e===void 0&&(e=Ti);const[n]=t,r=Xy(n?kt(n):null),[i,s]=m.useState(Ym);function o(){s(()=>t.length?t.map(l=>Gy(l)?r:new Du(e(l),l)):Ym)}const a=lc({callback:o});return ln(()=>{a?.disconnect(),o(),t.forEach(l=>a?.observe(l))},[t]),i}function Zy(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Ho(e)?e:t}function d7(t){let{measure:e}=t;const[n,r]=m.useState(null),i=m.useCallback(c=>{for(const{target:h}of c)if(Ho(h)){r(u=>{const f=e(h);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),s=lc({callback:i}),o=m.useCallback(c=>{const h=Zy(c);s?.disconnect(),h&&s?.observe(h),r(h?e(h):null)},[e,s]),[a,l]=Dl(o);return m.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const h7=[{sensor:Tu,options:{}},{sensor:Au,options:{}}],u7={current:{}},el={draggable:{measure:Hm},droppable:{measure:Hm,strategy:Us.WhileDragging,frequency:Ah.Optimized},dragOverlay:{measure:Ti}};class ys extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const f7={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ys,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:el,measureDroppableContainers:Tl,windowRect:null,measuringScheduled:!1},e1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tl,draggableNodes:new Map,over:null,measureDroppableContainers:Tl},Wo=m.createContext(e1),t1=m.createContext(f7);function p7(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ys}}}function m7(t,e){switch(e.type){case qe.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case qe.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case qe.DragEnd:case qe.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qe.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new ys(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case qe.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new ys(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case qe.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new ys(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function g7(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=m.useContext(Wo),s=Al(r),o=Al(n?.id);return m.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!oc(s)||document.activeElement===s.target)return;const a=i.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const h of[l.current,c.current]){if(!h)continue;const u=h6(h);if(u){u.focus();break}}})}},[r,e,i,o,s]),null}function n1(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function b7(t){return m.useMemo(()=>({draggable:{...el.draggable,...t?.draggable},droppable:{...el.droppable,...t?.droppable},dragOverlay:{...el.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function x7(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=m.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ln(()=>{if(!o&&!a||!e){s.current=!1;return}if(s.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const h=n(c),u=Vy(h,r);if(o||(u.x=0),a||(u.y=0),s.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=Wy(c);f&&f.scrollBy({top:u.y,left:u.x})}},[e,o,a,r,n])}const cc=m.createContext({...cn,scaleX:1,scaleY:1});var Jn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Jn||(Jn={}));const y7=m.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:h=h7,collisionDetection:u=P6,measuring:f,modifiers:p,...g}=e;const b=m.useReducer(m7,void 0,p7),[x,w]=b,[v,k]=b6(),[j,S]=m.useState(Jn.Uninitialized),C=j===Jn.Initialized,{draggable:{active:y,nodes:N,translate:A},droppable:{containers:T}}=x,P=y!=null?N.get(y):null,R=m.useRef({initial:null,translated:null}),z=m.useMemo(()=>{var We;return y!=null?{id:y,data:(We=P?.data)!=null?We:u7,rect:R}:null},[y,P]),I=m.useRef(null),[F,G]=m.useState(null),[ae,X]=m.useState(null),Q=_s(g,Object.values(g)),le=_o("DndDescribedBy",o),fe=m.useMemo(()=>T.getEnabled(),[T]),W=b7(f),{droppableRects:se,measureDroppableContainers:ue,measuringScheduled:xe}=e7(fe,{dragging:C,dependencies:[A.x,A.y],config:W.droppable}),Pe=X6(N,y),Qe=m.useMemo(()=>ae?Ml(ae):null,[ae]),U=na(),ve=t7(Pe,W.draggable.measure);x7({activeNode:y!=null?N.get(y):null,config:U.layoutShiftCompensation,initialRect:ve,measure:W.draggable.measure});const ee=Km(Pe,W.draggable.measure,ve),Ae=Km(Pe?Pe.parentElement:null),pe=m.useRef({activatorEvent:null,active:null,activeNode:Pe,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=T.getNodeFor((n=pe.current.over)==null?void 0:n.id),$=d7({measure:W.dragOverlay.measure}),K=(r=$.nodeRef.current)!=null?r:Pe,ce=C?(i=$.rect)!=null?i:ee:null,Ne=!!($.nodeRef.current&&$.rect),Tt=i7(Ne?null:ee),Un=Xy(K?kt(K):null),Ct=s7(C?_e??Pe:null),Wr=c7(Ct),Ur=n1(p,{transform:{x:A.x-Tt.x,y:A.y-Tt.y,scaleX:1,scaleY:1},activatorEvent:ae,active:z,activeNodeRect:ee,containerNodeRect:Ae,draggingNodeRect:ce,over:pe.current.over,overlayNodeRect:$.rect,scrollableAncestors:Ct,scrollableAncestorRects:Wr,windowRect:Un}),Qo=Qe?gi(Qe,A):null,fn=o7(Ct),yr=qm(fn),Xo=qm(fn,[ee]),pn=gi(Ur,yr),at=ce?A6(ce,Ur):null,mt=z&&at?u({active:z,collisionRect:at,droppableRects:se,droppableContainers:fe,pointerCoordinates:Qo}):null,Fi=Hy(mt,"id"),[mn,Kr]=m.useState(null),dc=Ne?Ur:gi(Ur,Xo),nn=N6(dc,(s=mn?.rect)!=null?s:null,ee),Gr=m.useRef(null),zi=m.useCallback((We,gt)=>{let{sensor:lt,options:gn}=gt;if(I.current==null)return;const bt=N.get(I.current);if(!bt)return;const Xe=We.nativeEvent,xt=new lt({active:I.current,activeNode:bt,event:Xe,options:gn,context:pe,onAbort(Ke){if(!N.get(Ke))return;const{onDragAbort:O}=Q.current,D={id:Ke};O?.(D),v({type:"onDragAbort",event:D})},onPending(Ke,bn,O,D){if(!N.get(Ke))return;const{onDragPending:B}=Q.current,H={id:Ke,constraint:bn,initialCoordinates:O,offset:D};B?.(H),v({type:"onDragPending",event:H})},onStart(Ke){const bn=I.current;if(bn==null)return;const O=N.get(bn);if(!O)return;const{onDragStart:D}=Q.current,M={activatorEvent:Xe,active:{id:bn,data:O.data,rect:R}};Dr.unstable_batchedUpdates(()=>{D?.(M),S(Jn.Initializing),w({type:qe.DragStart,initialCoordinates:Ke,active:bn}),v({type:"onDragStart",event:M}),G(Gr.current),X(Xe)})},onMove(Ke){w({type:qe.DragMove,coordinates:Ke})},onEnd:In(qe.DragEnd),onCancel:In(qe.DragCancel)});Gr.current=xt;function In(Ke){return async function(){const{active:O,collisions:D,over:M,scrollAdjustedTranslate:B}=pe.current;let H=null;if(O&&B){const{cancelDrop:Z}=Q.current;H={activatorEvent:Xe,active:O,collisions:D,delta:B,over:M},Ke===qe.DragEnd&&typeof Z=="function"&&await Promise.resolve(Z(H))&&(Ke=qe.DragCancel)}I.current=null,Dr.unstable_batchedUpdates(()=>{w({type:Ke}),S(Jn.Uninitialized),Kr(null),G(null),X(null),Gr.current=null;const Z=Ke===qe.DragEnd?"onDragEnd":"onDragCancel";if(H){const J=Q.current[Z];J?.(H),v({type:Z,event:H})}})}}},[N]),Zo=m.useCallback((We,gt)=>(lt,gn)=>{const bt=lt.nativeEvent,Xe=N.get(gn);if(I.current!==null||!Xe||bt.dndKit||bt.defaultPrevented)return;const xt={active:Xe};We(lt,gt.options,xt)===!0&&(bt.dndKit={capturedBy:gt.sensor},I.current=gn,zi(lt,gt))},[N,zi]),ea=Z6(h,Zo);a7(h),ln(()=>{ee&&j===Jn.Initializing&&S(Jn.Initialized)},[ee,j]),m.useEffect(()=>{const{onDragMove:We}=Q.current,{active:gt,activatorEvent:lt,collisions:gn,over:bt}=pe.current;if(!gt||!lt)return;const Xe={active:gt,activatorEvent:lt,collisions:gn,delta:{x:pn.x,y:pn.y},over:bt};Dr.unstable_batchedUpdates(()=>{We?.(Xe),v({type:"onDragMove",event:Xe})})},[pn.x,pn.y]),m.useEffect(()=>{const{active:We,activatorEvent:gt,collisions:lt,droppableContainers:gn,scrollAdjustedTranslate:bt}=pe.current;if(!We||I.current==null||!gt||!bt)return;const{onDragOver:Xe}=Q.current,xt=gn.get(Fi),In=xt&&xt.rect.current?{id:xt.id,rect:xt.rect.current,data:xt.data,disabled:xt.disabled}:null,Ke={active:We,activatorEvent:gt,collisions:lt,delta:{x:bt.x,y:bt.y},over:In};Dr.unstable_batchedUpdates(()=>{Kr(In),Xe?.(Ke),v({type:"onDragOver",event:Ke})})},[Fi]),ln(()=>{pe.current={activatorEvent:ae,active:z,activeNode:Pe,collisionRect:at,collisions:mt,droppableRects:se,draggableNodes:N,draggingNode:K,draggingNodeRect:ce,droppableContainers:T,over:mn,scrollableAncestors:Ct,scrollAdjustedTranslate:pn},R.current={initial:ce,translated:at}},[z,Pe,mt,at,N,K,ce,se,T,mn,Ct,pn]),Y6({...U,delta:A,draggingRect:at,pointerCoordinates:Qo,scrollableAncestors:Ct,scrollableAncestorRects:Wr});const ta=m.useMemo(()=>({active:z,activeNode:Pe,activeNodeRect:ee,activatorEvent:ae,collisions:mt,containerNodeRect:Ae,dragOverlay:$,draggableNodes:N,droppableContainers:T,droppableRects:se,over:mn,measureDroppableContainers:ue,scrollableAncestors:Ct,scrollableAncestorRects:Wr,measuringConfiguration:W,measuringScheduled:xe,windowRect:Un}),[z,Pe,ee,ae,mt,Ae,$,N,T,se,mn,ue,Ct,Wr,W,xe,Un]),qr=m.useMemo(()=>({activatorEvent:ae,activators:ea,active:z,activeNodeRect:ee,ariaDescribedById:{draggable:le},dispatch:w,draggableNodes:N,over:mn,measureDroppableContainers:ue}),[ae,ea,z,ee,w,le,N,mn,ue]);return Le.createElement(By.Provider,{value:k},Le.createElement(Wo.Provider,{value:qr},Le.createElement(t1.Provider,{value:ta},Le.createElement(cc.Provider,{value:nn},c)),Le.createElement(g7,{disabled:a?.restoreFocus===!1})),Le.createElement(v6,{...a,hiddenTextDescribedById:le}));function na(){const We=F?.autoScrollEnabled===!1,gt=typeof l=="object"?l.enabled===!1:l===!1,lt=C&&!We&&!gt;return typeof l=="object"?{...l,enabled:lt}:{enabled:lt}}}),v7=m.createContext(null),Jm="button",w7="Draggable";function S7(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=_o(w7),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:h,draggableNodes:u,over:f}=m.useContext(Wo),{role:p=Jm,roleDescription:g="draggable",tabIndex:b=0}=i??{},x=l?.id===e,w=m.useContext(x?cc:v7),[v,k]=Dl(),[j,S]=Dl(),C=l7(o,e),y=_s(n);ln(()=>(u.set(e,{id:e,key:s,node:v,activatorNode:j,data:y}),()=>{const A=u.get(e);A&&A.key===s&&u.delete(e)}),[u,e]);const N=m.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&p===Jm?!0:void 0,"aria-roledescription":g,"aria-describedby":h.draggable}),[r,p,b,x,g,h.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:N,isDragging:x,listeners:r?void 0:C,node:v,over:f,setNodeRef:k,setActivatorNodeRef:S,transform:w}}function r1(){return m.useContext(t1)}const k7="Droppable",C7={timeout:25};function i1(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=_o(k7),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=m.useContext(Wo),h=m.useRef({disabled:n}),u=m.useRef(!1),f=m.useRef(null),p=m.useRef(null),{disabled:g,updateMeasurementsFor:b,timeout:x}={...C7,...i},w=_s(b??r),v=m.useCallback(()=>{if(!u.current){u.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),p.current=null},x)},[x]),k=lc({callback:v,disabled:g||!o}),j=m.useCallback((N,A)=>{k&&(A&&(k.unobserve(A),u.current=!1),N&&k.observe(N))},[k]),[S,C]=Dl(j),y=_s(e);return m.useEffect(()=>{!k||!S.current||(k.disconnect(),u.current=!1,k.observe(S.current))},[S,k]),m.useEffect(()=>(a({type:qe.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:f,data:y}}),()=>a({type:qe.UnregisterDroppable,key:s,id:r})),[r]),m.useEffect(()=>{n!==h.current.disabled&&(a({type:qe.SetDroppableDisabled,id:r,key:s,disabled:n}),h.current.disabled=n)},[r,s,n,a]),{active:o,rect:f,isOver:l?.id===r,node:S,over:l,setNodeRef:C}}function j7(t){let{animation:e,children:n}=t;const[r,i]=m.useState(null),[s,o]=m.useState(null),a=Al(n);return!n&&!r&&a&&i(a),ln(()=>{if(!s)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(e(c,s)).then(()=>{i(null)})},[e,r,s]),Le.createElement(Le.Fragment,null,n,r?m.cloneElement(r,{ref:o}):null)}const O7={x:0,y:0,scaleX:1,scaleY:1};function P7(t){let{children:e}=t;return Le.createElement(Wo.Provider,{value:e1},Le.createElement(cc.Provider,{value:O7},e))}const N7={position:"fixed",touchAction:"none"},D7=t=>oc(t)?"transform 250ms ease":void 0,A7=m.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:i,children:s,className:o,rect:a,style:l,transform:c,transition:h=D7}=t;if(!a)return null;const u=i?c:{...c,scaleX:1,scaleY:1},f={...N7,width:a.width,height:a.height,top:a.top,left:a.left,transform:pr.Transform.toString(u),transformOrigin:i&&r?S6(r,a):void 0,transition:typeof h=="function"?h(r):h,...l};return Le.createElement(n,{className:o,style:f,ref:e},s)}),M7=t=>e=>{let{active:n,dragOverlay:r}=e;const i={},{styles:s,className:o}=t;if(s!=null&&s.active)for(const[a,l]of Object.entries(s.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(s!=null&&s.dragOverlay)for(const[a,l]of Object.entries(s.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},T7=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:pr.Transform.toString(e)},{transform:pr.Transform.toString(n)}]},E7={duration:250,easing:"ease",keyframes:T7,sideEffects:M7({styles:{active:{opacity:"0"}}})};function R7(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=t;return sc((s,o)=>{if(e===null)return;const a=n.get(s);if(!a)return;const l=a.node.current;if(!l)return;const c=Zy(o);if(!c)return;const{transform:h}=kt(o).getComputedStyle(o),u=_y(h);if(!u)return;const f=typeof e=="function"?e:L7(e);return Jy(l,i.draggable.measure),f({active:{id:s,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function L7(t){const{duration:e,easing:n,sideEffects:r,keyframes:i}={...E7,...t};return s=>{let{active:o,dragOverlay:a,transform:l,...c}=s;if(!e)return;const h={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},u={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-h.x,y:l.y-h.y,...u},p=i({...c,active:o,dragOverlay:a,transform:{initial:l,final:f}}),[g]=p,b=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(b))return;const x=r?.({active:o,dragOverlay:a,...c}),w=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(v=>{w.onfinish=()=>{x?.(),v()}})}}let Qm=0;function I7(t){return m.useMemo(()=>{if(t!=null)return Qm++,Qm},[t])}const $7=Le.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:i,transition:s,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggableNodes:g,droppableContainers:b,dragOverlay:x,over:w,measuringConfiguration:v,scrollableAncestors:k,scrollableAncestorRects:j,windowRect:S}=r1(),C=m.useContext(cc),y=I7(u?.id),N=n1(o,{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:x.rect,over:w,overlayNodeRect:x.rect,scrollableAncestors:k,scrollableAncestorRects:j,transform:C,windowRect:S}),A=Eu(f),T=R7({config:r,draggableNodes:g,droppableContainers:b,measuringConfiguration:v}),P=A?x.setRef:void 0;return Le.createElement(P7,null,Le.createElement(j7,{animation:T},u&&y?Le.createElement(A7,{key:y,id:u.id,ref:P,as:a,activatorEvent:h,adjustScale:e,className:l,transition:s,rect:A,style:{zIndex:c,...i},transform:N},n):null))});function Ru(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function B7(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function $a(t){return t!==null&&t>=0}function F7(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function z7(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Ba={scaleX:1,scaleY:1},H7=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:s,index:o}=t;const a=(e=n[i])!=null?e:r;if(!a)return null;const l=V7(n,o,i);if(o===i){const c=n[s];return c?{x:i<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...Ba}:null}return o>i&&o<=s?{x:-a.width-l,y:0,...Ba}:o<i&&o>=s?{x:a.width+l,y:0,...Ba}:{x:0,y:0,...Ba}};function V7(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return!r||!i&&!s?0:n<e?i?r.left-(i.left+i.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(i.left+i.width)}const s1=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=Ru(e,r,n),o=e[i],a=s[i];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},o1="Sortable",a1=Le.createContext({activeIndex:-1,containerId:o1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:s1,disabled:{draggable:!1,droppable:!1}});function _7(t){let{children:e,id:n,items:r,strategy:i=s1,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:h}=r1(),u=_o(o1,n),f=a.rect!==null,p=m.useMemo(()=>r.map(C=>typeof C=="object"&&"id"in C?C.id:C),[r]),g=o!=null,b=o?p.indexOf(o.id):-1,x=c?p.indexOf(c.id):-1,w=m.useRef(p),v=!F7(p,w.current),k=x!==-1&&b===-1||v,j=z7(s);ln(()=>{v&&g&&h(p)},[v,p,g,h]),m.useEffect(()=>{w.current=p},[p]);const S=m.useMemo(()=>({activeIndex:b,containerId:u,disabled:j,disableTransforms:k,items:p,overIndex:x,useDragOverlay:f,sortedRects:B7(p,l),strategy:i}),[b,u,j.draggable,j.droppable,k,p,x,l,f,i]);return Le.createElement(a1.Provider,{value:S},e)}const W7=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return Ru(n,r,i).indexOf(e)},U7=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==s&&i===o?!1:n?!0:o!==i&&e===l},K7={duration:200,easing:"ease"},l1="transform",G7=pr.Transition.toString({property:l1,duration:0,easing:"linear"}),q7={roleDescription:"sortable"};function Y7(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=m.useState(null),a=m.useRef(n);return ln(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=Ti(r.current,{ignoreTransform:!0}),h={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(h.x||h.y)&&o(h)}}n!==a.current&&(a.current=n)},[e,n,r,i]),m.useEffect(()=>{s&&o(null)},[s]),s}function J7(t){let{animateLayoutChanges:e=U7,attributes:n,disabled:r,data:i,getNewIndex:s=W7,id:o,strategy:a,resizeObserverConfig:l,transition:c=K7}=t;const{items:h,containerId:u,activeIndex:f,disabled:p,disableTransforms:g,sortedRects:b,overIndex:x,useDragOverlay:w,strategy:v}=m.useContext(a1),k=Q7(r,p),j=h.indexOf(o),S=m.useMemo(()=>({sortable:{containerId:u,index:j,items:h},...i}),[u,i,j,h]),C=m.useMemo(()=>h.slice(h.indexOf(o)),[h,o]),{rect:y,node:N,isOver:A,setNodeRef:T}=i1({id:o,data:S,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:P,activatorEvent:R,activeNodeRect:z,attributes:I,setNodeRef:F,listeners:G,isDragging:ae,over:X,setActivatorNodeRef:Q,transform:le}=S7({id:o,data:S,attributes:{...q7,...n},disabled:k.draggable}),fe=a6(T,F),W=!!P,se=W&&!g&&$a(f)&&$a(x),ue=!w&&ae,xe=ue&&se?le:null,Qe=se?xe??(a??v)({rects:b,activeNodeRect:z,activeIndex:f,overIndex:x,index:j}):null,U=$a(f)&&$a(x)?s({id:o,items:h,activeIndex:f,overIndex:x}):j,ve=P?.id,ee=m.useRef({activeId:ve,items:h,newIndex:U,containerId:u}),Ae=h!==ee.current.items,pe=e({active:P,containerId:u,isDragging:ae,isSorting:W,id:o,index:j,items:h,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:c,wasDragging:ee.current.activeId!=null}),_e=Y7({disabled:!pe,index:j,node:N,rect:y});return m.useEffect(()=>{W&&ee.current.newIndex!==U&&(ee.current.newIndex=U),u!==ee.current.containerId&&(ee.current.containerId=u),h!==ee.current.items&&(ee.current.items=h)},[W,U,u,h]),m.useEffect(()=>{if(ve===ee.current.activeId)return;if(ve!=null&&ee.current.activeId==null){ee.current.activeId=ve;return}const K=setTimeout(()=>{ee.current.activeId=ve},50);return()=>clearTimeout(K)},[ve]),{active:P,activeIndex:f,attributes:I,data:S,rect:y,index:j,newIndex:U,items:h,isOver:A,isSorting:W,isDragging:ae,listeners:G,node:N,overIndex:x,over:X,setNodeRef:fe,setActivatorNodeRef:Q,setDroppableNodeRef:T,setDraggableNodeRef:F,transform:_e??Qe,transition:$()};function $(){if(_e||Ae&&ee.current.newIndex===j)return G7;if(!(ue&&!oc(R)||!c)&&(W||pe))return pr.Transition.toString({...c,property:l1})}}function Q7(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Rl(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const X7=[we.Down,we.Right,we.Up,we.Left],Z7=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(X7.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=i.get(u.id);if(f)switch(t.code){case we.Down:r.top<f.top&&l.push(u);break;case we.Up:r.top>f.top&&l.push(u);break;case we.Left:r.left>f.left&&l.push(u);break;case we.Right:r.left<f.left&&l.push(u);break}});const c=j6({collisionRect:r,droppableRects:i,droppableContainers:l});let h=Hy(c,"id");if(h===o?.id&&c.length>1&&(h=c[1].id),h!=null){const u=s.get(n.id),f=s.get(h),p=f?i.get(f.id):null,g=f?.node.current;if(g&&p&&u&&f){const x=ac(g).some((C,y)=>a[y]!==C),w=c1(u,f),v=eN(u,f),k=x||!w?{x:0,y:0}:{x:v?r.width-p.width:0,y:v?r.height-p.height:0},j={x:p.left,y:p.top};return k.x&&k.y?j:Ws(j,k)}}}};function c1(t,e){return!Rl(t)||!Rl(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function eN(t,e){return!Rl(t)||!Rl(e)||!c1(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}m.createContext(null);var tN=function(e,n){if(n){if(e&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!e&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function Ks(t){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(t)}var nN=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function Xm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Fa(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xm(Object(n),!0).forEach(function(r){rN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rN(t,e,n){return e=iN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iN(t){var e=sN(t,"string");return Ks(e)=="symbol"?e:String(e)}function sN(t,e){if(Ks(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oN(t,e){if(t==null)return{};var n=aN(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var br=m.memo(function(t){var e=t.shape,n=e===void 0?"circle":e,r=t.color,i=r===void 0?"#fff":r,s=t.background,o=t.size,a=t.style,l=t.iconMultiple,c=l===void 0?.75:l,h=t.Icon,u=t.iconStyle,f=t.iconClassName,p=oN(t,nN),g=XP(),b=g.isDarkMode;return d.jsx(r6,Fa(Fa({flex:"none",style:Fa({background:s,borderRadius:n==="circle"?"50%":Math.floor(o*.1),boxShadow:tN(b,s),color:i,height:o,width:o},a)},p),{},{children:h&&d.jsx(h,{className:f,color:i,size:o,style:Fa({transform:"scale(".concat(c,")")},u)})}))});function Gs(t){"@babel/helpers - typeof";return Gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gs(t)}var lN=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function Zm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Zm(Object(n),!0).forEach(function(r){cN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Zm(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cN(t,e,n){return e=dN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dN(t){var e=hN(t,"string");return Gs(e)=="symbol"?e:String(e)}function hN(t,e){if(Gs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uN(t,e){if(t==null)return{};var n=fN(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function fN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var xr=m.memo(function(t){var e=t.Icon,n=t.style,r=t.Text,i=t.color,s=t.size,o=s===void 0?24:s,a=t.spaceMultiple,l=a===void 0?1:a,c=t.textMultiple,h=c===void 0?1:c,u=t.extra,f=t.extraStyle,p=t.showText,g=p===void 0?!0:p,b=t.showLogo,x=b===void 0?!0:b,w=t.extraClassName,v=t.iconProps,k=t.inverse,j=uN(t,lN),S=e&&x&&d.jsx(e,Gn(Gn({size:o},v),{},{style:Gn(k?{marginLeft:o*l}:{marginRight:o*l},v?.style)})),C=g&&r&&d.jsx(r,{size:o*h});return d.jsxs(Ly,Gn(Gn({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:Gn({color:i},n)},j),{},{children:[k?d.jsxs(d.Fragment,{children:[C,S]}):d.jsxs(d.Fragment,{children:[S,C]}),u&&d.jsx("span",{className:w,style:Gn({fontSize:o*h*.95,lineHeight:1},f),children:u})]}))}),pN=function(e,n){return m.useMemo(function(){var r=Array.from({length:n},function(i,s){var o="lobe-icons-".concat(o6(e),"-fill-").concat(s);return{fill:"url(#".concat(o,")"),id:o}});return r},[e,n])},Ei="Claude",mN=.8,gN=.1,d1="#D97757",bN=d1,xN="#fff",yN=.75;function qs(t){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qs(t)}var vN=["size","style"];function eg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eg(Object(n),!0).forEach(function(r){wN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wN(t,e,n){return e=SN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SN(t){var e=kN(t,"string");return qs(e)=="symbol"?e:String(e)}function kN(t,e){if(qs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CN(t,e){if(t==null)return{};var n=jN(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Lu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=CN(t,vN);return d.jsxs("svg",sd(sd({fill:"currentColor",fillRule:"evenodd",height:n,style:sd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ei}),d.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function Ys(t){"@babel/helpers - typeof";return Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ys(t)}function tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ON(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tg(Object(n),!0).forEach(function(r){PN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PN(t,e,n){return e=NN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NN(t){var e=DN(t,"string");return Ys(e)=="symbol"?e:String(e)}function DN(t,e){if(Ys(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ys(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AN(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var MN=m.memo(function(t){var e=Object.assign({},(AN(t),t));return d.jsx(br,ON({Icon:Lu,"aria-label":Ei,background:bN,color:xN,iconMultiple:yN},e))});function Js(t){"@babel/helpers - typeof";return Js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Js(t)}var TN=["size","style"];function ng(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function od(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ng(Object(n),!0).forEach(function(r){EN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function EN(t,e,n){return e=RN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RN(t){var e=LN(t,"string");return Js(e)=="symbol"?e:String(e)}function LN(t,e){if(Js(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Js(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function IN(t,e){if(t==null)return{};var n=$N(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $N(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var h1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=IN(t,TN);return d.jsxs("svg",od(od({height:n,style:od({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ei}),d.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function Qs(t){"@babel/helpers - typeof";return Qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qs(t)}var BN=["size","style"];function rg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ad(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rg(Object(n),!0).forEach(function(r){FN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function FN(t,e,n){return e=zN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zN(t){var e=HN(t,"string");return Qs(e)=="symbol"?e:String(e)}function HN(t,e){if(Qs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function VN(t,e){if(t==null)return{};var n=_N(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _N(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var u1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=VN(t,BN);return d.jsxs("svg",ad(ad({fill:"currentColor",fillRule:"nonzero",height:n,style:ad({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ei}),d.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function Xs(t){"@babel/helpers - typeof";return Xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xs(t)}var WN=["type"];function ig(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UN(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ig(Object(n),!0).forEach(function(r){KN(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ig(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KN(t,e,n){return e=GN(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GN(t){var e=qN(t,"string");return Xs(e)=="symbol"?e:String(e)}function qN(t,e){if(Xs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YN(t,e){if(t==null)return{};var n=JN(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function JN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var QN=m.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=YN(t,WN),i=n==="color"?h1:Lu;return d.jsx(xr,UN({Icon:i,Text:u1,"aria-label":Ei,spaceMultiple:gN,textMultiple:mN},r))}),Vr=Lu;Vr.Color=h1;Vr.Text=u1;Vr.Combine=QN;Vr.Avatar=MN;Vr.colorPrimary=d1;Vr.title=Ei;var Uo="OpenAI",XN=.75,ZN=.1,f1="#000",p1="#19C37D",m1="#AB68FF",g1="#F86AA4",Iu="#F9C322",b1="#0099FF",x1="#0000FE",e8=f1,t8="#fff",n8=.75;function Zs(t){"@babel/helpers - typeof";return Zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zs(t)}var r8=["size","style"];function sg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ld(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sg(Object(n),!0).forEach(function(r){i8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function i8(t,e,n){return e=s8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s8(t){var e=o8(t,"string");return Zs(e)=="symbol"?e:String(e)}function o8(t,e){if(Zs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function a8(t,e){if(t==null)return{};var n=l8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function l8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var $u=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=a8(t,r8);return d.jsxs("svg",ld(ld({fill:"currentColor",fillRule:"evenodd",height:n,style:ld({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Uo}),d.jsx("path",{d:"M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"})]}))}),Fr="Gemini",c8=.8,d8=.2,y1="#fff",h8=y1,u8="#fff",f8=.8;function eo(t){"@babel/helpers - typeof";return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(t)}var p8=["size","style"];function og(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?og(Object(n),!0).forEach(function(r){m8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):og(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function m8(t,e,n){return e=g8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g8(t){var e=b8(t,"string");return eo(e)=="symbol"?e:String(e)}function b8(t,e){if(eo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function x8(t,e){return S8(t)||w8(t,e)||v8(t,e)||y8()}function y8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
249
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v8(t,e){if(t){if(typeof t=="string")return ag(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ag(t,e)}}function ag(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function w8(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(h){c=!0,i=h}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function S8(t){if(Array.isArray(t))return t}function k8(t,e){if(t==null)return{};var n=C8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function C8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Bu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=k8(t,p8),s=pN(Fr,3),o=x8(s,3),a=o[0],l=o[1],c=o[2];return d.jsxs("svg",cd(cd({height:n,style:cd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Fr}),d.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),d.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:a.fill}),d.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:l.fill}),d.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:c.fill}),d.jsxs("defs",{children:[d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:a.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[d.jsx("stop",{stopColor:"#08B962"}),d.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:l.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[d.jsx("stop",{stopColor:"#F94543"}),d.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),d.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:c.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[d.jsx("stop",{stopColor:"#FABC12"}),d.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}))});function to(t){"@babel/helpers - typeof";return to=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},to(t)}function lg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function j8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lg(Object(n),!0).forEach(function(r){O8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function O8(t,e,n){return e=P8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P8(t){var e=N8(t,"string");return to(e)=="symbol"?e:String(e)}function N8(t,e){if(to(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(to(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function D8(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var A8=m.memo(function(t){var e=Object.assign({},(D8(t),t));return d.jsx(br,j8({Icon:Bu,"aria-label":Fr,background:h8,color:u8,iconMultiple:f8},e))});function no(t){"@babel/helpers - typeof";return no=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},no(t)}var M8=["size","style"];function cg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cg(Object(n),!0).forEach(function(r){T8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function T8(t,e,n){return e=E8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function E8(t){var e=R8(t,"string");return no(e)=="symbol"?e:String(e)}function R8(t,e){if(no(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(no(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function L8(t,e){if(t==null)return{};var n=I8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function I8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var v1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=L8(t,M8);return d.jsxs("svg",dd(dd({fill:"currentColor",fillRule:"evenodd",height:n,style:dd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Fr}),d.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})]}))});function ro(t){"@babel/helpers - typeof";return ro=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ro(t)}var $8=["size","style"];function dg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dg(Object(n),!0).forEach(function(r){B8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function B8(t,e,n){return e=F8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function F8(t){var e=z8(t,"string");return ro(e)=="symbol"?e:String(e)}function z8(t,e){if(ro(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ro(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function H8(t,e){if(t==null)return{};var n=V8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function V8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var w1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=H8(t,$8);return d.jsxs("svg",hd(hd({fill:"currentColor",fillRule:"evenodd",height:n,style:hd({flex:"none",lineHeight:1},r),viewBox:"0 0 98 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Fr}),d.jsx("path",{d:"M21.186 12.67c0 2.649-.786 4.759-2.359 6.33-1.766 1.87-4.09 2.806-6.969 2.806-2.756 0-5.088-.953-6.996-2.86C2.954 17.04 2 14.693 2 11.904c0-2.789.954-5.137 2.862-7.043C6.77 2.953 9.102 2 11.858 2c1.396 0 2.712.247 3.949.741 1.236.495 2.252 1.192 3.047 2.092l-1.749 1.748c-.583-.706-1.338-1.258-2.266-1.655a7.49 7.49 0 00-2.981-.596c-2.067 0-3.816.715-5.247 2.145-1.413 1.448-2.12 3.257-2.12 5.428s.707 3.98 2.12 5.428c1.431 1.43 3.18 2.145 5.247 2.145 1.89 0 3.463-.53 4.717-1.588 1.254-1.06 1.979-2.516 2.173-4.37h-6.89v-2.277h9.196c.088.495.132.971.132 1.43m7.652-4.633c1.946 0 3.494.629 4.645 1.886 1.15 1.257 1.726 3.018 1.726 5.282l-.027.268H24.877c.036 1.284.464 2.318 1.285 3.102.82.785 1.802 1.177 2.944 1.177 1.57 0 2.802-.784 3.694-2.354l2.195 1.07a6.54 6.54 0 01-2.45 2.595C31.503 21.688 30.32 22 29 22c-1.927 0-3.516-.66-4.765-1.98-1.249-1.319-1.873-2.986-1.873-5.001 0-1.997.606-3.66 1.82-4.988 1.213-1.329 2.766-1.993 4.657-1.993m-.053 2.247c-.928 0-1.727.285-2.396.856-.67.57-1.11 1.337-1.325 2.3h7.522c-.071-.91-.442-1.663-1.111-2.26-.67-.598-1.566-.896-2.69-.896M39.247 21.53h-2.455V8.465h2.348v1.813h.107c.374-.64.947-1.173 1.721-1.6.774-.427 1.544-.64 2.309-.64.96 0 1.806.222 2.535.667a3.931 3.931 0 011.601 1.84c1.085-1.671 2.589-2.507 4.51-2.507 1.513 0 2.678.462 3.496 1.387.819.924 1.228 2.24 1.228 3.946v8.16h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.192-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227h-2.455v-7.786c0-1.227-.223-2.112-.668-2.654-.444-.542-1.191-.813-2.241-.813-.943 0-1.735.4-2.375 1.2-.64.8-.961 1.742-.961 2.826v7.227zM61.911 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zM80 3.93c0 .48-.17.89-.508 1.228a1.675 1.675 0 01-1.23.508c-.48 0-.89-.17-1.229-.508a1.673 1.673 0 01-.508-1.228c0-.481.17-.89.508-1.229a1.675 1.675 0 011.23-.508c.48 0 .89.17 1.23.508.338.338.507.748.507 1.228m-.11 4.514v13.088h-2.857V8.443h2.857zm-16.343.022h2.349v1.813h.107c.373-.64.947-1.173 1.721-1.6a4.935 4.935 0 012.415-.64c1.601 0 2.833.458 3.696 1.373.863.916 1.294 2.218 1.294 3.907v8.213h-2.455v-8.053c-.053-2.133-1.13-3.2-3.229-3.2-.978 0-1.797.395-2.455 1.187-.658.79-.987 1.737-.987 2.84v7.226h-2.456V8.465z"})]}))});function io(t){"@babel/helpers - typeof";return io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},io(t)}var _8=["type"];function hg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function W8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hg(Object(n),!0).forEach(function(r){U8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U8(t,e,n){return e=K8(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function K8(t){var e=G8(t,"string");return io(e)=="symbol"?e:String(e)}function G8(t,e){if(io(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(io(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q8(t,e){if(t==null)return{};var n=Y8(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Y8(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var J8=m.memo(function(t){var e=t.type,n=e===void 0?"mono":e,r=q8(t,_8),i=n==="color"?Bu:v1;return d.jsx(xr,W8({Icon:i,Text:w1,"aria-label":Fr,spaceMultiple:d8,textMultiple:c8},r))}),_r=v1;_r.Color=Bu;_r.Text=w1;_r.Combine=J8;_r.Avatar=A8;_r.colorPrimary=y1;_r.title=Fr;function so(t){"@babel/helpers - typeof";return so=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},so(t)}var Q8=["type"];function ug(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function X8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ug(Object(n),!0).forEach(function(r){Z8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ug(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Z8(t,e,n){return e=eD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eD(t){var e=tD(t,"string");return so(e)=="symbol"?e:String(e)}function tD(t,e){if(so(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(so(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nD(t,e){if(t==null)return{};var n=rD(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rD(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var iD=m.memo(function(t){var e=t.type,n=e===void 0?"normal":e,r=nD(t,Q8),i=m.useMemo(function(){switch(n){case"gpt3":return p1;case"gpt4":return m1;case"gpt5":return g1;case"o3":case"o1":return Iu;case"oss":return b1;case"platform":return x1;default:return e8}},[n]);return d.jsx(br,X8({Icon:$u,"aria-label":Uo,background:i,color:t8,iconMultiple:n8},r))});function oo(t){"@babel/helpers - typeof";return oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oo(t)}var sD=["size","style"];function fg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ud(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fg(Object(n),!0).forEach(function(r){oD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oD(t,e,n){return e=aD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aD(t){var e=lD(t,"string");return oo(e)=="symbol"?e:String(e)}function lD(t,e){if(oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(oo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cD(t,e){if(t==null)return{};var n=dD(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dD(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var S1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=cD(t,sD);return d.jsxs("svg",ud(ud({fill:"currentColor",fillRule:"evenodd",height:n,style:ud({flex:"none",lineHeight:1},r),viewBox:"0 0 84 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Uo}),d.jsx("path",{d:"M2 10.955c0 5.276 3.376 8.955 8.054 8.955 4.678 0 8.054-3.679 8.054-8.955S14.732 2 10.054 2C5.423 2 2.068 5.606 2 10.797L2 10.955zm13.021 0c0 3.775-2.05 6.22-4.967 6.22-2.918 0-4.968-2.445-4.968-6.22 0-3.776 2.05-6.22 4.968-6.22 2.917 0 4.967 2.444 4.967 6.22zm11.778 8.955c3.545 0 5.57-3.001 5.57-6.607 0-3.607-2.025-6.608-5.57-6.608-1.64 0-2.845.654-3.64 1.598V6.937h-2.894V24h2.893v-5.688c.796.944 2.002 1.598 3.641 1.598zm-3.713-6.97c0-2.397 1.35-3.703 3.135-3.703 2.097 0 3.23 1.645 3.23 4.066 0 2.42-1.133 4.066-3.23 4.066-1.785 0-3.135-1.332-3.135-3.68v-.75zM40.2 19.91c2.532 0 4.533-1.331 5.425-3.558l-2.483-.944c-.386 1.307-1.52 2.033-2.942 2.033-1.857 0-3.159-1.331-3.376-3.51h8.874v-.967c0-3.485-1.953-6.269-5.619-6.269-3.665 0-6.028 2.88-6.028 6.608 0 3.92 2.532 6.607 6.15 6.607zm-.145-10.77c1.833 0 2.701 1.21 2.725 2.614H36.97c.434-1.719 1.591-2.614 3.086-2.614zm7.814 10.504h2.894v-7.455c0-1.815 1.326-2.783 2.628-2.783 1.591 0 2.218 1.137 2.218 2.71v7.528h2.894V11.27c0-2.735-1.592-4.575-4.244-4.575-1.64 0-2.773.75-3.496 1.598V6.937h-2.894v12.707zM66.978 2.266l-6.56 17.378h3.063l1.471-3.97h7.475l1.495 3.97h3.11L70.475 2.266h-3.496zm1.687 3.437l2.75 7.26h-5.45l2.7-7.26zM82 2.317h-3.086v17.377H82V2.317z"})]}))});function ao(t){"@babel/helpers - typeof";return ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ao(t)}var hD=["extraStyle"];function pg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pg(Object(n),!0).forEach(function(r){uD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uD(t,e,n){return e=fD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fD(t){var e=pD(t,"string");return ao(e)=="symbol"?e:String(e)}function pD(t,e){if(ao(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ao(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mD(t,e){if(t==null)return{};var n=gD(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gD(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var bD=m.memo(function(t){var e=t.extraStyle,n=mD(t,hD);return d.jsx(xr,mg({Icon:$u,Text:S1,"aria-label":Uo,extraStyle:mg({fontWeight:600},e),spaceMultiple:ZN,textMultiple:XN},n))}),Ht=$u;Ht.Text=S1;Ht.Combine=bD;Ht.Avatar=iD;Ht.colorPrimary=f1;Ht.colorGpt3=p1;Ht.colorGpt4=m1;Ht.colorGpt5=g1;Ht.colorO1=Iu;Ht.colorO3=Iu;Ht.colorOss=b1;Ht.colorPlatform=x1;Ht.title=Uo;var Ko="GithubCopilot",xD=.75,yD=.3,k1="#000",vD=k1,wD="#fff",SD=.75;function lo(t){"@babel/helpers - typeof";return lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lo(t)}var kD=["size","style"];function gg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gg(Object(n),!0).forEach(function(r){CD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function CD(t,e,n){return e=jD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jD(t){var e=OD(t,"string");return lo(e)=="symbol"?e:String(e)}function OD(t,e){if(lo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(lo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PD(t,e){if(t==null)return{};var n=ND(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ND(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Fu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=PD(t,kD);return d.jsxs("svg",fd(fd({fill:"currentColor",fillRule:"evenodd",height:n,style:fd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ko}),d.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})]}))});function co(t){"@babel/helpers - typeof";return co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},co(t)}function bg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function DD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bg(Object(n),!0).forEach(function(r){AD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AD(t,e,n){return e=MD(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MD(t){var e=TD(t,"string");return co(e)=="symbol"?e:String(e)}function TD(t,e){if(co(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ED(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var RD=m.memo(function(t){var e=Object.assign({},(ED(t),t));return d.jsx(br,DD({Icon:Fu,"aria-label":Ko,background:vD,color:wD,iconMultiple:SD},e))});function ho(t){"@babel/helpers - typeof";return ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ho(t)}var LD=["size","style"];function xg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xg(Object(n),!0).forEach(function(r){ID(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ID(t,e,n){return e=$D(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $D(t){var e=BD(t,"string");return ho(e)=="symbol"?e:String(e)}function BD(t,e){if(ho(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ho(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function FD(t,e){if(t==null)return{};var n=zD(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function zD(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var C1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=FD(t,LD);return d.jsxs("svg",pd(pd({fill:"currentColor",fillRule:"evenodd",height:n,style:pd({flex:"none",lineHeight:1},r),viewBox:"0 0 154 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Ko}),d.jsx("path",{d:"M2 11.875c0 5.256 3.013 8.506 8.19 8.506 4.76 0 8.027-2.72 8.027-7.722v-1.545h-7.982v2.928h4.095c-.161 1.96-1.68 3.25-4.049 3.25-2.6 0-4.347-1.498-4.347-4.334V10.7c0-2.582 1.518-4.31 4.186-4.31 1.91 0 3.267.922 3.68 2.374h3.865c-.437-3.366-3.427-5.625-7.499-5.625C5.29 3.138 2 6.366 2 11.875zm17.308-5.44h3.496V3h-3.496v3.435zm0 13.715h3.496V7.795h-3.496V20.15zm10.544-9.52h2.438V7.795h-2.438V3.922h-3.496v3.873H24.17v2.835h2.186v6.8c0 1.637.69 2.72 2.76 2.72h3.174v-2.766h-2.438V10.63zm3.994 9.52h3.727v-7.076h7.568v7.076h3.726V3.346h-3.726v6.777h-7.568V3.346h-3.727V20.15zM62.385 7.795h-3.497v6.523c0 1.868-1.012 3.205-2.668 3.205-1.38 0-2.162-.83-2.162-2.56V7.796h-3.52v7.722c0 2.95 1.357 4.864 4.118 4.864 1.955 0 3.29-.945 4.002-2.49h.207l.46 2.26h3.06V7.794zm1.698 12.355h3.06l.436-2.213h.207c.713 1.591 2.3 2.444 4.072 2.444 3.174 0 5.015-2.374 5.015-6.385 0-4.057-1.887-6.432-5.084-6.432-1.978 0-3.428 1.014-4.003 2.49h-.207V3h-3.496v17.15zm3.496-5.624v-1.06c0-1.845 1.173-3.043 2.99-3.043 1.657 0 2.738.853 2.738 2.581v1.983c0 1.521-.874 2.559-2.714 2.559-1.864 0-3.014-1.222-3.014-3.02zm21.8 5.855c4.21 0 7.177-2.351 7.683-6.063h-3.151c-.46 2.098-2.186 3.389-4.486 3.389-2.852 0-4.67-1.867-4.67-4.518v-2.743c0-2.882 1.887-4.634 4.716-4.634 2.53 0 4.072 1.36 4.44 3.366h3.151c-.368-3.665-3.243-6.063-7.499-6.063-5.038 0-7.982 3.274-7.982 8.668 0 5.348 2.898 8.598 7.798 8.598zm8.533-6.34c0 3.92 2.346 6.34 5.98 6.34 3.796 0 6.004-2.536 6.004-6.34 0-4.056-2.484-6.338-6.003-6.338-3.635 0-5.981 2.397-5.981 6.339zm2.898.992V13.12c0-1.89 1.22-3.066 3.083-3.066 1.817 0 3.082 1.152 3.082 3.066v1.913c0 1.96-1.288 2.997-3.082 2.997-1.749 0-3.083-1.015-3.083-2.997zM111.018 24h2.853v-6.132h.184c.667 1.453 2.116 2.398 4.186 2.398 3.083 0 4.992-2.26 4.992-6.293 0-3.942-1.863-6.27-4.992-6.27-1.863 0-3.427.852-4.186 2.397h-.184l-.345-2.167h-2.508V24zm6.211-6.063c-2.024 0-3.358-1.314-3.358-3.342v-1.222c0-2.005 1.31-3.342 3.381-3.342 2.002 0 3.037 1.152 3.037 2.881v2.144c0 1.815-1.16 2.849-2.973 2.88l-.087.001zm7.1-11.733h2.83V3.115h-2.83v3.09zm0 13.946h2.83V7.933h-2.83V20.15zm4.338 0h2.83V3.115h-2.83V20.15zm9.927-12.447c3.52 0 6.004 2.282 6.004 6.339 0 3.803-2.208 6.339-6.004 6.339-3.634 0-5.98-2.42-5.98-6.34 0-3.941 2.346-6.338 5.98-6.338zm10.922-3.689v3.919H152v2.328h-2.484v7.607H152v2.282h-2.99c-1.749 0-2.324-.922-2.324-2.282v-7.607h-2.185V7.933h2.185V4.014h2.83zm-10.922 6.04c-1.863 0-3.082 1.175-3.082 3.066v1.913c0 1.982 1.334 2.997 3.082 2.997 1.795 0 3.083-1.038 3.083-2.997V13.12c0-1.914-1.265-3.066-3.083-3.066z"})]}))});function uo(t){"@babel/helpers - typeof";return uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uo(t)}function yg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function HD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yg(Object(n),!0).forEach(function(r){VD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VD(t,e,n){return e=_D(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _D(t){var e=WD(t,"string");return uo(e)=="symbol"?e:String(e)}function WD(t,e){if(uo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(uo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function UD(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var KD=m.memo(function(t){var e=Object.assign({},(UD(t),t));return d.jsx(xr,HD({Icon:Fu,Text:C1,"aria-label":Ko,spaceMultiple:yD,textMultiple:xD},e))}),Ri=Fu;Ri.Text=C1;Ri.Combine=KD;Ri.Avatar=RD;Ri.colorPrimary=k1;Ri.title=Ko;var Go="Cline",GD=.7,qD=.2,j1="#323B43",YD=j1,JD="#fff",QD=.6;function fo(t){"@babel/helpers - typeof";return fo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fo(t)}var XD=["size","style"];function vg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function md(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vg(Object(n),!0).forEach(function(r){ZD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ZD(t,e,n){return e=eA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eA(t){var e=tA(t,"string");return fo(e)=="symbol"?e:String(e)}function tA(t,e){if(fo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nA(t,e){if(t==null)return{};var n=rA(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var zu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=nA(t,XD);return d.jsxs("svg",md(md({fill:"currentColor",fillRule:"evenodd",height:n,style:md({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Go}),d.jsx("path",{d:"M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"}),d.jsx("path",{d:"M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"})]}))});function po(t){"@babel/helpers - typeof";return po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},po(t)}function wg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function iA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wg(Object(n),!0).forEach(function(r){sA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sA(t,e,n){return e=oA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oA(t){var e=aA(t,"string");return po(e)=="symbol"?e:String(e)}function aA(t,e){if(po(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(po(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var cA=m.memo(function(t){var e=Object.assign({},(lA(t),t));return d.jsx(br,iA({Icon:zu,"aria-label":Go,background:YD,color:JD,iconMultiple:QD},e))});function mo(t){"@babel/helpers - typeof";return mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mo(t)}var dA=["size","style"];function Sg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sg(Object(n),!0).forEach(function(r){hA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hA(t,e,n){return e=uA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uA(t){var e=fA(t,"string");return mo(e)=="symbol"?e:String(e)}function fA(t,e){if(mo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pA(t,e){if(t==null)return{};var n=mA(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var O1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=pA(t,dA);return d.jsxs("svg",gd(gd({fill:"currentColor",fillRule:"evenodd",height:n,style:gd({flex:"none",lineHeight:1},r),viewBox:"0 0 88 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Go}),d.jsx("path",{d:"M79.558 21.986c-1.13 0-2.167-.189-3.108-.565a7.128 7.128 0 01-2.403-1.569 6.933 6.933 0 01-1.554-2.331 7.876 7.876 0 01-.537-2.925v-.58c0-1.196.189-2.279.566-3.25.376-.97.894-1.798 1.554-2.486a6.84 6.84 0 012.289-1.582 7.005 7.005 0 012.797-.566c1.103 0 2.078.189 2.925.566.848.367 1.56.88 2.134 1.54.575.668 1.008 1.464 1.3 2.388.292.923.438 1.93.438 3.023v1.456H75.362v.07c.103.67.263 1.23.48 1.682.217.452.513.857.89 1.215.377.377.82.669 1.328.876.518.207 1.084.31 1.696.31.838 0 1.62-.16 2.346-.48a4.71 4.71 0 001.794-1.398l1.808 1.752c-.508.734-1.29 1.394-2.345 1.978-1.046.584-2.313.876-3.8.876zm-.41-13.113c-.48 0-.927.09-1.342.269-.405.17-.768.414-1.088.735-.32.33-.589.725-.805 1.187a6.25 6.25 0 00-.48 1.568h7.191v-.226c0-.443-.08-.88-.24-1.314a3.545 3.545 0 00-.678-1.159 3.004 3.004 0 00-1.074-.763c-.424-.198-.919-.297-1.484-.297zM55.043 21.703V6.415h3.052l.212 2.176c.207-.292.433-.56.678-.805.255-.255.523-.48.806-.679a5.555 5.555 0 013.179-.975 6.5 6.5 0 012.148.34 4.11 4.11 0 011.667 1.073c.461.49.82 1.117 1.074 1.88.254.753.381 1.667.381 2.74v9.538h-3.377v-9.48c0-.632-.07-1.16-.212-1.583-.141-.424-.348-.763-.621-1.018a2.3 2.3 0 00-.99-.537 4.736 4.736 0 00-1.328-.17c-.414 0-.8.057-1.158.17a3.421 3.421 0 00-1.611 1.004 4.282 4.282 0 00-.523.706v10.908h-3.377zM38.44 6.415h8.111v12.49h4.493v2.798H38.441v-2.797h4.705v-9.68H38.44V6.416zm4.395-3.956c0-.274.047-.523.141-.75a1.69 1.69 0 01.41-.607c.17-.16.372-.282.607-.367.245-.094.519-.141.82-.141.509 0 .918.131 1.23.395.32.254.503.584.55.99.066.414-.004.776-.212 1.087-.207.302-.508.504-.904.608a1.48 1.48 0 01-.706.353c-.273.057-.575.033-.905-.07a1.396 1.396 0 01-.777-.552 1.758 1.758 0 01-.254-.946zM20.934 0h8.238v18.906h4.634v2.797H20.934v-2.797h4.832V2.812h-4.832V0zM16.71 15.373c-.095.999-.33 1.908-.707 2.727a6.672 6.672 0 01-1.484 2.077 6.542 6.542 0 01-2.218 1.357c-.848.31-1.79.466-2.826.466-.848 0-1.63-.113-2.346-.339a6.467 6.467 0 01-1.893-.99 6.55 6.55 0 01-1.413-1.426 9.438 9.438 0 01-1.003-1.851c-.274-.66-.48-1.375-.622-2.148A14.34 14.34 0 012 12.83v-2.812c0-.8.066-1.573.198-2.317.132-.744.33-1.446.593-2.106A8.284 8.284 0 013.88 3.603a7.296 7.296 0 011.555-1.54 6.953 6.953 0 011.836-.904A7.256 7.256 0 019.49.834c1.083 0 2.049.16 2.896.48.858.32 1.588.773 2.19 1.357a6.337 6.337 0 011.442 2.147c.358.839.588 1.771.692 2.798h-3.391a6.568 6.568 0 00-.353-1.653c-.17-.5-.405-.923-.707-1.272a2.977 2.977 0 00-1.144-.791c-.453-.188-.994-.283-1.625-.283-.443 0-.843.062-1.201.184-.349.122-.66.297-.933.523a3.385 3.385 0 00-.947 1.074 7.033 7.033 0 00-.607 1.455c-.123.471-.217.975-.283 1.512a15.25 15.25 0 00-.084 1.625v2.84c0 .688.037 1.333.113 1.936.084.602.212 1.154.381 1.653.132.414.297.791.495 1.13.207.34.452.631.734.876.292.264.627.466 1.004.608.386.132.824.198 1.314.198.584 0 1.102-.085 1.554-.255.452-.17.838-.419 1.159-.749.31-.32.56-.72.748-1.2.189-.481.311-1.032.368-1.654h3.405z"})]}))});function go(t){"@babel/helpers - typeof";return go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},go(t)}function kg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kg(Object(n),!0).forEach(function(r){bA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bA(t,e,n){return e=xA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xA(t){var e=yA(t,"string");return go(e)=="symbol"?e:String(e)}function yA(t,e){if(go(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(go(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var wA=m.memo(function(t){var e=Object.assign({},(vA(t),t));return d.jsx(xr,gA({Icon:zu,Text:O1,"aria-label":Go,iconProps:{shape:"square"},spaceMultiple:qD,textMultiple:GD},e))}),Li=zu;Li.Text=O1;Li.Combine=wA;Li.Avatar=cA;Li.colorPrimary=j1;Li.title=Go;var qo="Cursor",SA=.7,kA=.1,P1="#000",CA=P1,jA="#fff",OA=.6;function bo(t){"@babel/helpers - typeof";return bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bo(t)}var PA=["size","style"];function Cg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function bd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Cg(Object(n),!0).forEach(function(r){NA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Cg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function NA(t,e,n){return e=DA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function DA(t){var e=AA(t,"string");return bo(e)=="symbol"?e:String(e)}function AA(t,e){if(bo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(bo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function MA(t,e){if(t==null)return{};var n=TA(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function TA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Hu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=MA(t,PA);return d.jsxs("svg",bd(bd({fill:"currentColor",fillRule:"evenodd",height:n,style:bd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:qo}),d.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})]}))});function xo(t){"@babel/helpers - typeof";return xo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xo(t)}function jg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function EA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jg(Object(n),!0).forEach(function(r){RA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RA(t,e,n){return e=LA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LA(t){var e=IA(t,"string");return xo(e)=="symbol"?e:String(e)}function IA(t,e){if(xo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(xo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $A(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var BA=m.memo(function(t){var e=Object.assign({},($A(t),t));return d.jsx(br,EA({Icon:Hu,"aria-label":qo,background:CA,color:jA,iconMultiple:OA},e))});function yo(t){"@babel/helpers - typeof";return yo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yo(t)}var FA=["size","style"];function Og(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function xd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Og(Object(n),!0).forEach(function(r){zA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Og(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zA(t,e,n){return e=HA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HA(t){var e=VA(t,"string");return yo(e)=="symbol"?e:String(e)}function VA(t,e){if(yo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(yo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _A(t,e){if(t==null)return{};var n=WA(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function WA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var N1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=_A(t,FA);return d.jsxs("svg",xd(xd({fill:"currentColor",fillRule:"evenodd",height:n,style:xd({flex:"none",lineHeight:1},r),viewBox:"0 0 123 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:qo}),d.jsx("path",{d:"M11.995 2.33h6.516v3.582h-6.295C8.82 5.912 6.169 7.868 6.169 12c0 4.133 2.65 6.089 6.047 6.089h6.295v3.581H11.72C6.03 21.67 2 18.336 2 12c0-6.337 4.307-9.67 9.995-9.67zm9.829 0h4.03V14.15c0 2.947 1.354 4.325 4.53 4.325 3.175 0 4.528-1.377 4.528-4.325V2.33h4.03v12.644c0 4.297-2.733 7.025-8.559 7.025-5.826 0-8.56-2.755-8.56-7.052V2.33zm38.185 5.483c0 2.149-1.243 3.801-2.9 4.518v.055c1.74.248 2.624 1.488 2.65 3.169l.084 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.71v7.41h-4.03V2.33h11.127c3.644 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561H46.84v5.123h6.626c1.518 0 2.485-.909 2.485-2.562zm19.3 7.66c0-1.378-.884-1.957-2.209-2.067l-4.473-.413c-3.866-.358-5.881-1.873-5.881-5.537 0-3.664 2.485-5.675 6.046-5.675h9.885V5.8h-9.609c-1.38 0-2.263.717-2.263 2.094 0 1.378.91 2.039 2.291 2.15l4.556.385c3.452.303 5.715 1.874 5.715 5.565 0 3.691-2.402 5.675-5.798 5.675H63.184V18.2h9.94c1.297 0 2.126-.882 2.126-2.177zM91.097 2c6.074 0 9.912 3.884 9.912 9.972C101.01 18.061 97.006 22 90.932 22s-9.912-3.94-9.912-10.028C81.02 5.884 85.024 2 91.098 2zm5.743 10c0-4.077-2.374-6.474-5.826-6.474-3.451 0-5.826 2.397-5.826 6.474s2.375 6.473 5.826 6.473c3.452 0 5.826-2.396 5.826-6.473zM121 7.813c0 2.149-1.242 3.801-2.899 4.518v.055c1.739.248 2.623 1.488 2.65 3.169l.083 6.115h-4.031l-.083-5.454c-.027-1.212-.745-1.956-2.181-1.956h-6.709v7.41h-4.031V2.33h11.127c3.645 0 6.074 1.846 6.074 5.483zm-4.059.55c0-1.652-.883-2.561-2.54-2.561h-6.571v5.123h6.626c1.518 0 2.485-.909 2.485-2.562z"})]}))});function vo(t){"@babel/helpers - typeof";return vo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vo(t)}function Pg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pg(Object(n),!0).forEach(function(r){KA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KA(t,e,n){return e=GA(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GA(t){var e=qA(t,"string");return vo(e)=="symbol"?e:String(e)}function qA(t,e){if(vo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YA(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var JA=m.memo(function(t){var e=Object.assign({},(YA(t),t));return d.jsx(xr,UA({Icon:Hu,Text:N1,"aria-label":qo,spaceMultiple:kA,textMultiple:SA},e))}),Ii=Hu;Ii.Text=N1;Ii.Combine=JA;Ii.Avatar=BA;Ii.colorPrimary=P1;Ii.title=qo;var Yo="Goose",QA=.7,XA=.2,D1="#fff",ZA=D1,eM="#000",tM=.65;function wo(t){"@babel/helpers - typeof";return wo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wo(t)}var nM=["size","style"];function Ng(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function yd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ng(Object(n),!0).forEach(function(r){rM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rM(t,e,n){return e=iM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iM(t){var e=sM(t,"string");return wo(e)=="symbol"?e:String(e)}function sM(t,e){if(wo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(wo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oM(t,e){if(t==null)return{};var n=aM(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aM(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Vu=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=oM(t,nM);return d.jsxs("svg",yd(yd({fill:"currentColor",fillRule:"evenodd",height:n,style:yd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Yo}),d.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})]}))});function So(t){"@babel/helpers - typeof";return So=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},So(t)}function Dg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dg(Object(n),!0).forEach(function(r){cM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cM(t,e,n){return e=dM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dM(t){var e=hM(t,"string");return So(e)=="symbol"?e:String(e)}function hM(t,e){if(So(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(So(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uM(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var fM=m.memo(function(t){var e=Object.assign({},(uM(t),t));return d.jsx(br,lM({Icon:Vu,"aria-label":Yo,background:ZA,color:eM,iconMultiple:tM},e))});function ko(t){"@babel/helpers - typeof";return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ko(t)}var pM=["size","style"];function Ag(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ag(Object(n),!0).forEach(function(r){mM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ag(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mM(t,e,n){return e=gM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gM(t){var e=bM(t,"string");return ko(e)=="symbol"?e:String(e)}function bM(t,e){if(ko(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ko(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xM(t,e){if(t==null)return{};var n=yM(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function yM(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var A1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=xM(t,pM);return d.jsxs("svg",vd(vd({fill:"currentColor",fillRule:"evenodd",height:n,style:vd({flex:"none",lineHeight:1},r),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Yo}),d.jsx("path",{d:"M17.122 16.607c0 4.696-3.219 7.393-7.774 7.393-3.674 0-6.255-1.546-7.257-4.637l3.401-1.21c.486 1.786 1.852 2.907 3.856 2.907 2.46 0 4.13-1.211 4.13-4.12v-1.122c-.85 1.121-2.46 2-4.494 2C4.61 17.818 2 14.273 2 9.909 2 5.546 4.611 2 8.984 2c2.004 0 3.644.879 4.494 2V2.303h3.644v14.303zm-3.583-6.85c0-2.908-1.58-4.575-3.857-4.575-2.52 0-4.008 1.757-4.008 4.727 0 2.94 1.488 4.727 4.008 4.727 2.278 0 3.857-1.666 3.857-4.515v-.363zM35.546 10.273c0 4.94-3.188 8.273-7.683 8.273-4.494 0-7.682-3.334-7.682-8.273C20.181 5.333 23.37 2 27.863 2c4.495 0 7.683 3.333 7.683 8.273zm-11.69 0c0 3.242 1.548 5.212 4.007 5.212 2.46 0 4.009-1.97 4.009-5.212 0-3.243-1.549-5.212-4.009-5.212-2.46 0-4.008 1.97-4.008 5.212zM52.957 10.273c0 4.94-3.188 8.273-7.682 8.273s-7.682-3.334-7.682-8.273C37.593 5.333 40.78 2 45.275 2s7.682 3.333 7.682 8.273zm-11.69 0c0 3.242 1.548 5.212 4.008 5.212s4.008-1.97 4.008-5.212c0-3.243-1.549-5.212-4.008-5.212-2.46 0-4.008 1.97-4.008 5.212zM54.336 15.182L57.069 13c.941 1.546 2.763 2.576 4.615 2.576 1.549 0 2.976-.546 2.976-1.97 0-1.364-1.336-1.515-3.856-2.03-2.52-.515-5.405-1.152-5.405-4.546 0-2.909 2.55-5.03 6.224-5.03 2.794 0 5.284 1.242 6.438 3L65.6 7.212c-.91-1.424-2.429-2.242-4.19-2.242-1.488 0-2.46.666-2.46 1.727 0 1.152 1.154 1.364 3.158 1.788 2.703.576 6.104 1.151 6.104 4.788 0 3.211-2.946 5.273-6.56 5.273-2.945 0-5.89-1.182-7.317-3.364zM77.965 18.546c-4.555 0-7.743-3.364-7.743-8.273 0-4.667 3.157-8.273 7.59-8.273 4.616 0 7.076 3.485 7.076 7.849v1.212H73.713c.274 2.727 1.913 4.394 4.252 4.394 1.791 0 3.218-.91 3.704-2.546l3.128 1.182c-1.124 2.787-3.644 4.455-6.832 4.455zm-.183-13.485c-1.882 0-3.34 1.12-3.886 3.272h7.318c-.03-1.757-1.124-3.272-3.432-3.272z"})]}))});function Co(t){"@babel/helpers - typeof";return Co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Co(t)}function Mg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mg(Object(n),!0).forEach(function(r){wM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wM(t,e,n){return e=SM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SM(t){var e=kM(t,"string");return Co(e)=="symbol"?e:String(e)}function kM(t,e){if(Co(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CM(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var jM=m.memo(function(t){var e=Object.assign({},(CM(t),t));return d.jsx(xr,vM({Icon:Vu,Text:A1,"aria-label":Yo,iconProps:{shape:"square"},spaceMultiple:XA,textMultiple:QA},e))}),$i=Vu;$i.Text=A1;$i.Combine=jM;$i.Avatar=fM;$i.colorPrimary=D1;$i.title=Yo;var Jo="Windsurf",OM=.7,PM=.2,M1="#fff",NM=M1,DM="#000",AM=.75;function jo(t){"@babel/helpers - typeof";return jo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jo(t)}var MM=["size","style"];function Tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){TM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TM(t,e,n){return e=EM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EM(t){var e=RM(t,"string");return jo(e)=="symbol"?e:String(e)}function RM(t,e){if(jo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(jo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LM(t,e){if(t==null)return{};var n=IM(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function IM(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var _u=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=LM(t,MM);return d.jsxs("svg",wd(wd({fill:"currentColor",fillRule:"evenodd",height:n,style:wd({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Jo}),d.jsx("path",{clipRule:"evenodd",d:"M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"})]}))});function Oo(t){"@babel/helpers - typeof";return Oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oo(t)}function Eg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $M(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Eg(Object(n),!0).forEach(function(r){BM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Eg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function BM(t,e,n){return e=FM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FM(t){var e=zM(t,"string");return Oo(e)=="symbol"?e:String(e)}function zM(t,e){if(Oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Oo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HM(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var VM=m.memo(function(t){var e=Object.assign({},(HM(t),t));return d.jsx(br,$M({Icon:_u,"aria-label":Jo,background:NM,color:DM,iconMultiple:AM},e))});function Po(t){"@babel/helpers - typeof";return Po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Po(t)}var _M=["size","style"];function Rg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Sd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Rg(Object(n),!0).forEach(function(r){WM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function WM(t,e,n){return e=UM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UM(t){var e=KM(t,"string");return Po(e)=="symbol"?e:String(e)}function KM(t,e){if(Po(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Po(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GM(t,e){if(t==null)return{};var n=qM(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qM(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var T1=m.memo(function(t){var e=t.size,n=e===void 0?"1em":e,r=t.style,i=GM(t,_M);return d.jsxs("svg",Sd(Sd({fill:"currentColor",fillRule:"evenodd",height:n,style:Sd({flex:"none",lineHeight:1},r),viewBox:"0 0 111 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[d.jsx("title",{children:Jo}),d.jsx("path",{clipRule:"evenodd",d:"M33.412 7.182h-1.715a.316.316 0 00-.315.316v13.79c0 .174.14.316.315.316h1.715a.316.316 0 00.316-.317V7.498a.316.316 0 00-.316-.316zm-1.772-5.18h1.828c.174 0 .315.141.315.316V4.57a.316.316 0 01-.315.316H31.64a.316.316 0 01-.315-.316V2.318c0-.175.141-.317.315-.317zM43.676 6.79c-1.927 0-3.324.671-4.218 1.653a.457.457 0 01-.782-.322v-.623a.316.316 0 00-.316-.316h-1.686a.316.316 0 00-.316.316v13.79c0 .174.142.316.316.316h1.687a.316.316 0 00.316-.317v-8.729c0-3.025.587-3.697 3.8-3.697s3.742.533 3.742 3.557v8.868c0 .175.142.317.316.317h1.715a.316.316 0 00.316-.317v-9.513c0-3.445-1.956-4.986-4.889-4.986v.003h-.001zm17.518 1.849a.457.457 0 00.782-.322V2.319c0-.175.142-.316.316-.316h1.687c.174 0 .316.141.316.316v18.97a.316.316 0 01-.316.316h-1.687a.316.316 0 01-.316-.316v-.819c.017-.418-.489-.62-.782-.322-.81 1.008-2.374 1.848-4.47 1.848-3.685 0-6.088-2.632-6.088-7.533 0-5.18 2.68-7.673 6.172-7.673 2.095 0 3.604.84 4.386 1.849zm-8.018 5.767c0 4.733.587 5.434 4.414 5.434 3.8 0 4.386-.701 4.386-5.434 0-4.733-.559-5.461-4.386-5.461s-4.414.728-4.414 5.461zm20.924-.894l-2.763-.476c-2.04-.364-2.404-.98-2.404-2.045.028-1.457.587-2.184 3.296-2.184 2.538 0 3.35.752 3.525 2.376.017.16.152.284.313.284h1.677c.18 0 .326-.151.316-.333-.163-2.788-2.709-4.346-5.746-4.346-3.408 0-5.67 1.82-5.67 4.426 0 2.38 1.844 3.417 4.05 3.837l3.046.56c1.676.31 2.235.87 2.235 1.933 0 1.709-.587 2.437-3.464 2.437s-3.673-.832-3.858-2.518a.315.315 0 00-.313-.282h-1.687a.318.318 0 00-.317.325c.08 3.004 2.797 4.493 6.034 4.493 3.52 0 5.949-1.82 5.949-4.566 0-2.408-1.845-3.501-4.219-3.921zm12.21 6.414c3.128 0 3.715-.672 3.715-3.697V7.502c0-.174.141-.316.316-.316h1.714c.175 0 .316.142.316.316v13.79a.316.316 0 01-.316.316h-1.714a.316.316 0 01-.316-.317v-.6c-.007-.429-.45-.642-.755-.343-.892.98-2.289 1.652-4.161 1.652-2.877 0-4.833-1.54-4.833-4.986V7.501c0-.175.142-.317.316-.317h1.715c.174 0 .316.142.316.317v8.868c0 3.024.558 3.557 3.687 3.557zm19.782-12.744v-1.85c0-.727.588-1.316 1.314-1.316h1.276a.316.316 0 00.315-.317V2.317a.316.316 0 00-.315-.317h-.885c-2.514 0-4.051 1.4-4.051 3.81v1.372h-1.859c-1.647.002-2.94.229-3.803 1.26-.317.302-.755.076-.755-.36V7.5a.316.316 0 00-.315-.317h-1.715a.316.316 0 00-.316.317v13.789c0 .174.141.316.316.316h1.715a.316.316 0 00.315-.316v-8.645c0-2.857.727-3.528 3.855-3.528h2.562V21.29c0 .175.141.317.316.317h1.715a.316.316 0 00.315-.317V9.116h2.593a.316.316 0 00.315-.317V7.501a.316.316 0 00-.315-.317h-2.593v-.002zM21.834 18.008a.561.561 0 001.091.005l3.933-15.772A.318.318 0 0127.166 2h1.963c.21 0 .363.199.31.403l-4.947 18.972a.305.305 0 01-.295.228h-3.502a.31.31 0 01-.3-.234L16.285 5.5a.56.56 0 00-.543-.42h-.036a.562.562 0 00-.542.42l-4.11 15.87a.31.31 0 01-.299.234H7.253a.304.304 0 01-.295-.228L2.011 2.403A.321.321 0 012.32 2h1.963c.145 0 .272.1.308.241l3.932 15.772a.56.56 0 001.09-.005l3.78-15.764A.316.316 0 0113.7 2h4.047c.146 0 .273.1.307.244l3.779 15.764z"})]}))});function No(t){"@babel/helpers - typeof";return No=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},No(t)}function Lg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function YM(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lg(Object(n),!0).forEach(function(r){JM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JM(t,e,n){return e=QM(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QM(t){var e=XM(t,"string");return No(e)=="symbol"?e:String(e)}function XM(t,e){if(No(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(No(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ZM(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var eT=m.memo(function(t){var e=Object.assign({},(ZM(t),t));return d.jsx(xr,YM({Icon:_u,Text:T1,"aria-label":Jo,iconProps:{shape:"square"},spaceMultiple:PM,textMultiple:OM},e))}),Bi=_u;Bi.Text=T1;Bi.Combine=eT;Bi.Avatar=VM;Bi.colorPrimary=M1;Bi.title=Jo;const tT={"claude-code":Vr.Avatar,cursor:Ii.Avatar,codex:Ht.Avatar,"gemini-cli":_r.Avatar,goose:$i.Avatar,"github-copilot":Ri.Avatar,windsurf:Bi.Avatar,cline:Li.Avatar},nT={antigravity:"/agents/antigravity.png",droid:"/agents/droid.png",opencode:"/agents/opencode.svg",amp:"/agents/amp.png",kilo:"/agents/kilo.png",roo:"/agents/roo.png",openhands:"/agents/openhands.png"};function rT(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}const E1=({agentName:t,displayName:e,size:n=20})=>{const r=tT[t];if(r)return d.jsx(r,{size:n});const i=nT[t];return i?d.jsx("img",{src:i,alt:e,className:"rounded object-contain",style:{width:n,height:n}}):d.jsx("div",{className:"flex items-center justify-center rounded bg-dash-surface-hover text-dash-text-muted font-semibold",style:{width:n,height:n,fontSize:n*.45},children:rT(e)})};function kd(t){return JSON.stringify([t.provider,t.type,t.item,t.global])}function iT(t){if(typeof t=="string"){const e=t.trim();return e.length>0?e:null}if(typeof t=="object"&&t!==null){const e=t;for(const n of["message","error","detail","details","reason"]){const r=e[n];if(typeof r=="string"&&r.trim().length>0)return r.trim()}}return null}async function Ig(t,e){const r=(await t.text().catch(()=>"")).trim();if(!r)return e;try{const i=JSON.parse(r);return iT(i)||e}catch{return r}}function sT(){const[t,e]=m.useState("idle"),[n,r]=m.useState(null),[i,s]=m.useState(new Map),[o,a]=m.useState(null),[l,c]=m.useState(null),h=m.useRef(0),u=m.useRef(0),f=m.useRef(null),p=m.useRef(null),g=m.useCallback(async k=>{e("reconciling"),c(null),a(null),h.current+=1;const j=h.current;f.current?.abort();const S=new AbortController;f.current=S;try{const C=new URLSearchParams({providers:k.providers.join(","),global:String(k.global),agents:String(k.include.agents??!0),commands:String(k.include.commands??!0),skills:String(k.include.skills??!0),config:String(k.include.config??!0),rules:String(k.include.rules??!0),hooks:String(k.include.hooks??!0)});k.source&&C.set("source",k.source);const y=await fetch(`/api/migrate/reconcile?${C.toString()}`,{signal:S.signal});if(!y.ok){const A=await Ig(y,"Failed to reconcile migration plan");throw new Error(A)}const N=await y.json();if(j!==h.current)return;r(N.plan),s(new Map),e("reviewing")}catch(C){if(S.signal.aborted||C instanceof DOMException&&C.name==="AbortError"||j!==h.current)return;c(C instanceof Error?C.message:"Failed to reconcile"),e("error")}},[]),b=m.useCallback((k,j)=>{s(S=>{const C=new Map(S);return C.set(kd(k),j),C})},[]),x=m.useCallback(async()=>{if(!n)return c("No plan to execute"),e("error"),!1;e("executing"),c(null),u.current+=1;const k=u.current;p.current?.abort();const j=new AbortController;p.current=j;try{const S=Object.fromEntries(i.entries()),C=await fetch("/api/migrate/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:n,resolutions:S}),signal:j.signal});if(k!==u.current)return!1;if(!C.ok){const N=await Ig(C,"Failed to execute migration");if(C.status===501)return c(N||"Plan execution is not available in this server build"),e("reviewing"),!1;throw new Error(N)}const y=await C.json();return k!==u.current?!1:(a({results:y.results,counts:y.counts,warnings:y.warnings??[],discovery:y.discovery}),e("complete"),!0)}catch(S){return j.signal.aborted||S instanceof DOMException&&S.name==="AbortError"||k!==u.current||(c(S instanceof Error?S.message:"Failed to execute migration"),e("error")),!1}},[n,i]),w=m.useCallback(()=>{f.current?.abort(),p.current?.abort(),e("idle"),r(null),s(new Map),a(null),c(null)},[]),v=m.useMemo(()=>n?n.actions.filter(k=>k.action==="conflict").every(k=>i.has(kd(k))):!0,[n,i]);return{phase:t,plan:n,resolutions:i,results:o,error:l,reconcile:g,resolve:b,execute:x,reset:w,allConflictsResolved:v,actionKey:kd}}const oT={agents:!0,commands:!0,skills:!0,config:!0,rules:!0,hooks:!0},Kt=["agents","commands","skills","config","rules","hooks"],Nr={agents:"migrateTypeAgents",commands:"migrateTypeCommands",skills:"migrateTypeSkills",config:"migrateTypeConfig",rules:"migrateTypeRules",hooks:"migrateTypeHooks"},$g={detected:"#D4A574","not-detected":"#8B9DC3"},jt=({label:t,value:e,tone:n="default"})=>{const r=n==="accent"?"text-dash-accent":n==="success"?"text-green-400":"text-dash-text";return d.jsxs("div",{className:"rounded-lg border border-dash-border bg-dash-bg/70 px-3 py-2.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t}),d.jsx("p",{className:`mt-1 text-lg font-semibold ${r}`,children:e})]})};function Bg(t,e){return t.success?t.skipped?{label:e("migrateStatusSkipped"),className:"text-yellow-400"}:{label:e("migrateStatusInstalled"),className:"text-green-400"}:{label:e("migrateStatusFailed"),className:"text-red-400"}}const aT=new Set([8203,8204,8205,8288,65279,8232,8233,8234,8235,8236,8237,8238,8294,8295,8296,8297]);function lT(t){return t===9||t===10||t===13?!0:t>=0&&t<=8||t>=11&&t<=31||t>=127&&t<=159||aT.has(t)}function Fg(t){let e="";for(const n of t){const r=n.codePointAt(0);r!==void 0&&(lT(r)||(e+=n))}return e}const cT=({provider:t,include:e,isSelected:n,cardClickToggles:r,onToggleSelect:i,onOpenDetails:s,t:o})=>{const a=Kt.filter(c=>t.capabilities[c]).length,l=Kt.some(c=>e[c]&&!t.capabilities[c]);return d.jsxs("div",{className:`relative rounded-xl border px-4 py-3 cursor-pointer transition-all ${n?"bg-dash-accent-subtle border-dash-accent/30 shadow-sm shadow-dash-accent/10":l?"bg-dash-surface border-yellow-500/25 hover:bg-dash-surface-hover hover:border-yellow-500/40":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-accent/25"}`,children:[d.jsx("button",{type:"button",onClick:()=>r?i(t.name):s(t.name),"aria-label":r?`${t.displayName} deselect`:`${t.displayName} details`,className:"absolute inset-0 z-10 rounded-xl dash-focus-ring"}),d.jsxs("div",{className:"relative flex flex-col gap-3 lg:grid lg:grid-cols-[minmax(0,1.25fr)_140px_minmax(0,220px)_auto] lg:items-center lg:gap-4",children:[d.jsxs("div",{className:"min-w-0 space-y-1.5",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(E1,{agentName:t.name,displayName:t.displayName,size:18}),d.jsx("span",{className:"text-sm font-semibold text-dash-text truncate",children:t.displayName}),t.recommended&&d.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")}),t.commandsGlobalOnly&&d.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-yellow-500/30 text-yellow-400",children:o("migrateGlobalOnlyCommandsShort")})]}),d.jsxs("div",{className:"text-xs text-dash-text-muted truncate",children:[t.name," · ",a,"/",Kt.length," ",o("migrateCapabilitiesLabel")]})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] lg:flex-col lg:items-start lg:gap-1",children:[d.jsx("span",{className:t.detected?"text-dash-accent":"text-dash-text-muted",children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),d.jsx("span",{className:"text-dash-text-muted",children:t.recommended?o("migrateFilterRecommended"):"-"})]}),d.jsx("div",{className:"flex flex-wrap gap-1",children:Kt.map(c=>{const h=t.capabilities[c],u=e[c];return d.jsx("span",{className:`text-[10px] uppercase px-1.5 py-0.5 rounded border ${h&&u?"border-dash-accent/45 text-dash-accent":h?"border-dash-border text-dash-text-secondary":"border-dash-border text-dash-text-muted opacity-60"}`,children:o(Nr[c])},c)})}),d.jsx("div",{className:"relative z-20 flex justify-start lg:justify-end",children:d.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),i(t.name)},className:`dash-focus-ring px-4 py-1.5 text-xs font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateSelectedButton":"migrateSelectButton")})})]})]})},dT=({provider:t,include:e,isSelected:n,latestResult:r,onToggleSelect:i,onClose:s,t:o})=>{const a=m.useRef(null),l=m.useRef(null),c=m.useCallback(()=>{const f=l.current;l.current=null,f&&document.contains(f)&&f.focus()},[]),h=m.useCallback(()=>{s(),c()},[s,c]),u=m.useCallback(()=>{const f=a.current;if(f?.open){f.close();return}s(),c()},[s,c]);return m.useEffect(()=>{const f=a.current;if(f){if(!f.open){l.current=document.activeElement instanceof HTMLElement?document.activeElement:null;try{f.showModal()}catch{c(),s()}}return()=>{if(f.open){f.close();return}c()}}},[s,c]),d.jsx("dialog",{ref:a,"aria-label":t.displayName,onClose:h,onCancel:f=>{f.preventDefault(),u()},onClick:f=>{f.target===f.currentTarget&&u()},className:"fixed inset-0 z-50 m-0 h-full max-h-none w-full max-w-none overflow-hidden border-0 bg-transparent p-0 backdrop:bg-black/50",children:d.jsxs("div",{className:"ml-auto h-full w-full sm:w-[460px] bg-dash-surface border-l border-dash-border shadow-2xl flex flex-col animate-slide-in",children:[d.jsx("div",{className:"px-6 py-5 border-b border-dash-border",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2.5",children:[d.jsx(E1,{agentName:t.name,displayName:t.displayName,size:22}),d.jsx("h2",{className:"text-xl font-bold text-dash-text truncate",children:t.displayName})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[d.jsx("span",{className:"text-[11px] text-dash-text-muted font-mono",children:t.name}),d.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border ${t.detected?"border-dash-accent/30 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:t.detected?o("migrateDetectedTag"):o("migrateNotDetectedTag")}),t.recommended&&d.jsx("span",{className:"text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:o("migrateFilterRecommended")})]})]}),d.jsx("button",{type:"button",onClick:u,"aria-label":o("detailPanelClose"),className:"w-8 h-8 flex items-center justify-center rounded-md text-dash-text-muted hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:d.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18",strokeWidth:2}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18",strokeWidth:2})]})})]})}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateCapabilitiesSection")}),d.jsx("div",{className:"space-y-1.5",children:Kt.map(f=>{const p=t.capabilities[f],g=e[f];return d.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-dash-bg rounded-md",children:[d.jsx("span",{className:"text-sm text-dash-text",children:o(Nr[f])}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${g?"border-dash-accent/35 text-dash-accent":"border-dash-border text-dash-text-muted"}`,children:o(g?"migrateIncludedEnabled":"migrateIncludedDisabled")}),d.jsx("span",{className:`text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${p?"border-green-500/35 text-green-400":"border-red-500/30 text-red-400"}`,children:o(p?"migrateSupported":"migrateUnsupportedShort")})]})]},f)})})]}),t.commandsGlobalOnly&&e.commands&&d.jsx("div",{className:"px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-xs text-yellow-400",children:o("migrateGlobalForced")}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wide text-dash-text-muted mb-2.5",children:o("migrateLatestTarget")}),r?d.jsxs("div",{className:"px-3 py-2 bg-dash-bg rounded-md border border-dash-border space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-dash-text-muted",children:o("migrateStatus")}),d.jsx("span",{className:`text-xs font-semibold ${Bg(r,o).className}`,children:Bg(r,o).label})]}),d.jsx("p",{className:"text-xs font-mono text-dash-text break-all",children:Fg(r.path||"-")}),(r.error||r.skipReason)&&d.jsx("p",{className:"text-xs text-red-400 break-words",children:Fg(r.error||r.skipReason||"-")})]}):d.jsx("p",{className:"text-sm text-dash-text-muted",children:o("migrateNoResultForProvider")})]})]}),d.jsxs("div",{className:"px-6 py-4 border-t border-dash-border flex items-center justify-between gap-2",children:[d.jsx("button",{type:"button",onClick:()=>i(t.name),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors ${n?"bg-transparent text-dash-text-secondary border border-dash-border hover:bg-dash-surface-hover":"bg-dash-accent text-white hover:bg-dash-accent/90"}`,children:o(n?"migrateUnselectProvider":"migrateSelectProviderAction")}),d.jsx("button",{type:"button",onClick:u,"aria-label":o("detailPanelClose"),className:"px-4 py-2 text-sm font-medium rounded-md border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover",children:o("detailPanelClose")})]})]})})},hT=()=>{const{t}=he(),e=sT(),[n,r]=m.useState([]),[i,s]=m.useState(null),[o,a]=m.useState([]),[l,c]=m.useState(oT),[h,u]=m.useState(!0),[f,p]=m.useState(!0),[g,b]=m.useState(!1),[x,w]=m.useState(null),[v,k]=m.useState(""),j=m.useDeferredValue(v),[S,C]=m.useState("all"),[y,N]=m.useState(null),A=m.useRef(0),T=m.useCallback(async($=!1)=>{A.current+=1;const K=A.current;try{$?b(!0):p(!0),w(null);const[ce,Ne]=await Promise.all([z2(),kf()]);if(K!==A.current)return;r(ce.providers),s(Ne),a(Tt=>{if(Tt.length===0)return[];const Un=ce.providers.map(Ct=>Ct.name);return Tt.filter(Ct=>Un.includes(Ct))})}catch(ce){if(K!==A.current)return;w(ce instanceof Error?ce.message:t("migrateDetectFailed"))}finally{K===A.current&&(p(!1),b(!1))}},[t]);m.useEffect(()=>{T()},[T]);const P=m.useMemo(()=>{const $=new Map;for(const K of n)$.set(K.name,K);return $},[n]),R=m.useMemo(()=>y&&P.get(y)||null,[y,P]);m.useEffect(()=>{y&&!P.has(y)&&N(null)},[y,P]);const z=m.useCallback(()=>{N(null)},[]),I=m.useMemo(()=>new Set(o),[o]),F=m.useMemo(()=>n.filter($=>$.detected).length,[n]),G=o.length,ae=m.useMemo(()=>n.filter($=>$.recommended).length,[n]),X=m.useMemo(()=>Kt.filter($=>l[$]).length,[l]),Q=m.useMemo(()=>{const $=[];l.commands&&o.includes("codex")&&!h&&P.get("codex")?.commandsGlobalOnly&&$.push(t("migrateGlobalForced"));for(const K of Kt){if(!l[K])continue;const ce=o.filter(Ne=>!P.get(Ne)?.capabilities[K]).map(Ne=>P.get(Ne)?.displayName||Ne);ce.length>0&&$.push(`${t("migrateUnsupported")}: ${t(Nr[K])} -> ${ce.join(", ")}`)}return $},[l,h,P,o,t]),le=m.useCallback($=>{if($==="codex"){a(["codex"]);return}if($==="antigravity"){a(["antigravity"]);return}if($==="core"){const ce=["codex","antigravity","droid"].filter(Ne=>n.some(Tt=>Tt.name===Ne));a(ce);return}const K=n.filter(ce=>ce.detected).map(ce=>ce.name);a(K)},[n]),fe=m.useCallback($=>{a(K=>K.includes($)?K.filter(ce=>ce!==$):[...K,$])},[]),W=m.useCallback($=>{c(K=>({...K,[$]:!K[$]}))},[]),se=m.useMemo(()=>{const $=[...n];return $.sort((K,ce)=>{const Ne=I.has(K.name),Tt=I.has(ce.name);return Ne!==Tt?Ne?-1:1:K.detected!==ce.detected?K.detected?-1:1:K.recommended!==ce.recommended?K.recommended?-1:1:K.displayName.localeCompare(ce.displayName)}),$},[n,I]),ue=m.useMemo(()=>{const $=j.trim().toLowerCase();return se.filter(K=>{if(S==="selected"&&!I.has(K.name)||S==="detected"&&!K.detected||S==="recommended"&&!K.recommended||S==="not-detected"&&K.detected)return!1;if(!$)return!0;const ce=Kt.filter(Ne=>K.capabilities[Ne]).map(Ne=>t(Nr[Ne]).toLowerCase());return K.displayName.toLowerCase().includes($)||K.name.toLowerCase().includes($)||ce.some(Ne=>Ne.includes($))})},[j,S,I,se,t]),xe=m.useMemo(()=>{const $=ue.filter(Ne=>Ne.detected),K=ue.filter(Ne=>!Ne.detected),ce=[];return $.length>0&&ce.push({key:"detected",label:t("migrateDetectedTag"),providers:$}),K.length>0&&ce.push({key:"not-detected",label:t("migrateNotDetectedTag"),providers:K}),ce},[ue,t]),Pe=m.useMemo(()=>({all:n.length,selected:G,detected:n.filter($=>$.detected).length,recommended:n.filter($=>$.recommended).length,"not-detected":n.filter($=>!$.detected).length}),[n,G]),Qe=m.useMemo(()=>ue.map($=>$.name),[ue]),U=m.useCallback(()=>{a($=>{const K=new Set($);for(const ce of Qe)K.add(ce);return Array.from(K)})},[Qe]),ve=m.useCallback(()=>{a([])},[]),ee=m.useCallback(async()=>{if(o.length===0){w(t("migrateSelectProvider"));return}if(X===0){w(t("migrateNoTypesEnabled"));return}await e.reconcile({providers:o,global:h,include:l})},[X,l,h,o,t,e]),Ae=m.useCallback(async()=>{if(w(null),!!await e.execute())try{const K=await kf();s(K)}catch(K){console.error("Failed to refresh discovery:",K)}},[e]),pe=m.useMemo(()=>{const $=new Map;if(!e.results)return $;for(const K of e.results.results)$.set(K.provider,K);return $},[e.results]);m.useEffect(()=>{const $=K=>{const ce=K.target,Ne=!!(ce&&(ce instanceof HTMLInputElement||ce instanceof HTMLTextAreaElement||ce.isContentEditable||ce.closest('[contenteditable="true"], [role="textbox"]'))),Tt=K.metaKey||K.ctrlKey||K.altKey;K.key==="/"&&!Ne&&!Tt&&(K.preventDefault(),document.getElementById("migrate-search")?.focus())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[]);const _e=e.phase==="idle"&&o.length>0&&X>0;return f?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),d.jsx("p",{className:"text-dash-text-muted",children:t("migrateDiscovering")})]})}):d.jsxs("div",{className:"relative h-full overflow-hidden",children:[d.jsxs("div",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden",children:[d.jsx("div",{className:"absolute -top-24 -right-8 h-64 w-64 rounded-full bg-dash-accent/10 blur-3xl"}),d.jsx("div",{className:"absolute -bottom-28 -left-10 h-72 w-72 rounded-full bg-dash-accent/5 blur-3xl"})]}),d.jsxs("div",{className:"h-full overflow-y-auto space-y-4 pb-8",children:[d.jsx("section",{className:"dash-panel dash-sticky-glass sticky top-0 z-20 px-4 py-4 md:px-6 md:py-5",children:d.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-end xl: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:t("migrate")}),d.jsx("h1",{className:"text-xl md:text-2xl font-semibold text-dash-text",children:t("migrateTitle")}),d.jsx("p",{className:"text-sm text-dash-text-secondary max-w-3xl",children:t("migrateSubtitle")})]}),e.phase==="complete"&&e.results?d.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[d.jsx(jt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),d.jsx(jt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),d.jsx(jt,{label:t("migrateFailed"),value:e.results.counts.failed})]}):d.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[d.jsx(jt,{label:t("migrateTypeAgents"),value:i?.counts.agents??0}),d.jsx(jt,{label:t("migrateDetectedProviders"),value:F,tone:"success"}),d.jsx(jt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),d.jsx(jt,{label:t("migrateTypes"),value:X})]})]})}),x&&d.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:x}),d.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(0,340px)]",children:[d.jsxs("section",{className:"order-2 xl:order-1 space-y-4",children:[e.phase==="reviewing"&&e.plan&&d.jsxs("div",{className:"dash-panel flex flex-col max-h-[calc(100vh-200px)]",children:[d.jsxs("div",{className:"flex items-center justify-between p-5 pb-4",children:[d.jsx("h2",{className:"text-lg font-semibold text-dash-text",children:t("migrateReviewPlan")}),d.jsx("button",{type:"button",onClick:()=>e.reset(),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:t("cancel")})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-4",children:[d.jsx(qP,{plan:e.plan,resolutions:e.resolutions,onResolve:e.resolve,actionKey:e.actionKey}),e.error&&d.jsx("div",{className:"mt-4 px-3 py-2 border border-red-500/30 bg-red-500/10 rounded text-xs text-red-400",children:e.error})]}),d.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-dash-border bg-dash-surface rounded-b-xl",children:[e.plan.hasConflicts&&!e.allConflictsResolved&&d.jsx("p",{className:"text-xs text-yellow-400",children:t("migrateResolveConflicts")}),d.jsx("button",{type:"button",onClick:Ae,disabled:e.plan.hasConflicts&&!e.allConflictsResolved,className:"dash-focus-ring px-4 py-2 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t("migrateExecutePlan")})]})]}),e.phase==="complete"&&e.results&&d.jsx(RP,{results:e.results,onReset:e.reset}),e.phase==="error"&&e.error&&d.jsxs("div",{className:"dash-panel p-5",children:[d.jsx("div",{className:"px-4 py-3 border border-red-500/30 bg-red-500/10 rounded-lg text-sm text-red-400",children:e.error}),d.jsx("button",{type:"button",onClick:e.reset,className:"mt-4 dash-focus-ring px-4 py-2 bg-dash-bg border border-dash-border rounded-md text-sm text-dash-text-secondary hover:bg-dash-surface-hover",children:t("tryAgain")})]}),(e.phase==="reconciling"||e.phase==="executing")&&d.jsx("div",{className:"dash-panel p-5",children:d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-8 h-8 border-4 border-dash-accent border-t-transparent rounded-full animate-spin mx-auto mb-3"}),d.jsx("p",{className:"text-dash-text-muted",children:e.phase==="reconciling"?t("migrateReconciling"):t("migrateExecuting")})]})})}),e.phase==="idle"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[d.jsxs("div",{className:"relative flex-1",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",{id:"migrate-search",type:"text",value:v,onChange:$=>k($.target.value),placeholder:t("migrateSearchProviders"),className:"dash-focus-ring w-full pl-9 pr-12 py-2 bg-dash-bg border border-dash-border rounded-lg text-dash-text text-sm focus:border-dash-accent transition-colors"}),d.jsx("span",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[11px] text-dash-text-muted bg-dash-surface-hover border border-dash-border px-1.5 py-0.5 rounded",children:t("searchShortcut")})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>T(!0),disabled:g,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t(g?"checking":"migrateRefresh")}),d.jsx("button",{type:"button",onClick:U,disabled:Qe.length===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateSelectVisible")}),d.jsx("button",{type:"button",onClick:ve,disabled:G===0,className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover disabled:opacity-50 whitespace-nowrap",children:t("migrateClearSelection")})]})]}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"all",label:t("categoryAll")},{key:"selected",label:t("migrateSelectedProviders")},{key:"detected",label:t("migrateDetectedProviders")},{key:"recommended",label:t("migrateFilterRecommended")},{key:"not-detected",label:t("migrateNotDetectedTag")}].map($=>d.jsxs("button",{type:"button",onClick:()=>C($.key),className:`dash-focus-ring px-3 py-1 text-xs font-medium rounded-full border transition-all whitespace-nowrap ${S===$.key?"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:[$.label,d.jsx("span",{className:"opacity-60 ml-1 text-[10px]",children:Pe[$.key]})]},$.key))}),d.jsxs("div",{children:[d.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Kt.map($=>d.jsx("button",{type:"button",onClick:()=>W($),className:`dash-focus-ring px-2.5 py-1 text-[11px] uppercase tracking-wide rounded-md border transition-colors ${l[$]?"border-dash-accent/45 text-dash-accent bg-dash-accent/5":"border-dash-border text-dash-text-muted hover:bg-dash-surface-hover"}`,children:t(Nr[$])},$))})]})]}),d.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[d.jsx("h2",{className:"text-sm font-semibold text-dash-text mb-4",children:t("migrateSourceSummary")}),d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:Kt.map($=>d.jsxs("div",{className:"px-3 py-2 bg-dash-bg border border-dash-border rounded-md text-center",children:[d.jsx("p",{className:"text-[11px] uppercase tracking-wide text-dash-text-muted",children:t(Nr[$])}),d.jsx("p",{className:"text-lg font-semibold text-dash-text",children:i?.counts[$]??0})]},$))})]}),d.jsxs("div",{className:"dash-panel p-4 md:p-5",children:[d.jsxs("div",{className:"flex items-center justify-between mb-4",children:[d.jsx("h2",{className:"text-sm font-semibold text-dash-text",children:t("migrateProvidersHeading")}),d.jsxs("p",{className:"text-xs text-dash-text-muted",children:[ue.length," ",t("migrateProvidersCountSuffix")]})]}),n.length===0?d.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProviders")}):ue.length===0?d.jsx("div",{className:"text-sm text-dash-text-muted",children:t("migrateNoProvidersMatch")}):d.jsx("div",{className:"space-y-5",children:xe.map($=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[d.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:$g[$.key]}}),d.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:$g[$.key]},children:$.label}),d.jsxs("span",{className:"text-[11px] text-dash-text-muted ml-auto",children:[$.providers.length," ",t("migrateProvidersCountSuffix")]}),d.jsx("div",{className:"flex-1 h-px bg-dash-border ml-3"})]}),d.jsx("div",{className:"space-y-2",children:$.providers.map(K=>d.jsx(cT,{provider:K,include:l,isSelected:I.has(K.name),cardClickToggles:S==="selected",onToggleSelect:fe,onOpenDetails:N,t},K.name))})]},$.key))})]})]})]}),d.jsx("aside",{className:"order-1 xl:order-2 space-y-4 self-start xl:sticky xl:top-[84px]",children:e.phase==="complete"&&e.results?d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateSummaryTitle")}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[e.results.counts.installed+e.results.counts.skipped+e.results.counts.failed," ",t("migrateSummarySubtitle")]})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsx(jt,{label:t("migrateInstalled"),value:e.results.counts.installed,tone:"success"}),d.jsx(jt,{label:t("migrateSkipped"),value:e.results.counts.skipped}),d.jsx(jt,{label:t("migrateFailed"),value:e.results.counts.failed})]}),e.results.discovery&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateTypes")}),Kt.map($=>{const K=e.results?.discovery?.[$]??0;return K===0?null:d.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dash-bg rounded-md text-xs",children:[d.jsx("span",{className:"text-dash-text-secondary",children:t(Nr[$])}),d.jsx("span",{className:"font-semibold text-dash-text",children:K})]},$)})]}),o.length>0&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSummaryProviders")}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map($=>{const K=P.get($);return d.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded border border-dash-accent/30 text-dash-accent",children:K?.displayName||$},$)})})]}),d.jsx("div",{className:"text-[10px] px-3 py-1.5 bg-dash-bg rounded-md text-dash-text-muted",children:t(h?"migrateScopeGlobal":"migrateScopeProject")}),d.jsx("button",{type:"button",onClick:e.reset,className:"dash-focus-ring w-full px-4 py-2.5 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors",children:t("migrateSummaryNewMigration")})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"dash-panel p-4 md:p-5 space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold text-dash-text",children:t("migrateActionSummaryTitle")}),d.jsxs("p",{className:"text-xs text-dash-text-muted mt-1",children:[G," ",t("migrateProvidersCountSuffix")," ·"," ",X,"/",Kt.length," ",t("migrateTypes")]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(jt,{label:t("migrateSelectedProviders"),value:G,tone:"accent"}),d.jsx(jt,{label:t("migrateDetectedProviders"),value:F}),d.jsx(jt,{label:t("migrateTypes"),value:X}),d.jsx(jt,{label:t("migrateFilterRecommended"),value:ae,tone:"success"})]}),d.jsxs("div",{className:"inline-flex w-full rounded-md border border-dash-border overflow-hidden",children:[d.jsx("button",{type:"button",onClick:()=>u(!1),className:`dash-focus-ring flex-1 px-3 py-2 text-sm ${h?"bg-dash-bg text-dash-text-secondary":"bg-dash-accent-subtle text-dash-accent"}`,children:t("migrateScopeProject")}),d.jsx("button",{type:"button",onClick:()=>u(!0),className:`dash-focus-ring flex-1 px-3 py-2 text-sm border-l border-dash-border ${h?"bg-dash-accent-subtle text-dash-accent":"bg-dash-bg text-dash-text-secondary"}`,children:t("migrateScopeGlobal")})]}),d.jsx("button",{type:"button",onClick:ee,disabled:!_e,className:"dash-focus-ring w-full px-4 py-2.5 bg-dash-accent text-white rounded-md text-sm font-semibold hover:bg-dash-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:e.phase==="reconciling"?t("migrateRunning"):t("migrateRun")}),Q.length>0&&d.jsx("div",{className:"space-y-2",children:Q.map(($,K)=>d.jsx("p",{className:"text-xs px-3 py-2 border border-yellow-500/30 bg-yellow-500/10 rounded text-yellow-400",children:$},`${$}-${K}`))})]}),d.jsxs("div",{className:"dash-panel-muted p-4",children:[d.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-dash-text-muted",children:t("migrateSelectProviderAction")}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx("button",{type:"button",onClick:()=>le("codex"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCodex")}),d.jsx("button",{type:"button",onClick:()=>le("antigravity"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetAntigravity")}),d.jsx("button",{type:"button",onClick:()=>le("core"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetCore")}),d.jsx("button",{type:"button",onClick:()=>le("detected"),className:"dash-focus-ring px-3 py-1.5 bg-dash-bg border border-dash-border rounded-md text-xs text-dash-text-secondary hover:bg-dash-surface-hover",children:t("migratePresetDetected")})]})]})]})})]})]}),R&&d.jsx(dT,{provider:R,include:l,isSelected:I.has(R.name),latestResult:pe.get(R.name)||null,onToggleSelect:fe,onClose:z,t})]})},uT=({featureId:t,name:e,description:n,included:r})=>{const{t:i}=he();return d.jsxs("div",{"data-testid":`feature-card-${t}`,className:`p-4 rounded-lg border transition-all ${r?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-sm":"border-[var(--dash-border)] bg-[var(--dash-bg)] opacity-50"}`,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r?d.jsx("svg",{className:"w-5 h-5 text-[var(--dash-accent)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):d.jsx("svg",{className:"w-5 h-5 text-[var(--dash-text-muted)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),d.jsx("h4",{className:"font-medium text-[var(--dash-text)]",children:i(e)})]}),d.jsx("p",{className:"text-sm text-[var(--dash-text-muted)] leading-relaxed",children:i(n)})]})},fT=({selectedKit:t,onKitSelect:e,onInstall:n,installing:r})=>{const{t:i}=he(),[s,o]=m.useState(1);return d.jsxs("div",{className:"space-y-6","data-testid":"install-wizard",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(Cd,{number:1,active:s===1,label:i("stepChooseKit")}),d.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),d.jsx(Cd,{number:2,active:s===2,label:i("stepConfigure")}),d.jsx("div",{className:"flex-1 h-px bg-[var(--dash-border)]"}),d.jsx(Cd,{number:3,active:s===3,label:i("stepInstall")})]}),d.jsxs("div",{className:"min-h-[200px]",children:[s===1&&d.jsx(pT,{onSelect:e,selected:t}),s===2&&t&&d.jsx(mT,{kit:t}),s===3&&d.jsx(gT,{installing:r})]}),d.jsxs("div",{className:"flex justify-between pt-4 border-t border-[var(--dash-border)]",children:[s>1?d.jsx("button",{onClick:()=>o(a=>a-1),className:"px-4 py-2 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"wizard-back",children:i("back")}):d.jsx("div",{}),s<3&&t&&d.jsx("button",{onClick:()=>o(a=>a+1),className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"wizard-next",children:i("next")}),s===3&&d.jsx("button",{onClick:n,disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"wizard-install",children:i("install")})]})]})},Cd=({number:t,active:e,label:n})=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold transition-colors ${e?"bg-[var(--dash-accent)] text-white":"bg-[var(--dash-surface)] text-[var(--dash-text-muted)] border border-[var(--dash-border)]"}`,children:t}),d.jsx("span",{className:`text-sm font-medium ${e?"text-[var(--dash-text)]":"text-[var(--dash-text-muted)]"}`,children:n})]}),pT=({onSelect:t,selected:e})=>{const{t:n}=he();return d.jsxs("div",{className:"space-y-4",children:[d.jsx("p",{className:"text-[var(--dash-text-muted)]",children:e?`Selected: ${e===kn.ENGINEER?n("kitEngineerName"):n("kitMarketingName")}`:"Please select a kit above"}),e&&d.jsxs("button",{type:"button",onClick:()=>t(e===kn.ENGINEER?kn.MARKETING:kn.ENGINEER),className:"text-sm text-[var(--dash-accent)] hover:underline",children:["Switch to ",e===kn.ENGINEER?n("kitMarketingName"):n("kitEngineerName")]})]})},mT=()=>d.jsx("div",{className:"text-[var(--dash-text-muted)]",children:"Configuration preview placeholder"}),gT=({installing:t})=>d.jsx("div",{className:"text-[var(--dash-text-muted)]",children:t?"Installing...":"Ready to install"}),bT=({kit:t,onGetStarted:e})=>{const{t:n}=he(),r=Tn(),i=t===kn.ENGINEER?"kitEngineerName":t===kn.MARKETING?"kitMarketingName":"kitEngineerName";return d.jsxs("div",{className:"text-center py-12 space-y-6","data-testid":"success-screen",children:[d.jsx("div",{className:"w-16 h-16 mx-auto bg-green-100 rounded-full flex items-center justify-center",children:d.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),d.jsx("h2",{className:"text-2xl font-bold text-[var(--dash-text)]",children:n("installSuccess")}),d.jsx("p",{className:"text-[var(--dash-text-muted)] max-w-md mx-auto",children:n("installSuccessDesc").replace("{kit}",n(i))}),d.jsxs("div",{className:"flex gap-4 justify-center pt-4",children:[d.jsx("button",{onClick:e,className:"px-6 py-2.5 text-sm font-medium text-white bg-[var(--dash-accent)] rounded-lg hover:opacity-90 transition-opacity","data-testid":"get-started-btn",children:n("getStarted")}),d.jsx("button",{onClick:()=>r("/"),className:"px-6 py-2.5 text-sm font-medium text-[var(--dash-text)] bg-[var(--dash-surface)] border border-[var(--dash-border)] rounded-lg hover:bg-[var(--dash-surface-hover)] transition-colors","data-testid":"dashboard-btn",children:n("goToDashboard")})]})]})},xT=[{id:"agents",name:"featureAgents",description:"featureAgentsDesc",engineer:!0,marketing:!0},{id:"hooks",name:"featureHooks",description:"featureHooksDesc",engineer:!0,marketing:!0},{id:"skills",name:"featureSkills",description:"featureSkillsDesc",engineer:!0,marketing:!0},{id:"multiagent",name:"featureMultiAgent",description:"featureMultiAgentDesc",engineer:!0,marketing:!1},{id:"content",name:"featureContent",description:"featureContentDesc",engineer:!1,marketing:!0},{id:"social",name:"featureSocial",description:"featureSocialDesc",engineer:!1,marketing:!0}],R1={engineer:{id:"engineer",name:"kitEngineerName",tagline:"kitEngineerTagline",primaryColor:"text-blue-500",features:["agents","hooks","skills","multiagent"]},marketing:{id:"marketing",name:"kitMarketingName",tagline:"kitMarketingTagline",primaryColor:"text-purple-500",features:["agents","hooks","skills","content","social"]}};function yT(t){const e=R1[t];return e?xT.filter(n=>e.features.includes(n.id)):(console.warn(`Unknown kit type: ${t}`),[])}const vT=({kit:t,selected:e,onSelect:n,features:r})=>{const{t:i}=he();return d.jsxs("button",{type:"button",onClick:n,className:`p-6 rounded-lg border-2 text-left transition-all w-full ${e?"border-[var(--dash-accent)] bg-[var(--dash-surface)] shadow-md":"border-[var(--dash-border)] hover:border-[var(--dash-accent)]/50"}`,children:[d.jsx("h3",{className:`text-xl font-bold ${t.primaryColor}`,children:i(t.name)}),d.jsx("p",{className:"text-[var(--dash-text-muted)] mt-1",children:i(t.tagline)}),d.jsx("div",{className:"mt-4 space-y-2",children:r.slice(0,3).map(s=>d.jsx(uT,{featureId:s.id,name:s.name,description:s.description,included:!0},s.id))})]})},wT=()=>{const{t}=he(),e=Tn(),[n,r]=m.useState(null),[i,s]=m.useState(!1),[o,a]=m.useState(!1),[l,c]=m.useState(null),h=async()=>{if(n){s(!0),c(null);try{const f=await fetch("/api/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kit:n})});if(!f.ok)throw new Error(`Installation failed: ${f.statusText}`);a(!0)}catch(f){const p=f instanceof Error?f.message:"Unknown error occurred";c(p),console.error("Install failed:",f)}finally{s(!1)}}};if(o&&n)return d.jsx(bT,{kit:n,onGetStarted:()=>e("/")});const u=f=>f==="engineer"?kn.ENGINEER:kn.MARKETING;return d.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[d.jsxs("header",{className:"text-center mb-8",children:[d.jsx("h1",{className:"text-3xl font-bold text-[var(--dash-text)]",children:t("onboardingTitle")}),d.jsx("p",{className:"mt-2 text-[var(--dash-text-muted)]",children:t("onboardingSubtitle")})]}),d.jsx("section",{className:"grid md:grid-cols-2 gap-6 mb-8",children:Object.values(R1).map(f=>{const p=u(f.id);return d.jsx(vT,{kit:f,selected:n===p,onSelect:()=>r(p),features:yT(f.id)},f.id)})}),l&&d.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-red-100 border border-red-300 text-red-800",children:[d.jsx("p",{className:"font-medium",children:"Installation Error"}),d.jsx("p",{className:"text-sm mt-1",children:l}),d.jsx("button",{type:"button",onClick:()=>c(null),className:"mt-2 text-sm underline hover:no-underline",children:"Dismiss"})]}),n&&d.jsx(fT,{selectedKit:n,onKitSelect:r,onInstall:h,installing:i})]})},ST=()=>{const{t}=he(),e=Tn(),{projectId:n}=b0(),[r,i]=m.useState(null),{sizes:s,isDragging:o,startDrag:a}=Oh({storageKey:"claudekit-project-config-panels",defaultSizes:[35,40,25],minSizes:[20,25,15]}),l=m.useCallback(async()=>{if(!n)throw new Error("No project ID");const[b,x,w]=await Promise.all([Mm("project",n),Mm("global"),_h()]),v=w.find(k=>k.id===n);return v&&i(v.path),{...b,global:x.config??{}}},[n]),c=m.useCallback(async b=>n?(await My({scope:"project",projectId:n,config:b})).config:void 0,[n]),h=Ay({scope:"project",fetchConfig:l,fetchSchema:Ty,saveConfig:c}),u=m.useCallback(b=>{const x=Md(h.config,b),w=Md(h.globalConfig,b);return x!==void 0&&w!==void 0&&x!==w},[h.config,h.globalConfig]),f=m.useMemo(()=>[{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:"project",title:t("sectionProject"),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:"privacy",title:t("sectionPrivacy"),defaultCollapsed:!0,fields:[{path:"privacyBlock",label:t("fieldPrivacyBlock"),description:t("fieldPrivacyBlockDesc")}]},{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")}]}],[t]),p=h.activeFieldPath&&u(h.activeFieldPath)?d.jsx("span",{className:"text-[9px] bg-orange-500/10 text-orange-500 px-1.5 py-0.5 rounded font-bold border border-orange-500/30",children:t("localOverride")}):null,g=h.fieldDoc?d.jsxs("section",{className:"bg-blue-500/5 p-3 rounded-lg border border-blue-500/20",children:[d.jsx("h4",{className:"text-[10px] font-bold text-blue-500 uppercase tracking-widest mb-1",children:t("inheritedFromGlobal")}),d.jsxs("p",{className:"text-[12px] text-dash-text-secondary leading-normal",children:[t("viewGlobalConfig")," ",d.jsx("button",{onClick:()=>e("/config/global"),className:"text-dash-accent hover:underline font-medium",children:t("globalConfig")})]})]}):null;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("projectConfig"),filePath:r?`${r}/.claude/.ck.json`:".claude/.ck.json",onBack:()=>e(`/project/${n}`),onSave:h.handleSave,onReset:h.handleReset,saveStatus:h.saveStatus,syntaxError:h.syntaxError,showResetConfirm:h.showResetConfirm,setShowResetConfirm:h.setShowResetConfirm}),d.jsxs("div",{className:"flex-1 flex min-h-0",children:[d.jsx(T0,{width:s[0],isLoading:h.isLoading,schema:h.schema,config:h.config,sources:h.sources,sections:f,onChange:h.handleFormChange,onFieldFocus:h.setFocusedFieldPath}),d.jsx(rr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(0,b)}),d.jsx(ju,{width:s[1],isLoading:h.isLoading,jsonText:h.jsonText,cursorLine:h.cursorLine,syntaxError:h.syntaxError,onChange:h.handleJsonChange,onEditorFocus:h.handleJsonEditorFocus,onCursorLineChange:h.setCursorLine}),d.jsx(rr,{direction:"horizontal",isDragging:o,onMouseDown:b=>a(1,b)}),d.jsx(Py,{width:s[2],fieldDoc:h.fieldDoc,activeFieldPath:h.activeFieldPath,overrideBadge:p,extraContent:g})]})]})},_t="__global__",kT=({project:t})=>{const{t:e}=he(),n=Tn(),{skills:r,loading:i}=H2(),{sessions:s,loading:o}=V2(t.id),[a,l]=m.useState(null),[c,h]=m.useState(!0),[u,f]=m.useState(null),[p,g]=m.useState(_t),[b,x]=m.useState(_t),w=async(P,R)=>{try{await E2(P,t.path,R,t.id)}catch(z){alert(`${e("actionFailed")}: ${z instanceof Error?z.message:P}`)}},v=m.useCallback(()=>{const P=new AbortController;return h(!0),f(null),T2(t.id,P.signal).then(R=>{l(R),g(R.preferences.project.terminalApp||_t),x(R.preferences.project.editorApp||_t)}).catch(R=>{R instanceof DOMException&&R.name==="AbortError"||(l(null),g(_t),x(_t),f(e("actionOptionsLoadFailed")))}).finally(()=>{P.signal.aborted||h(!1)}),P},[t.id,e]);m.useEffect(()=>{const P=v();return()=>{P.abort()}},[v]);const k=r.filter(P=>t.skills.includes(P.id)),j=a?.terminals||[],S=a?.editors||[],C=j.find(P=>P.id===a?.defaults.terminalApp)?.label||a?.defaults.terminalApp,y=S.find(P=>P.id===a?.defaults.editorApp)?.label||a?.defaults.editorApp,N=m.useMemo(()=>j.find(P=>p===_t?P.id===a?.defaults.terminalApp:P.id===p),[j,p,a?.defaults.terminalApp]),A=m.useMemo(()=>S.find(P=>b===_t?P.id===a?.defaults.editorApp:P.id===b),[S,b,a?.defaults.editorApp]),T=async(P,R)=>{if(!t.id.startsWith("discovered-"))try{await O0(t.id,{preferences:{[P]:R===_t?null:R}})}catch(z){const I=z instanceof Error?z.message:"Failed to save preference";alert(`${e("actionFailed")}: ${I}`)}};return d.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-500 transition-colors flex flex-col h-full",children:[d.jsx("section",{className:"mb-6 shrink-0",children:d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[d.jsx("h1",{className:"text-3xl font-bold tracking-tight text-dash-text",children:t.name}),d.jsx(CT,{status:t.health}),d.jsx(JO,{variant:"beta"})]}),d.jsxs("p",{className:"text-dash-text-secondary mono text-sm flex items-center gap-2 italic",children:[d.jsx("svg",{xmlns:"http://www.w3.org/2000/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:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),t.path]})]}),d.jsx("div",{className:"flex items-center gap-3",children:d.jsx("span",{className:"text-[10px] text-dash-text-muted font-bold uppercase tracking-widest bg-dash-surface border border-dash-border px-2 py-1 rounded",children:s.length>0?`${s.length} ${e("sessions")}`:e("noSessions")})})]})}),d.jsxs("section",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6 shrink-0",children:[u?d.jsxs("div",{className:"col-span-2 md:col-span-4 rounded-lg border border-orange-500/30 bg-orange-500/5 px-3 py-2 text-xs text-orange-700 dark:text-orange-300 flex items-center justify-between gap-3",children:[d.jsx("span",{children:u}),d.jsx("button",{onClick:()=>void v(),className:"rounded border border-orange-500/40 px-2 py-1 font-semibold hover:bg-orange-500/10 transition-colors",children:e("tryAgain")})]}):null,d.jsx(zg,{icon:"📟",label:e("terminal"),sub:N?`${N.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${N.label}`:e("terminalSub"),onClick:()=>w("terminal",p===_t?void 0:p),disabled:c||!N&&j.length>0,options:j,value:p,fallbackLabel:a?`${e("useGlobalFallback")} (${C})`:e("useGlobalFallback"),onChange:async P=>{g(P),await T("terminalApp",P)}}),d.jsx(zg,{icon:"💻",label:e("editor"),sub:A?`${A.openMode==="open-app"?e("openAppOnly"):e("openAtPath")} • ${A.label}`:e("editorSub"),onClick:()=>w("editor",b===_t?void 0:b),disabled:c||!A&&S.length>0,options:S,value:b,fallbackLabel:a?`${e("useGlobalFallback")} (${y})`:e("useGlobalFallback"),onChange:async P=>{x(P),await T("editorApp",P)}}),d.jsx(Mh,{icon:"🤖",label:e("launch"),sub:e("launchSub"),highlight:!0,onClick:()=>w("launch")}),d.jsx(Mh,{icon:"⚙️",label:e("config"),sub:e("configSub"),onClick:()=>n(`/config/project/${t.id}`)})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0",children:[d.jsx("div",{className:"lg:col-span-2 flex flex-col gap-6 min-h-0",children:d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl overflow-hidden shadow-sm flex-1 flex flex-col min-h-0",children:[d.jsx("div",{className:"px-4 py-3 border-b border-dash-border flex items-center justify-between bg-dash-surface-hover/50 shrink-0",children:d.jsx("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest",children:e("recentSessions")})}),d.jsx("div",{className:"divide-y divide-dash-border overflow-y-auto flex-1",children:o?d.jsx("div",{className:"p-4 text-center text-dash-text-muted animate-pulse",children:e("loadingSessions")}):s.length===0?d.jsx("div",{className:"p-4 text-center text-dash-text-muted",children:e("noSessionsFound")}):s.map(P=>d.jsxs("div",{className:"p-4 hover:bg-dash-surface-hover transition-colors group cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between mb-1",children:[d.jsx("span",{className:"text-xs font-bold text-dash-accent",children:P.timestamp}),d.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium group-hover:text-dash-text-secondary transition-colors",children:P.duration})]}),d.jsx("p",{className:"text-sm text-dash-text-secondary leading-relaxed truncate",children:P.summary})]},P.id))})]})}),d.jsxs("div",{className:"flex flex-col gap-6 min-h-0",children:[d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl p-6 shadow-sm shrink-0",children:[d.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest mb-4 flex items-center gap-2",children:[e("configuration"),d.jsx("span",{className:"text-[10px] font-normal text-dash-text-muted normal-case",children:e("globalSettings")})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsx(za,{label:e("activeKit"),value:t.kitType}),d.jsx(za,{label:e("aiModel"),value:t.model}),d.jsx(za,{label:e("hooks"),value:`${t.activeHooks} ${e("active")}`}),d.jsx(za,{label:e("mcpServers"),value:`${t.mcpServers} ${e("connected")}`})]}),d.jsx("button",{onClick:()=>n(`/config/project/${t.id}`),className:"w-full mt-6 py-2 rounded-lg bg-dash-bg text-xs font-bold text-dash-text-secondary hover:bg-dash-surface-hover transition-colors border border-dash-border",children:e("editProjectConfig")})]}),d.jsxs("div",{className:"bg-dash-surface border border-dash-border rounded-xl shadow-sm flex flex-col flex-1 min-h-0",children:[d.jsx("div",{className:"p-4 pb-2 border-b border-dash-border shrink-0",children:d.jsxs("h3",{className:"text-sm font-bold text-dash-text-secondary uppercase tracking-widest flex items-center justify-between",children:[e("globalSkills"),d.jsx("span",{className:"text-[10px] bg-dash-accent-subtle text-dash-accent px-1.5 py-0.5 rounded-full",children:i?"...":r.length})]})}),d.jsx("div",{className:"overflow-y-auto flex-1 px-4 py-2 space-y-2",children:i?d.jsx("div",{className:"text-center text-dash-text-muted animate-pulse py-4",children:e("loadingSkills")}):(k.length>0?k:r).map(P=>d.jsxs("div",{className:"flex flex-col gap-0.5 border-l-2 border-dash-accent/20 pl-3 py-1",children:[d.jsx("span",{className:"text-sm font-semibold text-dash-text",children:P.name}),d.jsx("p",{className:"text-[10px] text-dash-text-muted leading-tight line-clamp-1",children:P.description||e("noDescription")})]},P.id))}),d.jsx("div",{className:"p-4 pt-2 border-t border-dash-border shrink-0",children:d.jsxs("a",{href:"https://kits.vibery.app/",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-dash-text-muted hover:text-dash-accent transition-colors text-center block",children:[e("browseSkillsMarketplace")," →"]})})]})]})]})]})},CT=({status:t})=>{const e={[er.HEALTHY]:"bg-dash-accent-subtle text-dash-accent border-dash-accent/20",[er.WARNING]:"bg-orange-500/10 text-orange-600 border-orange-500/20",[er.ERROR]:"bg-red-500/10 text-red-600 border-red-500/20",[er.LOADING]:"bg-dash-border/20 text-dash-text-muted border-dash-border",[er.UNKNOWN]:"bg-dash-border/20 text-dash-text-muted border-dash-border"};return d.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border uppercase tracking-widest ${e[t]}`,children:t})},zg=({icon:t,label:e,sub:n,disabled:r,options:i,value:s,fallbackLabel:o,onClick:a,onChange:l})=>d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(Mh,{icon:t,label:e,sub:n,onClick:a,disabled:r}),d.jsxs("select",{value:s,onChange:c=>void l(c.target.value),className:"w-full rounded-md border border-dash-border bg-dash-surface px-2 py-1 text-xs text-dash-text-secondary",children:[d.jsx("option",{value:_t,children:o}),i.map(c=>d.jsx("option",{value:c.id,disabled:!c.available,children:`${c.label} • ${c.detected?"Detected":"Not detected"}`},c.id))]})]}),Mh=({icon:t,label:e,sub:n,highlight:r,onClick:i,disabled:s})=>d.jsxs("button",{onClick:i,disabled:s,className:`p-4 rounded-xl border flex flex-col gap-1 transition-all group ${r?"bg-dash-accent-subtle border-dash-accent/30 hover:bg-dash-accent-glow hover:border-dash-accent/50 shadow-sm shadow-dash-accent/5":"bg-dash-surface border-dash-border hover:bg-dash-surface-hover hover:border-dash-text-muted shadow-sm"} ${s?"opacity-50 cursor-not-allowed":""}`,children:[d.jsx("span",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:t}),d.jsx("span",{className:"text-sm font-bold text-dash-text",children:e}),d.jsx("span",{className:"text-[10px] text-dash-text-muted font-medium truncate italic",children:n})]}),za=({label:t,value:e})=>d.jsxs("div",{className:"flex items-center justify-between text-xs py-1.5 border-b border-dash-border/50 last:border-0",children:[d.jsx("span",{className:"text-dash-text-muted font-medium",children:t}),d.jsx("span",{className:"text-dash-text font-bold mono uppercase text-[10px] tracking-tight",children:e})]}),jT=()=>{const{t}=he(),{project:e}=pw();return e?d.jsx(kT,{project:e}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full space-y-4 opacity-50",children:[d.jsx("div",{className:"w-16 h-16 rounded-full bg-dash-surface border border-dash-border flex items-center justify-center",children:d.jsx("span",{className:"text-2xl text-dash-text-muted",children:"📂"})}),d.jsx("p",{className:"text-lg text-dash-text-secondary font-bold",children:t("selectProject")})]})},L1=["model","context","quota","directory","git","cost","changes","agents","todos"],Ll={contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"cyan",muted:"dim",separator:"dim",quotaLow:"green",quotaHigh:"yellow"},OT=[["model","context","quota"],["directory","git","cost","changes"],["agents","todos"]],I1={model:{icon:"🤖"},quota:{icon:"⌛"},directory:{icon:"📁"},git:{icon:"🌿"},cost:{icon:"💰"},changes:{icon:"📝"},agents:{icon:"🔄"},todos:{icon:"✅"}},Qn={baseMode:"full",lines:OT,sectionConfig:I1,theme:Ll,responsiveBreakpoint:.85,maxAgentRows:4,todoTruncation:50},PT={model:"claude-sonnet-4-6",context:"▰▰▰▰▰▰▱▱▱▱▱▱ 52%",quota:"5h 31% wk 33%",directory:"~/projects/myapp",git:"main (2, +1, 3↑)",cost:"$0.042",changes:"+128 -34",agents:"○ planner ● researcher",todos:"▸ Implement auth (3 done, 4 pending)"},$1={green:"#4ade80",yellow:"#facc15",red:"#f87171",cyan:"#22d3ee",blue:"#60a5fa",magenta:"#e879f9",white:"#f1f5f9",dim:"#64748b",default:"#94a3b8",brightGreen:"#86efac",brightYellow:"#fde68a",brightRed:"#fca5a5",brightCyan:"#67e8f9",brightBlue:"#93c5fd",brightMagenta:"#f0abfc",brightWhite:"#ffffff"},Wu={model:"cyan",directory:"blue",git:"magenta",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"brightGreen"},Hg=[{name:"Default",labelKey:"statuslinePresetDefault",theme:Ll,sectionColors:Wu},{name:"Monochrome",labelKey:"statuslinePresetMonochrome",theme:{contextLow:"white",contextMid:"white",contextHigh:"white",accent:"white",muted:"dim",separator:"dim",quotaLow:"white",quotaHigh:"white"},sectionColors:{model:"white",directory:"white",git:"white",cost:"dim",changes:"white",agents:"white",todos:"white"}},{name:"Nord",labelKey:"statuslinePresetNord",theme:{contextLow:"brightCyan",contextMid:"blue",contextHigh:"magenta",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightBlue"},sectionColors:{model:"brightCyan",directory:"brightBlue",git:"brightCyan",cost:"dim",changes:"brightYellow",agents:"blue",todos:"brightCyan"}},{name:"Dracula",labelKey:"statuslinePresetDracula",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"brightCyan",git:"brightGreen",cost:"dim",changes:"brightYellow",agents:"brightMagenta",todos:"brightGreen"}},{name:"Catppuccin",labelKey:"statuslinePresetCatppuccin",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"brightYellow",git:"brightMagenta",cost:"dim",changes:"brightGreen",agents:"brightBlue",todos:"brightCyan"}},{name:"Gruvbox",labelKey:"statuslinePresetGruvbox",theme:{contextLow:"brightGreen",contextMid:"yellow",contextHigh:"red",accent:"brightYellow",muted:"dim",separator:"dim",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"brightYellow",directory:"brightGreen",git:"red",cost:"dim",changes:"yellow",agents:"brightYellow",todos:"brightGreen"}},{name:"Tokyo Night",labelKey:"statuslinePresetTokyoNight",theme:{contextLow:"cyan",contextMid:"brightBlue",contextHigh:"brightMagenta",accent:"brightBlue",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightMagenta"},sectionColors:{model:"brightBlue",directory:"cyan",git:"brightMagenta",cost:"dim",changes:"brightCyan",agents:"brightBlue",todos:"brightGreen"}},{name:"Solarized",labelKey:"statuslinePresetSolarized",theme:{contextLow:"green",contextMid:"yellow",contextHigh:"red",accent:"blue",muted:"dim",separator:"dim",quotaLow:"cyan",quotaHigh:"yellow"},sectionColors:{model:"blue",directory:"cyan",git:"green",cost:"dim",changes:"yellow",agents:"blue",todos:"green"}},{name:"Rose Pine",labelKey:"statuslinePresetRosePine",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"brightRed",accent:"magenta",muted:"dim",separator:"dim",quotaLow:"magenta",quotaHigh:"brightRed"},sectionColors:{model:"magenta",directory:"brightBlue",git:"brightMagenta",cost:"dim",changes:"brightYellow",agents:"magenta",todos:"brightGreen"}},{name:"One Dark",labelKey:"statuslinePresetOneDark",theme:{contextLow:"green",contextMid:"brightYellow",contextHigh:"brightRed",accent:"brightCyan",muted:"dim",separator:"dim",quotaLow:"brightCyan",quotaHigh:"brightRed"},sectionColors:{model:"brightCyan",directory:"blue",git:"brightRed",cost:"dim",changes:"brightYellow",agents:"brightCyan",todos:"green"}},{name:"Ayu",labelKey:"statuslinePresetAyu",theme:{contextLow:"brightGreen",contextMid:"brightYellow",contextHigh:"red",accent:"yellow",muted:"dim",separator:"white",quotaLow:"brightYellow",quotaHigh:"red"},sectionColors:{model:"yellow",directory:"brightCyan",git:"brightYellow",cost:"dim",changes:"brightGreen",agents:"yellow",todos:"brightGreen"}},{name:"Kanagawa",labelKey:"statuslinePresetKanagawa",theme:{contextLow:"cyan",contextMid:"brightYellow",contextHigh:"red",accent:"brightMagenta",muted:"dim",separator:"dim",quotaLow:"brightBlue",quotaHigh:"brightMagenta"},sectionColors:{model:"brightMagenta",directory:"cyan",git:"brightYellow",cost:"dim",changes:"brightBlue",agents:"brightMagenta",todos:"cyan"}},{name:"Stealth",labelKey:"statuslinePresetStealth",theme:{contextLow:"dim",contextMid:"dim",contextHigh:"brightRed",accent:"dim",muted:"dim",separator:"dim",quotaLow:"dim",quotaHigh:"brightRed"},sectionColors:{model:"dim",directory:"dim",git:"dim",cost:"dim",changes:"dim",agents:"dim",todos:"dim"}},{name:"Hacker",labelKey:"statuslinePresetHacker",theme:{contextLow:"green",contextMid:"brightGreen",contextHigh:"brightGreen",accent:"brightGreen",muted:"green",separator:"green",quotaLow:"green",quotaHigh:"brightGreen"},sectionColors:{model:"brightGreen",directory:"green",git:"brightGreen",cost:"green",changes:"brightGreen",agents:"green",todos:"brightGreen"}}],NT=({sectionId:t,label:e,config:n,onConfigChange:r,onRemove:i})=>{const{t:s}=he(),[o,a]=m.useState(!1),{attributes:l,listeners:c,setNodeRef:h,transform:u,transition:f,isDragging:p}=J7({id:t}),g={transform:pr.Transform.toString(u),transition:f,opacity:p?.4:1,zIndex:p?50:void 0},b=j=>{r({...n,icon:j.target.value||void 0})},x=j=>{r({...n,label:j.target.value||void 0})},w=j=>{const S=Number.parseInt(j.target.value,10);r({...n,maxWidth:Number.isNaN(S)?void 0:Math.max(10,Math.min(200,S))})},v=n.icon??"",k=n.label??e;return d.jsxs("div",{ref:h,style:g,className:"relative",children:[d.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1 rounded-md border cursor-pointer select-none transition-all ${p?"border-dash-accent bg-dash-accent/20 shadow-lg":"border-dash-border bg-dash-surface hover:border-dash-accent/60 hover:bg-dash-surface-hover"}`,children:[d.jsx("span",{...l,...c,className:"text-dash-text-muted cursor-grab active:cursor-grabbing shrink-0 opacity-50 group-hover:opacity-100 transition-opacity","aria-label":"drag handle",children:"⠿"}),d.jsxs("button",{type:"button",onClick:()=>a(j=>!j),className:"flex items-center gap-1 text-xs text-dash-text min-w-0","aria-label":s(o?"statuslineCollapseSettings":"statuslineExpandSettings"),children:[v&&d.jsx("span",{className:"shrink-0",children:v}),d.jsx("span",{className:"truncate",children:k}),d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 shrink-0 text-dash-text-muted transition-transform ${o?"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"})})]}),i&&d.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),i()},className:"text-dash-text-muted/40 hover:text-red-400 transition-colors shrink-0","aria-label":"remove section",children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o&&d.jsxs("div",{className:"absolute top-full left-0 z-20 mt-1 w-56 p-3 rounded-lg border border-dash-border bg-dash-surface shadow-xl space-y-2",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:`chip-icon-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:s("statuslineIconOverride")}),d.jsx("input",{id:`chip-icon-${t}`,type:"text",value:n.icon??"",onChange:b,placeholder:s("statuslineIconPlaceholder"),maxLength:20,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:`chip-label-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:s("statuslineLabelOverride")}),d.jsx("input",{id:`chip-label-${t}`,type:"text",value:n.label??"",onChange:x,placeholder:e,maxLength:50,className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:`chip-maxwidth-${t}`,className:"block text-[10px] font-medium text-dash-text-muted mb-1",children:s("statuslineMaxWidth")}),d.jsx("input",{id:`chip-maxwidth-${t}`,type:"number",min:10,max:200,value:n.maxWidth??"",onChange:w,placeholder:s("statuslineMaxWidthPlaceholder"),className:"w-full text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text placeholder-dash-text-muted focus:outline-none focus:border-dash-accent"})]}),d.jsx("button",{type:"button",onClick:()=>a(!1),className:"w-full text-[10px] py-0.5 text-dash-text-muted hover:text-dash-text transition-colors",children:s("closeModal")})]})]})},DT={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},Vg=({containerId:t,sectionIds:e,sectionConfig:n,onConfigChange:r,onRemoveSection:i,headerLabel:s,onRemove:o,isPool:a=!1})=>{const{t:l}=he(),{setNodeRef:c,isOver:h}=i1({id:t});return d.jsxs("div",{className:`rounded-lg border transition-colors ${a?"border-dash-border/50 bg-dash-bg/50":h?"border-dash-accent/60 bg-dash-accent/5":"border-dash-border bg-dash-surface"}`,children:[s&&d.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-dash-border/50",children:[d.jsx("span",{className:`text-xs font-medium uppercase tracking-wider ${a?"text-dash-text-muted/70":"text-dash-text-muted"}`,children:s}),o&&d.jsx("button",{type:"button",onClick:o,className:"text-xs text-dash-text-muted hover:text-red-400 transition-colors px-1","aria-label":l("statuslineRemoveLine"),children:l("statuslineRemoveLine")})]}),d.jsx("div",{ref:c,className:"p-2 min-h-[44px]",children:d.jsx(_7,{items:e,strategy:H7,children:d.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?d.jsx("span",{className:"text-xs text-dash-text-muted/50 italic px-1 py-0.5",children:a?l("statuslineDragToLine"):"—"}):e.map(u=>d.jsx(NT,{sectionId:u,label:l(DT[u]??"statuslineSectionModelLabel"),config:n[u]??{},onConfigChange:f=>r(u,f),onRemove:!a&&i?()=>i(u):void 0},u))})})})]})};function _g(t,e,n){for(let r=0;r<t.length;r++)if(t[r].includes(n))return`line-${r}`;return e.includes(n)?"pool":null}const AT=({lines:t,sectionConfig:e,onLinesChange:n,onSectionConfigChange:r})=>{const{t:i}=he(),[s,o]=m.useState(null),a=w6(Bm(Tu),Bm(Au,{coordinateGetter:Z7})),l=new Set(t.flat()),c=L1.filter(x=>!l.has(x)),h=x=>{o(String(x.active.id))},u=x=>{o(null);const{active:w,over:v}=x;if(!v)return;const k=String(w.id),j=String(v.id),S=_g(t,c,k);let C=_g(t,c,j);if(C||(j.startsWith("line-")||j==="pool")&&(C=j),!S||!C||k===j)return;const y=t.map(T=>[...T]),N=T=>{if(T==="pool")return[...c];const P=Number.parseInt(T.replace("line-",""),10);return y[P]??[]},A=(T,P)=>{if(T==="pool")return;const R=Number.parseInt(T.replace("line-",""),10);y[R]=P};if(S===C){const T=N(S),P=T.indexOf(k),R=T.indexOf(j);P!==-1&&R!==-1&&A(S,Ru(T,P,R))}else{const T=N(S),P=N(C),R=T.filter(G=>G!==k),z=P.indexOf(j),I=z===-1?P.length:z,F=[...P.slice(0,I),k,...P.slice(I)];S!=="pool"&&A(S,R),C!=="pool"&&A(C,F)}n(y)},f=()=>{n([...t,[]])},p=x=>{t[x];const w=t.filter((v,k)=>k!==x);n(w)},g=(x,w)=>{r({...e,[x]:w})},b=(x,w)=>{const v=t.map((k,j)=>j===x?k.filter(S=>S!==w):[...k]);n(v)};return d.jsxs("div",{className:"space-y-2",children:[d.jsx("p",{className:"text-xs text-dash-text-muted px-1",children:i("statuslineDragHint")}),d.jsxs(y7,{sensors:a,collisionDetection:C6,onDragStart:h,onDragEnd:u,children:[d.jsx("div",{className:"space-y-2",children:t.map((x,w)=>d.jsx(Vg,{containerId:`line-${w}`,sectionIds:x,sectionConfig:e,onConfigChange:g,onRemoveSection:v=>b(w,v),headerLabel:`${i("statuslineLine")} ${w+1}`,onRemove:()=>p(w)},`line-zone-${w}`))}),d.jsxs("button",{type:"button",onClick:f,className:"w-full text-xs px-3 py-2 rounded-lg border border-dashed border-dash-border text-dash-text-muted hover:border-dash-accent/60 hover:text-dash-text transition-colors",children:["+ ",i("statuslineAddLine")]}),d.jsxs("div",{className:"pt-0.5",children:[d.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider mb-1 px-1",children:i("statuslineHiddenSections")}),d.jsx(Vg,{containerId:"pool",sectionIds:c,sectionConfig:e,onConfigChange:g,isPool:!0})]}),d.jsx($7,{children:s?d.jsx("div",{className:"px-2 py-1 rounded-md border border-dash-accent bg-dash-accent/20 text-xs text-dash-text shadow-xl opacity-90",children:s}):null})]})]})},Lt=$1;function MT(t){return Lt[t]??Lt.default}const TT=({sectionId:t,config:e,theme:n})=>{const r=PT[t]??t,i=e.icon??"";let s=e.color??Wu[t]??n.accent;t==="context"&&!e.color&&(s=n.contextMid),t==="quota"&&!e.color&&(s=n.quotaLow);const o=MT(s),a=e.label?`${i} ${e.label}: ${r}`:i?`${i} ${r}`:r,l=e.maxWidth&&a.length>e.maxWidth?`${a.slice(0,e.maxWidth-1)}…`:a;return d.jsx("span",{className:"font-mono text-xs whitespace-nowrap",style:{color:o},children:l})},ET=d.jsx("span",{className:"font-mono text-xs",style:{color:Lt.dim},children:" │ "}),RT=({sectionIds:t,sectionConfig:e,theme:n})=>{const{t:r}=he();return d.jsx("div",{className:"flex items-center gap-0 py-0.5 px-2 rounded mb-0.5 last:mb-0 overflow-hidden",style:{backgroundColor:"#313244"},children:t.length===0?d.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:Lt.dim},children:r("statuslinePreviewEmptyLine")}):t.map((i,s)=>d.jsxs("span",{className:"flex items-center shrink-0",children:[d.jsx(TT,{sectionId:i,config:e[i]??{},theme:n}),s<t.length-1&&ET]},i))})},LT=({lines:t,sectionConfig:e,theme:n})=>{const{t:r}=he(),i=t.reduce((s,o)=>s+o.length,0);return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-dash-text-muted",children:r("statuslinePreview")}),d.jsxs("span",{className:"text-xs text-dash-text-muted/60",children:[i," ",r("statuslineSectionsVisible")]})]}),d.jsxs("div",{className:"rounded-lg overflow-hidden border border-dash-border shadow-lg",children:[d.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[#1e1e2e] border-b border-[#313244]",children:[d.jsxs("div",{className:"flex gap-1.5",children:[d.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f38ba8]"}),d.jsx("span",{className:"w-3 h-3 rounded-full bg-[#f9e2af]"}),d.jsx("span",{className:"w-3 h-3 rounded-full bg-[#a6e3a1]"})]}),d.jsx("span",{className:"text-xs text-[#6c7086] font-mono ml-2",children:r("statuslinePreviewTitle")})]}),d.jsxs("div",{className:"bg-[#1e1e2e] px-3 py-2 font-mono text-xs overflow-x-auto select-none",children:[d.jsxs("div",{className:"mb-1",children:[d.jsx("span",{style:{color:Lt.green},children:"user@machine"}),d.jsx("span",{style:{color:Lt.dim},children:":"}),d.jsx("span",{style:{color:Lt.blue},children:"~/projects/myapp"}),d.jsx("span",{style:{color:Lt.white},children:" $ "})]}),t.length===0?d.jsx("div",{className:"py-0.5 px-2 rounded mb-0.5",style:{backgroundColor:"#313244"},children:d.jsx("span",{className:"text-xs font-mono opacity-30",style:{color:Lt.dim},children:r("statuslinePreviewNoLines")})}):t.map((s,o)=>d.jsx(RT,{sectionIds:s,sectionConfig:e,theme:n},o)),d.jsxs("div",{className:"mt-1 flex items-center",children:[d.jsx("span",{style:{color:Lt.green},children:"user@machine"}),d.jsx("span",{style:{color:Lt.dim},children:":"}),d.jsx("span",{style:{color:Lt.blue},children:"~/projects/myapp"}),d.jsx("span",{style:{color:Lt.white},children:" $ "}),d.jsx("span",{className:"inline-block w-2 h-4 bg-white/70 animate-pulse ml-0.5"})]})]})]})]})},IT={model:"statuslineSectionModelLabel",context:"statuslineSectionContextLabel",quota:"statuslineSectionQuotaLabel",directory:"statuslineSectionDirectoryLabel",git:"statuslineSectionGitLabel",cost:"statuslineSectionCostLabel",changes:"statuslineSectionChangesLabel",agents:"statuslineSectionAgentsLabel",todos:"statuslineSectionTodosLabel"},$T=["green","yellow","red","cyan","blue","magenta","white","dim","brightGreen","brightYellow","brightRed","brightCyan","brightBlue","brightMagenta","brightWhite"],Il=$1,$n=({field:t,label:e,value:n,onChange:r})=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-3 h-3 rounded-full shrink-0 border border-white/20",style:{backgroundColor:Il[n]??Il.default}}),d.jsx("label",{htmlFor:`color-${t}`,className:"text-xs text-dash-text-muted w-24 shrink-0",children:e}),d.jsx("select",{id:`color-${t}`,value:n,onChange:i=>r(i.target.value),className:"flex-1 text-xs px-2 py-1 rounded border border-dash-border bg-dash-bg text-dash-text focus:outline-none focus:border-dash-accent",children:$T.map(i=>d.jsx("option",{value:i,children:i},i))})]}),BT=({theme:t,sectionConfig:e,onChange:n,onSectionConfigChange:r})=>{const{t:i}=he(),s=(c,h)=>{n({...t,[c]:h})},o=(c,h)=>{r({...e,[c]:{...e[c],color:h}})},a=c=>{n({...c.theme});const h={...e};for(const[u,f]of Object.entries(c.sectionColors))h[u]={...h[u],color:f};r(h)},l=Hg.findIndex(c=>c.theme.contextLow===t.contextLow&&c.theme.contextMid===t.contextMid&&c.theme.contextHigh===t.contextHigh&&c.theme.accent===t.accent&&c.theme.muted===t.muted&&c.theme.separator===t.separator&&c.theme.quotaLow===t.quotaLow&&c.theme.quotaHigh===t.quotaHigh);return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-medium text-dash-text-muted mb-2 uppercase tracking-wider",children:i("statuslineTheme")}),d.jsx("div",{className:"grid grid-cols-2 gap-2",children:Hg.map((c,h)=>d.jsx("button",{type:"button",onClick:()=>a(c),className:`text-xs px-3 py-2 rounded border transition-colors text-left ${l===h?"border-dash-accent bg-dash-accent/10 text-dash-accent":"border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text"}`,children:d.jsxs("span",{className:"flex items-center gap-1",children:[[c.sectionColors.model,c.theme.contextMid,c.sectionColors.git,c.sectionColors.changes].map((u,f)=>d.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:Il[u]??Il.default}},f)),d.jsx("span",{className:"ml-0.5",children:i(c.labelKey)})]})},c.name))})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["▰ ",i("statuslineColorContextGroup")]}),d.jsx($n,{field:"contextLow",label:i("statuslineColorContextLow"),value:t.contextLow,onChange:c=>s("contextLow",c)}),d.jsx($n,{field:"contextMid",label:i("statuslineColorContextMid"),value:t.contextMid,onChange:c=>s("contextMid",c)}),d.jsx($n,{field:"contextHigh",label:i("statuslineColorContextHigh"),value:t.contextHigh,onChange:c=>s("contextHigh",c)})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:["⌛ ",i("statuslineColorQuotaGroup")]}),d.jsx($n,{field:"quotaLow",label:i("statuslineQuotaLow"),value:t.quotaLow,onChange:c=>s("quotaLow",c)}),d.jsx($n,{field:"quotaHigh",label:i("statuslineQuotaHigh"),value:t.quotaHigh,onChange:c=>s("quotaHigh",c)})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:i("statuslineColorGeneralGroup")}),d.jsx($n,{field:"accent",label:i("statuslineColorAccent"),value:t.accent,onChange:c=>s("accent",c)}),d.jsx($n,{field:"muted",label:i("statuslineColorMuted"),value:t.muted,onChange:c=>s("muted",c)}),d.jsx($n,{field:"separator",label:i("statuslineColorSeparator"),value:t.separator,onChange:c=>s("separator",c)})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("p",{className:"text-xs font-medium text-dash-text-muted uppercase tracking-wider",children:i("statuslineColorSectionGroup")}),L1.filter(c=>c!=="context"&&c!=="quota").map(c=>{const h=e[c]?.icon??I1[c]?.icon??"",u=i(IT[c]??"statuslineSectionModelLabel");return d.jsx($n,{field:`section-${c}`,label:h?`${h} ${u}`:u,value:e[c]?.color??Wu[c]??"default",onChange:f=>o(c,f)},c)})]})]})]})};function FT(t){return{baseMode:t.baseMode??Qn.baseMode,lines:t.lines??Qn.lines,sectionConfig:t.sectionConfig??Qn.sectionConfig,theme:t.theme?{...Ll,...t.theme}:Ll,responsiveBreakpoint:t.responsiveBreakpoint??Qn.responsiveBreakpoint,maxAgentRows:t.maxAgentRows??Qn.maxAgentRows,todoTruncation:t.todoTruncation??Qn.todoTruncation}}const zT=()=>{const{t}=he(),[e,n]=m.useState(Qn),[r,i]=m.useState(!0),[s,o]=m.useState(!1),[a,l]=m.useState(null),[c,h]=m.useState(!1),[u,f]=m.useState(!1),{size:p,isDragging:g,startDrag:b}=P0({storageKey:"ck-statusline-preview-width",defaultSize:500,minSize:300,maxSize:900,direction:"horizontal",invert:!0});m.useEffect(()=>{let S=!1;return fetch("/api/ck-config?scope=global").then(C=>{if(!C.ok)throw new Error(`Failed to fetch config: ${C.status}`);return C.json()}).then(C=>{if(S)return;const y=C.config.statuslineLayout;y&&n(FT(y))}).catch(()=>{S||f(!0)}).finally(()=>{S||i(!1)}),()=>{S=!0}},[]);const x=m.useCallback(async()=>{o(!0),l(null),h(!1);try{await gP("statuslineLayout",e,"global"),h(!0),setTimeout(()=>h(!1),3e3)}catch(S){l(S instanceof Error?S.message:"Unknown error")}finally{o(!1)}},[e]),w=m.useCallback(()=>{n(Qn),h(!1),l(null)},[]),v=m.useCallback(S=>{n(C=>({...C,lines:S}))},[]),k=m.useCallback(S=>{n(C=>({...C,sectionConfig:S}))},[]),j=m.useCallback(S=>{n(C=>({...C,theme:S}))},[]);return r?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-dash-text-muted text-sm",children:t("loading")})}):d.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d.jsx("div",{className:"shrink-0 px-6 py-4 border-b border-dash-border bg-dash-surface",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-lg font-bold text-dash-text",children:t("statuslineBuilder")}),d.jsx("p",{className:"text-sm text-dash-text-muted mt-0.5",children:t("statuslineBuilderDescription")})]}),c&&d.jsx("div",{className:"text-xs text-green-400 bg-green-400/10 border border-green-400/20 rounded px-3 py-1.5",children:t("statuslineSaved")}),u&&d.jsx("div",{className:"bg-orange-50 dark:bg-orange-950 text-orange-700 dark:text-orange-300 px-4 py-2 rounded-md text-sm border border-orange-200 dark:border-orange-800",children:t("statuslineLoadErrorSaveDisabled")}),a&&d.jsxs("div",{className:"text-xs text-red-400 bg-red-400/10 border border-red-400/20 rounded px-3 py-1.5",children:[t("statuslineSaveError"),": ",a]})]})}),d.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[d.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-dash-border overflow-hidden",children:[d.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d.jsx(BT,{theme:e.theme,sectionConfig:e.sectionConfig,onChange:j,onSectionConfigChange:k})}),d.jsxs("div",{className:"shrink-0 px-4 py-3 border-t border-dash-border bg-dash-surface flex gap-2",children:[d.jsx("button",{type:"button",onClick:w,className:"text-xs px-3 py-1.5 rounded border border-dash-border text-dash-text-secondary hover:bg-dash-surface-hover hover:text-dash-text transition-colors",children:t("statuslineResetDefaults")}),d.jsx("button",{type:"button",onClick:x,disabled:s||u,className:"flex-1 text-xs px-3 py-1.5 rounded border border-dash-accent bg-dash-accent/10 text-dash-accent hover:bg-dash-accent/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-medium",children:s?`${t("saving")}…`:t("statuslineSave")})]})]}),d.jsx(rr,{direction:"horizontal",isDragging:g,onMouseDown:b}),d.jsxs("div",{className:"shrink-0 overflow-y-auto p-4 bg-dash-bg space-y-4",style:{width:p},children:[d.jsx(LT,{lines:e.lines,sectionConfig:e.sectionConfig,theme:e.theme}),d.jsx(AT,{lines:e.lines,sectionConfig:e.sectionConfig,onLinesChange:v,onSectionConfigChange:k})]})]})]})},HT=c2([{path:"/",element:d.jsx(W2,{}),children:[{index:!0,element:d.jsx(bc,{to:"/config/global",replace:!0})},{path:"config/global",element:d.jsx(kP,{})},{path:"config/project/:projectId",element:d.jsx(ST,{})},{path:"project/:projectId",element:d.jsx(jT,{})},{path:"onboarding",element:d.jsx(wT,{})},{path:"migrate",element:d.jsx(hT,{})},{path:"statusline",element:d.jsx(zT,{})},{path:"kanban",element:d.jsx(OP,{})},{path:"skills",element:d.jsx(bc,{to:"/migrate",replace:!0})},{path:"*",element:d.jsx(bc,{to:"/",replace:!0})}]}]),B1=document.getElementById("root");if(!B1)throw document.body.innerHTML='<div style="padding:20px;color:red;">Fatal: Root element not found</div>',new Error("Root element #root not found");jd.createRoot(B1).render(d.jsx(Le.StrictMode,{children:d.jsx(j2,{children:d.jsx(O2,{children:d.jsx(S2,{router:HT})})})}));
|