@puddle-code/cli 0.0.10 → 0.0.11

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +54 -22
  2. package/dist/index.js +133 -35
  3. package/dist/public/assets/Dashboard-kSBMMJl-.js +1 -0
  4. package/dist/public/assets/{EditorTabClose-DXG0-8LG.js → EditorTabClose-AQGPNeQZ.js} +1 -1
  5. package/dist/public/assets/LazyTerminal-yvOIwEDK.js +2 -0
  6. package/dist/public/assets/{ModelRefcount-Cr0OdhVF.js → ModelRefcount-BQMI3Vu-.js} +1 -1
  7. package/dist/public/assets/PaneEditorBody-mk4tny45.js +66 -0
  8. package/dist/public/assets/SettingsDialog-CkttcYNN.js +1 -0
  9. package/dist/public/assets/{Terminal-DogmkohW.js → Terminal-Gbu8EGSD.js} +2 -2
  10. package/dist/public/assets/Workspace-Da28EOc_.js +6 -0
  11. package/dist/public/assets/api-CNOSFtPh.js +73 -0
  12. package/dist/public/assets/{buffer-store-DF2zMOcz.js → buffer-store-B6LPaCyf.js} +3 -3
  13. package/dist/public/assets/context-menu-Bsz8Kf7T.js +1 -0
  14. package/dist/public/assets/{cssMode-DYb85Jum.js → cssMode-Cb9x7qHj.js} +1 -1
  15. package/dist/public/assets/editor-tabs-D36ZKi_c.js +1 -0
  16. package/dist/public/assets/{htmlMode-DyXrW8ZC.js → htmlMode-B24wJNmk.js} +1 -1
  17. package/dist/public/assets/index-Ckwo55p_.css +2 -0
  18. package/dist/public/assets/index-DVjqBrui.js +10 -0
  19. package/dist/public/assets/{jsonMode-B5kO-8PP.js → jsonMode-CzL1xPlh.js} +1 -1
  20. package/dist/public/assets/session-seed-DFIaOrWq.js +1 -0
  21. package/dist/public/assets/ssh-mode-B1KdLV_0.js +1 -0
  22. package/dist/public/assets/{tsMode-BnA0oGE5.js → tsMode-hBn59dP5.js} +1 -1
  23. package/dist/public/index.html +4 -3
  24. package/package.json +1 -1
  25. package/dist/public/assets/Dashboard-Botzm-4a.js +0 -1
  26. package/dist/public/assets/PaneEditorBody-BzhoRYgd.js +0 -66
  27. package/dist/public/assets/SettingsDialog-Cd6rZoyo.js +0 -1
  28. package/dist/public/assets/Workspace-BDettW-h.js +0 -7
  29. package/dist/public/assets/api-BHwI7sYX.js +0 -73
  30. package/dist/public/assets/context-menu-CHZoXuDL.js +0 -1
  31. package/dist/public/assets/editor-tabs-BaSR99_-.js +0 -1
  32. package/dist/public/assets/index-BgfBBLZx.js +0 -10
  33. package/dist/public/assets/index-szwjDL7m.css +0 -2
  34. package/dist/public/assets/session-seed-Dy0HnELo.js +0 -1
  35. package/dist/public/assets/ssh-mode-CY9J7nfI.js +0 -1
@@ -1,4 +1,4 @@
1
- import{h as e,p as t}from"./editor.api2-4X9Vh9Zw.js";import{m as n}from"./buffer-store-DF2zMOcz.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b}from"./lspLanguageFeatures-x2nWJpem.js";var x=120*1e3,S=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>x&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=n({moduleId:`vs/language/json/jsonWorker`,createWorker:()=>new Worker(new URL(`/assets/json.worker-Oa9UrkKE.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId,enableSchemaRequest:this._defaults.diagnosticsOptions.enableSchemaRequest}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function C(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&E(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&E(e.charCodeAt(r)))for(r++;r<e.length&&E(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&E(e.charCodeAt(r))){for(r++;r<e.length&&E(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
1
+ import{h as e,p as t}from"./editor.api2-4X9Vh9Zw.js";import{m as n}from"./buffer-store-B6LPaCyf.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b}from"./lspLanguageFeatures-x2nWJpem.js";var x=120*1e3,S=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>x&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=n({moduleId:`vs/language/json/jsonWorker`,createWorker:()=>new Worker(new URL(`/assets/json.worker-Oa9UrkKE.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId,enableSchemaRequest:this._defaults.diagnosticsOptions.enableSchemaRequest}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function C(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&E(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&E(e.charCodeAt(r)))for(r++;r<e.length&&E(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&E(e.charCodeAt(r))){for(r++;r<e.length&&E(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
2
2
  `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(T(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(w(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(w(t));return o=15}if(T(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
3
3
  `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!T(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,T(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!E(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(w(e)||T(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function w(e){return e===32||e===9}function T(e){return e===10||e===13}function E(e){return e>=48&&e<=57}var D;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(D||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t));var O=200;Array(O).fill(0).map((e,t)=>`
4
4
  `+` `.repeat(t)),Array(O).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(O).fill(0).map((e,t)=>`\r
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{A as i,C as a,E as o,O as s,S as c,_ as l,b as u,d,f,j as p,m,p as h,v as g,w as _,x as v,y}from"./dialog-B43iKmfK.js";import{ct as b,dt as x,ft as S,it as C,lt as w,ot as T,st as E,ut as D}from"./LazyTerminal-yvOIwEDK.js";import{t as O}from"./utils-B6KiDbIe.js";import{t as k}from"./createLucideIcon-DyMAgLa3.js";import{n as A,t as j}from"./dist-VDiYuPKw.js";import{o as ee,tt as te}from"./index-DVjqBrui.js";var M=k(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),N=k(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),P=e(t(),1),F=e(n(),1);function I(e,[t,n]){return Math.min(n,Math.max(t,e))}var L=r(),R=[` `,`Enter`,`ArrowUp`,`ArrowDown`],z=[` `,`Enter`],B=`Select`,[V,H,U]=A(B),[W,ne]=s(B,[U,S]),G=S(),[re,K]=W(B),[ie,q]=W(B),ae=`SelectProvider`;function oe(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g,internal_do_not_use_render:_}=e,v=G(t),[y,b]=P.useState(null),[S,C]=P.useState(null),[w,T]=P.useState(!1),E=j(d),[D,O]=l({prop:r,defaultProp:i??!1,onChange:a,caller:B}),[k,A]=l({prop:o,defaultProp:s,onChange:c,caller:B}),ee=P.useRef(null),te=P.useRef(k);P.useEffect(()=>{let e=g?y?.ownerDocument.getElementById(g):y?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[g,y,A]);let M=!y||!!g||!!y.closest(`form`),[N,F]=P.useState(new Set),I=u(),R=Array.from(N).map(e=>e.props.value).join(`;`),z=P.useCallback(e=>{F(t=>new Set(t).add(e))},[]),H=P.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:h,trigger:y,onTriggerChange:b,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:I,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:ee,disabled:m,name:f,autoComplete:p,form:g,nativeOptions:N,nativeSelectKey:R,isFormControl:M};return(0,L.jsx)(x,{...v,children:(0,L.jsx)(re,{scope:t,...U,children:(0,L.jsx)(V.Provider,{scope:t,children:(0,L.jsx)(ie,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:H,children:tt(_)?_(U):n})})})})}oe.displayName=ae;var se=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,L.jsx)(oe,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[n,e?(0,L.jsx)(et,{__scopeSelect:t}):null]})})};se.displayName=B;var ce=`SelectTrigger`,le=P.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=G(n),s=K(ce,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=H(n),d=P.useRef(`touch`),[f,m,h]=nt(e=>{let t=u().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,L.jsx)(b,{asChild:!0,...o,children:(0,L.jsx)(_.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:p(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:p(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:p(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&R.includes(e.key)&&(g(),e.preventDefault())})})})});le.displayName=ce;var ue=`SelectValue`,de=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=K(ue,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);v(()=>{u(d)},[u,d]);let p=$(l.value);return(0,L.jsx)(_.span,{...c,asChild:!p&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,L.jsx)(P.Fragment,{children:p?s:o},p?`placeholder`:`value`)})});de.displayName=ue;var fe=`SelectIcon`,pe=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,L.jsx)(_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});pe.displayName=fe;var me=`SelectPortal`,[he,ge]=W(me,{forceMount:void 0}),_e=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,L.jsx)(he,{scope:e.__scopeSelect,forceMount:n,children:(0,L.jsx)(y,{asChild:!0,...r})})};_e.displayName=me;var J=`SelectContent`,ve=P.forwardRef((e,t)=>{let n=ge(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(J,e.__scopeSelect),[o,s]=P.useState();return v(()=>{s(new DocumentFragment)},[]),(0,L.jsx)(g,{present:r||a.open,children:({present:e})=>e?(0,L.jsx)(Ce,{...i,ref:t}):(0,L.jsx)(ye,{...i,fragment:o})})});ve.displayName=J;var ye=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?F.createPortal((0,L.jsx)(be,{scope:n,children:(0,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(`div`,{ref:t,children:r})})}),i):null});ye.displayName=`SelectContentFragment`;var Y=10,[be,X]=W(J),xe=`SelectContentImpl`,Se=o(`SelectContent.RemoveScroll`),Ce=P.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(J,n),[E,D]=P.useState(null),[O,k]=P.useState(null),A=i(t,D),[j,ee]=P.useState(null),[te,M]=P.useState(null),N=H(n),[F,I]=P.useState(!1),R=P.useRef(!1);P.useEffect(()=>{if(E)return d(E)},[E]),h();let z=P.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,O]),B=P.useCallback(()=>z([j,E]),[z,j,E]);P.useEffect(()=>{F&&B()},[F,B]);let{onOpenChange:V,triggerPointerDownPosRef:U}=T;P.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),U.current=null};return U.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,V,U]),P.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[W,ne]=nt(e=>{let t=N().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),G=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(R.current=!0))},[T.value]),re=P.useCallback(()=>E?.focus(),[E]),ie=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),q=r===`popper`?De:Te,ae=q===De?{side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,L.jsx)(be,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:G,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:F,searchRef:W,children:(0,L.jsx)(f,{as:Se,allowPinchZoom:!0,children:(0,L.jsx)(m,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,L.jsx)(c,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,L.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>I(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:p(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});Ce.displayName=xe;var we=`SelectItemAlignedPosition`,Te=P.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=K(J,n),s=X(J,n),[c,l]=P.useState(null),[u,d]=P.useState(null),f=i(t,d),p=H(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=P.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=I(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=I(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-Y*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),v=parseInt(d.paddingBottom,10),x=f+h+l+v+_,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+h+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+_);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,y,b,o.dir,r]);v(()=>S(),[S]);let[C,w]=P.useState();return v(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,L.jsx)(Oe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:P.useCallback(e=>{e&&h.current===!0&&(S(),x?.(),h.current=!1)},[S,x]),children:(0,L.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,L.jsx)(_.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Te.displayName=we;var Ee=`SelectPopperPosition`,De=P.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=G(n);return(0,L.jsx)(D,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});De.displayName=Ee;var[Oe,ke]=W(J,{}),Ae=`SelectViewport`,je=P.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(Ae,n),s=ke(Ae,n),c=i(t,o.onViewportChange),l=P.useRef(0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(_.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:p(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});je.displayName=Ae;var Me=`SelectGroup`,[Ne,Pe]=W(Me),Fe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=u();return(0,L.jsx)(Ne,{scope:n,id:i,children:(0,L.jsx)(_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Fe.displayName=Me;var Ie=`SelectLabel`,Le=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pe(Ie,n);return(0,L.jsx)(_.div,{id:i.id,...r,ref:t})});Le.displayName=Ie;var Z=`SelectItem`,[Re,ze]=W(Z),Be=P.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...c}=e,l=K(Z,n),d=X(Z,n),f=l.value===r,[m,h]=P.useState(s??``),[g,v]=P.useState(!1),y=i(t,a(e=>d.itemRefCallback?.(e,r,o))),b=u(),x=P.useRef(`touch`),S=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};return(0,L.jsx)(Re,{scope:n,value:r,disabled:o,textId:b,isSelected:f,onItemTextChange:P.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,L.jsx)(V.ItemSlot,{scope:n,value:r,disabled:o,textValue:m,children:(0,L.jsx)(_.div,{role:`option`,"aria-labelledby":b,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":o||void 0,"data-disabled":o?``:void 0,tabIndex:o?void 0:-1,...c,ref:y,onFocus:p(c.onFocus,()=>v(!0)),onBlur:p(c.onBlur,()=>v(!1)),onClick:p(c.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(c.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(c.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(c.onPointerMove,e=>{x.current=e.pointerType,o?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:p(c.onKeyDown,e=>{o||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(z.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Be.displayName=Z;var Q=`SelectItemText`,Ve=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:o,...s}=e,c=K(Q,n),l=X(Q,n),u=ze(Q,n),d=q(Q,n),[f,p]=P.useState(null),m=a(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),h=i(t,p,u.onItemTextChange,m),g=f?.textContent,y=P.useMemo(()=>(0,L.jsx)(`option`,{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return v(()=>(b(y),()=>x(y)),[b,x,y]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_.span,{id:u.textId,...s,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?F.createPortal(s.children,c.valueNode):null]})});Ve.displayName=Q;var He=`SelectItemIndicator`,Ue=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ze(He,n).isSelected?(0,L.jsx)(_.span,{"aria-hidden":!0,...r,ref:t}):null});Ue.displayName=He;var We=`SelectScrollUpButton`,Ge=P.forwardRef((e,t)=>{let n=X(We,e.__scopeSelect),r=ke(We,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ge.displayName=We;var Ke=`SelectScrollDownButton`,qe=P.forwardRef((e,t)=>{let n=X(Ke,e.__scopeSelect),r=ke(Ke,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});qe.displayName=Ke;var Je=P.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=P.useRef(null),s=H(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),v(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,L.jsx)(_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ye=`SelectSeparator`,Xe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,L.jsx)(_.div,{"aria-hidden":!0,...r,ref:t})});Xe.displayName=Ye;var Ze=`SelectArrow`,Qe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return X(Ze,n).position===`popper`?(0,L.jsx)(w,{...i,...r,ref:t}):null});Qe.displayName=Ze;var $e=`SelectBubbleInput`,et=P.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K($e,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=P.useRef(null),h=i(n,m),g=a??``,v=ee(g),y=Array.from(f).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[v,g]),(0,L.jsxs)(_.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...te,...t.style},ref:h,defaultValue:g,children:[$(a)&&!y?(0,L.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});et.displayName=$e;function tt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function nt(e){let t=a(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),o=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function rt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=it(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function it(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var at=se,ot=de;function st({className:e,children:t,...n}){return(0,L.jsxs)(le,{className:O(`flex h-8 w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,C,e),...n,children:[t,(0,L.jsx)(pe,{asChild:!0,children:(0,L.jsx)(N,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function ct({className:e,children:t,position:n=`popper`,...r}){return(0,L.jsx)(_e,{children:(0,L.jsx)(ve,{position:n,sideOffset:4,className:O(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,e),...r,children:(0,L.jsx)(je,{children:t})})})}function lt({className:e,children:t,detail:n,...r}){return(0,L.jsxs)(Be,{className:O(E,T,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,L.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,L.jsx)(Ue,{children:(0,L.jsx)(M,{className:`size-3.5`})})}),(0,L.jsx)(Ve,{children:t}),n]})}var ut={agent:{baseBranch:``,separateBranch:!0,separateWorktree:!0},terminal:{baseBranch:``,separateBranch:!1,separateWorktree:!1}};function dt(e,t){let n=t?.sessionDefaults?.[e],r=ut[e],i=n?.separateBranch??r.separateBranch;return{baseBranch:n?.baseBranch??r.baseBranch,separateBranch:i,separateWorktree:i?!0:n?.separateWorktree??r.separateWorktree}}export{st as a,lt as i,at as n,ot as o,ct as r,N as s,dt as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./index-DVjqBrui.js";function t(){return e.get()}export{t};
@@ -1,4 +1,4 @@
1
- import{a as e,c as t,f as n,h as r,o as i,p as a}from"./editor.api2-4X9Vh9Zw.js";import{m as o,p as s}from"./buffer-store-DF2zMOcz.js";var c=class{constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;let e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||=(async()=>(this._worker=o({moduleId:`vs/language/typescript/tsWorker`,createWorker:()=>new Worker(new URL(`/assets/ts.worker-BtjBFNHX.js`,``+import.meta.url),{type:`module`}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(a.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):await this._worker.getProxy()))(),this._client}async getLanguageServiceWorker(...e){let t=await this._getClient();return this._worker&&await this._worker.withSyncedResources(e),t}},l={};l[`lib.d.ts`]=!0,l[`lib.decorators.d.ts`]=!0,l[`lib.decorators.legacy.d.ts`]=!0,l[`lib.dom.asynciterable.d.ts`]=!0,l[`lib.dom.d.ts`]=!0,l[`lib.dom.iterable.d.ts`]=!0,l[`lib.es2015.collection.d.ts`]=!0,l[`lib.es2015.core.d.ts`]=!0,l[`lib.es2015.d.ts`]=!0,l[`lib.es2015.generator.d.ts`]=!0,l[`lib.es2015.iterable.d.ts`]=!0,l[`lib.es2015.promise.d.ts`]=!0,l[`lib.es2015.proxy.d.ts`]=!0,l[`lib.es2015.reflect.d.ts`]=!0,l[`lib.es2015.symbol.d.ts`]=!0,l[`lib.es2015.symbol.wellknown.d.ts`]=!0,l[`lib.es2016.array.include.d.ts`]=!0,l[`lib.es2016.d.ts`]=!0,l[`lib.es2016.full.d.ts`]=!0,l[`lib.es2016.intl.d.ts`]=!0,l[`lib.es2017.arraybuffer.d.ts`]=!0,l[`lib.es2017.d.ts`]=!0,l[`lib.es2017.date.d.ts`]=!0,l[`lib.es2017.full.d.ts`]=!0,l[`lib.es2017.intl.d.ts`]=!0,l[`lib.es2017.object.d.ts`]=!0,l[`lib.es2017.sharedmemory.d.ts`]=!0,l[`lib.es2017.string.d.ts`]=!0,l[`lib.es2017.typedarrays.d.ts`]=!0,l[`lib.es2018.asyncgenerator.d.ts`]=!0,l[`lib.es2018.asynciterable.d.ts`]=!0,l[`lib.es2018.d.ts`]=!0,l[`lib.es2018.full.d.ts`]=!0,l[`lib.es2018.intl.d.ts`]=!0,l[`lib.es2018.promise.d.ts`]=!0,l[`lib.es2018.regexp.d.ts`]=!0,l[`lib.es2019.array.d.ts`]=!0,l[`lib.es2019.d.ts`]=!0,l[`lib.es2019.full.d.ts`]=!0,l[`lib.es2019.intl.d.ts`]=!0,l[`lib.es2019.object.d.ts`]=!0,l[`lib.es2019.string.d.ts`]=!0,l[`lib.es2019.symbol.d.ts`]=!0,l[`lib.es2020.bigint.d.ts`]=!0,l[`lib.es2020.d.ts`]=!0,l[`lib.es2020.date.d.ts`]=!0,l[`lib.es2020.full.d.ts`]=!0,l[`lib.es2020.intl.d.ts`]=!0,l[`lib.es2020.number.d.ts`]=!0,l[`lib.es2020.promise.d.ts`]=!0,l[`lib.es2020.sharedmemory.d.ts`]=!0,l[`lib.es2020.string.d.ts`]=!0,l[`lib.es2020.symbol.wellknown.d.ts`]=!0,l[`lib.es2021.d.ts`]=!0,l[`lib.es2021.full.d.ts`]=!0,l[`lib.es2021.intl.d.ts`]=!0,l[`lib.es2021.promise.d.ts`]=!0,l[`lib.es2021.string.d.ts`]=!0,l[`lib.es2021.weakref.d.ts`]=!0,l[`lib.es2022.array.d.ts`]=!0,l[`lib.es2022.d.ts`]=!0,l[`lib.es2022.error.d.ts`]=!0,l[`lib.es2022.full.d.ts`]=!0,l[`lib.es2022.intl.d.ts`]=!0,l[`lib.es2022.object.d.ts`]=!0,l[`lib.es2022.regexp.d.ts`]=!0,l[`lib.es2022.string.d.ts`]=!0,l[`lib.es2023.array.d.ts`]=!0,l[`lib.es2023.collection.d.ts`]=!0,l[`lib.es2023.d.ts`]=!0,l[`lib.es2023.full.d.ts`]=!0,l[`lib.es2023.intl.d.ts`]=!0,l[`lib.es2024.arraybuffer.d.ts`]=!0,l[`lib.es2024.collection.d.ts`]=!0,l[`lib.es2024.d.ts`]=!0,l[`lib.es2024.full.d.ts`]=!0,l[`lib.es2024.object.d.ts`]=!0,l[`lib.es2024.promise.d.ts`]=!0,l[`lib.es2024.regexp.d.ts`]=!0,l[`lib.es2024.sharedmemory.d.ts`]=!0,l[`lib.es2024.string.d.ts`]=!0,l[`lib.es5.d.ts`]=!0,l[`lib.es6.d.ts`]=!0,l[`lib.esnext.array.d.ts`]=!0,l[`lib.esnext.collection.d.ts`]=!0,l[`lib.esnext.d.ts`]=!0,l[`lib.esnext.decorators.d.ts`]=!0,l[`lib.esnext.disposable.d.ts`]=!0,l[`lib.esnext.error.d.ts`]=!0,l[`lib.esnext.float16.d.ts`]=!0,l[`lib.esnext.full.d.ts`]=!0,l[`lib.esnext.intl.d.ts`]=!0,l[`lib.esnext.iterator.d.ts`]=!0,l[`lib.esnext.promise.d.ts`]=!0,l[`lib.esnext.sharedmemory.d.ts`]=!0,l[`lib.scripthost.d.ts`]=!0,l[`lib.webworker.asynciterable.d.ts`]=!0,l[`lib.webworker.d.ts`]=!0,l[`lib.webworker.importscripts.d.ts`]=!0,l[`lib.webworker.iterable.d.ts`]=!0;function u(e,t,n=0){if(typeof e==`string`)return e;if(e===void 0)return``;let r=``;if(n){r+=t;for(let e=0;e<n;e++)r+=` `}if(r+=e.messageText,n++,e.next)for(let i of e.next)r+=u(i,t,n);return r}function d(e){return e?e.map(e=>e.text).join(``):``}var f=class{constructor(e){this._worker=e}_textSpanToRange(e,t){let n=e.getPositionAt(t.start),r=e.getPositionAt(t.start+t.length),{lineNumber:i,column:a}=n,{lineNumber:o,column:s}=r;return{startLineNumber:i,startColumn:a,endLineNumber:o,endColumn:s}}},p=class{constructor(e){this._worker=e,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(e){return e?e.path.indexOf(`/lib.`)===0&&!!l[e.path.slice(1)]:!1}getOrCreateModel(e){let t=n.parse(e),r=a.getModel(t);if(r)return r;if(this.isLibFile(t)&&this._hasFetchedLibFiles)return a.createModel(this._libFiles[t.path.slice(1)],`typescript`,t);let i=s.getExtraLibs()[e];return i?a.createModel(i.content,`typescript`,t):null}_containsLibFile(e){for(let t of e)if(this.isLibFile(t))return!0;return!1}async fetchLibFilesIfNecessary(e){this._containsLibFile(e)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||=this._worker().then(e=>e.getLibFiles()).then(e=>{this._hasFetchedLibFiles=!0,this._libFiles=e}),this._fetchLibFilesPromise}},m=class extends f{constructor(e,t,n,r){super(r),this._libFiles=e,this._defaults=t,this._selector=n,this._disposables=[],this._listener=Object.create(null);let i=e=>{if(e.getLanguageId()!==n)return;let t=()=>{let{onlyVisible:t}=this._defaults.getDiagnosticsOptions();t?e.isAttachedToEditor()&&this._doValidate(e):this._doValidate(e)},r,i=e.onDidChangeContent(()=>{clearTimeout(r),r=window.setTimeout(t,500)}),o=e.onDidChangeAttached(()=>{let{onlyVisible:n}=this._defaults.getDiagnosticsOptions();n&&(e.isAttachedToEditor()?t():a.setModelMarkers(e,this._selector,[]))});this._listener[e.uri.toString()]={dispose(){i.dispose(),o.dispose(),clearTimeout(r)}},t()},o=e=>{a.setModelMarkers(e,this._selector,[]);let t=e.uri.toString();this._listener[t]&&(this._listener[t].dispose(),delete this._listener[t])};this._disposables.push(a.onDidCreateModel(e=>i(e))),this._disposables.push(a.onWillDisposeModel(o)),this._disposables.push(a.onDidChangeModelLanguage(e=>{o(e.model),i(e.model)})),this._disposables.push({dispose(){for(let e of a.getModels())o(e)}});let s=()=>{for(let e of a.getModels())o(e),i(e)};this._disposables.push(this._defaults.onDidChange(s)),this._disposables.push(this._defaults.onDidExtraLibsChange(s)),a.getModels().forEach(e=>i(e))}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}async _doValidate(e){let t=await this._worker(e.uri);if(e.isDisposed())return;let r=[],{noSyntaxValidation:i,noSemanticValidation:o,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();i||r.push(t.getSyntacticDiagnostics(e.uri.toString())),o||r.push(t.getSemanticDiagnostics(e.uri.toString())),s||r.push(t.getSuggestionDiagnostics(e.uri.toString()));let c=await Promise.all(r);if(!c||e.isDisposed())return;let l=c.reduce((e,t)=>t.concat(e),[]).filter(e=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(e.code)===-1),u=l.map(e=>e.relatedInformation||[]).reduce((e,t)=>t.concat(e),[]).map(e=>e.file?n.parse(e.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(u),!e.isDisposed()&&a.setModelMarkers(e,this._selector,l.map(t=>this._convertDiagnostics(e,t)))}_convertDiagnostics(e,t){let n=t.start||0,r=t.length||1,{lineNumber:a,column:o}=e.getPositionAt(n),{lineNumber:s,column:c}=e.getPositionAt(n+r),l=[];return t.reportsUnnecessary&&l.push(i.Unnecessary),t.reportsDeprecated&&l.push(i.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(t.category),startLineNumber:a,startColumn:o,endLineNumber:s,endColumn:c,message:u(t.messageText,`
1
+ import{a as e,c as t,f as n,h as r,o as i,p as a}from"./editor.api2-4X9Vh9Zw.js";import{m as o,p as s}from"./buffer-store-B6LPaCyf.js";var c=class{constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;let e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||=(async()=>(this._worker=o({moduleId:`vs/language/typescript/tsWorker`,createWorker:()=>new Worker(new URL(`/assets/ts.worker-BtjBFNHX.js`,``+import.meta.url),{type:`module`}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(a.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):await this._worker.getProxy()))(),this._client}async getLanguageServiceWorker(...e){let t=await this._getClient();return this._worker&&await this._worker.withSyncedResources(e),t}},l={};l[`lib.d.ts`]=!0,l[`lib.decorators.d.ts`]=!0,l[`lib.decorators.legacy.d.ts`]=!0,l[`lib.dom.asynciterable.d.ts`]=!0,l[`lib.dom.d.ts`]=!0,l[`lib.dom.iterable.d.ts`]=!0,l[`lib.es2015.collection.d.ts`]=!0,l[`lib.es2015.core.d.ts`]=!0,l[`lib.es2015.d.ts`]=!0,l[`lib.es2015.generator.d.ts`]=!0,l[`lib.es2015.iterable.d.ts`]=!0,l[`lib.es2015.promise.d.ts`]=!0,l[`lib.es2015.proxy.d.ts`]=!0,l[`lib.es2015.reflect.d.ts`]=!0,l[`lib.es2015.symbol.d.ts`]=!0,l[`lib.es2015.symbol.wellknown.d.ts`]=!0,l[`lib.es2016.array.include.d.ts`]=!0,l[`lib.es2016.d.ts`]=!0,l[`lib.es2016.full.d.ts`]=!0,l[`lib.es2016.intl.d.ts`]=!0,l[`lib.es2017.arraybuffer.d.ts`]=!0,l[`lib.es2017.d.ts`]=!0,l[`lib.es2017.date.d.ts`]=!0,l[`lib.es2017.full.d.ts`]=!0,l[`lib.es2017.intl.d.ts`]=!0,l[`lib.es2017.object.d.ts`]=!0,l[`lib.es2017.sharedmemory.d.ts`]=!0,l[`lib.es2017.string.d.ts`]=!0,l[`lib.es2017.typedarrays.d.ts`]=!0,l[`lib.es2018.asyncgenerator.d.ts`]=!0,l[`lib.es2018.asynciterable.d.ts`]=!0,l[`lib.es2018.d.ts`]=!0,l[`lib.es2018.full.d.ts`]=!0,l[`lib.es2018.intl.d.ts`]=!0,l[`lib.es2018.promise.d.ts`]=!0,l[`lib.es2018.regexp.d.ts`]=!0,l[`lib.es2019.array.d.ts`]=!0,l[`lib.es2019.d.ts`]=!0,l[`lib.es2019.full.d.ts`]=!0,l[`lib.es2019.intl.d.ts`]=!0,l[`lib.es2019.object.d.ts`]=!0,l[`lib.es2019.string.d.ts`]=!0,l[`lib.es2019.symbol.d.ts`]=!0,l[`lib.es2020.bigint.d.ts`]=!0,l[`lib.es2020.d.ts`]=!0,l[`lib.es2020.date.d.ts`]=!0,l[`lib.es2020.full.d.ts`]=!0,l[`lib.es2020.intl.d.ts`]=!0,l[`lib.es2020.number.d.ts`]=!0,l[`lib.es2020.promise.d.ts`]=!0,l[`lib.es2020.sharedmemory.d.ts`]=!0,l[`lib.es2020.string.d.ts`]=!0,l[`lib.es2020.symbol.wellknown.d.ts`]=!0,l[`lib.es2021.d.ts`]=!0,l[`lib.es2021.full.d.ts`]=!0,l[`lib.es2021.intl.d.ts`]=!0,l[`lib.es2021.promise.d.ts`]=!0,l[`lib.es2021.string.d.ts`]=!0,l[`lib.es2021.weakref.d.ts`]=!0,l[`lib.es2022.array.d.ts`]=!0,l[`lib.es2022.d.ts`]=!0,l[`lib.es2022.error.d.ts`]=!0,l[`lib.es2022.full.d.ts`]=!0,l[`lib.es2022.intl.d.ts`]=!0,l[`lib.es2022.object.d.ts`]=!0,l[`lib.es2022.regexp.d.ts`]=!0,l[`lib.es2022.string.d.ts`]=!0,l[`lib.es2023.array.d.ts`]=!0,l[`lib.es2023.collection.d.ts`]=!0,l[`lib.es2023.d.ts`]=!0,l[`lib.es2023.full.d.ts`]=!0,l[`lib.es2023.intl.d.ts`]=!0,l[`lib.es2024.arraybuffer.d.ts`]=!0,l[`lib.es2024.collection.d.ts`]=!0,l[`lib.es2024.d.ts`]=!0,l[`lib.es2024.full.d.ts`]=!0,l[`lib.es2024.object.d.ts`]=!0,l[`lib.es2024.promise.d.ts`]=!0,l[`lib.es2024.regexp.d.ts`]=!0,l[`lib.es2024.sharedmemory.d.ts`]=!0,l[`lib.es2024.string.d.ts`]=!0,l[`lib.es5.d.ts`]=!0,l[`lib.es6.d.ts`]=!0,l[`lib.esnext.array.d.ts`]=!0,l[`lib.esnext.collection.d.ts`]=!0,l[`lib.esnext.d.ts`]=!0,l[`lib.esnext.decorators.d.ts`]=!0,l[`lib.esnext.disposable.d.ts`]=!0,l[`lib.esnext.error.d.ts`]=!0,l[`lib.esnext.float16.d.ts`]=!0,l[`lib.esnext.full.d.ts`]=!0,l[`lib.esnext.intl.d.ts`]=!0,l[`lib.esnext.iterator.d.ts`]=!0,l[`lib.esnext.promise.d.ts`]=!0,l[`lib.esnext.sharedmemory.d.ts`]=!0,l[`lib.scripthost.d.ts`]=!0,l[`lib.webworker.asynciterable.d.ts`]=!0,l[`lib.webworker.d.ts`]=!0,l[`lib.webworker.importscripts.d.ts`]=!0,l[`lib.webworker.iterable.d.ts`]=!0;function u(e,t,n=0){if(typeof e==`string`)return e;if(e===void 0)return``;let r=``;if(n){r+=t;for(let e=0;e<n;e++)r+=` `}if(r+=e.messageText,n++,e.next)for(let i of e.next)r+=u(i,t,n);return r}function d(e){return e?e.map(e=>e.text).join(``):``}var f=class{constructor(e){this._worker=e}_textSpanToRange(e,t){let n=e.getPositionAt(t.start),r=e.getPositionAt(t.start+t.length),{lineNumber:i,column:a}=n,{lineNumber:o,column:s}=r;return{startLineNumber:i,startColumn:a,endLineNumber:o,endColumn:s}}},p=class{constructor(e){this._worker=e,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(e){return e?e.path.indexOf(`/lib.`)===0&&!!l[e.path.slice(1)]:!1}getOrCreateModel(e){let t=n.parse(e),r=a.getModel(t);if(r)return r;if(this.isLibFile(t)&&this._hasFetchedLibFiles)return a.createModel(this._libFiles[t.path.slice(1)],`typescript`,t);let i=s.getExtraLibs()[e];return i?a.createModel(i.content,`typescript`,t):null}_containsLibFile(e){for(let t of e)if(this.isLibFile(t))return!0;return!1}async fetchLibFilesIfNecessary(e){this._containsLibFile(e)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||=this._worker().then(e=>e.getLibFiles()).then(e=>{this._hasFetchedLibFiles=!0,this._libFiles=e}),this._fetchLibFilesPromise}},m=class extends f{constructor(e,t,n,r){super(r),this._libFiles=e,this._defaults=t,this._selector=n,this._disposables=[],this._listener=Object.create(null);let i=e=>{if(e.getLanguageId()!==n)return;let t=()=>{let{onlyVisible:t}=this._defaults.getDiagnosticsOptions();t?e.isAttachedToEditor()&&this._doValidate(e):this._doValidate(e)},r,i=e.onDidChangeContent(()=>{clearTimeout(r),r=window.setTimeout(t,500)}),o=e.onDidChangeAttached(()=>{let{onlyVisible:n}=this._defaults.getDiagnosticsOptions();n&&(e.isAttachedToEditor()?t():a.setModelMarkers(e,this._selector,[]))});this._listener[e.uri.toString()]={dispose(){i.dispose(),o.dispose(),clearTimeout(r)}},t()},o=e=>{a.setModelMarkers(e,this._selector,[]);let t=e.uri.toString();this._listener[t]&&(this._listener[t].dispose(),delete this._listener[t])};this._disposables.push(a.onDidCreateModel(e=>i(e))),this._disposables.push(a.onWillDisposeModel(o)),this._disposables.push(a.onDidChangeModelLanguage(e=>{o(e.model),i(e.model)})),this._disposables.push({dispose(){for(let e of a.getModels())o(e)}});let s=()=>{for(let e of a.getModels())o(e),i(e)};this._disposables.push(this._defaults.onDidChange(s)),this._disposables.push(this._defaults.onDidExtraLibsChange(s)),a.getModels().forEach(e=>i(e))}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}async _doValidate(e){let t=await this._worker(e.uri);if(e.isDisposed())return;let r=[],{noSyntaxValidation:i,noSemanticValidation:o,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();i||r.push(t.getSyntacticDiagnostics(e.uri.toString())),o||r.push(t.getSemanticDiagnostics(e.uri.toString())),s||r.push(t.getSuggestionDiagnostics(e.uri.toString()));let c=await Promise.all(r);if(!c||e.isDisposed())return;let l=c.reduce((e,t)=>t.concat(e),[]).filter(e=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(e.code)===-1),u=l.map(e=>e.relatedInformation||[]).reduce((e,t)=>t.concat(e),[]).map(e=>e.file?n.parse(e.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(u),!e.isDisposed()&&a.setModelMarkers(e,this._selector,l.map(t=>this._convertDiagnostics(e,t)))}_convertDiagnostics(e,t){let n=t.start||0,r=t.length||1,{lineNumber:a,column:o}=e.getPositionAt(n),{lineNumber:s,column:c}=e.getPositionAt(n+r),l=[];return t.reportsUnnecessary&&l.push(i.Unnecessary),t.reportsDeprecated&&l.push(i.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(t.category),startLineNumber:a,startColumn:o,endLineNumber:s,endColumn:c,message:u(t.messageText,`
2
2
  `),code:t.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(e,t.relatedInformation)}}_convertRelatedInformation(e,t){if(!t)return[];let n=[];return t.forEach(t=>{let r=e;if(t.file&&(r=this._libFiles.getOrCreateModel(t.file.fileName)),!r)return;let i=t.start||0,a=t.length||1,{lineNumber:o,column:s}=r.getPositionAt(i),{lineNumber:c,column:l}=r.getPositionAt(i+a);n.push({resource:r.uri,startLineNumber:o,startColumn:s,endLineNumber:c,endColumn:l,message:u(t.messageText,`
3
3
  `)})}),n}_tsDiagnosticCategoryToMarkerSeverity(t){switch(t){case 1:return e.Error;case 3:return e.Info;case 0:return e.Warning;case 2:return e.Hint}return e.Info}},h=class e extends f{get triggerCharacters(){return[`.`]}async provideCompletionItems(n,i,a,o){let s=n.getWordUntilPosition(i),c=new t(i.lineNumber,s.startColumn,i.lineNumber,s.endColumn),l=n.uri,u=n.getOffsetAt(i),d=await this._worker(l);if(n.isDisposed())return;let f=await d.getCompletionsAtPosition(l.toString(),u);if(!(!f||n.isDisposed()))return{suggestions:f.entries.map(a=>{let o=c;if(a.replacementSpan){let e=n.getPositionAt(a.replacementSpan.start),r=n.getPositionAt(a.replacementSpan.start+a.replacementSpan.length);o=new t(e.lineNumber,e.column,r.lineNumber,r.column)}let s=[];return a.kindModifiers!==void 0&&a.kindModifiers.indexOf(`deprecated`)!==-1&&s.push(r.CompletionItemTag.Deprecated),{uri:l,position:i,offset:u,range:o,label:a.name,insertText:a.name,sortText:a.sortText,kind:e.convertKind(a.kind),tags:s}})}}async resolveCompletionItem(t,n){let r=t,i=r.uri,a=r.position,o=r.offset,s=await(await this._worker(i)).getCompletionEntryDetails(i.toString(),o,r.label);return s?{uri:i,position:a,label:s.name,kind:e.convertKind(s.kind),detail:d(s.displayParts),documentation:{value:e.createDocumentationString(s)}}:r}static convertKind(e){switch(e){case C.primitiveType:case C.keyword:return r.CompletionItemKind.Keyword;case C.variable:case C.localVariable:return r.CompletionItemKind.Variable;case C.memberVariable:case C.memberGetAccessor:case C.memberSetAccessor:return r.CompletionItemKind.Field;case C.function:case C.memberFunction:case C.constructSignature:case C.callSignature:case C.indexSignature:return r.CompletionItemKind.Function;case C.enum:return r.CompletionItemKind.Enum;case C.module:return r.CompletionItemKind.Module;case C.class:return r.CompletionItemKind.Class;case C.interface:return r.CompletionItemKind.Interface;case C.warning:return r.CompletionItemKind.File}return r.CompletionItemKind.Property}static createDocumentationString(e){let t=d(e.documentation);if(e.tags)for(let n of e.tags)t+=`
4
4
 
@@ -5,17 +5,18 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/puddle.svg" />
7
7
  <title>puddle</title>
8
- <script type="module" crossorigin src="/assets/index-BgfBBLZx.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DVjqBrui.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-ffCh33zF.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/useMutation-Da9b4jwS.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
14
- <link rel="modulepreload" crossorigin href="/assets/api-BHwI7sYX.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/api-CNOSFtPh.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/utils-B6KiDbIe.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-DyMAgLa3.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/dialog-B43iKmfK.js">
18
- <link rel="stylesheet" crossorigin href="/assets/index-szwjDL7m.css">
18
+ <link rel="modulepreload" crossorigin href="/assets/LazyTerminal-yvOIwEDK.js">
19
+ <link rel="stylesheet" crossorigin href="/assets/index-Ckwo55p_.css">
19
20
  </head>
20
21
  <body>
21
22
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puddle-code/cli",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "puddle — self-hosted orchestrator for CLI coding agents: serves the cockpit UI and connects it to local or SSH hosts.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/PerceptronV/puddle-code#readme",
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{b as r,i}from"./api-BHwI7sYX.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./utils-B6KiDbIe.js";import{A as f,O as p,c as m,j as h,k as g,n as _,r as v,t as y}from"./context-menu-CHZoXuDL.js";import{i as b,r as x}from"./dist-VDiYuPKw.js";import{It as S,K as C,Lt as w,O as T,P as E,Pt as D,T as O,U as k,_t as A,in as j,kt as M,u as N,vt as P,wt as F,xt as I,z as L}from"./index-BgfBBLZx.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,r]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return T.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&T.killShell(i,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(N,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=D(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:i,onDragStart:p,onDragEnd:g,onDragOver:b}){let x=P(),[C,T]=(0,R.useState)(!1),[E,D]=(0,R.useState)(e.name),O=t=>x.mutate({id:e.id,archived:t},{onError:e=>r.error(e.message)}),A=()=>{let t=E.trim();if(!t||t===e.name){T(!1);return}x.mutate({id:e.id,name:t},{onSuccess:()=>T(!1),onError:e=>r.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(y,{children:[(0,z.jsx)(m,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:p,onDragEnd:g,onDragOver:b,className:d(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,z.jsxs)(j,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:h,label:`Reopen project`,onClick:()=>O(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:k,label:`Rename project`,onClick:()=>{D(e.name),T(!0)}}),(0,z.jsx)(G,{icon:f,label:`Archive project`,onClick:()=>O(!0)})]})})]})}),(0,z.jsx)(_,{children:e.archived?(0,z.jsxs)(v,{onSelect:()=>O(!1),children:[(0,z.jsx)(h,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(v,{onSelect:()=>{D(e.name),T(!0)},children:[(0,z.jsx)(k,{}),` Rename`]}),(0,z.jsxs)(v,{onSelect:()=>O(!0),children:[(0,z.jsx)(f,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:C,onOpenChange:T,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,z.jsx)(w,{value:E,onChange:e=>D(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(S,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>T(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!E.trim()||x.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=E(),t=F(e??void 0),n=M(),r=I(e??void 0),i=A(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),m=V(),h=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],v=r.data?.projectOrder??[],y=p(_.filter(e=>!e.archived),v),S=_.filter(e=>e.archived),w=(e,t)=>{e!==t&&i.mutate({projectOrder:g(y.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(x,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[y.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&w(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:C,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:L,label:m.open?`Close terminal`:`Open terminal`,hint:m.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:m.toggle})]}),S.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(b,{className:d(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(f,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:S.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:S.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),m.open&&(0,z.jsx)(H,{term:m.term,onExit:m.onExit}),e!==null&&(0,z.jsx)(O,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
@@ -1,66 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{_ as r,a as i,g as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f,u as p}from"./editor-tabs-BaSR99_-.js";import{b as m,r as h,t as g}from"./api-BHwI7sYX.js";import{t as ee}from"./createLucideIcon-DyMAgLa3.js";import{S as te,a as _,o as v,s as y}from"./index-BgfBBLZx.js";import{i as b,r as x}from"./editor.api2-4X9Vh9Zw.js";import{a as ne,c as S,d as re,f as C,i as ie,l as ae,n as oe,o as se,r as ce,s as le,t as ue,u as de}from"./buffer-store-DF2zMOcz.js";import{a as w,c as fe,i as pe,l as me,n as he,o as ge,r as _e,s as ve}from"./editor-sync-F3Wyveaa.js";import{r as ye}from"./buffer-logic-BrpRsL1b.js";var be=ee(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),T=e(t(),1);function xe(e){return!e}function E(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=b.CtrlCmd:e===`ctrl`?r|=b.WinCtrl:e===`alt`?r|=b.Alt:e===`shift`&&(r|=b.Shift);let i=x[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function Se(e,t){let n=E(te(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=E(te(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>v({editorWordWrap:xe(_().editorWordWrap)})})}function D(e,t,n){let i=ue(e,t),a=r(e,t),s=o(e),[c,l]=(0,T.useState)(null),[u,d]=(0,T.useState)(!1),f=(0,T.useRef)(!1),p=(0,T.useRef)(null),h=(0,T.useRef)(null),ee=(0,T.useRef)(n);ee.current=n;let te=(0,T.useRef)(!1),_=(0,T.useCallback)((e,t)=>{h.current?.cancel(),te.current=!0;try{se(i,e,t)}finally{te.current=!1}},[i]),v=(0,T.useSyncExternalStore)((0,T.useCallback)(e=>ae(i,e),[i]),()=>ce(i)),y=(0,T.useSyncExternalStore)((0,T.useCallback)(e=>ge(i,e),[i]),()=>w(i));(0,T.useEffect)(()=>{let n=a.data;if(!n||n.binary||n.content===null||f.current)return;f.current=!0;let r=S(i)!==void 0,o=oe(e,t,n.content,n.mtime_ms);l(o),!r&&me(e,t).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?ye(o,e.content)&&d(!0):m(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{ye(o,e.content)&&d(!0)}}}))})},[a.data,i,e,t]),(0,T.useEffect)(()=>{if(!c)return;let n=fe(e,t);h.current=n;let r=c.onDidChangeContent(()=>{te.current||(n(c.getValue(),S(i)??0),he(e,t))});return()=>{n.flush(),r.dispose(),h.current=null}},[c,i,e,t]),(0,T.useEffect)(()=>{!c||!y.savedElsewhere||ce(i)||a.refetch().then(e=>{ce(i)||(e.data&&e.data.content!==null&&_(e.data.content,e.data.mtime_ms),pe(i))})},[y.savedElsewhere,c,i]),(0,T.useEffect)(()=>{let e=a.data;!c||!e||e.content===null||!ce(i)&&e.mtime_ms!==S(i)&&_(e.content,e.mtime_ms)},[a.data,c,i]);let b=(0,T.useCallback)((n,r)=>{ie(i,n,r),h.current?.cancel(),ve(e,t),_e(e,t,r),d(!1)},[i,e,t]),x=(0,T.useCallback)(()=>{a.refetch().then(n=>{n.data&&n.data.content!==null&&_(n.data.content,n.data.mtime_ms),ve(e,t),d(!1)})},[i,e,t,_]),ne=(0,T.useCallback)((e,n)=>{s.mutate({path:t,content:e},{onSuccess:e=>b(n,e.mtime_ms),onError:e=>m.error(e instanceof Error?e.message:`Overwrite failed`)})},[s,t,b]),re=(0,T.useCallback)(()=>{if(!c||!ce(i))return;let e=c.getValue(),n=c.getAlternativeVersionId();s.mutate({path:t,content:e,expected_mtime_ms:S(i)},{onSuccess:e=>b(n,e.mtime_ms),onError:t=>{t instanceof g&&t.status===409&&t.code===`stale_file`?m.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>x()},cancel:{label:`Overwrite`,onClick:()=>ne(e,n)}}):m.error(t instanceof Error?t.message:`Save failed`)}})},[c,i,s,t,b,x,ne]),C=(0,T.useRef)(re);C.current=re;let le=(0,T.useCallback)(()=>{let n=p.current,r=ee.current;!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus())},[e,t]),de=(0,T.useCallback)(e=>{p.current=e,Se(e,{onSave:()=>C.current()}),le()},[le]);(0,T.useEffect)(()=>{le()},[n,c,le]);let be=(0,T.useCallback)(()=>{x()},[x]),xe,E=null;a.data?.binary?xe=`binary`:a.error?a.error instanceof g&&a.error.status===413?xe=`too-large`:(xe=`error`,E=a.error instanceof Error?a.error.message:`Failed to load file`):xe=c?`ready`:`loading`;let D=v&&y.savedElsewhere?`saved-elsewhere`:v&&y.dirtyElsewhere?`dirty-elsewhere`:null;return{status:xe,errorMessage:E,model:c,dirty:v,restoredNotice:u,discardRestore:be,peerBadge:D,save:re,onMount:de}}var O=n();function Ce({message:e,session:t,path:n,download:r}){return(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:e}),r&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>void p(t,n).catch(e=>m.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,O.jsx)(be,{className:`size-4`}),`Download`]})]})}function k({session:e,path:t,reveal:n}){let r=y(),i=D(e,t,n),a=(0,T.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(i.status===`binary`)return(0,O.jsx)(Ce,{message:`Binary file — use Download`,session:e,path:t,download:!0});if(i.status===`too-large`)return(0,O.jsx)(Ce,{message:`File too large to edit — use Download`,session:e,path:t,download:!0});if(i.status===`error`)return(0,O.jsx)(Ce,{message:i.errorMessage??`Failed to load file`,session:e,path:t});let o=i.peerBadge===`saved-elsewhere`?`Saved in another window`:i.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,O.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[i.restoredNotice&&(0,O.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,O.jsx)(`span`,{children:`Restored unsaved changes`}),(0,O.jsx)(`button`,{type:`button`,onClick:i.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),o&&(0,O.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:o}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:i.model&&(0,O.jsx)(re,{path:i.model.uri.toString(),defaultValue:i.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>i.onMount(e),loading:(0,O.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:a,tabSize:r.editorTabSize,wordWrap:r.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function A({children:e}){return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function we(e,t){let n=(0,T.useRef)(t);n.current=t,(0,T.useEffect)(()=>(le(e),()=>{n.current?.(),ne(e)}),[e])}function Te(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function Ee({session:e,refName:t,path:n,content:r}){let i=(0,T.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,O.jsx)(re,{path:Te(`puddle-view`,e,t,n),defaultValue:r,theme:de,loading:(0,O.jsx)(A,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:i,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function j({session:e,against:t,path:n}){let r=c(e,t,n);return r.isPending?(0,O.jsx)(A,{children:`…`}):r.error?(0,O.jsx)(A,{children:r.error instanceof Error?r.error.message:`Failed to load`}):r.data.binary?(0,O.jsx)(A,{children:`Binary file — deleted`}):(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,O.jsx)(Ee,{session:e,refName:t,path:n,content:r.data.content??``})})]})}function M({session:e,against:t,path:n,basePath:r}){let i=y(),a=D(e,n,null),o=c(e,t,r),s=(0,T.useRef)(null);we(ue(e,n),()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),s.current=null});let l=(0,T.useRef)(a.save);l.current=a.save;let u=(0,T.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),d=o.error instanceof g&&o.error.status===404;return a.status===`binary`||o.data?.binary?(0,O.jsx)(A,{children:`Binary file`}):a.status===`too-large`?(0,O.jsx)(A,{children:`File too large to show`}):a.status===`error`?(0,O.jsx)(A,{children:a.errorMessage??`Failed to load file`}):d?(0,O.jsx)(k,{session:e,path:n,reveal:null}):o.isPending||!a.model?(0,O.jsx)(A,{children:`…`}):o.error?(0,O.jsx)(A,{children:o.error instanceof Error?o.error.message:`Failed to load base`}):(0,O.jsx)(C,{modifiedModelPath:a.model.uri.toString(),originalModelPath:Te(`puddle-base`,e,t,r),original:o.data.content??``,language:a.model.getLanguageId(),theme:de,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(A,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null}),e.getModifiedEditor().addCommand(b.CtrlCmd|x.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:u,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function De({session:e,path:t}){return we(ue(e,t)),(0,O.jsx)(k,{session:e,path:t,reveal:null})}function Oe({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,O.jsx)(De,{session:e,path:n.path});case`deleted`:return(0,O.jsx)(j,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,O.jsx)(M,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function ke({session:e,sha:t,path:n}){let r=c(e,t,n);return r.isPending?(0,O.jsx)(A,{children:`…`}):r.error?(0,O.jsx)(A,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,O.jsx)(A,{children:`Binary file`}):(0,O.jsx)(Ee,{session:e,refName:t,path:n,content:r.data.content??``})}function Ae({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=(0,T.useRef)(null),c=(0,T.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,T.useEffect)(()=>()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),s.current=null},[]),(0,O.jsx)(C,{originalModelPath:Te(`puddle-hist-orig`,e,t,n),modifiedModelPath:Te(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:de,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,O.jsx)(A,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function je({session:e,sha:t,path:n,basePath:r}){let i=c(e,`${t}^`,r),a=c(e,t,n);return i.error instanceof g&&i.error.status===404?(0,O.jsx)(ke,{session:e,sha:t,path:n}):i.isPending||a.isPending?(0,O.jsx)(A,{children:`…`}):i.error?(0,O.jsx)(A,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):a.error?(0,O.jsx)(A,{children:a.error instanceof Error?a.error.message:`Failed to load file`}):i.data.binary||a.data.binary?(0,O.jsx)(A,{children:`Binary file`}):(0,O.jsx)(Ae,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:a.data.content??``})}function Me({session:e,sha:t,entry:n,isRootCommit:r}){switch(i(n.status,r)){case`added`:return(0,O.jsx)(ke,{session:e,sha:t,path:n.path});case`deleted`:return(0,O.jsx)(j,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,O.jsx)(je,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Ne({session:e,sha:t,path:n}){let r=u(e,t);if(r.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let i=r.data.files.find(e=>e.path===n);return i?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(Me,{session:e,sha:t,entry:i,isRootCommit:r.data.parents.length===0})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function Pe({session:e,path:t}){let n=a(e);if(n.isPending)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,O.jsx)(`div`,{className:`h-full`,children:(0,O.jsx)(Oe,{session:e,against:n.data.against,entry:r})}):(0,O.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,O.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}function Fe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ie(e){if(Array.isArray(e))return e}function Le(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Re(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ze(e,t){return Ie(e)||Le(e,t)||Be(e,t)||Re()}function Be(e,t){if(e){if(typeof e==`string`)return Fe(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fe(e,t):void 0}}var Ve=Object.entries,N=Object.setPrototypeOf,He=Object.isFrozen,Ue=Object.getPrototypeOf,We=Object.getOwnPropertyDescriptor,P=Object.freeze,F=Object.seal,Ge=Object.create,Ke=typeof Reflect<`u`&&Reflect,qe=Ke.apply,Je=Ke.construct;P||=function(e){return e},F||=function(e){return e},qe||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Je||=function(e){return new e(...[...arguments].slice(1))};var Ye=z(Array.prototype.forEach),Xe=z(Array.prototype.lastIndexOf),Ze=z(Array.prototype.pop),Qe=z(Array.prototype.push),$e=z(Array.prototype.splice),et=Array.isArray,tt=z(String.prototype.toLowerCase),nt=z(String.prototype.toString),rt=z(String.prototype.match),it=z(String.prototype.replace),at=z(String.prototype.indexOf),ot=z(String.prototype.trim),st=z(Number.prototype.toString),I=z(Boolean.prototype.toString),ct=typeof BigInt>`u`?null:z(BigInt.prototype.toString),lt=typeof Symbol>`u`?null:z(Symbol.prototype.toString),L=z(Object.prototype.hasOwnProperty),ut=z(Object.prototype.toString),R=z(RegExp.prototype.test),dt=ft(TypeError);function z(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return qe(e,t,n)}}function ft(e){return function(){return Je(e,[...arguments])}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tt;if(N&&N(e,null),!et(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(He(t)||(t[r]=e),i=e)}e[i]=!0}return e}function pt(e){for(let t=0;t<e.length;t++)L(e,t)||(e[t]=null);return e}function V(e){let t=Ge(null);for(let r of Ve(e)){var n=ze(r,2);let i=n[0],a=n[1];L(e,i)&&(et(a)?t[i]=pt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=V(a):t[i]=a)}return t}function mt(e){switch(typeof e){case`string`:return e;case`number`:return st(e);case`boolean`:return I(e);case`bigint`:return ct?ct(e):`0`;case`symbol`:return lt?lt(e):`Symbol()`;case`undefined`:return ut(e);case`function`:case`object`:{if(e===null)return ut(e);let t=e,n=H(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ut(e)}return ut(e)}default:return ut(e)}}function H(e,t){for(;e!==null;){let n=We(e,t);if(n){if(n.get)return z(n.get);if(typeof n.value==`function`)return z(n.value)}e=Ue(e)}function n(){return null}return n}function ht(e){try{return R(e,``),!0}catch{return!1}}var gt=P(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),_t=P(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),vt=P([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),yt=P([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),bt=P(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),xt=P([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),St=P([`#text`]),Ct=P(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),wt=P(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Tt=P(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Et=P([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Dt=F(/{{[\w\W]*|^[\w\W]*}}/g),Ot=F(/<%[\w\W]*|^[\w\W]*%>/g),kt=F(/\${[\w\W]*/g),At=F(/^data-[\-\w.\u00B7-\uFFFF]+$/),jt=F(/^aria-[\-\w]+$/),Mt=F(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nt=F(/^(?:\w+script|data):/i),Pt=F(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ft=F(/^html$/i),It=F(/^[a-z][.\w]*(-[.\w]+)+$/i),Lt=F(/<[/\w!]/g),Rt=F(/<[/\w]/g),zt=F(/<\/no(script|embed|frames)/i),Bt=F(/\/>/i),U={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Vt=function(){return typeof window>`u`?null:window},Ht=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ut=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Wt=function(e,t,n,r){return L(e,t)&&et(e[t])?B(r.base?V(r.base):{},e[t],r.transform):n};function Gt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vt(),t=e=>Gt(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==U.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=H(d,`cloneNode`),p=H(d,`remove`),m=H(d,`nextSibling`),h=H(d,`childNodes`),g=H(d,`parentNode`),ee=H(d,`shadowRoot`),te=H(d,`attributes`),_=o&&o.prototype?H(o.prototype,`nodeType`):null,v=o&&o.prototype?H(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let y,b=``,x,ne=!1,S=0,re=function(){if(S>0)throw dt(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},C=function(e){re(),S++;try{return y.createHTML(e)}finally{S--}},ie=function(e){re(),S++;try{return y.createScriptURL(e)}finally{S--}},ae=function(){return ne||=(x=Ht(u,i),!0),x},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,w=Ut();t.isSupported=typeof Ve==`function`&&typeof g==`function`&&se&&se.createHTMLDocument!==void 0;let fe=Dt,pe=Ot,me=kt,he=At,ge=jt,_e=Nt,ve=Pt,ye=It,be=Mt,T=null,xe=B({},[...gt,..._t,...vt,...bt,...St]),E=null,Se=B({},[...Ct,...wt,...Tt,...Et]),D=Object.seal(Ge(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),O=null,Ce=null,k=Object.seal(Ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),A=!0,we=!0,Te=!1,Ee=!0,j=!1,M=!0,De=!1,Oe=!1,ke=null,Ae=null,je=!1,Me=!1,Ne=!1,Pe=!1,Fe=!0,Ie=!1,Le=`user-content-`,Re=!0,ze=!1,Be={},N=null,He=B({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ue=null,We=B({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ke=null,qe=B({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Je=`http://www.w3.org/1998/Math/MathML`,st=`http://www.w3.org/2000/svg`,I=`http://www.w3.org/1999/xhtml`,ct=I,lt=!1,ut=null,z=B({},[Je,st,I],nt),ft=P([`mi`,`mo`,`mn`,`ms`,`mtext`]),pt=B({},ft),Kt=P([`annotation-xml`]),qt=B({},Kt),Jt=B({},[`title`,`style`,`font`,`a`,`script`]),Yt=null,Xt=[`application/xhtml+xml`,`text/html`],W=null,G=null,Zt=n.createElement(`form`),K=function(e){return e instanceof RegExp||e instanceof Function},Qt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(G&&G===e)return;(!e||typeof e!=`object`)&&(e={}),e=V(e),Yt=Xt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=Yt===`application/xhtml+xml`?nt:tt,T=Wt(e,`ALLOWED_TAGS`,xe,{transform:W}),E=Wt(e,`ALLOWED_ATTR`,Se,{transform:W}),ut=Wt(e,`ALLOWED_NAMESPACES`,z,{transform:nt}),Ke=Wt(e,`ADD_URI_SAFE_ATTR`,qe,{transform:W,base:qe}),Ue=Wt(e,`ADD_DATA_URI_TAGS`,We,{transform:W,base:We}),N=Wt(e,`FORBID_CONTENTS`,He,{transform:W}),O=Wt(e,`FORBID_TAGS`,V({}),{transform:W}),Ce=Wt(e,`FORBID_ATTR`,V({}),{transform:W}),Be=L(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?V(e.USE_PROFILES):e.USE_PROFILES:!1,A=e.ALLOW_ARIA_ATTR!==!1,we=e.ALLOW_DATA_ATTR!==!1,Te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,j=e.SAFE_FOR_TEMPLATES||!1,M=e.SAFE_FOR_XML!==!1,De=e.WHOLE_DOCUMENT||!1,Me=e.RETURN_DOM||!1,Ne=e.RETURN_DOM_FRAGMENT||!1,Pe=e.RETURN_TRUSTED_TYPE||!1,je=e.FORCE_BODY||!1,Fe=e.SANITIZE_DOM!==!1,Ie=e.SANITIZE_NAMED_PROPS||!1,Re=e.KEEP_CONTENT!==!1,ze=e.IN_PLACE||!1,be=ht(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Mt,ct=typeof e.NAMESPACE==`string`?e.NAMESPACE:I,pt=L(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?V(e.MATHML_TEXT_INTEGRATION_POINTS):B({},ft),qt=L(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?V(e.HTML_INTEGRATION_POINTS):B({},Kt);let t=L(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?V(e.CUSTOM_ELEMENT_HANDLING):Ge(null);if(D=Ge(null),L(t,`tagNameCheck`)&&K(t.tagNameCheck)&&(D.tagNameCheck=t.tagNameCheck),L(t,`attributeNameCheck`)&&K(t.attributeNameCheck)&&(D.attributeNameCheck=t.attributeNameCheck),L(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(D.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),F(D),j&&(we=!1),Ne&&(Me=!0),Be&&(T=B({},St),E=Ge(null),Be.html===!0&&(B(T,gt),B(E,Ct)),Be.svg===!0&&(B(T,_t),B(E,wt),B(E,Et)),Be.svgFilters===!0&&(B(T,vt),B(E,wt),B(E,Et)),Be.mathMl===!0&&(B(T,bt),B(E,Tt),B(E,Et))),k.tagCheck=null,k.attributeCheck=null,L(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?k.tagCheck=e.ADD_TAGS:et(e.ADD_TAGS)&&(T===xe&&(T=V(T)),B(T,e.ADD_TAGS,W))),L(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?k.attributeCheck=e.ADD_ATTR:et(e.ADD_ATTR)&&(E===Se&&(E=V(E)),B(E,e.ADD_ATTR,W))),L(e,`ADD_URI_SAFE_ATTR`)&&et(e.ADD_URI_SAFE_ATTR)&&B(Ke,e.ADD_URI_SAFE_ATTR,W),L(e,`FORBID_CONTENTS`)&&et(e.FORBID_CONTENTS)&&(N===He&&(N=V(N)),B(N,e.FORBID_CONTENTS,W)),L(e,`ADD_FORBID_CONTENTS`)&&et(e.ADD_FORBID_CONTENTS)&&(N===He&&(N=V(N)),B(N,e.ADD_FORBID_CONTENTS,W)),Re&&(T[`#text`]=!0),De&&B(T,[`html`,`head`,`body`]),T.table&&(B(T,[`tbody`]),delete O.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw dt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw dt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=y;y=e.TRUSTED_TYPES_POLICY;try{b=C(``)}catch(e){throw y=t,e}}else e.TRUSTED_TYPES_POLICY===null?(y=void 0,b=``):(y===void 0&&(y=ae()),y&&typeof b==`string`&&(b=C(``)));P&&P(e),G=e},$t=B({},[..._t,...vt,...yt]),en=B({},[...bt,...xt]),tn=function(e,t,n){return t.namespaceURI===I?e===`svg`:t.namespaceURI===Je?e===`svg`&&(n===`annotation-xml`||pt[n]):!!$t[e]},nn=function(e,t,n){return t.namespaceURI===I?e===`math`:t.namespaceURI===st?e===`math`&&qt[n]:!!en[e]},rn=function(e,t,n){return t.namespaceURI===st&&!qt[n]||t.namespaceURI===Je&&!pt[n]?!1:!en[e]&&(Jt[e]||!$t[e])},an=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:ct,tagName:`template`});let n=tt(e.tagName),r=tt(t.tagName);return ut[e.namespaceURI]?e.namespaceURI===st?tn(n,t,r):e.namespaceURI===Je?nn(n,t,r):e.namespaceURI===I?rn(n,t,r):!!(Yt===`application/xhtml+xml`&&ut[e.namespaceURI]):!1},q=function(e){Qe(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw dt(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},on=function(e){cn(e);let t=h(e);if(t){let e=[];Ye(t,t=>{Qe(e,t)}),Ye(e,e=>{try{p(e)}catch{}})}let n=te(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},J=function(e,n){try{Qe(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Qe(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Me||Ne)try{q(n)}catch{}else try{n.setAttribute(e,``)}catch{}},sn=function(e){let t=te(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||E[W(i)]))try{e.removeAttribute(i)}catch{}}},cn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(_?_(e):e.nodeType)===U.element&&sn(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ln=function(e){if(!M)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=_?_(e):e.nodeType;if(n===U.processingInstruction||n===U.comment&&R(Rt,e.data)){try{p(e)}catch{}continue}if(n===U.element){let t=e,n=W(v?v(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},un=function(e){let t=null,r=null;if(je)e=`<remove></remove>`+e;else{let t=rt(e,/^[\r\n\t ]+/);r=t&&t[0]}Yt===`application/xhtml+xml`&&ct===I&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=y?C(e):e;if(ct===I)try{t=new l().parseFromString(i,Yt)}catch{}if(!t||!t.documentElement){t=se.createDocument(ct,`template`,null);try{t.documentElement.innerHTML=lt?b:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ct===I?ue.call(t,De?`html`:`body`)[0]:De?t.documentElement:a},dn=function(e){return ce.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fn=function(e){return e=it(e,fe,` `),e=it(e,pe,` `),e=it(e,me,` `),e},pn=function(e){e.normalize();let t=ce.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=fn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ye(r,e=>{hn(e.content)&&pn(e.content)})},mn=function(e){let t=v?v(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==te(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==_(e)||e.childNodes!==h(e)},hn=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return _(e)===U.documentFragment}catch{return!1}},gn=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return typeof _(e)==`number`}catch{return!1}};function Y(e,n,r){e.length!==0&&Ye(e,e=>{e.call(t,n,r,G)})}let _n=function(e,t){return!!(M&&e.hasChildNodes()&&!gn(e.firstElementChild)&&R(Lt,e.textContent)&&R(Lt,e.innerHTML)||M&&e.namespaceURI===I&&t===`style`&&gn(e.firstElementChild)||e.nodeType===U.processingInstruction||M&&e.nodeType===U.comment&&R(Rt,e.data))},vn=function(e,t){if(!O[t]&&Sn(t)&&(D.tagNameCheck instanceof RegExp&&R(D.tagNameCheck,t)||D.tagNameCheck instanceof Function&&D.tagNameCheck(t)))return!1;if(Re&&!N[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=ze?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return q(e),!0},yn=function(e,n){if(Y(w.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(mn(e))return q(e),!0;let r=W(v?v(e):e.nodeName);if(Y(w.uponSanitizeElement,e,{tagName:r,allowedTags:T}),e!==n&&g(e)===null)return!0;if(_n(e,r))return q(e),!0;if(O[r]||!(k.tagCheck instanceof Function&&k.tagCheck(r))&&!T[r]){let t=vn(e,r);return t===!1&&Y(w.afterSanitizeElements,e,null),t}if((_?_(e):e.nodeType)===U.element&&!an(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&R(zt,e.innerHTML))return q(e),!0;if(j&&e.nodeType===U.text){let n=fn(e.textContent);e.textContent!==n&&(Qe(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Y(w.afterSanitizeElements,e,null),!1},bn=function(e,t,r){if(Ce[t]||M&&t===`patchsrc`||M&&t===`for`&&e!==`label`&&e!==`output`||Fe&&(t===`id`||t===`name`)&&(r in n||r in Zt))return!1;let i=E[t]||k.attributeCheck instanceof Function&&k.attributeCheck(t,e);if(!(we&&R(he,t))&&!(A&&R(ge,t))){if(!i){if(!(Sn(e)&&(D.tagNameCheck instanceof RegExp&&R(D.tagNameCheck,e)||D.tagNameCheck instanceof Function&&D.tagNameCheck(e))&&(D.attributeNameCheck instanceof RegExp&&R(D.attributeNameCheck,t)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(t,e))||t===`is`&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&R(D.tagNameCheck,r)||D.tagNameCheck instanceof Function&&D.tagNameCheck(r))))return!1}else if(!Ke[t]&&!R(be,it(r,ve,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&at(r,`data:`)===0&&Ue[e])&&!(Te&&!R(_e,it(r,ve,``)))&&r)return!1}return!0},xn=B({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Sn=function(e){return!xn[tt(e)]&&R(ye,e)},Cn=function(e,t,n,r){if(y&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return C(r);case`TrustedScriptURL`:return ie(r)}return r},wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),mn(e)?q(e):Ze(t.removed)}catch{J(n,e)}},Tn=function(e){Y(w.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||mn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0},r=t.length,i=W(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=W(o),u=c,d=o===`value`?u:ot(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Y(w.uponSanitizeAttribute,e,n),d=n.attrValue,Ie&&(l===`id`||l===`name`)&&at(d,Le)!==0&&(J(o,e),d=Le+d),M&&R(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){J(o,e);continue}if(l===`attributename`&&rt(d,`href`)){J(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){J(o,e);continue}if(!Ee&&R(Bt,d)){J(o,e);continue}if(j&&(d=fn(d)),!bn(i,l,d)){J(o,e);continue}d=Cn(i,l,s,d),d!==u&&wn(e,o,s,d)}}Y(w.afterSanitizeAttributes,e,null)},En=function(e){let t=null,n=dn(e);for(Y(w.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Y(w.uponSanitizeShadowNode,t,null),yn(t,e),Tn(t),hn(t.content)&&En(t.content),(_?_(t):t.nodeType)===U.element){let e=ee(t);hn(e)&&(Dn(e),En(e))}Y(w.afterSanitizeShadowDOM,e,null)},Dn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){En(e.shadow);continue}let n=e.node,r=(_?_(n):n.nodeType)===U.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=v?v(n):null;if(typeof e==`string`&&W(e)===`template`){let e=n.content;hn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ee(n);hn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(lt=!e,lt&&(e=`<!-->`),typeof e!=`string`&&!gn(e)&&(e=mt(e),typeof e!=`string`))throw dt(`dirty is not a string, aborting`);if(!t.isSupported)return e;Oe?(T=ke,E=Ae):Qt(n),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(T=V(T)),w.uponSanitizeAttribute.length>0&&(E=V(E)),t.removed=[];let c=ze&&typeof e!=`string`&&gn(e);if(c){ln(e);let t=v?v(e):e.nodeName;if(typeof t==`string`){let n=W(t);if(!T[n]||O[n])throw on(e),dt(`root node is forbidden and cannot be sanitized in-place`)}if(mn(e))throw on(e),dt(`root node is clobbered and cannot be sanitized in-place`);try{Dn(e)}catch(t){throw on(e),t}}else if(gn(e))i=un(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===U.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dn(a);else{if(!Me&&!j&&!De&&e.indexOf(`<`)===-1)return y&&Pe?C(e):e;if(i=un(e),!i)return Me?null:Pe?b:``}i&&je&&q(i.firstChild);let l=c?e:i,u=dn(l);try{for(;o=u.nextNode();)yn(o,l),Tn(o),hn(o.content)&&En(o.content)}catch(n){throw c&&(on(e),Ye(t.removed,e=>{e.element&&cn(e.element)})),n}if(c)return Ye(t.removed,e=>{e.element&&cn(e.element)}),j&&pn(e),e;if(Me){if(j&&pn(i),Ne)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(E.shadowroot||E.shadowrootmode)&&(s=de.call(r,s,!0)),s}let d=De?i.outerHTML:i.innerHTML;return De&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&R(Ft,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
- `+d),j&&(d=fn(d)),y&&Pe?C(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qt(e),Oe=!0,ke=T,Ae=E},t.clearConfig=function(){G=null,Oe=!1,ke=null,Ae=null,y=x,b=``},t.isValidAttribute=function(e,t,n){G||Qt({});let r=W(e),i=W(t);return bn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&L(w,e)&&Qe(w[e],t)},t.removeHook=function(e,t){if(L(w,e)){if(t!==void 0){let n=Xe(w[e],t);return n===-1?void 0:$e(w[e],n,1)[0]}return Ze(w[e])}},t.removeHooks=function(e){L(w,e)&&(w[e]=[])},t.removeAllHooks=function(){w=Ut()},t}var Kt=Gt();function qt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Jt=qt();function Yt(e){Jt=e}var Xt={exec:()=>null};function W(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function G(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(K.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Zt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),K={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:W(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:W(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:W(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:W(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:W(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:W(e=>RegExp(`^ {0,${e}}>`))},Qt=/^(?:[ \t]*(?:\n|$))+/,$t=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,en=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,rn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,an=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,q=G(an).replace(/bull/g,rn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),on=G(an).replace(/bull/g,rn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),J=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,sn=/^[^\n]+/,cn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ln=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,cn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),un=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,rn).getRegex(),dn=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,fn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,pn=G(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,fn).replace(`tag`,dn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mn=e=>G(J).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,dn).getRegex(),hn=mn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),gn=mn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Y={blockquote:G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,gn).getRegex(),code:$t,def:ln,fences:en,heading:nn,hr:tn,html:pn,lheading:q,list:un,newline:Qt,paragraph:hn,table:Xt,text:sn},_n=G(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,dn).getRegex(),vn={...Y,lheading:on,table:_n,paragraph:G(J).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,_n).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,dn).getRegex()},yn={...Y,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,fn).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(J).replace(`hr`,tn).replace(`heading`,` *#{1,6} *[^
4
- ]`).replace(`lheading`,q).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},bn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sn=/^( {2,}|\\)\n(?!\s*$)/,Cn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wn=/[\p{P}\p{S}]/u,Tn=/[\s\p{P}\p{S}]/u,En=/[^\s\p{P}\p{S}]/u,Dn=G(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Tn).getRegex(),On=/(?!~)[\p{P}\p{S}]/u,kn=/(?!~)[\s\p{P}\p{S}]/u,An=/(?:[^\s\p{P}\p{S}]|~)/u,jn=G(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Zt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Mn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Nn=G(Mn,`u`).replace(/punct/g,wn).getRegex(),Pn=G(Mn,`u`).replace(/punct/g,On).getRegex(),Fn=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,In=G(Fn,`gu`).replace(/notPunctSpace/g,En).replace(/punctSpace/g,Tn).replace(/punct/g,wn).getRegex(),Ln=G(Fn,`gu`).replace(/notPunctSpace/g,An).replace(/punctSpace/g,kn).replace(/punct/g,On).getRegex(),Rn=G(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,En).replace(/punctSpace/g,Tn).replace(/punct/g,wn).getRegex(),zn=G(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,wn).getRegex(),Bn=G(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,En).replace(/punctSpace/g,Tn).replace(/punct/g,wn).getRegex(),Vn=G(/\\(punct)/,`gu`).replace(/punct/g,wn).getRegex(),Hn=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Un=G(fn).replace(`(?:-->|$)`,`-->`).getRegex(),Wn=G(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Un).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Kn=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Gn).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qn=G(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Gn).replace(`ref`,cn).getRegex(),Jn=G(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,cn).getRegex(),Yn=G(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,qn).replace(`nolink`,Jn).getRegex(),Xn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Zn={_backpedal:Xt,anyPunctuation:Vn,autolink:Hn,blockSkip:jn,br:Sn,code:xn,del:Xt,delLDelim:Xt,delRDelim:Xt,emStrongLDelim:Nn,emStrongRDelimAst:In,emStrongRDelimUnd:Rn,escape:bn,link:Kn,nolink:Jn,punctuation:Dn,reflink:qn,reflinkSearch:Yn,tag:Wn,text:Cn,url:Xt},Qn={...Zn,link:G(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Gn).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Gn).getRegex()},$n={...Zn,emStrongRDelimAst:Ln,emStrongLDelim:Pn,delLDelim:zn,delRDelim:Bn,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Xn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Xn).getRegex()},er={...$n,br:G(Sn).replace(`{2,}`,`*`).getRegex(),text:G($n.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},tr={normal:Y,gfm:vn,pedantic:yn},nr={normal:Zn,gfm:$n,breaks:er,pedantic:Qn},rr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},ir=e=>rr[e];function X(e,t){if(t){if(K.escapeTest.test(e))return e.replace(K.escapeReplace,ir)}else if(K.escapeTestNoEncode.test(e))return e.replace(K.escapeReplaceNoEncode,ir);return e}function ar(e){try{e=encodeURI(e).replace(K.percentDecode,`%`)}catch{return null}return e}function or(e,t){let n=e.replace(K.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(K.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(K.slashPipe,`|`);return n}function sr(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function cr(e){let t=e.split(`
5
- `),n=t.length-1;for(;n>=0&&K.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
6
- `)}function lr(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function ur(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function dr(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function fr(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
7
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
8
- `)}var pr=class{options;rules;lexer;constructor(e){this.options=e||Jt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:cr(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=fr(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=sr(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:sr(t[0],`
9
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:sr(t[0],`
10
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=sr(t[0],`
11
- `).split(`
12
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
13
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
14
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
15
- ${s}`:s,r=r?`${r}
16
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
17
- `+e.join(`
18
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
19
- `+e.join(`
20
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
21
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=ur(t[2].split(`
22
- `,1)[0],t[1].length),l=e.split(`
23
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
24
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
25
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
26
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
27
- `+l}u=!l.trim(),r+=p+`
28
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=cr(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:sr(t[0],`
29
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=or(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
30
- `):[],a={type:`table`,raw:sr(t[0],`
31
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(or(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:sr(t[0],`
32
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
33
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=sr(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=lr(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),dr(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return dr(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Z=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Jt,this.options.tokenizer=this.options.tokenizer||new pr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:K,block:tr.normal,inline:nr.normal};this.options.pedantic?(t.block=tr.pedantic,t.inline=nr.pedantic):this.options.gfm&&(t.block=tr.gfm,this.options.breaks?t.inline=nr.breaks:t.inline=nr.gfm),this.tokenizer.rules=t}static get rules(){return{block:tr,inline:nr}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(K.carriageReturn,`
34
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(K.tabCharGlobal,` `).replace(K.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
35
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
36
- `)?``:`
37
- `)+i.raw,n.text+=`
38
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
39
- `)?``:`
40
- `)+i.raw,n.text+=`
41
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
42
- `)?``:`
43
- `)+i.raw,r.text+=`
44
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
45
- `)?``:`
46
- `)+i.raw,n.text+=`
47
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,`++`),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},mr=class{options;parser;constructor(e){this.options=e||Jt}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(K.notSpaceStart)?.[0],i=e.replace(K.endingNewline,``)+`
48
- `;return r?`<pre><code class="language-`+X(r)+`">`+(n?i:X(i,!0))+`</code></pre>
49
- `:`<pre><code>`+(n?i:X(i,!0))+`</code></pre>
50
- `}blockquote({tokens:e}){return`<blockquote>
51
- ${this.parser.parse(e)}</blockquote>
52
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
53
- `}hr(e){return`<hr>
54
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
55
- `+r+`</`+i+`>
56
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
57
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
58
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
59
- <thead>
60
- `+t+`</thead>
61
- `+r+`</table>
62
- `}tablerow({text:e}){return`<tr>
63
- ${e}</tr>
64
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
65
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${X(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=ar(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+X(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ar(e);if(i===null)return X(n);e=i;let a=`<img src="${e}" alt="${X(n)}"`;return t&&(a+=` title="${X(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:X(e.text)}},hr=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Q=class e{options;renderer;textRenderer;constructor(e){this.options=e||Jt,this.options.renderer=this.options.renderer||new mr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hr}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},gr=class{options;block;constructor(e){this.options=e||Jt}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Z.lex:Z.lexInline}provideParser(e=this.block){return e?Q.parse:Q.parseInline}},_r=new class{defaults=qt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Q;Renderer=mr;TextRenderer=hr;Lexer=Z;Tokenizer=pr;Hooks=gr;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new mr(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new pr(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new gr;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];gr.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&gr.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Z.lex(e,t??this.defaults)}parser(e,t){return Q.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
66
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+X(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return _r.parse(e,t)}$.options=$.setOptions=function(e){return _r.setOptions(e),$.defaults=_r.defaults,Yt($.defaults),$},$.getDefaults=qt,$.defaults=Jt,$.use=function(...e){return _r.use(...e),$.defaults=_r.defaults,Yt($.defaults),$},$.walkTokens=function(e,t){return _r.walkTokens(e,t)},$.parseInline=_r.parseInline,$.Parser=Q,$.parser=Q.parse,$.Renderer=mr,$.TextRenderer=hr,$.Lexer=Z,$.lexer=Z.lex,$.Tokenizer=pr,$.Hooks=gr,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Q.parse,Z.lex;var vr=$.setOptions({gfm:!0,breaks:!1,async:!1});function yr(e){return vr.parse(e)}function br({session:e,path:t,kind:n}){let r=xr(e,t);return r===null?null:n===`markdown`?(0,O.jsx)(Sr,{session:e,path:t,text:r}):(0,O.jsx)(Cr,{path:t,text:r})}function xr(e,t){let n=r(e,t),i=n.data&&!n.data.binary?n.data.content:null,a=i!==null&&n.data?oe(e,t,i,n.data.mtime_ms):null;return(0,T.useSyncExternalStore)(n=>ae(ue(e,t),n),()=>a?.getValue()??null)}Kt.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&/^https?:/i.test(e.getAttribute(`href`)??``)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))});function Sr({session:e,path:t,text:n}){let r=(0,T.useMemo)(()=>Kt.sanitize(yr(n)),[n]),i=(0,T.useRef)(null);return(0,T.useEffect)(()=>{let n=i.current;if(!n)return;let r=!1,a=[];for(let i of n.querySelectorAll(`img`)){let n=s(t,i.getAttribute(`src`)??``);n&&(i.removeAttribute(`src`),h(`GET`,`/api/worktrees/${e}/media?path=${encodeURIComponent(n)}`).then(e=>e.blob()).then(e=>{if(r)return;let t=URL.createObjectURL(e);a.push(t),i.src=t}).catch(()=>void 0))}return()=>{r=!0;for(let e of a)URL.revokeObjectURL(e)}},[r,e,t]),(0,O.jsx)(`div`,{className:`h-full overflow-y-auto bg-ground`,children:(0,O.jsx)(`div`,{ref:i,onClick:e=>{let t=e.target.closest(`a`);t&&!/^https?:/i.test(t.getAttribute(`href`)??``)&&e.preventDefault()},className:`md-preview mx-auto max-w-3xl px-6 py-5 text-sm text-fg-secondary`,dangerouslySetInnerHTML:{__html:r}})})}function Cr({path:e,text:t}){return(0,O.jsx)(`iframe`,{sandbox:`allow-scripts`,srcDoc:t,title:e,className:`size-full bg-paper`})}var wr={png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,bmp:`image`,ico:`image`,avif:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,mov:`video`,mkv:`video`,avi:`video`,mp3:`audio`,wav:`audio`,ogg:`audio`,m4a:`audio`,flac:`audio`,aac:`audio`,pdf:`pdf`};function Tr(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?null:wr[t.slice(n+1).toLowerCase()]??null}function Er({session:e,path:t,kind:n}){let{url:r,error:i}=kr(e,t);return i?(0,O.jsxs)(Dr,{children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Couldn’t load this file.`}),(0,O.jsx)(Or,{session:e,path:t})]}):r?n===`image`?(0,O.jsx)(Dr,{children:(0,O.jsx)(`img`,{src:r,alt:t,className:`max-h-full max-w-full object-contain`})}):n===`video`?(0,O.jsx)(Dr,{children:(0,O.jsx)(`video`,{src:r,controls:!0,className:`max-h-full max-w-full`})}):n===`audio`?(0,O.jsx)(Dr,{children:(0,O.jsx)(`audio`,{src:r,controls:!0,className:`w-full max-w-xl`})}):(0,O.jsx)(`iframe`,{src:r,title:t,className:`h-full w-full border-0 bg-ground`}):(0,O.jsx)(Dr,{children:(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`…`})})}function Dr({children:e}){return(0,O.jsx)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 overflow-auto bg-ground p-4`,children:e})}function Or({session:e,path:t}){return(0,O.jsx)(`button`,{type:`button`,onClick:()=>void p(e,t).catch(e=>m.error(e instanceof Error?e.message:`Download failed`)),className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})}function kr(e,t){let[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1);return(0,T.useEffect)(()=>{let n=null,i=!1;return r(null),a(!1),h(`GET`,`/api/worktrees/${e}/media?path=${encodeURIComponent(t)}`).then(e=>e.blob()).then(e=>{i||(n=URL.createObjectURL(e),r(n))}).catch(()=>{i||a(!0)}),()=>{i=!0,n&&URL.revokeObjectURL(n)}},[e,t]),{url:n,error:i}}function Ar({tab:e,reveal:t}){let n=l(e);if(n===`diff`)return(0,O.jsx)(Pe,{session:e.session,path:e.path},f(e));if(n===`commit`&&e.sha)return(0,O.jsx)(Ne,{session:e.session,sha:e.sha,path:e.path},f(e));let r=Tr(e.path);if(r)return(0,O.jsx)(Er,{session:e.session,path:e.path,kind:r},f(e));let i=e.view===`preview`?d(e.path):null;return i?(0,O.jsx)(br,{session:e.session,path:e.path,kind:i},f(e)):(0,O.jsx)(k,{session:e.session,path:e.path,reveal:t},f(e))}export{Ar as PaneEditorBody};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{b as r,d as i,f as a,h as o,l as s,m as c,p as l,u}from"./api-BHwI7sYX.js";import{a as d,g as f,i as p,n as m,o as h,r as g,t as _}from"./dialog-B43iKmfK.js";import{t as v}from"./utils-B6KiDbIe.js";import{t as y}from"./createLucideIcon-DyMAgLa3.js";import{a as b,c as x,d as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k,u as ee}from"./session-seed-Dy0HnELo.js";import{i as te,r as ne}from"./dist-VDiYuPKw.js";import{A as re,C as ie,D as ae,E as oe,F as se,G as ce,H as le,I as ue,It as de,L as fe,Lt as A,N as pe,P as j,Qt as me,R as he,Rt as M,St as N,V as P,W as ge,X as _e,Z as ve,_t as F,a as ye,at as be,b as xe,f as Se,ft as I,g as Ce,gt as L,ht as R,i as we,j as Te,k as Ee,kt as De,l as Oe,lt as ke,m as Ae,mt as je,nn as Me,nt as Ne,o as z,p as Pe,s as B,st as Fe,tt as Ie,ut as Le,v as Re,wt as ze,x as Be,xt as V,y as Ve,yt as He}from"./index-BgfBBLZx.js";var Ue=y(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),We=y(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ge=y(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=y(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),qe=y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Je=y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ye=y(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Xe=y(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ze=y(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),H=e(t(),1),U=n();function W({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,U.jsxs)(`div`,{className:v(`flex items-center gap-4 py-2.5`,a),children:[(0,U.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,U.jsx)(`span`,{className:v(`text-xs text-fg-muted`,n),children:t})]}),(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function G({children:e,note:t}){return(0,U.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function Qe(){let e=B(),[t,n]=(0,H.useState)(Me());return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`This browser only`,children:`Appearance`}),(0,U.jsx)(W,{label:`Theme`,description:`Chrome, terminal, and editor restyle together.`,children:(0,U.jsxs)(D,{value:t,onValueChange:e=>{n(e),me(e)},children:[(0,U.jsx)(E,{className:`w-32`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:`dark`,children:`Dark`}),(0,U.jsx)(b,{value:`light`,children:`Light`}),(0,U.jsx)(b,{value:`system`,children:`System`})]})]})}),(0,U.jsx)(W,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,U.jsx)(A,{id:`ui-font-size`,type:`number`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onChange:e=>z({uiFontSize:Number(e.target.value)||we.uiFontSize})})}),(0,U.jsx)(W,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,U.jsx)(A,{id:`terminal-font-size`,type:`number`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onChange:e=>z({terminalFontSize:Number(e.target.value)||13})})}),(0,U.jsx)(W,{label:`Density`,children:(0,U.jsxs)(D,{value:e.density,onValueChange:e=>z({density:e}),children:[(0,U.jsx)(E,{className:`w-36`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:`compact`,children:`Compact`}),(0,U.jsx)(b,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,U.jsx)(W,{label:`Reduced motion`,description:`Status ripples become static dots.`,htmlFor:`reduced-motion`,children:(0,U.jsx)(T,{id:`reduced-motion`,checked:e.reducedMotion,onCheckedChange:e=>z({reducedMotion:e})})}),(0,U.jsx)(W,{label:`All projects in the sidebar`,description:`Show every project's sessions in the right sidebar, grouped by project.`,htmlFor:`all-project-sessions`,children:(0,U.jsx)(T,{id:`all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>z({showAllProjectSessions:e})})})]})}function $e({profile:e}){let t=L(),[n,i]=(0,H.useState)(!1),a=n=>{t.mutate({id:e.id,icon:n},{onError:e=>r.error(e.message)}),i(!1)},o=n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>r.error(e.message)});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(W,{label:`Icon`,description:`The glyph shown wherever this profile appears.`,children:(0,U.jsxs)(Se,{open:n,onOpenChange:i,children:[(0,U.jsx)(Ae,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,U.jsx)(se,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,U.jsx)(Pe,{align:`end`,className:`w-72`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>a(null),className:v(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,U.jsx)(se,{icon:null,colour:null,className:`size-4`})}),fe.map(({name:t,Icon:n})=>(0,U.jsx)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:v(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,U.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,U.jsx)(W,{label:`Icon colour`,description:`Any theme colour; recolours with light/dark.`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsxs)(`button`,{type:`button`,title:`Default`,onClick:()=>o(null),className:v(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,!e.icon_colour&&`bg-elevated`),children:[(0,U.jsx)(`span`,{className:`size-3.5 rounded-full bg-fg-muted`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Default colour`})]}),c.map(t=>(0,U.jsxs)(`button`,{type:`button`,title:t,onClick:()=>o(t),className:v(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,e.icon_colour===t&&`bg-elevated`),children:[(0,U.jsx)(`span`,{className:v(`size-3.5 rounded-full bg-current`,ue(t))}),(0,U.jsx)(`span`,{className:`sr-only`,children:t})]},t))]})})]})}var K=`__none__`;function et(){let e=j(),t=N().data?.find(t=>t.id===e),n=_e(e??void 0),i=V(e??void 0),a=L(),o=F(e??``),c=Fe(),[l,u]=(0,H.useState)(``),[v,y]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[w,T]=(0,H.useState)(``);if((0,H.useEffect)(()=>{t&&(u(t.name),y(t.branch_prefix))},[t]),!t)return null;let k=i.data?.default_account_id;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Profile`}),(0,U.jsxs)(W,{label:`Name`,description:`A display label. Letters, digits, dot, underscore and hyphen; must be unique.`,htmlFor:`profile-name`,children:[(0,U.jsx)(A,{id:`profile-name`,value:l,onChange:e=>u(e.target.value),className:`w-44 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:l===t.name||l.trim()===``||a.isPending,onClick:()=>a.mutate({id:t.id,name:l},{onError:e=>r.error(e.message)}),children:`Save`})]}),(0,U.jsxs)(W,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,U.jsx)(A,{id:`branch-prefix`,value:v,onChange:e=>y(e.target.value),placeholder:s,className:`w-44 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:v===t.branch_prefix||a.isPending,onClick:()=>a.mutate({id:t.id,branch_prefix:v},{onError:e=>r.error(e.message)}),children:`Save`})]}),(0,U.jsx)($e,{profile:t}),(0,U.jsx)(W,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,U.jsxs)(D,{value:typeof k==`number`?String(k):K,onValueChange:e=>o.mutate({default_account_id:e===K?null:Number(e)},{onError:e=>r.error(e.message)}),children:[(0,U.jsx)(E,{className:`w-56`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(C,{children:[(0,U.jsx)(b,{value:K,children:`First available`}),n.data?.map(e=>(0,U.jsx)(b,{value:String(e.id),children:(0,U.jsxs)(`span`,{className:`font-mono`,children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,U.jsx)(W,{label:`Delete profile`,description:`Removes its projects, accounts (logging them out), and archived history. Non-archived sessions block deletion.`,className:`mt-4`,children:(0,U.jsx)(f,{variant:`danger`,size:`sm`,onClick:()=>S(!0),children:`Delete…`})}),(0,U.jsx)(_,{open:x,onOpenChange:e=>{e||(S(!1),T(``))},children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{children:[`Delete profile `,(0,U.jsx)(`span`,{className:`font-mono`,children:t.name}),`?`]}),(0,U.jsx)(g,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(de,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,U.jsx)(`span`,{className:`font-mono text-fg`,children:t.name}),` to confirm`]}),(0,U.jsx)(A,{id:`delete-confirm-name`,value:w,onChange:e=>T(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>{S(!1),T(``)},children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:w!==t.name||c.isPending,onClick:()=>c.mutate(t.id,{onSuccess:()=>{Ee(),pe.set(null)},onError:e=>{S(!1),T(``),r.error(e.message)}}),children:`Delete profile`})]})]})})]})}function tt({agentId:e,profileId:t,onClose:n}){let i=Ne(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(``),l=ke(oe(s,150)),u=a.trim()!==``&&(s.startsWith(`/`)||s.startsWith(`~`));return(0,U.jsx)(_,{open:!0,onOpenChange:e=>!e&&n(),children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsx)(h,{children:`Import an existing account`}),(0,U.jsx)(g,{children:`The directory is copied into a puddle-owned account; the original is never touched. If credentials do not travel (macOS keychain), log in once afterwards.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(A,{placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value),className:`font-mono`}),(0,U.jsx)(ae,{value:s,onValueChange:c,placeholder:`config dir on the host, e.g. ~/.claude`,hints:(l.data?.entries??[]).map(e=>({value:e.path,label:e.name})),className:`font-mono`})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,U.jsxs)(f,{disabled:!u||i.isPending,onClick:()=>i.mutate({profile_id:t,agent_type:e,label:a.trim(),import_dir:s.trim()},{onSuccess:e=>{n(),e.logged_in||r.info(`Imported without credentials — press Login to authenticate.`)},onError:e=>r.error(e.message)}),children:[(0,U.jsx)(Ge,{}),`Import`]})]})]})})}function nt({account:e,gateOpen:t}){let n=I(),i=je(),a=be(),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),[u,v]=(0,H.useState)(e.label);return(0,H.useEffect)(()=>v(e.label),[e.label]),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`input`,{value:u,onChange:e=>v(e.target.value),onBlur:()=>{let t=u.trim();if(t!==e.label){if(t===``){v(e.label);return}i.mutate({id:e.id,label:t},{onError:t=>{r.error(t.message),v(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(v(e.label),t.currentTarget.blur())},"aria-label":`Account name`,className:`-mx-1 block w-full truncate rounded-sm bg-transparent px-1 py-0.5 font-mono text-sm text-fg transition-colors hover:bg-elevated focus:bg-elevated focus:outline-none`}),(0,U.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-running`:`text-waiting`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,U.jsx)(T,{checked:e.skip_permissions_default,onCheckedChange:t=>i.mutate({id:e.id,skip_permissions_default:t},{onError:e=>r.error(e.message)})})]}),(0,U.jsxs)(f,{size:`sm`,variant:`secondary`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:e=>s(e.stream),onError:e=>r.error(e.message)}),children:[(0,U.jsx)(ce,{}),e.logged_in?`Re-login`:`Login`]}),(0,U.jsxs)(f,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>l(!0),children:[(0,U.jsx)(x,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),o&&(0,U.jsx)(Oe,{stream:o,label:`${e.agent_type}/${e.label}`,onClose:()=>s(null)}),(0,U.jsx)(_,{open:c,onOpenChange:l,children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{children:[`Delete `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.label}),`?`]}),(0,U.jsx)(g,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>l(!1),onError:e=>{l(!1),r.error(e.message)}}),children:`Delete account`})]})]})})]})}function rt(){let e=j(),t=ve(),n=_e(e??void 0),i=V(e??void 0),a=Ne(),o=I(),[s,c]=(0,H.useState)({}),[l,u]=(0,H.useState)(null),[d,p]=(0,H.useState)(null),m=i.data?.allowSkipPermissions===!0,h=t=>{let n=(s[t]??``).trim();!n||e===null||a.mutate({profile_id:e,agent_type:t,label:n},{onSuccess:e=>{c(e=>({...e,[t]:``})),o.mutate(e.id,{onSuccess:n=>u({stream:n.stream,label:`${t}/${e.label}`})})},onError:e=>r.error(e.message)})};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[];return(0,U.jsxs)(`div`,{className:`mb-5`,children:[(0,U.jsx)(W,{label:e.display_name,description:`Accounts are isolated config dirs under this profile.`,className:`py-1`,children:(0,U.jsx)(`span`,{className:`font-mono text-2xs text-fg-muted`,children:e.id})}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,U.jsx)(nt,{account:t,gateOpen:m&&e.capabilities.skip_permissions},t.id)),(0,U.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),h(e.id)},children:[(0,U.jsx)(A,{placeholder:`label, e.g. personal`,value:s[e.id]??``,onChange:t=>c(n=>({...n,[e.id]:t.target.value})),className:`w-48 font-mono`}),(0,U.jsxs)(f,{type:`submit`,size:`sm`,variant:`secondary`,disabled:!(s[e.id]??``).trim()||a.isPending,children:[(0,U.jsx)(le,{}),`Add account`]}),(0,U.jsxs)(f,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>p(e.id),children:[(0,U.jsx)(Ge,{}),`Import existing…`]})]})]})]},e.id)}),l&&(0,U.jsx)(Oe,{stream:l.stream,label:l.label,onClose:()=>u(null)}),d!==null&&e!==null&&(0,U.jsx)(tt,{agentId:d,profileId:e,onClose:()=>p(null)})]})}function it(){let e=Ie(),t=R(),[n,r]=(0,H.useState)(``);return(0,H.useEffect)(()=>{e.data&&r(e.data.agentPath)},[e.data]),(0,U.jsx)(W,{label:`Agent search path (host-wide)`,description:`Colon-separated dirs the daemon prepends to PATH to find agent CLIs like claude (e.g. ~/.local/bin). Applies after the daemon restarts.`,htmlFor:`agent-path`,children:(0,U.jsx)(A,{id:`agent-path`,type:`text`,className:`w-64 font-mono text-2xs`,value:n,onChange:e=>r(e.target.value),onBlur:()=>{e.data&&n!==e.data.agentPath&&t.mutate({agentPath:n})}})})}function at({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=k(e,n),o=n.sessionDefaults??{},[s,c]=(0,H.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,U.jsx)(W,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,U.jsx)(A,{id:`${e}-default-base`,type:`text`,placeholder:`repository default`,className:`w-48 font-mono`,value:s,onChange:e=>c(e.target.value),onBlur:()=>{s.trim()!==a.baseBranch&&l({baseBranch:s.trim()})}})}),(0,U.jsx)(W,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,U.jsx)(T,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,U.jsx)(W,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`An own working copy of the base branch, instead of sharing one.`,htmlFor:`${e}-default-dir`,children:(0,U.jsx)(T,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function ot(){return(0,U.jsx)(W,{label:`Terminal scrollback`,description:`Lines kept per terminal. This browser only.`,htmlFor:`scrollback`,children:(0,U.jsx)(A,{id:`scrollback`,type:`number`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:B().terminalScrollback,onChange:e=>z({terminalScrollback:Number(e.target.value)||5e3})})})}function q({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,H.useState)(r);return(0,U.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,U.jsx)(M,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,U.jsx)(f,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var st={id:`4f3c2b1a-7e6d-5c4b-3a2f-1e0d9c8b7a6f`,title:null,agent_title:`Refactor the auth flow`,osc_title:`claude`,branch:`alice/refactor-auth`,worktree_path:`/home/alice/code/app--refactor-auth`,status:`waiting_input`,agent_type:`claude-code`};function ct({initial:e,onSave:t,pending:n}){let[r,i]=(0,H.useState)(e),a=r.length>0?r:l;return(0,U.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,U.jsx)(A,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:l}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,U.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:Ce(st,a)})]}),(0,U.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:o.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,U.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,U.jsx)(f,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(l),t(l)},children:`Reset to default`})]})]})}function lt(){let e=j(),t=N().data?.find(t=>t.id===e),n=V(e??void 0),o=F(e??``),[s,c]=(0,H.useState)(!1),[l,v]=(0,H.useState)(``),y=n.data?.allowSkipPermissions===!0,b=e=>o.mutate({allowSkipPermissions:e},{onSuccess:()=>{c(!1),v(``)},onError:e=>r.error(e.message)}),x=e=>t=>o.mutate({[e]:t},{onError:e=>r.error(e.message)});return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Sessions`}),(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-secondary`,children:`Permission prompts are on by default, everywhere. Skipping them requires this profile gate, a per-account opt-in, and a per-session toggle — and the daemon re-checks all three on every launch, resume, and hand-off.`}),(0,U.jsx)(W,{label:`Allow skipping permission prompts`,description:y?`The gate is open: opted-in accounts can start prompt-free sessions.`:`The gate is closed: every session keeps its permission prompts.`,htmlFor:`gate`,children:(0,U.jsx)(T,{id:`gate`,checked:y,onCheckedChange:e=>{e?c(!0):b(!1)}})}),(0,U.jsx)(W,{label:`Capture exported env vars`,description:n.data?.captureSessionEnv===!1?`Paused: session shells spawn plain — nothing new is captured or injected. Already-captured vars are kept for when this is re-enabled.`:`Vars exported in a session terminal persist: re-injected into its new shells and agent restarts. Values stay on the daemon host.`,htmlFor:`capture-env`,children:(0,U.jsx)(T,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:o.isPending,onCheckedChange:e=>o.mutate({captureSessionEnv:e},{onError:e=>r.error(e.message)})})}),(0,U.jsx)(it,{}),(0,U.jsx)(ot,{}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`What the new-agent and new-terminal modals open with — everything stays editable per session.`,children:`New session defaults`}),n.data&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(at,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>o.mutate({sessionDefaults:e},{onError:e=>r.error(e.message)}),pending:o.isPending},`${e}:agent-seed`),(0,U.jsx)(at,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>o.mutate({sessionDefaults:e},{onError:e=>r.error(e.message)}),pending:o.isPending},`${e}:terminal-seed`)]})]}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`Sent to the agent as its opening message when a session starts. Leave a box empty to send no preamble.`,children:`Launch text`}),n.data&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{id:`onboarding-template`,label:`New worktree`,description:`For a freshly created worktree. Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??i,defaultText:i,onSave:x(`onboardingTemplate`),pending:o.isPending},`${e}:onboarding`),(0,U.jsx)(q,{id:`concurrent-template`,label:`Existing / shared worktree`,description:`For a session joining a worktree other agents may already be working in.`,initial:n.data.concurrentTemplate??u,defaultText:u,onSave:x(`concurrentTemplate`),pending:o.isPending},`${e}:concurrent`),(0,U.jsx)(q,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot — its processes are gone.`,initial:n.data.restartTemplate??a,defaultText:a,onSave:x(`restartTemplate`),pending:o.isPending},`${e}:restart`)]})]}),(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(G,{note:`How each session's tab and sidebar label is composed from its parts.`,children:`Tab title`}),n.data&&(0,U.jsx)(ct,{initial:n.data.tabTitleTemplate??"${name}",onSave:x(`tabTitleTemplate`),pending:o.isPending},`${e}:tab-title`)]}),(0,U.jsx)(_,{open:s,onOpenChange:e=>{e||(c(!1),v(``))},children:(0,U.jsxs)(m,{children:[(0,U.jsxs)(d,{children:[(0,U.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Ye,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,U.jsx)(g,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,U.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,U.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,U.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,U.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,U.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,U.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,U.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,U.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(de,{htmlFor:`confirm-name`,children:[`Type `,(0,U.jsx)(`span`,{className:`font-mono text-fg`,children:t?.name}),` to confirm`]}),(0,U.jsx)(A,{id:`confirm-name`,value:l,onChange:e=>v(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,U.jsxs)(p,{children:[(0,U.jsx)(f,{variant:`ghost`,onClick:()=>{c(!1),v(``)},children:`Cancel`}),(0,U.jsx)(f,{variant:`danger`,disabled:l!==t?.name||o.isPending,onClick:()=>b(!0),children:`Open the gate`})]})]})})]})}var ut={desktop:!0,sound:!1,muted_projects:[]};function dt(){let e=j(),t=V(e??void 0),n=F(e??``),i=ze(e??void 0),a={...ut,...t.data?.notifications??{}},o=e=>n.mutate({notifications:e},{onError:e=>r.error(e.message)});return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`Delivery lands in a later phase`,children:`Notifications`}),(0,U.jsx)(W,{label:`Desktop notification on waiting`,description:`When a session flips to waiting for input.`,htmlFor:`notify-desktop`,children:(0,U.jsx)(T,{id:`notify-desktop`,checked:a.desktop,onCheckedChange:e=>o({...a,desktop:e})})}),(0,U.jsx)(W,{label:`Sound`,htmlFor:`notify-sound`,children:(0,U.jsx)(T,{id:`notify-sound`,checked:a.sound,onCheckedChange:e=>o({...a,sound:e})})}),(0,U.jsx)(W,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,U.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[a.muted_projects.length,` muted`]})}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1`,children:i.data?.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,U.jsx)(T,{checked:a.muted_projects.includes(e.id),onCheckedChange:t=>o({...a,muted_projects:t?[...a.muted_projects,e.id]:a.muted_projects.filter(t=>t!==e.id)})}),e.name]},e.id))})]})}function ft(){let e=B();return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`This browser only`,children:`Editor`}),(0,U.jsx)(W,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,U.jsx)(A,{id:`tab-size`,type:`number`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onChange:e=>z({editorTabSize:Number(e.target.value)||2})})}),(0,U.jsx)(W,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,U.jsx)(T,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>z({editorWordWrap:e})})}),(0,U.jsx)(W,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,U.jsx)(A,{id:`editor-link-host`,type:`text`,placeholder:`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>z({editorLinkSshHost:e.target.value})})})]})}function pt({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,H.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=xe(e.nativeEvent);t&&(n(t),a(!1))},className:v(`min-w-24 rounded-md px-2 py-1 text-center font-mono text-xs transition-colors`,i?`bg-action text-action-ink`:`bg-elevated text-fg hover:bg-border/70`),children:i?`Press keys…`:Be(e)}),!t&&(0,U.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,U.jsx)(qe,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function mt(){let e=j(),t=V(e??void 0),n=F(e??``),i=t.data?.hotkeys??{},a=(e,t)=>i[e]||t,o=new Map;for(let e of Re){let t=a(e.id,e.defaultBinding);o.set(t,(o.get(t)??0)+1)}let s=(e,t)=>n.mutate({hotkeys:{...i,[e]:t}},{onError:e=>r.error(e.message)}),c=e=>{let t={...i};delete t[e],n.mutate({hotkeys:t},{onError:e=>r.error(e.message)})};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Hotkeys`}),(0,U.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed. Browser-reserved combos (⌘W, ⌘T, ⌘⇧B, …) can’t be captured by a web tab.`}),Ve.map(e=>{let t=Re.filter(t=>t.group===e);return t.length===0?null:(0,U.jsxs)(`div`,{className:`mb-5`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=a(e.id,e.defaultBinding),n=(o.get(t)??0)>1,r=ie(t)?`Browser-reserved — won’t fire in a tab.`:n?`Conflicts with another shortcut.`:void 0;return(0,U.jsx)(W,{label:e.label,description:r,descriptionClassName:r?`text-interrupted`:void 0,children:(0,U.jsx)(pt,{value:t,isDefault:!i[e.id],onRecord:t=>s(e.id,t),onReset:()=>c(e.id)})},e.id)})]},e)})]})}var ht=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,J=65,Y=Object.fromEntries([...ht].map((e,t)=>[e,t])),gt=`H`,_t=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function vt(e){let t=4294967295;for(let n of e)t=_t[(t^n)&255]^t>>>8;return((t^4294967295)>>>0).toString(16).padStart(8,`0`)}function yt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function bt(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}async function xt(e){let t=new Blob([new TextEncoder().encode(e)]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function St(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(t).text()}function X(e,t){let n=(t%J+J)%J,r=``;for(let t of e){let e=Y[t];r+=e===void 0?t:ht[(e+n)%J]}return r}async function Ct(e){let t=await xt(JSON.stringify(e));return X(yt(t)+vt(t),1+Math.floor(Math.random()*(J-1)))}async function wt(e){let t=e.trim(),n=t[0];if(!n||Y[n]===void 0)throw Error(`Not a settings export.`);let r=X(t,-((Y[n]-Y[gt]+J)%J));if(r.length<9||r[0]!==gt)throw Error(`Not a settings export.`);let i=r.slice(0,-8),a=r.slice(-8),o=bt(i);if(vt(o)!==a)throw Error(`Settings export is corrupt (checksum mismatch).`);return JSON.parse(await St(o))}var Z=[{id:`appearance`,label:`Appearance`,fields:[{key:`theme`,store:`theme`},{key:`uiFontSize`,store:`client`},{key:`terminalFontSize`,store:`client`},{key:`density`,store:`client`},{key:`reducedMotion`,store:`client`},{key:`terminalScrollback`,store:`client`},{key:`showAllProjectSessions`,store:`client`}]},{id:`profile`,label:`Profile`,fields:[{key:`branch_prefix`,store:`profileColumn`},{key:`icon`,store:`profileColumn`},{key:`icon_colour`,store:`profileColumn`}]},{id:`sessions`,label:`Sessions`,fields:[{key:`onboardingTemplate`,store:`profileSettings`},{key:`concurrentTemplate`,store:`profileSettings`},{key:`restartTemplate`,store:`profileSettings`},{key:`tabTitleTemplate`,store:`profileSettings`},{key:`sessionDefaults`,store:`profileSettings`},{key:`allowSkipPermissions`,store:`profileSettings`}]},{id:`editor`,label:`Editor`,fields:[{key:`editorTabSize`,store:`client`},{key:`editorWordWrap`,store:`client`},{key:`editorLinkSshHost`,store:`client`}]},{id:`hotkeys`,label:`Hotkeys`,fields:[{key:`hotkeys`,store:`profileSettings`}]}];function Tt(e,t){switch(e.store){case`client`:return t.client[e.key];case`theme`:return t.theme;case`profileSettings`:return t.profileSettings[e.key];case`profileColumn`:return t.profile[e.key]}}function Et(e,t){let n={};for(let r of Z){if(!e.includes(r.id))continue;let i={};for(let e of r.fields){let n=Tt(e,t);n!==void 0&&(i[e.key]=n)}Object.keys(i).length>0&&(n[r.id]=i)}return n}function Dt(e,t){if(!e||typeof e!=`object`)return[];let n=e,r={},i={},a={},o=[];for(let e of Z){let s=n[e.id];if(!s||typeof s!=`object`)continue;let c=s,l=!1;for(let n of e.fields){if(!(n.key in c))continue;l=!0;let e=c[n.key];n.store===`client`?r[n.key]=e:n.store===`theme`?t.setTheme(e):n.store===`profileSettings`?i[n.key]=e:a[n.key]=e}l&&o.push(e.label)}return Object.keys(r).length>0&&t.setClient(r),Object.keys(i).length>0&&t.patchProfileSettings(i),Object.keys(a).length>0&&t.patchProfileColumns(a),o}function Ot(){let e=j(),t=V(e??void 0),n=N().data?.find(t=>t.id===e),i=F(e??``),a=L(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(()=>Object.fromEntries(Z.map(e=>[e.id,!0]))),y=async()=>{g(!0);try{let t=Dt(await wt(o.trim()),{setClient:e=>z(e),setTheme:e=>{typeof e==`string`&&me(e)},patchProfileSettings:e=>i.mutate(e,{onError:e=>r.error(e.message)}),patchProfileColumns:t=>{e&&a.mutate({id:e,...t},{onError:e=>r.error(e.message)})}});t.length===0?r.error(`Nothing recognised to import.`):(r.success(`Imported ${t.join(`, `)}.`),s(``))}catch(e){r.error(e.message)}finally{g(!1)}},b=async()=>{g(!0);try{let e=Et(Z.filter(e=>_[e.id]).map(e=>e.id),{client:ye(),theme:Me(),profileSettings:t.data??{},profile:n??{}});l(await Ct(e)),d(!1)}finally{g(!1)}};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Sync`}),(0,U.jsx)(`p`,{className:`mb-5 text-xs text-fg-muted`,children:`Carry your settings between machines as one string. Accounts, repositories, and anything machine-specific are never included. Applies to this profile.`}),(0,U.jsxs)(`div`,{className:`mb-6`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Import`}),(0,U.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Paste an exported string — only the settings it carries are updated.`}),(0,U.jsx)(M,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Paste a settings export…`,rows:3,spellCheck:!1,className:`resize-y font-mono text-xs`}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(f,{size:`sm`,disabled:!o.trim()||h,onClick:()=>void y(),children:`Import`})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Export`}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`mb-2 mt-1 flex items-center gap-1 text-xs text-fg-secondary transition-colors hover:text-fg`,children:[p?(0,U.jsx)(ee,{className:`size-3.5`}):(0,U.jsx)(te,{className:`size-3.5`}),`Choose what to include`]}),p&&(0,U.jsx)(`div`,{className:`mb-3 flex flex-col gap-2 pl-1`,children:Z.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(T,{checked:_[e.id]??!1,onCheckedChange:t=>v(n=>({...n,[e.id]:t}))}),e.label]},e.id))}),(0,U.jsx)(f,{size:`sm`,disabled:h,onClick:()=>void b(),children:`Export`}),c&&(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(M,{readOnly:!0,value:c,rows:3,spellCheck:!1,onFocus:e=>e.currentTarget.select(),className:`resize-y font-mono text-xs`}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsxs)(f,{size:`sm`,variant:`secondary`,onClick:()=>{navigator.clipboard?.writeText(c),d(!0)},children:[u?(0,U.jsx)(S,{}):(0,U.jsx)(w,{}),u?`Copied`:`Copy`]})})]})]})]})}function kt({repo:e}){let t=He(),n=Le(),[i,a]=(0,H.useState)(e.default_base_branch),[o,s]=(0,H.useState)(e.onboarding_notes??``),c=e=>r.error(e.message);return(0,U.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-fg`,children:e.path}),(0,U.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted tabular-nums`,children:e.last_fetched_at?`fetched ${new Date(e.last_fetched_at).toLocaleString()}`:`never fetched`}),(0,U.jsxs)(f,{size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:()=>r.success(`Fetched.`),onError:c}),children:[(0,U.jsx)(P,{}),`Fetch now`]})]}),(0,U.jsxs)(W,{label:`Default base branch`,htmlFor:`base-${e.id}`,className:`py-1.5`,children:[(0,U.jsx)(A,{id:`base-${e.id}`,value:i,onChange:e=>a(e.target.value),className:`w-40 font-mono`}),(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:i===e.default_base_branch||t.isPending,onClick:()=>t.mutate({id:e.id,default_base_branch:i},{onError:c}),children:`Save`})]}),(0,U.jsx)(W,{label:`Periodic fetch`,description:`Fetched on open and on the daemon's interval while sessions are active.`,htmlFor:`fetch-${e.id}`,className:`py-1.5`,children:(0,U.jsx)(T,{id:`fetch-${e.id}`,checked:e.fetch_enabled,onCheckedChange:n=>t.mutate({id:e.id,fetch_enabled:n},{onError:c})})}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,U.jsxs)(`label`,{htmlFor:`notes-${e.id}`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Onboarding notes`,(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Standing setup rules, injected into every fresh worktree. Agents update them via .puddle/onboarding-notes.md.`})]}),(0,U.jsx)(M,{id:`notes-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:4,className:`font-mono`}),(0,U.jsx)(`div`,{children:(0,U.jsx)(f,{size:`sm`,variant:`secondary`,disabled:o===(e.onboarding_notes??``)||t.isPending,onClick:()=>t.mutate({id:e.id,onboarding_notes:o},{onError:c}),children:`Save notes`})})]}),e.orphan_worktrees.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 rounded-md bg-elevated p-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:`Orphan worktrees — directories no session claims. Puddle never deletes these automatically; remove them by hand if unwanted.`}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,children:e.orphan_worktrees.map(e=>(0,U.jsx)(`li`,{className:`truncate font-mono text-2xs text-fg-muted`,children:e},e))})]})]})}function At(){let e=De();return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{children:`Repositories`}),e.data?.length===0&&(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No repositories yet — register one from the new-project flow on the dashboard.`}),e.data?.map(e=>(0,U.jsx)(kt,{repo:e},e.id))]})}function Q({label:e,description:t,field:n,config:i,min:a,step:o=1}){let s=R();return(0,U.jsx)(W,{label:e,description:t,htmlFor:`host-${n}`,children:(0,U.jsx)(A,{id:`host-${n}`,type:`number`,min:a,step:o,className:`w-32 tabular-nums`,defaultValue:i[n],onBlur:e=>{let t=Number(e.target.value);Number.isFinite(t)&&t!==i[n]&&s.mutate({[n]:t},{onError:e=>r.error(e.message)})}})})}function jt(){let e=Ie(),t=R();return e.data?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(G,{note:`Affects all profiles on this host`,children:`Host`}),(0,U.jsx)(Q,{label:`Fetch interval (minutes)`,description:`Periodic git fetch for repos with active sessions.`,field:`fetchIntervalMinutes`,config:e.data,min:1}),(0,U.jsx)(Q,{label:`Log size cap (bytes)`,description:`Per-terminal on-disk log cap.`,field:`logMaxBytes`,config:e.data,min:65536,step:1048576}),(0,U.jsx)(Q,{label:`Replay size (bytes)`,description:`Log tail sent to a terminal on attach.`,field:`replayBytes`,config:e.data,min:1024,step:65536}),(0,U.jsx)(Q,{label:`UI-state retention (days)`,description:`Stale workspace snapshots are swept at boot.`,field:`uiStateRetentionDays`,config:e.data,min:1}),(0,U.jsx)(W,{label:`Auto-resume`,description:`Resume interrupted sessions automatically after a daemon restart.`,htmlFor:`host-autoResume`,children:(0,U.jsx)(T,{id:`host-autoResume`,checked:e.data.autoResume,onCheckedChange:e=>t.mutate({autoResume:e},{onError:e=>r.error(e.message)})})})]}):null}var $=[{id:`appearance`,label:`Appearance`,icon:ge,render:()=>(0,U.jsx)(Qe,{})},{id:`profile`,label:`Profile`,icon:he,render:()=>(0,U.jsx)(et,{})},{id:`accounts`,label:`Accounts`,icon:Ze,render:()=>(0,U.jsx)(rt,{})},{id:`sessions`,label:`Sessions`,icon:Xe,render:()=>(0,U.jsx)(lt,{})},{id:`editor`,label:`Editor`,icon:We,render:()=>(0,U.jsx)(ft,{})},{id:`hotkeys`,label:`Hotkeys`,icon:Ke,render:()=>(0,U.jsx)(mt,{})},{id:`notifications`,label:`Notifications`,icon:Ue,render:()=>(0,U.jsx)(dt,{})},{id:`repositories`,label:`Repositories`,icon:ne,render:()=>(0,U.jsx)(At,{})},{id:`host`,label:`Host`,icon:Je,render:()=>(0,U.jsx)(jt,{})},{id:`sync`,label:`Sync`,icon:P,render:()=>(0,U.jsx)(Ot,{})}],Mt={terminal:`sessions`};function Nt(){let e=Te(),t=e===null?null:Mt[e]??e,n=$.find(e=>e.id===t)??$[0];return(0,U.jsx)(_,{open:e!==null,onOpenChange:e=>!e&&Ee(),children:(0,U.jsxs)(m,{wide:!0,className:`grid h-[34rem] grid-cols-[14rem_1fr] gap-0 overflow-hidden p-0`,children:[(0,U.jsx)(h,{className:`sr-only`,children:`Settings`}),(0,U.jsxs)(`nav`,{className:`flex flex-col gap-1 bg-surface p-2.5 pr-6`,children:[(0,U.jsx)(`span`,{className:`px-2.5 py-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`Settings`}),$.map(({id:e,label:t,icon:r})=>(0,U.jsxs)(`button`,{onClick:()=>re(e),className:v(`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors`,e===n.id?`bg-elevated text-fg`:`text-fg-secondary hover:bg-elevated hover:text-fg`),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),t]},e))]}),(0,U.jsx)(`div`,{className:`overflow-y-auto p-5`,children:n.render()})]})})}export{Nt as SettingsDialog};