@sourcegraph/amp 0.0.1761663433-g06cac3 → 0.0.1761664990-gf5b267
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +66 -66
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2036,7 +2036,7 @@ ${BI.map((J)=>`- **${J.id}** (${J.provider}): ${J.description}`).join(`
|
|
|
2036
2036
|
- Write code: { model: "${Ds}", system: "You are a senior programmer who follows coding best practices.", message: "Write a function to calculate the sum of two numbers." }
|
|
2037
2037
|
- Write tests: { model: "gpt-4o", system: "You are a senior software test writer.", message: "Review the following code to flag possible bugs, performance, and security issues. Then write tests that cover both possible existing issues as well as cases we do not want to regress in the future." }
|
|
2038
2038
|
- Answer technical question: { model: "${Ax}", system: "You are a detail-oriented senior engineer.", message: "Explain how this code works." }
|
|
2039
|
-
`,xR1={spec:{name:qi1,description:iM8,inputSchema:{type:"object",properties:{model:{type:"string",description:"The model name to use"},system:{type:"string",description:"The system message to provide context and instructions"},message:{type:"string",description:"The user message to send to the model"},contextFiles:{type:"array",items:{type:"string"},description:"Optional array of file paths or URIs to include as context"}},required:["model","system","message"]},source:"builtin"},fn:Promise.resolve().then(() => (SO0(),CO0)).then(({nodeChatLLMTool:J})=>J)}});function kO0(J){let Q=atob(J),Z=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)Z[Y]=Q.charCodeAt(Y);return new TextDecoder("utf-8").decode(Z)}var _O0;var xO0=B1(()=>{EG();z8();_O0={spec:{name:jS,description:"Run CI/CD checks (typechecker, linter, formatter, and tests) to validate the changes. Returns the success or failure status, plus the relevant log lines. If tree parameter is provided, checks will be run for that specific repository tree. Otherwise, checks will be run for the tree with the most changes or the first available tree.",inputSchema:{type:"object",properties:{tree:{type:"string",description:'URI of the specific tree/repository to run checks for (e.g., "file:///path/to/repo"). If not provided, will automatically select the most appropriate tree.'}},required:[],additionalProperties:!1},source:"builtin",meta:{disableTimeout:!0}},fn:OD({os:null,github:null,gitlab:null})}});var fO0={};R6(fO0,{nodeUndoEditTool:()=>ZV8});import{writeFile as QV8}from"node:fs/promises";function XV8(J){if(typeof J!=="object"||J===null)throw Error("args must be an object. received instead: `"+JSON.stringify(J)+"`");if(typeof J.path!=="string")throw Error("path must be a string. received instead: `"+JSON.stringify(J.path)+"`")}var ZV8=({args:J},{dir:Q,fileChangeTracker:Z})=>{return d6(async(X)=>{Lj(Q),XV8(J);let Y=fX(J.path);await HF(Y).acquire();try{let K=await Z.getLastEdit(Y);if(!K)return{status:"error",progress:{},error:{message:`No edit history found for file '${J.path}'.`}};let G=BF(K.newContent,K.oldContent,J.path),q=zN1(G);return await QV8(Y.fsPath,K.oldContent,{encoding:"utf-8",signal:X}),K.revert(),{status:"done",progress:{},result:q}}finally{HF(Y).release()}})};var hO0=B1(()=>{C0();Vz();WL();cs();hX()});var Qf;var lR1=B1(()=>{Qf={name:"mermaid",version:"11.6.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.0.4","@iconify/utils":"^2.1.33","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.13",dompurify:"^3.2.4",katex:"^0.16.9",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^15.0.7",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.2","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",chokidar:"^4.0.3",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.0.2",jison:"^0.4.18","js-base64":"^3.7.7",jsdom:"^26.0.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.2",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.10","type-fest":"^4.35.0",typedoc:"^0.27.8","typedoc-plugin-markdown":"^4.4.2",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.0.2","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}});var iV8,j11,nV8,Kj0,aV8,rV8,D=(J,Q)=>j11(J,"name",{value:Q,configurable:!0}),Q4=(J,Q)=>function(){return Q||(0,J[Kj0(J)[0]])((Q={exports:{}}).exports,Q),Q.exports},sJ=(J,Q)=>{for(var Z in Q)j11(J,Z,{get:Q[Z],enumerable:!0})},iR1=(J,Q,Z,X)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(let Y of Kj0(Q))if(!rV8.call(J,Y)&&Y!==Z)j11(J,Y,{get:()=>Q[Y],enumerable:!(X=nV8(Q,Y))||X.enumerable})}return J},Zf=(J,Q,Z)=>(iR1(J,Q,"default"),Z&&iR1(Z,Q,"default")),Z4=(J,Q,Z)=>(Z=J!=null?iV8(aV8(J)):{},iR1(Q||!J||!J.__esModule?j11(Z,"default",{value:J,enumerable:!0}):Z,J));var O6=B1(()=>{iV8=Object.create,j11=Object.defineProperty,nV8=Object.getOwnPropertyDescriptor,Kj0=Object.getOwnPropertyNames,aV8=Object.getPrototypeOf,rV8=Object.prototype.hasOwnProperty});var x$0={};R6(x$0,{default:()=>g38});function xj0(J){return String(J).replace(QN8,(Q)=>JN8[Q])}function yj0(J){if(J.default)return J.default;var Q=J.type,Z=Array.isArray(Q)?Q[0]:Q;if(typeof Z!=="string")return Z.enum[0];switch(Z){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function fj0(J){for(var Q=0;Q<KO1.length;Q++){var Z=KO1[Q];for(var X=0;X<Z.blocks.length;X++){var Y=Z.blocks[X];if(J>=Y[0]&&J<=Y[1])return Z.name}}return null}function AO1(J){for(var Q=0;Q<b11.length;Q+=2)if(J>=b11[Q]&&J<=b11[Q+1])return!0;return!1}function hj0(J,Q){YU[J]=Q}function p11(J,Q,Z){if(!YU[Q])throw Error("Font metrics not found for font: "+Q+".");var X=J.charCodeAt(0),Y=YU[Q][X];if(!Y&&J[0]in qj0)X=qj0[J[0]].charCodeAt(0),Y=YU[Q][X];if(!Y&&Z==="text"){if(AO1(X))Y=YU[Q][77]}if(Y)return{depth:Y[0],height:Y[1],italic:Y[2],skew:Y[3],width:Y[4]}}function gj0(J){var Q;if(J>=5)Q=0;else if(J>=3)Q=1;else Q=2;if(!nR1[Q]){var Z=nR1[Q]={cssEmPerMu:$11.quad[Q]/18};for(var X in $11)if($11.hasOwnProperty(X))Z[X]=$11[X][Q]}return nR1[Q]}function zO1(J){if(J instanceof KK)return J;else throw Error("Expected symbolNode but got "+String(J)+".")}function lj0(J){if(J instanceof Hf)return J;else throw Error("Expected span<HtmlDomNode> but got "+String(J)+".")}function s(J,Q,Z,X,Y,K){if(X4[J][Y]={font:Q,group:Z,replace:X},K&&X)X4[J][X]=X4[J][Y]}function H6(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:G}=J,q={type:Q,numArgs:X.numArgs,argTypes:X.argTypes,allowedInArgument:!!X.allowedInArgument,allowedInText:!!X.allowedInText,allowedInMath:X.allowedInMath===void 0?!0:X.allowedInMath,numOptionalArgs:X.numOptionalArgs||0,infix:!!X.infix,primitive:!!X.primitive,handler:Y};for(var z=0;z<Z.length;++z)oj0[Z[z]]=q;if(Q){if(K)h11[Q]=K;if(G)g11[Q]=G}}function PM(J){var{type:Q,htmlBuilder:Z,mathmlBuilder:X}=J;H6({type:Q,names:[],props:{numArgs:0},handler(){throw Error("Should never be called.")},htmlBuilder:Z,mathmlBuilder:X})}function Kf(J,Q){var Z=iF(["base"],J,Q),X=iF(["strut"]);if(X.style.height=J6(Z.height+Z.depth),Z.depth)X.style.verticalAlign=J6(-Z.depth);return Z.children.unshift(X),Z}function u11(J,Q){var Z=null;if(J.length===1&&J[0].type==="tag")Z=J[0].tag,J=J[0].body;var X=H5(J,Q,"root"),Y;if(X.length===2&&X[1].hasClass("tag"))Y=X.pop();var K=[],G=[];for(var q=0;q<X.length;q++)if(G.push(X[q]),X[q].hasClass("mbin")||X[q].hasClass("mrel")||X[q].hasClass("allowbreak")){var z=!1;while(q<X.length-1&&X[q+1].hasClass("mspace")&&!X[q+1].hasClass("newline"))if(q++,G.push(X[q]),X[q].hasClass("nobreak"))z=!0;if(!z)K.push(Kf(G,Q)),G=[]}else if(X[q].hasClass("newline")){if(G.pop(),G.length>0)K.push(Kf(G,Q)),G=[];K.push(X[q])}if(G.length>0)K.push(Kf(G,Q));var U;if(Z)U=Kf(H5(Z,Q,!0)),U.classes=["tag"],K.push(U);else if(Y)K.push(Y);var W=iF(["katex-html"],K);if(W.setAttribute("aria-hidden","true"),U){var F=U.children[0];if(F.style.height=J6(W.height+W.depth),W.depth)F.style.verticalAlign=J6(-W.depth)}return W}function OO1(J){return new Ff(J)}function FO1(J,Q,Z,X,Y){var K=dZ(J,Z),G;if(K.length===1&&K[0]instanceof XK&&K8.contains(["mrow","mtable"],K[0].type))G=K[0];else G=new g0.MathNode("mrow",K);var q=new g0.MathNode("annotation",[new g0.TextNode(Q)]);q.setAttribute("encoding","application/x-tex");var z=new g0.MathNode("semantics",[G,q]),U=new g0.MathNode("math",[z]);if(U.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),X)U.setAttribute("display","block");var W=Y?"katex":"katex-mathml";return Y0.makeSpan([W],[U])}function a8(J,Q){if(!J||J.type!==Q)throw Error("Expected node of type "+Q+", but got "+(J?"node of type "+J.type:String(J)));return J}function l11(J){var Q=Bf(J);if(!Q)throw Error("Expected node of symbol group type, but got "+(J?"node of type "+J.type:String(J)));return Q}function Bf(J){if(J&&(J.type==="atom"||IN8.hasOwnProperty(J.type)))return J;return null}function IO1(J,Q){var Z=H5(J.body,Q,!0);return X38([J.mclass],Z,Q)}function PO1(J,Q){var Z,X=dZ(J.body,Q);if(J.mclass==="minner")Z=new g0.MathNode("mpadded",X);else if(J.mclass==="mord")if(J.isCharacterBox)Z=X[0],Z.type="mi";else Z=new g0.MathNode("mi",X);else{if(J.isCharacterBox)Z=X[0],Z.type="mo";else Z=new g0.MathNode("mo",X);if(J.mclass==="mbin")Z.attributes.lspace="0.22em",Z.attributes.rspace="0.22em";else if(J.mclass==="mpunct")Z.attributes.lspace="0em",Z.attributes.rspace="0.17em";else if(J.mclass==="mopen"||J.mclass==="mclose")Z.attributes.lspace="0em",Z.attributes.rspace="0em";else if(J.mclass==="minner")Z.attributes.lspace="0.0556em",Z.attributes.width="+0.1111em"}return Z}function Z$0(J,Q,Z){var X=Y38[J];switch(X){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return Z.callFunction(X,[Q[0]],[Q[1]]);case"\\uparrow":case"\\downarrow":{var Y=Z.callFunction("\\\\cdleft",[Q[0]],[]),K={type:"atom",text:X,mode:"math",family:"rel"},G=Z.callFunction("\\Big",[K],[]),q=Z.callFunction("\\\\cdright",[Q[1]],[]),z={type:"ordgroup",mode:"math",body:[Y,G,q]};return Z.callFunction("\\\\cdparent",[z],[])}case"\\\\cdlongequal":return Z.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var U={type:"textord",text:"\\Vert",mode:"math"};return Z.callFunction("\\Big",[U],[])}default:return{type:"textord",text:" ",mode:"math"}}}function X$0(J){var Q=[];J.gullet.beginGroup(),J.gullet.macros.set("\\cr","\\\\\\relax"),J.gullet.beginGroup();while(!0){Q.push(J.parseExpression(!1,"\\\\")),J.gullet.endGroup(),J.gullet.beginGroup();var Z=J.fetch().text;if(Z==="&"||Z==="\\\\")J.consume();else if(Z==="\\end"){if(Q[Q.length-1].length===0)Q.pop();break}else throw new r0("Expected \\\\ or \\cr or \\end",J.nextToken)}var X=[],Y=[X];for(var K=0;K<Q.length;K++){var G=Q[K],q=Dj0();for(var z=0;z<G.length;z++)if(!Mj0(G[z]))q.body.push(G[z]);else{X.push(q),z+=1;var U=l11(G[z]).text,W=[,,];if(W[0]={type:"ordgroup",mode:"math",body:[]},W[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(U)>-1);else if("<>AV".indexOf(U)>-1)for(var F=0;F<2;F++){var H=!0;for(var B=z+1;B<G.length;B++){if(K38(G[B],U)){H=!1,z=B;break}if(Mj0(G[B]))throw new r0("Missing a "+U+" character to complete a CD arrow.",G[B]);W[F].body.push(G[B])}if(H)throw new r0("Missing a "+U+" character to complete a CD arrow.",G[z])}else throw new r0('Expected one of "<>AV=|." after @',G[z]);var M=Z$0(U,W,J),V={type:"styling",body:[M],mode:"math",style:"display"};X.push(V),q=Dj0()}if(K%2===0)X.push(q);else X.shift();X=[],Y.push(X)}J.gullet.endGroup(),J.gullet.endGroup();var N=Array(Y[0].length).fill({type:"align",align:"c",pregap:0.25,postgap:0.25});return{type:"array",mode:"math",body:Y,arraystretch:1,addJot:!0,rowGaps:[null],cols:N,colSeparationType:"CD",hLinesBeforeRow:Array(Y.length+1).fill([])}}function Df(J,Q){var Z=Bf(J);if(Z&&K8.contains(L38,Z.text))return Z;else if(Z)throw new r0("Invalid delimiter '"+Z.text+"' after '"+Q.funcName+"'",J);else throw new r0("Invalid delimiter type '"+J.type+"'",J)}function DO1(J){if(!J.body)throw Error("Bug: The leftright ParseNode wasn't fully parsed.")}function Kq(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:G}=J,q={type:Q,numArgs:X.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:Y};for(var z=0;z<Z.length;++z)V$0[Z[z]]=q;if(K)h11[Q]=K;if(G)g11[Q]=G}function j1(J,Q){N$0[J]=Q}function MO1(J){var Q=[];J.consumeSpaces();var Z=J.fetch().text;if(Z==="\\relax")J.consume(),J.consumeSpaces(),Z=J.fetch().text;while(Z==="\\hline"||Z==="\\hdashline")J.consume(),Q.push(Z==="\\hdashline"),J.consumeSpaces(),Z=J.fetch().text;return Q}function a11(J){if(J.indexOf("ed")===-1)return J.indexOf("*")===-1}function rF(J,Q,Z){var{hskipBeforeAndAfter:X,addJot:Y,cols:K,arraystretch:G,colSeparationType:q,autoTag:z,singleRow:U,emptySingleRow:W,maxNumCols:F,leqno:H}=Q;if(J.gullet.beginGroup(),!U)J.gullet.macros.set("\\cr","\\\\\\relax");if(!G){var B=J.gullet.expandMacroAsText("\\arraystretch");if(B==null)G=1;else if(G=parseFloat(B),!G||G<0)throw new r0("Invalid \\arraystretch: "+B)}J.gullet.beginGroup();var M=[],V=[M],N=[],L=[],A=z!=null?[]:void 0;function w(){if(z)J.gullet.macros.set("\\@eqnsw","1",!0)}D(w,"beginRow");function R(){if(A)if(J.gullet.macros.get("\\df@tag"))A.push(J.subparse([new KU("\\df@tag")])),J.gullet.macros.set("\\df@tag",void 0,!0);else A.push(Boolean(z)&&J.gullet.macros.get("\\@eqnsw")==="1")}D(R,"endRow"),w(),L.push(MO1(J));while(!0){var O=J.parseExpression(!1,U?"\\end":"\\\\");if(J.gullet.endGroup(),J.gullet.beginGroup(),O={type:"ordgroup",mode:J.mode,body:O},Z)O={type:"styling",mode:J.mode,style:Z,body:[O]};M.push(O);var j=J.fetch().text;if(j==="&"){if(F&&M.length===F)if(U||q)throw new r0("Too many tab characters: &",J.nextToken);else J.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.");J.consume()}else if(j==="\\end"){if(R(),M.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(V.length>1||!W))V.pop();if(L.length<V.length+1)L.push([]);break}else if(j==="\\\\"){J.consume();var $=void 0;if(J.gullet.future().text!==" ")$=J.parseSizeGroup(!0);N.push($?$.value:null),R(),L.push(MO1(J)),M=[],V.push(M),w()}else throw new r0("Expected & or \\\\ or \\cr or \\end",J.nextToken)}return J.gullet.endGroup(),J.gullet.endGroup(),{type:"array",mode:J.mode,addJot:Y,arraystretch:G,body:V,cols:K,rowGaps:N,hskipBeforeAndAfter:X,hLinesBeforeRow:L,colSeparationType:q,tags:A,leqno:H}}function r11(J){if(J.slice(0,1)==="d")return"display";else return"text"}function _O1(J,Q,Z){var X=H5(J,Q,!1),Y=Q.sizeMultiplier/Z.sizeMultiplier;for(var K=0;K<X.length;K++){var G=X[K].classes.indexOf("sizing");if(G<0)Array.prototype.push.apply(X[K].classes,Q.sizingClasses(Z));else if(X[K].classes[G+1]==="reset-size"+Q.size)X[K].classes[G+1]="reset-size"+Z.size;X[K].height*=Y,X[K].depth*=Y}return Y0.makeFragment(X)}var Xq,KU,r0,sV8,oV8,tV8,eV8,JN8,QN8,bj0,ZN8,XN8,YN8,K8,x11,NO1,RM,LO1=0,y11=1,MI=2,dF=3,Uf=4,YK=5,VI=6,dQ=7,XU,KN8,GN8,qN8,zN8,UN8,WN8,H8,KO1,b11,DI=80,FN8,HN8,BN8,DN8,MN8,VN8,NN8,LN8,AN8,Gj0,wN8,Ff,YU,$11,qj0,nR1,RN8,zj0,Uj0,mj0,GO1,ON8,uj0,h4,J6,$M,pj0,dj0,cj0,Hf,wO1,jN8,$N8,KK,lF,EM,qO1,EN8,IN8,X4,K1="math",_0="text",A1="main",m1="ams",I4="accent-token",A6="bin",cQ="close",NI="inner",F8="mathord",h7="op-token",GY="open",d11="punct",u1="rel",aF="spacing",o1="textord",ij0,Wj0='0123456789/@."',aR1,E11,Fj0='0123456789!@*()-=+";:?/.,',rR1,I11,f11="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Xf,P11,C8="",y4,oJ,uF,OM,UO1="ÐÞþ",Yf,T11,C11,Hj0,PN8,c11,Yq,TN8,CN8,SN8,vN8,kN8,RO1,pZ,nj0,_N8,xN8,aj0,bN8,yN8,fN8,hN8,S11,rj0,sj0,gN8,Y0,f4,VA,pF,mN8,uN8,oj0,h11,g11,m11,N7,iF,pN8,dN8,cN8,lN8,H5,Bj0,tj0,iN8,WO1,Wf,J2,XK,qf,nN8,g0,GK,jO1,$O1,dZ,IM,r2,ej0,J$0,aN8,rN8,sN8,oN8,tN8,eN8,J38,Q38,nF,EO1,Q$0,Z38,v11,X38,i11,Y38,Dj0,Mj0,K38,Y$0,K$0,HO1,G$0,G38,q$0,Gf,TO1,z$0,q38,z38,U$0,sR1,oR1,BO1=0.008,k11,U38,W38,W$0,tR1=80,eR1=0.08,JO1,F38,F$0,H38,H$0,zf,B38,D38,M38,B$0,V38,D$0,M$0,N38,cF,Vj0,L38,CO1,SO1,V$0,N$0,n11,GU,A38,qU,L$0,Nj0,A$0,w$0,Lj0,R$0,vO1,kO1,Aj0,wj0,O$0,w38,QO1,Rj0,j$0,$$0,LI,Mf,R38,O38,E$0,j38,Oj0,$38,jj0,E38,I$0,ZO1,XO1,$j0,Ej0,Ij0,I38,Pj0,Tj0,jM,P$0=`[ \r
|
|
2039
|
+
`,xR1={spec:{name:qi1,description:iM8,inputSchema:{type:"object",properties:{model:{type:"string",description:"The model name to use"},system:{type:"string",description:"The system message to provide context and instructions"},message:{type:"string",description:"The user message to send to the model"},contextFiles:{type:"array",items:{type:"string"},description:"Optional array of file paths or URIs to include as context"}},required:["model","system","message"]},source:"builtin"},fn:Promise.resolve().then(() => (SO0(),CO0)).then(({nodeChatLLMTool:J})=>J)}});function kO0(J){let Q=atob(J),Z=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)Z[Y]=Q.charCodeAt(Y);return new TextDecoder("utf-8").decode(Z)}var _O0;var xO0=B1(()=>{EG();z8();_O0={spec:{name:jS,description:"Run CI/CD checks (typechecker, linter, formatter, and tests) to validate the changes. Returns the success or failure status, plus the relevant log lines. If tree parameter is provided, checks will be run for that specific repository tree. Otherwise, checks will be run for the tree with the most changes or the first available tree.",inputSchema:{type:"object",properties:{tree:{type:"string",description:'URI of the specific tree/repository to run checks for (e.g., "file:///path/to/repo"). If not provided, will automatically select the most appropriate tree.'}},required:[],additionalProperties:!1},source:"builtin",meta:{disableTimeout:!0}},fn:OD({os:null,github:null,gitlab:null})}});var fO0={};R6(fO0,{nodeUndoEditTool:()=>ZV8});import{writeFile as QV8}from"node:fs/promises";function XV8(J){if(typeof J!=="object"||J===null)throw Error("args must be an object. received instead: `"+JSON.stringify(J)+"`");if(typeof J.path!=="string")throw Error("path must be a string. received instead: `"+JSON.stringify(J.path)+"`")}var ZV8=({args:J},{dir:Q,fileChangeTracker:Z})=>{return d6(async(X)=>{Lj(Q),XV8(J);let Y=fX(J.path);await HF(Y).acquire();try{let K=await Z.getLastEdit(Y);if(!K)return{status:"error",progress:{},error:{message:`No edit history found for file '${J.path}'.`}};let G=BF(K.newContent,K.oldContent,J.path),q=zN1(G);return await QV8(Y.fsPath,K.oldContent,{encoding:"utf-8",signal:X}),K.revert(),{status:"done",progress:{},result:q}}finally{HF(Y).release()}})};var hO0=B1(()=>{C0();Vz();WL();cs();hX()});var Qf;var lR1=B1(()=>{Qf={name:"mermaid",version:"11.6.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.0.4","@iconify/utils":"^2.1.33","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.13",dompurify:"^3.2.4",katex:"^0.16.9",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^15.0.7",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.2","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",chokidar:"^4.0.3",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.0.2",jison:"^0.4.18","js-base64":"^3.7.7",jsdom:"^26.0.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.2",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.10","type-fest":"^4.35.0",typedoc:"^0.27.8","typedoc-plugin-markdown":"^4.4.2",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.0.2","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}});var iV8,j11,nV8,Kj0,aV8,rV8,D=(J,Q)=>j11(J,"name",{value:Q,configurable:!0}),Q4=(J,Q)=>function(){return Q||(0,J[Kj0(J)[0]])((Q={exports:{}}).exports,Q),Q.exports},sJ=(J,Q)=>{for(var Z in Q)j11(J,Z,{get:Q[Z],enumerable:!0})},iR1=(J,Q,Z,X)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(let Y of Kj0(Q))if(!rV8.call(J,Y)&&Y!==Z)j11(J,Y,{get:()=>Q[Y],enumerable:!(X=nV8(Q,Y))||X.enumerable})}return J},Zf=(J,Q,Z)=>(iR1(J,Q,"default"),Z&&iR1(Z,Q,"default")),Z4=(J,Q,Z)=>(Z=J!=null?iV8(aV8(J)):{},iR1(Q||!J||!J.__esModule?j11(Z,"default",{value:J,enumerable:!0}):Z,J));var O6=B1(()=>{iV8=Object.create,j11=Object.defineProperty,nV8=Object.getOwnPropertyDescriptor,Kj0=Object.getOwnPropertyNames,aV8=Object.getPrototypeOf,rV8=Object.prototype.hasOwnProperty});var x$0={};R6(x$0,{default:()=>g38});function xj0(J){return String(J).replace(QN8,(Q)=>JN8[Q])}function yj0(J){if(J.default)return J.default;var Q=J.type,Z=Array.isArray(Q)?Q[0]:Q;if(typeof Z!=="string")return Z.enum[0];switch(Z){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function fj0(J){for(var Q=0;Q<KO1.length;Q++){var Z=KO1[Q];for(var X=0;X<Z.blocks.length;X++){var Y=Z.blocks[X];if(J>=Y[0]&&J<=Y[1])return Z.name}}return null}function AO1(J){for(var Q=0;Q<b11.length;Q+=2)if(J>=b11[Q]&&J<=b11[Q+1])return!0;return!1}function hj0(J,Q){YU[J]=Q}function p11(J,Q,Z){if(!YU[Q])throw Error("Font metrics not found for font: "+Q+".");var X=J.charCodeAt(0),Y=YU[Q][X];if(!Y&&J[0]in qj0)X=qj0[J[0]].charCodeAt(0),Y=YU[Q][X];if(!Y&&Z==="text"){if(AO1(X))Y=YU[Q][77]}if(Y)return{depth:Y[0],height:Y[1],italic:Y[2],skew:Y[3],width:Y[4]}}function gj0(J){var Q;if(J>=5)Q=0;else if(J>=3)Q=1;else Q=2;if(!nR1[Q]){var Z=nR1[Q]={cssEmPerMu:$11.quad[Q]/18};for(var X in $11)if($11.hasOwnProperty(X))Z[X]=$11[X][Q]}return nR1[Q]}function zO1(J){if(J instanceof KK)return J;else throw Error("Expected symbolNode but got "+String(J)+".")}function lj0(J){if(J instanceof Hf)return J;else throw Error("Expected span<HtmlDomNode> but got "+String(J)+".")}function s(J,Q,Z,X,Y,K){if(X4[J][Y]={font:Q,group:Z,replace:X},K&&X)X4[J][X]=X4[J][Y]}function H6(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:G}=J,q={type:Q,numArgs:X.numArgs,argTypes:X.argTypes,allowedInArgument:!!X.allowedInArgument,allowedInText:!!X.allowedInText,allowedInMath:X.allowedInMath===void 0?!0:X.allowedInMath,numOptionalArgs:X.numOptionalArgs||0,infix:!!X.infix,primitive:!!X.primitive,handler:Y};for(var z=0;z<Z.length;++z)oj0[Z[z]]=q;if(Q){if(K)h11[Q]=K;if(G)g11[Q]=G}}function PM(J){var{type:Q,htmlBuilder:Z,mathmlBuilder:X}=J;H6({type:Q,names:[],props:{numArgs:0},handler(){throw Error("Should never be called.")},htmlBuilder:Z,mathmlBuilder:X})}function Kf(J,Q){var Z=iF(["base"],J,Q),X=iF(["strut"]);if(X.style.height=J6(Z.height+Z.depth),Z.depth)X.style.verticalAlign=J6(-Z.depth);return Z.children.unshift(X),Z}function u11(J,Q){var Z=null;if(J.length===1&&J[0].type==="tag")Z=J[0].tag,J=J[0].body;var X=H5(J,Q,"root"),Y;if(X.length===2&&X[1].hasClass("tag"))Y=X.pop();var K=[],G=[];for(var q=0;q<X.length;q++)if(G.push(X[q]),X[q].hasClass("mbin")||X[q].hasClass("mrel")||X[q].hasClass("allowbreak")){var z=!1;while(q<X.length-1&&X[q+1].hasClass("mspace")&&!X[q+1].hasClass("newline"))if(q++,G.push(X[q]),X[q].hasClass("nobreak"))z=!0;if(!z)K.push(Kf(G,Q)),G=[]}else if(X[q].hasClass("newline")){if(G.pop(),G.length>0)K.push(Kf(G,Q)),G=[];K.push(X[q])}if(G.length>0)K.push(Kf(G,Q));var U;if(Z)U=Kf(H5(Z,Q,!0)),U.classes=["tag"],K.push(U);else if(Y)K.push(Y);var W=iF(["katex-html"],K);if(W.setAttribute("aria-hidden","true"),U){var F=U.children[0];if(F.style.height=J6(W.height+W.depth),W.depth)F.style.verticalAlign=J6(-W.depth)}return W}function OO1(J){return new Ff(J)}function FO1(J,Q,Z,X,Y){var K=dZ(J,Z),G;if(K.length===1&&K[0]instanceof XK&&K8.contains(["mrow","mtable"],K[0].type))G=K[0];else G=new g0.MathNode("mrow",K);var q=new g0.MathNode("annotation",[new g0.TextNode(Q)]);q.setAttribute("encoding","application/x-tex");var z=new g0.MathNode("semantics",[G,q]),U=new g0.MathNode("math",[z]);if(U.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),X)U.setAttribute("display","block");var W=Y?"katex":"katex-mathml";return Y0.makeSpan([W],[U])}function a8(J,Q){if(!J||J.type!==Q)throw Error("Expected node of type "+Q+", but got "+(J?"node of type "+J.type:String(J)));return J}function l11(J){var Q=Bf(J);if(!Q)throw Error("Expected node of symbol group type, but got "+(J?"node of type "+J.type:String(J)));return Q}function Bf(J){if(J&&(J.type==="atom"||IN8.hasOwnProperty(J.type)))return J;return null}function IO1(J,Q){var Z=H5(J.body,Q,!0);return X38([J.mclass],Z,Q)}function PO1(J,Q){var Z,X=dZ(J.body,Q);if(J.mclass==="minner")Z=new g0.MathNode("mpadded",X);else if(J.mclass==="mord")if(J.isCharacterBox)Z=X[0],Z.type="mi";else Z=new g0.MathNode("mi",X);else{if(J.isCharacterBox)Z=X[0],Z.type="mo";else Z=new g0.MathNode("mo",X);if(J.mclass==="mbin")Z.attributes.lspace="0.22em",Z.attributes.rspace="0.22em";else if(J.mclass==="mpunct")Z.attributes.lspace="0em",Z.attributes.rspace="0.17em";else if(J.mclass==="mopen"||J.mclass==="mclose")Z.attributes.lspace="0em",Z.attributes.rspace="0em";else if(J.mclass==="minner")Z.attributes.lspace="0.0556em",Z.attributes.width="+0.1111em"}return Z}function Z$0(J,Q,Z){var X=Y38[J];switch(X){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return Z.callFunction(X,[Q[0]],[Q[1]]);case"\\uparrow":case"\\downarrow":{var Y=Z.callFunction("\\\\cdleft",[Q[0]],[]),K={type:"atom",text:X,mode:"math",family:"rel"},G=Z.callFunction("\\Big",[K],[]),q=Z.callFunction("\\\\cdright",[Q[1]],[]),z={type:"ordgroup",mode:"math",body:[Y,G,q]};return Z.callFunction("\\\\cdparent",[z],[])}case"\\\\cdlongequal":return Z.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var U={type:"textord",text:"\\Vert",mode:"math"};return Z.callFunction("\\Big",[U],[])}default:return{type:"textord",text:" ",mode:"math"}}}function X$0(J){var Q=[];J.gullet.beginGroup(),J.gullet.macros.set("\\cr","\\\\\\relax"),J.gullet.beginGroup();while(!0){Q.push(J.parseExpression(!1,"\\\\")),J.gullet.endGroup(),J.gullet.beginGroup();var Z=J.fetch().text;if(Z==="&"||Z==="\\\\")J.consume();else if(Z==="\\end"){if(Q[Q.length-1].length===0)Q.pop();break}else throw new r0("Expected \\\\ or \\cr or \\end",J.nextToken)}var X=[],Y=[X];for(var K=0;K<Q.length;K++){var G=Q[K],q=Dj0();for(var z=0;z<G.length;z++)if(!Mj0(G[z]))q.body.push(G[z]);else{X.push(q),z+=1;var U=l11(G[z]).text,W=[,,];if(W[0]={type:"ordgroup",mode:"math",body:[]},W[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(U)>-1);else if("<>AV".indexOf(U)>-1)for(var F=0;F<2;F++){var H=!0;for(var B=z+1;B<G.length;B++){if(K38(G[B],U)){H=!1,z=B;break}if(Mj0(G[B]))throw new r0("Missing a "+U+" character to complete a CD arrow.",G[B]);W[F].body.push(G[B])}if(H)throw new r0("Missing a "+U+" character to complete a CD arrow.",G[z])}else throw new r0('Expected one of "<>AV=|." after @',G[z]);var M=Z$0(U,W,J),V={type:"styling",body:[M],mode:"math",style:"display"};X.push(V),q=Dj0()}if(K%2===0)X.push(q);else X.shift();X=[],Y.push(X)}J.gullet.endGroup(),J.gullet.endGroup();var N=Array(Y[0].length).fill({type:"align",align:"c",pregap:0.25,postgap:0.25});return{type:"array",mode:"math",body:Y,arraystretch:1,addJot:!0,rowGaps:[null],cols:N,colSeparationType:"CD",hLinesBeforeRow:Array(Y.length+1).fill([])}}function Df(J,Q){var Z=Bf(J);if(Z&&K8.contains(L38,Z.text))return Z;else if(Z)throw new r0("Invalid delimiter '"+Z.text+"' after '"+Q.funcName+"'",J);else throw new r0("Invalid delimiter type '"+J.type+"'",J)}function DO1(J){if(!J.body)throw Error("Bug: The leftright ParseNode wasn't fully parsed.")}function Kq(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:G}=J,q={type:Q,numArgs:X.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:Y};for(var z=0;z<Z.length;++z)V$0[Z[z]]=q;if(K)h11[Q]=K;if(G)g11[Q]=G}function $1(J,Q){N$0[J]=Q}function MO1(J){var Q=[];J.consumeSpaces();var Z=J.fetch().text;if(Z==="\\relax")J.consume(),J.consumeSpaces(),Z=J.fetch().text;while(Z==="\\hline"||Z==="\\hdashline")J.consume(),Q.push(Z==="\\hdashline"),J.consumeSpaces(),Z=J.fetch().text;return Q}function a11(J){if(J.indexOf("ed")===-1)return J.indexOf("*")===-1}function rF(J,Q,Z){var{hskipBeforeAndAfter:X,addJot:Y,cols:K,arraystretch:G,colSeparationType:q,autoTag:z,singleRow:U,emptySingleRow:W,maxNumCols:F,leqno:H}=Q;if(J.gullet.beginGroup(),!U)J.gullet.macros.set("\\cr","\\\\\\relax");if(!G){var B=J.gullet.expandMacroAsText("\\arraystretch");if(B==null)G=1;else if(G=parseFloat(B),!G||G<0)throw new r0("Invalid \\arraystretch: "+B)}J.gullet.beginGroup();var M=[],V=[M],N=[],L=[],A=z!=null?[]:void 0;function w(){if(z)J.gullet.macros.set("\\@eqnsw","1",!0)}D(w,"beginRow");function R(){if(A)if(J.gullet.macros.get("\\df@tag"))A.push(J.subparse([new KU("\\df@tag")])),J.gullet.macros.set("\\df@tag",void 0,!0);else A.push(Boolean(z)&&J.gullet.macros.get("\\@eqnsw")==="1")}D(R,"endRow"),w(),L.push(MO1(J));while(!0){var O=J.parseExpression(!1,U?"\\end":"\\\\");if(J.gullet.endGroup(),J.gullet.beginGroup(),O={type:"ordgroup",mode:J.mode,body:O},Z)O={type:"styling",mode:J.mode,style:Z,body:[O]};M.push(O);var j=J.fetch().text;if(j==="&"){if(F&&M.length===F)if(U||q)throw new r0("Too many tab characters: &",J.nextToken);else J.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.");J.consume()}else if(j==="\\end"){if(R(),M.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(V.length>1||!W))V.pop();if(L.length<V.length+1)L.push([]);break}else if(j==="\\\\"){J.consume();var $=void 0;if(J.gullet.future().text!==" ")$=J.parseSizeGroup(!0);N.push($?$.value:null),R(),L.push(MO1(J)),M=[],V.push(M),w()}else throw new r0("Expected & or \\\\ or \\cr or \\end",J.nextToken)}return J.gullet.endGroup(),J.gullet.endGroup(),{type:"array",mode:J.mode,addJot:Y,arraystretch:G,body:V,cols:K,rowGaps:N,hskipBeforeAndAfter:X,hLinesBeforeRow:L,colSeparationType:q,tags:A,leqno:H}}function r11(J){if(J.slice(0,1)==="d")return"display";else return"text"}function _O1(J,Q,Z){var X=H5(J,Q,!1),Y=Q.sizeMultiplier/Z.sizeMultiplier;for(var K=0;K<X.length;K++){var G=X[K].classes.indexOf("sizing");if(G<0)Array.prototype.push.apply(X[K].classes,Q.sizingClasses(Z));else if(X[K].classes[G+1]==="reset-size"+Q.size)X[K].classes[G+1]="reset-size"+Z.size;X[K].height*=Y,X[K].depth*=Y}return Y0.makeFragment(X)}var Xq,KU,r0,sV8,oV8,tV8,eV8,JN8,QN8,bj0,ZN8,XN8,YN8,K8,x11,NO1,RM,LO1=0,y11=1,MI=2,dF=3,Uf=4,YK=5,VI=6,dQ=7,XU,KN8,GN8,qN8,zN8,UN8,WN8,H8,KO1,b11,DI=80,FN8,HN8,BN8,DN8,MN8,VN8,NN8,LN8,AN8,Gj0,wN8,Ff,YU,$11,qj0,nR1,RN8,zj0,Uj0,mj0,GO1,ON8,uj0,h4,J6,$M,pj0,dj0,cj0,Hf,wO1,jN8,$N8,KK,lF,EM,qO1,EN8,IN8,X4,K1="math",_0="text",A1="main",m1="ams",I4="accent-token",A6="bin",cQ="close",NI="inner",F8="mathord",h7="op-token",GY="open",d11="punct",u1="rel",aF="spacing",o1="textord",ij0,Wj0='0123456789/@."',aR1,E11,Fj0='0123456789!@*()-=+";:?/.,',rR1,I11,f11="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Xf,P11,C8="",y4,oJ,uF,OM,UO1="ÐÞþ",Yf,T11,C11,Hj0,PN8,c11,Yq,TN8,CN8,SN8,vN8,kN8,RO1,pZ,nj0,_N8,xN8,aj0,bN8,yN8,fN8,hN8,S11,rj0,sj0,gN8,Y0,f4,VA,pF,mN8,uN8,oj0,h11,g11,m11,N7,iF,pN8,dN8,cN8,lN8,H5,Bj0,tj0,iN8,WO1,Wf,J2,XK,qf,nN8,g0,GK,jO1,$O1,dZ,IM,r2,ej0,J$0,aN8,rN8,sN8,oN8,tN8,eN8,J38,Q38,nF,EO1,Q$0,Z38,v11,X38,i11,Y38,Dj0,Mj0,K38,Y$0,K$0,HO1,G$0,G38,q$0,Gf,TO1,z$0,q38,z38,U$0,sR1,oR1,BO1=0.008,k11,U38,W38,W$0,tR1=80,eR1=0.08,JO1,F38,F$0,H38,H$0,zf,B38,D38,M38,B$0,V38,D$0,M$0,N38,cF,Vj0,L38,CO1,SO1,V$0,N$0,n11,GU,A38,qU,L$0,Nj0,A$0,w$0,Lj0,R$0,vO1,kO1,Aj0,wj0,O$0,w38,QO1,Rj0,j$0,$$0,LI,Mf,R38,O38,E$0,j38,Oj0,$38,jj0,E38,I$0,ZO1,XO1,$j0,Ej0,Ij0,I38,Pj0,Tj0,jM,P$0=`[ \r
|
|
2040
2040
|
]`,P38="\\\\[a-zA-Z@]+",T38="\\\\[^\uD800-\uDFFF]",C38,S38=`\\\\(
|
|
2041
2041
|
|[ \r ]+
|
|
2042
2042
|
?)[ \r ]*`,VO1="[̀-ͯ]",v38,k38,Cj0,_38,x38,Sj0,xO1,vj0,bO1,T$0,C$0,S$0,b38,kj0,_11,YO1,_j0,v$0,yO1,k$0,y38,f38,_$0,fO1,h38,g38;var b$0=B1(()=>{O6();Xq=class J{static{D(this,"SourceLocation")}constructor(Q,Z,X){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=Q,this.start=Z,this.end=X}static range(Q,Z){if(!Z)return Q&&Q.loc;else if(!Q||!Q.loc||!Z.loc||Q.loc.lexer!==Z.loc.lexer)return null;else return new J(Q.loc.lexer,Q.loc.start,Z.loc.end)}},KU=class J{static{D(this,"Token")}constructor(Q,Z){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=Q,this.loc=Z}range(Q,Z){return new J(Z,Xq.range(this,Q))}},r0=class J{static{D(this,"ParseError")}constructor(Q,Z){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var X="KaTeX parse error: "+Q,Y,K,G=Z&&Z.loc;if(G&&G.start<=G.end){var q=G.lexer.input;if(Y=G.start,K=G.end,Y===q.length)X+=" at end of input: ";else X+=" at position "+(Y+1)+": ";var z=q.slice(Y,K).replace(/[^]/g,"$&̲"),U;if(Y>15)U="…"+q.slice(Y-15,Y);else U=q.slice(0,Y);var W;if(K+15<q.length)W=q.slice(K,K+15)+"…";else W=q.slice(K);X+=U+z+W}var F=Error(X);if(F.name="ParseError",F.__proto__=J.prototype,F.position=Y,Y!=null&&K!=null)F.length=K-Y;return F.rawMessage=Q,F}};r0.prototype.__proto__=Error.prototype;sV8=D(function(Q,Z){return Q.indexOf(Z)!==-1},"contains"),oV8=D(function(Q,Z){return Q===void 0?Z:Q},"deflt"),tV8=/([A-Z])/g,eV8=D(function(Q){return Q.replace(tV8,"-$1").toLowerCase()},"hyphenate"),JN8={"&":"&",">":">","<":"<",'"':""","'":"'"},QN8=/[&><"']/g;D(xj0,"escape");bj0=D(function J(Q){if(Q.type==="ordgroup")if(Q.body.length===1)return J(Q.body[0]);else return Q;else if(Q.type==="color")if(Q.body.length===1)return J(Q.body[0]);else return Q;else if(Q.type==="font")return J(Q.body);else return Q},"getBaseElem"),ZN8=D(function(Q){var Z=bj0(Q);return Z.type==="mathord"||Z.type==="textord"||Z.type==="atom"},"isCharacterBox"),XN8=D(function(Q){if(!Q)throw Error("Expected non-null, but got "+String(Q));return Q},"assert"),YN8=D(function(Q){var Z=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(Q);if(!Z)return"_relative";if(Z[2]!==":")return null;if(!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(Z[1]))return null;return Z[1].toLowerCase()},"protocolFromUrl"),K8={contains:sV8,deflt:oV8,escape:xj0,hyphenate:eV8,getBaseElem:bj0,isCharacterBox:ZN8,protocolFromUrl:YN8},x11={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:D((J)=>"#"+J,"cliProcessor")},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:D((J,Q)=>{return Q.push(J),Q},"cliProcessor")},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:D((J)=>Math.max(0,J),"processor"),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:D((J)=>Math.max(0,J),"processor"),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1000,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:D((J)=>Math.max(0,J),"processor"),cli:"-e, --max-expand <n>",cliProcessor:D((J)=>J==="Infinity"?1/0:parseInt(J),"cliProcessor")},globalGroup:{type:"boolean",cli:!1}};D(yj0,"getDefaultValue");NO1=class{static{D(this,"Settings")}constructor(J){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,J=J||{};for(var Q in x11)if(x11.hasOwnProperty(Q)){var Z=x11[Q];this[Q]=J[Q]!==void 0?Z.processor?Z.processor(J[Q]):J[Q]:yj0(Z)}}reportNonstrict(J,Q,Z){var X=this.strict;if(typeof X==="function")X=X(J,Q,Z);if(!X||X==="ignore")return;else if(X===!0||X==="error")throw new r0("LaTeX-incompatible input and strict mode is set to 'error': "+(Q+" ["+J+"]"),Z);else if(X==="warn")typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(Q+" ["+J+"]"));else typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+X+"': "+Q+" ["+J+"]"))}useStrictBehavior(J,Q,Z){var X=this.strict;if(typeof X==="function")try{X=X(J,Q,Z)}catch(Y){X="error"}if(!X||X==="ignore")return!1;else if(X===!0||X==="error")return!0;else if(X==="warn")return typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(Q+" ["+J+"]")),!1;else return typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+X+"': "+Q+" ["+J+"]")),!1}isTrusted(J){if(J.url&&!J.protocol){var Q=K8.protocolFromUrl(J.url);if(Q==null)return!1;J.protocol=Q}var Z=typeof this.trust==="function"?this.trust(J):this.trust;return Boolean(Z)}},RM=class{static{D(this,"Style")}constructor(J,Q,Z){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=J,this.size=Q,this.cramped=Z}sup(){return XU[KN8[this.id]]}sub(){return XU[GN8[this.id]]}fracNum(){return XU[qN8[this.id]]}fracDen(){return XU[zN8[this.id]]}cramp(){return XU[UN8[this.id]]}text(){return XU[WN8[this.id]]}isTight(){return this.size>=2}},XU=[new RM(LO1,0,!1),new RM(y11,0,!0),new RM(MI,1,!1),new RM(dF,1,!0),new RM(Uf,2,!1),new RM(YK,2,!0),new RM(VI,3,!1),new RM(dQ,3,!0)],KN8=[Uf,YK,Uf,YK,VI,dQ,VI,dQ],GN8=[YK,YK,YK,YK,dQ,dQ,dQ,dQ],qN8=[MI,dF,Uf,YK,VI,dQ,VI,dQ],zN8=[dF,dF,YK,YK,dQ,dQ,dQ,dQ],UN8=[y11,y11,dF,dF,YK,YK,dQ,dQ],WN8=[LO1,y11,MI,dF,MI,dF,MI,dF],H8={DISPLAY:XU[LO1],TEXT:XU[MI],SCRIPT:XU[Uf],SCRIPTSCRIPT:XU[VI]},KO1=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];D(fj0,"scriptFromCodepoint");b11=[];KO1.forEach((J)=>J.blocks.forEach((Q)=>b11.push(...Q)));D(AO1,"supportedCodepoint");FN8=D(function(Q,Z){return"M95,"+(622+Q+Z)+`
|
|
@@ -2294,9 +2294,9 @@ c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
|
|
|
2294
2294
|
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
|
|
2295
2295
|
l0,-`+(Z+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
2296
2296
|
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw Error("Unknown stretchy delimiter.")}},"tallDelim"),Ff=class{static{D(this,"DocumentFragment")}constructor(J){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=J,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(J){return K8.contains(this.classes,J)}toNode(){var J=document.createDocumentFragment();for(var Q=0;Q<this.children.length;Q++)J.appendChild(this.children[Q].toNode());return J}toMarkup(){var J="";for(var Q=0;Q<this.children.length;Q++)J+=this.children[Q].toMarkup();return J}toText(){var J=D((Q)=>Q.toText(),"toText");return this.children.map(J).join("")}},YU={"AMS-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.68889,0,0,0.72222],"66":[0,0.68889,0,0,0.66667],"67":[0,0.68889,0,0,0.72222],"68":[0,0.68889,0,0,0.72222],"69":[0,0.68889,0,0,0.66667],"70":[0,0.68889,0,0,0.61111],"71":[0,0.68889,0,0,0.77778],"72":[0,0.68889,0,0,0.77778],"73":[0,0.68889,0,0,0.38889],"74":[0.16667,0.68889,0,0,0.5],"75":[0,0.68889,0,0,0.77778],"76":[0,0.68889,0,0,0.66667],"77":[0,0.68889,0,0,0.94445],"78":[0,0.68889,0,0,0.72222],"79":[0.16667,0.68889,0,0,0.77778],"80":[0,0.68889,0,0,0.61111],"81":[0.16667,0.68889,0,0,0.77778],"82":[0,0.68889,0,0,0.72222],"83":[0,0.68889,0,0,0.55556],"84":[0,0.68889,0,0,0.66667],"85":[0,0.68889,0,0,0.72222],"86":[0,0.68889,0,0,0.72222],"87":[0,0.68889,0,0,1],"88":[0,0.68889,0,0,0.72222],"89":[0,0.68889,0,0,0.72222],"90":[0,0.68889,0,0,0.66667],"107":[0,0.68889,0,0,0.55556],"160":[0,0,0,0,0.25],"165":[0,0.675,0.025,0,0.75],"174":[0.15559,0.69224,0,0,0.94666],"240":[0,0.68889,0,0,0.55556],"295":[0,0.68889,0,0,0.54028],"710":[0,0.825,0,0,2.33334],"732":[0,0.9,0,0,2.33334],"770":[0,0.825,0,0,2.33334],"771":[0,0.9,0,0,2.33334],"989":[0.08167,0.58167,0,0,0.77778],"1008":[0,0.43056,0.04028,0,0.66667],"8245":[0,0.54986,0,0,0.275],"8463":[0,0.68889,0,0,0.54028],"8487":[0,0.68889,0,0,0.72222],"8498":[0,0.68889,0,0,0.55556],"8502":[0,0.68889,0,0,0.66667],"8503":[0,0.68889,0,0,0.44445],"8504":[0,0.68889,0,0,0.66667],"8513":[0,0.68889,0,0,0.63889],"8592":[-0.03598,0.46402,0,0,0.5],"8594":[-0.03598,0.46402,0,0,0.5],"8602":[-0.13313,0.36687,0,0,1],"8603":[-0.13313,0.36687,0,0,1],"8606":[0.01354,0.52239,0,0,1],"8608":[0.01354,0.52239,0,0,1],"8610":[0.01354,0.52239,0,0,1.11111],"8611":[0.01354,0.52239,0,0,1.11111],"8619":[0,0.54986,0,0,1],"8620":[0,0.54986,0,0,1],"8621":[-0.13313,0.37788,0,0,1.38889],"8622":[-0.13313,0.36687,0,0,1],"8624":[0,0.69224,0,0,0.5],"8625":[0,0.69224,0,0,0.5],"8630":[0,0.43056,0,0,1],"8631":[0,0.43056,0,0,1],"8634":[0.08198,0.58198,0,0,0.77778],"8635":[0.08198,0.58198,0,0,0.77778],"8638":[0.19444,0.69224,0,0,0.41667],"8639":[0.19444,0.69224,0,0,0.41667],"8642":[0.19444,0.69224,0,0,0.41667],"8643":[0.19444,0.69224,0,0,0.41667],"8644":[0.1808,0.675,0,0,1],"8646":[0.1808,0.675,0,0,1],"8647":[0.1808,0.675,0,0,1],"8648":[0.19444,0.69224,0,0,0.83334],"8649":[0.1808,0.675,0,0,1],"8650":[0.19444,0.69224,0,0,0.83334],"8651":[0.01354,0.52239,0,0,1],"8652":[0.01354,0.52239,0,0,1],"8653":[-0.13313,0.36687,0,0,1],"8654":[-0.13313,0.36687,0,0,1],"8655":[-0.13313,0.36687,0,0,1],"8666":[0.13667,0.63667,0,0,1],"8667":[0.13667,0.63667,0,0,1],"8669":[-0.13313,0.37788,0,0,1],"8672":[-0.064,0.437,0,0,1.334],"8674":[-0.064,0.437,0,0,1.334],"8705":[0,0.825,0,0,0.5],"8708":[0,0.68889,0,0,0.55556],"8709":[0.08167,0.58167,0,0,0.77778],"8717":[0,0.43056,0,0,0.42917],"8722":[-0.03598,0.46402,0,0,0.5],"8724":[0.08198,0.69224,0,0,0.77778],"8726":[0.08167,0.58167,0,0,0.77778],"8733":[0,0.69224,0,0,0.77778],"8736":[0,0.69224,0,0,0.72222],"8737":[0,0.69224,0,0,0.72222],"8738":[0.03517,0.52239,0,0,0.72222],"8739":[0.08167,0.58167,0,0,0.22222],"8740":[0.25142,0.74111,0,0,0.27778],"8741":[0.08167,0.58167,0,0,0.38889],"8742":[0.25142,0.74111,0,0,0.5],"8756":[0,0.69224,0,0,0.66667],"8757":[0,0.69224,0,0,0.66667],"8764":[-0.13313,0.36687,0,0,0.77778],"8765":[-0.13313,0.37788,0,0,0.77778],"8769":[-0.13313,0.36687,0,0,0.77778],"8770":[-0.03625,0.46375,0,0,0.77778],"8774":[0.30274,0.79383,0,0,0.77778],"8776":[-0.01688,0.48312,0,0,0.77778],"8778":[0.08167,0.58167,0,0,0.77778],"8782":[0.06062,0.54986,0,0,0.77778],"8783":[0.06062,0.54986,0,0,0.77778],"8785":[0.08198,0.58198,0,0,0.77778],"8786":[0.08198,0.58198,0,0,0.77778],"8787":[0.08198,0.58198,0,0,0.77778],"8790":[0,0.69224,0,0,0.77778],"8791":[0.22958,0.72958,0,0,0.77778],"8796":[0.08198,0.91667,0,0,0.77778],"8806":[0.25583,0.75583,0,0,0.77778],"8807":[0.25583,0.75583,0,0,0.77778],"8808":[0.25142,0.75726,0,0,0.77778],"8809":[0.25142,0.75726,0,0,0.77778],"8812":[0.25583,0.75583,0,0,0.5],"8814":[0.20576,0.70576,0,0,0.77778],"8815":[0.20576,0.70576,0,0,0.77778],"8816":[0.30274,0.79383,0,0,0.77778],"8817":[0.30274,0.79383,0,0,0.77778],"8818":[0.22958,0.72958,0,0,0.77778],"8819":[0.22958,0.72958,0,0,0.77778],"8822":[0.1808,0.675,0,0,0.77778],"8823":[0.1808,0.675,0,0,0.77778],"8828":[0.13667,0.63667,0,0,0.77778],"8829":[0.13667,0.63667,0,0,0.77778],"8830":[0.22958,0.72958,0,0,0.77778],"8831":[0.22958,0.72958,0,0,0.77778],"8832":[0.20576,0.70576,0,0,0.77778],"8833":[0.20576,0.70576,0,0,0.77778],"8840":[0.30274,0.79383,0,0,0.77778],"8841":[0.30274,0.79383,0,0,0.77778],"8842":[0.13597,0.63597,0,0,0.77778],"8843":[0.13597,0.63597,0,0,0.77778],"8847":[0.03517,0.54986,0,0,0.77778],"8848":[0.03517,0.54986,0,0,0.77778],"8858":[0.08198,0.58198,0,0,0.77778],"8859":[0.08198,0.58198,0,0,0.77778],"8861":[0.08198,0.58198,0,0,0.77778],"8862":[0,0.675,0,0,0.77778],"8863":[0,0.675,0,0,0.77778],"8864":[0,0.675,0,0,0.77778],"8865":[0,0.675,0,0,0.77778],"8872":[0,0.69224,0,0,0.61111],"8873":[0,0.69224,0,0,0.72222],"8874":[0,0.69224,0,0,0.88889],"8876":[0,0.68889,0,0,0.61111],"8877":[0,0.68889,0,0,0.61111],"8878":[0,0.68889,0,0,0.72222],"8879":[0,0.68889,0,0,0.72222],"8882":[0.03517,0.54986,0,0,0.77778],"8883":[0.03517,0.54986,0,0,0.77778],"8884":[0.13667,0.63667,0,0,0.77778],"8885":[0.13667,0.63667,0,0,0.77778],"8888":[0,0.54986,0,0,1.11111],"8890":[0.19444,0.43056,0,0,0.55556],"8891":[0.19444,0.69224,0,0,0.61111],"8892":[0.19444,0.69224,0,0,0.61111],"8901":[0,0.54986,0,0,0.27778],"8903":[0.08167,0.58167,0,0,0.77778],"8905":[0.08167,0.58167,0,0,0.77778],"8906":[0.08167,0.58167,0,0,0.77778],"8907":[0,0.69224,0,0,0.77778],"8908":[0,0.69224,0,0,0.77778],"8909":[-0.03598,0.46402,0,0,0.77778],"8910":[0,0.54986,0,0,0.76042],"8911":[0,0.54986,0,0,0.76042],"8912":[0.03517,0.54986,0,0,0.77778],"8913":[0.03517,0.54986,0,0,0.77778],"8914":[0,0.54986,0,0,0.66667],"8915":[0,0.54986,0,0,0.66667],"8916":[0,0.69224,0,0,0.66667],"8918":[0.0391,0.5391,0,0,0.77778],"8919":[0.0391,0.5391,0,0,0.77778],"8920":[0.03517,0.54986,0,0,1.33334],"8921":[0.03517,0.54986,0,0,1.33334],"8922":[0.38569,0.88569,0,0,0.77778],"8923":[0.38569,0.88569,0,0,0.77778],"8926":[0.13667,0.63667,0,0,0.77778],"8927":[0.13667,0.63667,0,0,0.77778],"8928":[0.30274,0.79383,0,0,0.77778],"8929":[0.30274,0.79383,0,0,0.77778],"8934":[0.23222,0.74111,0,0,0.77778],"8935":[0.23222,0.74111,0,0,0.77778],"8936":[0.23222,0.74111,0,0,0.77778],"8937":[0.23222,0.74111,0,0,0.77778],"8938":[0.20576,0.70576,0,0,0.77778],"8939":[0.20576,0.70576,0,0,0.77778],"8940":[0.30274,0.79383,0,0,0.77778],"8941":[0.30274,0.79383,0,0,0.77778],"8994":[0.19444,0.69224,0,0,0.77778],"8995":[0.19444,0.69224,0,0,0.77778],"9416":[0.15559,0.69224,0,0,0.90222],"9484":[0,0.69224,0,0,0.5],"9488":[0,0.69224,0,0,0.5],"9492":[0,0.37788,0,0,0.5],"9496":[0,0.37788,0,0,0.5],"9585":[0.19444,0.68889,0,0,0.88889],"9586":[0.19444,0.74111,0,0,0.88889],"9632":[0,0.675,0,0,0.77778],"9633":[0,0.675,0,0,0.77778],"9650":[0,0.54986,0,0,0.72222],"9651":[0,0.54986,0,0,0.72222],"9654":[0.03517,0.54986,0,0,0.77778],"9660":[0,0.54986,0,0,0.72222],"9661":[0,0.54986,0,0,0.72222],"9664":[0.03517,0.54986,0,0,0.77778],"9674":[0.11111,0.69224,0,0,0.66667],"9733":[0.19444,0.69224,0,0,0.94445],"10003":[0,0.69224,0,0,0.83334],"10016":[0,0.69224,0,0,0.83334],"10731":[0.11111,0.69224,0,0,0.66667],"10846":[0.19444,0.75583,0,0,0.61111],"10877":[0.13667,0.63667,0,0,0.77778],"10878":[0.13667,0.63667,0,0,0.77778],"10885":[0.25583,0.75583,0,0,0.77778],"10886":[0.25583,0.75583,0,0,0.77778],"10887":[0.13597,0.63597,0,0,0.77778],"10888":[0.13597,0.63597,0,0,0.77778],"10889":[0.26167,0.75726,0,0,0.77778],"10890":[0.26167,0.75726,0,0,0.77778],"10891":[0.48256,0.98256,0,0,0.77778],"10892":[0.48256,0.98256,0,0,0.77778],"10901":[0.13667,0.63667,0,0,0.77778],"10902":[0.13667,0.63667,0,0,0.77778],"10933":[0.25142,0.75726,0,0,0.77778],"10934":[0.25142,0.75726,0,0,0.77778],"10935":[0.26167,0.75726,0,0,0.77778],"10936":[0.26167,0.75726,0,0,0.77778],"10937":[0.26167,0.75726,0,0,0.77778],"10938":[0.26167,0.75726,0,0,0.77778],"10949":[0.25583,0.75583,0,0,0.77778],"10950":[0.25583,0.75583,0,0,0.77778],"10955":[0.28481,0.79383,0,0,0.77778],"10956":[0.28481,0.79383,0,0,0.77778],"57350":[0.08167,0.58167,0,0,0.22222],"57351":[0.08167,0.58167,0,0,0.38889],"57352":[0.08167,0.58167,0,0,0.77778],"57353":[0,0.43056,0.04028,0,0.66667],"57356":[0.25142,0.75726,0,0,0.77778],"57357":[0.25142,0.75726,0,0,0.77778],"57358":[0.41951,0.91951,0,0,0.77778],"57359":[0.30274,0.79383,0,0,0.77778],"57360":[0.30274,0.79383,0,0,0.77778],"57361":[0.41951,0.91951,0,0,0.77778],"57366":[0.25142,0.75726,0,0,0.77778],"57367":[0.25142,0.75726,0,0,0.77778],"57368":[0.25142,0.75726,0,0,0.77778],"57369":[0.25142,0.75726,0,0,0.77778],"57370":[0.13597,0.63597,0,0,0.77778],"57371":[0.13597,0.63597,0,0,0.77778]},"Caligraphic-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.68333,0,0.19445,0.79847],"66":[0,0.68333,0.03041,0.13889,0.65681],"67":[0,0.68333,0.05834,0.13889,0.52653],"68":[0,0.68333,0.02778,0.08334,0.77139],"69":[0,0.68333,0.08944,0.11111,0.52778],"70":[0,0.68333,0.09931,0.11111,0.71875],"71":[0.09722,0.68333,0.0593,0.11111,0.59487],"72":[0,0.68333,0.00965,0.11111,0.84452],"73":[0,0.68333,0.07382,0,0.54452],"74":[0.09722,0.68333,0.18472,0.16667,0.67778],"75":[0,0.68333,0.01445,0.05556,0.76195],"76":[0,0.68333,0,0.13889,0.68972],"77":[0,0.68333,0,0.13889,1.2009],"78":[0,0.68333,0.14736,0.08334,0.82049],"79":[0,0.68333,0.02778,0.11111,0.79611],"80":[0,0.68333,0.08222,0.08334,0.69556],"81":[0.09722,0.68333,0,0.11111,0.81667],"82":[0,0.68333,0,0.08334,0.8475],"83":[0,0.68333,0.075,0.13889,0.60556],"84":[0,0.68333,0.25417,0,0.54464],"85":[0,0.68333,0.09931,0.08334,0.62583],"86":[0,0.68333,0.08222,0,0.61278],"87":[0,0.68333,0.08222,0.08334,0.98778],"88":[0,0.68333,0.14643,0.13889,0.7133],"89":[0.09722,0.68333,0.08222,0.08334,0.66834],"90":[0,0.68333,0.07944,0.13889,0.72473],"160":[0,0,0,0,0.25]},"Fraktur-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69141,0,0,0.29574],"34":[0,0.69141,0,0,0.21471],"38":[0,0.69141,0,0,0.73786],"39":[0,0.69141,0,0,0.21201],"40":[0.24982,0.74947,0,0,0.38865],"41":[0.24982,0.74947,0,0,0.38865],"42":[0,0.62119,0,0,0.27764],"43":[0.08319,0.58283,0,0,0.75623],"44":[0,0.10803,0,0,0.27764],"45":[0.08319,0.58283,0,0,0.75623],"46":[0,0.10803,0,0,0.27764],"47":[0.24982,0.74947,0,0,0.50181],"48":[0,0.47534,0,0,0.50181],"49":[0,0.47534,0,0,0.50181],"50":[0,0.47534,0,0,0.50181],"51":[0.18906,0.47534,0,0,0.50181],"52":[0.18906,0.47534,0,0,0.50181],"53":[0.18906,0.47534,0,0,0.50181],"54":[0,0.69141,0,0,0.50181],"55":[0.18906,0.47534,0,0,0.50181],"56":[0,0.69141,0,0,0.50181],"57":[0.18906,0.47534,0,0,0.50181],"58":[0,0.47534,0,0,0.21606],"59":[0.12604,0.47534,0,0,0.21606],"61":[-0.13099,0.36866,0,0,0.75623],"63":[0,0.69141,0,0,0.36245],"65":[0,0.69141,0,0,0.7176],"66":[0,0.69141,0,0,0.88397],"67":[0,0.69141,0,0,0.61254],"68":[0,0.69141,0,0,0.83158],"69":[0,0.69141,0,0,0.66278],"70":[0.12604,0.69141,0,0,0.61119],"71":[0,0.69141,0,0,0.78539],"72":[0.06302,0.69141,0,0,0.7203],"73":[0,0.69141,0,0,0.55448],"74":[0.12604,0.69141,0,0,0.55231],"75":[0,0.69141,0,0,0.66845],"76":[0,0.69141,0,0,0.66602],"77":[0,0.69141,0,0,1.04953],"78":[0,0.69141,0,0,0.83212],"79":[0,0.69141,0,0,0.82699],"80":[0.18906,0.69141,0,0,0.82753],"81":[0.03781,0.69141,0,0,0.82699],"82":[0,0.69141,0,0,0.82807],"83":[0,0.69141,0,0,0.82861],"84":[0,0.69141,0,0,0.66899],"85":[0,0.69141,0,0,0.64576],"86":[0,0.69141,0,0,0.83131],"87":[0,0.69141,0,0,1.04602],"88":[0,0.69141,0,0,0.71922],"89":[0.18906,0.69141,0,0,0.83293],"90":[0.12604,0.69141,0,0,0.60201],"91":[0.24982,0.74947,0,0,0.27764],"93":[0.24982,0.74947,0,0,0.27764],"94":[0,0.69141,0,0,0.49965],"97":[0,0.47534,0,0,0.50046],"98":[0,0.69141,0,0,0.51315],"99":[0,0.47534,0,0,0.38946],"100":[0,0.62119,0,0,0.49857],"101":[0,0.47534,0,0,0.40053],"102":[0.18906,0.69141,0,0,0.32626],"103":[0.18906,0.47534,0,0,0.5037],"104":[0.18906,0.69141,0,0,0.52126],"105":[0,0.69141,0,0,0.27899],"106":[0,0.69141,0,0,0.28088],"107":[0,0.69141,0,0,0.38946],"108":[0,0.69141,0,0,0.27953],"109":[0,0.47534,0,0,0.76676],"110":[0,0.47534,0,0,0.52666],"111":[0,0.47534,0,0,0.48885],"112":[0.18906,0.52396,0,0,0.50046],"113":[0.18906,0.47534,0,0,0.48912],"114":[0,0.47534,0,0,0.38919],"115":[0,0.47534,0,0,0.44266],"116":[0,0.62119,0,0,0.33301],"117":[0,0.47534,0,0,0.5172],"118":[0,0.52396,0,0,0.5118],"119":[0,0.52396,0,0,0.77351],"120":[0.18906,0.47534,0,0,0.38865],"121":[0.18906,0.47534,0,0,0.49884],"122":[0.18906,0.47534,0,0,0.39054],"160":[0,0,0,0,0.25],"8216":[0,0.69141,0,0,0.21471],"8217":[0,0.69141,0,0,0.21471],"58112":[0,0.62119,0,0,0.49749],"58113":[0,0.62119,0,0,0.4983],"58114":[0.18906,0.69141,0,0,0.33328],"58115":[0.18906,0.69141,0,0,0.32923],"58116":[0.18906,0.47534,0,0,0.50343],"58117":[0,0.69141,0,0,0.33301],"58118":[0,0.62119,0,0,0.33409],"58119":[0,0.47534,0,0,0.50073]},"Main-Bold":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.35],"34":[0,0.69444,0,0,0.60278],"35":[0.19444,0.69444,0,0,0.95833],"36":[0.05556,0.75,0,0,0.575],"37":[0.05556,0.75,0,0,0.95833],"38":[0,0.69444,0,0,0.89444],"39":[0,0.69444,0,0,0.31944],"40":[0.25,0.75,0,0,0.44722],"41":[0.25,0.75,0,0,0.44722],"42":[0,0.75,0,0,0.575],"43":[0.13333,0.63333,0,0,0.89444],"44":[0.19444,0.15556,0,0,0.31944],"45":[0,0.44444,0,0,0.38333],"46":[0,0.15556,0,0,0.31944],"47":[0.25,0.75,0,0,0.575],"48":[0,0.64444,0,0,0.575],"49":[0,0.64444,0,0,0.575],"50":[0,0.64444,0,0,0.575],"51":[0,0.64444,0,0,0.575],"52":[0,0.64444,0,0,0.575],"53":[0,0.64444,0,0,0.575],"54":[0,0.64444,0,0,0.575],"55":[0,0.64444,0,0,0.575],"56":[0,0.64444,0,0,0.575],"57":[0,0.64444,0,0,0.575],"58":[0,0.44444,0,0,0.31944],"59":[0.19444,0.44444,0,0,0.31944],"60":[0.08556,0.58556,0,0,0.89444],"61":[-0.10889,0.39111,0,0,0.89444],"62":[0.08556,0.58556,0,0,0.89444],"63":[0,0.69444,0,0,0.54305],"64":[0,0.69444,0,0,0.89444],"65":[0,0.68611,0,0,0.86944],"66":[0,0.68611,0,0,0.81805],"67":[0,0.68611,0,0,0.83055],"68":[0,0.68611,0,0,0.88194],"69":[0,0.68611,0,0,0.75555],"70":[0,0.68611,0,0,0.72361],"71":[0,0.68611,0,0,0.90416],"72":[0,0.68611,0,0,0.9],"73":[0,0.68611,0,0,0.43611],"74":[0,0.68611,0,0,0.59444],"75":[0,0.68611,0,0,0.90138],"76":[0,0.68611,0,0,0.69166],"77":[0,0.68611,0,0,1.09166],"78":[0,0.68611,0,0,0.9],"79":[0,0.68611,0,0,0.86388],"80":[0,0.68611,0,0,0.78611],"81":[0.19444,0.68611,0,0,0.86388],"82":[0,0.68611,0,0,0.8625],"83":[0,0.68611,0,0,0.63889],"84":[0,0.68611,0,0,0.8],"85":[0,0.68611,0,0,0.88472],"86":[0,0.68611,0.01597,0,0.86944],"87":[0,0.68611,0.01597,0,1.18888],"88":[0,0.68611,0,0,0.86944],"89":[0,0.68611,0.02875,0,0.86944],"90":[0,0.68611,0,0,0.70277],"91":[0.25,0.75,0,0,0.31944],"92":[0.25,0.75,0,0,0.575],"93":[0.25,0.75,0,0,0.31944],"94":[0,0.69444,0,0,0.575],"95":[0.31,0.13444,0.03194,0,0.575],"97":[0,0.44444,0,0,0.55902],"98":[0,0.69444,0,0,0.63889],"99":[0,0.44444,0,0,0.51111],"100":[0,0.69444,0,0,0.63889],"101":[0,0.44444,0,0,0.52708],"102":[0,0.69444,0.10903,0,0.35139],"103":[0.19444,0.44444,0.01597,0,0.575],"104":[0,0.69444,0,0,0.63889],"105":[0,0.69444,0,0,0.31944],"106":[0.19444,0.69444,0,0,0.35139],"107":[0,0.69444,0,0,0.60694],"108":[0,0.69444,0,0,0.31944],"109":[0,0.44444,0,0,0.95833],"110":[0,0.44444,0,0,0.63889],"111":[0,0.44444,0,0,0.575],"112":[0.19444,0.44444,0,0,0.63889],"113":[0.19444,0.44444,0,0,0.60694],"114":[0,0.44444,0,0,0.47361],"115":[0,0.44444,0,0,0.45361],"116":[0,0.63492,0,0,0.44722],"117":[0,0.44444,0,0,0.63889],"118":[0,0.44444,0.01597,0,0.60694],"119":[0,0.44444,0.01597,0,0.83055],"120":[0,0.44444,0,0,0.60694],"121":[0.19444,0.44444,0.01597,0,0.60694],"122":[0,0.44444,0,0,0.51111],"123":[0.25,0.75,0,0,0.575],"124":[0.25,0.75,0,0,0.31944],"125":[0.25,0.75,0,0,0.575],"126":[0.35,0.34444,0,0,0.575],"160":[0,0,0,0,0.25],"163":[0,0.69444,0,0,0.86853],"168":[0,0.69444,0,0,0.575],"172":[0,0.44444,0,0,0.76666],"176":[0,0.69444,0,0,0.86944],"177":[0.13333,0.63333,0,0,0.89444],"184":[0.17014,0,0,0,0.51111],"198":[0,0.68611,0,0,1.04166],"215":[0.13333,0.63333,0,0,0.89444],"216":[0.04861,0.73472,0,0,0.89444],"223":[0,0.69444,0,0,0.59722],"230":[0,0.44444,0,0,0.83055],"247":[0.13333,0.63333,0,0,0.89444],"248":[0.09722,0.54167,0,0,0.575],"305":[0,0.44444,0,0,0.31944],"338":[0,0.68611,0,0,1.16944],"339":[0,0.44444,0,0,0.89444],"567":[0.19444,0.44444,0,0,0.35139],"710":[0,0.69444,0,0,0.575],"711":[0,0.63194,0,0,0.575],"713":[0,0.59611,0,0,0.575],"714":[0,0.69444,0,0,0.575],"715":[0,0.69444,0,0,0.575],"728":[0,0.69444,0,0,0.575],"729":[0,0.69444,0,0,0.31944],"730":[0,0.69444,0,0,0.86944],"732":[0,0.69444,0,0,0.575],"733":[0,0.69444,0,0,0.575],"915":[0,0.68611,0,0,0.69166],"916":[0,0.68611,0,0,0.95833],"920":[0,0.68611,0,0,0.89444],"923":[0,0.68611,0,0,0.80555],"926":[0,0.68611,0,0,0.76666],"928":[0,0.68611,0,0,0.9],"931":[0,0.68611,0,0,0.83055],"933":[0,0.68611,0,0,0.89444],"934":[0,0.68611,0,0,0.83055],"936":[0,0.68611,0,0,0.89444],"937":[0,0.68611,0,0,0.83055],"8211":[0,0.44444,0.03194,0,0.575],"8212":[0,0.44444,0.03194,0,1.14999],"8216":[0,0.69444,0,0,0.31944],"8217":[0,0.69444,0,0,0.31944],"8220":[0,0.69444,0,0,0.60278],"8221":[0,0.69444,0,0,0.60278],"8224":[0.19444,0.69444,0,0,0.51111],"8225":[0.19444,0.69444,0,0,0.51111],"8242":[0,0.55556,0,0,0.34444],"8407":[0,0.72444,0.15486,0,0.575],"8463":[0,0.69444,0,0,0.66759],"8465":[0,0.69444,0,0,0.83055],"8467":[0,0.69444,0,0,0.47361],"8472":[0.19444,0.44444,0,0,0.74027],"8476":[0,0.69444,0,0,0.83055],"8501":[0,0.69444,0,0,0.70277],"8592":[-0.10889,0.39111,0,0,1.14999],"8593":[0.19444,0.69444,0,0,0.575],"8594":[-0.10889,0.39111,0,0,1.14999],"8595":[0.19444,0.69444,0,0,0.575],"8596":[-0.10889,0.39111,0,0,1.14999],"8597":[0.25,0.75,0,0,0.575],"8598":[0.19444,0.69444,0,0,1.14999],"8599":[0.19444,0.69444,0,0,1.14999],"8600":[0.19444,0.69444,0,0,1.14999],"8601":[0.19444,0.69444,0,0,1.14999],"8636":[-0.10889,0.39111,0,0,1.14999],"8637":[-0.10889,0.39111,0,0,1.14999],"8640":[-0.10889,0.39111,0,0,1.14999],"8641":[-0.10889,0.39111,0,0,1.14999],"8656":[-0.10889,0.39111,0,0,1.14999],"8657":[0.19444,0.69444,0,0,0.70277],"8658":[-0.10889,0.39111,0,0,1.14999],"8659":[0.19444,0.69444,0,0,0.70277],"8660":[-0.10889,0.39111,0,0,1.14999],"8661":[0.25,0.75,0,0,0.70277],"8704":[0,0.69444,0,0,0.63889],"8706":[0,0.69444,0.06389,0,0.62847],"8707":[0,0.69444,0,0,0.63889],"8709":[0.05556,0.75,0,0,0.575],"8711":[0,0.68611,0,0,0.95833],"8712":[0.08556,0.58556,0,0,0.76666],"8715":[0.08556,0.58556,0,0,0.76666],"8722":[0.13333,0.63333,0,0,0.89444],"8723":[0.13333,0.63333,0,0,0.89444],"8725":[0.25,0.75,0,0,0.575],"8726":[0.25,0.75,0,0,0.575],"8727":[-0.02778,0.47222,0,0,0.575],"8728":[-0.02639,0.47361,0,0,0.575],"8729":[-0.02639,0.47361,0,0,0.575],"8730":[0.18,0.82,0,0,0.95833],"8733":[0,0.44444,0,0,0.89444],"8734":[0,0.44444,0,0,1.14999],"8736":[0,0.69224,0,0,0.72222],"8739":[0.25,0.75,0,0,0.31944],"8741":[0.25,0.75,0,0,0.575],"8743":[0,0.55556,0,0,0.76666],"8744":[0,0.55556,0,0,0.76666],"8745":[0,0.55556,0,0,0.76666],"8746":[0,0.55556,0,0,0.76666],"8747":[0.19444,0.69444,0.12778,0,0.56875],"8764":[-0.10889,0.39111,0,0,0.89444],"8768":[0.19444,0.69444,0,0,0.31944],"8771":[0.00222,0.50222,0,0,0.89444],"8773":[0.027,0.638,0,0,0.894],"8776":[0.02444,0.52444,0,0,0.89444],"8781":[0.00222,0.50222,0,0,0.89444],"8801":[0.00222,0.50222,0,0,0.89444],"8804":[0.19667,0.69667,0,0,0.89444],"8805":[0.19667,0.69667,0,0,0.89444],"8810":[0.08556,0.58556,0,0,1.14999],"8811":[0.08556,0.58556,0,0,1.14999],"8826":[0.08556,0.58556,0,0,0.89444],"8827":[0.08556,0.58556,0,0,0.89444],"8834":[0.08556,0.58556,0,0,0.89444],"8835":[0.08556,0.58556,0,0,0.89444],"8838":[0.19667,0.69667,0,0,0.89444],"8839":[0.19667,0.69667,0,0,0.89444],"8846":[0,0.55556,0,0,0.76666],"8849":[0.19667,0.69667,0,0,0.89444],"8850":[0.19667,0.69667,0,0,0.89444],"8851":[0,0.55556,0,0,0.76666],"8852":[0,0.55556,0,0,0.76666],"8853":[0.13333,0.63333,0,0,0.89444],"8854":[0.13333,0.63333,0,0,0.89444],"8855":[0.13333,0.63333,0,0,0.89444],"8856":[0.13333,0.63333,0,0,0.89444],"8857":[0.13333,0.63333,0,0,0.89444],"8866":[0,0.69444,0,0,0.70277],"8867":[0,0.69444,0,0,0.70277],"8868":[0,0.69444,0,0,0.89444],"8869":[0,0.69444,0,0,0.89444],"8900":[-0.02639,0.47361,0,0,0.575],"8901":[-0.02639,0.47361,0,0,0.31944],"8902":[-0.02778,0.47222,0,0,0.575],"8968":[0.25,0.75,0,0,0.51111],"8969":[0.25,0.75,0,0,0.51111],"8970":[0.25,0.75,0,0,0.51111],"8971":[0.25,0.75,0,0,0.51111],"8994":[-0.13889,0.36111,0,0,1.14999],"8995":[-0.13889,0.36111,0,0,1.14999],"9651":[0.19444,0.69444,0,0,1.02222],"9657":[-0.02778,0.47222,0,0,0.575],"9661":[0.19444,0.69444,0,0,1.02222],"9667":[-0.02778,0.47222,0,0,0.575],"9711":[0.19444,0.69444,0,0,1.14999],"9824":[0.12963,0.69444,0,0,0.89444],"9825":[0.12963,0.69444,0,0,0.89444],"9826":[0.12963,0.69444,0,0,0.89444],"9827":[0.12963,0.69444,0,0,0.89444],"9837":[0,0.75,0,0,0.44722],"9838":[0.19444,0.69444,0,0,0.44722],"9839":[0.19444,0.69444,0,0,0.44722],"10216":[0.25,0.75,0,0,0.44722],"10217":[0.25,0.75,0,0,0.44722],"10815":[0,0.68611,0,0,0.9],"10927":[0.19667,0.69667,0,0,0.89444],"10928":[0.19667,0.69667,0,0,0.89444],"57376":[0.19444,0.69444,0,0,0]},"Main-BoldItalic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.11417,0,0.38611],"34":[0,0.69444,0.07939,0,0.62055],"35":[0.19444,0.69444,0.06833,0,0.94444],"37":[0.05556,0.75,0.12861,0,0.94444],"38":[0,0.69444,0.08528,0,0.88555],"39":[0,0.69444,0.12945,0,0.35555],"40":[0.25,0.75,0.15806,0,0.47333],"41":[0.25,0.75,0.03306,0,0.47333],"42":[0,0.75,0.14333,0,0.59111],"43":[0.10333,0.60333,0.03306,0,0.88555],"44":[0.19444,0.14722,0,0,0.35555],"45":[0,0.44444,0.02611,0,0.41444],"46":[0,0.14722,0,0,0.35555],"47":[0.25,0.75,0.15806,0,0.59111],"48":[0,0.64444,0.13167,0,0.59111],"49":[0,0.64444,0.13167,0,0.59111],"50":[0,0.64444,0.13167,0,0.59111],"51":[0,0.64444,0.13167,0,0.59111],"52":[0.19444,0.64444,0.13167,0,0.59111],"53":[0,0.64444,0.13167,0,0.59111],"54":[0,0.64444,0.13167,0,0.59111],"55":[0.19444,0.64444,0.13167,0,0.59111],"56":[0,0.64444,0.13167,0,0.59111],"57":[0,0.64444,0.13167,0,0.59111],"58":[0,0.44444,0.06695,0,0.35555],"59":[0.19444,0.44444,0.06695,0,0.35555],"61":[-0.10889,0.39111,0.06833,0,0.88555],"63":[0,0.69444,0.11472,0,0.59111],"64":[0,0.69444,0.09208,0,0.88555],"65":[0,0.68611,0,0,0.86555],"66":[0,0.68611,0.0992,0,0.81666],"67":[0,0.68611,0.14208,0,0.82666],"68":[0,0.68611,0.09062,0,0.87555],"69":[0,0.68611,0.11431,0,0.75666],"70":[0,0.68611,0.12903,0,0.72722],"71":[0,0.68611,0.07347,0,0.89527],"72":[0,0.68611,0.17208,0,0.8961],"73":[0,0.68611,0.15681,0,0.47166],"74":[0,0.68611,0.145,0,0.61055],"75":[0,0.68611,0.14208,0,0.89499],"76":[0,0.68611,0,0,0.69777],"77":[0,0.68611,0.17208,0,1.07277],"78":[0,0.68611,0.17208,0,0.8961],"79":[0,0.68611,0.09062,0,0.85499],"80":[0,0.68611,0.0992,0,0.78721],"81":[0.19444,0.68611,0.09062,0,0.85499],"82":[0,0.68611,0.02559,0,0.85944],"83":[0,0.68611,0.11264,0,0.64999],"84":[0,0.68611,0.12903,0,0.7961],"85":[0,0.68611,0.17208,0,0.88083],"86":[0,0.68611,0.18625,0,0.86555],"87":[0,0.68611,0.18625,0,1.15999],"88":[0,0.68611,0.15681,0,0.86555],"89":[0,0.68611,0.19803,0,0.86555],"90":[0,0.68611,0.14208,0,0.70888],"91":[0.25,0.75,0.1875,0,0.35611],"93":[0.25,0.75,0.09972,0,0.35611],"94":[0,0.69444,0.06709,0,0.59111],"95":[0.31,0.13444,0.09811,0,0.59111],"97":[0,0.44444,0.09426,0,0.59111],"98":[0,0.69444,0.07861,0,0.53222],"99":[0,0.44444,0.05222,0,0.53222],"100":[0,0.69444,0.10861,0,0.59111],"101":[0,0.44444,0.085,0,0.53222],"102":[0.19444,0.69444,0.21778,0,0.4],"103":[0.19444,0.44444,0.105,0,0.53222],"104":[0,0.69444,0.09426,0,0.59111],"105":[0,0.69326,0.11387,0,0.35555],"106":[0.19444,0.69326,0.1672,0,0.35555],"107":[0,0.69444,0.11111,0,0.53222],"108":[0,0.69444,0.10861,0,0.29666],"109":[0,0.44444,0.09426,0,0.94444],"110":[0,0.44444,0.09426,0,0.64999],"111":[0,0.44444,0.07861,0,0.59111],"112":[0.19444,0.44444,0.07861,0,0.59111],"113":[0.19444,0.44444,0.105,0,0.53222],"114":[0,0.44444,0.11111,0,0.50167],"115":[0,0.44444,0.08167,0,0.48694],"116":[0,0.63492,0.09639,0,0.385],"117":[0,0.44444,0.09426,0,0.62055],"118":[0,0.44444,0.11111,0,0.53222],"119":[0,0.44444,0.11111,0,0.76777],"120":[0,0.44444,0.12583,0,0.56055],"121":[0.19444,0.44444,0.105,0,0.56166],"122":[0,0.44444,0.13889,0,0.49055],"126":[0.35,0.34444,0.11472,0,0.59111],"160":[0,0,0,0,0.25],"168":[0,0.69444,0.11473,0,0.59111],"176":[0,0.69444,0,0,0.94888],"184":[0.17014,0,0,0,0.53222],"198":[0,0.68611,0.11431,0,1.02277],"216":[0.04861,0.73472,0.09062,0,0.88555],"223":[0.19444,0.69444,0.09736,0,0.665],"230":[0,0.44444,0.085,0,0.82666],"248":[0.09722,0.54167,0.09458,0,0.59111],"305":[0,0.44444,0.09426,0,0.35555],"338":[0,0.68611,0.11431,0,1.14054],"339":[0,0.44444,0.085,0,0.82666],"567":[0.19444,0.44444,0.04611,0,0.385],"710":[0,0.69444,0.06709,0,0.59111],"711":[0,0.63194,0.08271,0,0.59111],"713":[0,0.59444,0.10444,0,0.59111],"714":[0,0.69444,0.08528,0,0.59111],"715":[0,0.69444,0,0,0.59111],"728":[0,0.69444,0.10333,0,0.59111],"729":[0,0.69444,0.12945,0,0.35555],"730":[0,0.69444,0,0,0.94888],"732":[0,0.69444,0.11472,0,0.59111],"733":[0,0.69444,0.11472,0,0.59111],"915":[0,0.68611,0.12903,0,0.69777],"916":[0,0.68611,0,0,0.94444],"920":[0,0.68611,0.09062,0,0.88555],"923":[0,0.68611,0,0,0.80666],"926":[0,0.68611,0.15092,0,0.76777],"928":[0,0.68611,0.17208,0,0.8961],"931":[0,0.68611,0.11431,0,0.82666],"933":[0,0.68611,0.10778,0,0.88555],"934":[0,0.68611,0.05632,0,0.82666],"936":[0,0.68611,0.10778,0,0.88555],"937":[0,0.68611,0.0992,0,0.82666],"8211":[0,0.44444,0.09811,0,0.59111],"8212":[0,0.44444,0.09811,0,1.18221],"8216":[0,0.69444,0.12945,0,0.35555],"8217":[0,0.69444,0.12945,0,0.35555],"8220":[0,0.69444,0.16772,0,0.62055],"8221":[0,0.69444,0.07939,0,0.62055]},"Main-Italic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.12417,0,0.30667],"34":[0,0.69444,0.06961,0,0.51444],"35":[0.19444,0.69444,0.06616,0,0.81777],"37":[0.05556,0.75,0.13639,0,0.81777],"38":[0,0.69444,0.09694,0,0.76666],"39":[0,0.69444,0.12417,0,0.30667],"40":[0.25,0.75,0.16194,0,0.40889],"41":[0.25,0.75,0.03694,0,0.40889],"42":[0,0.75,0.14917,0,0.51111],"43":[0.05667,0.56167,0.03694,0,0.76666],"44":[0.19444,0.10556,0,0,0.30667],"45":[0,0.43056,0.02826,0,0.35778],"46":[0,0.10556,0,0,0.30667],"47":[0.25,0.75,0.16194,0,0.51111],"48":[0,0.64444,0.13556,0,0.51111],"49":[0,0.64444,0.13556,0,0.51111],"50":[0,0.64444,0.13556,0,0.51111],"51":[0,0.64444,0.13556,0,0.51111],"52":[0.19444,0.64444,0.13556,0,0.51111],"53":[0,0.64444,0.13556,0,0.51111],"54":[0,0.64444,0.13556,0,0.51111],"55":[0.19444,0.64444,0.13556,0,0.51111],"56":[0,0.64444,0.13556,0,0.51111],"57":[0,0.64444,0.13556,0,0.51111],"58":[0,0.43056,0.0582,0,0.30667],"59":[0.19444,0.43056,0.0582,0,0.30667],"61":[-0.13313,0.36687,0.06616,0,0.76666],"63":[0,0.69444,0.1225,0,0.51111],"64":[0,0.69444,0.09597,0,0.76666],"65":[0,0.68333,0,0,0.74333],"66":[0,0.68333,0.10257,0,0.70389],"67":[0,0.68333,0.14528,0,0.71555],"68":[0,0.68333,0.09403,0,0.755],"69":[0,0.68333,0.12028,0,0.67833],"70":[0,0.68333,0.13305,0,0.65277],"71":[0,0.68333,0.08722,0,0.77361],"72":[0,0.68333,0.16389,0,0.74333],"73":[0,0.68333,0.15806,0,0.38555],"74":[0,0.68333,0.14028,0,0.525],"75":[0,0.68333,0.14528,0,0.76888],"76":[0,0.68333,0,0,0.62722],"77":[0,0.68333,0.16389,0,0.89666],"78":[0,0.68333,0.16389,0,0.74333],"79":[0,0.68333,0.09403,0,0.76666],"80":[0,0.68333,0.10257,0,0.67833],"81":[0.19444,0.68333,0.09403,0,0.76666],"82":[0,0.68333,0.03868,0,0.72944],"83":[0,0.68333,0.11972,0,0.56222],"84":[0,0.68333,0.13305,0,0.71555],"85":[0,0.68333,0.16389,0,0.74333],"86":[0,0.68333,0.18361,0,0.74333],"87":[0,0.68333,0.18361,0,0.99888],"88":[0,0.68333,0.15806,0,0.74333],"89":[0,0.68333,0.19383,0,0.74333],"90":[0,0.68333,0.14528,0,0.61333],"91":[0.25,0.75,0.1875,0,0.30667],"93":[0.25,0.75,0.10528,0,0.30667],"94":[0,0.69444,0.06646,0,0.51111],"95":[0.31,0.12056,0.09208,0,0.51111],"97":[0,0.43056,0.07671,0,0.51111],"98":[0,0.69444,0.06312,0,0.46],"99":[0,0.43056,0.05653,0,0.46],"100":[0,0.69444,0.10333,0,0.51111],"101":[0,0.43056,0.07514,0,0.46],"102":[0.19444,0.69444,0.21194,0,0.30667],"103":[0.19444,0.43056,0.08847,0,0.46],"104":[0,0.69444,0.07671,0,0.51111],"105":[0,0.65536,0.1019,0,0.30667],"106":[0.19444,0.65536,0.14467,0,0.30667],"107":[0,0.69444,0.10764,0,0.46],"108":[0,0.69444,0.10333,0,0.25555],"109":[0,0.43056,0.07671,0,0.81777],"110":[0,0.43056,0.07671,0,0.56222],"111":[0,0.43056,0.06312,0,0.51111],"112":[0.19444,0.43056,0.06312,0,0.51111],"113":[0.19444,0.43056,0.08847,0,0.46],"114":[0,0.43056,0.10764,0,0.42166],"115":[0,0.43056,0.08208,0,0.40889],"116":[0,0.61508,0.09486,0,0.33222],"117":[0,0.43056,0.07671,0,0.53666],"118":[0,0.43056,0.10764,0,0.46],"119":[0,0.43056,0.10764,0,0.66444],"120":[0,0.43056,0.12042,0,0.46389],"121":[0.19444,0.43056,0.08847,0,0.48555],"122":[0,0.43056,0.12292,0,0.40889],"126":[0.35,0.31786,0.11585,0,0.51111],"160":[0,0,0,0,0.25],"168":[0,0.66786,0.10474,0,0.51111],"176":[0,0.69444,0,0,0.83129],"184":[0.17014,0,0,0,0.46],"198":[0,0.68333,0.12028,0,0.88277],"216":[0.04861,0.73194,0.09403,0,0.76666],"223":[0.19444,0.69444,0.10514,0,0.53666],"230":[0,0.43056,0.07514,0,0.71555],"248":[0.09722,0.52778,0.09194,0,0.51111],"338":[0,0.68333,0.12028,0,0.98499],"339":[0,0.43056,0.07514,0,0.71555],"710":[0,0.69444,0.06646,0,0.51111],"711":[0,0.62847,0.08295,0,0.51111],"713":[0,0.56167,0.10333,0,0.51111],"714":[0,0.69444,0.09694,0,0.51111],"715":[0,0.69444,0,0,0.51111],"728":[0,0.69444,0.10806,0,0.51111],"729":[0,0.66786,0.11752,0,0.30667],"730":[0,0.69444,0,0,0.83129],"732":[0,0.66786,0.11585,0,0.51111],"733":[0,0.69444,0.1225,0,0.51111],"915":[0,0.68333,0.13305,0,0.62722],"916":[0,0.68333,0,0,0.81777],"920":[0,0.68333,0.09403,0,0.76666],"923":[0,0.68333,0,0,0.69222],"926":[0,0.68333,0.15294,0,0.66444],"928":[0,0.68333,0.16389,0,0.74333],"931":[0,0.68333,0.12028,0,0.71555],"933":[0,0.68333,0.11111,0,0.76666],"934":[0,0.68333,0.05986,0,0.71555],"936":[0,0.68333,0.11111,0,0.76666],"937":[0,0.68333,0.10257,0,0.71555],"8211":[0,0.43056,0.09208,0,0.51111],"8212":[0,0.43056,0.09208,0,1.02222],"8216":[0,0.69444,0.12417,0,0.30667],"8217":[0,0.69444,0.12417,0,0.30667],"8220":[0,0.69444,0.1685,0,0.51444],"8221":[0,0.69444,0.06961,0,0.51444],"8463":[0,0.68889,0,0,0.54028]},"Main-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.27778],"34":[0,0.69444,0,0,0.5],"35":[0.19444,0.69444,0,0,0.83334],"36":[0.05556,0.75,0,0,0.5],"37":[0.05556,0.75,0,0,0.83334],"38":[0,0.69444,0,0,0.77778],"39":[0,0.69444,0,0,0.27778],"40":[0.25,0.75,0,0,0.38889],"41":[0.25,0.75,0,0,0.38889],"42":[0,0.75,0,0,0.5],"43":[0.08333,0.58333,0,0,0.77778],"44":[0.19444,0.10556,0,0,0.27778],"45":[0,0.43056,0,0,0.33333],"46":[0,0.10556,0,0,0.27778],"47":[0.25,0.75,0,0,0.5],"48":[0,0.64444,0,0,0.5],"49":[0,0.64444,0,0,0.5],"50":[0,0.64444,0,0,0.5],"51":[0,0.64444,0,0,0.5],"52":[0,0.64444,0,0,0.5],"53":[0,0.64444,0,0,0.5],"54":[0,0.64444,0,0,0.5],"55":[0,0.64444,0,0,0.5],"56":[0,0.64444,0,0,0.5],"57":[0,0.64444,0,0,0.5],"58":[0,0.43056,0,0,0.27778],"59":[0.19444,0.43056,0,0,0.27778],"60":[0.0391,0.5391,0,0,0.77778],"61":[-0.13313,0.36687,0,0,0.77778],"62":[0.0391,0.5391,0,0,0.77778],"63":[0,0.69444,0,0,0.47222],"64":[0,0.69444,0,0,0.77778],"65":[0,0.68333,0,0,0.75],"66":[0,0.68333,0,0,0.70834],"67":[0,0.68333,0,0,0.72222],"68":[0,0.68333,0,0,0.76389],"69":[0,0.68333,0,0,0.68056],"70":[0,0.68333,0,0,0.65278],"71":[0,0.68333,0,0,0.78472],"72":[0,0.68333,0,0,0.75],"73":[0,0.68333,0,0,0.36111],"74":[0,0.68333,0,0,0.51389],"75":[0,0.68333,0,0,0.77778],"76":[0,0.68333,0,0,0.625],"77":[0,0.68333,0,0,0.91667],"78":[0,0.68333,0,0,0.75],"79":[0,0.68333,0,0,0.77778],"80":[0,0.68333,0,0,0.68056],"81":[0.19444,0.68333,0,0,0.77778],"82":[0,0.68333,0,0,0.73611],"83":[0,0.68333,0,0,0.55556],"84":[0,0.68333,0,0,0.72222],"85":[0,0.68333,0,0,0.75],"86":[0,0.68333,0.01389,0,0.75],"87":[0,0.68333,0.01389,0,1.02778],"88":[0,0.68333,0,0,0.75],"89":[0,0.68333,0.025,0,0.75],"90":[0,0.68333,0,0,0.61111],"91":[0.25,0.75,0,0,0.27778],"92":[0.25,0.75,0,0,0.5],"93":[0.25,0.75,0,0,0.27778],"94":[0,0.69444,0,0,0.5],"95":[0.31,0.12056,0.02778,0,0.5],"97":[0,0.43056,0,0,0.5],"98":[0,0.69444,0,0,0.55556],"99":[0,0.43056,0,0,0.44445],"100":[0,0.69444,0,0,0.55556],"101":[0,0.43056,0,0,0.44445],"102":[0,0.69444,0.07778,0,0.30556],"103":[0.19444,0.43056,0.01389,0,0.5],"104":[0,0.69444,0,0,0.55556],"105":[0,0.66786,0,0,0.27778],"106":[0.19444,0.66786,0,0,0.30556],"107":[0,0.69444,0,0,0.52778],"108":[0,0.69444,0,0,0.27778],"109":[0,0.43056,0,0,0.83334],"110":[0,0.43056,0,0,0.55556],"111":[0,0.43056,0,0,0.5],"112":[0.19444,0.43056,0,0,0.55556],"113":[0.19444,0.43056,0,0,0.52778],"114":[0,0.43056,0,0,0.39167],"115":[0,0.43056,0,0,0.39445],"116":[0,0.61508,0,0,0.38889],"117":[0,0.43056,0,0,0.55556],"118":[0,0.43056,0.01389,0,0.52778],"119":[0,0.43056,0.01389,0,0.72222],"120":[0,0.43056,0,0,0.52778],"121":[0.19444,0.43056,0.01389,0,0.52778],"122":[0,0.43056,0,0,0.44445],"123":[0.25,0.75,0,0,0.5],"124":[0.25,0.75,0,0,0.27778],"125":[0.25,0.75,0,0,0.5],"126":[0.35,0.31786,0,0,0.5],"160":[0,0,0,0,0.25],"163":[0,0.69444,0,0,0.76909],"167":[0.19444,0.69444,0,0,0.44445],"168":[0,0.66786,0,0,0.5],"172":[0,0.43056,0,0,0.66667],"176":[0,0.69444,0,0,0.75],"177":[0.08333,0.58333,0,0,0.77778],"182":[0.19444,0.69444,0,0,0.61111],"184":[0.17014,0,0,0,0.44445],"198":[0,0.68333,0,0,0.90278],"215":[0.08333,0.58333,0,0,0.77778],"216":[0.04861,0.73194,0,0,0.77778],"223":[0,0.69444,0,0,0.5],"230":[0,0.43056,0,0,0.72222],"247":[0.08333,0.58333,0,0,0.77778],"248":[0.09722,0.52778,0,0,0.5],"305":[0,0.43056,0,0,0.27778],"338":[0,0.68333,0,0,1.01389],"339":[0,0.43056,0,0,0.77778],"567":[0.19444,0.43056,0,0,0.30556],"710":[0,0.69444,0,0,0.5],"711":[0,0.62847,0,0,0.5],"713":[0,0.56778,0,0,0.5],"714":[0,0.69444,0,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0,0,0.5],"729":[0,0.66786,0,0,0.27778],"730":[0,0.69444,0,0,0.75],"732":[0,0.66786,0,0,0.5],"733":[0,0.69444,0,0,0.5],"915":[0,0.68333,0,0,0.625],"916":[0,0.68333,0,0,0.83334],"920":[0,0.68333,0,0,0.77778],"923":[0,0.68333,0,0,0.69445],"926":[0,0.68333,0,0,0.66667],"928":[0,0.68333,0,0,0.75],"931":[0,0.68333,0,0,0.72222],"933":[0,0.68333,0,0,0.77778],"934":[0,0.68333,0,0,0.72222],"936":[0,0.68333,0,0,0.77778],"937":[0,0.68333,0,0,0.72222],"8211":[0,0.43056,0.02778,0,0.5],"8212":[0,0.43056,0.02778,0,1],"8216":[0,0.69444,0,0,0.27778],"8217":[0,0.69444,0,0,0.27778],"8220":[0,0.69444,0,0,0.5],"8221":[0,0.69444,0,0,0.5],"8224":[0.19444,0.69444,0,0,0.44445],"8225":[0.19444,0.69444,0,0,0.44445],"8230":[0,0.123,0,0,1.172],"8242":[0,0.55556,0,0,0.275],"8407":[0,0.71444,0.15382,0,0.5],"8463":[0,0.68889,0,0,0.54028],"8465":[0,0.69444,0,0,0.72222],"8467":[0,0.69444,0,0.11111,0.41667],"8472":[0.19444,0.43056,0,0.11111,0.63646],"8476":[0,0.69444,0,0,0.72222],"8501":[0,0.69444,0,0,0.61111],"8592":[-0.13313,0.36687,0,0,1],"8593":[0.19444,0.69444,0,0,0.5],"8594":[-0.13313,0.36687,0,0,1],"8595":[0.19444,0.69444,0,0,0.5],"8596":[-0.13313,0.36687,0,0,1],"8597":[0.25,0.75,0,0,0.5],"8598":[0.19444,0.69444,0,0,1],"8599":[0.19444,0.69444,0,0,1],"8600":[0.19444,0.69444,0,0,1],"8601":[0.19444,0.69444,0,0,1],"8614":[0.011,0.511,0,0,1],"8617":[0.011,0.511,0,0,1.126],"8618":[0.011,0.511,0,0,1.126],"8636":[-0.13313,0.36687,0,0,1],"8637":[-0.13313,0.36687,0,0,1],"8640":[-0.13313,0.36687,0,0,1],"8641":[-0.13313,0.36687,0,0,1],"8652":[0.011,0.671,0,0,1],"8656":[-0.13313,0.36687,0,0,1],"8657":[0.19444,0.69444,0,0,0.61111],"8658":[-0.13313,0.36687,0,0,1],"8659":[0.19444,0.69444,0,0,0.61111],"8660":[-0.13313,0.36687,0,0,1],"8661":[0.25,0.75,0,0,0.61111],"8704":[0,0.69444,0,0,0.55556],"8706":[0,0.69444,0.05556,0.08334,0.5309],"8707":[0,0.69444,0,0,0.55556],"8709":[0.05556,0.75,0,0,0.5],"8711":[0,0.68333,0,0,0.83334],"8712":[0.0391,0.5391,0,0,0.66667],"8715":[0.0391,0.5391,0,0,0.66667],"8722":[0.08333,0.58333,0,0,0.77778],"8723":[0.08333,0.58333,0,0,0.77778],"8725":[0.25,0.75,0,0,0.5],"8726":[0.25,0.75,0,0,0.5],"8727":[-0.03472,0.46528,0,0,0.5],"8728":[-0.05555,0.44445,0,0,0.5],"8729":[-0.05555,0.44445,0,0,0.5],"8730":[0.2,0.8,0,0,0.83334],"8733":[0,0.43056,0,0,0.77778],"8734":[0,0.43056,0,0,1],"8736":[0,0.69224,0,0,0.72222],"8739":[0.25,0.75,0,0,0.27778],"8741":[0.25,0.75,0,0,0.5],"8743":[0,0.55556,0,0,0.66667],"8744":[0,0.55556,0,0,0.66667],"8745":[0,0.55556,0,0,0.66667],"8746":[0,0.55556,0,0,0.66667],"8747":[0.19444,0.69444,0.11111,0,0.41667],"8764":[-0.13313,0.36687,0,0,0.77778],"8768":[0.19444,0.69444,0,0,0.27778],"8771":[-0.03625,0.46375,0,0,0.77778],"8773":[-0.022,0.589,0,0,0.778],"8776":[-0.01688,0.48312,0,0,0.77778],"8781":[-0.03625,0.46375,0,0,0.77778],"8784":[-0.133,0.673,0,0,0.778],"8801":[-0.03625,0.46375,0,0,0.77778],"8804":[0.13597,0.63597,0,0,0.77778],"8805":[0.13597,0.63597,0,0,0.77778],"8810":[0.0391,0.5391,0,0,1],"8811":[0.0391,0.5391,0,0,1],"8826":[0.0391,0.5391,0,0,0.77778],"8827":[0.0391,0.5391,0,0,0.77778],"8834":[0.0391,0.5391,0,0,0.77778],"8835":[0.0391,0.5391,0,0,0.77778],"8838":[0.13597,0.63597,0,0,0.77778],"8839":[0.13597,0.63597,0,0,0.77778],"8846":[0,0.55556,0,0,0.66667],"8849":[0.13597,0.63597,0,0,0.77778],"8850":[0.13597,0.63597,0,0,0.77778],"8851":[0,0.55556,0,0,0.66667],"8852":[0,0.55556,0,0,0.66667],"8853":[0.08333,0.58333,0,0,0.77778],"8854":[0.08333,0.58333,0,0,0.77778],"8855":[0.08333,0.58333,0,0,0.77778],"8856":[0.08333,0.58333,0,0,0.77778],"8857":[0.08333,0.58333,0,0,0.77778],"8866":[0,0.69444,0,0,0.61111],"8867":[0,0.69444,0,0,0.61111],"8868":[0,0.69444,0,0,0.77778],"8869":[0,0.69444,0,0,0.77778],"8872":[0.249,0.75,0,0,0.867],"8900":[-0.05555,0.44445,0,0,0.5],"8901":[-0.05555,0.44445,0,0,0.27778],"8902":[-0.03472,0.46528,0,0,0.5],"8904":[0.005,0.505,0,0,0.9],"8942":[0.03,0.903,0,0,0.278],"8943":[-0.19,0.313,0,0,1.172],"8945":[-0.1,0.823,0,0,1.282],"8968":[0.25,0.75,0,0,0.44445],"8969":[0.25,0.75,0,0,0.44445],"8970":[0.25,0.75,0,0,0.44445],"8971":[0.25,0.75,0,0,0.44445],"8994":[-0.14236,0.35764,0,0,1],"8995":[-0.14236,0.35764,0,0,1],"9136":[0.244,0.744,0,0,0.412],"9137":[0.244,0.745,0,0,0.412],"9651":[0.19444,0.69444,0,0,0.88889],"9657":[-0.03472,0.46528,0,0,0.5],"9661":[0.19444,0.69444,0,0,0.88889],"9667":[-0.03472,0.46528,0,0,0.5],"9711":[0.19444,0.69444,0,0,1],"9824":[0.12963,0.69444,0,0,0.77778],"9825":[0.12963,0.69444,0,0,0.77778],"9826":[0.12963,0.69444,0,0,0.77778],"9827":[0.12963,0.69444,0,0,0.77778],"9837":[0,0.75,0,0,0.38889],"9838":[0.19444,0.69444,0,0,0.38889],"9839":[0.19444,0.69444,0,0,0.38889],"10216":[0.25,0.75,0,0,0.38889],"10217":[0.25,0.75,0,0,0.38889],"10222":[0.244,0.744,0,0,0.412],"10223":[0.244,0.745,0,0,0.412],"10229":[0.011,0.511,0,0,1.609],"10230":[0.011,0.511,0,0,1.638],"10231":[0.011,0.511,0,0,1.859],"10232":[0.024,0.525,0,0,1.609],"10233":[0.024,0.525,0,0,1.638],"10234":[0.024,0.525,0,0,1.858],"10236":[0.011,0.511,0,0,1.638],"10815":[0,0.68333,0,0,0.75],"10927":[0.13597,0.63597,0,0,0.77778],"10928":[0.13597,0.63597,0,0,0.77778],"57376":[0.19444,0.69444,0,0,0]},"Math-BoldItalic":{"32":[0,0,0,0,0.25],"48":[0,0.44444,0,0,0.575],"49":[0,0.44444,0,0,0.575],"50":[0,0.44444,0,0,0.575],"51":[0.19444,0.44444,0,0,0.575],"52":[0.19444,0.44444,0,0,0.575],"53":[0.19444,0.44444,0,0,0.575],"54":[0,0.64444,0,0,0.575],"55":[0.19444,0.44444,0,0,0.575],"56":[0,0.64444,0,0,0.575],"57":[0.19444,0.44444,0,0,0.575],"65":[0,0.68611,0,0,0.86944],"66":[0,0.68611,0.04835,0,0.8664],"67":[0,0.68611,0.06979,0,0.81694],"68":[0,0.68611,0.03194,0,0.93812],"69":[0,0.68611,0.05451,0,0.81007],"70":[0,0.68611,0.15972,0,0.68889],"71":[0,0.68611,0,0,0.88673],"72":[0,0.68611,0.08229,0,0.98229],"73":[0,0.68611,0.07778,0,0.51111],"74":[0,0.68611,0.10069,0,0.63125],"75":[0,0.68611,0.06979,0,0.97118],"76":[0,0.68611,0,0,0.75555],"77":[0,0.68611,0.11424,0,1.14201],"78":[0,0.68611,0.11424,0,0.95034],"79":[0,0.68611,0.03194,0,0.83666],"80":[0,0.68611,0.15972,0,0.72309],"81":[0.19444,0.68611,0,0,0.86861],"82":[0,0.68611,0.00421,0,0.87235],"83":[0,0.68611,0.05382,0,0.69271],"84":[0,0.68611,0.15972,0,0.63663],"85":[0,0.68611,0.11424,0,0.80027],"86":[0,0.68611,0.25555,0,0.67778],"87":[0,0.68611,0.15972,0,1.09305],"88":[0,0.68611,0.07778,0,0.94722],"89":[0,0.68611,0.25555,0,0.67458],"90":[0,0.68611,0.06979,0,0.77257],"97":[0,0.44444,0,0,0.63287],"98":[0,0.69444,0,0,0.52083],"99":[0,0.44444,0,0,0.51342],"100":[0,0.69444,0,0,0.60972],"101":[0,0.44444,0,0,0.55361],"102":[0.19444,0.69444,0.11042,0,0.56806],"103":[0.19444,0.44444,0.03704,0,0.5449],"104":[0,0.69444,0,0,0.66759],"105":[0,0.69326,0,0,0.4048],"106":[0.19444,0.69326,0.0622,0,0.47083],"107":[0,0.69444,0.01852,0,0.6037],"108":[0,0.69444,0.0088,0,0.34815],"109":[0,0.44444,0,0,1.0324],"110":[0,0.44444,0,0,0.71296],"111":[0,0.44444,0,0,0.58472],"112":[0.19444,0.44444,0,0,0.60092],"113":[0.19444,0.44444,0.03704,0,0.54213],"114":[0,0.44444,0.03194,0,0.5287],"115":[0,0.44444,0,0,0.53125],"116":[0,0.63492,0,0,0.41528],"117":[0,0.44444,0,0,0.68102],"118":[0,0.44444,0.03704,0,0.56666],"119":[0,0.44444,0.02778,0,0.83148],"120":[0,0.44444,0,0,0.65903],"121":[0.19444,0.44444,0.03704,0,0.59028],"122":[0,0.44444,0.04213,0,0.55509],"160":[0,0,0,0,0.25],"915":[0,0.68611,0.15972,0,0.65694],"916":[0,0.68611,0,0,0.95833],"920":[0,0.68611,0.03194,0,0.86722],"923":[0,0.68611,0,0,0.80555],"926":[0,0.68611,0.07458,0,0.84125],"928":[0,0.68611,0.08229,0,0.98229],"931":[0,0.68611,0.05451,0,0.88507],"933":[0,0.68611,0.15972,0,0.67083],"934":[0,0.68611,0,0,0.76666],"936":[0,0.68611,0.11653,0,0.71402],"937":[0,0.68611,0.04835,0,0.8789],"945":[0,0.44444,0,0,0.76064],"946":[0.19444,0.69444,0.03403,0,0.65972],"947":[0.19444,0.44444,0.06389,0,0.59003],"948":[0,0.69444,0.03819,0,0.52222],"949":[0,0.44444,0,0,0.52882],"950":[0.19444,0.69444,0.06215,0,0.50833],"951":[0.19444,0.44444,0.03704,0,0.6],"952":[0,0.69444,0.03194,0,0.5618],"953":[0,0.44444,0,0,0.41204],"954":[0,0.44444,0,0,0.66759],"955":[0,0.69444,0,0,0.67083],"956":[0.19444,0.44444,0,0,0.70787],"957":[0,0.44444,0.06898,0,0.57685],"958":[0.19444,0.69444,0.03021,0,0.50833],"959":[0,0.44444,0,0,0.58472],"960":[0,0.44444,0.03704,0,0.68241],"961":[0.19444,0.44444,0,0,0.6118],"962":[0.09722,0.44444,0.07917,0,0.42361],"963":[0,0.44444,0.03704,0,0.68588],"964":[0,0.44444,0.13472,0,0.52083],"965":[0,0.44444,0.03704,0,0.63055],"966":[0.19444,0.44444,0,0,0.74722],"967":[0.19444,0.44444,0,0,0.71805],"968":[0.19444,0.69444,0.03704,0,0.75833],"969":[0,0.44444,0.03704,0,0.71782],"977":[0,0.69444,0,0,0.69155],"981":[0.19444,0.69444,0,0,0.7125],"982":[0,0.44444,0.03194,0,0.975],"1009":[0.19444,0.44444,0,0,0.6118],"1013":[0,0.44444,0,0,0.48333],"57649":[0,0.44444,0,0,0.39352],"57911":[0.19444,0.44444,0,0,0.43889]},"Math-Italic":{"32":[0,0,0,0,0.25],"48":[0,0.43056,0,0,0.5],"49":[0,0.43056,0,0,0.5],"50":[0,0.43056,0,0,0.5],"51":[0.19444,0.43056,0,0,0.5],"52":[0.19444,0.43056,0,0,0.5],"53":[0.19444,0.43056,0,0,0.5],"54":[0,0.64444,0,0,0.5],"55":[0.19444,0.43056,0,0,0.5],"56":[0,0.64444,0,0,0.5],"57":[0.19444,0.43056,0,0,0.5],"65":[0,0.68333,0,0.13889,0.75],"66":[0,0.68333,0.05017,0.08334,0.75851],"67":[0,0.68333,0.07153,0.08334,0.71472],"68":[0,0.68333,0.02778,0.05556,0.82792],"69":[0,0.68333,0.05764,0.08334,0.7382],"70":[0,0.68333,0.13889,0.08334,0.64306],"71":[0,0.68333,0,0.08334,0.78625],"72":[0,0.68333,0.08125,0.05556,0.83125],"73":[0,0.68333,0.07847,0.11111,0.43958],"74":[0,0.68333,0.09618,0.16667,0.55451],"75":[0,0.68333,0.07153,0.05556,0.84931],"76":[0,0.68333,0,0.02778,0.68056],"77":[0,0.68333,0.10903,0.08334,0.97014],"78":[0,0.68333,0.10903,0.08334,0.80347],"79":[0,0.68333,0.02778,0.08334,0.76278],"80":[0,0.68333,0.13889,0.08334,0.64201],"81":[0.19444,0.68333,0,0.08334,0.79056],"82":[0,0.68333,0.00773,0.08334,0.75929],"83":[0,0.68333,0.05764,0.08334,0.6132],"84":[0,0.68333,0.13889,0.08334,0.58438],"85":[0,0.68333,0.10903,0.02778,0.68278],"86":[0,0.68333,0.22222,0,0.58333],"87":[0,0.68333,0.13889,0,0.94445],"88":[0,0.68333,0.07847,0.08334,0.82847],"89":[0,0.68333,0.22222,0,0.58056],"90":[0,0.68333,0.07153,0.08334,0.68264],"97":[0,0.43056,0,0,0.52859],"98":[0,0.69444,0,0,0.42917],"99":[0,0.43056,0,0.05556,0.43276],"100":[0,0.69444,0,0.16667,0.52049],"101":[0,0.43056,0,0.05556,0.46563],"102":[0.19444,0.69444,0.10764,0.16667,0.48959],"103":[0.19444,0.43056,0.03588,0.02778,0.47697],"104":[0,0.69444,0,0,0.57616],"105":[0,0.65952,0,0,0.34451],"106":[0.19444,0.65952,0.05724,0,0.41181],"107":[0,0.69444,0.03148,0,0.5206],"108":[0,0.69444,0.01968,0.08334,0.29838],"109":[0,0.43056,0,0,0.87801],"110":[0,0.43056,0,0,0.60023],"111":[0,0.43056,0,0.05556,0.48472],"112":[0.19444,0.43056,0,0.08334,0.50313],"113":[0.19444,0.43056,0.03588,0.08334,0.44641],"114":[0,0.43056,0.02778,0.05556,0.45116],"115":[0,0.43056,0,0.05556,0.46875],"116":[0,0.61508,0,0.08334,0.36111],"117":[0,0.43056,0,0.02778,0.57246],"118":[0,0.43056,0.03588,0.02778,0.48472],"119":[0,0.43056,0.02691,0.08334,0.71592],"120":[0,0.43056,0,0.02778,0.57153],"121":[0.19444,0.43056,0.03588,0.05556,0.49028],"122":[0,0.43056,0.04398,0.05556,0.46505],"160":[0,0,0,0,0.25],"915":[0,0.68333,0.13889,0.08334,0.61528],"916":[0,0.68333,0,0.16667,0.83334],"920":[0,0.68333,0.02778,0.08334,0.76278],"923":[0,0.68333,0,0.16667,0.69445],"926":[0,0.68333,0.07569,0.08334,0.74236],"928":[0,0.68333,0.08125,0.05556,0.83125],"931":[0,0.68333,0.05764,0.08334,0.77986],"933":[0,0.68333,0.13889,0.05556,0.58333],"934":[0,0.68333,0,0.08334,0.66667],"936":[0,0.68333,0.11,0.05556,0.61222],"937":[0,0.68333,0.05017,0.08334,0.7724],"945":[0,0.43056,0.0037,0.02778,0.6397],"946":[0.19444,0.69444,0.05278,0.08334,0.56563],"947":[0.19444,0.43056,0.05556,0,0.51773],"948":[0,0.69444,0.03785,0.05556,0.44444],"949":[0,0.43056,0,0.08334,0.46632],"950":[0.19444,0.69444,0.07378,0.08334,0.4375],"951":[0.19444,0.43056,0.03588,0.05556,0.49653],"952":[0,0.69444,0.02778,0.08334,0.46944],"953":[0,0.43056,0,0.05556,0.35394],"954":[0,0.43056,0,0,0.57616],"955":[0,0.69444,0,0,0.58334],"956":[0.19444,0.43056,0,0.02778,0.60255],"957":[0,0.43056,0.06366,0.02778,0.49398],"958":[0.19444,0.69444,0.04601,0.11111,0.4375],"959":[0,0.43056,0,0.05556,0.48472],"960":[0,0.43056,0.03588,0,0.57003],"961":[0.19444,0.43056,0,0.08334,0.51702],"962":[0.09722,0.43056,0.07986,0.08334,0.36285],"963":[0,0.43056,0.03588,0,0.57141],"964":[0,0.43056,0.1132,0.02778,0.43715],"965":[0,0.43056,0.03588,0.02778,0.54028],"966":[0.19444,0.43056,0,0.08334,0.65417],"967":[0.19444,0.43056,0,0.05556,0.62569],"968":[0.19444,0.69444,0.03588,0.11111,0.65139],"969":[0,0.43056,0.03588,0,0.62245],"977":[0,0.69444,0,0.08334,0.59144],"981":[0.19444,0.69444,0,0.08334,0.59583],"982":[0,0.43056,0.02778,0,0.82813],"1009":[0.19444,0.43056,0,0.08334,0.51702],"1013":[0,0.43056,0,0.05556,0.4059],"57649":[0,0.43056,0,0.02778,0.32246],"57911":[0.19444,0.43056,0,0.08334,0.38403]},"SansSerif-Bold":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.36667],"34":[0,0.69444,0,0,0.55834],"35":[0.19444,0.69444,0,0,0.91667],"36":[0.05556,0.75,0,0,0.55],"37":[0.05556,0.75,0,0,1.02912],"38":[0,0.69444,0,0,0.83056],"39":[0,0.69444,0,0,0.30556],"40":[0.25,0.75,0,0,0.42778],"41":[0.25,0.75,0,0,0.42778],"42":[0,0.75,0,0,0.55],"43":[0.11667,0.61667,0,0,0.85556],"44":[0.10556,0.13056,0,0,0.30556],"45":[0,0.45833,0,0,0.36667],"46":[0,0.13056,0,0,0.30556],"47":[0.25,0.75,0,0,0.55],"48":[0,0.69444,0,0,0.55],"49":[0,0.69444,0,0,0.55],"50":[0,0.69444,0,0,0.55],"51":[0,0.69444,0,0,0.55],"52":[0,0.69444,0,0,0.55],"53":[0,0.69444,0,0,0.55],"54":[0,0.69444,0,0,0.55],"55":[0,0.69444,0,0,0.55],"56":[0,0.69444,0,0,0.55],"57":[0,0.69444,0,0,0.55],"58":[0,0.45833,0,0,0.30556],"59":[0.10556,0.45833,0,0,0.30556],"61":[-0.09375,0.40625,0,0,0.85556],"63":[0,0.69444,0,0,0.51945],"64":[0,0.69444,0,0,0.73334],"65":[0,0.69444,0,0,0.73334],"66":[0,0.69444,0,0,0.73334],"67":[0,0.69444,0,0,0.70278],"68":[0,0.69444,0,0,0.79445],"69":[0,0.69444,0,0,0.64167],"70":[0,0.69444,0,0,0.61111],"71":[0,0.69444,0,0,0.73334],"72":[0,0.69444,0,0,0.79445],"73":[0,0.69444,0,0,0.33056],"74":[0,0.69444,0,0,0.51945],"75":[0,0.69444,0,0,0.76389],"76":[0,0.69444,0,0,0.58056],"77":[0,0.69444,0,0,0.97778],"78":[0,0.69444,0,0,0.79445],"79":[0,0.69444,0,0,0.79445],"80":[0,0.69444,0,0,0.70278],"81":[0.10556,0.69444,0,0,0.79445],"82":[0,0.69444,0,0,0.70278],"83":[0,0.69444,0,0,0.61111],"84":[0,0.69444,0,0,0.73334],"85":[0,0.69444,0,0,0.76389],"86":[0,0.69444,0.01528,0,0.73334],"87":[0,0.69444,0.01528,0,1.03889],"88":[0,0.69444,0,0,0.73334],"89":[0,0.69444,0.0275,0,0.73334],"90":[0,0.69444,0,0,0.67223],"91":[0.25,0.75,0,0,0.34306],"93":[0.25,0.75,0,0,0.34306],"94":[0,0.69444,0,0,0.55],"95":[0.35,0.10833,0.03056,0,0.55],"97":[0,0.45833,0,0,0.525],"98":[0,0.69444,0,0,0.56111],"99":[0,0.45833,0,0,0.48889],"100":[0,0.69444,0,0,0.56111],"101":[0,0.45833,0,0,0.51111],"102":[0,0.69444,0.07639,0,0.33611],"103":[0.19444,0.45833,0.01528,0,0.55],"104":[0,0.69444,0,0,0.56111],"105":[0,0.69444,0,0,0.25556],"106":[0.19444,0.69444,0,0,0.28611],"107":[0,0.69444,0,0,0.53056],"108":[0,0.69444,0,0,0.25556],"109":[0,0.45833,0,0,0.86667],"110":[0,0.45833,0,0,0.56111],"111":[0,0.45833,0,0,0.55],"112":[0.19444,0.45833,0,0,0.56111],"113":[0.19444,0.45833,0,0,0.56111],"114":[0,0.45833,0.01528,0,0.37222],"115":[0,0.45833,0,0,0.42167],"116":[0,0.58929,0,0,0.40417],"117":[0,0.45833,0,0,0.56111],"118":[0,0.45833,0.01528,0,0.5],"119":[0,0.45833,0.01528,0,0.74445],"120":[0,0.45833,0,0,0.5],"121":[0.19444,0.45833,0.01528,0,0.5],"122":[0,0.45833,0,0,0.47639],"126":[0.35,0.34444,0,0,0.55],"160":[0,0,0,0,0.25],"168":[0,0.69444,0,0,0.55],"176":[0,0.69444,0,0,0.73334],"180":[0,0.69444,0,0,0.55],"184":[0.17014,0,0,0,0.48889],"305":[0,0.45833,0,0,0.25556],"567":[0.19444,0.45833,0,0,0.28611],"710":[0,0.69444,0,0,0.55],"711":[0,0.63542,0,0,0.55],"713":[0,0.63778,0,0,0.55],"728":[0,0.69444,0,0,0.55],"729":[0,0.69444,0,0,0.30556],"730":[0,0.69444,0,0,0.73334],"732":[0,0.69444,0,0,0.55],"733":[0,0.69444,0,0,0.55],"915":[0,0.69444,0,0,0.58056],"916":[0,0.69444,0,0,0.91667],"920":[0,0.69444,0,0,0.85556],"923":[0,0.69444,0,0,0.67223],"926":[0,0.69444,0,0,0.73334],"928":[0,0.69444,0,0,0.79445],"931":[0,0.69444,0,0,0.79445],"933":[0,0.69444,0,0,0.85556],"934":[0,0.69444,0,0,0.79445],"936":[0,0.69444,0,0,0.85556],"937":[0,0.69444,0,0,0.79445],"8211":[0,0.45833,0.03056,0,0.55],"8212":[0,0.45833,0.03056,0,1.10001],"8216":[0,0.69444,0,0,0.30556],"8217":[0,0.69444,0,0,0.30556],"8220":[0,0.69444,0,0,0.55834],"8221":[0,0.69444,0,0,0.55834]},"SansSerif-Italic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.05733,0,0.31945],"34":[0,0.69444,0.00316,0,0.5],"35":[0.19444,0.69444,0.05087,0,0.83334],"36":[0.05556,0.75,0.11156,0,0.5],"37":[0.05556,0.75,0.03126,0,0.83334],"38":[0,0.69444,0.03058,0,0.75834],"39":[0,0.69444,0.07816,0,0.27778],"40":[0.25,0.75,0.13164,0,0.38889],"41":[0.25,0.75,0.02536,0,0.38889],"42":[0,0.75,0.11775,0,0.5],"43":[0.08333,0.58333,0.02536,0,0.77778],"44":[0.125,0.08333,0,0,0.27778],"45":[0,0.44444,0.01946,0,0.33333],"46":[0,0.08333,0,0,0.27778],"47":[0.25,0.75,0.13164,0,0.5],"48":[0,0.65556,0.11156,0,0.5],"49":[0,0.65556,0.11156,0,0.5],"50":[0,0.65556,0.11156,0,0.5],"51":[0,0.65556,0.11156,0,0.5],"52":[0,0.65556,0.11156,0,0.5],"53":[0,0.65556,0.11156,0,0.5],"54":[0,0.65556,0.11156,0,0.5],"55":[0,0.65556,0.11156,0,0.5],"56":[0,0.65556,0.11156,0,0.5],"57":[0,0.65556,0.11156,0,0.5],"58":[0,0.44444,0.02502,0,0.27778],"59":[0.125,0.44444,0.02502,0,0.27778],"61":[-0.13,0.37,0.05087,0,0.77778],"63":[0,0.69444,0.11809,0,0.47222],"64":[0,0.69444,0.07555,0,0.66667],"65":[0,0.69444,0,0,0.66667],"66":[0,0.69444,0.08293,0,0.66667],"67":[0,0.69444,0.11983,0,0.63889],"68":[0,0.69444,0.07555,0,0.72223],"69":[0,0.69444,0.11983,0,0.59722],"70":[0,0.69444,0.13372,0,0.56945],"71":[0,0.69444,0.11983,0,0.66667],"72":[0,0.69444,0.08094,0,0.70834],"73":[0,0.69444,0.13372,0,0.27778],"74":[0,0.69444,0.08094,0,0.47222],"75":[0,0.69444,0.11983,0,0.69445],"76":[0,0.69444,0,0,0.54167],"77":[0,0.69444,0.08094,0,0.875],"78":[0,0.69444,0.08094,0,0.70834],"79":[0,0.69444,0.07555,0,0.73611],"80":[0,0.69444,0.08293,0,0.63889],"81":[0.125,0.69444,0.07555,0,0.73611],"82":[0,0.69444,0.08293,0,0.64584],"83":[0,0.69444,0.09205,0,0.55556],"84":[0,0.69444,0.13372,0,0.68056],"85":[0,0.69444,0.08094,0,0.6875],"86":[0,0.69444,0.1615,0,0.66667],"87":[0,0.69444,0.1615,0,0.94445],"88":[0,0.69444,0.13372,0,0.66667],"89":[0,0.69444,0.17261,0,0.66667],"90":[0,0.69444,0.11983,0,0.61111],"91":[0.25,0.75,0.15942,0,0.28889],"93":[0.25,0.75,0.08719,0,0.28889],"94":[0,0.69444,0.0799,0,0.5],"95":[0.35,0.09444,0.08616,0,0.5],"97":[0,0.44444,0.00981,0,0.48056],"98":[0,0.69444,0.03057,0,0.51667],"99":[0,0.44444,0.08336,0,0.44445],"100":[0,0.69444,0.09483,0,0.51667],"101":[0,0.44444,0.06778,0,0.44445],"102":[0,0.69444,0.21705,0,0.30556],"103":[0.19444,0.44444,0.10836,0,0.5],"104":[0,0.69444,0.01778,0,0.51667],"105":[0,0.67937,0.09718,0,0.23889],"106":[0.19444,0.67937,0.09162,0,0.26667],"107":[0,0.69444,0.08336,0,0.48889],"108":[0,0.69444,0.09483,0,0.23889],"109":[0,0.44444,0.01778,0,0.79445],"110":[0,0.44444,0.01778,0,0.51667],"111":[0,0.44444,0.06613,0,0.5],"112":[0.19444,0.44444,0.0389,0,0.51667],"113":[0.19444,0.44444,0.04169,0,0.51667],"114":[0,0.44444,0.10836,0,0.34167],"115":[0,0.44444,0.0778,0,0.38333],"116":[0,0.57143,0.07225,0,0.36111],"117":[0,0.44444,0.04169,0,0.51667],"118":[0,0.44444,0.10836,0,0.46111],"119":[0,0.44444,0.10836,0,0.68334],"120":[0,0.44444,0.09169,0,0.46111],"121":[0.19444,0.44444,0.10836,0,0.46111],"122":[0,0.44444,0.08752,0,0.43472],"126":[0.35,0.32659,0.08826,0,0.5],"160":[0,0,0,0,0.25],"168":[0,0.67937,0.06385,0,0.5],"176":[0,0.69444,0,0,0.73752],"184":[0.17014,0,0,0,0.44445],"305":[0,0.44444,0.04169,0,0.23889],"567":[0.19444,0.44444,0.04169,0,0.26667],"710":[0,0.69444,0.0799,0,0.5],"711":[0,0.63194,0.08432,0,0.5],"713":[0,0.60889,0.08776,0,0.5],"714":[0,0.69444,0.09205,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0.09483,0,0.5],"729":[0,0.67937,0.07774,0,0.27778],"730":[0,0.69444,0,0,0.73752],"732":[0,0.67659,0.08826,0,0.5],"733":[0,0.69444,0.09205,0,0.5],"915":[0,0.69444,0.13372,0,0.54167],"916":[0,0.69444,0,0,0.83334],"920":[0,0.69444,0.07555,0,0.77778],"923":[0,0.69444,0,0,0.61111],"926":[0,0.69444,0.12816,0,0.66667],"928":[0,0.69444,0.08094,0,0.70834],"931":[0,0.69444,0.11983,0,0.72222],"933":[0,0.69444,0.09031,0,0.77778],"934":[0,0.69444,0.04603,0,0.72222],"936":[0,0.69444,0.09031,0,0.77778],"937":[0,0.69444,0.08293,0,0.72222],"8211":[0,0.44444,0.08616,0,0.5],"8212":[0,0.44444,0.08616,0,1],"8216":[0,0.69444,0.07816,0,0.27778],"8217":[0,0.69444,0.07816,0,0.27778],"8220":[0,0.69444,0.14205,0,0.5],"8221":[0,0.69444,0.00316,0,0.5]},"SansSerif-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.31945],"34":[0,0.69444,0,0,0.5],"35":[0.19444,0.69444,0,0,0.83334],"36":[0.05556,0.75,0,0,0.5],"37":[0.05556,0.75,0,0,0.83334],"38":[0,0.69444,0,0,0.75834],"39":[0,0.69444,0,0,0.27778],"40":[0.25,0.75,0,0,0.38889],"41":[0.25,0.75,0,0,0.38889],"42":[0,0.75,0,0,0.5],"43":[0.08333,0.58333,0,0,0.77778],"44":[0.125,0.08333,0,0,0.27778],"45":[0,0.44444,0,0,0.33333],"46":[0,0.08333,0,0,0.27778],"47":[0.25,0.75,0,0,0.5],"48":[0,0.65556,0,0,0.5],"49":[0,0.65556,0,0,0.5],"50":[0,0.65556,0,0,0.5],"51":[0,0.65556,0,0,0.5],"52":[0,0.65556,0,0,0.5],"53":[0,0.65556,0,0,0.5],"54":[0,0.65556,0,0,0.5],"55":[0,0.65556,0,0,0.5],"56":[0,0.65556,0,0,0.5],"57":[0,0.65556,0,0,0.5],"58":[0,0.44444,0,0,0.27778],"59":[0.125,0.44444,0,0,0.27778],"61":[-0.13,0.37,0,0,0.77778],"63":[0,0.69444,0,0,0.47222],"64":[0,0.69444,0,0,0.66667],"65":[0,0.69444,0,0,0.66667],"66":[0,0.69444,0,0,0.66667],"67":[0,0.69444,0,0,0.63889],"68":[0,0.69444,0,0,0.72223],"69":[0,0.69444,0,0,0.59722],"70":[0,0.69444,0,0,0.56945],"71":[0,0.69444,0,0,0.66667],"72":[0,0.69444,0,0,0.70834],"73":[0,0.69444,0,0,0.27778],"74":[0,0.69444,0,0,0.47222],"75":[0,0.69444,0,0,0.69445],"76":[0,0.69444,0,0,0.54167],"77":[0,0.69444,0,0,0.875],"78":[0,0.69444,0,0,0.70834],"79":[0,0.69444,0,0,0.73611],"80":[0,0.69444,0,0,0.63889],"81":[0.125,0.69444,0,0,0.73611],"82":[0,0.69444,0,0,0.64584],"83":[0,0.69444,0,0,0.55556],"84":[0,0.69444,0,0,0.68056],"85":[0,0.69444,0,0,0.6875],"86":[0,0.69444,0.01389,0,0.66667],"87":[0,0.69444,0.01389,0,0.94445],"88":[0,0.69444,0,0,0.66667],"89":[0,0.69444,0.025,0,0.66667],"90":[0,0.69444,0,0,0.61111],"91":[0.25,0.75,0,0,0.28889],"93":[0.25,0.75,0,0,0.28889],"94":[0,0.69444,0,0,0.5],"95":[0.35,0.09444,0.02778,0,0.5],"97":[0,0.44444,0,0,0.48056],"98":[0,0.69444,0,0,0.51667],"99":[0,0.44444,0,0,0.44445],"100":[0,0.69444,0,0,0.51667],"101":[0,0.44444,0,0,0.44445],"102":[0,0.69444,0.06944,0,0.30556],"103":[0.19444,0.44444,0.01389,0,0.5],"104":[0,0.69444,0,0,0.51667],"105":[0,0.67937,0,0,0.23889],"106":[0.19444,0.67937,0,0,0.26667],"107":[0,0.69444,0,0,0.48889],"108":[0,0.69444,0,0,0.23889],"109":[0,0.44444,0,0,0.79445],"110":[0,0.44444,0,0,0.51667],"111":[0,0.44444,0,0,0.5],"112":[0.19444,0.44444,0,0,0.51667],"113":[0.19444,0.44444,0,0,0.51667],"114":[0,0.44444,0.01389,0,0.34167],"115":[0,0.44444,0,0,0.38333],"116":[0,0.57143,0,0,0.36111],"117":[0,0.44444,0,0,0.51667],"118":[0,0.44444,0.01389,0,0.46111],"119":[0,0.44444,0.01389,0,0.68334],"120":[0,0.44444,0,0,0.46111],"121":[0.19444,0.44444,0.01389,0,0.46111],"122":[0,0.44444,0,0,0.43472],"126":[0.35,0.32659,0,0,0.5],"160":[0,0,0,0,0.25],"168":[0,0.67937,0,0,0.5],"176":[0,0.69444,0,0,0.66667],"184":[0.17014,0,0,0,0.44445],"305":[0,0.44444,0,0,0.23889],"567":[0.19444,0.44444,0,0,0.26667],"710":[0,0.69444,0,0,0.5],"711":[0,0.63194,0,0,0.5],"713":[0,0.60889,0,0,0.5],"714":[0,0.69444,0,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0,0,0.5],"729":[0,0.67937,0,0,0.27778],"730":[0,0.69444,0,0,0.66667],"732":[0,0.67659,0,0,0.5],"733":[0,0.69444,0,0,0.5],"915":[0,0.69444,0,0,0.54167],"916":[0,0.69444,0,0,0.83334],"920":[0,0.69444,0,0,0.77778],"923":[0,0.69444,0,0,0.61111],"926":[0,0.69444,0,0,0.66667],"928":[0,0.69444,0,0,0.70834],"931":[0,0.69444,0,0,0.72222],"933":[0,0.69444,0,0,0.77778],"934":[0,0.69444,0,0,0.72222],"936":[0,0.69444,0,0,0.77778],"937":[0,0.69444,0,0,0.72222],"8211":[0,0.44444,0.02778,0,0.5],"8212":[0,0.44444,0.02778,0,1],"8216":[0,0.69444,0,0,0.27778],"8217":[0,0.69444,0,0,0.27778],"8220":[0,0.69444,0,0,0.5],"8221":[0,0.69444,0,0,0.5]},"Script-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.7,0.22925,0,0.80253],"66":[0,0.7,0.04087,0,0.90757],"67":[0,0.7,0.1689,0,0.66619],"68":[0,0.7,0.09371,0,0.77443],"69":[0,0.7,0.18583,0,0.56162],"70":[0,0.7,0.13634,0,0.89544],"71":[0,0.7,0.17322,0,0.60961],"72":[0,0.7,0.29694,0,0.96919],"73":[0,0.7,0.19189,0,0.80907],"74":[0.27778,0.7,0.19189,0,1.05159],"75":[0,0.7,0.31259,0,0.91364],"76":[0,0.7,0.19189,0,0.87373],"77":[0,0.7,0.15981,0,1.08031],"78":[0,0.7,0.3525,0,0.9015],"79":[0,0.7,0.08078,0,0.73787],"80":[0,0.7,0.08078,0,1.01262],"81":[0,0.7,0.03305,0,0.88282],"82":[0,0.7,0.06259,0,0.85],"83":[0,0.7,0.19189,0,0.86767],"84":[0,0.7,0.29087,0,0.74697],"85":[0,0.7,0.25815,0,0.79996],"86":[0,0.7,0.27523,0,0.62204],"87":[0,0.7,0.27523,0,0.80532],"88":[0,0.7,0.26006,0,0.94445],"89":[0,0.7,0.2939,0,0.70961],"90":[0,0.7,0.24037,0,0.8212],"160":[0,0,0,0,0.25]},"Size1-Regular":{"32":[0,0,0,0,0.25],"40":[0.35001,0.85,0,0,0.45834],"41":[0.35001,0.85,0,0,0.45834],"47":[0.35001,0.85,0,0,0.57778],"91":[0.35001,0.85,0,0,0.41667],"92":[0.35001,0.85,0,0,0.57778],"93":[0.35001,0.85,0,0,0.41667],"123":[0.35001,0.85,0,0,0.58334],"125":[0.35001,0.85,0,0,0.58334],"160":[0,0,0,0,0.25],"710":[0,0.72222,0,0,0.55556],"732":[0,0.72222,0,0,0.55556],"770":[0,0.72222,0,0,0.55556],"771":[0,0.72222,0,0,0.55556],"8214":[-0.00099,0.601,0,0,0.77778],"8593":[0.00001,0.6,0,0,0.66667],"8595":[0.00001,0.6,0,0,0.66667],"8657":[0.00001,0.6,0,0,0.77778],"8659":[0.00001,0.6,0,0,0.77778],"8719":[0.25001,0.75,0,0,0.94445],"8720":[0.25001,0.75,0,0,0.94445],"8721":[0.25001,0.75,0,0,1.05556],"8730":[0.35001,0.85,0,0,1],"8739":[-0.00599,0.606,0,0,0.33333],"8741":[-0.00599,0.606,0,0,0.55556],"8747":[0.30612,0.805,0.19445,0,0.47222],"8748":[0.306,0.805,0.19445,0,0.47222],"8749":[0.306,0.805,0.19445,0,0.47222],"8750":[0.30612,0.805,0.19445,0,0.47222],"8896":[0.25001,0.75,0,0,0.83334],"8897":[0.25001,0.75,0,0,0.83334],"8898":[0.25001,0.75,0,0,0.83334],"8899":[0.25001,0.75,0,0,0.83334],"8968":[0.35001,0.85,0,0,0.47222],"8969":[0.35001,0.85,0,0,0.47222],"8970":[0.35001,0.85,0,0,0.47222],"8971":[0.35001,0.85,0,0,0.47222],"9168":[-0.00099,0.601,0,0,0.66667],"10216":[0.35001,0.85,0,0,0.47222],"10217":[0.35001,0.85,0,0,0.47222],"10752":[0.25001,0.75,0,0,1.11111],"10753":[0.25001,0.75,0,0,1.11111],"10754":[0.25001,0.75,0,0,1.11111],"10756":[0.25001,0.75,0,0,0.83334],"10758":[0.25001,0.75,0,0,0.83334]},"Size2-Regular":{"32":[0,0,0,0,0.25],"40":[0.65002,1.15,0,0,0.59722],"41":[0.65002,1.15,0,0,0.59722],"47":[0.65002,1.15,0,0,0.81111],"91":[0.65002,1.15,0,0,0.47222],"92":[0.65002,1.15,0,0,0.81111],"93":[0.65002,1.15,0,0,0.47222],"123":[0.65002,1.15,0,0,0.66667],"125":[0.65002,1.15,0,0,0.66667],"160":[0,0,0,0,0.25],"710":[0,0.75,0,0,1],"732":[0,0.75,0,0,1],"770":[0,0.75,0,0,1],"771":[0,0.75,0,0,1],"8719":[0.55001,1.05,0,0,1.27778],"8720":[0.55001,1.05,0,0,1.27778],"8721":[0.55001,1.05,0,0,1.44445],"8730":[0.65002,1.15,0,0,1],"8747":[0.86225,1.36,0.44445,0,0.55556],"8748":[0.862,1.36,0.44445,0,0.55556],"8749":[0.862,1.36,0.44445,0,0.55556],"8750":[0.86225,1.36,0.44445,0,0.55556],"8896":[0.55001,1.05,0,0,1.11111],"8897":[0.55001,1.05,0,0,1.11111],"8898":[0.55001,1.05,0,0,1.11111],"8899":[0.55001,1.05,0,0,1.11111],"8968":[0.65002,1.15,0,0,0.52778],"8969":[0.65002,1.15,0,0,0.52778],"8970":[0.65002,1.15,0,0,0.52778],"8971":[0.65002,1.15,0,0,0.52778],"10216":[0.65002,1.15,0,0,0.61111],"10217":[0.65002,1.15,0,0,0.61111],"10752":[0.55001,1.05,0,0,1.51112],"10753":[0.55001,1.05,0,0,1.51112],"10754":[0.55001,1.05,0,0,1.51112],"10756":[0.55001,1.05,0,0,1.11111],"10758":[0.55001,1.05,0,0,1.11111]},"Size3-Regular":{"32":[0,0,0,0,0.25],"40":[0.95003,1.45,0,0,0.73611],"41":[0.95003,1.45,0,0,0.73611],"47":[0.95003,1.45,0,0,1.04445],"91":[0.95003,1.45,0,0,0.52778],"92":[0.95003,1.45,0,0,1.04445],"93":[0.95003,1.45,0,0,0.52778],"123":[0.95003,1.45,0,0,0.75],"125":[0.95003,1.45,0,0,0.75],"160":[0,0,0,0,0.25],"710":[0,0.75,0,0,1.44445],"732":[0,0.75,0,0,1.44445],"770":[0,0.75,0,0,1.44445],"771":[0,0.75,0,0,1.44445],"8730":[0.95003,1.45,0,0,1],"8968":[0.95003,1.45,0,0,0.58334],"8969":[0.95003,1.45,0,0,0.58334],"8970":[0.95003,1.45,0,0,0.58334],"8971":[0.95003,1.45,0,0,0.58334],"10216":[0.95003,1.45,0,0,0.75],"10217":[0.95003,1.45,0,0,0.75]},"Size4-Regular":{"32":[0,0,0,0,0.25],"40":[1.25003,1.75,0,0,0.79167],"41":[1.25003,1.75,0,0,0.79167],"47":[1.25003,1.75,0,0,1.27778],"91":[1.25003,1.75,0,0,0.58334],"92":[1.25003,1.75,0,0,1.27778],"93":[1.25003,1.75,0,0,0.58334],"123":[1.25003,1.75,0,0,0.80556],"125":[1.25003,1.75,0,0,0.80556],"160":[0,0,0,0,0.25],"710":[0,0.825,0,0,1.8889],"732":[0,0.825,0,0,1.8889],"770":[0,0.825,0,0,1.8889],"771":[0,0.825,0,0,1.8889],"8730":[1.25003,1.75,0,0,1],"8968":[1.25003,1.75,0,0,0.63889],"8969":[1.25003,1.75,0,0,0.63889],"8970":[1.25003,1.75,0,0,0.63889],"8971":[1.25003,1.75,0,0,0.63889],"9115":[0.64502,1.155,0,0,0.875],"9116":[0.00001,0.6,0,0,0.875],"9117":[0.64502,1.155,0,0,0.875],"9118":[0.64502,1.155,0,0,0.875],"9119":[0.00001,0.6,0,0,0.875],"9120":[0.64502,1.155,0,0,0.875],"9121":[0.64502,1.155,0,0,0.66667],"9122":[-0.00099,0.601,0,0,0.66667],"9123":[0.64502,1.155,0,0,0.66667],"9124":[0.64502,1.155,0,0,0.66667],"9125":[-0.00099,0.601,0,0,0.66667],"9126":[0.64502,1.155,0,0,0.66667],"9127":[0.00001,0.9,0,0,0.88889],"9128":[0.65002,1.15,0,0,0.88889],"9129":[0.90001,0,0,0,0.88889],"9130":[0,0.3,0,0,0.88889],"9131":[0.00001,0.9,0,0,0.88889],"9132":[0.65002,1.15,0,0,0.88889],"9133":[0.90001,0,0,0,0.88889],"9143":[0.88502,0.915,0,0,1.05556],"10216":[1.25003,1.75,0,0,0.80556],"10217":[1.25003,1.75,0,0,0.80556],"57344":[-0.00499,0.605,0,0,1.05556],"57345":[-0.00499,0.605,0,0,1.05556],"57680":[0,0.12,0,0,0.45],"57681":[0,0.12,0,0,0.45],"57682":[0,0.12,0,0,0.45],"57683":[0,0.12,0,0,0.45]},"Typewriter-Regular":{"32":[0,0,0,0,0.525],"33":[0,0.61111,0,0,0.525],"34":[0,0.61111,0,0,0.525],"35":[0,0.61111,0,0,0.525],"36":[0.08333,0.69444,0,0,0.525],"37":[0.08333,0.69444,0,0,0.525],"38":[0,0.61111,0,0,0.525],"39":[0,0.61111,0,0,0.525],"40":[0.08333,0.69444,0,0,0.525],"41":[0.08333,0.69444,0,0,0.525],"42":[0,0.52083,0,0,0.525],"43":[-0.08056,0.53055,0,0,0.525],"44":[0.13889,0.125,0,0,0.525],"45":[-0.08056,0.53055,0,0,0.525],"46":[0,0.125,0,0,0.525],"47":[0.08333,0.69444,0,0,0.525],"48":[0,0.61111,0,0,0.525],"49":[0,0.61111,0,0,0.525],"50":[0,0.61111,0,0,0.525],"51":[0,0.61111,0,0,0.525],"52":[0,0.61111,0,0,0.525],"53":[0,0.61111,0,0,0.525],"54":[0,0.61111,0,0,0.525],"55":[0,0.61111,0,0,0.525],"56":[0,0.61111,0,0,0.525],"57":[0,0.61111,0,0,0.525],"58":[0,0.43056,0,0,0.525],"59":[0.13889,0.43056,0,0,0.525],"60":[-0.05556,0.55556,0,0,0.525],"61":[-0.19549,0.41562,0,0,0.525],"62":[-0.05556,0.55556,0,0,0.525],"63":[0,0.61111,0,0,0.525],"64":[0,0.61111,0,0,0.525],"65":[0,0.61111,0,0,0.525],"66":[0,0.61111,0,0,0.525],"67":[0,0.61111,0,0,0.525],"68":[0,0.61111,0,0,0.525],"69":[0,0.61111,0,0,0.525],"70":[0,0.61111,0,0,0.525],"71":[0,0.61111,0,0,0.525],"72":[0,0.61111,0,0,0.525],"73":[0,0.61111,0,0,0.525],"74":[0,0.61111,0,0,0.525],"75":[0,0.61111,0,0,0.525],"76":[0,0.61111,0,0,0.525],"77":[0,0.61111,0,0,0.525],"78":[0,0.61111,0,0,0.525],"79":[0,0.61111,0,0,0.525],"80":[0,0.61111,0,0,0.525],"81":[0.13889,0.61111,0,0,0.525],"82":[0,0.61111,0,0,0.525],"83":[0,0.61111,0,0,0.525],"84":[0,0.61111,0,0,0.525],"85":[0,0.61111,0,0,0.525],"86":[0,0.61111,0,0,0.525],"87":[0,0.61111,0,0,0.525],"88":[0,0.61111,0,0,0.525],"89":[0,0.61111,0,0,0.525],"90":[0,0.61111,0,0,0.525],"91":[0.08333,0.69444,0,0,0.525],"92":[0.08333,0.69444,0,0,0.525],"93":[0.08333,0.69444,0,0,0.525],"94":[0,0.61111,0,0,0.525],"95":[0.09514,0,0,0,0.525],"96":[0,0.61111,0,0,0.525],"97":[0,0.43056,0,0,0.525],"98":[0,0.61111,0,0,0.525],"99":[0,0.43056,0,0,0.525],"100":[0,0.61111,0,0,0.525],"101":[0,0.43056,0,0,0.525],"102":[0,0.61111,0,0,0.525],"103":[0.22222,0.43056,0,0,0.525],"104":[0,0.61111,0,0,0.525],"105":[0,0.61111,0,0,0.525],"106":[0.22222,0.61111,0,0,0.525],"107":[0,0.61111,0,0,0.525],"108":[0,0.61111,0,0,0.525],"109":[0,0.43056,0,0,0.525],"110":[0,0.43056,0,0,0.525],"111":[0,0.43056,0,0,0.525],"112":[0.22222,0.43056,0,0,0.525],"113":[0.22222,0.43056,0,0,0.525],"114":[0,0.43056,0,0,0.525],"115":[0,0.43056,0,0,0.525],"116":[0,0.55358,0,0,0.525],"117":[0,0.43056,0,0,0.525],"118":[0,0.43056,0,0,0.525],"119":[0,0.43056,0,0,0.525],"120":[0,0.43056,0,0,0.525],"121":[0.22222,0.43056,0,0,0.525],"122":[0,0.43056,0,0,0.525],"123":[0.08333,0.69444,0,0,0.525],"124":[0.08333,0.69444,0,0,0.525],"125":[0.08333,0.69444,0,0,0.525],"126":[0,0.61111,0,0,0.525],"127":[0,0.61111,0,0,0.525],"160":[0,0,0,0,0.525],"176":[0,0.61111,0,0,0.525],"184":[0.19445,0,0,0,0.525],"305":[0,0.43056,0,0,0.525],"567":[0.22222,0.43056,0,0,0.525],"711":[0,0.56597,0,0,0.525],"713":[0,0.56555,0,0,0.525],"714":[0,0.61111,0,0,0.525],"715":[0,0.61111,0,0,0.525],"728":[0,0.61111,0,0,0.525],"730":[0,0.61111,0,0,0.525],"770":[0,0.61111,0,0,0.525],"771":[0,0.61111,0,0,0.525],"776":[0,0.61111,0,0,0.525],"915":[0,0.61111,0,0,0.525],"916":[0,0.61111,0,0,0.525],"920":[0,0.61111,0,0,0.525],"923":[0,0.61111,0,0,0.525],"926":[0,0.61111,0,0,0.525],"928":[0,0.61111,0,0,0.525],"931":[0,0.61111,0,0,0.525],"933":[0,0.61111,0,0,0.525],"934":[0,0.61111,0,0,0.525],"936":[0,0.61111,0,0,0.525],"937":[0,0.61111,0,0,0.525],"8216":[0,0.61111,0,0,0.525],"8217":[0,0.61111,0,0,0.525],"8242":[0,0.61111,0,0,0.525],"9251":[0.11111,0.21944,0,0,0.525]}},$11={slant:[0.25,0.25,0.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[0.431,0.431,0.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[0.677,0.732,0.925],num2:[0.394,0.384,0.387],num3:[0.444,0.471,0.504],denom1:[0.686,0.752,1.025],denom2:[0.345,0.344,0.532],sup1:[0.413,0.503,0.504],sup2:[0.363,0.431,0.404],sup3:[0.289,0.286,0.294],sub1:[0.15,0.143,0.2],sub2:[0.247,0.286,0.4],supDrop:[0.386,0.353,0.494],subDrop:[0.05,0.071,0.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[0.25,0.25,0.25],defaultRuleThickness:[0.04,0.049,0.049],bigOpSpacing1:[0.111,0.111,0.111],bigOpSpacing2:[0.166,0.166,0.166],bigOpSpacing3:[0.2,0.2,0.2],bigOpSpacing4:[0.6,0.611,0.611],bigOpSpacing5:[0.1,0.143,0.143],sqrtRuleThickness:[0.04,0.04,0.04],ptPerEm:[10,10,10],doubleRuleSep:[0.2,0.2,0.2],arrayRuleWidth:[0.04,0.04,0.04],fboxsep:[0.3,0.3,0.3],fboxrule:[0.04,0.04,0.04]},qj0={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};D(hj0,"setFontMetrics");D(p11,"getCharacterMetrics");nR1={};D(gj0,"getGlobalMetrics");RN8=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],zj0=[0.5,0.6,0.7,0.8,0.9,1,1.2,1.44,1.728,2.074,2.488],Uj0=D(function(Q,Z){return Z.size<2?Q:RN8[Q-1][Z.size-1]},"sizeAtStyle"),mj0=class J{static{D(this,"Options")}constructor(Q){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=Q.style,this.color=Q.color,this.size=Q.size||J.BASESIZE,this.textSize=Q.textSize||this.size,this.phantom=!!Q.phantom,this.font=Q.font||"",this.fontFamily=Q.fontFamily||"",this.fontWeight=Q.fontWeight||"",this.fontShape=Q.fontShape||"",this.sizeMultiplier=zj0[this.size-1],this.maxSize=Q.maxSize,this.minRuleThickness=Q.minRuleThickness,this._fontMetrics=void 0}extend(Q){var Z={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var X in Q)if(Q.hasOwnProperty(X))Z[X]=Q[X];return new J(Z)}havingStyle(Q){if(this.style===Q)return this;else return this.extend({style:Q,size:Uj0(this.textSize,Q)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(Q){if(this.size===Q&&this.textSize===Q)return this;else return this.extend({style:this.style.text(),size:Q,textSize:Q,sizeMultiplier:zj0[Q-1]})}havingBaseStyle(Q){Q=Q||this.style.text();var Z=Uj0(J.BASESIZE,Q);if(this.size===Z&&this.textSize===J.BASESIZE&&this.style===Q)return this;else return this.extend({style:Q,size:Z})}havingBaseSizing(){var Q;switch(this.style.id){case 4:case 5:Q=3;break;case 6:case 7:Q=1;break;default:Q=6}return this.extend({style:this.style.text(),size:Q})}withColor(Q){return this.extend({color:Q})}withPhantom(){return this.extend({phantom:!0})}withFont(Q){return this.extend({font:Q})}withTextFontFamily(Q){return this.extend({fontFamily:Q,font:""})}withTextFontWeight(Q){return this.extend({fontWeight:Q,font:""})}withTextFontShape(Q){return this.extend({fontShape:Q,font:""})}sizingClasses(Q){if(Q.size!==this.size)return["sizing","reset-size"+Q.size,"size"+this.size];else return[]}baseSizingClasses(){if(this.size!==J.BASESIZE)return["sizing","reset-size"+this.size,"size"+J.BASESIZE];else return[]}fontMetrics(){if(!this._fontMetrics)this._fontMetrics=gj0(this.size);return this._fontMetrics}getColor(){if(this.phantom)return"transparent";else return this.color}};mj0.BASESIZE=6;GO1={pt:1,mm:2.8452755905511813,cm:28.45275590551181,in:72.27,bp:1.00375,pc:12,dd:1.070008643042351,cc:12.84010371650821,nd:1.0669781931464175,nc:12.80373831775701,sp:0.0000152587890625,px:1.00375},ON8={ex:!0,em:!0,mu:!0},uj0=D(function(Q){if(typeof Q!=="string")Q=Q.unit;return Q in GO1||Q in ON8||Q==="ex"},"validUnit"),h4=D(function(Q,Z){var X;if(Q.unit in GO1)X=GO1[Q.unit]/Z.fontMetrics().ptPerEm/Z.sizeMultiplier;else if(Q.unit==="mu")X=Z.fontMetrics().cssEmPerMu;else{var Y;if(Z.style.isTight())Y=Z.havingStyle(Z.style.text());else Y=Z;if(Q.unit==="ex")X=Y.fontMetrics().xHeight;else if(Q.unit==="em")X=Y.fontMetrics().quad;else throw new r0("Invalid unit: '"+Q.unit+"'");if(Y!==Z)X*=Y.sizeMultiplier/Z.sizeMultiplier}return Math.min(Q.number*X,Z.maxSize)},"calculateSize"),J6=D(function(Q){return+Q.toFixed(4)+"em"},"makeEm"),$M=D(function(Q){return Q.filter((Z)=>Z).join(" ")},"createClass"),pj0=D(function(Q,Z,X){if(this.classes=Q||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=X||{},Z){if(Z.style.isTight())this.classes.push("mtight");var Y=Z.getColor();if(Y)this.style.color=Y}},"initNode"),dj0=D(function(Q){var Z=document.createElement(Q);Z.className=$M(this.classes);for(var X in this.style)if(this.style.hasOwnProperty(X))Z.style[X]=this.style[X];for(var Y in this.attributes)if(this.attributes.hasOwnProperty(Y))Z.setAttribute(Y,this.attributes[Y]);for(var K=0;K<this.children.length;K++)Z.appendChild(this.children[K].toNode());return Z},"toNode"),cj0=D(function(Q){var Z="<"+Q;if(this.classes.length)Z+=' class="'+K8.escape($M(this.classes))+'"';var X="";for(var Y in this.style)if(this.style.hasOwnProperty(Y))X+=K8.hyphenate(Y)+":"+this.style[Y]+";";if(X)Z+=' style="'+K8.escape(X)+'"';for(var K in this.attributes)if(this.attributes.hasOwnProperty(K))Z+=" "+K+'="'+K8.escape(this.attributes[K])+'"';Z+=">";for(var G=0;G<this.children.length;G++)Z+=this.children[G].toMarkup();return Z+="</"+Q+">",Z},"toMarkup"),Hf=class{static{D(this,"Span")}constructor(J,Q,Z,X){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,pj0.call(this,J,Z,X),this.children=Q||[]}setAttribute(J,Q){this.attributes[J]=Q}hasClass(J){return K8.contains(this.classes,J)}toNode(){return dj0.call(this,"span")}toMarkup(){return cj0.call(this,"span")}},wO1=class{static{D(this,"Anchor")}constructor(J,Q,Z,X){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,pj0.call(this,Q,X),this.children=Z||[],this.setAttribute("href",J)}setAttribute(J,Q){this.attributes[J]=Q}hasClass(J){return K8.contains(this.classes,J)}toNode(){return dj0.call(this,"a")}toMarkup(){return cj0.call(this,"a")}},jN8=class{static{D(this,"Img")}constructor(J,Q,Z){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=Q,this.src=J,this.classes=["mord"],this.style=Z}hasClass(J){return K8.contains(this.classes,J)}toNode(){var J=document.createElement("img");J.src=this.src,J.alt=this.alt,J.className="mord";for(var Q in this.style)if(this.style.hasOwnProperty(Q))J.style[Q]=this.style[Q];return J}toMarkup(){var J='<img src="'+K8.escape(this.src)+'"'+(' alt="'+K8.escape(this.alt)+'"'),Q="";for(var Z in this.style)if(this.style.hasOwnProperty(Z))Q+=K8.hyphenate(Z)+":"+this.style[Z]+";";if(Q)J+=' style="'+K8.escape(Q)+'"';return J+="'/>",J}},$N8={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"},KK=class{static{D(this,"SymbolNode")}constructor(J,Q,Z,X,Y,K,G,q){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=J,this.height=Q||0,this.depth=Z||0,this.italic=X||0,this.skew=Y||0,this.width=K||0,this.classes=G||[],this.style=q||{},this.maxFontSize=0;var z=fj0(this.text.charCodeAt(0));if(z)this.classes.push(z+"_fallback");if(/[îïíì]/.test(this.text))this.text=$N8[this.text]}hasClass(J){return K8.contains(this.classes,J)}toNode(){var J=document.createTextNode(this.text),Q=null;if(this.italic>0)Q=document.createElement("span"),Q.style.marginRight=J6(this.italic);if(this.classes.length>0)Q=Q||document.createElement("span"),Q.className=$M(this.classes);for(var Z in this.style)if(this.style.hasOwnProperty(Z))Q=Q||document.createElement("span"),Q.style[Z]=this.style[Z];if(Q)return Q.appendChild(J),Q;else return J}toMarkup(){var J=!1,Q="<span";if(this.classes.length)J=!0,Q+=' class="',Q+=K8.escape($M(this.classes)),Q+='"';var Z="";if(this.italic>0)Z+="margin-right:"+this.italic+"em;";for(var X in this.style)if(this.style.hasOwnProperty(X))Z+=K8.hyphenate(X)+":"+this.style[X]+";";if(Z)J=!0,Q+=' style="'+K8.escape(Z)+'"';var Y=K8.escape(this.text);if(J)return Q+=">",Q+=Y,Q+="</span>",Q;else return Y}},lF=class{static{D(this,"SvgNode")}constructor(J,Q){this.children=void 0,this.attributes=void 0,this.children=J||[],this.attributes=Q||{}}toNode(){var J="http://www.w3.org/2000/svg",Q=document.createElementNS(J,"svg");for(var Z in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Z))Q.setAttribute(Z,this.attributes[Z]);for(var X=0;X<this.children.length;X++)Q.appendChild(this.children[X].toNode());return Q}toMarkup(){var J='<svg xmlns="http://www.w3.org/2000/svg"';for(var Q in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Q))J+=" "+Q+'="'+K8.escape(this.attributes[Q])+'"';J+=">";for(var Z=0;Z<this.children.length;Z++)J+=this.children[Z].toMarkup();return J+="</svg>",J}},EM=class{static{D(this,"PathNode")}constructor(J,Q){this.pathName=void 0,this.alternate=void 0,this.pathName=J,this.alternate=Q}toNode(){var J="http://www.w3.org/2000/svg",Q=document.createElementNS(J,"path");if(this.alternate)Q.setAttribute("d",this.alternate);else Q.setAttribute("d",Gj0[this.pathName]);return Q}toMarkup(){if(this.alternate)return'<path d="'+K8.escape(this.alternate)+'"/>';else return'<path d="'+K8.escape(Gj0[this.pathName])+'"/>'}},qO1=class{static{D(this,"LineNode")}constructor(J){this.attributes=void 0,this.attributes=J||{}}toNode(){var J="http://www.w3.org/2000/svg",Q=document.createElementNS(J,"line");for(var Z in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Z))Q.setAttribute(Z,this.attributes[Z]);return Q}toMarkup(){var J="<line";for(var Q in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Q))J+=" "+Q+'="'+K8.escape(this.attributes[Q])+'"';return J+="/>",J}};D(zO1,"assertSymbolDomNode");D(lj0,"assertSpan");EN8={bin:1,close:1,inner:1,open:1,punct:1,rel:1},IN8={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},X4={math:{},text:{}};D(s,"defineSymbol");s(K1,A1,u1,"≡","\\equiv",!0);s(K1,A1,u1,"≺","\\prec",!0);s(K1,A1,u1,"≻","\\succ",!0);s(K1,A1,u1,"∼","\\sim",!0);s(K1,A1,u1,"⊥","\\perp");s(K1,A1,u1,"⪯","\\preceq",!0);s(K1,A1,u1,"⪰","\\succeq",!0);s(K1,A1,u1,"≃","\\simeq",!0);s(K1,A1,u1,"∣","\\mid",!0);s(K1,A1,u1,"≪","\\ll",!0);s(K1,A1,u1,"≫","\\gg",!0);s(K1,A1,u1,"≍","\\asymp",!0);s(K1,A1,u1,"∥","\\parallel");s(K1,A1,u1,"⋈","\\bowtie",!0);s(K1,A1,u1,"⌣","\\smile",!0);s(K1,A1,u1,"⊑","\\sqsubseteq",!0);s(K1,A1,u1,"⊒","\\sqsupseteq",!0);s(K1,A1,u1,"≐","\\doteq",!0);s(K1,A1,u1,"⌢","\\frown",!0);s(K1,A1,u1,"∋","\\ni",!0);s(K1,A1,u1,"∝","\\propto",!0);s(K1,A1,u1,"⊢","\\vdash",!0);s(K1,A1,u1,"⊣","\\dashv",!0);s(K1,A1,u1,"∋","\\owns");s(K1,A1,d11,".","\\ldotp");s(K1,A1,d11,"⋅","\\cdotp");s(K1,A1,o1,"#","\\#");s(_0,A1,o1,"#","\\#");s(K1,A1,o1,"&","\\&");s(_0,A1,o1,"&","\\&");s(K1,A1,o1,"ℵ","\\aleph",!0);s(K1,A1,o1,"∀","\\forall",!0);s(K1,A1,o1,"ℏ","\\hbar",!0);s(K1,A1,o1,"∃","\\exists",!0);s(K1,A1,o1,"∇","\\nabla",!0);s(K1,A1,o1,"♭","\\flat",!0);s(K1,A1,o1,"ℓ","\\ell",!0);s(K1,A1,o1,"♮","\\natural",!0);s(K1,A1,o1,"♣","\\clubsuit",!0);s(K1,A1,o1,"℘","\\wp",!0);s(K1,A1,o1,"♯","\\sharp",!0);s(K1,A1,o1,"♢","\\diamondsuit",!0);s(K1,A1,o1,"ℜ","\\Re",!0);s(K1,A1,o1,"♡","\\heartsuit",!0);s(K1,A1,o1,"ℑ","\\Im",!0);s(K1,A1,o1,"♠","\\spadesuit",!0);s(K1,A1,o1,"§","\\S",!0);s(_0,A1,o1,"§","\\S");s(K1,A1,o1,"¶","\\P",!0);s(_0,A1,o1,"¶","\\P");s(K1,A1,o1,"†","\\dag");s(_0,A1,o1,"†","\\dag");s(_0,A1,o1,"†","\\textdagger");s(K1,A1,o1,"‡","\\ddag");s(_0,A1,o1,"‡","\\ddag");s(_0,A1,o1,"‡","\\textdaggerdbl");s(K1,A1,cQ,"⎱","\\rmoustache",!0);s(K1,A1,GY,"⎰","\\lmoustache",!0);s(K1,A1,cQ,"⟯","\\rgroup",!0);s(K1,A1,GY,"⟮","\\lgroup",!0);s(K1,A1,A6,"∓","\\mp",!0);s(K1,A1,A6,"⊖","\\ominus",!0);s(K1,A1,A6,"⊎","\\uplus",!0);s(K1,A1,A6,"⊓","\\sqcap",!0);s(K1,A1,A6,"∗","\\ast");s(K1,A1,A6,"⊔","\\sqcup",!0);s(K1,A1,A6,"◯","\\bigcirc",!0);s(K1,A1,A6,"∙","\\bullet",!0);s(K1,A1,A6,"‡","\\ddagger");s(K1,A1,A6,"≀","\\wr",!0);s(K1,A1,A6,"⨿","\\amalg");s(K1,A1,A6,"&","\\And");s(K1,A1,u1,"⟵","\\longleftarrow",!0);s(K1,A1,u1,"⇐","\\Leftarrow",!0);s(K1,A1,u1,"⟸","\\Longleftarrow",!0);s(K1,A1,u1,"⟶","\\longrightarrow",!0);s(K1,A1,u1,"⇒","\\Rightarrow",!0);s(K1,A1,u1,"⟹","\\Longrightarrow",!0);s(K1,A1,u1,"↔","\\leftrightarrow",!0);s(K1,A1,u1,"⟷","\\longleftrightarrow",!0);s(K1,A1,u1,"⇔","\\Leftrightarrow",!0);s(K1,A1,u1,"⟺","\\Longleftrightarrow",!0);s(K1,A1,u1,"↦","\\mapsto",!0);s(K1,A1,u1,"⟼","\\longmapsto",!0);s(K1,A1,u1,"↗","\\nearrow",!0);s(K1,A1,u1,"↩","\\hookleftarrow",!0);s(K1,A1,u1,"↪","\\hookrightarrow",!0);s(K1,A1,u1,"↘","\\searrow",!0);s(K1,A1,u1,"↼","\\leftharpoonup",!0);s(K1,A1,u1,"⇀","\\rightharpoonup",!0);s(K1,A1,u1,"↙","\\swarrow",!0);s(K1,A1,u1,"↽","\\leftharpoondown",!0);s(K1,A1,u1,"⇁","\\rightharpoondown",!0);s(K1,A1,u1,"↖","\\nwarrow",!0);s(K1,A1,u1,"⇌","\\rightleftharpoons",!0);s(K1,m1,u1,"≮","\\nless",!0);s(K1,m1,u1,"","\\@nleqslant");s(K1,m1,u1,"","\\@nleqq");s(K1,m1,u1,"⪇","\\lneq",!0);s(K1,m1,u1,"≨","\\lneqq",!0);s(K1,m1,u1,"","\\@lvertneqq");s(K1,m1,u1,"⋦","\\lnsim",!0);s(K1,m1,u1,"⪉","\\lnapprox",!0);s(K1,m1,u1,"⊀","\\nprec",!0);s(K1,m1,u1,"⋠","\\npreceq",!0);s(K1,m1,u1,"⋨","\\precnsim",!0);s(K1,m1,u1,"⪹","\\precnapprox",!0);s(K1,m1,u1,"≁","\\nsim",!0);s(K1,m1,u1,"","\\@nshortmid");s(K1,m1,u1,"∤","\\nmid",!0);s(K1,m1,u1,"⊬","\\nvdash",!0);s(K1,m1,u1,"⊭","\\nvDash",!0);s(K1,m1,u1,"⋪","\\ntriangleleft");s(K1,m1,u1,"⋬","\\ntrianglelefteq",!0);s(K1,m1,u1,"⊊","\\subsetneq",!0);s(K1,m1,u1,"","\\@varsubsetneq");s(K1,m1,u1,"⫋","\\subsetneqq",!0);s(K1,m1,u1,"","\\@varsubsetneqq");s(K1,m1,u1,"≯","\\ngtr",!0);s(K1,m1,u1,"","\\@ngeqslant");s(K1,m1,u1,"","\\@ngeqq");s(K1,m1,u1,"⪈","\\gneq",!0);s(K1,m1,u1,"≩","\\gneqq",!0);s(K1,m1,u1,"","\\@gvertneqq");s(K1,m1,u1,"⋧","\\gnsim",!0);s(K1,m1,u1,"⪊","\\gnapprox",!0);s(K1,m1,u1,"⊁","\\nsucc",!0);s(K1,m1,u1,"⋡","\\nsucceq",!0);s(K1,m1,u1,"⋩","\\succnsim",!0);s(K1,m1,u1,"⪺","\\succnapprox",!0);s(K1,m1,u1,"≆","\\ncong",!0);s(K1,m1,u1,"","\\@nshortparallel");s(K1,m1,u1,"∦","\\nparallel",!0);s(K1,m1,u1,"⊯","\\nVDash",!0);s(K1,m1,u1,"⋫","\\ntriangleright");s(K1,m1,u1,"⋭","\\ntrianglerighteq",!0);s(K1,m1,u1,"","\\@nsupseteqq");s(K1,m1,u1,"⊋","\\supsetneq",!0);s(K1,m1,u1,"","\\@varsupsetneq");s(K1,m1,u1,"⫌","\\supsetneqq",!0);s(K1,m1,u1,"","\\@varsupsetneqq");s(K1,m1,u1,"⊮","\\nVdash",!0);s(K1,m1,u1,"⪵","\\precneqq",!0);s(K1,m1,u1,"⪶","\\succneqq",!0);s(K1,m1,u1,"","\\@nsubseteqq");s(K1,m1,A6,"⊴","\\unlhd");s(K1,m1,A6,"⊵","\\unrhd");s(K1,m1,u1,"↚","\\nleftarrow",!0);s(K1,m1,u1,"↛","\\nrightarrow",!0);s(K1,m1,u1,"⇍","\\nLeftarrow",!0);s(K1,m1,u1,"⇏","\\nRightarrow",!0);s(K1,m1,u1,"↮","\\nleftrightarrow",!0);s(K1,m1,u1,"⇎","\\nLeftrightarrow",!0);s(K1,m1,u1,"△","\\vartriangle");s(K1,m1,o1,"ℏ","\\hslash");s(K1,m1,o1,"▽","\\triangledown");s(K1,m1,o1,"◊","\\lozenge");s(K1,m1,o1,"Ⓢ","\\circledS");s(K1,m1,o1,"®","\\circledR");s(_0,m1,o1,"®","\\circledR");s(K1,m1,o1,"∡","\\measuredangle",!0);s(K1,m1,o1,"∄","\\nexists");s(K1,m1,o1,"℧","\\mho");s(K1,m1,o1,"Ⅎ","\\Finv",!0);s(K1,m1,o1,"⅁","\\Game",!0);s(K1,m1,o1,"‵","\\backprime");s(K1,m1,o1,"▲","\\blacktriangle");s(K1,m1,o1,"▼","\\blacktriangledown");s(K1,m1,o1,"■","\\blacksquare");s(K1,m1,o1,"⧫","\\blacklozenge");s(K1,m1,o1,"★","\\bigstar");s(K1,m1,o1,"∢","\\sphericalangle",!0);s(K1,m1,o1,"∁","\\complement",!0);s(K1,m1,o1,"ð","\\eth",!0);s(_0,A1,o1,"ð","ð");s(K1,m1,o1,"╱","\\diagup");s(K1,m1,o1,"╲","\\diagdown");s(K1,m1,o1,"□","\\square");s(K1,m1,o1,"□","\\Box");s(K1,m1,o1,"◊","\\Diamond");s(K1,m1,o1,"¥","\\yen",!0);s(_0,m1,o1,"¥","\\yen",!0);s(K1,m1,o1,"✓","\\checkmark",!0);s(_0,m1,o1,"✓","\\checkmark");s(K1,m1,o1,"ℶ","\\beth",!0);s(K1,m1,o1,"ℸ","\\daleth",!0);s(K1,m1,o1,"ℷ","\\gimel",!0);s(K1,m1,o1,"ϝ","\\digamma",!0);s(K1,m1,o1,"ϰ","\\varkappa");s(K1,m1,GY,"┌","\\@ulcorner",!0);s(K1,m1,cQ,"┐","\\@urcorner",!0);s(K1,m1,GY,"└","\\@llcorner",!0);s(K1,m1,cQ,"┘","\\@lrcorner",!0);s(K1,m1,u1,"≦","\\leqq",!0);s(K1,m1,u1,"⩽","\\leqslant",!0);s(K1,m1,u1,"⪕","\\eqslantless",!0);s(K1,m1,u1,"≲","\\lesssim",!0);s(K1,m1,u1,"⪅","\\lessapprox",!0);s(K1,m1,u1,"≊","\\approxeq",!0);s(K1,m1,A6,"⋖","\\lessdot");s(K1,m1,u1,"⋘","\\lll",!0);s(K1,m1,u1,"≶","\\lessgtr",!0);s(K1,m1,u1,"⋚","\\lesseqgtr",!0);s(K1,m1,u1,"⪋","\\lesseqqgtr",!0);s(K1,m1,u1,"≑","\\doteqdot");s(K1,m1,u1,"≓","\\risingdotseq",!0);s(K1,m1,u1,"≒","\\fallingdotseq",!0);s(K1,m1,u1,"∽","\\backsim",!0);s(K1,m1,u1,"⋍","\\backsimeq",!0);s(K1,m1,u1,"⫅","\\subseteqq",!0);s(K1,m1,u1,"⋐","\\Subset",!0);s(K1,m1,u1,"⊏","\\sqsubset",!0);s(K1,m1,u1,"≼","\\preccurlyeq",!0);s(K1,m1,u1,"⋞","\\curlyeqprec",!0);s(K1,m1,u1,"≾","\\precsim",!0);s(K1,m1,u1,"⪷","\\precapprox",!0);s(K1,m1,u1,"⊲","\\vartriangleleft");s(K1,m1,u1,"⊴","\\trianglelefteq");s(K1,m1,u1,"⊨","\\vDash",!0);s(K1,m1,u1,"⊪","\\Vvdash",!0);s(K1,m1,u1,"⌣","\\smallsmile");s(K1,m1,u1,"⌢","\\smallfrown");s(K1,m1,u1,"≏","\\bumpeq",!0);s(K1,m1,u1,"≎","\\Bumpeq",!0);s(K1,m1,u1,"≧","\\geqq",!0);s(K1,m1,u1,"⩾","\\geqslant",!0);s(K1,m1,u1,"⪖","\\eqslantgtr",!0);s(K1,m1,u1,"≳","\\gtrsim",!0);s(K1,m1,u1,"⪆","\\gtrapprox",!0);s(K1,m1,A6,"⋗","\\gtrdot");s(K1,m1,u1,"⋙","\\ggg",!0);s(K1,m1,u1,"≷","\\gtrless",!0);s(K1,m1,u1,"⋛","\\gtreqless",!0);s(K1,m1,u1,"⪌","\\gtreqqless",!0);s(K1,m1,u1,"≖","\\eqcirc",!0);s(K1,m1,u1,"≗","\\circeq",!0);s(K1,m1,u1,"≜","\\triangleq",!0);s(K1,m1,u1,"∼","\\thicksim");s(K1,m1,u1,"≈","\\thickapprox");s(K1,m1,u1,"⫆","\\supseteqq",!0);s(K1,m1,u1,"⋑","\\Supset",!0);s(K1,m1,u1,"⊐","\\sqsupset",!0);s(K1,m1,u1,"≽","\\succcurlyeq",!0);s(K1,m1,u1,"⋟","\\curlyeqsucc",!0);s(K1,m1,u1,"≿","\\succsim",!0);s(K1,m1,u1,"⪸","\\succapprox",!0);s(K1,m1,u1,"⊳","\\vartriangleright");s(K1,m1,u1,"⊵","\\trianglerighteq");s(K1,m1,u1,"⊩","\\Vdash",!0);s(K1,m1,u1,"∣","\\shortmid");s(K1,m1,u1,"∥","\\shortparallel");s(K1,m1,u1,"≬","\\between",!0);s(K1,m1,u1,"⋔","\\pitchfork",!0);s(K1,m1,u1,"∝","\\varpropto");s(K1,m1,u1,"◀","\\blacktriangleleft");s(K1,m1,u1,"∴","\\therefore",!0);s(K1,m1,u1,"∍","\\backepsilon");s(K1,m1,u1,"▶","\\blacktriangleright");s(K1,m1,u1,"∵","\\because",!0);s(K1,m1,u1,"⋘","\\llless");s(K1,m1,u1,"⋙","\\gggtr");s(K1,m1,A6,"⊲","\\lhd");s(K1,m1,A6,"⊳","\\rhd");s(K1,m1,u1,"≂","\\eqsim",!0);s(K1,A1,u1,"⋈","\\Join");s(K1,m1,u1,"≑","\\Doteq",!0);s(K1,m1,A6,"∔","\\dotplus",!0);s(K1,m1,A6,"∖","\\smallsetminus");s(K1,m1,A6,"⋒","\\Cap",!0);s(K1,m1,A6,"⋓","\\Cup",!0);s(K1,m1,A6,"⩞","\\doublebarwedge",!0);s(K1,m1,A6,"⊟","\\boxminus",!0);s(K1,m1,A6,"⊞","\\boxplus",!0);s(K1,m1,A6,"⋇","\\divideontimes",!0);s(K1,m1,A6,"⋉","\\ltimes",!0);s(K1,m1,A6,"⋊","\\rtimes",!0);s(K1,m1,A6,"⋋","\\leftthreetimes",!0);s(K1,m1,A6,"⋌","\\rightthreetimes",!0);s(K1,m1,A6,"⋏","\\curlywedge",!0);s(K1,m1,A6,"⋎","\\curlyvee",!0);s(K1,m1,A6,"⊝","\\circleddash",!0);s(K1,m1,A6,"⊛","\\circledast",!0);s(K1,m1,A6,"⋅","\\centerdot");s(K1,m1,A6,"⊺","\\intercal",!0);s(K1,m1,A6,"⋒","\\doublecap");s(K1,m1,A6,"⋓","\\doublecup");s(K1,m1,A6,"⊠","\\boxtimes",!0);s(K1,m1,u1,"⇢","\\dashrightarrow",!0);s(K1,m1,u1,"⇠","\\dashleftarrow",!0);s(K1,m1,u1,"⇇","\\leftleftarrows",!0);s(K1,m1,u1,"⇆","\\leftrightarrows",!0);s(K1,m1,u1,"⇚","\\Lleftarrow",!0);s(K1,m1,u1,"↞","\\twoheadleftarrow",!0);s(K1,m1,u1,"↢","\\leftarrowtail",!0);s(K1,m1,u1,"↫","\\looparrowleft",!0);s(K1,m1,u1,"⇋","\\leftrightharpoons",!0);s(K1,m1,u1,"↶","\\curvearrowleft",!0);s(K1,m1,u1,"↺","\\circlearrowleft",!0);s(K1,m1,u1,"↰","\\Lsh",!0);s(K1,m1,u1,"⇈","\\upuparrows",!0);s(K1,m1,u1,"↿","\\upharpoonleft",!0);s(K1,m1,u1,"⇃","\\downharpoonleft",!0);s(K1,A1,u1,"⊶","\\origof",!0);s(K1,A1,u1,"⊷","\\imageof",!0);s(K1,m1,u1,"⊸","\\multimap",!0);s(K1,m1,u1,"↭","\\leftrightsquigarrow",!0);s(K1,m1,u1,"⇉","\\rightrightarrows",!0);s(K1,m1,u1,"⇄","\\rightleftarrows",!0);s(K1,m1,u1,"↠","\\twoheadrightarrow",!0);s(K1,m1,u1,"↣","\\rightarrowtail",!0);s(K1,m1,u1,"↬","\\looparrowright",!0);s(K1,m1,u1,"↷","\\curvearrowright",!0);s(K1,m1,u1,"↻","\\circlearrowright",!0);s(K1,m1,u1,"↱","\\Rsh",!0);s(K1,m1,u1,"⇊","\\downdownarrows",!0);s(K1,m1,u1,"↾","\\upharpoonright",!0);s(K1,m1,u1,"⇂","\\downharpoonright",!0);s(K1,m1,u1,"⇝","\\rightsquigarrow",!0);s(K1,m1,u1,"⇝","\\leadsto");s(K1,m1,u1,"⇛","\\Rrightarrow",!0);s(K1,m1,u1,"↾","\\restriction");s(K1,A1,o1,"‘","`");s(K1,A1,o1,"$","\\$");s(_0,A1,o1,"$","\\$");s(_0,A1,o1,"$","\\textdollar");s(K1,A1,o1,"%","\\%");s(_0,A1,o1,"%","\\%");s(K1,A1,o1,"_","\\_");s(_0,A1,o1,"_","\\_");s(_0,A1,o1,"_","\\textunderscore");s(K1,A1,o1,"∠","\\angle",!0);s(K1,A1,o1,"∞","\\infty",!0);s(K1,A1,o1,"′","\\prime");s(K1,A1,o1,"△","\\triangle");s(K1,A1,o1,"Γ","\\Gamma",!0);s(K1,A1,o1,"Δ","\\Delta",!0);s(K1,A1,o1,"Θ","\\Theta",!0);s(K1,A1,o1,"Λ","\\Lambda",!0);s(K1,A1,o1,"Ξ","\\Xi",!0);s(K1,A1,o1,"Π","\\Pi",!0);s(K1,A1,o1,"Σ","\\Sigma",!0);s(K1,A1,o1,"Υ","\\Upsilon",!0);s(K1,A1,o1,"Φ","\\Phi",!0);s(K1,A1,o1,"Ψ","\\Psi",!0);s(K1,A1,o1,"Ω","\\Omega",!0);s(K1,A1,o1,"A","Α");s(K1,A1,o1,"B","Β");s(K1,A1,o1,"E","Ε");s(K1,A1,o1,"Z","Ζ");s(K1,A1,o1,"H","Η");s(K1,A1,o1,"I","Ι");s(K1,A1,o1,"K","Κ");s(K1,A1,o1,"M","Μ");s(K1,A1,o1,"N","Ν");s(K1,A1,o1,"O","Ο");s(K1,A1,o1,"P","Ρ");s(K1,A1,o1,"T","Τ");s(K1,A1,o1,"X","Χ");s(K1,A1,o1,"¬","\\neg",!0);s(K1,A1,o1,"¬","\\lnot");s(K1,A1,o1,"⊤","\\top");s(K1,A1,o1,"⊥","\\bot");s(K1,A1,o1,"∅","\\emptyset");s(K1,m1,o1,"∅","\\varnothing");s(K1,A1,F8,"α","\\alpha",!0);s(K1,A1,F8,"β","\\beta",!0);s(K1,A1,F8,"γ","\\gamma",!0);s(K1,A1,F8,"δ","\\delta",!0);s(K1,A1,F8,"ϵ","\\epsilon",!0);s(K1,A1,F8,"ζ","\\zeta",!0);s(K1,A1,F8,"η","\\eta",!0);s(K1,A1,F8,"θ","\\theta",!0);s(K1,A1,F8,"ι","\\iota",!0);s(K1,A1,F8,"κ","\\kappa",!0);s(K1,A1,F8,"λ","\\lambda",!0);s(K1,A1,F8,"μ","\\mu",!0);s(K1,A1,F8,"ν","\\nu",!0);s(K1,A1,F8,"ξ","\\xi",!0);s(K1,A1,F8,"ο","\\omicron",!0);s(K1,A1,F8,"π","\\pi",!0);s(K1,A1,F8,"ρ","\\rho",!0);s(K1,A1,F8,"σ","\\sigma",!0);s(K1,A1,F8,"τ","\\tau",!0);s(K1,A1,F8,"υ","\\upsilon",!0);s(K1,A1,F8,"ϕ","\\phi",!0);s(K1,A1,F8,"χ","\\chi",!0);s(K1,A1,F8,"ψ","\\psi",!0);s(K1,A1,F8,"ω","\\omega",!0);s(K1,A1,F8,"ε","\\varepsilon",!0);s(K1,A1,F8,"ϑ","\\vartheta",!0);s(K1,A1,F8,"ϖ","\\varpi",!0);s(K1,A1,F8,"ϱ","\\varrho",!0);s(K1,A1,F8,"ς","\\varsigma",!0);s(K1,A1,F8,"φ","\\varphi",!0);s(K1,A1,A6,"∗","*",!0);s(K1,A1,A6,"+","+");s(K1,A1,A6,"−","-",!0);s(K1,A1,A6,"⋅","\\cdot",!0);s(K1,A1,A6,"∘","\\circ",!0);s(K1,A1,A6,"÷","\\div",!0);s(K1,A1,A6,"±","\\pm",!0);s(K1,A1,A6,"×","\\times",!0);s(K1,A1,A6,"∩","\\cap",!0);s(K1,A1,A6,"∪","\\cup",!0);s(K1,A1,A6,"∖","\\setminus",!0);s(K1,A1,A6,"∧","\\land");s(K1,A1,A6,"∨","\\lor");s(K1,A1,A6,"∧","\\wedge",!0);s(K1,A1,A6,"∨","\\vee",!0);s(K1,A1,o1,"√","\\surd");s(K1,A1,GY,"⟨","\\langle",!0);s(K1,A1,GY,"∣","\\lvert");s(K1,A1,GY,"∥","\\lVert");s(K1,A1,cQ,"?","?");s(K1,A1,cQ,"!","!");s(K1,A1,cQ,"⟩","\\rangle",!0);s(K1,A1,cQ,"∣","\\rvert");s(K1,A1,cQ,"∥","\\rVert");s(K1,A1,u1,"=","=");s(K1,A1,u1,":",":");s(K1,A1,u1,"≈","\\approx",!0);s(K1,A1,u1,"≅","\\cong",!0);s(K1,A1,u1,"≥","\\ge");s(K1,A1,u1,"≥","\\geq",!0);s(K1,A1,u1,"←","\\gets");s(K1,A1,u1,">","\\gt",!0);s(K1,A1,u1,"∈","\\in",!0);s(K1,A1,u1,"","\\@not");s(K1,A1,u1,"⊂","\\subset",!0);s(K1,A1,u1,"⊃","\\supset",!0);s(K1,A1,u1,"⊆","\\subseteq",!0);s(K1,A1,u1,"⊇","\\supseteq",!0);s(K1,m1,u1,"⊈","\\nsubseteq",!0);s(K1,m1,u1,"⊉","\\nsupseteq",!0);s(K1,A1,u1,"⊨","\\models");s(K1,A1,u1,"←","\\leftarrow",!0);s(K1,A1,u1,"≤","\\le");s(K1,A1,u1,"≤","\\leq",!0);s(K1,A1,u1,"<","\\lt",!0);s(K1,A1,u1,"→","\\rightarrow",!0);s(K1,A1,u1,"→","\\to");s(K1,m1,u1,"≱","\\ngeq",!0);s(K1,m1,u1,"≰","\\nleq",!0);s(K1,A1,aF," ","\\ ");s(K1,A1,aF," ","\\space");s(K1,A1,aF," ","\\nobreakspace");s(_0,A1,aF," ","\\ ");s(_0,A1,aF," "," ");s(_0,A1,aF," ","\\space");s(_0,A1,aF," ","\\nobreakspace");s(K1,A1,aF,null,"\\nobreak");s(K1,A1,aF,null,"\\allowbreak");s(K1,A1,d11,",",",");s(K1,A1,d11,";",";");s(K1,m1,A6,"⊼","\\barwedge",!0);s(K1,m1,A6,"⊻","\\veebar",!0);s(K1,A1,A6,"⊙","\\odot",!0);s(K1,A1,A6,"⊕","\\oplus",!0);s(K1,A1,A6,"⊗","\\otimes",!0);s(K1,A1,o1,"∂","\\partial",!0);s(K1,A1,A6,"⊘","\\oslash",!0);s(K1,m1,A6,"⊚","\\circledcirc",!0);s(K1,m1,A6,"⊡","\\boxdot",!0);s(K1,A1,A6,"△","\\bigtriangleup");s(K1,A1,A6,"▽","\\bigtriangledown");s(K1,A1,A6,"†","\\dagger");s(K1,A1,A6,"⋄","\\diamond");s(K1,A1,A6,"⋆","\\star");s(K1,A1,A6,"◃","\\triangleleft");s(K1,A1,A6,"▹","\\triangleright");s(K1,A1,GY,"{","\\{");s(_0,A1,o1,"{","\\{");s(_0,A1,o1,"{","\\textbraceleft");s(K1,A1,cQ,"}","\\}");s(_0,A1,o1,"}","\\}");s(_0,A1,o1,"}","\\textbraceright");s(K1,A1,GY,"{","\\lbrace");s(K1,A1,cQ,"}","\\rbrace");s(K1,A1,GY,"[","\\lbrack",!0);s(_0,A1,o1,"[","\\lbrack",!0);s(K1,A1,cQ,"]","\\rbrack",!0);s(_0,A1,o1,"]","\\rbrack",!0);s(K1,A1,GY,"(","\\lparen",!0);s(K1,A1,cQ,")","\\rparen",!0);s(_0,A1,o1,"<","\\textless",!0);s(_0,A1,o1,">","\\textgreater",!0);s(K1,A1,GY,"⌊","\\lfloor",!0);s(K1,A1,cQ,"⌋","\\rfloor",!0);s(K1,A1,GY,"⌈","\\lceil",!0);s(K1,A1,cQ,"⌉","\\rceil",!0);s(K1,A1,o1,"\\","\\backslash");s(K1,A1,o1,"∣","|");s(K1,A1,o1,"∣","\\vert");s(_0,A1,o1,"|","\\textbar",!0);s(K1,A1,o1,"∥","\\|");s(K1,A1,o1,"∥","\\Vert");s(_0,A1,o1,"∥","\\textbardbl");s(_0,A1,o1,"~","\\textasciitilde");s(_0,A1,o1,"\\","\\textbackslash");s(_0,A1,o1,"^","\\textasciicircum");s(K1,A1,u1,"↑","\\uparrow",!0);s(K1,A1,u1,"⇑","\\Uparrow",!0);s(K1,A1,u1,"↓","\\downarrow",!0);s(K1,A1,u1,"⇓","\\Downarrow",!0);s(K1,A1,u1,"↕","\\updownarrow",!0);s(K1,A1,u1,"⇕","\\Updownarrow",!0);s(K1,A1,h7,"∐","\\coprod");s(K1,A1,h7,"⋁","\\bigvee");s(K1,A1,h7,"⋀","\\bigwedge");s(K1,A1,h7,"⨄","\\biguplus");s(K1,A1,h7,"⋂","\\bigcap");s(K1,A1,h7,"⋃","\\bigcup");s(K1,A1,h7,"∫","\\int");s(K1,A1,h7,"∫","\\intop");s(K1,A1,h7,"∬","\\iint");s(K1,A1,h7,"∭","\\iiint");s(K1,A1,h7,"∏","\\prod");s(K1,A1,h7,"∑","\\sum");s(K1,A1,h7,"⨂","\\bigotimes");s(K1,A1,h7,"⨁","\\bigoplus");s(K1,A1,h7,"⨀","\\bigodot");s(K1,A1,h7,"∮","\\oint");s(K1,A1,h7,"∯","\\oiint");s(K1,A1,h7,"∰","\\oiiint");s(K1,A1,h7,"⨆","\\bigsqcup");s(K1,A1,h7,"∫","\\smallint");s(_0,A1,NI,"…","\\textellipsis");s(K1,A1,NI,"…","\\mathellipsis");s(_0,A1,NI,"…","\\ldots",!0);s(K1,A1,NI,"…","\\ldots",!0);s(K1,A1,NI,"⋯","\\@cdots",!0);s(K1,A1,NI,"⋱","\\ddots",!0);s(K1,A1,o1,"⋮","\\varvdots");s(K1,A1,I4,"ˊ","\\acute");s(K1,A1,I4,"ˋ","\\grave");s(K1,A1,I4,"¨","\\ddot");s(K1,A1,I4,"~","\\tilde");s(K1,A1,I4,"ˉ","\\bar");s(K1,A1,I4,"˘","\\breve");s(K1,A1,I4,"ˇ","\\check");s(K1,A1,I4,"^","\\hat");s(K1,A1,I4,"⃗","\\vec");s(K1,A1,I4,"˙","\\dot");s(K1,A1,I4,"˚","\\mathring");s(K1,A1,F8,"","\\@imath");s(K1,A1,F8,"","\\@jmath");s(K1,A1,o1,"ı","ı");s(K1,A1,o1,"ȷ","ȷ");s(_0,A1,o1,"ı","\\i",!0);s(_0,A1,o1,"ȷ","\\j",!0);s(_0,A1,o1,"ß","\\ss",!0);s(_0,A1,o1,"æ","\\ae",!0);s(_0,A1,o1,"œ","\\oe",!0);s(_0,A1,o1,"ø","\\o",!0);s(_0,A1,o1,"Æ","\\AE",!0);s(_0,A1,o1,"Œ","\\OE",!0);s(_0,A1,o1,"Ø","\\O",!0);s(_0,A1,I4,"ˊ","\\'");s(_0,A1,I4,"ˋ","\\`");s(_0,A1,I4,"ˆ","\\^");s(_0,A1,I4,"˜","\\~");s(_0,A1,I4,"ˉ","\\=");s(_0,A1,I4,"˘","\\u");s(_0,A1,I4,"˙","\\.");s(_0,A1,I4,"¸","\\c");s(_0,A1,I4,"˚","\\r");s(_0,A1,I4,"ˇ","\\v");s(_0,A1,I4,"¨","\\\"");s(_0,A1,I4,"˝","\\H");s(_0,A1,I4,"◯","\\textcircled");ij0={"--":!0,"---":!0,"``":!0,"''":!0};s(_0,A1,o1,"–","--",!0);s(_0,A1,o1,"–","\\textendash");s(_0,A1,o1,"—","---",!0);s(_0,A1,o1,"—","\\textemdash");s(_0,A1,o1,"‘","`",!0);s(_0,A1,o1,"‘","\\textquoteleft");s(_0,A1,o1,"’","'",!0);s(_0,A1,o1,"’","\\textquoteright");s(_0,A1,o1,"“","``",!0);s(_0,A1,o1,"“","\\textquotedblleft");s(_0,A1,o1,"”","''",!0);s(_0,A1,o1,"”","\\textquotedblright");s(K1,A1,o1,"°","\\degree",!0);s(_0,A1,o1,"°","\\degree");s(_0,A1,o1,"°","\\textdegree",!0);s(K1,A1,o1,"£","\\pounds");s(K1,A1,o1,"£","\\mathsterling",!0);s(_0,A1,o1,"£","\\pounds");s(_0,A1,o1,"£","\\textsterling",!0);s(K1,m1,o1,"✠","\\maltese");s(_0,m1,o1,"✠","\\maltese");for(E11=0;E11<Wj0.length;E11++)aR1=Wj0.charAt(E11),s(K1,A1,o1,aR1,aR1);for(I11=0;I11<Fj0.length;I11++)rR1=Fj0.charAt(I11),s(_0,A1,o1,rR1,rR1);for(P11=0;P11<f11.length;P11++)Xf=f11.charAt(P11),s(K1,A1,F8,Xf,Xf),s(_0,A1,o1,Xf,Xf);s(K1,m1,o1,"C","ℂ");s(_0,m1,o1,"C","ℂ");s(K1,m1,o1,"H","ℍ");s(_0,m1,o1,"H","ℍ");s(K1,m1,o1,"N","ℕ");s(_0,m1,o1,"N","ℕ");s(K1,m1,o1,"P","ℙ");s(_0,m1,o1,"P","ℙ");s(K1,m1,o1,"Q","ℚ");s(_0,m1,o1,"Q","ℚ");s(K1,m1,o1,"R","ℝ");s(_0,m1,o1,"R","ℝ");s(K1,m1,o1,"Z","ℤ");s(_0,m1,o1,"Z","ℤ");s(K1,A1,F8,"h","ℎ");s(_0,A1,F8,"h","ℎ");for(oJ=0;oJ<f11.length;oJ++)if(y4=f11.charAt(oJ),C8=String.fromCharCode(55349,56320+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56372+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56424+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56580+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56684+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56736+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56788+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56840+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56944+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),oJ<26)C8=String.fromCharCode(55349,56632+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8),C8=String.fromCharCode(55349,56476+oJ),s(K1,A1,F8,y4,C8),s(_0,A1,o1,y4,C8);C8=String.fromCharCode(55349,56668);s(K1,A1,F8,"k",C8);s(_0,A1,o1,"k",C8);for(OM=0;OM<10;OM++)uF=OM.toString(),C8=String.fromCharCode(55349,57294+OM),s(K1,A1,F8,uF,C8),s(_0,A1,o1,uF,C8),C8=String.fromCharCode(55349,57314+OM),s(K1,A1,F8,uF,C8),s(_0,A1,o1,uF,C8),C8=String.fromCharCode(55349,57324+OM),s(K1,A1,F8,uF,C8),s(_0,A1,o1,uF,C8),C8=String.fromCharCode(55349,57334+OM),s(K1,A1,F8,uF,C8),s(_0,A1,o1,uF,C8);for(T11=0;T11<UO1.length;T11++)Yf=UO1.charAt(T11),s(K1,A1,F8,Yf,Yf),s(_0,A1,o1,Yf,Yf);C11=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Hj0=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],PN8=D(function(Q,Z){var X=Q.charCodeAt(0),Y=Q.charCodeAt(1),K=(X-55296)*1024+(Y-56320)+65536,G=Z==="math"?0:1;if(119808<=K&&K<120484){var q=Math.floor((K-119808)/26);return[C11[q][2],C11[q][G]]}else if(120782<=K&&K<=120831){var z=Math.floor((K-120782)/10);return[Hj0[z][2],Hj0[z][G]]}else if(K===120485||K===120486)return[C11[0][2],C11[0][G]];else if(120486<K&&K<120782)return["",""];else throw new r0("Unsupported character: "+Q)},"wideCharacterFont"),c11=D(function(Q,Z,X){if(X4[X][Q]&&X4[X][Q].replace)Q=X4[X][Q].replace;return{value:Q,metrics:p11(Q,Z,X)}},"lookupSymbol"),Yq=D(function(Q,Z,X,Y,K){var G=c11(Q,Z,X),q=G.metrics;Q=G.value;var z;if(q){var U=q.italic;if(X==="text"||Y&&Y.font==="mathit")U=0;z=new KK(Q,q.height,q.depth,U,q.skew,q.width,K)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+Q+"' in style '"+Z+"' and mode '"+X+"'")),z=new KK(Q,0,0,0,0,0,K);if(Y){if(z.maxFontSize=Y.sizeMultiplier,Y.style.isTight())z.classes.push("mtight");var W=Y.getColor();if(W)z.style.color=W}return z},"makeSymbol"),TN8=D(function(Q,Z,X,Y){if(Y===void 0)Y=[];if(X.font==="boldsymbol"&&c11(Q,"Main-Bold",Z).metrics)return Yq(Q,"Main-Bold",Z,X,Y.concat(["mathbf"]));else if(Q==="\\"||X4[Z][Q].font==="main")return Yq(Q,"Main-Regular",Z,X,Y);else return Yq(Q,"AMS-Regular",Z,X,Y.concat(["amsrm"]))},"mathsym"),CN8=D(function(Q,Z,X,Y,K){if(K!=="textord"&&c11(Q,"Math-BoldItalic",Z).metrics)return{fontName:"Math-BoldItalic",fontClass:"boldsymbol"};else return{fontName:"Main-Bold",fontClass:"mathbf"}},"boldsymbol"),SN8=D(function(Q,Z,X){var{mode:Y,text:K}=Q,G=["mord"],q=Y==="math"||Y==="text"&&Z.font,z=q?Z.font:Z.fontFamily,U="",W="";if(K.charCodeAt(0)===55349)[U,W]=PN8(K,Y);if(U.length>0)return Yq(K,U,Y,Z,G.concat(W));else if(z){var F,H;if(z==="boldsymbol"){var B=CN8(K,Y,Z,G,X);F=B.fontName,H=[B.fontClass]}else if(q)F=rj0[z].fontName,H=[z];else F=S11(z,Z.fontWeight,Z.fontShape),H=[z,Z.fontWeight,Z.fontShape];if(c11(K,F,Y).metrics)return Yq(K,F,Y,Z,G.concat(H));else if(ij0.hasOwnProperty(K)&&F.slice(0,10)==="Typewriter"){var M=[];for(var V=0;V<K.length;V++)M.push(Yq(K[V],F,Y,Z,G.concat(H)));return aj0(M)}}if(X==="mathord")return Yq(K,"Math-Italic",Y,Z,G.concat(["mathnormal"]));else if(X==="textord"){var N=X4[Y][K]&&X4[Y][K].font;if(N==="ams"){var L=S11("amsrm",Z.fontWeight,Z.fontShape);return Yq(K,L,Y,Z,G.concat("amsrm",Z.fontWeight,Z.fontShape))}else if(N==="main"||!N){var A=S11("textrm",Z.fontWeight,Z.fontShape);return Yq(K,A,Y,Z,G.concat(Z.fontWeight,Z.fontShape))}else{var w=S11(N,Z.fontWeight,Z.fontShape);return Yq(K,w,Y,Z,G.concat(w,Z.fontWeight,Z.fontShape))}}else throw Error("unexpected type: "+X+" in makeOrd")},"makeOrd"),vN8=D((J,Q)=>{if($M(J.classes)!==$M(Q.classes)||J.skew!==Q.skew||J.maxFontSize!==Q.maxFontSize)return!1;if(J.classes.length===1){var Z=J.classes[0];if(Z==="mbin"||Z==="mord")return!1}for(var X in J.style)if(J.style.hasOwnProperty(X)&&J.style[X]!==Q.style[X])return!1;for(var Y in Q.style)if(Q.style.hasOwnProperty(Y)&&J.style[Y]!==Q.style[Y])return!1;return!0},"canCombine"),kN8=D((J)=>{for(var Q=0;Q<J.length-1;Q++){var Z=J[Q],X=J[Q+1];if(Z instanceof KK&&X instanceof KK&&vN8(Z,X))Z.text+=X.text,Z.height=Math.max(Z.height,X.height),Z.depth=Math.max(Z.depth,X.depth),Z.italic=X.italic,J.splice(Q+1,1),Q--}return J},"tryCombineChars"),RO1=D(function(Q){var Z=0,X=0,Y=0;for(var K=0;K<Q.children.length;K++){var G=Q.children[K];if(G.height>Z)Z=G.height;if(G.depth>X)X=G.depth;if(G.maxFontSize>Y)Y=G.maxFontSize}Q.height=Z,Q.depth=X,Q.maxFontSize=Y},"sizeElementFromChildren"),pZ=D(function(Q,Z,X,Y){var K=new Hf(Q,Z,X,Y);return RO1(K),K},"makeSpan"),nj0=D((J,Q,Z,X)=>new Hf(J,Q,Z,X),"makeSvgSpan"),_N8=D(function(Q,Z,X){var Y=pZ([Q],[],Z);return Y.height=Math.max(X||Z.fontMetrics().defaultRuleThickness,Z.minRuleThickness),Y.style.borderBottomWidth=J6(Y.height),Y.maxFontSize=1,Y},"makeLineSpan"),xN8=D(function(Q,Z,X,Y){var K=new wO1(Q,Z,X,Y);return RO1(K),K},"makeAnchor"),aj0=D(function(Q){var Z=new Ff(Q);return RO1(Z),Z},"makeFragment"),bN8=D(function(Q,Z){if(Q instanceof Ff)return pZ([],[Q],Z);return Q},"wrapFragment"),yN8=D(function(Q){if(Q.positionType==="individualShift"){var Z=Q.children,X=[Z[0]],Y=-Z[0].shift-Z[0].elem.depth,K=Y;for(var G=1;G<Z.length;G++){var q=-Z[G].shift-K-Z[G].elem.depth,z=q-(Z[G-1].elem.height+Z[G-1].elem.depth);K=K+q,X.push({type:"kern",size:z}),X.push(Z[G])}return{children:X,depth:Y}}var U;if(Q.positionType==="top"){var W=Q.positionData;for(var F=0;F<Q.children.length;F++){var H=Q.children[F];W-=H.type==="kern"?H.size:H.elem.height+H.elem.depth}U=W}else if(Q.positionType==="bottom")U=-Q.positionData;else{var B=Q.children[0];if(B.type!=="elem")throw Error('First child must have type "elem".');if(Q.positionType==="shift")U=-B.elem.depth-Q.positionData;else if(Q.positionType==="firstBaseline")U=-B.elem.depth;else throw Error("Invalid positionType "+Q.positionType+".")}return{children:Q.children,depth:U}},"getVListChildrenAndDepth"),fN8=D(function(Q,Z){var{children:X,depth:Y}=yN8(Q),K=0;for(var G=0;G<X.length;G++){var q=X[G];if(q.type==="elem"){var z=q.elem;K=Math.max(K,z.maxFontSize,z.height)}}K+=2;var U=pZ(["pstrut"],[]);U.style.height=J6(K);var W=[],F=Y,H=Y,B=Y;for(var M=0;M<X.length;M++){var V=X[M];if(V.type==="kern")B+=V.size;else{var N=V.elem,L=V.wrapperClasses||[],A=V.wrapperStyle||{},w=pZ(L,[U,N],void 0,A);if(w.style.top=J6(-K-B-N.depth),V.marginLeft)w.style.marginLeft=V.marginLeft;if(V.marginRight)w.style.marginRight=V.marginRight;W.push(w),B+=N.height+N.depth}F=Math.min(F,B),H=Math.max(H,B)}var R=pZ(["vlist"],W);R.style.height=J6(H);var O;if(F<0){var j=pZ([],[]),$=pZ(["vlist"],[j]);$.style.height=J6(-F);var E=pZ(["vlist-s"],[new KK("")]);O=[pZ(["vlist-r"],[R,E]),pZ(["vlist-r"],[$])]}else O=[pZ(["vlist-r"],[R])];var I=pZ(["vlist-t"],O);if(O.length===2)I.classes.push("vlist-t2");return I.height=H,I.depth=-F,I},"makeVList"),hN8=D((J,Q)=>{var Z=pZ(["mspace"],[],Q),X=h4(J,Q);return Z.style.marginRight=J6(X),Z},"makeGlue"),S11=D(function(Q,Z,X){var Y="";switch(Q){case"amsrm":Y="AMS";break;case"textrm":Y="Main";break;case"textsf":Y="SansSerif";break;case"texttt":Y="Typewriter";break;default:Y=Q}var K;if(Z==="textbf"&&X==="textit")K="BoldItalic";else if(Z==="textbf")K="Bold";else if(Z==="textit")K="Italic";else K="Regular";return Y+"-"+K},"retrieveTextFontName"),rj0={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},sj0={vec:["vec",0.471,0.714],oiintSize1:["oiintSize1",0.957,0.499],oiintSize2:["oiintSize2",1.472,0.659],oiiintSize1:["oiiintSize1",1.304,0.499],oiiintSize2:["oiiintSize2",1.98,0.659]},gN8=D(function(Q,Z){var[X,Y,K]=sj0[Q],G=new EM(X),q=new lF([G],{width:J6(Y),height:J6(K),style:"width:"+J6(Y),viewBox:"0 0 "+1000*Y+" "+1000*K,preserveAspectRatio:"xMinYMin"}),z=nj0(["overlay"],[q],Z);return z.height=K,z.style.height=J6(K),z.style.width=J6(Y),z},"staticSvg"),Y0={fontMap:rj0,makeSymbol:Yq,mathsym:TN8,makeSpan:pZ,makeSvgSpan:nj0,makeLineSpan:_N8,makeAnchor:xN8,makeFragment:aj0,wrapFragment:bN8,makeVList:fN8,makeOrd:SN8,makeGlue:hN8,staticSvg:gN8,svgData:sj0,tryCombineChars:kN8},f4={number:3,unit:"mu"},VA={number:4,unit:"mu"},pF={number:5,unit:"mu"},mN8={mord:{mop:f4,mbin:VA,mrel:pF,minner:f4},mop:{mord:f4,mop:f4,mrel:pF,minner:f4},mbin:{mord:VA,mop:VA,mopen:VA,minner:VA},mrel:{mord:pF,mop:pF,mopen:pF,minner:pF},mopen:{},mclose:{mop:f4,mbin:VA,mrel:pF,minner:f4},mpunct:{mord:f4,mop:f4,mrel:pF,mopen:f4,mclose:f4,mpunct:f4,minner:f4},minner:{mord:f4,mop:f4,mbin:VA,mrel:pF,mopen:f4,mpunct:f4,minner:f4}},uN8={mord:{mop:f4},mop:{mord:f4,mop:f4},mbin:{},mrel:{},mopen:{},mclose:{mop:f4},mpunct:{},minner:{mop:f4}},oj0={},h11={},g11={};D(H6,"defineFunction");D(PM,"defineFunctionBuilders");m11=D(function(Q){return Q.type==="ordgroup"&&Q.body.length===1?Q.body[0]:Q},"normalizeArgument"),N7=D(function(Q){return Q.type==="ordgroup"?Q.body:[Q]},"ordargument"),iF=Y0.makeSpan,pN8=["leftmost","mbin","mopen","mrel","mop","mpunct"],dN8=["rightmost","mrel","mclose","mpunct"],cN8={display:H8.DISPLAY,text:H8.TEXT,script:H8.SCRIPT,scriptscript:H8.SCRIPTSCRIPT},lN8={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},H5=D(function(Q,Z,X,Y){if(Y===void 0)Y=[null,null];var K=[];for(var G=0;G<Q.length;G++){var q=J2(Q[G],Z);if(q instanceof Ff){var z=q.children;K.push(...z)}else K.push(q)}if(Y0.tryCombineChars(K),!X)return K;var U=Z;if(Q.length===1){var W=Q[0];if(W.type==="sizing")U=Z.havingSize(W.size);else if(W.type==="styling")U=Z.havingStyle(cN8[W.style])}var F=iF([Y[0]||"leftmost"],[],Z),H=iF([Y[1]||"rightmost"],[],Z),B=X==="root";return Bj0(K,(M,V)=>{var N=V.classes[0],L=M.classes[0];if(N==="mbin"&&K8.contains(dN8,L))V.classes[0]="mord";else if(L==="mbin"&&K8.contains(pN8,N))M.classes[0]="mord"},{node:F},H,B),Bj0(K,(M,V)=>{var N=WO1(V),L=WO1(M),A=N&&L?M.hasClass("mtight")?uN8[N][L]:mN8[N][L]:null;if(A)return Y0.makeGlue(A,U)},{node:F},H,B),K},"buildExpression"),Bj0=D(function J(Q,Z,X,Y,K){if(Y)Q.push(Y);var G=0;for(;G<Q.length;G++){var q=Q[G],z=tj0(q);if(z){J(z.children,Z,X,null,K);continue}var U=!q.hasClass("mspace");if(U){var W=Z(q,X.node);if(W)if(X.insertAfter)X.insertAfter(W);else Q.unshift(W),G++}if(U)X.node=q;else if(K&&q.hasClass("newline"))X.node=iF(["leftmost"]);X.insertAfter=((F)=>(H)=>{Q.splice(F+1,0,H),G++})(G)}if(Y)Q.pop()},"traverseNonSpaceNodes"),tj0=D(function(Q){if(Q instanceof Ff||Q instanceof wO1||Q instanceof Hf&&Q.hasClass("enclosing"))return Q;return null},"checkPartialGroup"),iN8=D(function J(Q,Z){var X=tj0(Q);if(X){var Y=X.children;if(Y.length){if(Z==="right")return J(Y[Y.length-1],"right");else if(Z==="left")return J(Y[0],"left")}}return Q},"getOutermostNode"),WO1=D(function(Q,Z){if(!Q)return null;if(Z)Q=iN8(Q,Z);return lN8[Q.classes[0]]||null},"getTypeOfDomTree"),Wf=D(function(Q,Z){var X=["nulldelimiter"].concat(Q.baseSizingClasses());return iF(Z.concat(X))},"makeNullDelimiter"),J2=D(function(Q,Z,X){if(!Q)return iF();if(h11[Q.type]){var Y=h11[Q.type](Q,Z);if(X&&Z.size!==X.size){Y=iF(Z.sizingClasses(X),[Y],Z);var K=Z.sizeMultiplier/X.sizeMultiplier;Y.height*=K,Y.depth*=K}return Y}else throw new r0("Got group of unknown type: '"+Q.type+"'")},"buildGroup");D(Kf,"buildHTMLUnbreakable");D(u11,"buildHTML");D(OO1,"newDocumentFragment");XK=class{static{D(this,"MathNode")}constructor(J,Q,Z){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=J,this.attributes={},this.children=Q||[],this.classes=Z||[]}setAttribute(J,Q){this.attributes[J]=Q}getAttribute(J){return this.attributes[J]}toNode(){var J=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var Q in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Q))J.setAttribute(Q,this.attributes[Q]);if(this.classes.length>0)J.className=$M(this.classes);for(var Z=0;Z<this.children.length;Z++)J.appendChild(this.children[Z].toNode());return J}toMarkup(){var J="<"+this.type;for(var Q in this.attributes)if(Object.prototype.hasOwnProperty.call(this.attributes,Q))J+=" "+Q+'="',J+=K8.escape(this.attributes[Q]),J+='"';if(this.classes.length>0)J+=' class ="'+K8.escape($M(this.classes))+'"';J+=">";for(var Z=0;Z<this.children.length;Z++)J+=this.children[Z].toMarkup();return J+="</"+this.type+">",J}toText(){return this.children.map((J)=>J.toText()).join("")}},qf=class{static{D(this,"TextNode")}constructor(J){this.text=void 0,this.text=J}toNode(){return document.createTextNode(this.text)}toMarkup(){return K8.escape(this.toText())}toText(){return this.text}},nN8=class{static{D(this,"SpaceNode")}constructor(J){if(this.width=void 0,this.character=void 0,this.width=J,J>=0.05555&&J<=0.05556)this.character=" ";else if(J>=0.1666&&J<=0.1667)this.character=" ";else if(J>=0.2222&&J<=0.2223)this.character=" ";else if(J>=0.2777&&J<=0.2778)this.character=" ";else if(J>=-0.05556&&J<=-0.05555)this.character=" ";else if(J>=-0.1667&&J<=-0.1666)this.character=" ";else if(J>=-0.2223&&J<=-0.2222)this.character=" ";else if(J>=-0.2778&&J<=-0.2777)this.character=" ";else this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);else{var J=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return J.setAttribute("width",J6(this.width)),J}}toMarkup(){if(this.character)return"<mtext>"+this.character+"</mtext>";else return'<mspace width="'+J6(this.width)+'"/>'}toText(){if(this.character)return this.character;else return" "}},g0={MathNode:XK,TextNode:qf,SpaceNode:nN8,newDocumentFragment:OO1},GK=D(function(Q,Z,X){if(X4[Z][Q]&&X4[Z][Q].replace&&Q.charCodeAt(0)!==55349&&!(ij0.hasOwnProperty(Q)&&X&&(X.fontFamily&&X.fontFamily.slice(4,6)==="tt"||X.font&&X.font.slice(4,6)==="tt")))Q=X4[Z][Q].replace;return new g0.TextNode(Q)},"makeText"),jO1=D(function(Q){if(Q.length===1)return Q[0];else return new g0.MathNode("mrow",Q)},"makeRow"),$O1=D(function(Q,Z){if(Z.fontFamily==="texttt")return"monospace";else if(Z.fontFamily==="textsf")if(Z.fontShape==="textit"&&Z.fontWeight==="textbf")return"sans-serif-bold-italic";else if(Z.fontShape==="textit")return"sans-serif-italic";else if(Z.fontWeight==="textbf")return"bold-sans-serif";else return"sans-serif";else if(Z.fontShape==="textit"&&Z.fontWeight==="textbf")return"bold-italic";else if(Z.fontShape==="textit")return"italic";else if(Z.fontWeight==="textbf")return"bold";var X=Z.font;if(!X||X==="mathnormal")return null;var Y=Q.mode;if(X==="mathit")return"italic";else if(X==="boldsymbol")return Q.type==="textord"?"bold":"bold-italic";else if(X==="mathbf")return"bold";else if(X==="mathbb")return"double-struck";else if(X==="mathfrak")return"fraktur";else if(X==="mathscr"||X==="mathcal")return"script";else if(X==="mathsf")return"sans-serif";else if(X==="mathtt")return"monospace";var K=Q.text;if(K8.contains(["\\imath","\\jmath"],K))return null;if(X4[Y][K]&&X4[Y][K].replace)K=X4[Y][K].replace;var G=Y0.fontMap[X].fontName;if(p11(K,G,Y))return Y0.fontMap[X].variant;return null},"getVariant"),dZ=D(function(Q,Z,X){if(Q.length===1){var Y=r2(Q[0],Z);if(X&&Y instanceof XK&&Y.type==="mo")Y.setAttribute("lspace","0em"),Y.setAttribute("rspace","0em");return[Y]}var K=[],G;for(var q=0;q<Q.length;q++){var z=r2(Q[q],Z);if(z instanceof XK&&G instanceof XK){if(z.type==="mtext"&&G.type==="mtext"&&z.getAttribute("mathvariant")===G.getAttribute("mathvariant")){G.children.push(...z.children);continue}else if(z.type==="mn"&&G.type==="mn"){G.children.push(...z.children);continue}else if(z.type==="mi"&&z.children.length===1&&G.type==="mn"){var U=z.children[0];if(U instanceof qf&&U.text==="."){G.children.push(...z.children);continue}}else if(G.type==="mi"&&G.children.length===1){var W=G.children[0];if(W instanceof qf&&W.text==="̸"&&(z.type==="mo"||z.type==="mi"||z.type==="mn")){var F=z.children[0];if(F instanceof qf&&F.text.length>0)F.text=F.text.slice(0,1)+"̸"+F.text.slice(1),K.pop()}}}K.push(z),G=z}return K},"buildExpression"),IM=D(function(Q,Z,X){return jO1(dZ(Q,Z,X))},"buildExpressionRow"),r2=D(function(Q,Z){if(!Q)return new g0.MathNode("mrow");if(g11[Q.type]){var X=g11[Q.type](Q,Z);return X}else throw new r0("Got group of unknown type: '"+Q.type+"'")},"buildGroup");D(FO1,"buildMathML");ej0=D(function(Q){return new mj0({style:Q.displayMode?H8.DISPLAY:H8.TEXT,maxSize:Q.maxSize,minRuleThickness:Q.minRuleThickness})},"optionsFromSettings"),J$0=D(function(Q,Z){if(Z.displayMode){var X=["katex-display"];if(Z.leqno)X.push("leqno");if(Z.fleqn)X.push("fleqn");Q=Y0.makeSpan(X,[Q])}return Q},"displayWrap"),aN8=D(function(Q,Z,X){var Y=ej0(X),K;if(X.output==="mathml")return FO1(Q,Z,Y,X.displayMode,!0);else if(X.output==="html"){var G=u11(Q,Y);K=Y0.makeSpan(["katex"],[G])}else{var q=FO1(Q,Z,Y,X.displayMode,!1),z=u11(Q,Y);K=Y0.makeSpan(["katex"],[q,z])}return J$0(K,X)},"buildTree"),rN8=D(function(Q,Z,X){var Y=ej0(X),K=u11(Q,Y),G=Y0.makeSpan(["katex"],[K]);return J$0(G,X)},"buildHTMLTree"),sN8={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},oN8=D(function(Q){var Z=new g0.MathNode("mo",[new g0.TextNode(sN8[Q.replace(/^\\/,"")])]);return Z.setAttribute("stretchy","true"),Z},"mathMLnode"),tN8={overrightarrow:[["rightarrow"],0.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],0.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],0.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],0.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],0.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],0.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],0.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],0.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],0.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],0.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],0.888,522,"xMaxYMin"],xlongequal:[["longequal"],0.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],0.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],0.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],0.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],0.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],0.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],0.888,522],overgroup:[["leftgroup","rightgroup"],0.888,342],undergroup:[["leftgroupunder","rightgroupunder"],0.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},eN8=D(function(Q){if(Q.type==="ordgroup")return Q.body.length;else return 1},"groupLength"),J38=D(function(Q,Z){function X(){var q=400000,z=Q.label.slice(1);if(K8.contains(["widehat","widecheck","widetilde","utilde"],z)){var U=Q,W=eN8(U.base),F,H,B;if(W>5)if(z==="widehat"||z==="widecheck")F=420,q=2364,B=0.42,H=z+"4";else F=312,q=2340,B=0.34,H="tilde4";else{var M=[1,1,2,2,3,3][W];if(z==="widehat"||z==="widecheck")q=[0,1062,2364,2364,2364][M],F=[0,239,300,360,420][M],B=[0,0.24,0.3,0.3,0.36,0.42][M],H=z+M;else q=[0,600,1033,2339,2340][M],F=[0,260,286,306,312][M],B=[0,0.26,0.286,0.3,0.306,0.34][M],H="tilde"+M}var V=new EM(H),N=new lF([V],{width:"100%",height:J6(B),viewBox:"0 0 "+q+" "+F,preserveAspectRatio:"none"});return{span:Y0.makeSvgSpan([],[N],Z),minWidth:0,height:B}}else{var L=[],A=tN8[z],[w,R,O]=A,j=O/1000,$=w.length,E,I;if($===1){var T=A[3];E=["hide-tail"],I=[T]}else if($===2)E=["halfarrow-left","halfarrow-right"],I=["xMinYMin","xMaxYMin"];else if($===3)E=["brace-left","brace-center","brace-right"],I=["xMinYMin","xMidYMin","xMaxYMin"];else throw Error(`Correct katexImagesData or update code here to support
|
|
2297
|
-
`+$+" children.");for(var S=0;S<$;S++){var x=new EM(w[S]),h=new lF([x],{width:"400em",height:J6(j),viewBox:"0 0 "+q+" "+O,preserveAspectRatio:I[S]+" slice"}),v=Y0.makeSvgSpan([E[S]],[h],Z);if($===1)return{span:v,minWidth:R,height:j};else v.style.height=J6(j),L.push(v)}return{span:Y0.makeSpan(["stretchy"],L,Z),minWidth:R,height:j}}}D(X,"buildSvgSpan_");var{span:Y,minWidth:K,height:G}=X();if(Y.height=G,Y.style.height=J6(G),K>0)Y.style.minWidth=J6(K);return Y},"svgSpan"),Q38=D(function(Q,Z,X,Y,K){var G,q=Q.height+Q.depth+X+Y;if(/fbox|color|angl/.test(Z)){if(G=Y0.makeSpan(["stretchy",Z],[],K),Z==="fbox"){var z=K.color&&K.getColor();if(z)G.style.borderColor=z}}else{var U=[];if(/^[bx]cancel$/.test(Z))U.push(new qO1({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"}));if(/^x?cancel$/.test(Z))U.push(new qO1({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var W=new lF(U,{width:"100%",height:J6(q)});G=Y0.makeSvgSpan([],[W],K)}return G.height=q,G.style.height=J6(q),G},"encloseSpan"),nF={encloseSpan:Q38,mathMLnode:oN8,svgSpan:J38};D(a8,"assertNodeType");D(l11,"assertSymbolNodeType");D(Bf,"checkSymbolNodeType");EO1=D((J,Q)=>{var Z,X,Y;if(J&&J.type==="supsub")X=a8(J.base,"accent"),Z=X.base,J.base=Z,Y=lj0(J2(J,Q)),J.base=X;else X=a8(J,"accent"),Z=X.base;var K=J2(Z,Q.havingCrampedStyle()),G=X.isShifty&&K8.isCharacterBox(Z),q=0;if(G){var z=K8.getBaseElem(Z),U=J2(z,Q.havingCrampedStyle());q=zO1(U).skew}var W=X.label==="\\c",F=W?K.height+K.depth:Math.min(K.height,Q.fontMetrics().xHeight),H;if(!X.isStretchy){var B,M;if(X.label==="\\vec")B=Y0.staticSvg("vec",Q),M=Y0.svgData.vec[1];else if(B=Y0.makeOrd({mode:X.mode,text:X.label},Q,"textord"),B=zO1(B),B.italic=0,M=B.width,W)F+=B.depth;H=Y0.makeSpan(["accent-body"],[B]);var V=X.label==="\\textcircled";if(V)H.classes.push("accent-full"),F=K.height;var N=q;if(!V)N-=M/2;if(H.style.left=J6(N),X.label==="\\textcircled")H.style.top=".2em";H=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"kern",size:-F},{type:"elem",elem:H}]},Q)}else H=nF.svgSpan(X,Q),H=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"elem",elem:H,wrapperClasses:["svg-align"],wrapperStyle:q>0?{width:"calc(100% - "+J6(2*q)+")",marginLeft:J6(2*q)}:void 0}]},Q);var L=Y0.makeSpan(["mord","accent"],[H],Q);if(Y)return Y.children[0]=L,Y.height=Math.max(L.height,Y.height),Y.classes[0]="mord",Y;else return L},"htmlBuilder$a"),Q$0=D((J,Q)=>{var Z=J.isStretchy?nF.mathMLnode(J.label):new g0.MathNode("mo",[GK(J.label,J.mode)]),X=new g0.MathNode("mover",[r2(J.base,Q),Z]);return X.setAttribute("accent","true"),X},"mathmlBuilder$9"),Z38=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((J)=>"\\"+J).join("|"));H6({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:D((J,Q)=>{var Z=m11(Q[0]),X=!Z38.test(J.funcName),Y=!X||J.funcName==="\\widehat"||J.funcName==="\\widetilde"||J.funcName==="\\widecheck";return{type:"accent",mode:J.parser.mode,label:J.funcName,isStretchy:X,isShifty:Y,base:Z}},"handler"),htmlBuilder:EO1,mathmlBuilder:Q$0});H6({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.","\\\"","\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:D((J,Q)=>{var Z=Q[0],X=J.parser.mode;if(X==="math")J.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+J.funcName+" works only in text mode"),X="text";return{type:"accent",mode:X,label:J.funcName,isStretchy:!1,isShifty:!0,base:Z}},"handler"),htmlBuilder:EO1,mathmlBuilder:Q$0});H6({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"accentUnder",mode:Z.mode,label:X,base:Y}},"handler"),htmlBuilder:D((J,Q)=>{var Z=J2(J.base,Q),X=nF.svgSpan(J,Q),Y=J.label==="\\utilde"?0.12:0,K=Y0.makeVList({positionType:"top",positionData:Z.height,children:[{type:"elem",elem:X,wrapperClasses:["svg-align"]},{type:"kern",size:Y},{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord","accentunder"],[K],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=nF.mathMLnode(J.label),X=new g0.MathNode("munder",[r2(J.base,Q),Z]);return X.setAttribute("accentunder","true"),X},"mathmlBuilder")});v11=D((J)=>{var Q=new g0.MathNode("mpadded",J?[J]:[]);return Q.setAttribute("width","+0.6em"),Q.setAttribute("lspace","0.3em"),Q},"paddedNode");H6({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(J,Q,Z){var{parser:X,funcName:Y}=J;return{type:"xArrow",mode:X.mode,label:Y,body:Q[0],below:Z[0]}},htmlBuilder(J,Q){var Z=Q.style,X=Q.havingStyle(Z.sup()),Y=Y0.wrapFragment(J2(J.body,X,Q),Q),K=J.label.slice(0,2)==="\\x"?"x":"cd";Y.classes.push(K+"-arrow-pad");var G;if(J.below)X=Q.havingStyle(Z.sub()),G=Y0.wrapFragment(J2(J.below,X,Q),Q),G.classes.push(K+"-arrow-pad");var q=nF.svgSpan(J,Q),z=-Q.fontMetrics().axisHeight+0.5*q.height,U=-Q.fontMetrics().axisHeight-0.5*q.height-0.111;if(Y.depth>0.25||J.label==="\\xleftequilibrium")U-=Y.depth;var W;if(G){var F=-Q.fontMetrics().axisHeight+G.height+0.5*q.height+0.111;W=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Y,shift:U},{type:"elem",elem:q,shift:z},{type:"elem",elem:G,shift:F}]},Q)}else W=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Y,shift:U},{type:"elem",elem:q,shift:z}]},Q);return W.children[0].children[0].children[1].classes.push("svg-align"),Y0.makeSpan(["mrel","x-arrow"],[W],Q)},mathmlBuilder(J,Q){var Z=nF.mathMLnode(J.label);Z.setAttribute("minsize",J.label.charAt(0)==="x"?"1.75em":"3.0em");var X;if(J.body){var Y=v11(r2(J.body,Q));if(J.below){var K=v11(r2(J.below,Q));X=new g0.MathNode("munderover",[Z,K,Y])}else X=new g0.MathNode("mover",[Z,Y])}else if(J.below){var G=v11(r2(J.below,Q));X=new g0.MathNode("munder",[Z,G])}else X=v11(),X=new g0.MathNode("mover",[Z,X]);return X}});X38=Y0.makeSpan;D(IO1,"htmlBuilder$9");D(PO1,"mathmlBuilder$8");H6({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"mclass",mode:Z.mode,mclass:"m"+X.slice(5),body:N7(Y),isCharacterBox:K8.isCharacterBox(Y)}},htmlBuilder:IO1,mathmlBuilder:PO1});i11=D((J)=>{var Q=J.type==="ordgroup"&&J.body.length?J.body[0]:J;if(Q.type==="atom"&&(Q.family==="bin"||Q.family==="rel"))return"m"+Q.family;else return"mord"},"binrelClass");H6({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(J,Q){var{parser:Z}=J;return{type:"mclass",mode:Z.mode,mclass:i11(Q[0]),body:N7(Q[1]),isCharacterBox:K8.isCharacterBox(Q[1])}}});H6({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[1],K=Q[0],G;if(X!=="\\stackrel")G=i11(Y);else G="mrel";var q={type:"op",mode:Y.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:X!=="\\stackrel",body:N7(Y)},z={type:"supsub",mode:K.mode,base:q,sup:X==="\\underset"?null:K,sub:X==="\\underset"?K:null};return{type:"mclass",mode:Z.mode,mclass:G,body:[z],isCharacterBox:K8.isCharacterBox(z)}},htmlBuilder:IO1,mathmlBuilder:PO1});H6({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"pmb",mode:Z.mode,mclass:i11(Q[0]),body:N7(Q[0])}},htmlBuilder(J,Q){var Z=H5(J.body,Q,!0),X=Y0.makeSpan([J.mclass],Z,Q);return X.style.textShadow="0.02em 0.01em 0.04px",X},mathmlBuilder(J,Q){var Z=dZ(J.body,Q),X=new g0.MathNode("mstyle",Z);return X.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),X}});Y38={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Dj0=D(()=>{return{type:"styling",body:[],mode:"math",style:"display"}},"newCell"),Mj0=D((J)=>{return J.type==="textord"&&J.text==="@"},"isStartOfArrow"),K38=D((J,Q)=>{return(J.type==="mathord"||J.type==="atom")&&J.text===Q},"isLabelEnd");D(Z$0,"cdArrow");D(X$0,"parseCD");H6({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J;return{type:"cdlabel",mode:Z.mode,side:X.slice(4),label:Q[0]}},htmlBuilder(J,Q){var Z=Q.havingStyle(Q.style.sup()),X=Y0.wrapFragment(J2(J.label,Z,Q),Q);return X.classes.push("cd-label-"+J.side),X.style.bottom=J6(0.8-X.depth),X.height=0,X.depth=0,X},mathmlBuilder(J,Q){var Z=new g0.MathNode("mrow",[r2(J.label,Q)]);if(Z=new g0.MathNode("mpadded",[Z]),Z.setAttribute("width","0"),J.side==="left")Z.setAttribute("lspace","-1width");return Z.setAttribute("voffset","0.7em"),Z=new g0.MathNode("mstyle",[Z]),Z.setAttribute("displaystyle","false"),Z.setAttribute("scriptlevel","1"),Z}});H6({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(J,Q){var{parser:Z}=J;return{type:"cdlabelparent",mode:Z.mode,fragment:Q[0]}},htmlBuilder(J,Q){var Z=Y0.wrapFragment(J2(J.fragment,Q),Q);return Z.classes.push("cd-vert-arrow"),Z},mathmlBuilder(J,Q){return new g0.MathNode("mrow",[r2(J.fragment,Q)])}});H6({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"ordgroup"),Y=X.body,K="";for(var G=0;G<Y.length;G++){var q=a8(Y[G],"textord");K+=q.text}var z=parseInt(K),U;if(isNaN(z))throw new r0("\\@char has non-numeric argument "+K);else if(z<0||z>=1114111)throw new r0("\\@char with invalid code point "+K);else if(z<=65535)U=String.fromCharCode(z);else z-=65536,U=String.fromCharCode((z>>10)+55296,(z&1023)+56320);return{type:"textord",mode:Z.mode,text:U}}});Y$0=D((J,Q)=>{var Z=H5(J.body,Q.withColor(J.color),!1);return Y0.makeFragment(Z)},"htmlBuilder$8"),K$0=D((J,Q)=>{var Z=dZ(J.body,Q.withColor(J.color)),X=new g0.MathNode("mstyle",Z);return X.setAttribute("mathcolor",J.color),X},"mathmlBuilder$7");H6({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"color-token").color,Y=Q[1];return{type:"color",mode:Z.mode,color:X,body:N7(Y)}},htmlBuilder:Y$0,mathmlBuilder:K$0});H6({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(J,Q){var{parser:Z,breakOnTokenText:X}=J,Y=a8(Q[0],"color-token").color;Z.gullet.macros.set("\\current@color",Y);var K=Z.parseExpression(!0,X);return{type:"color",mode:Z.mode,color:Y,body:K}},htmlBuilder:Y$0,mathmlBuilder:K$0});H6({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(J,Q,Z){var{parser:X}=J,Y=X.gullet.future().text==="["?X.parseSizeGroup(!0):null,K=!X.settings.displayMode||!X.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:X.mode,newLine:K,size:Y&&a8(Y,"size").value}},htmlBuilder(J,Q){var Z=Y0.makeSpan(["mspace"],[],Q);if(J.newLine){if(Z.classes.push("newline"),J.size)Z.style.marginTop=J6(h4(J.size,Q))}return Z},mathmlBuilder(J,Q){var Z=new g0.MathNode("mspace");if(J.newLine){if(Z.setAttribute("linebreak","newline"),J.size)Z.setAttribute("height",J6(h4(J.size,Q)))}return Z}});HO1={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},G$0=D((J)=>{var Q=J.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(Q))throw new r0("Expected a control sequence",J);return Q},"checkControlSequence"),G38=D((J)=>{var Q=J.gullet.popToken();if(Q.text==="="){if(Q=J.gullet.popToken(),Q.text===" ")Q=J.gullet.popToken()}return Q},"getRHS"),q$0=D((J,Q,Z,X)=>{var Y=J.gullet.macros.get(Z.text);if(Y==null)Z.noexpand=!0,Y={tokens:[Z],numArgs:0,unexpandable:!J.gullet.isExpandable(Z.text)};J.gullet.macros.set(Q,Y,X)},"letCommand");H6({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(J){var{parser:Q,funcName:Z}=J;Q.consumeSpaces();var X=Q.fetch();if(HO1[X.text]){if(Z==="\\global"||Z==="\\\\globallong")X.text=HO1[X.text];return a8(Q.parseFunction(),"internal")}throw new r0("Invalid token after macro prefix",X)}});H6({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=Q.gullet.popToken(),Y=X.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(Y))throw new r0("Expected a control sequence",X);var K=0,G,q=[[]];while(Q.gullet.future().text!=="{")if(X=Q.gullet.popToken(),X.text==="#"){if(Q.gullet.future().text==="{"){G=Q.gullet.future(),q[K].push("{");break}if(X=Q.gullet.popToken(),!/^[1-9]$/.test(X.text))throw new r0('Invalid argument number "'+X.text+'"');if(parseInt(X.text)!==K+1)throw new r0('Argument number "'+X.text+'" out of order');K++,q.push([])}else if(X.text==="EOF")throw new r0("Expected a macro definition");else q[K].push(X.text);var{tokens:z}=Q.gullet.consumeArg();if(G)z.unshift(G);if(Z==="\\edef"||Z==="\\xdef")z=Q.gullet.expandTokens(z),z.reverse();return Q.gullet.macros.set(Y,{tokens:z,numArgs:K,delimiters:q},Z===HO1[Z]),{type:"internal",mode:Q.mode}}});H6({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=G$0(Q.gullet.popToken());Q.gullet.consumeSpaces();var Y=G38(Q);return q$0(Q,X,Y,Z==="\\\\globallet"),{type:"internal",mode:Q.mode}}});H6({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=G$0(Q.gullet.popToken()),Y=Q.gullet.popToken(),K=Q.gullet.popToken();return q$0(Q,X,K,Z==="\\\\globalfuture"),Q.gullet.pushToken(K),Q.gullet.pushToken(Y),{type:"internal",mode:Q.mode}}});Gf=D(function(Q,Z,X){var Y=X4.math[Q]&&X4.math[Q].replace,K=p11(Y||Q,Z,X);if(!K)throw Error("Unsupported symbol "+Q+" and font size "+Z+".");return K},"getMetrics"),TO1=D(function(Q,Z,X,Y){var K=X.havingBaseStyle(Z),G=Y0.makeSpan(Y.concat(K.sizingClasses(X)),[Q],X),q=K.sizeMultiplier/X.sizeMultiplier;return G.height*=q,G.depth*=q,G.maxFontSize=K.sizeMultiplier,G},"styleWrap"),z$0=D(function(Q,Z,X){var Y=Z.havingBaseStyle(X),K=(1-Z.sizeMultiplier/Y.sizeMultiplier)*Z.fontMetrics().axisHeight;Q.classes.push("delimcenter"),Q.style.top=J6(K),Q.height-=K,Q.depth+=K},"centerSpan"),q38=D(function(Q,Z,X,Y,K,G){var q=Y0.makeSymbol(Q,"Main-Regular",K,Y),z=TO1(q,Z,Y,G);if(X)z$0(z,Y,Z);return z},"makeSmallDelim"),z38=D(function(Q,Z,X,Y){return Y0.makeSymbol(Q,"Size"+Z+"-Regular",X,Y)},"mathrmSize"),U$0=D(function(Q,Z,X,Y,K,G){var q=z38(Q,Z,K,Y),z=TO1(Y0.makeSpan(["delimsizing","size"+Z],[q],Y),H8.TEXT,Y,G);if(X)z$0(z,Y,H8.TEXT);return z},"makeLargeDelim"),sR1=D(function(Q,Z,X){var Y;if(Z==="Size1-Regular")Y="delim-size1";else Y="delim-size4";var K=Y0.makeSpan(["delimsizinginner",Y],[Y0.makeSpan([],[Y0.makeSymbol(Q,Z,X)])]);return{type:"elem",elem:K}},"makeGlyphSpan"),oR1=D(function(Q,Z,X){var Y=YU["Size4-Regular"][Q.charCodeAt(0)]?YU["Size4-Regular"][Q.charCodeAt(0)][4]:YU["Size1-Regular"][Q.charCodeAt(0)][4],K=new EM("inner",AN8(Q,Math.round(1000*Z))),G=new lF([K],{width:J6(Y),height:J6(Z),style:"width:"+J6(Y),viewBox:"0 0 "+1000*Y+" "+Math.round(1000*Z),preserveAspectRatio:"xMinYMin"}),q=Y0.makeSvgSpan([],[G],X);return q.height=Z,q.style.height=J6(Z),q.style.width=J6(Y),{type:"elem",elem:q}},"makeInner"),k11={type:"kern",size:-1*BO1},U38=["|","\\lvert","\\rvert","\\vert"],W38=["\\|","\\lVert","\\rVert","\\Vert"],W$0=D(function(Q,Z,X,Y,K,G){var q,z,U,W,F="",H=0;q=U=W=Q,z=null;var B="Size1-Regular";if(Q==="\\uparrow")U=W="⏐";else if(Q==="\\Uparrow")U=W="‖";else if(Q==="\\downarrow")q=U="⏐";else if(Q==="\\Downarrow")q=U="‖";else if(Q==="\\updownarrow")q="\\uparrow",U="⏐",W="\\downarrow";else if(Q==="\\Updownarrow")q="\\Uparrow",U="‖",W="\\Downarrow";else if(K8.contains(U38,Q))U="∣",F="vert",H=333;else if(K8.contains(W38,Q))U="∥",F="doublevert",H=556;else if(Q==="["||Q==="\\lbrack")q="⎡",U="⎢",W="⎣",B="Size4-Regular",F="lbrack",H=667;else if(Q==="]"||Q==="\\rbrack")q="⎤",U="⎥",W="⎦",B="Size4-Regular",F="rbrack",H=667;else if(Q==="\\lfloor"||Q==="⌊")U=q="⎢",W="⎣",B="Size4-Regular",F="lfloor",H=667;else if(Q==="\\lceil"||Q==="⌈")q="⎡",U=W="⎢",B="Size4-Regular",F="lceil",H=667;else if(Q==="\\rfloor"||Q==="⌋")U=q="⎥",W="⎦",B="Size4-Regular",F="rfloor",H=667;else if(Q==="\\rceil"||Q==="⌉")q="⎤",U=W="⎥",B="Size4-Regular",F="rceil",H=667;else if(Q==="("||Q==="\\lparen")q="⎛",U="⎜",W="⎝",B="Size4-Regular",F="lparen",H=875;else if(Q===")"||Q==="\\rparen")q="⎞",U="⎟",W="⎠",B="Size4-Regular",F="rparen",H=875;else if(Q==="\\{"||Q==="\\lbrace")q="⎧",z="⎨",W="⎩",U="⎪",B="Size4-Regular";else if(Q==="\\}"||Q==="\\rbrace")q="⎫",z="⎬",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\lgroup"||Q==="⟮")q="⎧",W="⎩",U="⎪",B="Size4-Regular";else if(Q==="\\rgroup"||Q==="⟯")q="⎫",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\lmoustache"||Q==="⎰")q="⎧",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\rmoustache"||Q==="⎱")q="⎫",W="⎩",U="⎪",B="Size4-Regular";var M=Gf(q,B,K),V=M.height+M.depth,N=Gf(U,B,K),L=N.height+N.depth,A=Gf(W,B,K),w=A.height+A.depth,R=0,O=1;if(z!==null){var j=Gf(z,B,K);R=j.height+j.depth,O=2}var $=V+w+R,E=Math.max(0,Math.ceil((Z-$)/(O*L))),I=$+E*O*L,T=Y.fontMetrics().axisHeight;if(X)T*=Y.sizeMultiplier;var S=I/2-T,x=[];if(F.length>0){var h=I-V-w,v=Math.round(I*1000),_=wN8(F,Math.round(h*1000)),b=new EM(F,_),g=(H/1000).toFixed(3)+"em",k=(v/1000).toFixed(3)+"em",y=new lF([b],{width:g,height:k,viewBox:"0 0 "+H+" "+v}),f=Y0.makeSvgSpan([],[y],Y);f.height=v/1000,f.style.width=g,f.style.height=k,x.push({type:"elem",elem:f})}else{if(x.push(sR1(W,B,K)),x.push(k11),z===null){var m=I-V-w+2*BO1;x.push(oR1(U,m,Y))}else{var n=(I-V-w-R)/2+2*BO1;x.push(oR1(U,n,Y)),x.push(k11),x.push(sR1(z,B,K)),x.push(k11),x.push(oR1(U,n,Y))}x.push(k11),x.push(sR1(q,B,K))}var p=Y.havingBaseStyle(H8.TEXT),e=Y0.makeVList({positionType:"bottom",positionData:S,children:x},p);return TO1(Y0.makeSpan(["delimsizing","mult"],[e],p),H8.TEXT,Y,G)},"makeStackedDelim"),JO1=D(function(Q,Z,X,Y,K){var G=LN8(Q,Y,X),q=new EM(Q,G),z=new lF([q],{width:"400em",height:J6(Z),viewBox:"0 0 400000 "+X,preserveAspectRatio:"xMinYMin slice"});return Y0.makeSvgSpan(["hide-tail"],[z],K)},"sqrtSvg"),F38=D(function(Q,Z){var X=Z.havingBaseSizing(),Y=D$0("\\surd",Q*X.sizeMultiplier,B$0,X),K=X.sizeMultiplier,G=Math.max(0,Z.minRuleThickness-Z.fontMetrics().sqrtRuleThickness),q,z=0,U=0,W=0,F;if(Y.type==="small"){if(W=1000+1000*G+tR1,Q<1)K=1;else if(Q<1.4)K=0.7;z=(1+G+eR1)/K,U=(1+G)/K,q=JO1("sqrtMain",z,W,G,Z),q.style.minWidth="0.853em",F=0.833/K}else if(Y.type==="large")W=(1000+tR1)*zf[Y.size],U=(zf[Y.size]+G)/K,z=(zf[Y.size]+G+eR1)/K,q=JO1("sqrtSize"+Y.size,z,W,G,Z),q.style.minWidth="1.02em",F=1/K;else z=Q+G+eR1,U=Q+G,W=Math.floor(1000*Q+G)+tR1,q=JO1("sqrtTall",z,W,G,Z),q.style.minWidth="0.742em",F=1.056;return q.height=U,q.style.height=J6(z),{span:q,advanceWidth:F,ruleWidth:(Z.fontMetrics().sqrtRuleThickness+G)*K}},"makeSqrtImage"),F$0=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],H38=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],H$0=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],zf=[0,1.2,1.8,2.4,3],B38=D(function(Q,Z,X,Y,K){if(Q==="<"||Q==="\\lt"||Q==="⟨")Q="\\langle";else if(Q===">"||Q==="\\gt"||Q==="⟩")Q="\\rangle";if(K8.contains(F$0,Q)||K8.contains(H$0,Q))return U$0(Q,Z,!1,X,Y,K);else if(K8.contains(H38,Q))return W$0(Q,zf[Z],!1,X,Y,K);else throw new r0("Illegal delimiter: '"+Q+"'")},"makeSizedDelim"),D38=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],M38=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"stack"}],B$0=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],V38=D(function(Q){if(Q.type==="small")return"Main-Regular";else if(Q.type==="large")return"Size"+Q.size+"-Regular";else if(Q.type==="stack")return"Size4-Regular";else throw Error("Add support for delim type '"+Q.type+"' here.")},"delimTypeToFont"),D$0=D(function(Q,Z,X,Y){var K=Math.min(2,3-Y.style.size);for(var G=K;G<X.length;G++){if(X[G].type==="stack")break;var q=Gf(Q,V38(X[G]),"math"),z=q.height+q.depth;if(X[G].type==="small"){var U=Y.havingBaseStyle(X[G].style);z*=U.sizeMultiplier}if(z>Z)return X[G]}return X[X.length-1]},"traverseSequence"),M$0=D(function(Q,Z,X,Y,K,G){if(Q==="<"||Q==="\\lt"||Q==="⟨")Q="\\langle";else if(Q===">"||Q==="\\gt"||Q==="⟩")Q="\\rangle";var q;if(K8.contains(H$0,Q))q=D38;else if(K8.contains(F$0,Q))q=B$0;else q=M38;var z=D$0(Q,Z,q,Y);if(z.type==="small")return q38(Q,z.style,X,Y,K,G);else if(z.type==="large")return U$0(Q,z.size,X,Y,K,G);else return W$0(Q,Z,X,Y,K,G)},"makeCustomSizedDelim"),N38=D(function(Q,Z,X,Y,K,G){var q=Y.fontMetrics().axisHeight*Y.sizeMultiplier,z=901,U=5/Y.fontMetrics().ptPerEm,W=Math.max(Z-q,X+q),F=Math.max(W/500*z,2*W-U);return M$0(Q,F,!0,Y,K,G)},"makeLeftRightDelim"),cF={sqrtImage:F38,sizedDelim:B38,sizeToMaxHeight:zf,customSizedDelim:M$0,leftRightDelim:N38},Vj0={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},L38=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];D(Df,"checkDelimiter");H6({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:D((J,Q)=>{var Z=Df(Q[0],J);return{type:"delimsizing",mode:J.parser.mode,size:Vj0[J.funcName].size,mclass:Vj0[J.funcName].mclass,delim:Z.text}},"handler"),htmlBuilder:D((J,Q)=>{if(J.delim===".")return Y0.makeSpan([J.mclass]);return cF.sizedDelim(J.delim,J.size,Q,J.mode,[J.mclass])},"htmlBuilder"),mathmlBuilder:D((J)=>{var Q=[];if(J.delim!==".")Q.push(GK(J.delim,J.mode));var Z=new g0.MathNode("mo",Q);if(J.mclass==="mopen"||J.mclass==="mclose")Z.setAttribute("fence","true");else Z.setAttribute("fence","false");Z.setAttribute("stretchy","true");var X=J6(cF.sizeToMaxHeight[J.size]);return Z.setAttribute("minsize",X),Z.setAttribute("maxsize",X),Z},"mathmlBuilder")});D(DO1,"assertParsed");H6({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=J.parser.gullet.macros.get("\\current@color");if(Z&&typeof Z!=="string")throw new r0("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:J.parser.mode,delim:Df(Q[0],J).text,color:Z}},"handler")});H6({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=Df(Q[0],J),X=J.parser;++X.leftrightDepth;var Y=X.parseExpression(!1);--X.leftrightDepth,X.expect("\\right",!1);var K=a8(X.parseFunction(),"leftright-right");return{type:"leftright",mode:X.mode,body:Y,left:Z.text,right:K.delim,rightColor:K.color}},"handler"),htmlBuilder:D((J,Q)=>{DO1(J);var Z=H5(J.body,Q,!0,["mopen","mclose"]),X=0,Y=0,K=!1;for(var G=0;G<Z.length;G++)if(Z[G].isMiddle)K=!0;else X=Math.max(Z[G].height,X),Y=Math.max(Z[G].depth,Y);X*=Q.sizeMultiplier,Y*=Q.sizeMultiplier;var q;if(J.left===".")q=Wf(Q,["mopen"]);else q=cF.leftRightDelim(J.left,X,Y,Q,J.mode,["mopen"]);if(Z.unshift(q),K)for(var z=1;z<Z.length;z++){var U=Z[z],W=U.isMiddle;if(W)Z[z]=cF.leftRightDelim(W.delim,X,Y,W.options,J.mode,[])}var F;if(J.right===".")F=Wf(Q,["mclose"]);else{var H=J.rightColor?Q.withColor(J.rightColor):Q;F=cF.leftRightDelim(J.right,X,Y,H,J.mode,["mclose"])}return Z.push(F),Y0.makeSpan(["minner"],Z,Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{DO1(J);var Z=dZ(J.body,Q);if(J.left!=="."){var X=new g0.MathNode("mo",[GK(J.left,J.mode)]);X.setAttribute("fence","true"),Z.unshift(X)}if(J.right!=="."){var Y=new g0.MathNode("mo",[GK(J.right,J.mode)]);if(Y.setAttribute("fence","true"),J.rightColor)Y.setAttribute("mathcolor",J.rightColor);Z.push(Y)}return jO1(Z)},"mathmlBuilder")});H6({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=Df(Q[0],J);if(!J.parser.leftrightDepth)throw new r0("\\middle without preceding \\left",Z);return{type:"middle",mode:J.parser.mode,delim:Z.text}},"handler"),htmlBuilder:D((J,Q)=>{var Z;if(J.delim===".")Z=Wf(Q,[]);else{Z=cF.sizedDelim(J.delim,1,Q,J.mode,[]);var X={delim:J.delim,options:Q};Z.isMiddle=X}return Z},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=J.delim==="\\vert"||J.delim==="|"?GK("|","text"):GK(J.delim,J.mode),X=new g0.MathNode("mo",[Z]);return X.setAttribute("fence","true"),X.setAttribute("lspace","0.05em"),X.setAttribute("rspace","0.05em"),X},"mathmlBuilder")});CO1=D((J,Q)=>{var Z=Y0.wrapFragment(J2(J.body,Q),Q),X=J.label.slice(1),Y=Q.sizeMultiplier,K,G=0,q=K8.isCharacterBox(J.body);if(X==="sout")K=Y0.makeSpan(["stretchy","sout"]),K.height=Q.fontMetrics().defaultRuleThickness/Y,G=-0.5*Q.fontMetrics().xHeight;else if(X==="phase"){var z=h4({number:0.6,unit:"pt"},Q),U=h4({number:0.35,unit:"ex"},Q),W=Q.havingBaseSizing();Y=Y/W.sizeMultiplier;var F=Z.height+Z.depth+z+U;Z.style.paddingLeft=J6(F/2+z);var H=Math.floor(1000*F*Y),B=VN8(H),M=new lF([new EM("phase",B)],{width:"400em",height:J6(H/1000),viewBox:"0 0 400000 "+H,preserveAspectRatio:"xMinYMin slice"});K=Y0.makeSvgSpan(["hide-tail"],[M],Q),K.style.height=J6(F),G=Z.depth+z+U}else{if(/cancel/.test(X)){if(!q)Z.classes.push("cancel-pad")}else if(X==="angl")Z.classes.push("anglpad");else Z.classes.push("boxpad");var V=0,N=0,L=0;if(/box/.test(X))L=Math.max(Q.fontMetrics().fboxrule,Q.minRuleThickness),V=Q.fontMetrics().fboxsep+(X==="colorbox"?0:L),N=V;else if(X==="angl")L=Math.max(Q.fontMetrics().defaultRuleThickness,Q.minRuleThickness),V=4*L,N=Math.max(0,0.25-Z.depth);else V=q?0.2:0,N=V;if(K=nF.encloseSpan(Z,X,V,N,Q),/fbox|boxed|fcolorbox/.test(X))K.style.borderStyle="solid",K.style.borderWidth=J6(L);else if(X==="angl"&&L!==0.049)K.style.borderTopWidth=J6(L),K.style.borderRightWidth=J6(L);if(G=Z.depth+N,J.backgroundColor){if(K.style.backgroundColor=J.backgroundColor,J.borderColor)K.style.borderColor=J.borderColor}}var A;if(J.backgroundColor)A=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:K,shift:G},{type:"elem",elem:Z,shift:0}]},Q);else{var w=/cancel|phase/.test(X)?["svg-align"]:[];A=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Z,shift:0},{type:"elem",elem:K,shift:G,wrapperClasses:w}]},Q)}if(/cancel/.test(X))A.height=Z.height,A.depth=Z.depth;if(/cancel/.test(X)&&!q)return Y0.makeSpan(["mord","cancel-lap"],[A],Q);else return Y0.makeSpan(["mord"],[A],Q)},"htmlBuilder$7"),SO1=D((J,Q)=>{var Z=0,X=new g0.MathNode(J.label.indexOf("colorbox")>-1?"mpadded":"menclose",[r2(J.body,Q)]);switch(J.label){case"\\cancel":X.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":X.setAttribute("notation","downdiagonalstrike");break;case"\\phase":X.setAttribute("notation","phasorangle");break;case"\\sout":X.setAttribute("notation","horizontalstrike");break;case"\\fbox":X.setAttribute("notation","box");break;case"\\angl":X.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(Z=Q.fontMetrics().fboxsep*Q.fontMetrics().ptPerEm,X.setAttribute("width","+"+2*Z+"pt"),X.setAttribute("height","+"+2*Z+"pt"),X.setAttribute("lspace",Z+"pt"),X.setAttribute("voffset",Z+"pt"),J.label==="\\fcolorbox"){var Y=Math.max(Q.fontMetrics().fboxrule,Q.minRuleThickness);X.setAttribute("style","border: "+Y+"em solid "+String(J.borderColor))}break;case"\\xcancel":X.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}if(J.backgroundColor)X.setAttribute("mathbackground",J.backgroundColor);return X},"mathmlBuilder$6");H6({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(J,Q,Z){var{parser:X,funcName:Y}=J,K=a8(Q[0],"color-token").color,G=Q[1];return{type:"enclose",mode:X.mode,label:Y,backgroundColor:K,body:G}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(J,Q,Z){var{parser:X,funcName:Y}=J,K=a8(Q[0],"color-token").color,G=a8(Q[1],"color-token").color,q=Q[2];return{type:"enclose",mode:X.mode,label:Y,backgroundColor:G,borderColor:K,body:q}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"enclose",mode:Z.mode,label:"\\fbox",body:Q[0]}}});H6({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"enclose",mode:Z.mode,label:X,body:Y}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(J,Q){var{parser:Z}=J;return{type:"enclose",mode:Z.mode,label:"\\angl",body:Q[0]}}});V$0={};D(Kq,"defineEnvironment");N$0={};D(j1,"defineMacro");D(MO1,"getHLines");n11=D((J)=>{var Q=J.parser.settings;if(!Q.displayMode)throw new r0("{"+J.envName+"} can be used only in display mode.")},"validateAmsEnvironmentContext");D(a11,"getAutoTag");D(rF,"parseArray");D(r11,"dCellStyle");GU=D(function(Q,Z){var X,Y,K=Q.body.length,G=Q.hLinesBeforeRow,q=0,z=Array(K),U=[],W=Math.max(Z.fontMetrics().arrayRuleWidth,Z.minRuleThickness),F=1/Z.fontMetrics().ptPerEm,H=5*F;if(Q.colSeparationType&&Q.colSeparationType==="small"){var B=Z.havingStyle(H8.SCRIPT).sizeMultiplier;H=0.2778*(B/Z.sizeMultiplier)}var M=Q.colSeparationType==="CD"?h4({number:3,unit:"ex"},Z):12*F,V=3*F,N=Q.arraystretch*M,L=0.7*N,A=0.3*N,w=0;function R(W1){for(var w1=0;w1<W1.length;++w1){if(w1>0)w+=0.25;U.push({pos:w,isDashed:W1[w1]})}}D(R,"setHLinePos"),R(G[0]);for(X=0;X<Q.body.length;++X){var O=Q.body[X],j=L,$=A;if(q<O.length)q=O.length;var E=Array(O.length);for(Y=0;Y<O.length;++Y){var I=J2(O[Y],Z);if($<I.depth)$=I.depth;if(j<I.height)j=I.height;E[Y]=I}var T=Q.rowGaps[X],S=0;if(T){if(S=h4(T,Z),S>0){if(S+=A,$<S)$=S;S=0}}if(Q.addJot)$+=V;E.height=j,E.depth=$,w+=j,E.pos=w,w+=$+S,z[X]=E,R(G[X+1])}var x=w/2+Z.fontMetrics().axisHeight,h=Q.cols||[],v=[],_,b,g=[];if(Q.tags&&Q.tags.some((W1)=>W1))for(X=0;X<K;++X){var k=z[X],y=k.pos-x,f=Q.tags[X],m=void 0;if(f===!0)m=Y0.makeSpan(["eqn-num"],[],Z);else if(f===!1)m=Y0.makeSpan([],[],Z);else m=Y0.makeSpan([],H5(f,Z,!0),Z);m.depth=k.depth,m.height=k.height,g.push({type:"elem",elem:m,shift:y})}for(Y=0,b=0;Y<q||b<h.length;++Y,++b){var n=h[b]||{},p=!0;while(n.type==="separator"){if(!p)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z.fontMetrics().doubleRuleSep),v.push(_);if(n.separator==="|"||n.separator===":"){var e=n.separator==="|"?"solid":"dashed",G1=Y0.makeSpan(["vertical-separator"],[],Z);G1.style.height=J6(w),G1.style.borderRightWidth=J6(W),G1.style.borderRightStyle=e,G1.style.margin="0 "+J6(-W/2);var U1=w-x;if(U1)G1.style.verticalAlign=J6(-U1);v.push(G1)}else throw new r0("Invalid separator type: "+n.separator);b++,n=h[b]||{},p=!1}if(Y>=q)continue;var Z1=void 0;if(Y>0||Q.hskipBeforeAndAfter){if(Z1=K8.deflt(n.pregap,H),Z1!==0)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z1),v.push(_)}var F1=[];for(X=0;X<K;++X){var l=z[X],d=l[Y];if(!d)continue;var i=l.pos-x;d.depth=l.depth,d.height=l.height,F1.push({type:"elem",elem:d,shift:i})}if(F1=Y0.makeVList({positionType:"individualShift",children:F1},Z),F1=Y0.makeSpan(["col-align-"+(n.align||"c")],[F1]),v.push(F1),Y<q-1||Q.hskipBeforeAndAfter){if(Z1=K8.deflt(n.postgap,H),Z1!==0)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z1),v.push(_)}}if(z=Y0.makeSpan(["mtable"],v),U.length>0){var r=Y0.makeLineSpan("hline",Z,W),o=Y0.makeLineSpan("hdashline",Z,W),Y1=[{type:"elem",elem:z,shift:0}];while(U.length>0){var J1=U.pop(),H1=J1.pos-x;if(J1.isDashed)Y1.push({type:"elem",elem:o,shift:H1});else Y1.push({type:"elem",elem:r,shift:H1})}z=Y0.makeVList({positionType:"individualShift",children:Y1},Z)}if(g.length===0)return Y0.makeSpan(["mord"],[z],Z);else{var z1=Y0.makeVList({positionType:"individualShift",children:g},Z);return z1=Y0.makeSpan(["tag"],[z1],Z),Y0.makeFragment([z,z1])}},"htmlBuilder"),A38={c:"center ",l:"left ",r:"right "},qU=D(function(Q,Z){var X=[],Y=new g0.MathNode("mtd",[],["mtr-glue"]),K=new g0.MathNode("mtd",[],["mml-eqn-num"]);for(var G=0;G<Q.body.length;G++){var q=Q.body[G],z=[];for(var U=0;U<q.length;U++)z.push(new g0.MathNode("mtd",[r2(q[U],Z)]));if(Q.tags&&Q.tags[G])if(z.unshift(Y),z.push(Y),Q.leqno)z.unshift(K);else z.push(K);X.push(new g0.MathNode("mtr",z))}var W=new g0.MathNode("mtable",X),F=Q.arraystretch===0.5?0.1:0.16+Q.arraystretch-1+(Q.addJot?0.09:0);W.setAttribute("rowspacing",J6(F));var H="",B="";if(Q.cols&&Q.cols.length>0){var M=Q.cols,V="",N=!1,L=0,A=M.length;if(M[0].type==="separator")H+="top ",L=1;if(M[M.length-1].type==="separator")H+="bottom ",A-=1;for(var w=L;w<A;w++)if(M[w].type==="align"){if(B+=A38[M[w].align],N)V+="none ";N=!0}else if(M[w].type==="separator"){if(N)V+=M[w].separator==="|"?"solid ":"dashed ",N=!1}if(W.setAttribute("columnalign",B.trim()),/[sd]/.test(V))W.setAttribute("columnlines",V.trim())}if(Q.colSeparationType==="align"){var R=Q.cols||[],O="";for(var j=1;j<R.length;j++)O+=j%2?"0em ":"1em ";W.setAttribute("columnspacing",O.trim())}else if(Q.colSeparationType==="alignat"||Q.colSeparationType==="gather")W.setAttribute("columnspacing","0em");else if(Q.colSeparationType==="small")W.setAttribute("columnspacing","0.2778em");else if(Q.colSeparationType==="CD")W.setAttribute("columnspacing","0.5em");else W.setAttribute("columnspacing","1em");var $="",E=Q.hLinesBeforeRow;H+=E[0].length>0?"left ":"",H+=E[E.length-1].length>0?"right ":"";for(var I=1;I<E.length-1;I++)$+=E[I].length===0?"none ":E[I][0]?"dashed ":"solid ";if(/[sd]/.test($))W.setAttribute("rowlines",$.trim());if(H!=="")W=new g0.MathNode("menclose",[W]),W.setAttribute("notation",H.trim());if(Q.arraystretch&&Q.arraystretch<1)W=new g0.MathNode("mstyle",[W]),W.setAttribute("scriptlevel","1");return W},"mathmlBuilder"),L$0=D(function(Q,Z){if(Q.envName.indexOf("ed")===-1)n11(Q);var X=[],Y=Q.envName.indexOf("at")>-1?"alignat":"align",K=Q.envName==="split",G=rF(Q.parser,{cols:X,addJot:!0,autoTag:K?void 0:a11(Q.envName),emptySingleRow:!0,colSeparationType:Y,maxNumCols:K?2:void 0,leqno:Q.parser.settings.leqno},"display"),q,z=0,U={type:"ordgroup",mode:Q.mode,body:[]};if(Z[0]&&Z[0].type==="ordgroup"){var W="";for(var F=0;F<Z[0].body.length;F++){var H=a8(Z[0].body[F],"textord");W+=H.text}q=Number(W),z=q*2}var B=!z;G.body.forEach(function(L){for(var A=1;A<L.length;A+=2){var w=a8(L[A],"styling"),R=a8(w.body[0],"ordgroup");R.body.unshift(U)}if(!B){var O=L.length/2;if(q<O)throw new r0("Too many math in a row: "+("expected "+q+", but got "+O),L[0])}else if(z<L.length)z=L.length});for(var M=0;M<z;++M){var V="r",N=0;if(M%2===1)V="l";else if(M>0&&B)N=1;X[M]={type:"align",align:V,pregap:N,postgap:0}}return G.colSeparationType=B?"align":"alignat",G},"alignedHandler");Kq({type:"array",names:["array","darray"],props:{numArgs:1},handler(J,Q){var Z=Bf(Q[0]),X=Z?[Q[0]]:a8(Q[0],"ordgroup").body,Y=X.map(function(G){var q=l11(G),z=q.text;if("lcr".indexOf(z)!==-1)return{type:"align",align:z};else if(z==="|")return{type:"separator",separator:"|"};else if(z===":")return{type:"separator",separator:":"};throw new r0("Unknown column alignment: "+z,G)}),K={cols:Y,hskipBeforeAndAfter:!0,maxNumCols:Y.length};return rF(J.parser,K,r11(J.envName))},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(J){var Q={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[J.envName.replace("*","")],Z="c",X={hskipBeforeAndAfter:!1,cols:[{type:"align",align:Z}]};if(J.envName.charAt(J.envName.length-1)==="*"){var Y=J.parser;if(Y.consumeSpaces(),Y.fetch().text==="["){if(Y.consume(),Y.consumeSpaces(),Z=Y.fetch().text,"lcr".indexOf(Z)===-1)throw new r0("Expected l or c or r",Y.nextToken);Y.consume(),Y.consumeSpaces(),Y.expect("]"),Y.consume(),X.cols=[{type:"align",align:Z}]}}var K=rF(J.parser,X,r11(J.envName)),G=Math.max(0,...K.body.map((q)=>q.length));return K.cols=Array(G).fill({type:"align",align:Z}),Q?{type:"leftright",mode:J.mode,body:[K],left:Q[0],right:Q[1],rightColor:void 0}:K},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(J){var Q={arraystretch:0.5},Z=rF(J.parser,Q,"script");return Z.colSeparationType="small",Z},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["subarray"],props:{numArgs:1},handler(J,Q){var Z=Bf(Q[0]),X=Z?[Q[0]]:a8(Q[0],"ordgroup").body,Y=X.map(function(G){var q=l11(G),z=q.text;if("lc".indexOf(z)!==-1)return{type:"align",align:z};throw new r0("Unknown column alignment: "+z,G)});if(Y.length>1)throw new r0("{subarray} can contain only one column");var K={cols:Y,hskipBeforeAndAfter:!1,arraystretch:0.5};if(K=rF(J.parser,K,"script"),K.body.length>0&&K.body[0].length>1)throw new r0("{subarray} can contain only one column");return K},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(J){var Q={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Z=rF(J.parser,Q,r11(J.envName));return{type:"leftright",mode:J.mode,body:[Z],left:J.envName.indexOf("r")>-1?".":"\\{",right:J.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:L$0,htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(J){if(K8.contains(["gather","gather*"],J.envName))n11(J);var Q={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:a11(J.envName),emptySingleRow:!0,leqno:J.parser.settings.leqno};return rF(J.parser,Q,"display")},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:L$0,htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(J){n11(J);var Q={autoTag:a11(J.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:J.parser.settings.leqno};return rF(J.parser,Q,"display")},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["CD"],props:{numArgs:0},handler(J){return n11(J),X$0(J.parser)},htmlBuilder:GU,mathmlBuilder:qU});j1("\\nonumber","\\gdef\\@eqnsw{0}");j1("\\notag","\\nonumber");H6({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(J,Q){throw new r0(J.funcName+" valid only within array environment")}});Nj0=V$0;H6({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];if(Y.type!=="ordgroup")throw new r0("Invalid environment name",Y);var K="";for(var G=0;G<Y.body.length;++G)K+=a8(Y.body[G],"textord").text;if(X==="\\begin"){if(!Nj0.hasOwnProperty(K))throw new r0("No such environment: "+K,Y);var q=Nj0[K],{args:z,optArgs:U}=Z.parseArguments("\\begin{"+K+"}",q),W={mode:Z.mode,envName:K,parser:Z},F=q.handler(W,z,U);Z.expect("\\end",!1);var H=Z.nextToken,B=a8(Z.parseFunction(),"environment");if(B.name!==K)throw new r0("Mismatch: \\begin{"+K+"} matched by \\end{"+B.name+"}",H);return F}return{type:"environment",mode:Z.mode,name:K,nameGroup:Y}}});A$0=D((J,Q)=>{var Z=J.font,X=Q.withFont(Z);return J2(J.body,X)},"htmlBuilder$5"),w$0=D((J,Q)=>{var Z=J.font,X=Q.withFont(Z);return r2(J.body,X)},"mathmlBuilder$4"),Lj0={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};H6({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=m11(Q[0]),K=X;if(K in Lj0)K=Lj0[K];return{type:"font",mode:Z.mode,font:K.slice(1),body:Y}},"handler"),htmlBuilder:A$0,mathmlBuilder:w$0});H6({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0],Y=K8.isCharacterBox(X);return{type:"mclass",mode:Z.mode,mclass:i11(X),body:[{type:"font",mode:Z.mode,font:"boldsymbol",body:X}],isCharacterBox:Y}},"handler")});H6({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X,breakOnTokenText:Y}=J,{mode:K}=Z,G=Z.parseExpression(!0,Y),q="math"+X.slice(1);return{type:"font",mode:K,font:q,body:{type:"ordgroup",mode:Z.mode,body:G}}},"handler"),htmlBuilder:A$0,mathmlBuilder:w$0});R$0=D((J,Q)=>{var Z=Q;if(J==="display")Z=Z.id>=H8.SCRIPT.id?Z.text():H8.DISPLAY;else if(J==="text"&&Z.size===H8.DISPLAY.size)Z=H8.TEXT;else if(J==="script")Z=H8.SCRIPT;else if(J==="scriptscript")Z=H8.SCRIPTSCRIPT;return Z},"adjustStyle"),vO1=D((J,Q)=>{var Z=R$0(J.size,Q.style),X=Z.fracNum(),Y=Z.fracDen(),K;K=Q.havingStyle(X);var G=J2(J.numer,K,Q);if(J.continued){var q=8.5/Q.fontMetrics().ptPerEm,z=3.5/Q.fontMetrics().ptPerEm;G.height=G.height<q?q:G.height,G.depth=G.depth<z?z:G.depth}K=Q.havingStyle(Y);var U=J2(J.denom,K,Q),W,F,H;if(J.hasBarLine){if(J.barSize)F=h4(J.barSize,Q),W=Y0.makeLineSpan("frac-line",Q,F);else W=Y0.makeLineSpan("frac-line",Q);F=W.height,H=W.height}else W=null,F=0,H=Q.fontMetrics().defaultRuleThickness;var B,M,V;if(Z.size===H8.DISPLAY.size||J.size==="display"){if(B=Q.fontMetrics().num1,F>0)M=3*H;else M=7*H;V=Q.fontMetrics().denom1}else{if(F>0)B=Q.fontMetrics().num2,M=H;else B=Q.fontMetrics().num3,M=3*H;V=Q.fontMetrics().denom2}var N;if(!W){var L=B-G.depth-(U.height-V);if(L<M)B+=0.5*(M-L),V+=0.5*(M-L);N=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:U,shift:V},{type:"elem",elem:G,shift:-B}]},Q)}else{var A=Q.fontMetrics().axisHeight;if(B-G.depth-(A+0.5*F)<M)B+=M-(B-G.depth-(A+0.5*F));if(A-0.5*F-(U.height-V)<M)V+=M-(A-0.5*F-(U.height-V));var w=-(A-0.5*F);N=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:U,shift:V},{type:"elem",elem:W,shift:w},{type:"elem",elem:G,shift:-B}]},Q)}K=Q.havingStyle(Z),N.height*=K.sizeMultiplier/Q.sizeMultiplier,N.depth*=K.sizeMultiplier/Q.sizeMultiplier;var R;if(Z.size===H8.DISPLAY.size)R=Q.fontMetrics().delim1;else if(Z.size===H8.SCRIPTSCRIPT.size)R=Q.havingStyle(H8.SCRIPT).fontMetrics().delim2;else R=Q.fontMetrics().delim2;var O,j;if(J.leftDelim==null)O=Wf(Q,["mopen"]);else O=cF.customSizedDelim(J.leftDelim,R,!0,Q.havingStyle(Z),J.mode,["mopen"]);if(J.continued)j=Y0.makeSpan([]);else if(J.rightDelim==null)j=Wf(Q,["mclose"]);else j=cF.customSizedDelim(J.rightDelim,R,!0,Q.havingStyle(Z),J.mode,["mclose"]);return Y0.makeSpan(["mord"].concat(K.sizingClasses(Q)),[O,Y0.makeSpan(["mfrac"],[N]),j],Q)},"htmlBuilder$4"),kO1=D((J,Q)=>{var Z=new g0.MathNode("mfrac",[r2(J.numer,Q),r2(J.denom,Q)]);if(!J.hasBarLine)Z.setAttribute("linethickness","0px");else if(J.barSize){var X=h4(J.barSize,Q);Z.setAttribute("linethickness",J6(X))}var Y=R$0(J.size,Q.style);if(Y.size!==Q.style.size){Z=new g0.MathNode("mstyle",[Z]);var K=Y.size===H8.DISPLAY.size?"true":"false";Z.setAttribute("displaystyle",K),Z.setAttribute("scriptlevel","0")}if(J.leftDelim!=null||J.rightDelim!=null){var G=[];if(J.leftDelim!=null){var q=new g0.MathNode("mo",[new g0.TextNode(J.leftDelim.replace("\\",""))]);q.setAttribute("fence","true"),G.push(q)}if(G.push(Z),J.rightDelim!=null){var z=new g0.MathNode("mo",[new g0.TextNode(J.rightDelim.replace("\\",""))]);z.setAttribute("fence","true"),G.push(z)}return jO1(G)}return Z},"mathmlBuilder$3");H6({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=Q[1],G,q=null,z=null,U="auto";switch(X){case"\\dfrac":case"\\frac":case"\\tfrac":G=!0;break;case"\\\\atopfrac":G=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":G=!1,q="(",z=")";break;case"\\\\bracefrac":G=!1,q="\\{",z="\\}";break;case"\\\\brackfrac":G=!1,q="[",z="]";break;default:throw Error("Unrecognized genfrac command")}switch(X){case"\\dfrac":case"\\dbinom":U="display";break;case"\\tfrac":case"\\tbinom":U="text";break}return{type:"genfrac",mode:Z.mode,continued:!1,numer:Y,denom:K,hasBarLine:G,leftDelim:q,rightDelim:z,size:U,barSize:null}},"handler"),htmlBuilder:vO1,mathmlBuilder:kO1});H6({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=Q[1];return{type:"genfrac",mode:Z.mode,continued:!0,numer:Y,denom:K,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}},"handler")});H6({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(J){var{parser:Q,funcName:Z,token:X}=J,Y;switch(Z){case"\\over":Y="\\frac";break;case"\\choose":Y="\\binom";break;case"\\atop":Y="\\\\atopfrac";break;case"\\brace":Y="\\\\bracefrac";break;case"\\brack":Y="\\\\brackfrac";break;default:throw Error("Unrecognized infix genfrac command")}return{type:"infix",mode:Q.mode,replaceWith:Y,token:X}}});Aj0=["display","text","script","scriptscript"],wj0=D(function(Q){var Z=null;if(Q.length>0)Z=Q,Z=Z==="."?null:Z;return Z},"delimFromValue");H6({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(J,Q){var{parser:Z}=J,X=Q[4],Y=Q[5],K=m11(Q[0]),G=K.type==="atom"&&K.family==="open"?wj0(K.text):null,q=m11(Q[1]),z=q.type==="atom"&&q.family==="close"?wj0(q.text):null,U=a8(Q[2],"size"),W,F=null;if(U.isBlank)W=!0;else F=U.value,W=F.number>0;var H="auto",B=Q[3];if(B.type==="ordgroup"){if(B.body.length>0){var M=a8(B.body[0],"textord");H=Aj0[Number(M.text)]}}else B=a8(B,"textord"),H=Aj0[Number(B.text)];return{type:"genfrac",mode:Z.mode,numer:X,denom:Y,continued:!1,hasBarLine:W,barSize:F,leftDelim:G,rightDelim:z,size:H}},htmlBuilder:vO1,mathmlBuilder:kO1});H6({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(J,Q){var{parser:Z,funcName:X,token:Y}=J;return{type:"infix",mode:Z.mode,replaceWith:"\\\\abovefrac",size:a8(Q[0],"size").value,token:Y}}});H6({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=XN8(a8(Q[1],"infix").size),G=Q[2],q=K.number>0;return{type:"genfrac",mode:Z.mode,numer:Y,denom:G,continued:!1,hasBarLine:q,barSize:K,leftDelim:null,rightDelim:null,size:"auto"}},"handler"),htmlBuilder:vO1,mathmlBuilder:kO1});O$0=D((J,Q)=>{var Z=Q.style,X,Y;if(J.type==="supsub")X=J.sup?J2(J.sup,Q.havingStyle(Z.sup()),Q):J2(J.sub,Q.havingStyle(Z.sub()),Q),Y=a8(J.base,"horizBrace");else Y=a8(J,"horizBrace");var K=J2(Y.base,Q.havingBaseStyle(H8.DISPLAY)),G=nF.svgSpan(Y,Q),q;if(Y.isOver)q=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"kern",size:0.1},{type:"elem",elem:G}]},Q),q.children[0].children[0].children[1].classes.push("svg-align");else q=Y0.makeVList({positionType:"bottom",positionData:K.depth+0.1+G.height,children:[{type:"elem",elem:G},{type:"kern",size:0.1},{type:"elem",elem:K}]},Q),q.children[0].children[0].children[0].classes.push("svg-align");if(X){var z=Y0.makeSpan(["mord",Y.isOver?"mover":"munder"],[q],Q);if(Y.isOver)q=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:z},{type:"kern",size:0.2},{type:"elem",elem:X}]},Q);else q=Y0.makeVList({positionType:"bottom",positionData:z.depth+0.2+X.height+X.depth,children:[{type:"elem",elem:X},{type:"kern",size:0.2},{type:"elem",elem:z}]},Q)}return Y0.makeSpan(["mord",Y.isOver?"mover":"munder"],[q],Q)},"htmlBuilder$3"),w38=D((J,Q)=>{var Z=nF.mathMLnode(J.label);return new g0.MathNode(J.isOver?"mover":"munder",[r2(J.base,Q),Z])},"mathmlBuilder$2");H6({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J;return{type:"horizBrace",mode:Z.mode,label:X,isOver:/^\\over/.test(X),base:Q[0]}},htmlBuilder:O$0,mathmlBuilder:w38});H6({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[1],Y=a8(Q[0],"url").url;if(!Z.settings.isTrusted({command:"\\href",url:Y}))return Z.formatUnsupportedCmd("\\href");return{type:"href",mode:Z.mode,href:Y,body:N7(X)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q,!1);return Y0.makeAnchor(J.href,[],Z,Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=IM(J.body,Q);if(!(Z instanceof XK))Z=new XK("mrow",[Z]);return Z.setAttribute("href",J.href),Z},"mathmlBuilder")});H6({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=a8(Q[0],"url").url;if(!Z.settings.isTrusted({command:"\\url",url:X}))return Z.formatUnsupportedCmd("\\url");var Y=[];for(var K=0;K<X.length;K++){var G=X[K];if(G==="~")G="\\textasciitilde";Y.push({type:"textord",mode:"text",text:G})}var q={type:"text",mode:Z.mode,font:"\\texttt",body:Y};return{type:"href",mode:Z.mode,href:X,body:N7(q)}},"handler")});H6({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(J,Q){var{parser:Z}=J;return{type:"hbox",mode:Z.mode,body:N7(Q[0])}},htmlBuilder(J,Q){var Z=H5(J.body,Q,!1);return Y0.makeFragment(Z)},mathmlBuilder(J,Q){return new g0.MathNode("mrow",dZ(J.body,Q))}});H6({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X,token:Y}=J,K=a8(Q[0],"raw").string,G=Q[1];if(Z.settings.strict)Z.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var q,z={};switch(X){case"\\htmlClass":z.class=K,q={command:"\\htmlClass",class:K};break;case"\\htmlId":z.id=K,q={command:"\\htmlId",id:K};break;case"\\htmlStyle":z.style=K,q={command:"\\htmlStyle",style:K};break;case"\\htmlData":{var U=K.split(",");for(var W=0;W<U.length;W++){var F=U[W].split("=");if(F.length!==2)throw new r0("Error parsing key-value for \\htmlData");z["data-"+F[0].trim()]=F[1].trim()}q={command:"\\htmlData",attributes:z};break}default:throw Error("Unrecognized html command")}if(!Z.settings.isTrusted(q))return Z.formatUnsupportedCmd(X);return{type:"html",mode:Z.mode,attributes:z,body:N7(G)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q,!1),X=["enclosing"];if(J.attributes.class)X.push(...J.attributes.class.trim().split(/\s+/));var Y=Y0.makeSpan(X,Z,Q);for(var K in J.attributes)if(K!=="class"&&J.attributes.hasOwnProperty(K))Y.setAttribute(K,J.attributes[K]);return Y},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{return IM(J.body,Q)},"mathmlBuilder")});H6({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J;return{type:"htmlmathml",mode:Z.mode,html:N7(Q[0]),mathml:N7(Q[1])}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.html,Q,!1);return Y0.makeFragment(Z)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{return IM(J.mathml,Q)},"mathmlBuilder")});QO1=D(function(Q){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(Q))return{number:+Q,unit:"bp"};else{var Z=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(Q);if(!Z)throw new r0("Invalid size: '"+Q+"' in \\includegraphics");var X={number:+(Z[1]+Z[2]),unit:Z[3]};if(!uj0(X))throw new r0("Invalid unit: '"+X.unit+"' in \\includegraphics.");return X}},"sizeData");H6({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:D((J,Q,Z)=>{var{parser:X}=J,Y={number:0,unit:"em"},K={number:0.9,unit:"em"},G={number:0,unit:"em"},q="";if(Z[0]){var z=a8(Z[0],"raw").string,U=z.split(",");for(var W=0;W<U.length;W++){var F=U[W].split("=");if(F.length===2){var H=F[1].trim();switch(F[0].trim()){case"alt":q=H;break;case"width":Y=QO1(H);break;case"height":K=QO1(H);break;case"totalheight":G=QO1(H);break;default:throw new r0("Invalid key: '"+F[0]+"' in \\includegraphics.")}}}}var B=a8(Q[0],"url").url;if(q==="")q=B,q=q.replace(/^.*[\\/]/,""),q=q.substring(0,q.lastIndexOf("."));if(!X.settings.isTrusted({command:"\\includegraphics",url:B}))return X.formatUnsupportedCmd("\\includegraphics");return{type:"includegraphics",mode:X.mode,alt:q,width:Y,height:K,totalheight:G,src:B}},"handler"),htmlBuilder:D((J,Q)=>{var Z=h4(J.height,Q),X=0;if(J.totalheight.number>0)X=h4(J.totalheight,Q)-Z;var Y=0;if(J.width.number>0)Y=h4(J.width,Q);var K={height:J6(Z+X)};if(Y>0)K.width=J6(Y);if(X>0)K.verticalAlign=J6(-X);var G=new jN8(J.src,J.alt,K);return G.height=Z,G.depth=X,G},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mglyph",[]);Z.setAttribute("alt",J.alt);var X=h4(J.height,Q),Y=0;if(J.totalheight.number>0)Y=h4(J.totalheight,Q)-X,Z.setAttribute("valign",J6(-Y));if(Z.setAttribute("height",J6(X+Y)),J.width.number>0){var K=h4(J.width,Q);Z.setAttribute("width",J6(K))}return Z.setAttribute("src",J.src),Z},"mathmlBuilder")});H6({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=a8(Q[0],"size");if(Z.settings.strict){var K=X[1]==="m",G=Y.value.unit==="mu";if(K){if(!G)Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" supports only mu units, "+("not "+Y.value.unit+" units"));if(Z.mode!=="math")Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" works only in math mode")}else if(G)Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" doesn't support mu units")}return{type:"kern",mode:Z.mode,dimension:Y.value}},htmlBuilder(J,Q){return Y0.makeGlue(J.dimension,Q)},mathmlBuilder(J,Q){var Z=h4(J.dimension,Q);return new g0.SpaceNode(Z)}});H6({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"lap",mode:Z.mode,alignment:X.slice(5),body:Y}},"handler"),htmlBuilder:D((J,Q)=>{var Z;if(J.alignment==="clap")Z=Y0.makeSpan([],[J2(J.body,Q)]),Z=Y0.makeSpan(["inner"],[Z],Q);else Z=Y0.makeSpan(["inner"],[J2(J.body,Q)]);var X=Y0.makeSpan(["fix"],[]),Y=Y0.makeSpan([J.alignment],[Z,X],Q),K=Y0.makeSpan(["strut"]);if(K.style.height=J6(Y.height+Y.depth),Y.depth)K.style.verticalAlign=J6(-Y.depth);return Y.children.unshift(K),Y=Y0.makeSpan(["thinbox"],[Y],Q),Y0.makeSpan(["mord","vbox"],[Y],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]);if(J.alignment!=="rlap"){var X=J.alignment==="llap"?"-1":"-0.5";Z.setAttribute("lspace",X+"width")}return Z.setAttribute("width","0px"),Z},"mathmlBuilder")});H6({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(J,Q){var{funcName:Z,parser:X}=J,Y=X.mode;X.switchMode("math");var K=Z==="\\("?"\\)":"$",G=X.parseExpression(!1,K);return X.expect(K),X.switchMode(Y),{type:"styling",mode:X.mode,style:"text",body:G}}});H6({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(J,Q){throw new r0("Mismatched "+J.funcName)}});Rj0=D((J,Q)=>{switch(Q.style.size){case H8.DISPLAY.size:return J.display;case H8.TEXT.size:return J.text;case H8.SCRIPT.size:return J.script;case H8.SCRIPTSCRIPT.size:return J.scriptscript;default:return J.text}},"chooseMathStyle");H6({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:D((J,Q)=>{var{parser:Z}=J;return{type:"mathchoice",mode:Z.mode,display:N7(Q[0]),text:N7(Q[1]),script:N7(Q[2]),scriptscript:N7(Q[3])}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Rj0(J,Q),X=H5(Z,Q,!1);return Y0.makeFragment(X)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=Rj0(J,Q);return IM(Z,Q)},"mathmlBuilder")});j$0=D((J,Q,Z,X,Y,K,G)=>{J=Y0.makeSpan([],[J]);var q=Z&&K8.isCharacterBox(Z),z,U;if(Q){var W=J2(Q,X.havingStyle(Y.sup()),X);U={elem:W,kern:Math.max(X.fontMetrics().bigOpSpacing1,X.fontMetrics().bigOpSpacing3-W.depth)}}if(Z){var F=J2(Z,X.havingStyle(Y.sub()),X);z={elem:F,kern:Math.max(X.fontMetrics().bigOpSpacing2,X.fontMetrics().bigOpSpacing4-F.height)}}var H;if(U&&z){var B=X.fontMetrics().bigOpSpacing5+z.elem.height+z.elem.depth+z.kern+J.depth+G;H=Y0.makeVList({positionType:"bottom",positionData:B,children:[{type:"kern",size:X.fontMetrics().bigOpSpacing5},{type:"elem",elem:z.elem,marginLeft:J6(-K)},{type:"kern",size:z.kern},{type:"elem",elem:J},{type:"kern",size:U.kern},{type:"elem",elem:U.elem,marginLeft:J6(K)},{type:"kern",size:X.fontMetrics().bigOpSpacing5}]},X)}else if(z){var M=J.height-G;H=Y0.makeVList({positionType:"top",positionData:M,children:[{type:"kern",size:X.fontMetrics().bigOpSpacing5},{type:"elem",elem:z.elem,marginLeft:J6(-K)},{type:"kern",size:z.kern},{type:"elem",elem:J}]},X)}else if(U){var V=J.depth+G;H=Y0.makeVList({positionType:"bottom",positionData:V,children:[{type:"elem",elem:J},{type:"kern",size:U.kern},{type:"elem",elem:U.elem,marginLeft:J6(K)},{type:"kern",size:X.fontMetrics().bigOpSpacing5}]},X)}else return J;var N=[H];if(z&&K!==0&&!q){var L=Y0.makeSpan(["mspace"],[],X);L.style.marginRight=J6(K),N.unshift(L)}return Y0.makeSpan(["mop","op-limits"],N,X)},"assembleSupSub"),$$0=["\\smallint"],LI=D((J,Q)=>{var Z,X,Y=!1,K;if(J.type==="supsub")Z=J.sup,X=J.sub,K=a8(J.base,"op"),Y=!0;else K=a8(J,"op");var G=Q.style,q=!1;if(G.size===H8.DISPLAY.size&&K.symbol&&!K8.contains($$0,K.name))q=!0;var z;if(K.symbol){var U=q?"Size2-Regular":"Size1-Regular",W="";if(K.name==="\\oiint"||K.name==="\\oiiint")W=K.name.slice(1),K.name=W==="oiint"?"\\iint":"\\iiint";if(z=Y0.makeSymbol(K.name,U,"math",Q,["mop","op-symbol",q?"large-op":"small-op"]),W.length>0){var F=z.italic,H=Y0.staticSvg(W+"Size"+(q?"2":"1"),Q);z=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:z,shift:0},{type:"elem",elem:H,shift:q?0.08:0}]},Q),K.name="\\"+W,z.classes.unshift("mop"),z.italic=F}}else if(K.body){var B=H5(K.body,Q,!0);if(B.length===1&&B[0]instanceof KK)z=B[0],z.classes[0]="mop";else z=Y0.makeSpan(["mop"],B,Q)}else{var M=[];for(var V=1;V<K.name.length;V++)M.push(Y0.mathsym(K.name[V],K.mode,Q));z=Y0.makeSpan(["mop"],M,Q)}var N=0,L=0;if((z instanceof KK||K.name==="\\oiint"||K.name==="\\oiiint")&&!K.suppressBaseShift)N=(z.height-z.depth)/2-Q.fontMetrics().axisHeight,L=z.italic;if(Y)return j$0(z,Z,X,Q,G,L,N);else{if(N)z.style.position="relative",z.style.top=J6(N);return z}},"htmlBuilder$2"),Mf=D((J,Q)=>{var Z;if(J.symbol){if(Z=new XK("mo",[GK(J.name,J.mode)]),K8.contains($$0,J.name))Z.setAttribute("largeop","false")}else if(J.body)Z=new XK("mo",dZ(J.body,Q));else{Z=new XK("mi",[new qf(J.name.slice(1))]);var X=new XK("mo",[GK("","text")]);if(J.parentIsSupSub)Z=new XK("mrow",[Z,X]);else Z=OO1([Z,X])}return Z},"mathmlBuilder$1"),R38={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};H6({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=X;if(Y.length===1)Y=R38[Y];return{type:"op",mode:Z.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:Y}},"handler"),htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"op",mode:Z.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:N7(X)}},"handler"),htmlBuilder:LI,mathmlBuilder:Mf});O38={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};H6({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J;return{type:"op",mode:Q.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:Z}},htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J;return{type:"op",mode:Q.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:Z}},htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J,X=Z;if(X.length===1)X=O38[X];return{type:"op",mode:Q.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:X}},htmlBuilder:LI,mathmlBuilder:Mf});E$0=D((J,Q)=>{var Z,X,Y=!1,K;if(J.type==="supsub")Z=J.sup,X=J.sub,K=a8(J.base,"operatorname"),Y=!0;else K=a8(J,"operatorname");var G;if(K.body.length>0){var q=K.body.map((F)=>{var H=F.text;if(typeof H==="string")return{type:"textord",mode:F.mode,text:H};else return F}),z=H5(q,Q.withFont("mathrm"),!0);for(var U=0;U<z.length;U++){var W=z[U];if(W instanceof KK)W.text=W.text.replace(/\u2212/,"-").replace(/\u2217/,"*")}G=Y0.makeSpan(["mop"],z,Q)}else G=Y0.makeSpan(["mop"],[],Q);if(Y)return j$0(G,Z,X,Q,Q.style,0,0);else return G},"htmlBuilder$1"),j38=D((J,Q)=>{var Z=dZ(J.body,Q.withFont("mathrm")),X=!0;for(var Y=0;Y<Z.length;Y++){var K=Z[Y];if(K instanceof g0.SpaceNode);else if(K instanceof g0.MathNode)switch(K.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var G=K.children[0];if(K.children.length===1&&G instanceof g0.TextNode)G.text=G.text.replace(/\u2212/,"-").replace(/\u2217/,"*");else X=!1;break}default:X=!1}else X=!1}if(X){var q=Z.map((W)=>W.toText()).join("");Z=[new g0.TextNode(q)]}var z=new g0.MathNode("mi",Z);z.setAttribute("mathvariant","normal");var U=new g0.MathNode("mo",[GK("","text")]);if(J.parentIsSupSub)return new g0.MathNode("mrow",[z,U]);else return g0.newDocumentFragment([z,U])},"mathmlBuilder");H6({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"operatorname",mode:Z.mode,body:N7(Y),alwaysHandleSupSub:X==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},"handler"),htmlBuilder:E$0,mathmlBuilder:j38});j1("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");PM({type:"ordgroup",htmlBuilder(J,Q){if(J.semisimple)return Y0.makeFragment(H5(J.body,Q,!1));return Y0.makeSpan(["mord"],H5(J.body,Q,!0),Q)},mathmlBuilder(J,Q){return IM(J.body,Q,!0)}});H6({type:"overline",names:["\\overline"],props:{numArgs:1},handler(J,Q){var{parser:Z}=J,X=Q[0];return{type:"overline",mode:Z.mode,body:X}},htmlBuilder(J,Q){var Z=J2(J.body,Q.havingCrampedStyle()),X=Y0.makeLineSpan("overline-line",Q),Y=Q.fontMetrics().defaultRuleThickness,K=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z},{type:"kern",size:3*Y},{type:"elem",elem:X},{type:"kern",size:Y}]},Q);return Y0.makeSpan(["mord","overline"],[K],Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[new g0.TextNode("‾")]);Z.setAttribute("stretchy","true");var X=new g0.MathNode("mover",[r2(J.body,Q),Z]);return X.setAttribute("accent","true"),X}});H6({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"phantom",mode:Z.mode,body:N7(X)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q.withPhantom(),!1);return Y0.makeFragment(Z)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(J.body,Q);return new g0.MathNode("mphantom",Z)},"mathmlBuilder")});H6({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"hphantom",mode:Z.mode,body:X}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan([],[J2(J.body,Q.withPhantom())]);if(Z.height=0,Z.depth=0,Z.children)for(var X=0;X<Z.children.length;X++)Z.children[X].height=0,Z.children[X].depth=0;return Z=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z}]},Q),Y0.makeSpan(["mord"],[Z],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(N7(J.body),Q),X=new g0.MathNode("mphantom",Z),Y=new g0.MathNode("mpadded",[X]);return Y.setAttribute("height","0px"),Y.setAttribute("depth","0px"),Y},"mathmlBuilder")});H6({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"vphantom",mode:Z.mode,body:X}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan(["inner"],[J2(J.body,Q.withPhantom())]),X=Y0.makeSpan(["fix"],[]);return Y0.makeSpan(["mord","rlap"],[Z,X],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(N7(J.body),Q),X=new g0.MathNode("mphantom",Z),Y=new g0.MathNode("mpadded",[X]);return Y.setAttribute("width","0px"),Y},"mathmlBuilder")});H6({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"size").value,Y=Q[1];return{type:"raisebox",mode:Z.mode,dy:X,body:Y}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=h4(J.dy,Q);return Y0.makeVList({positionType:"shift",positionData:-X,children:[{type:"elem",elem:Z}]},Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]),X=J.dy.number+J.dy.unit;return Z.setAttribute("voffset",X),Z}});H6({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler(J){var{parser:Q}=J;return{type:"internal",mode:Q.mode}}});H6({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler(J,Q,Z){var{parser:X}=J,Y=Z[0],K=a8(Q[0],"size"),G=a8(Q[1],"size");return{type:"rule",mode:X.mode,shift:Y&&a8(Y,"size").value,width:K.value,height:G.value}},htmlBuilder(J,Q){var Z=Y0.makeSpan(["mord","rule"],[],Q),X=h4(J.width,Q),Y=h4(J.height,Q),K=J.shift?h4(J.shift,Q):0;return Z.style.borderRightWidth=J6(X),Z.style.borderTopWidth=J6(Y),Z.style.bottom=J6(K),Z.width=X,Z.height=Y+K,Z.depth=-K,Z.maxFontSize=Y*1.125*Q.sizeMultiplier,Z},mathmlBuilder(J,Q){var Z=h4(J.width,Q),X=h4(J.height,Q),Y=J.shift?h4(J.shift,Q):0,K=Q.color&&Q.getColor()||"black",G=new g0.MathNode("mspace");G.setAttribute("mathbackground",K),G.setAttribute("width",J6(Z)),G.setAttribute("height",J6(X));var q=new g0.MathNode("mpadded",[G]);if(Y>=0)q.setAttribute("height",J6(Y));else q.setAttribute("height",J6(Y)),q.setAttribute("depth",J6(-Y));return q.setAttribute("voffset",J6(Y)),q}});D(_O1,"sizingGroup");Oj0=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],$38=D((J,Q)=>{var Z=Q.havingSize(J.size);return _O1(J.body,Z,Q)},"htmlBuilder");H6({type:"sizing",names:Oj0,props:{numArgs:0,allowedInText:!0},handler:D((J,Q)=>{var{breakOnTokenText:Z,funcName:X,parser:Y}=J,K=Y.parseExpression(!1,Z);return{type:"sizing",mode:Y.mode,size:Oj0.indexOf(X)+1,body:K}},"handler"),htmlBuilder:$38,mathmlBuilder:D((J,Q)=>{var Z=Q.havingSize(J.size),X=dZ(J.body,Z),Y=new g0.MathNode("mstyle",X);return Y.setAttribute("mathsize",J6(Z.sizeMultiplier)),Y},"mathmlBuilder")});H6({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:D((J,Q,Z)=>{var{parser:X}=J,Y=!1,K=!1,G=Z[0]&&a8(Z[0],"ordgroup");if(G){var q="";for(var z=0;z<G.body.length;++z){var U=G.body[z];if(q=U.text,q==="t")Y=!0;else if(q==="b")K=!0;else{Y=!1,K=!1;break}}}else Y=!0,K=!0;var W=Q[0];return{type:"smash",mode:X.mode,body:W,smashHeight:Y,smashDepth:K}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan([],[J2(J.body,Q)]);if(!J.smashHeight&&!J.smashDepth)return Z;if(J.smashHeight){if(Z.height=0,Z.children)for(var X=0;X<Z.children.length;X++)Z.children[X].height=0}if(J.smashDepth){if(Z.depth=0,Z.children)for(var Y=0;Y<Z.children.length;Y++)Z.children[Y].depth=0}var K=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord"],[K],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]);if(J.smashHeight)Z.setAttribute("height","0px");if(J.smashDepth)Z.setAttribute("depth","0px");return Z},"mathmlBuilder")});H6({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(J,Q,Z){var{parser:X}=J,Y=Z[0],K=Q[0];return{type:"sqrt",mode:X.mode,body:K,index:Y}},htmlBuilder(J,Q){var Z=J2(J.body,Q.havingCrampedStyle());if(Z.height===0)Z.height=Q.fontMetrics().xHeight;Z=Y0.wrapFragment(Z,Q);var X=Q.fontMetrics(),Y=X.defaultRuleThickness,K=Y;if(Q.style.id<H8.TEXT.id)K=Q.fontMetrics().xHeight;var G=Y+K/4,q=Z.height+Z.depth+G+Y,{span:z,ruleWidth:U,advanceWidth:W}=cF.sqrtImage(q,Q),F=z.height-U;if(F>Z.height+Z.depth+G)G=(G+F-Z.height-Z.depth)/2;var H=z.height-Z.height-G-U;Z.style.paddingLeft=J6(W);var B=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z,wrapperClasses:["svg-align"]},{type:"kern",size:-(Z.height+H)},{type:"elem",elem:z},{type:"kern",size:U}]},Q);if(!J.index)return Y0.makeSpan(["mord","sqrt"],[B],Q);else{var M=Q.havingStyle(H8.SCRIPTSCRIPT),V=J2(J.index,M,Q),N=0.6*(B.height-B.depth),L=Y0.makeVList({positionType:"shift",positionData:-N,children:[{type:"elem",elem:V}]},Q),A=Y0.makeSpan(["root"],[L]);return Y0.makeSpan(["mord","sqrt"],[A,B],Q)}},mathmlBuilder(J,Q){var{body:Z,index:X}=J;return X?new g0.MathNode("mroot",[r2(Z,Q),r2(X,Q)]):new g0.MathNode("msqrt",[r2(Z,Q)])}});jj0={display:H8.DISPLAY,text:H8.TEXT,script:H8.SCRIPT,scriptscript:H8.SCRIPTSCRIPT};H6({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J,Q){var{breakOnTokenText:Z,funcName:X,parser:Y}=J,K=Y.parseExpression(!0,Z),G=X.slice(1,X.length-5);return{type:"styling",mode:Y.mode,style:G,body:K}},htmlBuilder(J,Q){var Z=jj0[J.style],X=Q.havingStyle(Z).withFont("");return _O1(J.body,X,Q)},mathmlBuilder(J,Q){var Z=jj0[J.style],X=Q.havingStyle(Z),Y=dZ(J.body,X),K=new g0.MathNode("mstyle",Y),G={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},q=G[J.style];return K.setAttribute("scriptlevel",q[0]),K.setAttribute("displaystyle",q[1]),K}});E38=D(function(Q,Z){var X=Q.base;if(!X)return null;else if(X.type==="op"){var Y=X.limits&&(Z.style.size===H8.DISPLAY.size||X.alwaysHandleSupSub);return Y?LI:null}else if(X.type==="operatorname"){var K=X.alwaysHandleSupSub&&(Z.style.size===H8.DISPLAY.size||X.limits);return K?E$0:null}else if(X.type==="accent")return K8.isCharacterBox(X.base)?EO1:null;else if(X.type==="horizBrace"){var G=!Q.sub;return G===X.isOver?O$0:null}else return null},"htmlBuilderDelegate");PM({type:"supsub",htmlBuilder(J,Q){var Z=E38(J,Q);if(Z)return Z(J,Q);var{base:X,sup:Y,sub:K}=J,G=J2(X,Q),q,z,U=Q.fontMetrics(),W=0,F=0,H=X&&K8.isCharacterBox(X);if(Y){var B=Q.havingStyle(Q.style.sup());if(q=J2(Y,B,Q),!H)W=G.height-B.fontMetrics().supDrop*B.sizeMultiplier/Q.sizeMultiplier}if(K){var M=Q.havingStyle(Q.style.sub());if(z=J2(K,M,Q),!H)F=G.depth+M.fontMetrics().subDrop*M.sizeMultiplier/Q.sizeMultiplier}var V;if(Q.style===H8.DISPLAY)V=U.sup1;else if(Q.style.cramped)V=U.sup3;else V=U.sup2;var N=Q.sizeMultiplier,L=J6(0.5/U.ptPerEm/N),A=null;if(z){var w=J.base&&J.base.type==="op"&&J.base.name&&(J.base.name==="\\oiint"||J.base.name==="\\oiiint");if(G instanceof KK||w)A=J6(-G.italic)}var R;if(q&&z){W=Math.max(W,V,q.depth+0.25*U.xHeight),F=Math.max(F,U.sub2);var O=U.defaultRuleThickness,j=4*O;if(W-q.depth-(z.height-F)<j){F=j-(W-q.depth)+z.height;var $=0.8*U.xHeight-(W-q.depth);if($>0)W+=$,F-=$}var E=[{type:"elem",elem:z,shift:F,marginRight:L,marginLeft:A},{type:"elem",elem:q,shift:-W,marginRight:L}];R=Y0.makeVList({positionType:"individualShift",children:E},Q)}else if(z){F=Math.max(F,U.sub1,z.height-0.8*U.xHeight);var I=[{type:"elem",elem:z,marginLeft:A,marginRight:L}];R=Y0.makeVList({positionType:"shift",positionData:F,children:I},Q)}else if(q)W=Math.max(W,V,q.depth+0.25*U.xHeight),R=Y0.makeVList({positionType:"shift",positionData:-W,children:[{type:"elem",elem:q,marginRight:L}]},Q);else throw Error("supsub must have either sup or sub.");var T=WO1(G,"right")||"mord";return Y0.makeSpan([T],[G,Y0.makeSpan(["msupsub"],[R])],Q)},mathmlBuilder(J,Q){var Z=!1,X,Y;if(J.base&&J.base.type==="horizBrace"){if(Y=!!J.sup,Y===J.base.isOver)Z=!0,X=J.base.isOver}if(J.base&&(J.base.type==="op"||J.base.type==="operatorname"))J.base.parentIsSupSub=!0;var K=[r2(J.base,Q)];if(J.sub)K.push(r2(J.sub,Q));if(J.sup)K.push(r2(J.sup,Q));var G;if(Z)G=X?"mover":"munder";else if(!J.sub){var q=J.base;if(q&&q.type==="op"&&q.limits&&(Q.style===H8.DISPLAY||q.alwaysHandleSupSub))G="mover";else if(q&&q.type==="operatorname"&&q.alwaysHandleSupSub&&(q.limits||Q.style===H8.DISPLAY))G="mover";else G="msup"}else if(!J.sup){var z=J.base;if(z&&z.type==="op"&&z.limits&&(Q.style===H8.DISPLAY||z.alwaysHandleSupSub))G="munder";else if(z&&z.type==="operatorname"&&z.alwaysHandleSupSub&&(z.limits||Q.style===H8.DISPLAY))G="munder";else G="msub"}else{var U=J.base;if(U&&U.type==="op"&&U.limits&&Q.style===H8.DISPLAY)G="munderover";else if(U&&U.type==="operatorname"&&U.alwaysHandleSupSub&&(Q.style===H8.DISPLAY||U.limits))G="munderover";else G="msubsup"}return new g0.MathNode(G,K)}});PM({type:"atom",htmlBuilder(J,Q){return Y0.mathsym(J.text,J.mode,Q,["m"+J.family])},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[GK(J.text,J.mode)]);if(J.family==="bin"){var X=$O1(J,Q);if(X==="bold-italic")Z.setAttribute("mathvariant",X)}else if(J.family==="punct")Z.setAttribute("separator","true");else if(J.family==="open"||J.family==="close")Z.setAttribute("stretchy","false");return Z}});I$0={mi:"italic",mn:"normal",mtext:"normal"};PM({type:"mathord",htmlBuilder(J,Q){return Y0.makeOrd(J,Q,"mathord")},mathmlBuilder(J,Q){var Z=new g0.MathNode("mi",[GK(J.text,J.mode,Q)]),X=$O1(J,Q)||"italic";if(X!==I$0[Z.type])Z.setAttribute("mathvariant",X);return Z}});PM({type:"textord",htmlBuilder(J,Q){return Y0.makeOrd(J,Q,"textord")},mathmlBuilder(J,Q){var Z=GK(J.text,J.mode,Q),X=$O1(J,Q)||"normal",Y;if(J.mode==="text")Y=new g0.MathNode("mtext",[Z]);else if(/[0-9]/.test(J.text))Y=new g0.MathNode("mn",[Z]);else if(J.text==="\\prime")Y=new g0.MathNode("mo",[Z]);else Y=new g0.MathNode("mi",[Z]);if(X!==I$0[Y.type])Y.setAttribute("mathvariant",X);return Y}});ZO1={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},XO1={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};PM({type:"spacing",htmlBuilder(J,Q){if(XO1.hasOwnProperty(J.text)){var Z=XO1[J.text].className||"";if(J.mode==="text"){var X=Y0.makeOrd(J,Q,"textord");return X.classes.push(Z),X}else return Y0.makeSpan(["mspace",Z],[Y0.mathsym(J.text,J.mode,Q)],Q)}else if(ZO1.hasOwnProperty(J.text))return Y0.makeSpan(["mspace",ZO1[J.text]],[],Q);else throw new r0('Unknown type of space "'+J.text+'"')},mathmlBuilder(J,Q){var Z;if(XO1.hasOwnProperty(J.text))Z=new g0.MathNode("mtext",[new g0.TextNode(" ")]);else if(ZO1.hasOwnProperty(J.text))return new g0.MathNode("mspace");else throw new r0('Unknown type of space "'+J.text+'"');return Z}});$j0=D(()=>{var J=new g0.MathNode("mtd",[]);return J.setAttribute("width","50%"),J},"pad");PM({type:"tag",mathmlBuilder(J,Q){var Z=new g0.MathNode("mtable",[new g0.MathNode("mtr",[$j0(),new g0.MathNode("mtd",[IM(J.body,Q)]),$j0(),new g0.MathNode("mtd",[IM(J.tag,Q)])])]);return Z.setAttribute("width","100%"),Z}});Ej0={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Ij0={"\\textbf":"textbf","\\textmd":"textmd"},I38={"\\textit":"textit","\\textup":"textup"},Pj0=D((J,Q)=>{var Z=J.font;if(!Z)return Q;else if(Ej0[Z])return Q.withTextFontFamily(Ej0[Z]);else if(Ij0[Z])return Q.withTextFontWeight(Ij0[Z]);else if(Z==="\\emph")return Q.fontShape==="textit"?Q.withTextFontShape("textup"):Q.withTextFontShape("textit");return Q.withTextFontShape(I38[Z])},"optionsWithFont");H6({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"text",mode:Z.mode,body:N7(Y),font:X}},htmlBuilder(J,Q){var Z=Pj0(J,Q),X=H5(J.body,Z,!0);return Y0.makeSpan(["mord","text"],X,Z)},mathmlBuilder(J,Q){var Z=Pj0(J,Q);return IM(J.body,Z)}});H6({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"underline",mode:Z.mode,body:Q[0]}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=Y0.makeLineSpan("underline-line",Q),Y=Q.fontMetrics().defaultRuleThickness,K=Y0.makeVList({positionType:"top",positionData:Z.height,children:[{type:"kern",size:Y},{type:"elem",elem:X},{type:"kern",size:3*Y},{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord","underline"],[K],Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[new g0.TextNode("‾")]);Z.setAttribute("stretchy","true");var X=new g0.MathNode("munder",[r2(J.body,Q),Z]);return X.setAttribute("accentunder","true"),X}});H6({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(J,Q){var{parser:Z}=J;return{type:"vcenter",mode:Z.mode,body:Q[0]}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=Q.fontMetrics().axisHeight,Y=0.5*(Z.height-X-(Z.depth+X));return Y0.makeVList({positionType:"shift",positionData:Y,children:[{type:"elem",elem:Z}]},Q)},mathmlBuilder(J,Q){return new g0.MathNode("mpadded",[r2(J.body,Q)],["vcenter"])}});H6({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(J,Q,Z){throw new r0("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(J,Q){var Z=Tj0(J),X=[],Y=Q.havingStyle(Q.style.text());for(var K=0;K<Z.length;K++){var G=Z[K];if(G==="~")G="\\textasciitilde";X.push(Y0.makeSymbol(G,"Typewriter-Regular",J.mode,Y,["mord","texttt"]))}return Y0.makeSpan(["mord","text"].concat(Y.sizingClasses(Q)),Y0.tryCombineChars(X),Y)},mathmlBuilder(J,Q){var Z=new g0.TextNode(Tj0(J)),X=new g0.MathNode("mtext",[Z]);return X.setAttribute("mathvariant","monospace"),X}});Tj0=D((J)=>J.body.replace(/ /g,J.star?"␣":" "),"makeVerb"),jM=oj0,C38="("+P38+")"+P$0+"*",v38=new RegExp(VO1+"+$"),k38="("+P$0+"+)|"+(S38+"|")+"([!-\\[\\]-‧-豈-]"+(VO1+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(VO1+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+C38)+("|"+T38+")"),Cj0=class{static{D(this,"Lexer")}constructor(J,Q){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=J,this.settings=Q,this.tokenRegex=new RegExp(k38,"g"),this.catcodes={"%":14,"~":13}}setCatcode(J,Q){this.catcodes[J]=Q}lex(){var J=this.input,Q=this.tokenRegex.lastIndex;if(Q===J.length)return new KU("EOF",new Xq(this,Q,Q));var Z=this.tokenRegex.exec(J);if(Z===null||Z.index!==Q)throw new r0("Unexpected character: '"+J[Q]+"'",new KU(J[Q],new Xq(this,Q,Q+1)));var X=Z[6]||Z[3]||(Z[2]?"\\ ":" ");if(this.catcodes[X]===14){var Y=J.indexOf(`
|
|
2298
|
-
`,this.tokenRegex.lastIndex);if(Y===-1)this.tokenRegex.lastIndex=J.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");else this.tokenRegex.lastIndex=Y+1;return this.lex()}return new KU(X,new Xq(this,Q,this.tokenRegex.lastIndex))}},_38=class{static{D(this,"Namespace")}constructor(J,Q){if(J===void 0)J={};if(Q===void 0)Q={};this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=Q,this.builtins=J,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new r0("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var J=this.undefStack.pop();for(var Q in J)if(J.hasOwnProperty(Q))if(J[Q]==null)delete this.current[Q];else this.current[Q]=J[Q]}endGroups(){while(this.undefStack.length>0)this.endGroup()}has(J){return this.current.hasOwnProperty(J)||this.builtins.hasOwnProperty(J)}get(J){if(this.current.hasOwnProperty(J))return this.current[J];else return this.builtins[J]}set(J,Q,Z){if(Z===void 0)Z=!1;if(Z){for(var X=0;X<this.undefStack.length;X++)delete this.undefStack[X][J];if(this.undefStack.length>0)this.undefStack[this.undefStack.length-1][J]=Q}else{var Y=this.undefStack[this.undefStack.length-1];if(Y&&!Y.hasOwnProperty(J))Y[J]=this.current[J]}if(Q==null)delete this.current[J];else this.current[J]=Q}},x38=N$0;j1("\\noexpand",function(J){var Q=J.popToken();if(J.isExpandable(Q.text))Q.noexpand=!0,Q.treatAsRelax=!0;return{tokens:[Q],numArgs:0}});j1("\\expandafter",function(J){var Q=J.popToken();return J.expandOnce(!0),{tokens:[Q],numArgs:0}});j1("\\@firstoftwo",function(J){var Q=J.consumeArgs(2);return{tokens:Q[0],numArgs:0}});j1("\\@secondoftwo",function(J){var Q=J.consumeArgs(2);return{tokens:Q[1],numArgs:0}});j1("\\@ifnextchar",function(J){var Q=J.consumeArgs(3);J.consumeSpaces();var Z=J.future();if(Q[0].length===1&&Q[0][0].text===Z.text)return{tokens:Q[1],numArgs:0};else return{tokens:Q[2],numArgs:0}});j1("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");j1("\\TextOrMath",function(J){var Q=J.consumeArgs(2);if(J.mode==="text")return{tokens:Q[0],numArgs:0};else return{tokens:Q[1],numArgs:0}});Sj0={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};j1("\\char",function(J){var Q=J.popToken(),Z,X="";if(Q.text==="'")Z=8,Q=J.popToken();else if(Q.text==='"')Z=16,Q=J.popToken();else if(Q.text==="`")if(Q=J.popToken(),Q.text[0]==="\\")X=Q.text.charCodeAt(1);else if(Q.text==="EOF")throw new r0("\\char` missing argument");else X=Q.text.charCodeAt(0);else Z=10;if(Z){if(X=Sj0[Q.text],X==null||X>=Z)throw new r0("Invalid base-"+Z+" digit "+Q.text);var Y;while((Y=Sj0[J.future().text])!=null&&Y<Z)X*=Z,X+=Y,J.popToken()}return"\\@char{"+X+"}"});xO1=D((J,Q,Z)=>{var X=J.consumeArg().tokens;if(X.length!==1)throw new r0("\\newcommand's first argument must be a macro name");var Y=X[0].text,K=J.isDefined(Y);if(K&&!Q)throw new r0("\\newcommand{"+Y+"} attempting to redefine "+(Y+"; use \\renewcommand"));if(!K&&!Z)throw new r0("\\renewcommand{"+Y+"} when command "+Y+" does not yet exist; use \\newcommand");var G=0;if(X=J.consumeArg().tokens,X.length===1&&X[0].text==="["){var q="",z=J.expandNextToken();while(z.text!=="]"&&z.text!=="EOF")q+=z.text,z=J.expandNextToken();if(!q.match(/^\s*[0-9]+\s*$/))throw new r0("Invalid number of arguments: "+q);G=parseInt(q),X=J.consumeArg().tokens}return J.macros.set(Y,{tokens:X,numArgs:G}),""},"newcommand");j1("\\newcommand",(J)=>xO1(J,!1,!0));j1("\\renewcommand",(J)=>xO1(J,!0,!1));j1("\\providecommand",(J)=>xO1(J,!0,!0));j1("\\message",(J)=>{var Q=J.consumeArgs(1)[0];return console.log(Q.reverse().map((Z)=>Z.text).join("")),""});j1("\\errmessage",(J)=>{var Q=J.consumeArgs(1)[0];return console.error(Q.reverse().map((Z)=>Z.text).join("")),""});j1("\\show",(J)=>{var Q=J.popToken(),Z=Q.text;return console.log(Q,J.macros.get(Z),jM[Z],X4.math[Z],X4.text[Z]),""});j1("\\bgroup","{");j1("\\egroup","}");j1("~","\\nobreakspace");j1("\\lq","`");j1("\\rq","'");j1("\\aa","\\r a");j1("\\AA","\\r A");j1("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");j1("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");j1("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");j1("ℬ","\\mathscr{B}");j1("ℰ","\\mathscr{E}");j1("ℱ","\\mathscr{F}");j1("ℋ","\\mathscr{H}");j1("ℐ","\\mathscr{I}");j1("ℒ","\\mathscr{L}");j1("ℳ","\\mathscr{M}");j1("ℛ","\\mathscr{R}");j1("ℭ","\\mathfrak{C}");j1("ℌ","\\mathfrak{H}");j1("ℨ","\\mathfrak{Z}");j1("\\Bbbk","\\Bbb{k}");j1("·","\\cdotp");j1("\\llap","\\mathllap{\\textrm{#1}}");j1("\\rlap","\\mathrlap{\\textrm{#1}}");j1("\\clap","\\mathclap{\\textrm{#1}}");j1("\\mathstrut","\\vphantom{(}");j1("\\underbar","\\underline{\\text{#1}}");j1("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');j1("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");j1("\\ne","\\neq");j1("≠","\\neq");j1("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");j1("∉","\\notin");j1("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");j1("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");j1("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");j1("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");j1("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");j1("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");j1("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");j1("⟂","\\perp");j1("‼","\\mathclose{!\\mkern-0.8mu!}");j1("∌","\\notni");j1("⌜","\\ulcorner");j1("⌝","\\urcorner");j1("⌞","\\llcorner");j1("⌟","\\lrcorner");j1("©","\\copyright");j1("®","\\textregistered");j1("️","\\textregistered");j1("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');j1("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');j1("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');j1("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');j1("\\vdots","\\mathord{\\varvdots\\rule{0pt}{15pt}}");j1("⋮","\\vdots");j1("\\varGamma","\\mathit{\\Gamma}");j1("\\varDelta","\\mathit{\\Delta}");j1("\\varTheta","\\mathit{\\Theta}");j1("\\varLambda","\\mathit{\\Lambda}");j1("\\varXi","\\mathit{\\Xi}");j1("\\varPi","\\mathit{\\Pi}");j1("\\varSigma","\\mathit{\\Sigma}");j1("\\varUpsilon","\\mathit{\\Upsilon}");j1("\\varPhi","\\mathit{\\Phi}");j1("\\varPsi","\\mathit{\\Psi}");j1("\\varOmega","\\mathit{\\Omega}");j1("\\substack","\\begin{subarray}{c}#1\\end{subarray}");j1("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");j1("\\boxed","\\fbox{$\\displaystyle{#1}$}");j1("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");j1("\\implies","\\DOTSB\\;\\Longrightarrow\\;");j1("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");vj0={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};j1("\\dots",function(J){var Q="\\dotso",Z=J.expandAfterFuture().text;if(Z in vj0)Q=vj0[Z];else if(Z.slice(0,4)==="\\not")Q="\\dotsb";else if(Z in X4.math){if(K8.contains(["bin","rel"],X4.math[Z].group))Q="\\dotsb"}return Q});bO1={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};j1("\\dotso",function(J){var Q=J.future().text;if(Q in bO1)return"\\ldots\\,";else return"\\ldots"});j1("\\dotsc",function(J){var Q=J.future().text;if(Q in bO1&&Q!==",")return"\\ldots\\,";else return"\\ldots"});j1("\\cdots",function(J){var Q=J.future().text;if(Q in bO1)return"\\@cdots\\,";else return"\\@cdots"});j1("\\dotsb","\\cdots");j1("\\dotsm","\\cdots");j1("\\dotsi","\\!\\cdots");j1("\\dotsx","\\ldots\\,");j1("\\DOTSI","\\relax");j1("\\DOTSB","\\relax");j1("\\DOTSX","\\relax");j1("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");j1("\\,","\\tmspace+{3mu}{.1667em}");j1("\\thinspace","\\,");j1("\\>","\\mskip{4mu}");j1("\\:","\\tmspace+{4mu}{.2222em}");j1("\\medspace","\\:");j1("\\;","\\tmspace+{5mu}{.2777em}");j1("\\thickspace","\\;");j1("\\!","\\tmspace-{3mu}{.1667em}");j1("\\negthinspace","\\!");j1("\\negmedspace","\\tmspace-{4mu}{.2222em}");j1("\\negthickspace","\\tmspace-{5mu}{.277em}");j1("\\enspace","\\kern.5em ");j1("\\enskip","\\hskip.5em\\relax");j1("\\quad","\\hskip1em\\relax");j1("\\qquad","\\hskip2em\\relax");j1("\\tag","\\@ifstar\\tag@literal\\tag@paren");j1("\\tag@paren","\\tag@literal{({#1})}");j1("\\tag@literal",(J)=>{if(J.macros.get("\\df@tag"))throw new r0("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});j1("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");j1("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");j1("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");j1("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");j1("\\newline","\\\\\\relax");j1("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");T$0=J6(YU["Main-Regular"][84][1]-0.7*YU["Main-Regular"][65][1]);j1("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+T$0+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");j1("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+T$0+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");j1("\\hspace","\\@ifstar\\@hspacer\\@hspace");j1("\\@hspace","\\hskip #1\\relax");j1("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");j1("\\ordinarycolon",":");j1("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");j1("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');j1("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');j1("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');j1("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');j1("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');j1("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');j1("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');j1("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');j1("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');j1("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');j1("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');j1("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');j1("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');j1("∷","\\dblcolon");j1("∹","\\eqcolon");j1("≔","\\coloneqq");j1("≕","\\eqqcolon");j1("⩴","\\Coloneqq");j1("\\ratio","\\vcentcolon");j1("\\coloncolon","\\dblcolon");j1("\\colonequals","\\coloneqq");j1("\\coloncolonequals","\\Coloneqq");j1("\\equalscolon","\\eqqcolon");j1("\\equalscoloncolon","\\Eqqcolon");j1("\\colonminus","\\coloneq");j1("\\coloncolonminus","\\Coloneq");j1("\\minuscolon","\\eqcolon");j1("\\minuscoloncolon","\\Eqcolon");j1("\\coloncolonapprox","\\Colonapprox");j1("\\coloncolonsim","\\Colonsim");j1("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");j1("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");j1("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");j1("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");j1("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");j1("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");j1("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");j1("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");j1("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");j1("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");j1("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");j1("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");j1("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");j1("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");j1("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");j1("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");j1("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");j1("\\nleqq","\\html@mathml{\\@nleqq}{≰}");j1("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");j1("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");j1("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");j1("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");j1("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");j1("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");j1("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");j1("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");j1("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");j1("\\imath","\\html@mathml{\\@imath}{ı}");j1("\\jmath","\\html@mathml{\\@jmath}{ȷ}");j1("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");j1("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");j1("⟦","\\llbracket");j1("⟧","\\rrbracket");j1("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");j1("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");j1("⦃","\\lBrace");j1("⦄","\\rBrace");j1("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");j1("⦵","\\minuso");j1("\\darr","\\downarrow");j1("\\dArr","\\Downarrow");j1("\\Darr","\\Downarrow");j1("\\lang","\\langle");j1("\\rang","\\rangle");j1("\\uarr","\\uparrow");j1("\\uArr","\\Uparrow");j1("\\Uarr","\\Uparrow");j1("\\N","\\mathbb{N}");j1("\\R","\\mathbb{R}");j1("\\Z","\\mathbb{Z}");j1("\\alef","\\aleph");j1("\\alefsym","\\aleph");j1("\\Alpha","\\mathrm{A}");j1("\\Beta","\\mathrm{B}");j1("\\bull","\\bullet");j1("\\Chi","\\mathrm{X}");j1("\\clubs","\\clubsuit");j1("\\cnums","\\mathbb{C}");j1("\\Complex","\\mathbb{C}");j1("\\Dagger","\\ddagger");j1("\\diamonds","\\diamondsuit");j1("\\empty","\\emptyset");j1("\\Epsilon","\\mathrm{E}");j1("\\Eta","\\mathrm{H}");j1("\\exist","\\exists");j1("\\harr","\\leftrightarrow");j1("\\hArr","\\Leftrightarrow");j1("\\Harr","\\Leftrightarrow");j1("\\hearts","\\heartsuit");j1("\\image","\\Im");j1("\\infin","\\infty");j1("\\Iota","\\mathrm{I}");j1("\\isin","\\in");j1("\\Kappa","\\mathrm{K}");j1("\\larr","\\leftarrow");j1("\\lArr","\\Leftarrow");j1("\\Larr","\\Leftarrow");j1("\\lrarr","\\leftrightarrow");j1("\\lrArr","\\Leftrightarrow");j1("\\Lrarr","\\Leftrightarrow");j1("\\Mu","\\mathrm{M}");j1("\\natnums","\\mathbb{N}");j1("\\Nu","\\mathrm{N}");j1("\\Omicron","\\mathrm{O}");j1("\\plusmn","\\pm");j1("\\rarr","\\rightarrow");j1("\\rArr","\\Rightarrow");j1("\\Rarr","\\Rightarrow");j1("\\real","\\Re");j1("\\reals","\\mathbb{R}");j1("\\Reals","\\mathbb{R}");j1("\\Rho","\\mathrm{P}");j1("\\sdot","\\cdot");j1("\\sect","\\S");j1("\\spades","\\spadesuit");j1("\\sub","\\subset");j1("\\sube","\\subseteq");j1("\\supe","\\supseteq");j1("\\Tau","\\mathrm{T}");j1("\\thetasym","\\vartheta");j1("\\weierp","\\wp");j1("\\Zeta","\\mathrm{Z}");j1("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");j1("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");j1("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");j1("\\bra","\\mathinner{\\langle{#1}|}");j1("\\ket","\\mathinner{|{#1}\\rangle}");j1("\\braket","\\mathinner{\\langle{#1}\\rangle}");j1("\\Bra","\\left\\langle#1\\right|");j1("\\Ket","\\left|#1\\right\\rangle");C$0=D((J)=>(Q)=>{var Z=Q.consumeArg().tokens,X=Q.consumeArg().tokens,Y=Q.consumeArg().tokens,K=Q.consumeArg().tokens,G=Q.macros.get("|"),q=Q.macros.get("\\|");Q.macros.beginGroup();var z=D((F)=>(H)=>{if(J){if(H.macros.set("|",G),Y.length)H.macros.set("\\|",q)}var B=F;if(!F&&Y.length){var M=H.future();if(M.text==="|")H.popToken(),B=!0}return{tokens:B?Y:X,numArgs:0}},"midMacro");if(Q.macros.set("|",z(!1)),Y.length)Q.macros.set("\\|",z(!0));var U=Q.consumeArg().tokens,W=Q.expandTokens([...K,...U,...Z]);return Q.macros.endGroup(),{tokens:W.reverse(),numArgs:0}},"braketHelper");j1("\\bra@ket",C$0(!1));j1("\\bra@set",C$0(!0));j1("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");j1("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");j1("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");j1("\\angln","{\\angl n}");j1("\\blue","\\textcolor{##6495ed}{#1}");j1("\\orange","\\textcolor{##ffa500}{#1}");j1("\\pink","\\textcolor{##ff00af}{#1}");j1("\\red","\\textcolor{##df0030}{#1}");j1("\\green","\\textcolor{##28ae7b}{#1}");j1("\\gray","\\textcolor{gray}{#1}");j1("\\purple","\\textcolor{##9d38bd}{#1}");j1("\\blueA","\\textcolor{##ccfaff}{#1}");j1("\\blueB","\\textcolor{##80f6ff}{#1}");j1("\\blueC","\\textcolor{##63d9ea}{#1}");j1("\\blueD","\\textcolor{##11accd}{#1}");j1("\\blueE","\\textcolor{##0c7f99}{#1}");j1("\\tealA","\\textcolor{##94fff5}{#1}");j1("\\tealB","\\textcolor{##26edd5}{#1}");j1("\\tealC","\\textcolor{##01d1c1}{#1}");j1("\\tealD","\\textcolor{##01a995}{#1}");j1("\\tealE","\\textcolor{##208170}{#1}");j1("\\greenA","\\textcolor{##b6ffb0}{#1}");j1("\\greenB","\\textcolor{##8af281}{#1}");j1("\\greenC","\\textcolor{##74cf70}{#1}");j1("\\greenD","\\textcolor{##1fab54}{#1}");j1("\\greenE","\\textcolor{##0d923f}{#1}");j1("\\goldA","\\textcolor{##ffd0a9}{#1}");j1("\\goldB","\\textcolor{##ffbb71}{#1}");j1("\\goldC","\\textcolor{##ff9c39}{#1}");j1("\\goldD","\\textcolor{##e07d10}{#1}");j1("\\goldE","\\textcolor{##a75a05}{#1}");j1("\\redA","\\textcolor{##fca9a9}{#1}");j1("\\redB","\\textcolor{##ff8482}{#1}");j1("\\redC","\\textcolor{##f9685d}{#1}");j1("\\redD","\\textcolor{##e84d39}{#1}");j1("\\redE","\\textcolor{##bc2612}{#1}");j1("\\maroonA","\\textcolor{##ffbde0}{#1}");j1("\\maroonB","\\textcolor{##ff92c6}{#1}");j1("\\maroonC","\\textcolor{##ed5fa6}{#1}");j1("\\maroonD","\\textcolor{##ca337c}{#1}");j1("\\maroonE","\\textcolor{##9e034e}{#1}");j1("\\purpleA","\\textcolor{##ddd7ff}{#1}");j1("\\purpleB","\\textcolor{##c6b9fc}{#1}");j1("\\purpleC","\\textcolor{##aa87ff}{#1}");j1("\\purpleD","\\textcolor{##7854ab}{#1}");j1("\\purpleE","\\textcolor{##543b78}{#1}");j1("\\mintA","\\textcolor{##f5f9e8}{#1}");j1("\\mintB","\\textcolor{##edf2df}{#1}");j1("\\mintC","\\textcolor{##e0e5cc}{#1}");j1("\\grayA","\\textcolor{##f6f7f7}{#1}");j1("\\grayB","\\textcolor{##f0f1f2}{#1}");j1("\\grayC","\\textcolor{##e3e5e6}{#1}");j1("\\grayD","\\textcolor{##d6d8da}{#1}");j1("\\grayE","\\textcolor{##babec2}{#1}");j1("\\grayF","\\textcolor{##888d93}{#1}");j1("\\grayG","\\textcolor{##626569}{#1}");j1("\\grayH","\\textcolor{##3b3e40}{#1}");j1("\\grayI","\\textcolor{##21242c}{#1}");j1("\\kaBlue","\\textcolor{##314453}{#1}");j1("\\kaGreen","\\textcolor{##71B307}{#1}");S$0={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},b38=class{static{D(this,"MacroExpander")}constructor(J,Q,Z){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=Q,this.expansionCount=0,this.feed(J),this.macros=new _38(x38,Q.macros),this.mode=Z,this.stack=[]}feed(J){this.lexer=new Cj0(J,this.settings)}switchMode(J){this.mode=J}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){if(this.stack.length===0)this.pushToken(this.lexer.lex());return this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(J){this.stack.push(J)}pushTokens(J){this.stack.push(...J)}scanArgument(J){var Q,Z,X;if(J){if(this.consumeSpaces(),this.future().text!=="[")return null;Q=this.popToken(),{tokens:X,end:Z}=this.consumeArg(["]"])}else({tokens:X,start:Q,end:Z}=this.consumeArg());return this.pushToken(new KU("EOF",Z.loc)),this.pushTokens(X),Q.range(Z,"")}consumeSpaces(){for(;;){var J=this.future();if(J.text===" ")this.stack.pop();else break}}consumeArg(J){var Q=[],Z=J&&J.length>0;if(!Z)this.consumeSpaces();var X=this.future(),Y,K=0,G=0;do{if(Y=this.popToken(),Q.push(Y),Y.text==="{")++K;else if(Y.text==="}"){if(--K,K===-1)throw new r0("Extra }",Y)}else if(Y.text==="EOF")throw new r0("Unexpected end of input in a macro argument, expected '"+(J&&Z?J[G]:"}")+"'",Y);if(J&&Z)if((K===0||K===1&&J[G]==="{")&&Y.text===J[G]){if(++G,G===J.length){Q.splice(-G,G);break}}else G=0}while(K!==0||Z);if(X.text==="{"&&Q[Q.length-1].text==="}")Q.pop(),Q.shift();return Q.reverse(),{tokens:Q,start:X,end:Y}}consumeArgs(J,Q){if(Q){if(Q.length!==J+1)throw new r0("The length of delimiters doesn't match the number of args!");var Z=Q[0];for(var X=0;X<Z.length;X++){var Y=this.popToken();if(Z[X]!==Y.text)throw new r0("Use of the macro doesn't match its definition",Y)}}var K=[];for(var G=0;G<J;G++)K.push(this.consumeArg(Q&&Q[G+1]).tokens);return K}countExpansion(J){if(this.expansionCount+=J,this.expansionCount>this.settings.maxExpand)throw new r0("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(J){var Q=this.popToken(),Z=Q.text,X=!Q.noexpand?this._getExpansion(Z):null;if(X==null||J&&X.unexpandable){if(J&&X==null&&Z[0]==="\\"&&!this.isDefined(Z))throw new r0("Undefined control sequence: "+Z);return this.pushToken(Q),!1}this.countExpansion(1);var Y=X.tokens,K=this.consumeArgs(X.numArgs,X.delimiters);if(X.numArgs){Y=Y.slice();for(var G=Y.length-1;G>=0;--G){var q=Y[G];if(q.text==="#"){if(G===0)throw new r0("Incomplete placeholder at end of macro body",q);if(q=Y[--G],q.text==="#")Y.splice(G+1,1);else if(/^[1-9]$/.test(q.text))Y.splice(G,2,...K[+q.text-1]);else throw new r0("Not a valid argument number",q)}}}return this.pushTokens(Y),Y.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var J=this.stack.pop();if(J.treatAsRelax)J.text="\\relax";return J}throw Error()}expandMacro(J){return this.macros.has(J)?this.expandTokens([new KU(J)]):void 0}expandTokens(J){var Q=[],Z=this.stack.length;this.pushTokens(J);while(this.stack.length>Z)if(this.expandOnce(!0)===!1){var X=this.stack.pop();if(X.treatAsRelax)X.noexpand=!1,X.treatAsRelax=!1;Q.push(X)}return this.countExpansion(Q.length),Q}expandMacroAsText(J){var Q=this.expandMacro(J);if(Q)return Q.map((Z)=>Z.text).join("");else return Q}_getExpansion(J){var Q=this.macros.get(J);if(Q==null)return Q;if(J.length===1){var Z=this.lexer.catcodes[J];if(Z!=null&&Z!==13)return}var X=typeof Q==="function"?Q(this):Q;if(typeof X==="string"){var Y=0;if(X.indexOf("#")!==-1){var K=X.replace(/##/g,"");while(K.indexOf("#"+(Y+1))!==-1)++Y}var G=new Cj0(X,this.settings),q=[],z=G.lex();while(z.text!=="EOF")q.push(z),z=G.lex();q.reverse();var U={tokens:q,numArgs:Y};return U}return X}isDefined(J){return this.macros.has(J)||jM.hasOwnProperty(J)||X4.math.hasOwnProperty(J)||X4.text.hasOwnProperty(J)||S$0.hasOwnProperty(J)}isExpandable(J){var Q=this.macros.get(J);return Q!=null?typeof Q==="string"||typeof Q==="function"||!Q.unexpandable:jM.hasOwnProperty(J)&&!jM[J].primitive}},kj0=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,_11=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),YO1={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:"\\\"",math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},_j0={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},v$0=class J{static{D(this,"Parser")}constructor(Q,Z){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new b38(Q,Z,this.mode),this.settings=Z,this.leftrightDepth=0}expect(Q,Z){if(Z===void 0)Z=!0;if(this.fetch().text!==Q)throw new r0("Expected '"+Q+"', got '"+this.fetch().text+"'",this.fetch());if(Z)this.consume()}consume(){this.nextToken=null}fetch(){if(this.nextToken==null)this.nextToken=this.gullet.expandNextToken();return this.nextToken}switchMode(Q){this.mode=Q,this.gullet.switchMode(Q)}parse(){if(!this.settings.globalGroup)this.gullet.beginGroup();if(this.settings.colorIsTextColor)this.gullet.macros.set("\\color","\\textcolor");try{var Q=this.parseExpression(!1);if(this.expect("EOF"),!this.settings.globalGroup)this.gullet.endGroup();return Q}finally{this.gullet.endGroups()}}subparse(Q){var Z=this.nextToken;this.consume(),this.gullet.pushToken(new KU("}")),this.gullet.pushTokens(Q);var X=this.parseExpression(!1);return this.expect("}"),this.nextToken=Z,X}parseExpression(Q,Z){var X=[];while(!0){if(this.mode==="math")this.consumeSpaces();var Y=this.fetch();if(J.endOfExpression.indexOf(Y.text)!==-1)break;if(Z&&Y.text===Z)break;if(Q&&jM[Y.text]&&jM[Y.text].infix)break;var K=this.parseAtom(Z);if(!K)break;else if(K.type==="internal")continue;X.push(K)}if(this.mode==="text")this.formLigatures(X);return this.handleInfixNodes(X)}handleInfixNodes(Q){var Z=-1,X;for(var Y=0;Y<Q.length;Y++)if(Q[Y].type==="infix"){if(Z!==-1)throw new r0("only one infix operator per group",Q[Y].token);Z=Y,X=Q[Y].replaceWith}if(Z!==-1&&X){var K,G,q=Q.slice(0,Z),z=Q.slice(Z+1);if(q.length===1&&q[0].type==="ordgroup")K=q[0];else K={type:"ordgroup",mode:this.mode,body:q};if(z.length===1&&z[0].type==="ordgroup")G=z[0];else G={type:"ordgroup",mode:this.mode,body:z};var U;if(X==="\\\\abovefrac")U=this.callFunction(X,[K,Q[Z],G],[]);else U=this.callFunction(X,[K,G],[]);return[U]}else return Q}handleSupSubscript(Q){var Z=this.fetch(),X=Z.text;this.consume(),this.consumeSpaces();var Y=this.parseGroup(Q);if(!Y)throw new r0("Expected group after '"+X+"'",Z);return Y}formatUnsupportedCmd(Q){var Z=[];for(var X=0;X<Q.length;X++)Z.push({type:"textord",mode:"text",text:Q[X]});var Y={type:"text",mode:this.mode,body:Z},K={type:"color",mode:this.mode,color:this.settings.errorColor,body:[Y]};return K}parseAtom(Q){var Z=this.parseGroup("atom",Q);if(this.mode==="text")return Z;var X,Y;while(!0){this.consumeSpaces();var K=this.fetch();if(K.text==="\\limits"||K.text==="\\nolimits"){if(Z&&Z.type==="op"){var G=K.text==="\\limits";Z.limits=G,Z.alwaysHandleSupSub=!0}else if(Z&&Z.type==="operatorname"){if(Z.alwaysHandleSupSub)Z.limits=K.text==="\\limits"}else throw new r0("Limit controls must follow a math operator",K);this.consume()}else if(K.text==="^"){if(X)throw new r0("Double superscript",K);X=this.handleSupSubscript("superscript")}else if(K.text==="_"){if(Y)throw new r0("Double subscript",K);Y=this.handleSupSubscript("subscript")}else if(K.text==="'"){if(X)throw new r0("Double superscript",K);var q={type:"textord",mode:this.mode,text:"\\prime"},z=[q];this.consume();while(this.fetch().text==="'")z.push(q),this.consume();if(this.fetch().text==="^")z.push(this.handleSupSubscript("superscript"));X={type:"ordgroup",mode:this.mode,body:z}}else if(_11[K.text]){var U=kj0.test(K.text),W=[];W.push(new KU(_11[K.text])),this.consume();while(!0){var F=this.fetch().text;if(!_11[F])break;if(kj0.test(F)!==U)break;W.unshift(new KU(_11[F])),this.consume()}var H=this.subparse(W);if(U)Y={type:"ordgroup",mode:"math",body:H};else X={type:"ordgroup",mode:"math",body:H}}else break}if(X||Y)return{type:"supsub",mode:this.mode,base:Z,sup:X,sub:Y};else return Z}parseFunction(Q,Z){var X=this.fetch(),Y=X.text,K=jM[Y];if(!K)return null;if(this.consume(),Z&&Z!=="atom"&&!K.allowedInArgument)throw new r0("Got function '"+Y+"' with no arguments"+(Z?" as "+Z:""),X);else if(this.mode==="text"&&!K.allowedInText)throw new r0("Can't use function '"+Y+"' in text mode",X);else if(this.mode==="math"&&K.allowedInMath===!1)throw new r0("Can't use function '"+Y+"' in math mode",X);var{args:G,optArgs:q}=this.parseArguments(Y,K);return this.callFunction(Y,G,q,X,Q)}callFunction(Q,Z,X,Y,K){var G={funcName:Q,parser:this,token:Y,breakOnTokenText:K},q=jM[Q];if(q&&q.handler)return q.handler(G,Z,X);else throw new r0("No function handler for "+Q)}parseArguments(Q,Z){var X=Z.numArgs+Z.numOptionalArgs;if(X===0)return{args:[],optArgs:[]};var Y=[],K=[];for(var G=0;G<X;G++){var q=Z.argTypes&&Z.argTypes[G],z=G<Z.numOptionalArgs;if(Z.primitive&&q==null||Z.type==="sqrt"&&G===1&&K[0]==null)q="primitive";var U=this.parseGroupOfType("argument to '"+Q+"'",q,z);if(z)K.push(U);else if(U!=null)Y.push(U);else throw new r0("Null argument, please report this as a bug")}return{args:Y,optArgs:K}}parseGroupOfType(Q,Z,X){switch(Z){case"color":return this.parseColorGroup(X);case"size":return this.parseSizeGroup(X);case"url":return this.parseUrlGroup(X);case"math":case"text":return this.parseArgumentGroup(X,Z);case"hbox":{var Y=this.parseArgumentGroup(X,"text");return Y!=null?{type:"styling",mode:Y.mode,body:[Y],style:"text"}:null}case"raw":{var K=this.parseStringGroup("raw",X);return K!=null?{type:"raw",mode:"text",string:K.text}:null}case"primitive":{if(X)throw new r0("A primitive argument cannot be optional");var G=this.parseGroup(Q);if(G==null)throw new r0("Expected group as "+Q,this.fetch());return G}case"original":case null:case void 0:return this.parseArgumentGroup(X);default:throw new r0("Unknown group type as "+Q,this.fetch())}}consumeSpaces(){while(this.fetch().text===" ")this.consume()}parseStringGroup(Q,Z){var X=this.gullet.scanArgument(Z);if(X==null)return null;var Y="",K;while((K=this.fetch()).text!=="EOF")Y+=K.text,this.consume();return this.consume(),X.text=Y,X}parseRegexGroup(Q,Z){var X=this.fetch(),Y=X,K="",G;while((G=this.fetch()).text!=="EOF"&&Q.test(K+G.text))Y=G,K+=Y.text,this.consume();if(K==="")throw new r0("Invalid "+Z+": '"+X.text+"'",X);return X.range(Y,K)}parseColorGroup(Q){var Z=this.parseStringGroup("color",Q);if(Z==null)return null;var X=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(Z.text);if(!X)throw new r0("Invalid color: '"+Z.text+"'",Z);var Y=X[0];if(/^[0-9a-f]{6}$/i.test(Y))Y="#"+Y;return{type:"color-token",mode:this.mode,color:Y}}parseSizeGroup(Q){var Z,X=!1;if(this.gullet.consumeSpaces(),!Q&&this.gullet.future().text!=="{")Z=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size");else Z=this.parseStringGroup("size",Q);if(!Z)return null;if(!Q&&Z.text.length===0)Z.text="0pt",X=!0;var Y=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(Z.text);if(!Y)throw new r0("Invalid size: '"+Z.text+"'",Z);var K={number:+(Y[1]+Y[2]),unit:Y[3]};if(!uj0(K))throw new r0("Invalid unit: '"+K.unit+"'",Z);return{type:"size",mode:this.mode,value:K,isBlank:X}}parseUrlGroup(Q){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var Z=this.parseStringGroup("url",Q);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),Z==null)return null;var X=Z.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:X}}parseArgumentGroup(Q,Z){var X=this.gullet.scanArgument(Q);if(X==null)return null;var Y=this.mode;if(Z)this.switchMode(Z);this.gullet.beginGroup();var K=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var G={type:"ordgroup",mode:this.mode,loc:X.loc,body:K};if(Z)this.switchMode(Y);return G}parseGroup(Q,Z){var X=this.fetch(),Y=X.text,K;if(Y==="{"||Y==="\\begingroup"){this.consume();var G=Y==="{"?"}":"\\endgroup";this.gullet.beginGroup();var q=this.parseExpression(!1,G),z=this.fetch();this.expect(G),this.gullet.endGroup(),K={type:"ordgroup",mode:this.mode,loc:Xq.range(X,z),body:q,semisimple:Y==="\\begingroup"||void 0}}else if(K=this.parseFunction(Z,Q)||this.parseSymbol(),K==null&&Y[0]==="\\"&&!S$0.hasOwnProperty(Y)){if(this.settings.throwOnError)throw new r0("Undefined control sequence: "+Y,X);K=this.formatUnsupportedCmd(Y),this.consume()}return K}formLigatures(Q){var Z=Q.length-1;for(var X=0;X<Z;++X){var Y=Q[X],K=Y.text;if(K==="-"&&Q[X+1].text==="-")if(X+1<Z&&Q[X+2].text==="-")Q.splice(X,3,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+2]),text:"---"}),Z-=2;else Q.splice(X,2,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+1]),text:"--"}),Z-=1;if((K==="'"||K==="`")&&Q[X+1].text===K)Q.splice(X,2,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+1]),text:K+K}),Z-=1}}parseSymbol(){var Q=this.fetch(),Z=Q.text;if(/^\\verb[^a-zA-Z]/.test(Z)){this.consume();var X=Z.slice(5),Y=X.charAt(0)==="*";if(Y)X=X.slice(1);if(X.length<2||X.charAt(0)!==X.slice(-1))throw new r0(`\\verb assertion failed --
|
|
2299
|
-
please report what input caused this bug`);return X=X.slice(1,-1),{type:"verb",mode:"text",body:X,star:Y}}if(_j0.hasOwnProperty(Z[0])&&!X4[this.mode][Z[0]]){if(this.settings.strict&&this.mode==="math")this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+Z[0]+'" used in math mode',Q);Z=_j0[Z[0]]+Z.slice(1)}var K=v38.exec(Z);if(K){if(Z=Z.substring(0,K.index),Z==="i")Z="ı";else if(Z==="j")Z="ȷ"}var G;if(X4[this.mode][Z]){if(this.settings.strict&&this.mode==="math"&&UO1.indexOf(Z)>=0)this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+Z[0]+'" used in math mode',Q);var q=X4[this.mode][Z].group,z=Xq.range(Q),U;if(EN8.hasOwnProperty(q)){var W=q;U={type:"atom",mode:this.mode,family:W,loc:z,text:Z}}else U={type:q,mode:this.mode,loc:z,text:Z};G=U}else if(Z.charCodeAt(0)>=128){if(this.settings.strict){if(!AO1(Z.charCodeAt(0)))this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+Z[0]+'"'+(" ("+Z.charCodeAt(0)+")"),Q);else if(this.mode==="math")this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+Z[0]+'" used in math mode',Q)}G={type:"textord",mode:"text",loc:Xq.range(Q),text:Z}}else return null;if(this.consume(),K)for(var F=0;F<K[0].length;F++){var H=K[0][F];if(!YO1[H])throw new r0("Unknown accent ' "+H+"'",Q);var B=YO1[H][this.mode]||YO1[H].text;if(!B)throw new r0("Accent "+H+" unsupported in "+this.mode+" mode",Q);G={type:"accent",mode:this.mode,loc:Xq.range(Q),label:B,isStretchy:!1,isShifty:!0,base:G}}return G}};v$0.endOfExpression=["}","\\endgroup","\\end","\\right","&"];yO1=D(function(Q,Z){if(!(typeof Q==="string"||Q instanceof String))throw TypeError("KaTeX can only parse string typed expression");var X=new v$0(Q,Z);delete X.gullet.macros.current["\\df@tag"];var Y=X.parse();if(delete X.gullet.macros.current["\\current@color"],delete X.gullet.macros.current["\\color"],X.gullet.macros.get("\\df@tag")){if(!Z.displayMode)throw new r0("\\tag works only in display equations");Y=[{type:"tag",mode:"text",body:Y,tag:X.subparse([new KU("\\df@tag")])}]}return Y},"parseTree"),k$0=D(function(Q,Z,X){Z.textContent="";var Y=fO1(Q,X).toNode();Z.appendChild(Y)},"render");if(typeof document<"u"){if(document.compatMode!=="CSS1Compat")typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),k$0=D(function(){throw new r0("KaTeX doesn't work in quirks mode.")},"render")}y38=D(function(Q,Z){var X=fO1(Q,Z).toMarkup();return X},"renderToString"),f38=D(function(Q,Z){var X=new NO1(Z);return yO1(Q,X)},"generateParseTree"),_$0=D(function(Q,Z,X){if(X.throwOnError||!(Q instanceof r0))throw Q;var Y=Y0.makeSpan(["katex-error"],[new KK(Z)]);return Y.setAttribute("title",Q.toString()),Y.setAttribute("style","color:"+X.errorColor),Y},"renderError"),fO1=D(function(Q,Z){var X=new NO1(Z);try{var Y=yO1(Q,X);return aN8(Y,Q,X)}catch(K){return _$0(K,Q,X)}},"renderToDomTree"),h38=D(function(Q,Z){var X=new NO1(Z);try{var Y=yO1(Q,X);return rN8(Y,Q,X)}catch(K){return _$0(K,Q,X)}},"renderToHTMLTree"),g38={version:"0.16.11",render:k$0,renderToString:y38,ParseError:r0,SETTINGS_SCHEMA:x11,__parse:f38,__renderToDomTree:fO1,__renderToHTMLTree:h38,__setFontMetrics:hj0,__defineSymbol:s,__defineFunction:H6,__defineMacro:j1,__domTree:{Span:Hf,Anchor:wO1,SymbolNode:KK,SvgNode:lF,PathNode:EM,LineNode:qO1}}});function QQ(J){return function(Q){for(var Z=arguments.length,X=Array(Z>1?Z-1:0),Y=1;Y<Z;Y++)X[Y-1]=arguments[Y];return sO1(J,Q,X)}}function TE0(J){return function(){for(var Q=arguments.length,Z=Array(Q),X=0;X<Q;X++)Z[X]=arguments[X];return oO1(J,Z)}}function N9(J,Q){let Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:G01;if(h$0)h$0(J,null);let X=Q.length;while(X--){let Y=Q[X];if(typeof Y==="string"){let K=Z(Y);if(K!==Y){if(!TL8(Q))Q[X]=K;Y=K}}J[Y]=!0}return J}function CE0(J){for(let Q=0;Q<J.length;Q++)if(!Gq(J,Q))J[Q]=null;return J}function CM(J){let Q=PE0(null);for(let[Z,X]of IE0(J))if(Gq(J,Z))if(Array.isArray(X))Q[Z]=CE0(X);else if(X&&typeof X==="object"&&X.constructor===Object)Q[Z]=CM(X);else Q[Z]=X;return Q}function wI(J,Q){while(J!==null){let X=SL8(J,Q);if(X){if(X.get)return QQ(X.get);if(typeof X.value==="function")return QQ(X.value)}J=CL8(J)}function Z(){return null}return D(Z,"fallbackValue"),Z}function uj1(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lL8(),Q=D((f0)=>uj1(f0),"DOMPurify");if(Q.version="3.2.4",Q.removed=[],!J||!J.document||J.document.nodeType!==Af.document||!J.Element)return Q.isSupported=!1,Q;let{document:Z}=J,X=Z,Y=X.currentScript,{DocumentFragment:K,HTMLTemplateElement:G,Node:q,Element:z,NodeFilter:U,NamedNodeMap:W=J.NamedNodeMap||J.MozNamedAttrMap,HTMLFormElement:F,DOMParser:H,trustedTypes:B}=J,M=z.prototype,V=wI(M,"cloneNode"),N=wI(M,"remove"),L=wI(M,"nextSibling"),A=wI(M,"childNodes"),w=wI(M,"parentNode");if(typeof G==="function"){let f0=Z.createElement("template");if(f0.content&&f0.content.ownerDocument)Z=f0.content.ownerDocument}let R,O="",{implementation:j,createNodeIterator:$,createDocumentFragment:E,getElementsByTagName:I}=Z,{importNode:T}=X,S=i$0();Q.isSupported=typeof IE0==="function"&&typeof w==="function"&&j&&j.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:x,ERB_EXPR:h,TMPLIT_EXPR:v,DATA_ATTR:_,ARIA_ATTR:b,IS_SCRIPT_OR_DATA:g,ATTR_WHITESPACE:k,CUSTOM_ELEMENT:y}=l$0,{IS_ALLOWED_URI:f}=l$0,m=null,n=N9({},[...u$0,...gO1,...mO1,...uO1,...p$0]),p=null,e=N9({},[...d$0,...pO1,...c$0,...e11]),G1=Object.seal(PE0(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}})),U1=null,Z1=null,F1=!0,l=!0,d=!1,i=!0,r=!1,o=!0,Y1=!1,J1=!1,H1=!1,z1=!1,W1=!1,w1=!1,D1=!0,y1=!1,l1="user-content-",s1=!0,d1=!1,r1={},V1=null,t=N9({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),O1=null,M1=N9({},["audio","video","img","source","image","track"]),I1=null,X1=N9({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),v1="http://www.w3.org/1998/Math/MathML",q1="http://www.w3.org/2000/svg",P1="http://www.w3.org/1999/xhtml",T1=P1,b1=!1,h1=null,c1=N9({},[v1,q1,P1],hO1),W0=N9({},["mi","mo","mn","ms","mtext"]),p1=N9({},["annotation-xml"]),R0=N9({},["title","style","font","a","script"]),T0=null,A0=["application/xhtml+xml","text/html"],l0="text/html",I0=null,$0=null,F0=Z.createElement("form"),m0=D(function(g1){return g1 instanceof RegExp||g1 instanceof Function},"isRegexOrFunction"),n0=D(function(){let g1=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($0&&$0===g1)return;if(!g1||typeof g1!=="object")g1={};if(g1=CM(g1),T0=A0.indexOf(g1.PARSER_MEDIA_TYPE)===-1?l0:g1.PARSER_MEDIA_TYPE,I0=T0==="application/xhtml+xml"?hO1:G01,m=Gq(g1,"ALLOWED_TAGS")?N9({},g1.ALLOWED_TAGS,I0):n,p=Gq(g1,"ALLOWED_ATTR")?N9({},g1.ALLOWED_ATTR,I0):e,h1=Gq(g1,"ALLOWED_NAMESPACES")?N9({},g1.ALLOWED_NAMESPACES,hO1):c1,I1=Gq(g1,"ADD_URI_SAFE_ATTR")?N9(CM(X1),g1.ADD_URI_SAFE_ATTR,I0):X1,O1=Gq(g1,"ADD_DATA_URI_TAGS")?N9(CM(M1),g1.ADD_DATA_URI_TAGS,I0):M1,V1=Gq(g1,"FORBID_CONTENTS")?N9({},g1.FORBID_CONTENTS,I0):t,U1=Gq(g1,"FORBID_TAGS")?N9({},g1.FORBID_TAGS,I0):{},Z1=Gq(g1,"FORBID_ATTR")?N9({},g1.FORBID_ATTR,I0):{},r1=Gq(g1,"USE_PROFILES")?g1.USE_PROFILES:!1,F1=g1.ALLOW_ARIA_ATTR!==!1,l=g1.ALLOW_DATA_ATTR!==!1,d=g1.ALLOW_UNKNOWN_PROTOCOLS||!1,i=g1.ALLOW_SELF_CLOSE_IN_ATTR!==!1,r=g1.SAFE_FOR_TEMPLATES||!1,o=g1.SAFE_FOR_XML!==!1,Y1=g1.WHOLE_DOCUMENT||!1,z1=g1.RETURN_DOM||!1,W1=g1.RETURN_DOM_FRAGMENT||!1,w1=g1.RETURN_TRUSTED_TYPE||!1,H1=g1.FORCE_BODY||!1,D1=g1.SANITIZE_DOM!==!1,y1=g1.SANITIZE_NAMED_PROPS||!1,s1=g1.KEEP_CONTENT!==!1,d1=g1.IN_PLACE||!1,f=g1.ALLOWED_URI_REGEXP||SE0,T1=g1.NAMESPACE||P1,W0=g1.MATHML_TEXT_INTEGRATION_POINTS||W0,p1=g1.HTML_INTEGRATION_POINTS||p1,G1=g1.CUSTOM_ELEMENT_HANDLING||{},g1.CUSTOM_ELEMENT_HANDLING&&m0(g1.CUSTOM_ELEMENT_HANDLING.tagNameCheck))G1.tagNameCheck=g1.CUSTOM_ELEMENT_HANDLING.tagNameCheck;if(g1.CUSTOM_ELEMENT_HANDLING&&m0(g1.CUSTOM_ELEMENT_HANDLING.attributeNameCheck))G1.attributeNameCheck=g1.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;if(g1.CUSTOM_ELEMENT_HANDLING&&typeof g1.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==="boolean")G1.allowCustomizedBuiltInElements=g1.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;if(r)l=!1;if(W1)z1=!0;if(r1){if(m=N9({},p$0),p=[],r1.html===!0)N9(m,u$0),N9(p,d$0);if(r1.svg===!0)N9(m,gO1),N9(p,pO1),N9(p,e11);if(r1.svgFilters===!0)N9(m,mO1),N9(p,pO1),N9(p,e11);if(r1.mathMl===!0)N9(m,uO1),N9(p,c$0),N9(p,e11)}if(g1.ADD_TAGS){if(m===n)m=CM(m);N9(m,g1.ADD_TAGS,I0)}if(g1.ADD_ATTR){if(p===e)p=CM(p);N9(p,g1.ADD_ATTR,I0)}if(g1.ADD_URI_SAFE_ATTR)N9(I1,g1.ADD_URI_SAFE_ATTR,I0);if(g1.FORBID_CONTENTS){if(V1===t)V1=CM(V1);N9(V1,g1.FORBID_CONTENTS,I0)}if(s1)m["#text"]=!0;if(Y1)N9(m,["html","head","body"]);if(m.table)N9(m,["tbody"]),delete U1.tbody;if(g1.TRUSTED_TYPES_POLICY){if(typeof g1.TRUSTED_TYPES_POLICY.createHTML!=="function")throw Lf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof g1.TRUSTED_TYPES_POLICY.createScriptURL!=="function")throw Lf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=g1.TRUSTED_TYPES_POLICY,O=R.createHTML("")}else{if(R===void 0)R=iL8(B,Y);if(R!==null&&typeof O==="string")O=R.createHTML("")}if(nQ)nQ(g1);$0=g1},"_parseConfig"),w0=N9({},[...gO1,...mO1,...bL8]),Y6=N9({},[...uO1,...yL8]),s0=D(function(g1){let q0=w(g1);if(!q0||!q0.tagName)q0={namespaceURI:T1,tagName:"template"};let v0=G01(g1.tagName),V6=G01(q0.tagName);if(!h1[g1.namespaceURI])return!1;if(g1.namespaceURI===q1){if(q0.namespaceURI===P1)return v0==="svg";if(q0.namespaceURI===v1)return v0==="svg"&&(V6==="annotation-xml"||W0[V6]);return Boolean(w0[v0])}if(g1.namespaceURI===v1){if(q0.namespaceURI===P1)return v0==="math";if(q0.namespaceURI===q1)return v0==="math"&&p1[V6];return Boolean(Y6[v0])}if(g1.namespaceURI===P1){if(q0.namespaceURI===q1&&!p1[V6])return!1;if(q0.namespaceURI===v1&&!W0[V6])return!1;return!Y6[v0]&&(R0[v0]||!w0[v0])}if(T0==="application/xhtml+xml"&&h1[g1.namespaceURI])return!0;return!1},"_checkValidNamespace"),k1=D(function(g1){Vf(Q.removed,{element:g1});try{w(g1).removeChild(g1)}catch(q0){N(g1)}},"_forceRemove"),R1=D(function(g1,q0){try{Vf(Q.removed,{attribute:q0.getAttributeNode(g1),from:q0})}catch(v0){Vf(Q.removed,{attribute:null,from:q0})}if(q0.removeAttribute(g1),g1==="is")if(z1||W1)try{k1(q0)}catch(v0){}else try{q0.setAttribute(g1,"")}catch(v0){}},"_removeAttribute"),S1=D(function(g1){let q0=null,v0=null;if(H1)g1="<remove></remove>"+g1;else{let o8=m$0(g1,/^[\r\n\t ]+/);v0=o8&&o8[0]}if(T0==="application/xhtml+xml"&&T1===P1)g1='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+g1+"</body></html>";let V6=R?R.createHTML(g1):g1;if(T1===P1)try{q0=new H().parseFromString(V6,T0)}catch(o8){}if(!q0||!q0.documentElement){q0=j.createDocument(T1,"template",null);try{q0.documentElement.innerHTML=b1?O:V6}catch(o8){}}let z9=q0.body||q0.documentElement;if(g1&&v0)z9.insertBefore(Z.createTextNode(v0),z9.childNodes[0]||null);if(T1===P1)return I.call(q0,Y1?"html":"body")[0];return Y1?q0.documentElement:z9},"_initDocument"),i1=D(function(g1){return $.call(g1.ownerDocument||g1,g1,U.SHOW_ELEMENT|U.SHOW_COMMENT|U.SHOW_TEXT|U.SHOW_PROCESSING_INSTRUCTION|U.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),f1=D(function(g1){return g1 instanceof F&&(typeof g1.nodeName!=="string"||typeof g1.textContent!=="string"||typeof g1.removeChild!=="function"||!(g1.attributes instanceof W)||typeof g1.removeAttribute!=="function"||typeof g1.setAttribute!=="function"||typeof g1.namespaceURI!=="string"||typeof g1.insertBefore!=="function"||typeof g1.hasChildNodes!=="function")},"_isClobbered"),j0=D(function(g1){return typeof q==="function"&&g1 instanceof q},"_isNode");function H0(f0,g1,q0){t11(f0,(v0)=>{v0.call(Q,g1,q0,$0)})}D(H0,"_executeHooks");let r6=D(function(g1){let q0=null;if(H0(S.beforeSanitizeElements,g1,null),f1(g1))return k1(g1),!0;let v0=I0(g1.nodeName);if(H0(S.uponSanitizeElement,g1,{tagName:v0,allowedTags:m}),g1.hasChildNodes()&&!j0(g1.firstElementChild)&&lQ(/<[/\w]/g,g1.innerHTML)&&lQ(/<[/\w]/g,g1.textContent))return k1(g1),!0;if(g1.nodeType===Af.progressingInstruction)return k1(g1),!0;if(o&&g1.nodeType===Af.comment&&lQ(/<[/\w]/g,g1.data))return k1(g1),!0;if(!m[v0]||U1[v0]){if(!U1[v0]&&s6(v0)){if(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,v0))return!1;if(G1.tagNameCheck instanceof Function&&G1.tagNameCheck(v0))return!1}if(s1&&!V1[v0]){let V6=w(g1)||g1.parentNode,z9=A(g1)||g1.childNodes;if(z9&&V6){let o8=z9.length;for(let p8=o8-1;p8>=0;--p8){let I8=V(z9[p8],!0);I8.__removalCount=(g1.__removalCount||0)+1,V6.insertBefore(I8,L(g1))}}}return k1(g1),!0}if(g1 instanceof z&&!s0(g1))return k1(g1),!0;if((v0==="noscript"||v0==="noembed"||v0==="noframes")&&lQ(/<\/no(script|embed|frames)/i,g1.innerHTML))return k1(g1),!0;if(r&&g1.nodeType===Af.text){if(q0=g1.textContent,t11([x,h,v],(V6)=>{q0=Nf(q0,V6," ")}),g1.textContent!==q0)Vf(Q.removed,{element:g1.cloneNode()}),g1.textContent=q0}return H0(S.afterSanitizeElements,g1,null),!1},"_sanitizeElements"),C6=D(function(g1,q0,v0){if(D1&&(q0==="id"||q0==="name")&&((v0 in Z)||(v0 in F0)))return!1;if(l&&!Z1[q0]&&lQ(_,q0));else if(F1&&lQ(b,q0));else if(!p[q0]||Z1[q0])if(s6(g1)&&(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,g1)||G1.tagNameCheck instanceof Function&&G1.tagNameCheck(g1))&&(G1.attributeNameCheck instanceof RegExp&&lQ(G1.attributeNameCheck,q0)||G1.attributeNameCheck instanceof Function&&G1.attributeNameCheck(q0))||q0==="is"&&G1.allowCustomizedBuiltInElements&&(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,v0)||G1.tagNameCheck instanceof Function&&G1.tagNameCheck(v0)));else return!1;else if(I1[q0]);else if(lQ(f,Nf(v0,k,"")));else if((q0==="src"||q0==="xlink:href"||q0==="href")&&g1!=="script"&&_L8(v0,"data:")===0&&O1[g1]);else if(d&&!lQ(g,Nf(v0,k,"")));else if(v0)return!1;return!0},"_isValidAttribute"),s6=D(function(g1){return g1!=="annotation-xml"&&m$0(g1,y)},"_isBasicCustomElement"),M6=D(function(g1){H0(S.beforeSanitizeAttributes,g1,null);let{attributes:q0}=g1;if(!q0||f1(g1))return;let v0={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:p,forceKeepAttr:void 0},V6=q0.length;while(V6--){let z9=q0[V6],{name:o8,namespaceURI:p8,value:I8}=z9,v9=I0(o8),Z9=o8==="value"?I8:xL8(I8);if(v0.attrName=v9,v0.attrValue=Z9,v0.keepAttr=!0,v0.forceKeepAttr=void 0,H0(S.uponSanitizeAttribute,g1,v0),Z9=v0.attrValue,y1&&(v9==="id"||v9==="name"))R1(o8,g1),Z9=l1+Z9;if(o&&lQ(/((--!?|])>)|<\/(style|title)/i,Z9)){R1(o8,g1);continue}if(v0.forceKeepAttr)continue;if(R1(o8,g1),!v0.keepAttr)continue;if(!i&&lQ(/\/>/i,Z9)){R1(o8,g1);continue}if(r)t11([x,h,v],(U6)=>{Z9=Nf(Z9,U6," ")});let T2=I0(g1.nodeName);if(!C6(T2,v9,Z9))continue;if(R&&typeof B==="object"&&typeof B.getAttributeType==="function")if(p8);else switch(B.getAttributeType(T2,v9)){case"TrustedHTML":{Z9=R.createHTML(Z9);break}case"TrustedScriptURL":{Z9=R.createScriptURL(Z9);break}}try{if(p8)g1.setAttributeNS(p8,o8,Z9);else g1.setAttribute(o8,Z9);if(f1(g1))k1(g1);else g$0(Q.removed)}catch(U6){}}H0(S.afterSanitizeAttributes,g1,null)},"_sanitizeAttributes"),N8=D(function f0(g1){let q0=null,v0=i1(g1);H0(S.beforeSanitizeShadowDOM,g1,null);while(q0=v0.nextNode())if(H0(S.uponSanitizeShadowNode,q0,null),r6(q0),M6(q0),q0.content instanceof K)f0(q0.content);H0(S.afterSanitizeShadowDOM,g1,null)},"_sanitizeShadowDOM");return Q.sanitize=function(f0){let g1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q0=null,v0=null,V6=null,z9=null;if(b1=!f0,b1)f0="<!-->";if(typeof f0!=="string"&&!j0(f0))if(typeof f0.toString==="function"){if(f0=f0.toString(),typeof f0!=="string")throw Lf("dirty is not a string, aborting")}else throw Lf("toString is not a function");if(!Q.isSupported)return f0;if(!J1)n0(g1);if(Q.removed=[],typeof f0==="string")d1=!1;if(d1){if(f0.nodeName){let I8=I0(f0.nodeName);if(!m[I8]||U1[I8])throw Lf("root node is forbidden and cannot be sanitized in-place")}}else if(f0 instanceof q)if(q0=S1("<!---->"),v0=q0.ownerDocument.importNode(f0,!0),v0.nodeType===Af.element&&v0.nodeName==="BODY")q0=v0;else if(v0.nodeName==="HTML")q0=v0;else q0.appendChild(v0);else{if(!z1&&!r&&!Y1&&f0.indexOf("<")===-1)return R&&w1?R.createHTML(f0):f0;if(q0=S1(f0),!q0)return z1?null:w1?O:""}if(q0&&H1)k1(q0.firstChild);let o8=i1(d1?f0:q0);while(V6=o8.nextNode())if(r6(V6),M6(V6),V6.content instanceof K)N8(V6.content);if(d1)return f0;if(z1){if(W1){z9=E.call(q0.ownerDocument);while(q0.firstChild)z9.appendChild(q0.firstChild)}else z9=q0;if(p.shadowroot||p.shadowrootmode)z9=T.call(X,z9,!0);return z9}let p8=Y1?q0.outerHTML:q0.innerHTML;if(Y1&&m["!doctype"]&&q0.ownerDocument&&q0.ownerDocument.doctype&&q0.ownerDocument.doctype.name&&lQ(vE0,q0.ownerDocument.doctype.name))p8="<!DOCTYPE "+q0.ownerDocument.doctype.name+`>
|
|
2297
|
+
`+$+" children.");for(var S=0;S<$;S++){var x=new EM(w[S]),h=new lF([x],{width:"400em",height:J6(j),viewBox:"0 0 "+q+" "+O,preserveAspectRatio:I[S]+" slice"}),v=Y0.makeSvgSpan([E[S]],[h],Z);if($===1)return{span:v,minWidth:R,height:j};else v.style.height=J6(j),L.push(v)}return{span:Y0.makeSpan(["stretchy"],L,Z),minWidth:R,height:j}}}D(X,"buildSvgSpan_");var{span:Y,minWidth:K,height:G}=X();if(Y.height=G,Y.style.height=J6(G),K>0)Y.style.minWidth=J6(K);return Y},"svgSpan"),Q38=D(function(Q,Z,X,Y,K){var G,q=Q.height+Q.depth+X+Y;if(/fbox|color|angl/.test(Z)){if(G=Y0.makeSpan(["stretchy",Z],[],K),Z==="fbox"){var z=K.color&&K.getColor();if(z)G.style.borderColor=z}}else{var U=[];if(/^[bx]cancel$/.test(Z))U.push(new qO1({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"}));if(/^x?cancel$/.test(Z))U.push(new qO1({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var W=new lF(U,{width:"100%",height:J6(q)});G=Y0.makeSvgSpan([],[W],K)}return G.height=q,G.style.height=J6(q),G},"encloseSpan"),nF={encloseSpan:Q38,mathMLnode:oN8,svgSpan:J38};D(a8,"assertNodeType");D(l11,"assertSymbolNodeType");D(Bf,"checkSymbolNodeType");EO1=D((J,Q)=>{var Z,X,Y;if(J&&J.type==="supsub")X=a8(J.base,"accent"),Z=X.base,J.base=Z,Y=lj0(J2(J,Q)),J.base=X;else X=a8(J,"accent"),Z=X.base;var K=J2(Z,Q.havingCrampedStyle()),G=X.isShifty&&K8.isCharacterBox(Z),q=0;if(G){var z=K8.getBaseElem(Z),U=J2(z,Q.havingCrampedStyle());q=zO1(U).skew}var W=X.label==="\\c",F=W?K.height+K.depth:Math.min(K.height,Q.fontMetrics().xHeight),H;if(!X.isStretchy){var B,M;if(X.label==="\\vec")B=Y0.staticSvg("vec",Q),M=Y0.svgData.vec[1];else if(B=Y0.makeOrd({mode:X.mode,text:X.label},Q,"textord"),B=zO1(B),B.italic=0,M=B.width,W)F+=B.depth;H=Y0.makeSpan(["accent-body"],[B]);var V=X.label==="\\textcircled";if(V)H.classes.push("accent-full"),F=K.height;var N=q;if(!V)N-=M/2;if(H.style.left=J6(N),X.label==="\\textcircled")H.style.top=".2em";H=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"kern",size:-F},{type:"elem",elem:H}]},Q)}else H=nF.svgSpan(X,Q),H=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"elem",elem:H,wrapperClasses:["svg-align"],wrapperStyle:q>0?{width:"calc(100% - "+J6(2*q)+")",marginLeft:J6(2*q)}:void 0}]},Q);var L=Y0.makeSpan(["mord","accent"],[H],Q);if(Y)return Y.children[0]=L,Y.height=Math.max(L.height,Y.height),Y.classes[0]="mord",Y;else return L},"htmlBuilder$a"),Q$0=D((J,Q)=>{var Z=J.isStretchy?nF.mathMLnode(J.label):new g0.MathNode("mo",[GK(J.label,J.mode)]),X=new g0.MathNode("mover",[r2(J.base,Q),Z]);return X.setAttribute("accent","true"),X},"mathmlBuilder$9"),Z38=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((J)=>"\\"+J).join("|"));H6({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:D((J,Q)=>{var Z=m11(Q[0]),X=!Z38.test(J.funcName),Y=!X||J.funcName==="\\widehat"||J.funcName==="\\widetilde"||J.funcName==="\\widecheck";return{type:"accent",mode:J.parser.mode,label:J.funcName,isStretchy:X,isShifty:Y,base:Z}},"handler"),htmlBuilder:EO1,mathmlBuilder:Q$0});H6({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.","\\\"","\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:D((J,Q)=>{var Z=Q[0],X=J.parser.mode;if(X==="math")J.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+J.funcName+" works only in text mode"),X="text";return{type:"accent",mode:X,label:J.funcName,isStretchy:!1,isShifty:!0,base:Z}},"handler"),htmlBuilder:EO1,mathmlBuilder:Q$0});H6({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"accentUnder",mode:Z.mode,label:X,base:Y}},"handler"),htmlBuilder:D((J,Q)=>{var Z=J2(J.base,Q),X=nF.svgSpan(J,Q),Y=J.label==="\\utilde"?0.12:0,K=Y0.makeVList({positionType:"top",positionData:Z.height,children:[{type:"elem",elem:X,wrapperClasses:["svg-align"]},{type:"kern",size:Y},{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord","accentunder"],[K],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=nF.mathMLnode(J.label),X=new g0.MathNode("munder",[r2(J.base,Q),Z]);return X.setAttribute("accentunder","true"),X},"mathmlBuilder")});v11=D((J)=>{var Q=new g0.MathNode("mpadded",J?[J]:[]);return Q.setAttribute("width","+0.6em"),Q.setAttribute("lspace","0.3em"),Q},"paddedNode");H6({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(J,Q,Z){var{parser:X,funcName:Y}=J;return{type:"xArrow",mode:X.mode,label:Y,body:Q[0],below:Z[0]}},htmlBuilder(J,Q){var Z=Q.style,X=Q.havingStyle(Z.sup()),Y=Y0.wrapFragment(J2(J.body,X,Q),Q),K=J.label.slice(0,2)==="\\x"?"x":"cd";Y.classes.push(K+"-arrow-pad");var G;if(J.below)X=Q.havingStyle(Z.sub()),G=Y0.wrapFragment(J2(J.below,X,Q),Q),G.classes.push(K+"-arrow-pad");var q=nF.svgSpan(J,Q),z=-Q.fontMetrics().axisHeight+0.5*q.height,U=-Q.fontMetrics().axisHeight-0.5*q.height-0.111;if(Y.depth>0.25||J.label==="\\xleftequilibrium")U-=Y.depth;var W;if(G){var F=-Q.fontMetrics().axisHeight+G.height+0.5*q.height+0.111;W=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Y,shift:U},{type:"elem",elem:q,shift:z},{type:"elem",elem:G,shift:F}]},Q)}else W=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Y,shift:U},{type:"elem",elem:q,shift:z}]},Q);return W.children[0].children[0].children[1].classes.push("svg-align"),Y0.makeSpan(["mrel","x-arrow"],[W],Q)},mathmlBuilder(J,Q){var Z=nF.mathMLnode(J.label);Z.setAttribute("minsize",J.label.charAt(0)==="x"?"1.75em":"3.0em");var X;if(J.body){var Y=v11(r2(J.body,Q));if(J.below){var K=v11(r2(J.below,Q));X=new g0.MathNode("munderover",[Z,K,Y])}else X=new g0.MathNode("mover",[Z,Y])}else if(J.below){var G=v11(r2(J.below,Q));X=new g0.MathNode("munder",[Z,G])}else X=v11(),X=new g0.MathNode("mover",[Z,X]);return X}});X38=Y0.makeSpan;D(IO1,"htmlBuilder$9");D(PO1,"mathmlBuilder$8");H6({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"mclass",mode:Z.mode,mclass:"m"+X.slice(5),body:N7(Y),isCharacterBox:K8.isCharacterBox(Y)}},htmlBuilder:IO1,mathmlBuilder:PO1});i11=D((J)=>{var Q=J.type==="ordgroup"&&J.body.length?J.body[0]:J;if(Q.type==="atom"&&(Q.family==="bin"||Q.family==="rel"))return"m"+Q.family;else return"mord"},"binrelClass");H6({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(J,Q){var{parser:Z}=J;return{type:"mclass",mode:Z.mode,mclass:i11(Q[0]),body:N7(Q[1]),isCharacterBox:K8.isCharacterBox(Q[1])}}});H6({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[1],K=Q[0],G;if(X!=="\\stackrel")G=i11(Y);else G="mrel";var q={type:"op",mode:Y.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:X!=="\\stackrel",body:N7(Y)},z={type:"supsub",mode:K.mode,base:q,sup:X==="\\underset"?null:K,sub:X==="\\underset"?K:null};return{type:"mclass",mode:Z.mode,mclass:G,body:[z],isCharacterBox:K8.isCharacterBox(z)}},htmlBuilder:IO1,mathmlBuilder:PO1});H6({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"pmb",mode:Z.mode,mclass:i11(Q[0]),body:N7(Q[0])}},htmlBuilder(J,Q){var Z=H5(J.body,Q,!0),X=Y0.makeSpan([J.mclass],Z,Q);return X.style.textShadow="0.02em 0.01em 0.04px",X},mathmlBuilder(J,Q){var Z=dZ(J.body,Q),X=new g0.MathNode("mstyle",Z);return X.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),X}});Y38={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Dj0=D(()=>{return{type:"styling",body:[],mode:"math",style:"display"}},"newCell"),Mj0=D((J)=>{return J.type==="textord"&&J.text==="@"},"isStartOfArrow"),K38=D((J,Q)=>{return(J.type==="mathord"||J.type==="atom")&&J.text===Q},"isLabelEnd");D(Z$0,"cdArrow");D(X$0,"parseCD");H6({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J;return{type:"cdlabel",mode:Z.mode,side:X.slice(4),label:Q[0]}},htmlBuilder(J,Q){var Z=Q.havingStyle(Q.style.sup()),X=Y0.wrapFragment(J2(J.label,Z,Q),Q);return X.classes.push("cd-label-"+J.side),X.style.bottom=J6(0.8-X.depth),X.height=0,X.depth=0,X},mathmlBuilder(J,Q){var Z=new g0.MathNode("mrow",[r2(J.label,Q)]);if(Z=new g0.MathNode("mpadded",[Z]),Z.setAttribute("width","0"),J.side==="left")Z.setAttribute("lspace","-1width");return Z.setAttribute("voffset","0.7em"),Z=new g0.MathNode("mstyle",[Z]),Z.setAttribute("displaystyle","false"),Z.setAttribute("scriptlevel","1"),Z}});H6({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(J,Q){var{parser:Z}=J;return{type:"cdlabelparent",mode:Z.mode,fragment:Q[0]}},htmlBuilder(J,Q){var Z=Y0.wrapFragment(J2(J.fragment,Q),Q);return Z.classes.push("cd-vert-arrow"),Z},mathmlBuilder(J,Q){return new g0.MathNode("mrow",[r2(J.fragment,Q)])}});H6({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"ordgroup"),Y=X.body,K="";for(var G=0;G<Y.length;G++){var q=a8(Y[G],"textord");K+=q.text}var z=parseInt(K),U;if(isNaN(z))throw new r0("\\@char has non-numeric argument "+K);else if(z<0||z>=1114111)throw new r0("\\@char with invalid code point "+K);else if(z<=65535)U=String.fromCharCode(z);else z-=65536,U=String.fromCharCode((z>>10)+55296,(z&1023)+56320);return{type:"textord",mode:Z.mode,text:U}}});Y$0=D((J,Q)=>{var Z=H5(J.body,Q.withColor(J.color),!1);return Y0.makeFragment(Z)},"htmlBuilder$8"),K$0=D((J,Q)=>{var Z=dZ(J.body,Q.withColor(J.color)),X=new g0.MathNode("mstyle",Z);return X.setAttribute("mathcolor",J.color),X},"mathmlBuilder$7");H6({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"color-token").color,Y=Q[1];return{type:"color",mode:Z.mode,color:X,body:N7(Y)}},htmlBuilder:Y$0,mathmlBuilder:K$0});H6({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(J,Q){var{parser:Z,breakOnTokenText:X}=J,Y=a8(Q[0],"color-token").color;Z.gullet.macros.set("\\current@color",Y);var K=Z.parseExpression(!0,X);return{type:"color",mode:Z.mode,color:Y,body:K}},htmlBuilder:Y$0,mathmlBuilder:K$0});H6({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(J,Q,Z){var{parser:X}=J,Y=X.gullet.future().text==="["?X.parseSizeGroup(!0):null,K=!X.settings.displayMode||!X.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:X.mode,newLine:K,size:Y&&a8(Y,"size").value}},htmlBuilder(J,Q){var Z=Y0.makeSpan(["mspace"],[],Q);if(J.newLine){if(Z.classes.push("newline"),J.size)Z.style.marginTop=J6(h4(J.size,Q))}return Z},mathmlBuilder(J,Q){var Z=new g0.MathNode("mspace");if(J.newLine){if(Z.setAttribute("linebreak","newline"),J.size)Z.setAttribute("height",J6(h4(J.size,Q)))}return Z}});HO1={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},G$0=D((J)=>{var Q=J.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(Q))throw new r0("Expected a control sequence",J);return Q},"checkControlSequence"),G38=D((J)=>{var Q=J.gullet.popToken();if(Q.text==="="){if(Q=J.gullet.popToken(),Q.text===" ")Q=J.gullet.popToken()}return Q},"getRHS"),q$0=D((J,Q,Z,X)=>{var Y=J.gullet.macros.get(Z.text);if(Y==null)Z.noexpand=!0,Y={tokens:[Z],numArgs:0,unexpandable:!J.gullet.isExpandable(Z.text)};J.gullet.macros.set(Q,Y,X)},"letCommand");H6({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(J){var{parser:Q,funcName:Z}=J;Q.consumeSpaces();var X=Q.fetch();if(HO1[X.text]){if(Z==="\\global"||Z==="\\\\globallong")X.text=HO1[X.text];return a8(Q.parseFunction(),"internal")}throw new r0("Invalid token after macro prefix",X)}});H6({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=Q.gullet.popToken(),Y=X.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(Y))throw new r0("Expected a control sequence",X);var K=0,G,q=[[]];while(Q.gullet.future().text!=="{")if(X=Q.gullet.popToken(),X.text==="#"){if(Q.gullet.future().text==="{"){G=Q.gullet.future(),q[K].push("{");break}if(X=Q.gullet.popToken(),!/^[1-9]$/.test(X.text))throw new r0('Invalid argument number "'+X.text+'"');if(parseInt(X.text)!==K+1)throw new r0('Argument number "'+X.text+'" out of order');K++,q.push([])}else if(X.text==="EOF")throw new r0("Expected a macro definition");else q[K].push(X.text);var{tokens:z}=Q.gullet.consumeArg();if(G)z.unshift(G);if(Z==="\\edef"||Z==="\\xdef")z=Q.gullet.expandTokens(z),z.reverse();return Q.gullet.macros.set(Y,{tokens:z,numArgs:K,delimiters:q},Z===HO1[Z]),{type:"internal",mode:Q.mode}}});H6({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=G$0(Q.gullet.popToken());Q.gullet.consumeSpaces();var Y=G38(Q);return q$0(Q,X,Y,Z==="\\\\globallet"),{type:"internal",mode:Q.mode}}});H6({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J){var{parser:Q,funcName:Z}=J,X=G$0(Q.gullet.popToken()),Y=Q.gullet.popToken(),K=Q.gullet.popToken();return q$0(Q,X,K,Z==="\\\\globalfuture"),Q.gullet.pushToken(K),Q.gullet.pushToken(Y),{type:"internal",mode:Q.mode}}});Gf=D(function(Q,Z,X){var Y=X4.math[Q]&&X4.math[Q].replace,K=p11(Y||Q,Z,X);if(!K)throw Error("Unsupported symbol "+Q+" and font size "+Z+".");return K},"getMetrics"),TO1=D(function(Q,Z,X,Y){var K=X.havingBaseStyle(Z),G=Y0.makeSpan(Y.concat(K.sizingClasses(X)),[Q],X),q=K.sizeMultiplier/X.sizeMultiplier;return G.height*=q,G.depth*=q,G.maxFontSize=K.sizeMultiplier,G},"styleWrap"),z$0=D(function(Q,Z,X){var Y=Z.havingBaseStyle(X),K=(1-Z.sizeMultiplier/Y.sizeMultiplier)*Z.fontMetrics().axisHeight;Q.classes.push("delimcenter"),Q.style.top=J6(K),Q.height-=K,Q.depth+=K},"centerSpan"),q38=D(function(Q,Z,X,Y,K,G){var q=Y0.makeSymbol(Q,"Main-Regular",K,Y),z=TO1(q,Z,Y,G);if(X)z$0(z,Y,Z);return z},"makeSmallDelim"),z38=D(function(Q,Z,X,Y){return Y0.makeSymbol(Q,"Size"+Z+"-Regular",X,Y)},"mathrmSize"),U$0=D(function(Q,Z,X,Y,K,G){var q=z38(Q,Z,K,Y),z=TO1(Y0.makeSpan(["delimsizing","size"+Z],[q],Y),H8.TEXT,Y,G);if(X)z$0(z,Y,H8.TEXT);return z},"makeLargeDelim"),sR1=D(function(Q,Z,X){var Y;if(Z==="Size1-Regular")Y="delim-size1";else Y="delim-size4";var K=Y0.makeSpan(["delimsizinginner",Y],[Y0.makeSpan([],[Y0.makeSymbol(Q,Z,X)])]);return{type:"elem",elem:K}},"makeGlyphSpan"),oR1=D(function(Q,Z,X){var Y=YU["Size4-Regular"][Q.charCodeAt(0)]?YU["Size4-Regular"][Q.charCodeAt(0)][4]:YU["Size1-Regular"][Q.charCodeAt(0)][4],K=new EM("inner",AN8(Q,Math.round(1000*Z))),G=new lF([K],{width:J6(Y),height:J6(Z),style:"width:"+J6(Y),viewBox:"0 0 "+1000*Y+" "+Math.round(1000*Z),preserveAspectRatio:"xMinYMin"}),q=Y0.makeSvgSpan([],[G],X);return q.height=Z,q.style.height=J6(Z),q.style.width=J6(Y),{type:"elem",elem:q}},"makeInner"),k11={type:"kern",size:-1*BO1},U38=["|","\\lvert","\\rvert","\\vert"],W38=["\\|","\\lVert","\\rVert","\\Vert"],W$0=D(function(Q,Z,X,Y,K,G){var q,z,U,W,F="",H=0;q=U=W=Q,z=null;var B="Size1-Regular";if(Q==="\\uparrow")U=W="⏐";else if(Q==="\\Uparrow")U=W="‖";else if(Q==="\\downarrow")q=U="⏐";else if(Q==="\\Downarrow")q=U="‖";else if(Q==="\\updownarrow")q="\\uparrow",U="⏐",W="\\downarrow";else if(Q==="\\Updownarrow")q="\\Uparrow",U="‖",W="\\Downarrow";else if(K8.contains(U38,Q))U="∣",F="vert",H=333;else if(K8.contains(W38,Q))U="∥",F="doublevert",H=556;else if(Q==="["||Q==="\\lbrack")q="⎡",U="⎢",W="⎣",B="Size4-Regular",F="lbrack",H=667;else if(Q==="]"||Q==="\\rbrack")q="⎤",U="⎥",W="⎦",B="Size4-Regular",F="rbrack",H=667;else if(Q==="\\lfloor"||Q==="⌊")U=q="⎢",W="⎣",B="Size4-Regular",F="lfloor",H=667;else if(Q==="\\lceil"||Q==="⌈")q="⎡",U=W="⎢",B="Size4-Regular",F="lceil",H=667;else if(Q==="\\rfloor"||Q==="⌋")U=q="⎥",W="⎦",B="Size4-Regular",F="rfloor",H=667;else if(Q==="\\rceil"||Q==="⌉")q="⎤",U=W="⎥",B="Size4-Regular",F="rceil",H=667;else if(Q==="("||Q==="\\lparen")q="⎛",U="⎜",W="⎝",B="Size4-Regular",F="lparen",H=875;else if(Q===")"||Q==="\\rparen")q="⎞",U="⎟",W="⎠",B="Size4-Regular",F="rparen",H=875;else if(Q==="\\{"||Q==="\\lbrace")q="⎧",z="⎨",W="⎩",U="⎪",B="Size4-Regular";else if(Q==="\\}"||Q==="\\rbrace")q="⎫",z="⎬",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\lgroup"||Q==="⟮")q="⎧",W="⎩",U="⎪",B="Size4-Regular";else if(Q==="\\rgroup"||Q==="⟯")q="⎫",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\lmoustache"||Q==="⎰")q="⎧",W="⎭",U="⎪",B="Size4-Regular";else if(Q==="\\rmoustache"||Q==="⎱")q="⎫",W="⎩",U="⎪",B="Size4-Regular";var M=Gf(q,B,K),V=M.height+M.depth,N=Gf(U,B,K),L=N.height+N.depth,A=Gf(W,B,K),w=A.height+A.depth,R=0,O=1;if(z!==null){var j=Gf(z,B,K);R=j.height+j.depth,O=2}var $=V+w+R,E=Math.max(0,Math.ceil((Z-$)/(O*L))),I=$+E*O*L,T=Y.fontMetrics().axisHeight;if(X)T*=Y.sizeMultiplier;var S=I/2-T,x=[];if(F.length>0){var h=I-V-w,v=Math.round(I*1000),_=wN8(F,Math.round(h*1000)),b=new EM(F,_),g=(H/1000).toFixed(3)+"em",k=(v/1000).toFixed(3)+"em",y=new lF([b],{width:g,height:k,viewBox:"0 0 "+H+" "+v}),f=Y0.makeSvgSpan([],[y],Y);f.height=v/1000,f.style.width=g,f.style.height=k,x.push({type:"elem",elem:f})}else{if(x.push(sR1(W,B,K)),x.push(k11),z===null){var m=I-V-w+2*BO1;x.push(oR1(U,m,Y))}else{var n=(I-V-w-R)/2+2*BO1;x.push(oR1(U,n,Y)),x.push(k11),x.push(sR1(z,B,K)),x.push(k11),x.push(oR1(U,n,Y))}x.push(k11),x.push(sR1(q,B,K))}var p=Y.havingBaseStyle(H8.TEXT),e=Y0.makeVList({positionType:"bottom",positionData:S,children:x},p);return TO1(Y0.makeSpan(["delimsizing","mult"],[e],p),H8.TEXT,Y,G)},"makeStackedDelim"),JO1=D(function(Q,Z,X,Y,K){var G=LN8(Q,Y,X),q=new EM(Q,G),z=new lF([q],{width:"400em",height:J6(Z),viewBox:"0 0 400000 "+X,preserveAspectRatio:"xMinYMin slice"});return Y0.makeSvgSpan(["hide-tail"],[z],K)},"sqrtSvg"),F38=D(function(Q,Z){var X=Z.havingBaseSizing(),Y=D$0("\\surd",Q*X.sizeMultiplier,B$0,X),K=X.sizeMultiplier,G=Math.max(0,Z.minRuleThickness-Z.fontMetrics().sqrtRuleThickness),q,z=0,U=0,W=0,F;if(Y.type==="small"){if(W=1000+1000*G+tR1,Q<1)K=1;else if(Q<1.4)K=0.7;z=(1+G+eR1)/K,U=(1+G)/K,q=JO1("sqrtMain",z,W,G,Z),q.style.minWidth="0.853em",F=0.833/K}else if(Y.type==="large")W=(1000+tR1)*zf[Y.size],U=(zf[Y.size]+G)/K,z=(zf[Y.size]+G+eR1)/K,q=JO1("sqrtSize"+Y.size,z,W,G,Z),q.style.minWidth="1.02em",F=1/K;else z=Q+G+eR1,U=Q+G,W=Math.floor(1000*Q+G)+tR1,q=JO1("sqrtTall",z,W,G,Z),q.style.minWidth="0.742em",F=1.056;return q.height=U,q.style.height=J6(z),{span:q,advanceWidth:F,ruleWidth:(Z.fontMetrics().sqrtRuleThickness+G)*K}},"makeSqrtImage"),F$0=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],H38=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],H$0=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],zf=[0,1.2,1.8,2.4,3],B38=D(function(Q,Z,X,Y,K){if(Q==="<"||Q==="\\lt"||Q==="⟨")Q="\\langle";else if(Q===">"||Q==="\\gt"||Q==="⟩")Q="\\rangle";if(K8.contains(F$0,Q)||K8.contains(H$0,Q))return U$0(Q,Z,!1,X,Y,K);else if(K8.contains(H38,Q))return W$0(Q,zf[Z],!1,X,Y,K);else throw new r0("Illegal delimiter: '"+Q+"'")},"makeSizedDelim"),D38=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],M38=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"stack"}],B$0=[{type:"small",style:H8.SCRIPTSCRIPT},{type:"small",style:H8.SCRIPT},{type:"small",style:H8.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],V38=D(function(Q){if(Q.type==="small")return"Main-Regular";else if(Q.type==="large")return"Size"+Q.size+"-Regular";else if(Q.type==="stack")return"Size4-Regular";else throw Error("Add support for delim type '"+Q.type+"' here.")},"delimTypeToFont"),D$0=D(function(Q,Z,X,Y){var K=Math.min(2,3-Y.style.size);for(var G=K;G<X.length;G++){if(X[G].type==="stack")break;var q=Gf(Q,V38(X[G]),"math"),z=q.height+q.depth;if(X[G].type==="small"){var U=Y.havingBaseStyle(X[G].style);z*=U.sizeMultiplier}if(z>Z)return X[G]}return X[X.length-1]},"traverseSequence"),M$0=D(function(Q,Z,X,Y,K,G){if(Q==="<"||Q==="\\lt"||Q==="⟨")Q="\\langle";else if(Q===">"||Q==="\\gt"||Q==="⟩")Q="\\rangle";var q;if(K8.contains(H$0,Q))q=D38;else if(K8.contains(F$0,Q))q=B$0;else q=M38;var z=D$0(Q,Z,q,Y);if(z.type==="small")return q38(Q,z.style,X,Y,K,G);else if(z.type==="large")return U$0(Q,z.size,X,Y,K,G);else return W$0(Q,Z,X,Y,K,G)},"makeCustomSizedDelim"),N38=D(function(Q,Z,X,Y,K,G){var q=Y.fontMetrics().axisHeight*Y.sizeMultiplier,z=901,U=5/Y.fontMetrics().ptPerEm,W=Math.max(Z-q,X+q),F=Math.max(W/500*z,2*W-U);return M$0(Q,F,!0,Y,K,G)},"makeLeftRightDelim"),cF={sqrtImage:F38,sizedDelim:B38,sizeToMaxHeight:zf,customSizedDelim:M$0,leftRightDelim:N38},Vj0={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},L38=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];D(Df,"checkDelimiter");H6({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:D((J,Q)=>{var Z=Df(Q[0],J);return{type:"delimsizing",mode:J.parser.mode,size:Vj0[J.funcName].size,mclass:Vj0[J.funcName].mclass,delim:Z.text}},"handler"),htmlBuilder:D((J,Q)=>{if(J.delim===".")return Y0.makeSpan([J.mclass]);return cF.sizedDelim(J.delim,J.size,Q,J.mode,[J.mclass])},"htmlBuilder"),mathmlBuilder:D((J)=>{var Q=[];if(J.delim!==".")Q.push(GK(J.delim,J.mode));var Z=new g0.MathNode("mo",Q);if(J.mclass==="mopen"||J.mclass==="mclose")Z.setAttribute("fence","true");else Z.setAttribute("fence","false");Z.setAttribute("stretchy","true");var X=J6(cF.sizeToMaxHeight[J.size]);return Z.setAttribute("minsize",X),Z.setAttribute("maxsize",X),Z},"mathmlBuilder")});D(DO1,"assertParsed");H6({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=J.parser.gullet.macros.get("\\current@color");if(Z&&typeof Z!=="string")throw new r0("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:J.parser.mode,delim:Df(Q[0],J).text,color:Z}},"handler")});H6({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=Df(Q[0],J),X=J.parser;++X.leftrightDepth;var Y=X.parseExpression(!1);--X.leftrightDepth,X.expect("\\right",!1);var K=a8(X.parseFunction(),"leftright-right");return{type:"leftright",mode:X.mode,body:Y,left:Z.text,right:K.delim,rightColor:K.color}},"handler"),htmlBuilder:D((J,Q)=>{DO1(J);var Z=H5(J.body,Q,!0,["mopen","mclose"]),X=0,Y=0,K=!1;for(var G=0;G<Z.length;G++)if(Z[G].isMiddle)K=!0;else X=Math.max(Z[G].height,X),Y=Math.max(Z[G].depth,Y);X*=Q.sizeMultiplier,Y*=Q.sizeMultiplier;var q;if(J.left===".")q=Wf(Q,["mopen"]);else q=cF.leftRightDelim(J.left,X,Y,Q,J.mode,["mopen"]);if(Z.unshift(q),K)for(var z=1;z<Z.length;z++){var U=Z[z],W=U.isMiddle;if(W)Z[z]=cF.leftRightDelim(W.delim,X,Y,W.options,J.mode,[])}var F;if(J.right===".")F=Wf(Q,["mclose"]);else{var H=J.rightColor?Q.withColor(J.rightColor):Q;F=cF.leftRightDelim(J.right,X,Y,H,J.mode,["mclose"])}return Z.push(F),Y0.makeSpan(["minner"],Z,Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{DO1(J);var Z=dZ(J.body,Q);if(J.left!=="."){var X=new g0.MathNode("mo",[GK(J.left,J.mode)]);X.setAttribute("fence","true"),Z.unshift(X)}if(J.right!=="."){var Y=new g0.MathNode("mo",[GK(J.right,J.mode)]);if(Y.setAttribute("fence","true"),J.rightColor)Y.setAttribute("mathcolor",J.rightColor);Z.push(Y)}return jO1(Z)},"mathmlBuilder")});H6({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var Z=Df(Q[0],J);if(!J.parser.leftrightDepth)throw new r0("\\middle without preceding \\left",Z);return{type:"middle",mode:J.parser.mode,delim:Z.text}},"handler"),htmlBuilder:D((J,Q)=>{var Z;if(J.delim===".")Z=Wf(Q,[]);else{Z=cF.sizedDelim(J.delim,1,Q,J.mode,[]);var X={delim:J.delim,options:Q};Z.isMiddle=X}return Z},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=J.delim==="\\vert"||J.delim==="|"?GK("|","text"):GK(J.delim,J.mode),X=new g0.MathNode("mo",[Z]);return X.setAttribute("fence","true"),X.setAttribute("lspace","0.05em"),X.setAttribute("rspace","0.05em"),X},"mathmlBuilder")});CO1=D((J,Q)=>{var Z=Y0.wrapFragment(J2(J.body,Q),Q),X=J.label.slice(1),Y=Q.sizeMultiplier,K,G=0,q=K8.isCharacterBox(J.body);if(X==="sout")K=Y0.makeSpan(["stretchy","sout"]),K.height=Q.fontMetrics().defaultRuleThickness/Y,G=-0.5*Q.fontMetrics().xHeight;else if(X==="phase"){var z=h4({number:0.6,unit:"pt"},Q),U=h4({number:0.35,unit:"ex"},Q),W=Q.havingBaseSizing();Y=Y/W.sizeMultiplier;var F=Z.height+Z.depth+z+U;Z.style.paddingLeft=J6(F/2+z);var H=Math.floor(1000*F*Y),B=VN8(H),M=new lF([new EM("phase",B)],{width:"400em",height:J6(H/1000),viewBox:"0 0 400000 "+H,preserveAspectRatio:"xMinYMin slice"});K=Y0.makeSvgSpan(["hide-tail"],[M],Q),K.style.height=J6(F),G=Z.depth+z+U}else{if(/cancel/.test(X)){if(!q)Z.classes.push("cancel-pad")}else if(X==="angl")Z.classes.push("anglpad");else Z.classes.push("boxpad");var V=0,N=0,L=0;if(/box/.test(X))L=Math.max(Q.fontMetrics().fboxrule,Q.minRuleThickness),V=Q.fontMetrics().fboxsep+(X==="colorbox"?0:L),N=V;else if(X==="angl")L=Math.max(Q.fontMetrics().defaultRuleThickness,Q.minRuleThickness),V=4*L,N=Math.max(0,0.25-Z.depth);else V=q?0.2:0,N=V;if(K=nF.encloseSpan(Z,X,V,N,Q),/fbox|boxed|fcolorbox/.test(X))K.style.borderStyle="solid",K.style.borderWidth=J6(L);else if(X==="angl"&&L!==0.049)K.style.borderTopWidth=J6(L),K.style.borderRightWidth=J6(L);if(G=Z.depth+N,J.backgroundColor){if(K.style.backgroundColor=J.backgroundColor,J.borderColor)K.style.borderColor=J.borderColor}}var A;if(J.backgroundColor)A=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:K,shift:G},{type:"elem",elem:Z,shift:0}]},Q);else{var w=/cancel|phase/.test(X)?["svg-align"]:[];A=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:Z,shift:0},{type:"elem",elem:K,shift:G,wrapperClasses:w}]},Q)}if(/cancel/.test(X))A.height=Z.height,A.depth=Z.depth;if(/cancel/.test(X)&&!q)return Y0.makeSpan(["mord","cancel-lap"],[A],Q);else return Y0.makeSpan(["mord"],[A],Q)},"htmlBuilder$7"),SO1=D((J,Q)=>{var Z=0,X=new g0.MathNode(J.label.indexOf("colorbox")>-1?"mpadded":"menclose",[r2(J.body,Q)]);switch(J.label){case"\\cancel":X.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":X.setAttribute("notation","downdiagonalstrike");break;case"\\phase":X.setAttribute("notation","phasorangle");break;case"\\sout":X.setAttribute("notation","horizontalstrike");break;case"\\fbox":X.setAttribute("notation","box");break;case"\\angl":X.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(Z=Q.fontMetrics().fboxsep*Q.fontMetrics().ptPerEm,X.setAttribute("width","+"+2*Z+"pt"),X.setAttribute("height","+"+2*Z+"pt"),X.setAttribute("lspace",Z+"pt"),X.setAttribute("voffset",Z+"pt"),J.label==="\\fcolorbox"){var Y=Math.max(Q.fontMetrics().fboxrule,Q.minRuleThickness);X.setAttribute("style","border: "+Y+"em solid "+String(J.borderColor))}break;case"\\xcancel":X.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}if(J.backgroundColor)X.setAttribute("mathbackground",J.backgroundColor);return X},"mathmlBuilder$6");H6({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(J,Q,Z){var{parser:X,funcName:Y}=J,K=a8(Q[0],"color-token").color,G=Q[1];return{type:"enclose",mode:X.mode,label:Y,backgroundColor:K,body:G}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(J,Q,Z){var{parser:X,funcName:Y}=J,K=a8(Q[0],"color-token").color,G=a8(Q[1],"color-token").color,q=Q[2];return{type:"enclose",mode:X.mode,label:Y,backgroundColor:G,borderColor:K,body:q}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"enclose",mode:Z.mode,label:"\\fbox",body:Q[0]}}});H6({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"enclose",mode:Z.mode,label:X,body:Y}},htmlBuilder:CO1,mathmlBuilder:SO1});H6({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(J,Q){var{parser:Z}=J;return{type:"enclose",mode:Z.mode,label:"\\angl",body:Q[0]}}});V$0={};D(Kq,"defineEnvironment");N$0={};D($1,"defineMacro");D(MO1,"getHLines");n11=D((J)=>{var Q=J.parser.settings;if(!Q.displayMode)throw new r0("{"+J.envName+"} can be used only in display mode.")},"validateAmsEnvironmentContext");D(a11,"getAutoTag");D(rF,"parseArray");D(r11,"dCellStyle");GU=D(function(Q,Z){var X,Y,K=Q.body.length,G=Q.hLinesBeforeRow,q=0,z=Array(K),U=[],W=Math.max(Z.fontMetrics().arrayRuleWidth,Z.minRuleThickness),F=1/Z.fontMetrics().ptPerEm,H=5*F;if(Q.colSeparationType&&Q.colSeparationType==="small"){var B=Z.havingStyle(H8.SCRIPT).sizeMultiplier;H=0.2778*(B/Z.sizeMultiplier)}var M=Q.colSeparationType==="CD"?h4({number:3,unit:"ex"},Z):12*F,V=3*F,N=Q.arraystretch*M,L=0.7*N,A=0.3*N,w=0;function R(W1){for(var w1=0;w1<W1.length;++w1){if(w1>0)w+=0.25;U.push({pos:w,isDashed:W1[w1]})}}D(R,"setHLinePos"),R(G[0]);for(X=0;X<Q.body.length;++X){var O=Q.body[X],j=L,$=A;if(q<O.length)q=O.length;var E=Array(O.length);for(Y=0;Y<O.length;++Y){var I=J2(O[Y],Z);if($<I.depth)$=I.depth;if(j<I.height)j=I.height;E[Y]=I}var T=Q.rowGaps[X],S=0;if(T){if(S=h4(T,Z),S>0){if(S+=A,$<S)$=S;S=0}}if(Q.addJot)$+=V;E.height=j,E.depth=$,w+=j,E.pos=w,w+=$+S,z[X]=E,R(G[X+1])}var x=w/2+Z.fontMetrics().axisHeight,h=Q.cols||[],v=[],_,b,g=[];if(Q.tags&&Q.tags.some((W1)=>W1))for(X=0;X<K;++X){var k=z[X],y=k.pos-x,f=Q.tags[X],m=void 0;if(f===!0)m=Y0.makeSpan(["eqn-num"],[],Z);else if(f===!1)m=Y0.makeSpan([],[],Z);else m=Y0.makeSpan([],H5(f,Z,!0),Z);m.depth=k.depth,m.height=k.height,g.push({type:"elem",elem:m,shift:y})}for(Y=0,b=0;Y<q||b<h.length;++Y,++b){var n=h[b]||{},p=!0;while(n.type==="separator"){if(!p)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z.fontMetrics().doubleRuleSep),v.push(_);if(n.separator==="|"||n.separator===":"){var e=n.separator==="|"?"solid":"dashed",G1=Y0.makeSpan(["vertical-separator"],[],Z);G1.style.height=J6(w),G1.style.borderRightWidth=J6(W),G1.style.borderRightStyle=e,G1.style.margin="0 "+J6(-W/2);var U1=w-x;if(U1)G1.style.verticalAlign=J6(-U1);v.push(G1)}else throw new r0("Invalid separator type: "+n.separator);b++,n=h[b]||{},p=!1}if(Y>=q)continue;var Z1=void 0;if(Y>0||Q.hskipBeforeAndAfter){if(Z1=K8.deflt(n.pregap,H),Z1!==0)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z1),v.push(_)}var F1=[];for(X=0;X<K;++X){var l=z[X],d=l[Y];if(!d)continue;var i=l.pos-x;d.depth=l.depth,d.height=l.height,F1.push({type:"elem",elem:d,shift:i})}if(F1=Y0.makeVList({positionType:"individualShift",children:F1},Z),F1=Y0.makeSpan(["col-align-"+(n.align||"c")],[F1]),v.push(F1),Y<q-1||Q.hskipBeforeAndAfter){if(Z1=K8.deflt(n.postgap,H),Z1!==0)_=Y0.makeSpan(["arraycolsep"],[]),_.style.width=J6(Z1),v.push(_)}}if(z=Y0.makeSpan(["mtable"],v),U.length>0){var r=Y0.makeLineSpan("hline",Z,W),o=Y0.makeLineSpan("hdashline",Z,W),Y1=[{type:"elem",elem:z,shift:0}];while(U.length>0){var J1=U.pop(),H1=J1.pos-x;if(J1.isDashed)Y1.push({type:"elem",elem:o,shift:H1});else Y1.push({type:"elem",elem:r,shift:H1})}z=Y0.makeVList({positionType:"individualShift",children:Y1},Z)}if(g.length===0)return Y0.makeSpan(["mord"],[z],Z);else{var z1=Y0.makeVList({positionType:"individualShift",children:g},Z);return z1=Y0.makeSpan(["tag"],[z1],Z),Y0.makeFragment([z,z1])}},"htmlBuilder"),A38={c:"center ",l:"left ",r:"right "},qU=D(function(Q,Z){var X=[],Y=new g0.MathNode("mtd",[],["mtr-glue"]),K=new g0.MathNode("mtd",[],["mml-eqn-num"]);for(var G=0;G<Q.body.length;G++){var q=Q.body[G],z=[];for(var U=0;U<q.length;U++)z.push(new g0.MathNode("mtd",[r2(q[U],Z)]));if(Q.tags&&Q.tags[G])if(z.unshift(Y),z.push(Y),Q.leqno)z.unshift(K);else z.push(K);X.push(new g0.MathNode("mtr",z))}var W=new g0.MathNode("mtable",X),F=Q.arraystretch===0.5?0.1:0.16+Q.arraystretch-1+(Q.addJot?0.09:0);W.setAttribute("rowspacing",J6(F));var H="",B="";if(Q.cols&&Q.cols.length>0){var M=Q.cols,V="",N=!1,L=0,A=M.length;if(M[0].type==="separator")H+="top ",L=1;if(M[M.length-1].type==="separator")H+="bottom ",A-=1;for(var w=L;w<A;w++)if(M[w].type==="align"){if(B+=A38[M[w].align],N)V+="none ";N=!0}else if(M[w].type==="separator"){if(N)V+=M[w].separator==="|"?"solid ":"dashed ",N=!1}if(W.setAttribute("columnalign",B.trim()),/[sd]/.test(V))W.setAttribute("columnlines",V.trim())}if(Q.colSeparationType==="align"){var R=Q.cols||[],O="";for(var j=1;j<R.length;j++)O+=j%2?"0em ":"1em ";W.setAttribute("columnspacing",O.trim())}else if(Q.colSeparationType==="alignat"||Q.colSeparationType==="gather")W.setAttribute("columnspacing","0em");else if(Q.colSeparationType==="small")W.setAttribute("columnspacing","0.2778em");else if(Q.colSeparationType==="CD")W.setAttribute("columnspacing","0.5em");else W.setAttribute("columnspacing","1em");var $="",E=Q.hLinesBeforeRow;H+=E[0].length>0?"left ":"",H+=E[E.length-1].length>0?"right ":"";for(var I=1;I<E.length-1;I++)$+=E[I].length===0?"none ":E[I][0]?"dashed ":"solid ";if(/[sd]/.test($))W.setAttribute("rowlines",$.trim());if(H!=="")W=new g0.MathNode("menclose",[W]),W.setAttribute("notation",H.trim());if(Q.arraystretch&&Q.arraystretch<1)W=new g0.MathNode("mstyle",[W]),W.setAttribute("scriptlevel","1");return W},"mathmlBuilder"),L$0=D(function(Q,Z){if(Q.envName.indexOf("ed")===-1)n11(Q);var X=[],Y=Q.envName.indexOf("at")>-1?"alignat":"align",K=Q.envName==="split",G=rF(Q.parser,{cols:X,addJot:!0,autoTag:K?void 0:a11(Q.envName),emptySingleRow:!0,colSeparationType:Y,maxNumCols:K?2:void 0,leqno:Q.parser.settings.leqno},"display"),q,z=0,U={type:"ordgroup",mode:Q.mode,body:[]};if(Z[0]&&Z[0].type==="ordgroup"){var W="";for(var F=0;F<Z[0].body.length;F++){var H=a8(Z[0].body[F],"textord");W+=H.text}q=Number(W),z=q*2}var B=!z;G.body.forEach(function(L){for(var A=1;A<L.length;A+=2){var w=a8(L[A],"styling"),R=a8(w.body[0],"ordgroup");R.body.unshift(U)}if(!B){var O=L.length/2;if(q<O)throw new r0("Too many math in a row: "+("expected "+q+", but got "+O),L[0])}else if(z<L.length)z=L.length});for(var M=0;M<z;++M){var V="r",N=0;if(M%2===1)V="l";else if(M>0&&B)N=1;X[M]={type:"align",align:V,pregap:N,postgap:0}}return G.colSeparationType=B?"align":"alignat",G},"alignedHandler");Kq({type:"array",names:["array","darray"],props:{numArgs:1},handler(J,Q){var Z=Bf(Q[0]),X=Z?[Q[0]]:a8(Q[0],"ordgroup").body,Y=X.map(function(G){var q=l11(G),z=q.text;if("lcr".indexOf(z)!==-1)return{type:"align",align:z};else if(z==="|")return{type:"separator",separator:"|"};else if(z===":")return{type:"separator",separator:":"};throw new r0("Unknown column alignment: "+z,G)}),K={cols:Y,hskipBeforeAndAfter:!0,maxNumCols:Y.length};return rF(J.parser,K,r11(J.envName))},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(J){var Q={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[J.envName.replace("*","")],Z="c",X={hskipBeforeAndAfter:!1,cols:[{type:"align",align:Z}]};if(J.envName.charAt(J.envName.length-1)==="*"){var Y=J.parser;if(Y.consumeSpaces(),Y.fetch().text==="["){if(Y.consume(),Y.consumeSpaces(),Z=Y.fetch().text,"lcr".indexOf(Z)===-1)throw new r0("Expected l or c or r",Y.nextToken);Y.consume(),Y.consumeSpaces(),Y.expect("]"),Y.consume(),X.cols=[{type:"align",align:Z}]}}var K=rF(J.parser,X,r11(J.envName)),G=Math.max(0,...K.body.map((q)=>q.length));return K.cols=Array(G).fill({type:"align",align:Z}),Q?{type:"leftright",mode:J.mode,body:[K],left:Q[0],right:Q[1],rightColor:void 0}:K},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(J){var Q={arraystretch:0.5},Z=rF(J.parser,Q,"script");return Z.colSeparationType="small",Z},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["subarray"],props:{numArgs:1},handler(J,Q){var Z=Bf(Q[0]),X=Z?[Q[0]]:a8(Q[0],"ordgroup").body,Y=X.map(function(G){var q=l11(G),z=q.text;if("lc".indexOf(z)!==-1)return{type:"align",align:z};throw new r0("Unknown column alignment: "+z,G)});if(Y.length>1)throw new r0("{subarray} can contain only one column");var K={cols:Y,hskipBeforeAndAfter:!1,arraystretch:0.5};if(K=rF(J.parser,K,"script"),K.body.length>0&&K.body[0].length>1)throw new r0("{subarray} can contain only one column");return K},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(J){var Q={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Z=rF(J.parser,Q,r11(J.envName));return{type:"leftright",mode:J.mode,body:[Z],left:J.envName.indexOf("r")>-1?".":"\\{",right:J.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:L$0,htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(J){if(K8.contains(["gather","gather*"],J.envName))n11(J);var Q={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:a11(J.envName),emptySingleRow:!0,leqno:J.parser.settings.leqno};return rF(J.parser,Q,"display")},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:L$0,htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(J){n11(J);var Q={autoTag:a11(J.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:J.parser.settings.leqno};return rF(J.parser,Q,"display")},htmlBuilder:GU,mathmlBuilder:qU});Kq({type:"array",names:["CD"],props:{numArgs:0},handler(J){return n11(J),X$0(J.parser)},htmlBuilder:GU,mathmlBuilder:qU});$1("\\nonumber","\\gdef\\@eqnsw{0}");$1("\\notag","\\nonumber");H6({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(J,Q){throw new r0(J.funcName+" valid only within array environment")}});Nj0=V$0;H6({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];if(Y.type!=="ordgroup")throw new r0("Invalid environment name",Y);var K="";for(var G=0;G<Y.body.length;++G)K+=a8(Y.body[G],"textord").text;if(X==="\\begin"){if(!Nj0.hasOwnProperty(K))throw new r0("No such environment: "+K,Y);var q=Nj0[K],{args:z,optArgs:U}=Z.parseArguments("\\begin{"+K+"}",q),W={mode:Z.mode,envName:K,parser:Z},F=q.handler(W,z,U);Z.expect("\\end",!1);var H=Z.nextToken,B=a8(Z.parseFunction(),"environment");if(B.name!==K)throw new r0("Mismatch: \\begin{"+K+"} matched by \\end{"+B.name+"}",H);return F}return{type:"environment",mode:Z.mode,name:K,nameGroup:Y}}});A$0=D((J,Q)=>{var Z=J.font,X=Q.withFont(Z);return J2(J.body,X)},"htmlBuilder$5"),w$0=D((J,Q)=>{var Z=J.font,X=Q.withFont(Z);return r2(J.body,X)},"mathmlBuilder$4"),Lj0={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};H6({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=m11(Q[0]),K=X;if(K in Lj0)K=Lj0[K];return{type:"font",mode:Z.mode,font:K.slice(1),body:Y}},"handler"),htmlBuilder:A$0,mathmlBuilder:w$0});H6({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0],Y=K8.isCharacterBox(X);return{type:"mclass",mode:Z.mode,mclass:i11(X),body:[{type:"font",mode:Z.mode,font:"boldsymbol",body:X}],isCharacterBox:Y}},"handler")});H6({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X,breakOnTokenText:Y}=J,{mode:K}=Z,G=Z.parseExpression(!0,Y),q="math"+X.slice(1);return{type:"font",mode:K,font:q,body:{type:"ordgroup",mode:Z.mode,body:G}}},"handler"),htmlBuilder:A$0,mathmlBuilder:w$0});R$0=D((J,Q)=>{var Z=Q;if(J==="display")Z=Z.id>=H8.SCRIPT.id?Z.text():H8.DISPLAY;else if(J==="text"&&Z.size===H8.DISPLAY.size)Z=H8.TEXT;else if(J==="script")Z=H8.SCRIPT;else if(J==="scriptscript")Z=H8.SCRIPTSCRIPT;return Z},"adjustStyle"),vO1=D((J,Q)=>{var Z=R$0(J.size,Q.style),X=Z.fracNum(),Y=Z.fracDen(),K;K=Q.havingStyle(X);var G=J2(J.numer,K,Q);if(J.continued){var q=8.5/Q.fontMetrics().ptPerEm,z=3.5/Q.fontMetrics().ptPerEm;G.height=G.height<q?q:G.height,G.depth=G.depth<z?z:G.depth}K=Q.havingStyle(Y);var U=J2(J.denom,K,Q),W,F,H;if(J.hasBarLine){if(J.barSize)F=h4(J.barSize,Q),W=Y0.makeLineSpan("frac-line",Q,F);else W=Y0.makeLineSpan("frac-line",Q);F=W.height,H=W.height}else W=null,F=0,H=Q.fontMetrics().defaultRuleThickness;var B,M,V;if(Z.size===H8.DISPLAY.size||J.size==="display"){if(B=Q.fontMetrics().num1,F>0)M=3*H;else M=7*H;V=Q.fontMetrics().denom1}else{if(F>0)B=Q.fontMetrics().num2,M=H;else B=Q.fontMetrics().num3,M=3*H;V=Q.fontMetrics().denom2}var N;if(!W){var L=B-G.depth-(U.height-V);if(L<M)B+=0.5*(M-L),V+=0.5*(M-L);N=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:U,shift:V},{type:"elem",elem:G,shift:-B}]},Q)}else{var A=Q.fontMetrics().axisHeight;if(B-G.depth-(A+0.5*F)<M)B+=M-(B-G.depth-(A+0.5*F));if(A-0.5*F-(U.height-V)<M)V+=M-(A-0.5*F-(U.height-V));var w=-(A-0.5*F);N=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:U,shift:V},{type:"elem",elem:W,shift:w},{type:"elem",elem:G,shift:-B}]},Q)}K=Q.havingStyle(Z),N.height*=K.sizeMultiplier/Q.sizeMultiplier,N.depth*=K.sizeMultiplier/Q.sizeMultiplier;var R;if(Z.size===H8.DISPLAY.size)R=Q.fontMetrics().delim1;else if(Z.size===H8.SCRIPTSCRIPT.size)R=Q.havingStyle(H8.SCRIPT).fontMetrics().delim2;else R=Q.fontMetrics().delim2;var O,j;if(J.leftDelim==null)O=Wf(Q,["mopen"]);else O=cF.customSizedDelim(J.leftDelim,R,!0,Q.havingStyle(Z),J.mode,["mopen"]);if(J.continued)j=Y0.makeSpan([]);else if(J.rightDelim==null)j=Wf(Q,["mclose"]);else j=cF.customSizedDelim(J.rightDelim,R,!0,Q.havingStyle(Z),J.mode,["mclose"]);return Y0.makeSpan(["mord"].concat(K.sizingClasses(Q)),[O,Y0.makeSpan(["mfrac"],[N]),j],Q)},"htmlBuilder$4"),kO1=D((J,Q)=>{var Z=new g0.MathNode("mfrac",[r2(J.numer,Q),r2(J.denom,Q)]);if(!J.hasBarLine)Z.setAttribute("linethickness","0px");else if(J.barSize){var X=h4(J.barSize,Q);Z.setAttribute("linethickness",J6(X))}var Y=R$0(J.size,Q.style);if(Y.size!==Q.style.size){Z=new g0.MathNode("mstyle",[Z]);var K=Y.size===H8.DISPLAY.size?"true":"false";Z.setAttribute("displaystyle",K),Z.setAttribute("scriptlevel","0")}if(J.leftDelim!=null||J.rightDelim!=null){var G=[];if(J.leftDelim!=null){var q=new g0.MathNode("mo",[new g0.TextNode(J.leftDelim.replace("\\",""))]);q.setAttribute("fence","true"),G.push(q)}if(G.push(Z),J.rightDelim!=null){var z=new g0.MathNode("mo",[new g0.TextNode(J.rightDelim.replace("\\",""))]);z.setAttribute("fence","true"),G.push(z)}return jO1(G)}return Z},"mathmlBuilder$3");H6({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=Q[1],G,q=null,z=null,U="auto";switch(X){case"\\dfrac":case"\\frac":case"\\tfrac":G=!0;break;case"\\\\atopfrac":G=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":G=!1,q="(",z=")";break;case"\\\\bracefrac":G=!1,q="\\{",z="\\}";break;case"\\\\brackfrac":G=!1,q="[",z="]";break;default:throw Error("Unrecognized genfrac command")}switch(X){case"\\dfrac":case"\\dbinom":U="display";break;case"\\tfrac":case"\\tbinom":U="text";break}return{type:"genfrac",mode:Z.mode,continued:!1,numer:Y,denom:K,hasBarLine:G,leftDelim:q,rightDelim:z,size:U,barSize:null}},"handler"),htmlBuilder:vO1,mathmlBuilder:kO1});H6({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=Q[1];return{type:"genfrac",mode:Z.mode,continued:!0,numer:Y,denom:K,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}},"handler")});H6({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(J){var{parser:Q,funcName:Z,token:X}=J,Y;switch(Z){case"\\over":Y="\\frac";break;case"\\choose":Y="\\binom";break;case"\\atop":Y="\\\\atopfrac";break;case"\\brace":Y="\\\\bracefrac";break;case"\\brack":Y="\\\\brackfrac";break;default:throw Error("Unrecognized infix genfrac command")}return{type:"infix",mode:Q.mode,replaceWith:Y,token:X}}});Aj0=["display","text","script","scriptscript"],wj0=D(function(Q){var Z=null;if(Q.length>0)Z=Q,Z=Z==="."?null:Z;return Z},"delimFromValue");H6({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(J,Q){var{parser:Z}=J,X=Q[4],Y=Q[5],K=m11(Q[0]),G=K.type==="atom"&&K.family==="open"?wj0(K.text):null,q=m11(Q[1]),z=q.type==="atom"&&q.family==="close"?wj0(q.text):null,U=a8(Q[2],"size"),W,F=null;if(U.isBlank)W=!0;else F=U.value,W=F.number>0;var H="auto",B=Q[3];if(B.type==="ordgroup"){if(B.body.length>0){var M=a8(B.body[0],"textord");H=Aj0[Number(M.text)]}}else B=a8(B,"textord"),H=Aj0[Number(B.text)];return{type:"genfrac",mode:Z.mode,numer:X,denom:Y,continued:!1,hasBarLine:W,barSize:F,leftDelim:G,rightDelim:z,size:H}},htmlBuilder:vO1,mathmlBuilder:kO1});H6({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(J,Q){var{parser:Z,funcName:X,token:Y}=J;return{type:"infix",mode:Z.mode,replaceWith:"\\\\abovefrac",size:a8(Q[0],"size").value,token:Y}}});H6({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0],K=XN8(a8(Q[1],"infix").size),G=Q[2],q=K.number>0;return{type:"genfrac",mode:Z.mode,numer:Y,denom:G,continued:!1,hasBarLine:q,barSize:K,leftDelim:null,rightDelim:null,size:"auto"}},"handler"),htmlBuilder:vO1,mathmlBuilder:kO1});O$0=D((J,Q)=>{var Z=Q.style,X,Y;if(J.type==="supsub")X=J.sup?J2(J.sup,Q.havingStyle(Z.sup()),Q):J2(J.sub,Q.havingStyle(Z.sub()),Q),Y=a8(J.base,"horizBrace");else Y=a8(J,"horizBrace");var K=J2(Y.base,Q.havingBaseStyle(H8.DISPLAY)),G=nF.svgSpan(Y,Q),q;if(Y.isOver)q=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:K},{type:"kern",size:0.1},{type:"elem",elem:G}]},Q),q.children[0].children[0].children[1].classes.push("svg-align");else q=Y0.makeVList({positionType:"bottom",positionData:K.depth+0.1+G.height,children:[{type:"elem",elem:G},{type:"kern",size:0.1},{type:"elem",elem:K}]},Q),q.children[0].children[0].children[0].classes.push("svg-align");if(X){var z=Y0.makeSpan(["mord",Y.isOver?"mover":"munder"],[q],Q);if(Y.isOver)q=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:z},{type:"kern",size:0.2},{type:"elem",elem:X}]},Q);else q=Y0.makeVList({positionType:"bottom",positionData:z.depth+0.2+X.height+X.depth,children:[{type:"elem",elem:X},{type:"kern",size:0.2},{type:"elem",elem:z}]},Q)}return Y0.makeSpan(["mord",Y.isOver?"mover":"munder"],[q],Q)},"htmlBuilder$3"),w38=D((J,Q)=>{var Z=nF.mathMLnode(J.label);return new g0.MathNode(J.isOver?"mover":"munder",[r2(J.base,Q),Z])},"mathmlBuilder$2");H6({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(J,Q){var{parser:Z,funcName:X}=J;return{type:"horizBrace",mode:Z.mode,label:X,isOver:/^\\over/.test(X),base:Q[0]}},htmlBuilder:O$0,mathmlBuilder:w38});H6({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[1],Y=a8(Q[0],"url").url;if(!Z.settings.isTrusted({command:"\\href",url:Y}))return Z.formatUnsupportedCmd("\\href");return{type:"href",mode:Z.mode,href:Y,body:N7(X)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q,!1);return Y0.makeAnchor(J.href,[],Z,Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=IM(J.body,Q);if(!(Z instanceof XK))Z=new XK("mrow",[Z]);return Z.setAttribute("href",J.href),Z},"mathmlBuilder")});H6({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=a8(Q[0],"url").url;if(!Z.settings.isTrusted({command:"\\url",url:X}))return Z.formatUnsupportedCmd("\\url");var Y=[];for(var K=0;K<X.length;K++){var G=X[K];if(G==="~")G="\\textasciitilde";Y.push({type:"textord",mode:"text",text:G})}var q={type:"text",mode:Z.mode,font:"\\texttt",body:Y};return{type:"href",mode:Z.mode,href:X,body:N7(q)}},"handler")});H6({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(J,Q){var{parser:Z}=J;return{type:"hbox",mode:Z.mode,body:N7(Q[0])}},htmlBuilder(J,Q){var Z=H5(J.body,Q,!1);return Y0.makeFragment(Z)},mathmlBuilder(J,Q){return new g0.MathNode("mrow",dZ(J.body,Q))}});H6({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X,token:Y}=J,K=a8(Q[0],"raw").string,G=Q[1];if(Z.settings.strict)Z.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var q,z={};switch(X){case"\\htmlClass":z.class=K,q={command:"\\htmlClass",class:K};break;case"\\htmlId":z.id=K,q={command:"\\htmlId",id:K};break;case"\\htmlStyle":z.style=K,q={command:"\\htmlStyle",style:K};break;case"\\htmlData":{var U=K.split(",");for(var W=0;W<U.length;W++){var F=U[W].split("=");if(F.length!==2)throw new r0("Error parsing key-value for \\htmlData");z["data-"+F[0].trim()]=F[1].trim()}q={command:"\\htmlData",attributes:z};break}default:throw Error("Unrecognized html command")}if(!Z.settings.isTrusted(q))return Z.formatUnsupportedCmd(X);return{type:"html",mode:Z.mode,attributes:z,body:N7(G)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q,!1),X=["enclosing"];if(J.attributes.class)X.push(...J.attributes.class.trim().split(/\s+/));var Y=Y0.makeSpan(X,Z,Q);for(var K in J.attributes)if(K!=="class"&&J.attributes.hasOwnProperty(K))Y.setAttribute(K,J.attributes[K]);return Y},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{return IM(J.body,Q)},"mathmlBuilder")});H6({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J;return{type:"htmlmathml",mode:Z.mode,html:N7(Q[0]),mathml:N7(Q[1])}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.html,Q,!1);return Y0.makeFragment(Z)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{return IM(J.mathml,Q)},"mathmlBuilder")});QO1=D(function(Q){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(Q))return{number:+Q,unit:"bp"};else{var Z=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(Q);if(!Z)throw new r0("Invalid size: '"+Q+"' in \\includegraphics");var X={number:+(Z[1]+Z[2]),unit:Z[3]};if(!uj0(X))throw new r0("Invalid unit: '"+X.unit+"' in \\includegraphics.");return X}},"sizeData");H6({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:D((J,Q,Z)=>{var{parser:X}=J,Y={number:0,unit:"em"},K={number:0.9,unit:"em"},G={number:0,unit:"em"},q="";if(Z[0]){var z=a8(Z[0],"raw").string,U=z.split(",");for(var W=0;W<U.length;W++){var F=U[W].split("=");if(F.length===2){var H=F[1].trim();switch(F[0].trim()){case"alt":q=H;break;case"width":Y=QO1(H);break;case"height":K=QO1(H);break;case"totalheight":G=QO1(H);break;default:throw new r0("Invalid key: '"+F[0]+"' in \\includegraphics.")}}}}var B=a8(Q[0],"url").url;if(q==="")q=B,q=q.replace(/^.*[\\/]/,""),q=q.substring(0,q.lastIndexOf("."));if(!X.settings.isTrusted({command:"\\includegraphics",url:B}))return X.formatUnsupportedCmd("\\includegraphics");return{type:"includegraphics",mode:X.mode,alt:q,width:Y,height:K,totalheight:G,src:B}},"handler"),htmlBuilder:D((J,Q)=>{var Z=h4(J.height,Q),X=0;if(J.totalheight.number>0)X=h4(J.totalheight,Q)-Z;var Y=0;if(J.width.number>0)Y=h4(J.width,Q);var K={height:J6(Z+X)};if(Y>0)K.width=J6(Y);if(X>0)K.verticalAlign=J6(-X);var G=new jN8(J.src,J.alt,K);return G.height=Z,G.depth=X,G},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mglyph",[]);Z.setAttribute("alt",J.alt);var X=h4(J.height,Q),Y=0;if(J.totalheight.number>0)Y=h4(J.totalheight,Q)-X,Z.setAttribute("valign",J6(-Y));if(Z.setAttribute("height",J6(X+Y)),J.width.number>0){var K=h4(J.width,Q);Z.setAttribute("width",J6(K))}return Z.setAttribute("src",J.src),Z},"mathmlBuilder")});H6({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=a8(Q[0],"size");if(Z.settings.strict){var K=X[1]==="m",G=Y.value.unit==="mu";if(K){if(!G)Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" supports only mu units, "+("not "+Y.value.unit+" units"));if(Z.mode!=="math")Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" works only in math mode")}else if(G)Z.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+X+" doesn't support mu units")}return{type:"kern",mode:Z.mode,dimension:Y.value}},htmlBuilder(J,Q){return Y0.makeGlue(J.dimension,Q)},mathmlBuilder(J,Q){var Z=h4(J.dimension,Q);return new g0.SpaceNode(Z)}});H6({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"lap",mode:Z.mode,alignment:X.slice(5),body:Y}},"handler"),htmlBuilder:D((J,Q)=>{var Z;if(J.alignment==="clap")Z=Y0.makeSpan([],[J2(J.body,Q)]),Z=Y0.makeSpan(["inner"],[Z],Q);else Z=Y0.makeSpan(["inner"],[J2(J.body,Q)]);var X=Y0.makeSpan(["fix"],[]),Y=Y0.makeSpan([J.alignment],[Z,X],Q),K=Y0.makeSpan(["strut"]);if(K.style.height=J6(Y.height+Y.depth),Y.depth)K.style.verticalAlign=J6(-Y.depth);return Y.children.unshift(K),Y=Y0.makeSpan(["thinbox"],[Y],Q),Y0.makeSpan(["mord","vbox"],[Y],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]);if(J.alignment!=="rlap"){var X=J.alignment==="llap"?"-1":"-0.5";Z.setAttribute("lspace",X+"width")}return Z.setAttribute("width","0px"),Z},"mathmlBuilder")});H6({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(J,Q){var{funcName:Z,parser:X}=J,Y=X.mode;X.switchMode("math");var K=Z==="\\("?"\\)":"$",G=X.parseExpression(!1,K);return X.expect(K),X.switchMode(Y),{type:"styling",mode:X.mode,style:"text",body:G}}});H6({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(J,Q){throw new r0("Mismatched "+J.funcName)}});Rj0=D((J,Q)=>{switch(Q.style.size){case H8.DISPLAY.size:return J.display;case H8.TEXT.size:return J.text;case H8.SCRIPT.size:return J.script;case H8.SCRIPTSCRIPT.size:return J.scriptscript;default:return J.text}},"chooseMathStyle");H6({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:D((J,Q)=>{var{parser:Z}=J;return{type:"mathchoice",mode:Z.mode,display:N7(Q[0]),text:N7(Q[1]),script:N7(Q[2]),scriptscript:N7(Q[3])}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Rj0(J,Q),X=H5(Z,Q,!1);return Y0.makeFragment(X)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=Rj0(J,Q);return IM(Z,Q)},"mathmlBuilder")});j$0=D((J,Q,Z,X,Y,K,G)=>{J=Y0.makeSpan([],[J]);var q=Z&&K8.isCharacterBox(Z),z,U;if(Q){var W=J2(Q,X.havingStyle(Y.sup()),X);U={elem:W,kern:Math.max(X.fontMetrics().bigOpSpacing1,X.fontMetrics().bigOpSpacing3-W.depth)}}if(Z){var F=J2(Z,X.havingStyle(Y.sub()),X);z={elem:F,kern:Math.max(X.fontMetrics().bigOpSpacing2,X.fontMetrics().bigOpSpacing4-F.height)}}var H;if(U&&z){var B=X.fontMetrics().bigOpSpacing5+z.elem.height+z.elem.depth+z.kern+J.depth+G;H=Y0.makeVList({positionType:"bottom",positionData:B,children:[{type:"kern",size:X.fontMetrics().bigOpSpacing5},{type:"elem",elem:z.elem,marginLeft:J6(-K)},{type:"kern",size:z.kern},{type:"elem",elem:J},{type:"kern",size:U.kern},{type:"elem",elem:U.elem,marginLeft:J6(K)},{type:"kern",size:X.fontMetrics().bigOpSpacing5}]},X)}else if(z){var M=J.height-G;H=Y0.makeVList({positionType:"top",positionData:M,children:[{type:"kern",size:X.fontMetrics().bigOpSpacing5},{type:"elem",elem:z.elem,marginLeft:J6(-K)},{type:"kern",size:z.kern},{type:"elem",elem:J}]},X)}else if(U){var V=J.depth+G;H=Y0.makeVList({positionType:"bottom",positionData:V,children:[{type:"elem",elem:J},{type:"kern",size:U.kern},{type:"elem",elem:U.elem,marginLeft:J6(K)},{type:"kern",size:X.fontMetrics().bigOpSpacing5}]},X)}else return J;var N=[H];if(z&&K!==0&&!q){var L=Y0.makeSpan(["mspace"],[],X);L.style.marginRight=J6(K),N.unshift(L)}return Y0.makeSpan(["mop","op-limits"],N,X)},"assembleSupSub"),$$0=["\\smallint"],LI=D((J,Q)=>{var Z,X,Y=!1,K;if(J.type==="supsub")Z=J.sup,X=J.sub,K=a8(J.base,"op"),Y=!0;else K=a8(J,"op");var G=Q.style,q=!1;if(G.size===H8.DISPLAY.size&&K.symbol&&!K8.contains($$0,K.name))q=!0;var z;if(K.symbol){var U=q?"Size2-Regular":"Size1-Regular",W="";if(K.name==="\\oiint"||K.name==="\\oiiint")W=K.name.slice(1),K.name=W==="oiint"?"\\iint":"\\iiint";if(z=Y0.makeSymbol(K.name,U,"math",Q,["mop","op-symbol",q?"large-op":"small-op"]),W.length>0){var F=z.italic,H=Y0.staticSvg(W+"Size"+(q?"2":"1"),Q);z=Y0.makeVList({positionType:"individualShift",children:[{type:"elem",elem:z,shift:0},{type:"elem",elem:H,shift:q?0.08:0}]},Q),K.name="\\"+W,z.classes.unshift("mop"),z.italic=F}}else if(K.body){var B=H5(K.body,Q,!0);if(B.length===1&&B[0]instanceof KK)z=B[0],z.classes[0]="mop";else z=Y0.makeSpan(["mop"],B,Q)}else{var M=[];for(var V=1;V<K.name.length;V++)M.push(Y0.mathsym(K.name[V],K.mode,Q));z=Y0.makeSpan(["mop"],M,Q)}var N=0,L=0;if((z instanceof KK||K.name==="\\oiint"||K.name==="\\oiiint")&&!K.suppressBaseShift)N=(z.height-z.depth)/2-Q.fontMetrics().axisHeight,L=z.italic;if(Y)return j$0(z,Z,X,Q,G,L,N);else{if(N)z.style.position="relative",z.style.top=J6(N);return z}},"htmlBuilder$2"),Mf=D((J,Q)=>{var Z;if(J.symbol){if(Z=new XK("mo",[GK(J.name,J.mode)]),K8.contains($$0,J.name))Z.setAttribute("largeop","false")}else if(J.body)Z=new XK("mo",dZ(J.body,Q));else{Z=new XK("mi",[new qf(J.name.slice(1))]);var X=new XK("mo",[GK("","text")]);if(J.parentIsSupSub)Z=new XK("mrow",[Z,X]);else Z=OO1([Z,X])}return Z},"mathmlBuilder$1"),R38={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};H6({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=X;if(Y.length===1)Y=R38[Y];return{type:"op",mode:Z.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:Y}},"handler"),htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"op",mode:Z.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:N7(X)}},"handler"),htmlBuilder:LI,mathmlBuilder:Mf});O38={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};H6({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J;return{type:"op",mode:Q.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:Z}},htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J;return{type:"op",mode:Q.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:Z}},htmlBuilder:LI,mathmlBuilder:Mf});H6({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(J){var{parser:Q,funcName:Z}=J,X=Z;if(X.length===1)X=O38[X];return{type:"op",mode:Q.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:X}},htmlBuilder:LI,mathmlBuilder:Mf});E$0=D((J,Q)=>{var Z,X,Y=!1,K;if(J.type==="supsub")Z=J.sup,X=J.sub,K=a8(J.base,"operatorname"),Y=!0;else K=a8(J,"operatorname");var G;if(K.body.length>0){var q=K.body.map((F)=>{var H=F.text;if(typeof H==="string")return{type:"textord",mode:F.mode,text:H};else return F}),z=H5(q,Q.withFont("mathrm"),!0);for(var U=0;U<z.length;U++){var W=z[U];if(W instanceof KK)W.text=W.text.replace(/\u2212/,"-").replace(/\u2217/,"*")}G=Y0.makeSpan(["mop"],z,Q)}else G=Y0.makeSpan(["mop"],[],Q);if(Y)return j$0(G,Z,X,Q,Q.style,0,0);else return G},"htmlBuilder$1"),j38=D((J,Q)=>{var Z=dZ(J.body,Q.withFont("mathrm")),X=!0;for(var Y=0;Y<Z.length;Y++){var K=Z[Y];if(K instanceof g0.SpaceNode);else if(K instanceof g0.MathNode)switch(K.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var G=K.children[0];if(K.children.length===1&&G instanceof g0.TextNode)G.text=G.text.replace(/\u2212/,"-").replace(/\u2217/,"*");else X=!1;break}default:X=!1}else X=!1}if(X){var q=Z.map((W)=>W.toText()).join("");Z=[new g0.TextNode(q)]}var z=new g0.MathNode("mi",Z);z.setAttribute("mathvariant","normal");var U=new g0.MathNode("mo",[GK("","text")]);if(J.parentIsSupSub)return new g0.MathNode("mrow",[z,U]);else return g0.newDocumentFragment([z,U])},"mathmlBuilder");H6({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:D((J,Q)=>{var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"operatorname",mode:Z.mode,body:N7(Y),alwaysHandleSupSub:X==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},"handler"),htmlBuilder:E$0,mathmlBuilder:j38});$1("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");PM({type:"ordgroup",htmlBuilder(J,Q){if(J.semisimple)return Y0.makeFragment(H5(J.body,Q,!1));return Y0.makeSpan(["mord"],H5(J.body,Q,!0),Q)},mathmlBuilder(J,Q){return IM(J.body,Q,!0)}});H6({type:"overline",names:["\\overline"],props:{numArgs:1},handler(J,Q){var{parser:Z}=J,X=Q[0];return{type:"overline",mode:Z.mode,body:X}},htmlBuilder(J,Q){var Z=J2(J.body,Q.havingCrampedStyle()),X=Y0.makeLineSpan("overline-line",Q),Y=Q.fontMetrics().defaultRuleThickness,K=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z},{type:"kern",size:3*Y},{type:"elem",elem:X},{type:"kern",size:Y}]},Q);return Y0.makeSpan(["mord","overline"],[K],Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[new g0.TextNode("‾")]);Z.setAttribute("stretchy","true");var X=new g0.MathNode("mover",[r2(J.body,Q),Z]);return X.setAttribute("accent","true"),X}});H6({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"phantom",mode:Z.mode,body:N7(X)}},"handler"),htmlBuilder:D((J,Q)=>{var Z=H5(J.body,Q.withPhantom(),!1);return Y0.makeFragment(Z)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(J.body,Q);return new g0.MathNode("mphantom",Z)},"mathmlBuilder")});H6({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"hphantom",mode:Z.mode,body:X}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan([],[J2(J.body,Q.withPhantom())]);if(Z.height=0,Z.depth=0,Z.children)for(var X=0;X<Z.children.length;X++)Z.children[X].height=0,Z.children[X].depth=0;return Z=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z}]},Q),Y0.makeSpan(["mord"],[Z],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(N7(J.body),Q),X=new g0.MathNode("mphantom",Z),Y=new g0.MathNode("mpadded",[X]);return Y.setAttribute("height","0px"),Y.setAttribute("depth","0px"),Y},"mathmlBuilder")});H6({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:D((J,Q)=>{var{parser:Z}=J,X=Q[0];return{type:"vphantom",mode:Z.mode,body:X}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan(["inner"],[J2(J.body,Q.withPhantom())]),X=Y0.makeSpan(["fix"],[]);return Y0.makeSpan(["mord","rlap"],[Z,X],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=dZ(N7(J.body),Q),X=new g0.MathNode("mphantom",Z),Y=new g0.MathNode("mpadded",[X]);return Y.setAttribute("width","0px"),Y},"mathmlBuilder")});H6({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(J,Q){var{parser:Z}=J,X=a8(Q[0],"size").value,Y=Q[1];return{type:"raisebox",mode:Z.mode,dy:X,body:Y}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=h4(J.dy,Q);return Y0.makeVList({positionType:"shift",positionData:-X,children:[{type:"elem",elem:Z}]},Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]),X=J.dy.number+J.dy.unit;return Z.setAttribute("voffset",X),Z}});H6({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler(J){var{parser:Q}=J;return{type:"internal",mode:Q.mode}}});H6({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler(J,Q,Z){var{parser:X}=J,Y=Z[0],K=a8(Q[0],"size"),G=a8(Q[1],"size");return{type:"rule",mode:X.mode,shift:Y&&a8(Y,"size").value,width:K.value,height:G.value}},htmlBuilder(J,Q){var Z=Y0.makeSpan(["mord","rule"],[],Q),X=h4(J.width,Q),Y=h4(J.height,Q),K=J.shift?h4(J.shift,Q):0;return Z.style.borderRightWidth=J6(X),Z.style.borderTopWidth=J6(Y),Z.style.bottom=J6(K),Z.width=X,Z.height=Y+K,Z.depth=-K,Z.maxFontSize=Y*1.125*Q.sizeMultiplier,Z},mathmlBuilder(J,Q){var Z=h4(J.width,Q),X=h4(J.height,Q),Y=J.shift?h4(J.shift,Q):0,K=Q.color&&Q.getColor()||"black",G=new g0.MathNode("mspace");G.setAttribute("mathbackground",K),G.setAttribute("width",J6(Z)),G.setAttribute("height",J6(X));var q=new g0.MathNode("mpadded",[G]);if(Y>=0)q.setAttribute("height",J6(Y));else q.setAttribute("height",J6(Y)),q.setAttribute("depth",J6(-Y));return q.setAttribute("voffset",J6(Y)),q}});D(_O1,"sizingGroup");Oj0=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],$38=D((J,Q)=>{var Z=Q.havingSize(J.size);return _O1(J.body,Z,Q)},"htmlBuilder");H6({type:"sizing",names:Oj0,props:{numArgs:0,allowedInText:!0},handler:D((J,Q)=>{var{breakOnTokenText:Z,funcName:X,parser:Y}=J,K=Y.parseExpression(!1,Z);return{type:"sizing",mode:Y.mode,size:Oj0.indexOf(X)+1,body:K}},"handler"),htmlBuilder:$38,mathmlBuilder:D((J,Q)=>{var Z=Q.havingSize(J.size),X=dZ(J.body,Z),Y=new g0.MathNode("mstyle",X);return Y.setAttribute("mathsize",J6(Z.sizeMultiplier)),Y},"mathmlBuilder")});H6({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:D((J,Q,Z)=>{var{parser:X}=J,Y=!1,K=!1,G=Z[0]&&a8(Z[0],"ordgroup");if(G){var q="";for(var z=0;z<G.body.length;++z){var U=G.body[z];if(q=U.text,q==="t")Y=!0;else if(q==="b")K=!0;else{Y=!1,K=!1;break}}}else Y=!0,K=!0;var W=Q[0];return{type:"smash",mode:X.mode,body:W,smashHeight:Y,smashDepth:K}},"handler"),htmlBuilder:D((J,Q)=>{var Z=Y0.makeSpan([],[J2(J.body,Q)]);if(!J.smashHeight&&!J.smashDepth)return Z;if(J.smashHeight){if(Z.height=0,Z.children)for(var X=0;X<Z.children.length;X++)Z.children[X].height=0}if(J.smashDepth){if(Z.depth=0,Z.children)for(var Y=0;Y<Z.children.length;Y++)Z.children[Y].depth=0}var K=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord"],[K],Q)},"htmlBuilder"),mathmlBuilder:D((J,Q)=>{var Z=new g0.MathNode("mpadded",[r2(J.body,Q)]);if(J.smashHeight)Z.setAttribute("height","0px");if(J.smashDepth)Z.setAttribute("depth","0px");return Z},"mathmlBuilder")});H6({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(J,Q,Z){var{parser:X}=J,Y=Z[0],K=Q[0];return{type:"sqrt",mode:X.mode,body:K,index:Y}},htmlBuilder(J,Q){var Z=J2(J.body,Q.havingCrampedStyle());if(Z.height===0)Z.height=Q.fontMetrics().xHeight;Z=Y0.wrapFragment(Z,Q);var X=Q.fontMetrics(),Y=X.defaultRuleThickness,K=Y;if(Q.style.id<H8.TEXT.id)K=Q.fontMetrics().xHeight;var G=Y+K/4,q=Z.height+Z.depth+G+Y,{span:z,ruleWidth:U,advanceWidth:W}=cF.sqrtImage(q,Q),F=z.height-U;if(F>Z.height+Z.depth+G)G=(G+F-Z.height-Z.depth)/2;var H=z.height-Z.height-G-U;Z.style.paddingLeft=J6(W);var B=Y0.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:Z,wrapperClasses:["svg-align"]},{type:"kern",size:-(Z.height+H)},{type:"elem",elem:z},{type:"kern",size:U}]},Q);if(!J.index)return Y0.makeSpan(["mord","sqrt"],[B],Q);else{var M=Q.havingStyle(H8.SCRIPTSCRIPT),V=J2(J.index,M,Q),N=0.6*(B.height-B.depth),L=Y0.makeVList({positionType:"shift",positionData:-N,children:[{type:"elem",elem:V}]},Q),A=Y0.makeSpan(["root"],[L]);return Y0.makeSpan(["mord","sqrt"],[A,B],Q)}},mathmlBuilder(J,Q){var{body:Z,index:X}=J;return X?new g0.MathNode("mroot",[r2(Z,Q),r2(X,Q)]):new g0.MathNode("msqrt",[r2(Z,Q)])}});jj0={display:H8.DISPLAY,text:H8.TEXT,script:H8.SCRIPT,scriptscript:H8.SCRIPTSCRIPT};H6({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(J,Q){var{breakOnTokenText:Z,funcName:X,parser:Y}=J,K=Y.parseExpression(!0,Z),G=X.slice(1,X.length-5);return{type:"styling",mode:Y.mode,style:G,body:K}},htmlBuilder(J,Q){var Z=jj0[J.style],X=Q.havingStyle(Z).withFont("");return _O1(J.body,X,Q)},mathmlBuilder(J,Q){var Z=jj0[J.style],X=Q.havingStyle(Z),Y=dZ(J.body,X),K=new g0.MathNode("mstyle",Y),G={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},q=G[J.style];return K.setAttribute("scriptlevel",q[0]),K.setAttribute("displaystyle",q[1]),K}});E38=D(function(Q,Z){var X=Q.base;if(!X)return null;else if(X.type==="op"){var Y=X.limits&&(Z.style.size===H8.DISPLAY.size||X.alwaysHandleSupSub);return Y?LI:null}else if(X.type==="operatorname"){var K=X.alwaysHandleSupSub&&(Z.style.size===H8.DISPLAY.size||X.limits);return K?E$0:null}else if(X.type==="accent")return K8.isCharacterBox(X.base)?EO1:null;else if(X.type==="horizBrace"){var G=!Q.sub;return G===X.isOver?O$0:null}else return null},"htmlBuilderDelegate");PM({type:"supsub",htmlBuilder(J,Q){var Z=E38(J,Q);if(Z)return Z(J,Q);var{base:X,sup:Y,sub:K}=J,G=J2(X,Q),q,z,U=Q.fontMetrics(),W=0,F=0,H=X&&K8.isCharacterBox(X);if(Y){var B=Q.havingStyle(Q.style.sup());if(q=J2(Y,B,Q),!H)W=G.height-B.fontMetrics().supDrop*B.sizeMultiplier/Q.sizeMultiplier}if(K){var M=Q.havingStyle(Q.style.sub());if(z=J2(K,M,Q),!H)F=G.depth+M.fontMetrics().subDrop*M.sizeMultiplier/Q.sizeMultiplier}var V;if(Q.style===H8.DISPLAY)V=U.sup1;else if(Q.style.cramped)V=U.sup3;else V=U.sup2;var N=Q.sizeMultiplier,L=J6(0.5/U.ptPerEm/N),A=null;if(z){var w=J.base&&J.base.type==="op"&&J.base.name&&(J.base.name==="\\oiint"||J.base.name==="\\oiiint");if(G instanceof KK||w)A=J6(-G.italic)}var R;if(q&&z){W=Math.max(W,V,q.depth+0.25*U.xHeight),F=Math.max(F,U.sub2);var O=U.defaultRuleThickness,j=4*O;if(W-q.depth-(z.height-F)<j){F=j-(W-q.depth)+z.height;var $=0.8*U.xHeight-(W-q.depth);if($>0)W+=$,F-=$}var E=[{type:"elem",elem:z,shift:F,marginRight:L,marginLeft:A},{type:"elem",elem:q,shift:-W,marginRight:L}];R=Y0.makeVList({positionType:"individualShift",children:E},Q)}else if(z){F=Math.max(F,U.sub1,z.height-0.8*U.xHeight);var I=[{type:"elem",elem:z,marginLeft:A,marginRight:L}];R=Y0.makeVList({positionType:"shift",positionData:F,children:I},Q)}else if(q)W=Math.max(W,V,q.depth+0.25*U.xHeight),R=Y0.makeVList({positionType:"shift",positionData:-W,children:[{type:"elem",elem:q,marginRight:L}]},Q);else throw Error("supsub must have either sup or sub.");var T=WO1(G,"right")||"mord";return Y0.makeSpan([T],[G,Y0.makeSpan(["msupsub"],[R])],Q)},mathmlBuilder(J,Q){var Z=!1,X,Y;if(J.base&&J.base.type==="horizBrace"){if(Y=!!J.sup,Y===J.base.isOver)Z=!0,X=J.base.isOver}if(J.base&&(J.base.type==="op"||J.base.type==="operatorname"))J.base.parentIsSupSub=!0;var K=[r2(J.base,Q)];if(J.sub)K.push(r2(J.sub,Q));if(J.sup)K.push(r2(J.sup,Q));var G;if(Z)G=X?"mover":"munder";else if(!J.sub){var q=J.base;if(q&&q.type==="op"&&q.limits&&(Q.style===H8.DISPLAY||q.alwaysHandleSupSub))G="mover";else if(q&&q.type==="operatorname"&&q.alwaysHandleSupSub&&(q.limits||Q.style===H8.DISPLAY))G="mover";else G="msup"}else if(!J.sup){var z=J.base;if(z&&z.type==="op"&&z.limits&&(Q.style===H8.DISPLAY||z.alwaysHandleSupSub))G="munder";else if(z&&z.type==="operatorname"&&z.alwaysHandleSupSub&&(z.limits||Q.style===H8.DISPLAY))G="munder";else G="msub"}else{var U=J.base;if(U&&U.type==="op"&&U.limits&&Q.style===H8.DISPLAY)G="munderover";else if(U&&U.type==="operatorname"&&U.alwaysHandleSupSub&&(Q.style===H8.DISPLAY||U.limits))G="munderover";else G="msubsup"}return new g0.MathNode(G,K)}});PM({type:"atom",htmlBuilder(J,Q){return Y0.mathsym(J.text,J.mode,Q,["m"+J.family])},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[GK(J.text,J.mode)]);if(J.family==="bin"){var X=$O1(J,Q);if(X==="bold-italic")Z.setAttribute("mathvariant",X)}else if(J.family==="punct")Z.setAttribute("separator","true");else if(J.family==="open"||J.family==="close")Z.setAttribute("stretchy","false");return Z}});I$0={mi:"italic",mn:"normal",mtext:"normal"};PM({type:"mathord",htmlBuilder(J,Q){return Y0.makeOrd(J,Q,"mathord")},mathmlBuilder(J,Q){var Z=new g0.MathNode("mi",[GK(J.text,J.mode,Q)]),X=$O1(J,Q)||"italic";if(X!==I$0[Z.type])Z.setAttribute("mathvariant",X);return Z}});PM({type:"textord",htmlBuilder(J,Q){return Y0.makeOrd(J,Q,"textord")},mathmlBuilder(J,Q){var Z=GK(J.text,J.mode,Q),X=$O1(J,Q)||"normal",Y;if(J.mode==="text")Y=new g0.MathNode("mtext",[Z]);else if(/[0-9]/.test(J.text))Y=new g0.MathNode("mn",[Z]);else if(J.text==="\\prime")Y=new g0.MathNode("mo",[Z]);else Y=new g0.MathNode("mi",[Z]);if(X!==I$0[Y.type])Y.setAttribute("mathvariant",X);return Y}});ZO1={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},XO1={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};PM({type:"spacing",htmlBuilder(J,Q){if(XO1.hasOwnProperty(J.text)){var Z=XO1[J.text].className||"";if(J.mode==="text"){var X=Y0.makeOrd(J,Q,"textord");return X.classes.push(Z),X}else return Y0.makeSpan(["mspace",Z],[Y0.mathsym(J.text,J.mode,Q)],Q)}else if(ZO1.hasOwnProperty(J.text))return Y0.makeSpan(["mspace",ZO1[J.text]],[],Q);else throw new r0('Unknown type of space "'+J.text+'"')},mathmlBuilder(J,Q){var Z;if(XO1.hasOwnProperty(J.text))Z=new g0.MathNode("mtext",[new g0.TextNode(" ")]);else if(ZO1.hasOwnProperty(J.text))return new g0.MathNode("mspace");else throw new r0('Unknown type of space "'+J.text+'"');return Z}});$j0=D(()=>{var J=new g0.MathNode("mtd",[]);return J.setAttribute("width","50%"),J},"pad");PM({type:"tag",mathmlBuilder(J,Q){var Z=new g0.MathNode("mtable",[new g0.MathNode("mtr",[$j0(),new g0.MathNode("mtd",[IM(J.body,Q)]),$j0(),new g0.MathNode("mtd",[IM(J.tag,Q)])])]);return Z.setAttribute("width","100%"),Z}});Ej0={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Ij0={"\\textbf":"textbf","\\textmd":"textmd"},I38={"\\textit":"textit","\\textup":"textup"},Pj0=D((J,Q)=>{var Z=J.font;if(!Z)return Q;else if(Ej0[Z])return Q.withTextFontFamily(Ej0[Z]);else if(Ij0[Z])return Q.withTextFontWeight(Ij0[Z]);else if(Z==="\\emph")return Q.fontShape==="textit"?Q.withTextFontShape("textup"):Q.withTextFontShape("textit");return Q.withTextFontShape(I38[Z])},"optionsWithFont");H6({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(J,Q){var{parser:Z,funcName:X}=J,Y=Q[0];return{type:"text",mode:Z.mode,body:N7(Y),font:X}},htmlBuilder(J,Q){var Z=Pj0(J,Q),X=H5(J.body,Z,!0);return Y0.makeSpan(["mord","text"],X,Z)},mathmlBuilder(J,Q){var Z=Pj0(J,Q);return IM(J.body,Z)}});H6({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(J,Q){var{parser:Z}=J;return{type:"underline",mode:Z.mode,body:Q[0]}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=Y0.makeLineSpan("underline-line",Q),Y=Q.fontMetrics().defaultRuleThickness,K=Y0.makeVList({positionType:"top",positionData:Z.height,children:[{type:"kern",size:Y},{type:"elem",elem:X},{type:"kern",size:3*Y},{type:"elem",elem:Z}]},Q);return Y0.makeSpan(["mord","underline"],[K],Q)},mathmlBuilder(J,Q){var Z=new g0.MathNode("mo",[new g0.TextNode("‾")]);Z.setAttribute("stretchy","true");var X=new g0.MathNode("munder",[r2(J.body,Q),Z]);return X.setAttribute("accentunder","true"),X}});H6({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(J,Q){var{parser:Z}=J;return{type:"vcenter",mode:Z.mode,body:Q[0]}},htmlBuilder(J,Q){var Z=J2(J.body,Q),X=Q.fontMetrics().axisHeight,Y=0.5*(Z.height-X-(Z.depth+X));return Y0.makeVList({positionType:"shift",positionData:Y,children:[{type:"elem",elem:Z}]},Q)},mathmlBuilder(J,Q){return new g0.MathNode("mpadded",[r2(J.body,Q)],["vcenter"])}});H6({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(J,Q,Z){throw new r0("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(J,Q){var Z=Tj0(J),X=[],Y=Q.havingStyle(Q.style.text());for(var K=0;K<Z.length;K++){var G=Z[K];if(G==="~")G="\\textasciitilde";X.push(Y0.makeSymbol(G,"Typewriter-Regular",J.mode,Y,["mord","texttt"]))}return Y0.makeSpan(["mord","text"].concat(Y.sizingClasses(Q)),Y0.tryCombineChars(X),Y)},mathmlBuilder(J,Q){var Z=new g0.TextNode(Tj0(J)),X=new g0.MathNode("mtext",[Z]);return X.setAttribute("mathvariant","monospace"),X}});Tj0=D((J)=>J.body.replace(/ /g,J.star?"␣":" "),"makeVerb"),jM=oj0,C38="("+P38+")"+P$0+"*",v38=new RegExp(VO1+"+$"),k38="("+P$0+"+)|"+(S38+"|")+"([!-\\[\\]-‧-豈-]"+(VO1+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(VO1+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+C38)+("|"+T38+")"),Cj0=class{static{D(this,"Lexer")}constructor(J,Q){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=J,this.settings=Q,this.tokenRegex=new RegExp(k38,"g"),this.catcodes={"%":14,"~":13}}setCatcode(J,Q){this.catcodes[J]=Q}lex(){var J=this.input,Q=this.tokenRegex.lastIndex;if(Q===J.length)return new KU("EOF",new Xq(this,Q,Q));var Z=this.tokenRegex.exec(J);if(Z===null||Z.index!==Q)throw new r0("Unexpected character: '"+J[Q]+"'",new KU(J[Q],new Xq(this,Q,Q+1)));var X=Z[6]||Z[3]||(Z[2]?"\\ ":" ");if(this.catcodes[X]===14){var Y=J.indexOf(`
|
|
2298
|
+
`,this.tokenRegex.lastIndex);if(Y===-1)this.tokenRegex.lastIndex=J.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");else this.tokenRegex.lastIndex=Y+1;return this.lex()}return new KU(X,new Xq(this,Q,this.tokenRegex.lastIndex))}},_38=class{static{D(this,"Namespace")}constructor(J,Q){if(J===void 0)J={};if(Q===void 0)Q={};this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=Q,this.builtins=J,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new r0("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var J=this.undefStack.pop();for(var Q in J)if(J.hasOwnProperty(Q))if(J[Q]==null)delete this.current[Q];else this.current[Q]=J[Q]}endGroups(){while(this.undefStack.length>0)this.endGroup()}has(J){return this.current.hasOwnProperty(J)||this.builtins.hasOwnProperty(J)}get(J){if(this.current.hasOwnProperty(J))return this.current[J];else return this.builtins[J]}set(J,Q,Z){if(Z===void 0)Z=!1;if(Z){for(var X=0;X<this.undefStack.length;X++)delete this.undefStack[X][J];if(this.undefStack.length>0)this.undefStack[this.undefStack.length-1][J]=Q}else{var Y=this.undefStack[this.undefStack.length-1];if(Y&&!Y.hasOwnProperty(J))Y[J]=this.current[J]}if(Q==null)delete this.current[J];else this.current[J]=Q}},x38=N$0;$1("\\noexpand",function(J){var Q=J.popToken();if(J.isExpandable(Q.text))Q.noexpand=!0,Q.treatAsRelax=!0;return{tokens:[Q],numArgs:0}});$1("\\expandafter",function(J){var Q=J.popToken();return J.expandOnce(!0),{tokens:[Q],numArgs:0}});$1("\\@firstoftwo",function(J){var Q=J.consumeArgs(2);return{tokens:Q[0],numArgs:0}});$1("\\@secondoftwo",function(J){var Q=J.consumeArgs(2);return{tokens:Q[1],numArgs:0}});$1("\\@ifnextchar",function(J){var Q=J.consumeArgs(3);J.consumeSpaces();var Z=J.future();if(Q[0].length===1&&Q[0][0].text===Z.text)return{tokens:Q[1],numArgs:0};else return{tokens:Q[2],numArgs:0}});$1("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");$1("\\TextOrMath",function(J){var Q=J.consumeArgs(2);if(J.mode==="text")return{tokens:Q[0],numArgs:0};else return{tokens:Q[1],numArgs:0}});Sj0={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};$1("\\char",function(J){var Q=J.popToken(),Z,X="";if(Q.text==="'")Z=8,Q=J.popToken();else if(Q.text==='"')Z=16,Q=J.popToken();else if(Q.text==="`")if(Q=J.popToken(),Q.text[0]==="\\")X=Q.text.charCodeAt(1);else if(Q.text==="EOF")throw new r0("\\char` missing argument");else X=Q.text.charCodeAt(0);else Z=10;if(Z){if(X=Sj0[Q.text],X==null||X>=Z)throw new r0("Invalid base-"+Z+" digit "+Q.text);var Y;while((Y=Sj0[J.future().text])!=null&&Y<Z)X*=Z,X+=Y,J.popToken()}return"\\@char{"+X+"}"});xO1=D((J,Q,Z)=>{var X=J.consumeArg().tokens;if(X.length!==1)throw new r0("\\newcommand's first argument must be a macro name");var Y=X[0].text,K=J.isDefined(Y);if(K&&!Q)throw new r0("\\newcommand{"+Y+"} attempting to redefine "+(Y+"; use \\renewcommand"));if(!K&&!Z)throw new r0("\\renewcommand{"+Y+"} when command "+Y+" does not yet exist; use \\newcommand");var G=0;if(X=J.consumeArg().tokens,X.length===1&&X[0].text==="["){var q="",z=J.expandNextToken();while(z.text!=="]"&&z.text!=="EOF")q+=z.text,z=J.expandNextToken();if(!q.match(/^\s*[0-9]+\s*$/))throw new r0("Invalid number of arguments: "+q);G=parseInt(q),X=J.consumeArg().tokens}return J.macros.set(Y,{tokens:X,numArgs:G}),""},"newcommand");$1("\\newcommand",(J)=>xO1(J,!1,!0));$1("\\renewcommand",(J)=>xO1(J,!0,!1));$1("\\providecommand",(J)=>xO1(J,!0,!0));$1("\\message",(J)=>{var Q=J.consumeArgs(1)[0];return console.log(Q.reverse().map((Z)=>Z.text).join("")),""});$1("\\errmessage",(J)=>{var Q=J.consumeArgs(1)[0];return console.error(Q.reverse().map((Z)=>Z.text).join("")),""});$1("\\show",(J)=>{var Q=J.popToken(),Z=Q.text;return console.log(Q,J.macros.get(Z),jM[Z],X4.math[Z],X4.text[Z]),""});$1("\\bgroup","{");$1("\\egroup","}");$1("~","\\nobreakspace");$1("\\lq","`");$1("\\rq","'");$1("\\aa","\\r a");$1("\\AA","\\r A");$1("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");$1("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");$1("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");$1("ℬ","\\mathscr{B}");$1("ℰ","\\mathscr{E}");$1("ℱ","\\mathscr{F}");$1("ℋ","\\mathscr{H}");$1("ℐ","\\mathscr{I}");$1("ℒ","\\mathscr{L}");$1("ℳ","\\mathscr{M}");$1("ℛ","\\mathscr{R}");$1("ℭ","\\mathfrak{C}");$1("ℌ","\\mathfrak{H}");$1("ℨ","\\mathfrak{Z}");$1("\\Bbbk","\\Bbb{k}");$1("·","\\cdotp");$1("\\llap","\\mathllap{\\textrm{#1}}");$1("\\rlap","\\mathrlap{\\textrm{#1}}");$1("\\clap","\\mathclap{\\textrm{#1}}");$1("\\mathstrut","\\vphantom{(}");$1("\\underbar","\\underline{\\text{#1}}");$1("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');$1("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");$1("\\ne","\\neq");$1("≠","\\neq");$1("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");$1("∉","\\notin");$1("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");$1("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");$1("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");$1("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");$1("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");$1("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");$1("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");$1("⟂","\\perp");$1("‼","\\mathclose{!\\mkern-0.8mu!}");$1("∌","\\notni");$1("⌜","\\ulcorner");$1("⌝","\\urcorner");$1("⌞","\\llcorner");$1("⌟","\\lrcorner");$1("©","\\copyright");$1("®","\\textregistered");$1("️","\\textregistered");$1("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');$1("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');$1("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');$1("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');$1("\\vdots","\\mathord{\\varvdots\\rule{0pt}{15pt}}");$1("⋮","\\vdots");$1("\\varGamma","\\mathit{\\Gamma}");$1("\\varDelta","\\mathit{\\Delta}");$1("\\varTheta","\\mathit{\\Theta}");$1("\\varLambda","\\mathit{\\Lambda}");$1("\\varXi","\\mathit{\\Xi}");$1("\\varPi","\\mathit{\\Pi}");$1("\\varSigma","\\mathit{\\Sigma}");$1("\\varUpsilon","\\mathit{\\Upsilon}");$1("\\varPhi","\\mathit{\\Phi}");$1("\\varPsi","\\mathit{\\Psi}");$1("\\varOmega","\\mathit{\\Omega}");$1("\\substack","\\begin{subarray}{c}#1\\end{subarray}");$1("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");$1("\\boxed","\\fbox{$\\displaystyle{#1}$}");$1("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");$1("\\implies","\\DOTSB\\;\\Longrightarrow\\;");$1("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");vj0={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};$1("\\dots",function(J){var Q="\\dotso",Z=J.expandAfterFuture().text;if(Z in vj0)Q=vj0[Z];else if(Z.slice(0,4)==="\\not")Q="\\dotsb";else if(Z in X4.math){if(K8.contains(["bin","rel"],X4.math[Z].group))Q="\\dotsb"}return Q});bO1={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};$1("\\dotso",function(J){var Q=J.future().text;if(Q in bO1)return"\\ldots\\,";else return"\\ldots"});$1("\\dotsc",function(J){var Q=J.future().text;if(Q in bO1&&Q!==",")return"\\ldots\\,";else return"\\ldots"});$1("\\cdots",function(J){var Q=J.future().text;if(Q in bO1)return"\\@cdots\\,";else return"\\@cdots"});$1("\\dotsb","\\cdots");$1("\\dotsm","\\cdots");$1("\\dotsi","\\!\\cdots");$1("\\dotsx","\\ldots\\,");$1("\\DOTSI","\\relax");$1("\\DOTSB","\\relax");$1("\\DOTSX","\\relax");$1("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");$1("\\,","\\tmspace+{3mu}{.1667em}");$1("\\thinspace","\\,");$1("\\>","\\mskip{4mu}");$1("\\:","\\tmspace+{4mu}{.2222em}");$1("\\medspace","\\:");$1("\\;","\\tmspace+{5mu}{.2777em}");$1("\\thickspace","\\;");$1("\\!","\\tmspace-{3mu}{.1667em}");$1("\\negthinspace","\\!");$1("\\negmedspace","\\tmspace-{4mu}{.2222em}");$1("\\negthickspace","\\tmspace-{5mu}{.277em}");$1("\\enspace","\\kern.5em ");$1("\\enskip","\\hskip.5em\\relax");$1("\\quad","\\hskip1em\\relax");$1("\\qquad","\\hskip2em\\relax");$1("\\tag","\\@ifstar\\tag@literal\\tag@paren");$1("\\tag@paren","\\tag@literal{({#1})}");$1("\\tag@literal",(J)=>{if(J.macros.get("\\df@tag"))throw new r0("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});$1("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");$1("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");$1("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");$1("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");$1("\\newline","\\\\\\relax");$1("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");T$0=J6(YU["Main-Regular"][84][1]-0.7*YU["Main-Regular"][65][1]);$1("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+T$0+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");$1("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+T$0+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");$1("\\hspace","\\@ifstar\\@hspacer\\@hspace");$1("\\@hspace","\\hskip #1\\relax");$1("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");$1("\\ordinarycolon",":");$1("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");$1("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');$1("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');$1("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');$1("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');$1("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');$1("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');$1("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');$1("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');$1("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');$1("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');$1("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');$1("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');$1("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');$1("∷","\\dblcolon");$1("∹","\\eqcolon");$1("≔","\\coloneqq");$1("≕","\\eqqcolon");$1("⩴","\\Coloneqq");$1("\\ratio","\\vcentcolon");$1("\\coloncolon","\\dblcolon");$1("\\colonequals","\\coloneqq");$1("\\coloncolonequals","\\Coloneqq");$1("\\equalscolon","\\eqqcolon");$1("\\equalscoloncolon","\\Eqqcolon");$1("\\colonminus","\\coloneq");$1("\\coloncolonminus","\\Coloneq");$1("\\minuscolon","\\eqcolon");$1("\\minuscoloncolon","\\Eqcolon");$1("\\coloncolonapprox","\\Colonapprox");$1("\\coloncolonsim","\\Colonsim");$1("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");$1("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");$1("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");$1("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");$1("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");$1("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");$1("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");$1("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");$1("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");$1("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");$1("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");$1("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");$1("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");$1("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");$1("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");$1("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");$1("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");$1("\\nleqq","\\html@mathml{\\@nleqq}{≰}");$1("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");$1("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");$1("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");$1("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");$1("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");$1("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");$1("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");$1("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");$1("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");$1("\\imath","\\html@mathml{\\@imath}{ı}");$1("\\jmath","\\html@mathml{\\@jmath}{ȷ}");$1("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");$1("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");$1("⟦","\\llbracket");$1("⟧","\\rrbracket");$1("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");$1("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");$1("⦃","\\lBrace");$1("⦄","\\rBrace");$1("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");$1("⦵","\\minuso");$1("\\darr","\\downarrow");$1("\\dArr","\\Downarrow");$1("\\Darr","\\Downarrow");$1("\\lang","\\langle");$1("\\rang","\\rangle");$1("\\uarr","\\uparrow");$1("\\uArr","\\Uparrow");$1("\\Uarr","\\Uparrow");$1("\\N","\\mathbb{N}");$1("\\R","\\mathbb{R}");$1("\\Z","\\mathbb{Z}");$1("\\alef","\\aleph");$1("\\alefsym","\\aleph");$1("\\Alpha","\\mathrm{A}");$1("\\Beta","\\mathrm{B}");$1("\\bull","\\bullet");$1("\\Chi","\\mathrm{X}");$1("\\clubs","\\clubsuit");$1("\\cnums","\\mathbb{C}");$1("\\Complex","\\mathbb{C}");$1("\\Dagger","\\ddagger");$1("\\diamonds","\\diamondsuit");$1("\\empty","\\emptyset");$1("\\Epsilon","\\mathrm{E}");$1("\\Eta","\\mathrm{H}");$1("\\exist","\\exists");$1("\\harr","\\leftrightarrow");$1("\\hArr","\\Leftrightarrow");$1("\\Harr","\\Leftrightarrow");$1("\\hearts","\\heartsuit");$1("\\image","\\Im");$1("\\infin","\\infty");$1("\\Iota","\\mathrm{I}");$1("\\isin","\\in");$1("\\Kappa","\\mathrm{K}");$1("\\larr","\\leftarrow");$1("\\lArr","\\Leftarrow");$1("\\Larr","\\Leftarrow");$1("\\lrarr","\\leftrightarrow");$1("\\lrArr","\\Leftrightarrow");$1("\\Lrarr","\\Leftrightarrow");$1("\\Mu","\\mathrm{M}");$1("\\natnums","\\mathbb{N}");$1("\\Nu","\\mathrm{N}");$1("\\Omicron","\\mathrm{O}");$1("\\plusmn","\\pm");$1("\\rarr","\\rightarrow");$1("\\rArr","\\Rightarrow");$1("\\Rarr","\\Rightarrow");$1("\\real","\\Re");$1("\\reals","\\mathbb{R}");$1("\\Reals","\\mathbb{R}");$1("\\Rho","\\mathrm{P}");$1("\\sdot","\\cdot");$1("\\sect","\\S");$1("\\spades","\\spadesuit");$1("\\sub","\\subset");$1("\\sube","\\subseteq");$1("\\supe","\\supseteq");$1("\\Tau","\\mathrm{T}");$1("\\thetasym","\\vartheta");$1("\\weierp","\\wp");$1("\\Zeta","\\mathrm{Z}");$1("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");$1("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");$1("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");$1("\\bra","\\mathinner{\\langle{#1}|}");$1("\\ket","\\mathinner{|{#1}\\rangle}");$1("\\braket","\\mathinner{\\langle{#1}\\rangle}");$1("\\Bra","\\left\\langle#1\\right|");$1("\\Ket","\\left|#1\\right\\rangle");C$0=D((J)=>(Q)=>{var Z=Q.consumeArg().tokens,X=Q.consumeArg().tokens,Y=Q.consumeArg().tokens,K=Q.consumeArg().tokens,G=Q.macros.get("|"),q=Q.macros.get("\\|");Q.macros.beginGroup();var z=D((F)=>(H)=>{if(J){if(H.macros.set("|",G),Y.length)H.macros.set("\\|",q)}var B=F;if(!F&&Y.length){var M=H.future();if(M.text==="|")H.popToken(),B=!0}return{tokens:B?Y:X,numArgs:0}},"midMacro");if(Q.macros.set("|",z(!1)),Y.length)Q.macros.set("\\|",z(!0));var U=Q.consumeArg().tokens,W=Q.expandTokens([...K,...U,...Z]);return Q.macros.endGroup(),{tokens:W.reverse(),numArgs:0}},"braketHelper");$1("\\bra@ket",C$0(!1));$1("\\bra@set",C$0(!0));$1("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");$1("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");$1("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");$1("\\angln","{\\angl n}");$1("\\blue","\\textcolor{##6495ed}{#1}");$1("\\orange","\\textcolor{##ffa500}{#1}");$1("\\pink","\\textcolor{##ff00af}{#1}");$1("\\red","\\textcolor{##df0030}{#1}");$1("\\green","\\textcolor{##28ae7b}{#1}");$1("\\gray","\\textcolor{gray}{#1}");$1("\\purple","\\textcolor{##9d38bd}{#1}");$1("\\blueA","\\textcolor{##ccfaff}{#1}");$1("\\blueB","\\textcolor{##80f6ff}{#1}");$1("\\blueC","\\textcolor{##63d9ea}{#1}");$1("\\blueD","\\textcolor{##11accd}{#1}");$1("\\blueE","\\textcolor{##0c7f99}{#1}");$1("\\tealA","\\textcolor{##94fff5}{#1}");$1("\\tealB","\\textcolor{##26edd5}{#1}");$1("\\tealC","\\textcolor{##01d1c1}{#1}");$1("\\tealD","\\textcolor{##01a995}{#1}");$1("\\tealE","\\textcolor{##208170}{#1}");$1("\\greenA","\\textcolor{##b6ffb0}{#1}");$1("\\greenB","\\textcolor{##8af281}{#1}");$1("\\greenC","\\textcolor{##74cf70}{#1}");$1("\\greenD","\\textcolor{##1fab54}{#1}");$1("\\greenE","\\textcolor{##0d923f}{#1}");$1("\\goldA","\\textcolor{##ffd0a9}{#1}");$1("\\goldB","\\textcolor{##ffbb71}{#1}");$1("\\goldC","\\textcolor{##ff9c39}{#1}");$1("\\goldD","\\textcolor{##e07d10}{#1}");$1("\\goldE","\\textcolor{##a75a05}{#1}");$1("\\redA","\\textcolor{##fca9a9}{#1}");$1("\\redB","\\textcolor{##ff8482}{#1}");$1("\\redC","\\textcolor{##f9685d}{#1}");$1("\\redD","\\textcolor{##e84d39}{#1}");$1("\\redE","\\textcolor{##bc2612}{#1}");$1("\\maroonA","\\textcolor{##ffbde0}{#1}");$1("\\maroonB","\\textcolor{##ff92c6}{#1}");$1("\\maroonC","\\textcolor{##ed5fa6}{#1}");$1("\\maroonD","\\textcolor{##ca337c}{#1}");$1("\\maroonE","\\textcolor{##9e034e}{#1}");$1("\\purpleA","\\textcolor{##ddd7ff}{#1}");$1("\\purpleB","\\textcolor{##c6b9fc}{#1}");$1("\\purpleC","\\textcolor{##aa87ff}{#1}");$1("\\purpleD","\\textcolor{##7854ab}{#1}");$1("\\purpleE","\\textcolor{##543b78}{#1}");$1("\\mintA","\\textcolor{##f5f9e8}{#1}");$1("\\mintB","\\textcolor{##edf2df}{#1}");$1("\\mintC","\\textcolor{##e0e5cc}{#1}");$1("\\grayA","\\textcolor{##f6f7f7}{#1}");$1("\\grayB","\\textcolor{##f0f1f2}{#1}");$1("\\grayC","\\textcolor{##e3e5e6}{#1}");$1("\\grayD","\\textcolor{##d6d8da}{#1}");$1("\\grayE","\\textcolor{##babec2}{#1}");$1("\\grayF","\\textcolor{##888d93}{#1}");$1("\\grayG","\\textcolor{##626569}{#1}");$1("\\grayH","\\textcolor{##3b3e40}{#1}");$1("\\grayI","\\textcolor{##21242c}{#1}");$1("\\kaBlue","\\textcolor{##314453}{#1}");$1("\\kaGreen","\\textcolor{##71B307}{#1}");S$0={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},b38=class{static{D(this,"MacroExpander")}constructor(J,Q,Z){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=Q,this.expansionCount=0,this.feed(J),this.macros=new _38(x38,Q.macros),this.mode=Z,this.stack=[]}feed(J){this.lexer=new Cj0(J,this.settings)}switchMode(J){this.mode=J}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){if(this.stack.length===0)this.pushToken(this.lexer.lex());return this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(J){this.stack.push(J)}pushTokens(J){this.stack.push(...J)}scanArgument(J){var Q,Z,X;if(J){if(this.consumeSpaces(),this.future().text!=="[")return null;Q=this.popToken(),{tokens:X,end:Z}=this.consumeArg(["]"])}else({tokens:X,start:Q,end:Z}=this.consumeArg());return this.pushToken(new KU("EOF",Z.loc)),this.pushTokens(X),Q.range(Z,"")}consumeSpaces(){for(;;){var J=this.future();if(J.text===" ")this.stack.pop();else break}}consumeArg(J){var Q=[],Z=J&&J.length>0;if(!Z)this.consumeSpaces();var X=this.future(),Y,K=0,G=0;do{if(Y=this.popToken(),Q.push(Y),Y.text==="{")++K;else if(Y.text==="}"){if(--K,K===-1)throw new r0("Extra }",Y)}else if(Y.text==="EOF")throw new r0("Unexpected end of input in a macro argument, expected '"+(J&&Z?J[G]:"}")+"'",Y);if(J&&Z)if((K===0||K===1&&J[G]==="{")&&Y.text===J[G]){if(++G,G===J.length){Q.splice(-G,G);break}}else G=0}while(K!==0||Z);if(X.text==="{"&&Q[Q.length-1].text==="}")Q.pop(),Q.shift();return Q.reverse(),{tokens:Q,start:X,end:Y}}consumeArgs(J,Q){if(Q){if(Q.length!==J+1)throw new r0("The length of delimiters doesn't match the number of args!");var Z=Q[0];for(var X=0;X<Z.length;X++){var Y=this.popToken();if(Z[X]!==Y.text)throw new r0("Use of the macro doesn't match its definition",Y)}}var K=[];for(var G=0;G<J;G++)K.push(this.consumeArg(Q&&Q[G+1]).tokens);return K}countExpansion(J){if(this.expansionCount+=J,this.expansionCount>this.settings.maxExpand)throw new r0("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(J){var Q=this.popToken(),Z=Q.text,X=!Q.noexpand?this._getExpansion(Z):null;if(X==null||J&&X.unexpandable){if(J&&X==null&&Z[0]==="\\"&&!this.isDefined(Z))throw new r0("Undefined control sequence: "+Z);return this.pushToken(Q),!1}this.countExpansion(1);var Y=X.tokens,K=this.consumeArgs(X.numArgs,X.delimiters);if(X.numArgs){Y=Y.slice();for(var G=Y.length-1;G>=0;--G){var q=Y[G];if(q.text==="#"){if(G===0)throw new r0("Incomplete placeholder at end of macro body",q);if(q=Y[--G],q.text==="#")Y.splice(G+1,1);else if(/^[1-9]$/.test(q.text))Y.splice(G,2,...K[+q.text-1]);else throw new r0("Not a valid argument number",q)}}}return this.pushTokens(Y),Y.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var J=this.stack.pop();if(J.treatAsRelax)J.text="\\relax";return J}throw Error()}expandMacro(J){return this.macros.has(J)?this.expandTokens([new KU(J)]):void 0}expandTokens(J){var Q=[],Z=this.stack.length;this.pushTokens(J);while(this.stack.length>Z)if(this.expandOnce(!0)===!1){var X=this.stack.pop();if(X.treatAsRelax)X.noexpand=!1,X.treatAsRelax=!1;Q.push(X)}return this.countExpansion(Q.length),Q}expandMacroAsText(J){var Q=this.expandMacro(J);if(Q)return Q.map((Z)=>Z.text).join("");else return Q}_getExpansion(J){var Q=this.macros.get(J);if(Q==null)return Q;if(J.length===1){var Z=this.lexer.catcodes[J];if(Z!=null&&Z!==13)return}var X=typeof Q==="function"?Q(this):Q;if(typeof X==="string"){var Y=0;if(X.indexOf("#")!==-1){var K=X.replace(/##/g,"");while(K.indexOf("#"+(Y+1))!==-1)++Y}var G=new Cj0(X,this.settings),q=[],z=G.lex();while(z.text!=="EOF")q.push(z),z=G.lex();q.reverse();var U={tokens:q,numArgs:Y};return U}return X}isDefined(J){return this.macros.has(J)||jM.hasOwnProperty(J)||X4.math.hasOwnProperty(J)||X4.text.hasOwnProperty(J)||S$0.hasOwnProperty(J)}isExpandable(J){var Q=this.macros.get(J);return Q!=null?typeof Q==="string"||typeof Q==="function"||!Q.unexpandable:jM.hasOwnProperty(J)&&!jM[J].primitive}},kj0=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,_11=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),YO1={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:"\\\"",math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},_j0={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},v$0=class J{static{D(this,"Parser")}constructor(Q,Z){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new b38(Q,Z,this.mode),this.settings=Z,this.leftrightDepth=0}expect(Q,Z){if(Z===void 0)Z=!0;if(this.fetch().text!==Q)throw new r0("Expected '"+Q+"', got '"+this.fetch().text+"'",this.fetch());if(Z)this.consume()}consume(){this.nextToken=null}fetch(){if(this.nextToken==null)this.nextToken=this.gullet.expandNextToken();return this.nextToken}switchMode(Q){this.mode=Q,this.gullet.switchMode(Q)}parse(){if(!this.settings.globalGroup)this.gullet.beginGroup();if(this.settings.colorIsTextColor)this.gullet.macros.set("\\color","\\textcolor");try{var Q=this.parseExpression(!1);if(this.expect("EOF"),!this.settings.globalGroup)this.gullet.endGroup();return Q}finally{this.gullet.endGroups()}}subparse(Q){var Z=this.nextToken;this.consume(),this.gullet.pushToken(new KU("}")),this.gullet.pushTokens(Q);var X=this.parseExpression(!1);return this.expect("}"),this.nextToken=Z,X}parseExpression(Q,Z){var X=[];while(!0){if(this.mode==="math")this.consumeSpaces();var Y=this.fetch();if(J.endOfExpression.indexOf(Y.text)!==-1)break;if(Z&&Y.text===Z)break;if(Q&&jM[Y.text]&&jM[Y.text].infix)break;var K=this.parseAtom(Z);if(!K)break;else if(K.type==="internal")continue;X.push(K)}if(this.mode==="text")this.formLigatures(X);return this.handleInfixNodes(X)}handleInfixNodes(Q){var Z=-1,X;for(var Y=0;Y<Q.length;Y++)if(Q[Y].type==="infix"){if(Z!==-1)throw new r0("only one infix operator per group",Q[Y].token);Z=Y,X=Q[Y].replaceWith}if(Z!==-1&&X){var K,G,q=Q.slice(0,Z),z=Q.slice(Z+1);if(q.length===1&&q[0].type==="ordgroup")K=q[0];else K={type:"ordgroup",mode:this.mode,body:q};if(z.length===1&&z[0].type==="ordgroup")G=z[0];else G={type:"ordgroup",mode:this.mode,body:z};var U;if(X==="\\\\abovefrac")U=this.callFunction(X,[K,Q[Z],G],[]);else U=this.callFunction(X,[K,G],[]);return[U]}else return Q}handleSupSubscript(Q){var Z=this.fetch(),X=Z.text;this.consume(),this.consumeSpaces();var Y=this.parseGroup(Q);if(!Y)throw new r0("Expected group after '"+X+"'",Z);return Y}formatUnsupportedCmd(Q){var Z=[];for(var X=0;X<Q.length;X++)Z.push({type:"textord",mode:"text",text:Q[X]});var Y={type:"text",mode:this.mode,body:Z},K={type:"color",mode:this.mode,color:this.settings.errorColor,body:[Y]};return K}parseAtom(Q){var Z=this.parseGroup("atom",Q);if(this.mode==="text")return Z;var X,Y;while(!0){this.consumeSpaces();var K=this.fetch();if(K.text==="\\limits"||K.text==="\\nolimits"){if(Z&&Z.type==="op"){var G=K.text==="\\limits";Z.limits=G,Z.alwaysHandleSupSub=!0}else if(Z&&Z.type==="operatorname"){if(Z.alwaysHandleSupSub)Z.limits=K.text==="\\limits"}else throw new r0("Limit controls must follow a math operator",K);this.consume()}else if(K.text==="^"){if(X)throw new r0("Double superscript",K);X=this.handleSupSubscript("superscript")}else if(K.text==="_"){if(Y)throw new r0("Double subscript",K);Y=this.handleSupSubscript("subscript")}else if(K.text==="'"){if(X)throw new r0("Double superscript",K);var q={type:"textord",mode:this.mode,text:"\\prime"},z=[q];this.consume();while(this.fetch().text==="'")z.push(q),this.consume();if(this.fetch().text==="^")z.push(this.handleSupSubscript("superscript"));X={type:"ordgroup",mode:this.mode,body:z}}else if(_11[K.text]){var U=kj0.test(K.text),W=[];W.push(new KU(_11[K.text])),this.consume();while(!0){var F=this.fetch().text;if(!_11[F])break;if(kj0.test(F)!==U)break;W.unshift(new KU(_11[F])),this.consume()}var H=this.subparse(W);if(U)Y={type:"ordgroup",mode:"math",body:H};else X={type:"ordgroup",mode:"math",body:H}}else break}if(X||Y)return{type:"supsub",mode:this.mode,base:Z,sup:X,sub:Y};else return Z}parseFunction(Q,Z){var X=this.fetch(),Y=X.text,K=jM[Y];if(!K)return null;if(this.consume(),Z&&Z!=="atom"&&!K.allowedInArgument)throw new r0("Got function '"+Y+"' with no arguments"+(Z?" as "+Z:""),X);else if(this.mode==="text"&&!K.allowedInText)throw new r0("Can't use function '"+Y+"' in text mode",X);else if(this.mode==="math"&&K.allowedInMath===!1)throw new r0("Can't use function '"+Y+"' in math mode",X);var{args:G,optArgs:q}=this.parseArguments(Y,K);return this.callFunction(Y,G,q,X,Q)}callFunction(Q,Z,X,Y,K){var G={funcName:Q,parser:this,token:Y,breakOnTokenText:K},q=jM[Q];if(q&&q.handler)return q.handler(G,Z,X);else throw new r0("No function handler for "+Q)}parseArguments(Q,Z){var X=Z.numArgs+Z.numOptionalArgs;if(X===0)return{args:[],optArgs:[]};var Y=[],K=[];for(var G=0;G<X;G++){var q=Z.argTypes&&Z.argTypes[G],z=G<Z.numOptionalArgs;if(Z.primitive&&q==null||Z.type==="sqrt"&&G===1&&K[0]==null)q="primitive";var U=this.parseGroupOfType("argument to '"+Q+"'",q,z);if(z)K.push(U);else if(U!=null)Y.push(U);else throw new r0("Null argument, please report this as a bug")}return{args:Y,optArgs:K}}parseGroupOfType(Q,Z,X){switch(Z){case"color":return this.parseColorGroup(X);case"size":return this.parseSizeGroup(X);case"url":return this.parseUrlGroup(X);case"math":case"text":return this.parseArgumentGroup(X,Z);case"hbox":{var Y=this.parseArgumentGroup(X,"text");return Y!=null?{type:"styling",mode:Y.mode,body:[Y],style:"text"}:null}case"raw":{var K=this.parseStringGroup("raw",X);return K!=null?{type:"raw",mode:"text",string:K.text}:null}case"primitive":{if(X)throw new r0("A primitive argument cannot be optional");var G=this.parseGroup(Q);if(G==null)throw new r0("Expected group as "+Q,this.fetch());return G}case"original":case null:case void 0:return this.parseArgumentGroup(X);default:throw new r0("Unknown group type as "+Q,this.fetch())}}consumeSpaces(){while(this.fetch().text===" ")this.consume()}parseStringGroup(Q,Z){var X=this.gullet.scanArgument(Z);if(X==null)return null;var Y="",K;while((K=this.fetch()).text!=="EOF")Y+=K.text,this.consume();return this.consume(),X.text=Y,X}parseRegexGroup(Q,Z){var X=this.fetch(),Y=X,K="",G;while((G=this.fetch()).text!=="EOF"&&Q.test(K+G.text))Y=G,K+=Y.text,this.consume();if(K==="")throw new r0("Invalid "+Z+": '"+X.text+"'",X);return X.range(Y,K)}parseColorGroup(Q){var Z=this.parseStringGroup("color",Q);if(Z==null)return null;var X=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(Z.text);if(!X)throw new r0("Invalid color: '"+Z.text+"'",Z);var Y=X[0];if(/^[0-9a-f]{6}$/i.test(Y))Y="#"+Y;return{type:"color-token",mode:this.mode,color:Y}}parseSizeGroup(Q){var Z,X=!1;if(this.gullet.consumeSpaces(),!Q&&this.gullet.future().text!=="{")Z=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size");else Z=this.parseStringGroup("size",Q);if(!Z)return null;if(!Q&&Z.text.length===0)Z.text="0pt",X=!0;var Y=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(Z.text);if(!Y)throw new r0("Invalid size: '"+Z.text+"'",Z);var K={number:+(Y[1]+Y[2]),unit:Y[3]};if(!uj0(K))throw new r0("Invalid unit: '"+K.unit+"'",Z);return{type:"size",mode:this.mode,value:K,isBlank:X}}parseUrlGroup(Q){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var Z=this.parseStringGroup("url",Q);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),Z==null)return null;var X=Z.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:X}}parseArgumentGroup(Q,Z){var X=this.gullet.scanArgument(Q);if(X==null)return null;var Y=this.mode;if(Z)this.switchMode(Z);this.gullet.beginGroup();var K=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var G={type:"ordgroup",mode:this.mode,loc:X.loc,body:K};if(Z)this.switchMode(Y);return G}parseGroup(Q,Z){var X=this.fetch(),Y=X.text,K;if(Y==="{"||Y==="\\begingroup"){this.consume();var G=Y==="{"?"}":"\\endgroup";this.gullet.beginGroup();var q=this.parseExpression(!1,G),z=this.fetch();this.expect(G),this.gullet.endGroup(),K={type:"ordgroup",mode:this.mode,loc:Xq.range(X,z),body:q,semisimple:Y==="\\begingroup"||void 0}}else if(K=this.parseFunction(Z,Q)||this.parseSymbol(),K==null&&Y[0]==="\\"&&!S$0.hasOwnProperty(Y)){if(this.settings.throwOnError)throw new r0("Undefined control sequence: "+Y,X);K=this.formatUnsupportedCmd(Y),this.consume()}return K}formLigatures(Q){var Z=Q.length-1;for(var X=0;X<Z;++X){var Y=Q[X],K=Y.text;if(K==="-"&&Q[X+1].text==="-")if(X+1<Z&&Q[X+2].text==="-")Q.splice(X,3,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+2]),text:"---"}),Z-=2;else Q.splice(X,2,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+1]),text:"--"}),Z-=1;if((K==="'"||K==="`")&&Q[X+1].text===K)Q.splice(X,2,{type:"textord",mode:"text",loc:Xq.range(Y,Q[X+1]),text:K+K}),Z-=1}}parseSymbol(){var Q=this.fetch(),Z=Q.text;if(/^\\verb[^a-zA-Z]/.test(Z)){this.consume();var X=Z.slice(5),Y=X.charAt(0)==="*";if(Y)X=X.slice(1);if(X.length<2||X.charAt(0)!==X.slice(-1))throw new r0(`\\verb assertion failed --
|
|
2299
|
+
please report what input caused this bug`);return X=X.slice(1,-1),{type:"verb",mode:"text",body:X,star:Y}}if(_j0.hasOwnProperty(Z[0])&&!X4[this.mode][Z[0]]){if(this.settings.strict&&this.mode==="math")this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+Z[0]+'" used in math mode',Q);Z=_j0[Z[0]]+Z.slice(1)}var K=v38.exec(Z);if(K){if(Z=Z.substring(0,K.index),Z==="i")Z="ı";else if(Z==="j")Z="ȷ"}var G;if(X4[this.mode][Z]){if(this.settings.strict&&this.mode==="math"&&UO1.indexOf(Z)>=0)this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+Z[0]+'" used in math mode',Q);var q=X4[this.mode][Z].group,z=Xq.range(Q),U;if(EN8.hasOwnProperty(q)){var W=q;U={type:"atom",mode:this.mode,family:W,loc:z,text:Z}}else U={type:q,mode:this.mode,loc:z,text:Z};G=U}else if(Z.charCodeAt(0)>=128){if(this.settings.strict){if(!AO1(Z.charCodeAt(0)))this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+Z[0]+'"'+(" ("+Z.charCodeAt(0)+")"),Q);else if(this.mode==="math")this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+Z[0]+'" used in math mode',Q)}G={type:"textord",mode:"text",loc:Xq.range(Q),text:Z}}else return null;if(this.consume(),K)for(var F=0;F<K[0].length;F++){var H=K[0][F];if(!YO1[H])throw new r0("Unknown accent ' "+H+"'",Q);var B=YO1[H][this.mode]||YO1[H].text;if(!B)throw new r0("Accent "+H+" unsupported in "+this.mode+" mode",Q);G={type:"accent",mode:this.mode,loc:Xq.range(Q),label:B,isStretchy:!1,isShifty:!0,base:G}}return G}};v$0.endOfExpression=["}","\\endgroup","\\end","\\right","&"];yO1=D(function(Q,Z){if(!(typeof Q==="string"||Q instanceof String))throw TypeError("KaTeX can only parse string typed expression");var X=new v$0(Q,Z);delete X.gullet.macros.current["\\df@tag"];var Y=X.parse();if(delete X.gullet.macros.current["\\current@color"],delete X.gullet.macros.current["\\color"],X.gullet.macros.get("\\df@tag")){if(!Z.displayMode)throw new r0("\\tag works only in display equations");Y=[{type:"tag",mode:"text",body:Y,tag:X.subparse([new KU("\\df@tag")])}]}return Y},"parseTree"),k$0=D(function(Q,Z,X){Z.textContent="";var Y=fO1(Q,X).toNode();Z.appendChild(Y)},"render");if(typeof document<"u"){if(document.compatMode!=="CSS1Compat")typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),k$0=D(function(){throw new r0("KaTeX doesn't work in quirks mode.")},"render")}y38=D(function(Q,Z){var X=fO1(Q,Z).toMarkup();return X},"renderToString"),f38=D(function(Q,Z){var X=new NO1(Z);return yO1(Q,X)},"generateParseTree"),_$0=D(function(Q,Z,X){if(X.throwOnError||!(Q instanceof r0))throw Q;var Y=Y0.makeSpan(["katex-error"],[new KK(Z)]);return Y.setAttribute("title",Q.toString()),Y.setAttribute("style","color:"+X.errorColor),Y},"renderError"),fO1=D(function(Q,Z){var X=new NO1(Z);try{var Y=yO1(Q,X);return aN8(Y,Q,X)}catch(K){return _$0(K,Q,X)}},"renderToDomTree"),h38=D(function(Q,Z){var X=new NO1(Z);try{var Y=yO1(Q,X);return rN8(Y,Q,X)}catch(K){return _$0(K,Q,X)}},"renderToHTMLTree"),g38={version:"0.16.11",render:k$0,renderToString:y38,ParseError:r0,SETTINGS_SCHEMA:x11,__parse:f38,__renderToDomTree:fO1,__renderToHTMLTree:h38,__setFontMetrics:hj0,__defineSymbol:s,__defineFunction:H6,__defineMacro:$1,__domTree:{Span:Hf,Anchor:wO1,SymbolNode:KK,SvgNode:lF,PathNode:EM,LineNode:qO1}}});function QQ(J){return function(Q){for(var Z=arguments.length,X=Array(Z>1?Z-1:0),Y=1;Y<Z;Y++)X[Y-1]=arguments[Y];return sO1(J,Q,X)}}function TE0(J){return function(){for(var Q=arguments.length,Z=Array(Q),X=0;X<Q;X++)Z[X]=arguments[X];return oO1(J,Z)}}function N9(J,Q){let Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:G01;if(h$0)h$0(J,null);let X=Q.length;while(X--){let Y=Q[X];if(typeof Y==="string"){let K=Z(Y);if(K!==Y){if(!TL8(Q))Q[X]=K;Y=K}}J[Y]=!0}return J}function CE0(J){for(let Q=0;Q<J.length;Q++)if(!Gq(J,Q))J[Q]=null;return J}function CM(J){let Q=PE0(null);for(let[Z,X]of IE0(J))if(Gq(J,Z))if(Array.isArray(X))Q[Z]=CE0(X);else if(X&&typeof X==="object"&&X.constructor===Object)Q[Z]=CM(X);else Q[Z]=X;return Q}function wI(J,Q){while(J!==null){let X=SL8(J,Q);if(X){if(X.get)return QQ(X.get);if(typeof X.value==="function")return QQ(X.value)}J=CL8(J)}function Z(){return null}return D(Z,"fallbackValue"),Z}function uj1(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lL8(),Q=D((f0)=>uj1(f0),"DOMPurify");if(Q.version="3.2.4",Q.removed=[],!J||!J.document||J.document.nodeType!==Af.document||!J.Element)return Q.isSupported=!1,Q;let{document:Z}=J,X=Z,Y=X.currentScript,{DocumentFragment:K,HTMLTemplateElement:G,Node:q,Element:z,NodeFilter:U,NamedNodeMap:W=J.NamedNodeMap||J.MozNamedAttrMap,HTMLFormElement:F,DOMParser:H,trustedTypes:B}=J,M=z.prototype,V=wI(M,"cloneNode"),N=wI(M,"remove"),L=wI(M,"nextSibling"),A=wI(M,"childNodes"),w=wI(M,"parentNode");if(typeof G==="function"){let f0=Z.createElement("template");if(f0.content&&f0.content.ownerDocument)Z=f0.content.ownerDocument}let R,O="",{implementation:j,createNodeIterator:$,createDocumentFragment:E,getElementsByTagName:I}=Z,{importNode:T}=X,S=i$0();Q.isSupported=typeof IE0==="function"&&typeof w==="function"&&j&&j.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:x,ERB_EXPR:h,TMPLIT_EXPR:v,DATA_ATTR:_,ARIA_ATTR:b,IS_SCRIPT_OR_DATA:g,ATTR_WHITESPACE:k,CUSTOM_ELEMENT:y}=l$0,{IS_ALLOWED_URI:f}=l$0,m=null,n=N9({},[...u$0,...gO1,...mO1,...uO1,...p$0]),p=null,e=N9({},[...d$0,...pO1,...c$0,...e11]),G1=Object.seal(PE0(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}})),U1=null,Z1=null,F1=!0,l=!0,d=!1,i=!0,r=!1,o=!0,Y1=!1,J1=!1,H1=!1,z1=!1,W1=!1,w1=!1,D1=!0,y1=!1,l1="user-content-",s1=!0,d1=!1,r1={},V1=null,t=N9({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),O1=null,M1=N9({},["audio","video","img","source","image","track"]),I1=null,X1=N9({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),v1="http://www.w3.org/1998/Math/MathML",q1="http://www.w3.org/2000/svg",P1="http://www.w3.org/1999/xhtml",T1=P1,b1=!1,h1=null,c1=N9({},[v1,q1,P1],hO1),W0=N9({},["mi","mo","mn","ms","mtext"]),p1=N9({},["annotation-xml"]),R0=N9({},["title","style","font","a","script"]),T0=null,A0=["application/xhtml+xml","text/html"],l0="text/html",I0=null,$0=null,F0=Z.createElement("form"),m0=D(function(g1){return g1 instanceof RegExp||g1 instanceof Function},"isRegexOrFunction"),n0=D(function(){let g1=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($0&&$0===g1)return;if(!g1||typeof g1!=="object")g1={};if(g1=CM(g1),T0=A0.indexOf(g1.PARSER_MEDIA_TYPE)===-1?l0:g1.PARSER_MEDIA_TYPE,I0=T0==="application/xhtml+xml"?hO1:G01,m=Gq(g1,"ALLOWED_TAGS")?N9({},g1.ALLOWED_TAGS,I0):n,p=Gq(g1,"ALLOWED_ATTR")?N9({},g1.ALLOWED_ATTR,I0):e,h1=Gq(g1,"ALLOWED_NAMESPACES")?N9({},g1.ALLOWED_NAMESPACES,hO1):c1,I1=Gq(g1,"ADD_URI_SAFE_ATTR")?N9(CM(X1),g1.ADD_URI_SAFE_ATTR,I0):X1,O1=Gq(g1,"ADD_DATA_URI_TAGS")?N9(CM(M1),g1.ADD_DATA_URI_TAGS,I0):M1,V1=Gq(g1,"FORBID_CONTENTS")?N9({},g1.FORBID_CONTENTS,I0):t,U1=Gq(g1,"FORBID_TAGS")?N9({},g1.FORBID_TAGS,I0):{},Z1=Gq(g1,"FORBID_ATTR")?N9({},g1.FORBID_ATTR,I0):{},r1=Gq(g1,"USE_PROFILES")?g1.USE_PROFILES:!1,F1=g1.ALLOW_ARIA_ATTR!==!1,l=g1.ALLOW_DATA_ATTR!==!1,d=g1.ALLOW_UNKNOWN_PROTOCOLS||!1,i=g1.ALLOW_SELF_CLOSE_IN_ATTR!==!1,r=g1.SAFE_FOR_TEMPLATES||!1,o=g1.SAFE_FOR_XML!==!1,Y1=g1.WHOLE_DOCUMENT||!1,z1=g1.RETURN_DOM||!1,W1=g1.RETURN_DOM_FRAGMENT||!1,w1=g1.RETURN_TRUSTED_TYPE||!1,H1=g1.FORCE_BODY||!1,D1=g1.SANITIZE_DOM!==!1,y1=g1.SANITIZE_NAMED_PROPS||!1,s1=g1.KEEP_CONTENT!==!1,d1=g1.IN_PLACE||!1,f=g1.ALLOWED_URI_REGEXP||SE0,T1=g1.NAMESPACE||P1,W0=g1.MATHML_TEXT_INTEGRATION_POINTS||W0,p1=g1.HTML_INTEGRATION_POINTS||p1,G1=g1.CUSTOM_ELEMENT_HANDLING||{},g1.CUSTOM_ELEMENT_HANDLING&&m0(g1.CUSTOM_ELEMENT_HANDLING.tagNameCheck))G1.tagNameCheck=g1.CUSTOM_ELEMENT_HANDLING.tagNameCheck;if(g1.CUSTOM_ELEMENT_HANDLING&&m0(g1.CUSTOM_ELEMENT_HANDLING.attributeNameCheck))G1.attributeNameCheck=g1.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;if(g1.CUSTOM_ELEMENT_HANDLING&&typeof g1.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==="boolean")G1.allowCustomizedBuiltInElements=g1.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;if(r)l=!1;if(W1)z1=!0;if(r1){if(m=N9({},p$0),p=[],r1.html===!0)N9(m,u$0),N9(p,d$0);if(r1.svg===!0)N9(m,gO1),N9(p,pO1),N9(p,e11);if(r1.svgFilters===!0)N9(m,mO1),N9(p,pO1),N9(p,e11);if(r1.mathMl===!0)N9(m,uO1),N9(p,c$0),N9(p,e11)}if(g1.ADD_TAGS){if(m===n)m=CM(m);N9(m,g1.ADD_TAGS,I0)}if(g1.ADD_ATTR){if(p===e)p=CM(p);N9(p,g1.ADD_ATTR,I0)}if(g1.ADD_URI_SAFE_ATTR)N9(I1,g1.ADD_URI_SAFE_ATTR,I0);if(g1.FORBID_CONTENTS){if(V1===t)V1=CM(V1);N9(V1,g1.FORBID_CONTENTS,I0)}if(s1)m["#text"]=!0;if(Y1)N9(m,["html","head","body"]);if(m.table)N9(m,["tbody"]),delete U1.tbody;if(g1.TRUSTED_TYPES_POLICY){if(typeof g1.TRUSTED_TYPES_POLICY.createHTML!=="function")throw Lf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof g1.TRUSTED_TYPES_POLICY.createScriptURL!=="function")throw Lf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=g1.TRUSTED_TYPES_POLICY,O=R.createHTML("")}else{if(R===void 0)R=iL8(B,Y);if(R!==null&&typeof O==="string")O=R.createHTML("")}if(nQ)nQ(g1);$0=g1},"_parseConfig"),w0=N9({},[...gO1,...mO1,...bL8]),Y6=N9({},[...uO1,...yL8]),s0=D(function(g1){let q0=w(g1);if(!q0||!q0.tagName)q0={namespaceURI:T1,tagName:"template"};let v0=G01(g1.tagName),V6=G01(q0.tagName);if(!h1[g1.namespaceURI])return!1;if(g1.namespaceURI===q1){if(q0.namespaceURI===P1)return v0==="svg";if(q0.namespaceURI===v1)return v0==="svg"&&(V6==="annotation-xml"||W0[V6]);return Boolean(w0[v0])}if(g1.namespaceURI===v1){if(q0.namespaceURI===P1)return v0==="math";if(q0.namespaceURI===q1)return v0==="math"&&p1[V6];return Boolean(Y6[v0])}if(g1.namespaceURI===P1){if(q0.namespaceURI===q1&&!p1[V6])return!1;if(q0.namespaceURI===v1&&!W0[V6])return!1;return!Y6[v0]&&(R0[v0]||!w0[v0])}if(T0==="application/xhtml+xml"&&h1[g1.namespaceURI])return!0;return!1},"_checkValidNamespace"),k1=D(function(g1){Vf(Q.removed,{element:g1});try{w(g1).removeChild(g1)}catch(q0){N(g1)}},"_forceRemove"),R1=D(function(g1,q0){try{Vf(Q.removed,{attribute:q0.getAttributeNode(g1),from:q0})}catch(v0){Vf(Q.removed,{attribute:null,from:q0})}if(q0.removeAttribute(g1),g1==="is")if(z1||W1)try{k1(q0)}catch(v0){}else try{q0.setAttribute(g1,"")}catch(v0){}},"_removeAttribute"),S1=D(function(g1){let q0=null,v0=null;if(H1)g1="<remove></remove>"+g1;else{let o8=m$0(g1,/^[\r\n\t ]+/);v0=o8&&o8[0]}if(T0==="application/xhtml+xml"&&T1===P1)g1='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+g1+"</body></html>";let V6=R?R.createHTML(g1):g1;if(T1===P1)try{q0=new H().parseFromString(V6,T0)}catch(o8){}if(!q0||!q0.documentElement){q0=j.createDocument(T1,"template",null);try{q0.documentElement.innerHTML=b1?O:V6}catch(o8){}}let z9=q0.body||q0.documentElement;if(g1&&v0)z9.insertBefore(Z.createTextNode(v0),z9.childNodes[0]||null);if(T1===P1)return I.call(q0,Y1?"html":"body")[0];return Y1?q0.documentElement:z9},"_initDocument"),i1=D(function(g1){return $.call(g1.ownerDocument||g1,g1,U.SHOW_ELEMENT|U.SHOW_COMMENT|U.SHOW_TEXT|U.SHOW_PROCESSING_INSTRUCTION|U.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),f1=D(function(g1){return g1 instanceof F&&(typeof g1.nodeName!=="string"||typeof g1.textContent!=="string"||typeof g1.removeChild!=="function"||!(g1.attributes instanceof W)||typeof g1.removeAttribute!=="function"||typeof g1.setAttribute!=="function"||typeof g1.namespaceURI!=="string"||typeof g1.insertBefore!=="function"||typeof g1.hasChildNodes!=="function")},"_isClobbered"),j0=D(function(g1){return typeof q==="function"&&g1 instanceof q},"_isNode");function H0(f0,g1,q0){t11(f0,(v0)=>{v0.call(Q,g1,q0,$0)})}D(H0,"_executeHooks");let r6=D(function(g1){let q0=null;if(H0(S.beforeSanitizeElements,g1,null),f1(g1))return k1(g1),!0;let v0=I0(g1.nodeName);if(H0(S.uponSanitizeElement,g1,{tagName:v0,allowedTags:m}),g1.hasChildNodes()&&!j0(g1.firstElementChild)&&lQ(/<[/\w]/g,g1.innerHTML)&&lQ(/<[/\w]/g,g1.textContent))return k1(g1),!0;if(g1.nodeType===Af.progressingInstruction)return k1(g1),!0;if(o&&g1.nodeType===Af.comment&&lQ(/<[/\w]/g,g1.data))return k1(g1),!0;if(!m[v0]||U1[v0]){if(!U1[v0]&&s6(v0)){if(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,v0))return!1;if(G1.tagNameCheck instanceof Function&&G1.tagNameCheck(v0))return!1}if(s1&&!V1[v0]){let V6=w(g1)||g1.parentNode,z9=A(g1)||g1.childNodes;if(z9&&V6){let o8=z9.length;for(let p8=o8-1;p8>=0;--p8){let I8=V(z9[p8],!0);I8.__removalCount=(g1.__removalCount||0)+1,V6.insertBefore(I8,L(g1))}}}return k1(g1),!0}if(g1 instanceof z&&!s0(g1))return k1(g1),!0;if((v0==="noscript"||v0==="noembed"||v0==="noframes")&&lQ(/<\/no(script|embed|frames)/i,g1.innerHTML))return k1(g1),!0;if(r&&g1.nodeType===Af.text){if(q0=g1.textContent,t11([x,h,v],(V6)=>{q0=Nf(q0,V6," ")}),g1.textContent!==q0)Vf(Q.removed,{element:g1.cloneNode()}),g1.textContent=q0}return H0(S.afterSanitizeElements,g1,null),!1},"_sanitizeElements"),C6=D(function(g1,q0,v0){if(D1&&(q0==="id"||q0==="name")&&((v0 in Z)||(v0 in F0)))return!1;if(l&&!Z1[q0]&&lQ(_,q0));else if(F1&&lQ(b,q0));else if(!p[q0]||Z1[q0])if(s6(g1)&&(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,g1)||G1.tagNameCheck instanceof Function&&G1.tagNameCheck(g1))&&(G1.attributeNameCheck instanceof RegExp&&lQ(G1.attributeNameCheck,q0)||G1.attributeNameCheck instanceof Function&&G1.attributeNameCheck(q0))||q0==="is"&&G1.allowCustomizedBuiltInElements&&(G1.tagNameCheck instanceof RegExp&&lQ(G1.tagNameCheck,v0)||G1.tagNameCheck instanceof Function&&G1.tagNameCheck(v0)));else return!1;else if(I1[q0]);else if(lQ(f,Nf(v0,k,"")));else if((q0==="src"||q0==="xlink:href"||q0==="href")&&g1!=="script"&&_L8(v0,"data:")===0&&O1[g1]);else if(d&&!lQ(g,Nf(v0,k,"")));else if(v0)return!1;return!0},"_isValidAttribute"),s6=D(function(g1){return g1!=="annotation-xml"&&m$0(g1,y)},"_isBasicCustomElement"),M6=D(function(g1){H0(S.beforeSanitizeAttributes,g1,null);let{attributes:q0}=g1;if(!q0||f1(g1))return;let v0={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:p,forceKeepAttr:void 0},V6=q0.length;while(V6--){let z9=q0[V6],{name:o8,namespaceURI:p8,value:I8}=z9,v9=I0(o8),Z9=o8==="value"?I8:xL8(I8);if(v0.attrName=v9,v0.attrValue=Z9,v0.keepAttr=!0,v0.forceKeepAttr=void 0,H0(S.uponSanitizeAttribute,g1,v0),Z9=v0.attrValue,y1&&(v9==="id"||v9==="name"))R1(o8,g1),Z9=l1+Z9;if(o&&lQ(/((--!?|])>)|<\/(style|title)/i,Z9)){R1(o8,g1);continue}if(v0.forceKeepAttr)continue;if(R1(o8,g1),!v0.keepAttr)continue;if(!i&&lQ(/\/>/i,Z9)){R1(o8,g1);continue}if(r)t11([x,h,v],(U6)=>{Z9=Nf(Z9,U6," ")});let T2=I0(g1.nodeName);if(!C6(T2,v9,Z9))continue;if(R&&typeof B==="object"&&typeof B.getAttributeType==="function")if(p8);else switch(B.getAttributeType(T2,v9)){case"TrustedHTML":{Z9=R.createHTML(Z9);break}case"TrustedScriptURL":{Z9=R.createScriptURL(Z9);break}}try{if(p8)g1.setAttributeNS(p8,o8,Z9);else g1.setAttribute(o8,Z9);if(f1(g1))k1(g1);else g$0(Q.removed)}catch(U6){}}H0(S.afterSanitizeAttributes,g1,null)},"_sanitizeAttributes"),N8=D(function f0(g1){let q0=null,v0=i1(g1);H0(S.beforeSanitizeShadowDOM,g1,null);while(q0=v0.nextNode())if(H0(S.uponSanitizeShadowNode,q0,null),r6(q0),M6(q0),q0.content instanceof K)f0(q0.content);H0(S.afterSanitizeShadowDOM,g1,null)},"_sanitizeShadowDOM");return Q.sanitize=function(f0){let g1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q0=null,v0=null,V6=null,z9=null;if(b1=!f0,b1)f0="<!-->";if(typeof f0!=="string"&&!j0(f0))if(typeof f0.toString==="function"){if(f0=f0.toString(),typeof f0!=="string")throw Lf("dirty is not a string, aborting")}else throw Lf("toString is not a function");if(!Q.isSupported)return f0;if(!J1)n0(g1);if(Q.removed=[],typeof f0==="string")d1=!1;if(d1){if(f0.nodeName){let I8=I0(f0.nodeName);if(!m[I8]||U1[I8])throw Lf("root node is forbidden and cannot be sanitized in-place")}}else if(f0 instanceof q)if(q0=S1("<!---->"),v0=q0.ownerDocument.importNode(f0,!0),v0.nodeType===Af.element&&v0.nodeName==="BODY")q0=v0;else if(v0.nodeName==="HTML")q0=v0;else q0.appendChild(v0);else{if(!z1&&!r&&!Y1&&f0.indexOf("<")===-1)return R&&w1?R.createHTML(f0):f0;if(q0=S1(f0),!q0)return z1?null:w1?O:""}if(q0&&H1)k1(q0.firstChild);let o8=i1(d1?f0:q0);while(V6=o8.nextNode())if(r6(V6),M6(V6),V6.content instanceof K)N8(V6.content);if(d1)return f0;if(z1){if(W1){z9=E.call(q0.ownerDocument);while(q0.firstChild)z9.appendChild(q0.firstChild)}else z9=q0;if(p.shadowroot||p.shadowrootmode)z9=T.call(X,z9,!0);return z9}let p8=Y1?q0.outerHTML:q0.innerHTML;if(Y1&&m["!doctype"]&&q0.ownerDocument&&q0.ownerDocument.doctype&&q0.ownerDocument.doctype.name&&lQ(vE0,q0.ownerDocument.doctype.name))p8="<!DOCTYPE "+q0.ownerDocument.doctype.name+`>
|
|
2300
2300
|
`+p8;if(r)t11([x,h,v],(I8)=>{p8=Nf(p8,I8," ")});return R&&w1?R.createHTML(p8):p8},Q.setConfig=function(){let f0=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n0(f0),J1=!0},Q.clearConfig=function(){$0=null,J1=!1},Q.isValidAttribute=function(f0,g1,q0){if(!$0)n0({});let v0=I0(f0),V6=I0(g1);return C6(v0,V6,q0)},Q.addHook=function(f0,g1){if(typeof g1!=="function")return;Vf(S[f0],g1)},Q.removeHook=function(f0,g1){if(g1!==void 0){let q0=vL8(S[f0],g1);return q0===-1?void 0:kL8(S[f0],q0,1)[0]}return g$0(S[f0])},Q.removeHooks=function(f0){S[f0]=[]},Q.removeAllHooks=function(){S=i$0()},Q}function kE0(){jA.addHook("beforeSanitizeAttributes",(Q)=>{if(Q instanceof Element&&Q.tagName==="A"&&Q.hasAttribute("target"))Q.setAttribute("data-temp-href-target",Q.getAttribute("target")??"")}),jA.addHook("afterSanitizeAttributes",(Q)=>{if(Q instanceof Element&&Q.tagName==="A"&&Q.hasAttribute("data-temp-href-target")){if(Q.setAttribute("target",Q.getAttribute("data-temp-href-target")??""),Q.removeAttribute("data-temp-href-target"),Q.getAttribute("target")==="_blank")Q.setAttribute("rel","noopener")}})}function nj1(J,Q){let Z;if(Q===void 0){for(let X of J)if(X!=null&&(Z<X||Z===void 0&&X>=X))Z=X}else{let X=-1;for(let Y of J)if((Y=Q(Y,++X,J))!=null&&(Z<Y||Z===void 0&&Y>=Y))Z=Y}return Z}function aj1(J,Q){let Z;if(Q===void 0){for(let X of J)if(X!=null&&(Z>X||Z===void 0&&X>=X))Z=X}else{let X=-1;for(let Y of J)if((Y=Q(Y,++X,J))!=null&&(Z>Y||Z===void 0&&Y>=Y))Z=Y}return Z}function Tf(J,Q){return J==null||Q==null?NaN:J<Q?-1:J>Q?1:J>=Q?0:NaN}function yE0(J,Q){return J==null||Q==null?NaN:Q<J?-1:Q>J?1:Q>=J?0:NaN}function d01(J){let Q,Z,X;if(J.length!==2)Q=Tf,Z=D((q,z)=>Tf(J(q),z),"compare2"),X=D((q,z)=>J(q)-z,"delta");else Q=J===Tf||J===yE0?J:fE0,Z=J,X=J;function Y(q,z,U=0,W=q.length){if(U<W){if(Q(z,z)!==0)return W;do{let F=U+W>>>1;if(Z(q[F],z)<0)U=F+1;else W=F}while(U<W)}return U}D(Y,"left");function K(q,z,U=0,W=q.length){if(U<W){if(Q(z,z)!==0)return W;do{let F=U+W>>>1;if(Z(q[F],z)<=0)U=F+1;else W=F}while(U<W)}return U}D(K,"right");function G(q,z,U=0,W=q.length){let F=Y(q,z,U,W-1);return F>U&&X(q[F-1],z)>-X(q[F],z)?F-1:F}return D(G,"center"),{left:Y,center:G,right:K}}function fE0(){return 0}function hE0(J){return J===null?NaN:+J}function Jj1({_intern:J,_key:Q},Z){let X=Q(Z);return J.has(X)?J.get(X):Z}function mE0({_intern:J,_key:Q},Z){let X=Q(Z);if(J.has(X))return J.get(X);return J.set(X,Z),Z}function uE0({_intern:J,_key:Q},Z){let X=Q(Z);if(J.has(X))Z=J.get(X),J.delete(X);return Z}function pE0(J){return J!==null&&typeof J==="object"?J.valueOf():J}function vf(J,Q,Z){let X=(Q-J)/Math.max(0,Z),Y=Math.floor(Math.log10(X)),K=X/Math.pow(10,Y),G=K>=BA8?10:K>=DA8?5:K>=MA8?2:1,q,z,U;if(Y<0){if(U=Math.pow(10,-Y)/G,q=Math.round(J*U),z=Math.round(Q*U),q/U<J)++q;if(z/U>Q)--z;U=-U}else{if(U=Math.pow(10,Y)*G,q=Math.round(J/U),z=Math.round(Q/U),q*U<J)++q;if(z*U>Q)--z}if(z<q&&0.5<=Z&&Z<2)return vf(J,Q,Z*2);return[q,z,U]}function dE0(J,Q,Z){if(Q=+Q,J=+J,Z=+Z,!(Z>0))return[];if(J===Q)return[J];let X=Q<J,[Y,K,G]=X?vf(Q,J,Z):vf(J,Q,Z);if(!(K>=Y))return[];let q=K-Y+1,z=Array(q);if(X)if(G<0)for(let U=0;U<q;++U)z[U]=(K-U)/-G;else for(let U=0;U<q;++U)z[U]=(K-U)*G;else if(G<0)for(let U=0;U<q;++U)z[U]=(Y+U)/-G;else for(let U=0;U<q;++U)z[U]=(Y+U)*G;return z}function R01(J,Q,Z){return Q=+Q,J=+J,Z=+Z,vf(J,Q,Z)[2]}function O01(J,Q,Z){Q=+Q,J=+J,Z=+Z;let X=Q<J,Y=X?R01(Q,J,Z):R01(J,Q,Z);return(X?-1:1)*(Y<0?1/-Y:Y)}function cE0(J,Q,Z){J=+J,Q=+Q,Z=(Y=arguments.length)<2?(Q=J,J=0,1):Y<3?1:+Z;var X=-1,Y=Math.max(0,Math.ceil((Q-J)/Z))|0,K=Array(Y);while(++X<Y)K[X]=J+X*Z;return K}function lE0(J){return J}function iE0(J){return"translate("+J+",0)"}function nE0(J){return"translate(0,"+J+")"}function aE0(J){return(Q)=>+J(Q)}function rE0(J,Q){if(Q=Math.max(0,J.bandwidth()-Q*2)/2,J.round())Q=Math.round(Q);return(Z)=>+J(Z)+Q}function sE0(){return!this.__axis}function rj1(J,Q){var Z=[],X=null,Y=null,K=6,G=6,q=3,z=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,U=J===z01||J===J01?-1:1,W=J===J01||J===dO1?"x":"y",F=J===z01||J===Qj1?iE0:nE0;function H(B){var M=X==null?Q.ticks?Q.ticks.apply(Q,Z):Q.domain():X,V=Y==null?Q.tickFormat?Q.tickFormat.apply(Q,Z):lE0:Y,N=Math.max(K,0)+q,L=Q.range(),A=+L[0]+z,w=+L[L.length-1]+z,R=(Q.bandwidth?rE0:aE0)(Q.copy(),z),O=B.selection?B.selection():B,j=O.selectAll(".domain").data([null]),$=O.selectAll(".tick").data(M,Q).order(),E=$.exit(),I=$.enter().append("g").attr("class","tick"),T=$.select("line"),S=$.select("text");if(j=j.merge(j.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),$=$.merge(I),T=T.merge(I.append("line").attr("stroke","currentColor").attr(W+"2",U*K)),S=S.merge(I.append("text").attr("fill","currentColor").attr(W,U*N).attr("dy",J===z01?"0em":J===Qj1?"0.71em":"0.32em")),B!==O)j=j.transition(B),$=$.transition(B),T=T.transition(B),S=S.transition(B),E=E.transition(B).attr("opacity",o$0).attr("transform",function(x){return isFinite(x=R(x))?F(x+z):this.getAttribute("transform")}),I.attr("opacity",o$0).attr("transform",function(x){var h=this.parentNode.__axis;return F((h&&isFinite(h=h(x))?h:R(x))+z)});E.remove(),j.attr("d",J===J01||J===dO1?G?"M"+U*G+","+A+"H"+z+"V"+w+"H"+U*G:"M"+z+","+A+"V"+w:G?"M"+A+","+U*G+"V"+z+"H"+w+"V"+U*G:"M"+A+","+z+"H"+w),$.attr("opacity",1).attr("transform",function(x){return F(R(x)+z)}),T.attr(W+"2",U*K),S.attr(W,U*N).text(V),O.filter(sE0).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",J===dO1?"start":J===J01?"end":"middle"),O.each(function(){this.__axis=R})}return D(H,"axis"),H.scale=function(B){return arguments.length?(Q=B,H):Q},H.ticks=function(){return Z=Array.from(arguments),H},H.tickArguments=function(B){return arguments.length?(Z=B==null?[]:Array.from(B),H):Z.slice()},H.tickValues=function(B){return arguments.length?(X=B==null?null:Array.from(B),H):X&&X.slice()},H.tickFormat=function(B){return arguments.length?(Y=B,H):Y},H.tickSize=function(B){return arguments.length?(K=G=+B,H):K},H.tickSizeInner=function(B){return arguments.length?(K=+B,H):K},H.tickSizeOuter=function(B){return arguments.length?(G=+B,H):G},H.tickPadding=function(B){return arguments.length?(q=+B,H):q},H.offset=function(B){return arguments.length?(z=+B,H):z},H}function sj1(J){return rj1(z01,J)}function oj1(J){return rj1(Qj1,J)}function oE0(){}function c01(J){return J==null?oE0:function(){return this.querySelector(J)}}function tE0(J){if(typeof J!=="function")J=c01(J);for(var Q=this._groups,Z=Q.length,X=Array(Z),Y=0;Y<Z;++Y)for(var K=Q[Y],G=K.length,q=X[Y]=Array(G),z,U,W=0;W<G;++W)if((z=K[W])&&(U=J.call(z,z.__data__,W,K))){if("__data__"in z)U.__data__=z.__data__;q[W]=U}return new lZ(X,this._parents)}function eE0(J){return J==null?[]:Array.isArray(J)?J:Array.from(J)}function JI0(){return[]}function tj1(J){return J==null?JI0:function(){return this.querySelectorAll(J)}}function QI0(J){return function(){return eE0(J.apply(this,arguments))}}function ZI0(J){if(typeof J==="function")J=QI0(J);else J=tj1(J);for(var Q=this._groups,Z=Q.length,X=[],Y=[],K=0;K<Z;++K)for(var G=Q[K],q=G.length,z,U=0;U<q;++U)if(z=G[U])X.push(J.call(z,z.__data__,U,G)),Y.push(z);return new lZ(X,Y)}function ej1(J){return function(){return this.matches(J)}}function J$1(J){return function(Q){return Q.matches(J)}}function XI0(J){return function(){return VA8.call(this.children,J)}}function YI0(){return this.firstElementChild}function KI0(J){return this.select(J==null?YI0:XI0(typeof J==="function"?J:J$1(J)))}function GI0(){return Array.from(this.children)}function qI0(J){return function(){return NA8.call(this.children,J)}}function zI0(J){return this.selectAll(J==null?GI0:qI0(typeof J==="function"?J:J$1(J)))}function UI0(J){if(typeof J!=="function")J=ej1(J);for(var Q=this._groups,Z=Q.length,X=Array(Z),Y=0;Y<Z;++Y)for(var K=Q[Y],G=K.length,q=X[Y]=[],z,U=0;U<G;++U)if((z=K[U])&&J.call(z,z.__data__,U,K))q.push(z);return new lZ(X,this._parents)}function Q$1(J){return Array(J.length)}function WI0(){return new lZ(this._enter||this._groups.map(Q$1),this._parents)}function kf(J,Q){this.ownerDocument=J.ownerDocument,this.namespaceURI=J.namespaceURI,this._next=null,this._parent=J,this.__data__=Q}function FI0(J){return function(){return J}}function HI0(J,Q,Z,X,Y,K){var G=0,q,z=Q.length,U=K.length;for(;G<U;++G)if(q=Q[G])q.__data__=K[G],X[G]=q;else Z[G]=new kf(J,K[G]);for(;G<z;++G)if(q=Q[G])Y[G]=q}function BI0(J,Q,Z,X,Y,K,G){var q,z,U=new Map,W=Q.length,F=K.length,H=Array(W),B;for(q=0;q<W;++q)if(z=Q[q])if(H[q]=B=G.call(z,z.__data__,q,Q)+"",U.has(B))Y[q]=z;else U.set(B,z);for(q=0;q<F;++q)if(B=G.call(J,K[q],q,K)+"",z=U.get(B))X[q]=z,z.__data__=K[q],U.delete(B);else Z[q]=new kf(J,K[q]);for(q=0;q<W;++q)if((z=Q[q])&&U.get(H[q])===z)Y[q]=z}function DI0(J){return J.__data__}function MI0(J,Q){if(!arguments.length)return Array.from(this,DI0);var Z=Q?BI0:HI0,X=this._parents,Y=this._groups;if(typeof J!=="function")J=FI0(J);for(var K=Y.length,G=Array(K),q=Array(K),z=Array(K),U=0;U<K;++U){var W=X[U],F=Y[U],H=F.length,B=VI0(J.call(W,W&&W.__data__,U,X)),M=B.length,V=q[U]=Array(M),N=G[U]=Array(M),L=z[U]=Array(H);Z(W,F,V,N,L,B,Q);for(var A=0,w=0,R,O;A<M;++A)if(R=V[A]){if(A>=w)w=A+1;while(!(O=N[w])&&++w<M);R._next=O||null}}return G=new lZ(G,X),G._enter=q,G._exit=z,G}function VI0(J){return typeof J==="object"&&"length"in J?J:Array.from(J)}function NI0(){return new lZ(this._exit||this._groups.map(Q$1),this._parents)}function LI0(J,Q,Z){var X=this.enter(),Y=this,K=this.exit();if(typeof J==="function"){if(X=J(X),X)X=X.selection()}else X=X.append(J+"");if(Q!=null){if(Y=Q(Y),Y)Y=Y.selection()}if(Z==null)K.remove();else Z(K);return X&&Y?X.merge(Y).order():Y}function AI0(J){var Q=J.selection?J.selection():J;for(var Z=this._groups,X=Q._groups,Y=Z.length,K=X.length,G=Math.min(Y,K),q=Array(Y),z=0;z<G;++z)for(var U=Z[z],W=X[z],F=U.length,H=q[z]=Array(F),B,M=0;M<F;++M)if(B=U[M]||W[M])H[M]=B;for(;z<Y;++z)q[z]=Z[z];return new lZ(q,this._parents)}function wI0(){for(var J=this._groups,Q=-1,Z=J.length;++Q<Z;)for(var X=J[Q],Y=X.length-1,K=X[Y],G;--Y>=0;)if(G=X[Y]){if(K&&G.compareDocumentPosition(K)^4)K.parentNode.insertBefore(G,K);K=G}return this}function RI0(J){if(!J)J=OI0;function Q(F,H){return F&&H?J(F.__data__,H.__data__):!F-!H}D(Q,"compareNode");for(var Z=this._groups,X=Z.length,Y=Array(X),K=0;K<X;++K){for(var G=Z[K],q=G.length,z=Y[K]=Array(q),U,W=0;W<q;++W)if(U=G[W])z[W]=U;z.sort(Q)}return new lZ(Y,this._parents).order()}function OI0(J,Q){return J<Q?-1:J>Q?1:J>=Q?0:NaN}function jI0(){var J=arguments[0];return arguments[0]=this,J.apply(null,arguments),this}function $I0(){return Array.from(this)}function EI0(){for(var J=this._groups,Q=0,Z=J.length;Q<Z;++Q)for(var X=J[Q],Y=0,K=X.length;Y<K;++Y){var G=X[Y];if(G)return G}return null}function II0(){let J=0;for(let Q of this)++J;return J}function PI0(){return!this.node()}function TI0(J){for(var Q=this._groups,Z=0,X=Q.length;Z<X;++Z)for(var Y=Q[Z],K=0,G=Y.length,q;K<G;++K)if(q=Y[K])J.call(q,q.__data__,K,Y);return this}function sf(J){var Q=J+="",Z=Q.indexOf(":");if(Z>=0&&(Q=J.slice(0,Z))!=="xmlns")J=J.slice(Z+1);return t$0.hasOwnProperty(Q)?{space:t$0[Q],local:J}:J}function CI0(J){return function(){this.removeAttribute(J)}}function SI0(J){return function(){this.removeAttributeNS(J.space,J.local)}}function vI0(J,Q){return function(){this.setAttribute(J,Q)}}function kI0(J,Q){return function(){this.setAttributeNS(J.space,J.local,Q)}}function _I0(J,Q){return function(){var Z=Q.apply(this,arguments);if(Z==null)this.removeAttribute(J);else this.setAttribute(J,Z)}}function xI0(J,Q){return function(){var Z=Q.apply(this,arguments);if(Z==null)this.removeAttributeNS(J.space,J.local);else this.setAttributeNS(J.space,J.local,Z)}}function bI0(J,Q){var Z=sf(J);if(arguments.length<2){var X=this.node();return Z.local?X.getAttributeNS(Z.space,Z.local):X.getAttribute(Z)}return this.each((Q==null?Z.local?SI0:CI0:typeof Q==="function"?Z.local?xI0:_I0:Z.local?kI0:vI0)(Z,Q))}function Z$1(J){return J.ownerDocument&&J.ownerDocument.defaultView||J.document&&J||J.defaultView}function yI0(J){return function(){this.style.removeProperty(J)}}function fI0(J,Q,Z){return function(){this.style.setProperty(J,Q,Z)}}function hI0(J,Q,Z){return function(){var X=Q.apply(this,arguments);if(X==null)this.style.removeProperty(J);else this.style.setProperty(J,X,Z)}}function gI0(J,Q,Z){return arguments.length>1?this.each((Q==null?yI0:typeof Q==="function"?hI0:fI0)(J,Q,Z==null?"":Z)):$A(this.node(),J)}function $A(J,Q){return J.style.getPropertyValue(Q)||Z$1(J).getComputedStyle(J,null).getPropertyValue(Q)}function mI0(J){return function(){delete this[J]}}function uI0(J,Q){return function(){this[J]=Q}}function pI0(J,Q){return function(){var Z=Q.apply(this,arguments);if(Z==null)delete this[J];else this[J]=Z}}function dI0(J,Q){return arguments.length>1?this.each((Q==null?mI0:typeof Q==="function"?pI0:uI0)(J,Q)):this.node()[J]}function X$1(J){return J.trim().split(/^|\s+/)}function l01(J){return J.classList||new Y$1(J)}function Y$1(J){this._node=J,this._names=X$1(J.getAttribute("class")||"")}function K$1(J,Q){var Z=l01(J),X=-1,Y=Q.length;while(++X<Y)Z.add(Q[X])}function G$1(J,Q){var Z=l01(J),X=-1,Y=Q.length;while(++X<Y)Z.remove(Q[X])}function cI0(J){return function(){K$1(this,J)}}function lI0(J){return function(){G$1(this,J)}}function iI0(J,Q){return function(){(Q.apply(this,arguments)?K$1:G$1)(this,J)}}function nI0(J,Q){var Z=X$1(J+"");if(arguments.length<2){var X=l01(this.node()),Y=-1,K=Z.length;while(++Y<K)if(!X.contains(Z[Y]))return!1;return!0}return this.each((typeof Q==="function"?iI0:Q?cI0:lI0)(Z,Q))}function aI0(){this.textContent=""}function rI0(J){return function(){this.textContent=J}}function sI0(J){return function(){var Q=J.apply(this,arguments);this.textContent=Q==null?"":Q}}function oI0(J){return arguments.length?this.each(J==null?aI0:(typeof J==="function"?sI0:rI0)(J)):this.node().textContent}function tI0(){this.innerHTML=""}function eI0(J){return function(){this.innerHTML=J}}function JP0(J){return function(){var Q=J.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function QP0(J){return arguments.length?this.each(J==null?tI0:(typeof J==="function"?JP0:eI0)(J)):this.node().innerHTML}function ZP0(){if(this.nextSibling)this.parentNode.appendChild(this)}function XP0(){return this.each(ZP0)}function YP0(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KP0(){return this.each(YP0)}function GP0(J){return function(){var Q=this.ownerDocument,Z=this.namespaceURI;return Z===Zj1&&Q.documentElement.namespaceURI===Zj1?Q.createElement(J):Q.createElementNS(Z,J)}}function qP0(J){return function(){return this.ownerDocument.createElementNS(J.space,J.local)}}function q$1(J){var Q=sf(J);return(Q.local?qP0:GP0)(Q)}function zP0(J){var Q=typeof J==="function"?J:q$1(J);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function UP0(){return null}function WP0(J,Q){var Z=typeof J==="function"?J:q$1(J),X=Q==null?UP0:typeof Q==="function"?Q:c01(Q);return this.select(function(){return this.insertBefore(Z.apply(this,arguments),X.apply(this,arguments)||null)})}function FP0(){var J=this.parentNode;if(J)J.removeChild(this)}function HP0(){return this.each(FP0)}function BP0(){var J=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(J,this.nextSibling):J}function DP0(){var J=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(J,this.nextSibling):J}function MP0(J){return this.select(J?DP0:BP0)}function VP0(J){return arguments.length?this.property("__data__",J):this.node().__data__}function NP0(J){return function(Q){J.call(this,Q,this.__data__)}}function LP0(J){return J.trim().split(/^|\s+/).map(function(Q){var Z="",X=Q.indexOf(".");if(X>=0)Z=Q.slice(X+1),Q=Q.slice(0,X);return{type:Q,name:Z}})}function AP0(J){return function(){var Q=this.__on;if(!Q)return;for(var Z=0,X=-1,Y=Q.length,K;Z<Y;++Z)if(K=Q[Z],(!J.type||K.type===J.type)&&K.name===J.name)this.removeEventListener(K.type,K.listener,K.options);else Q[++X]=K;if(++X)Q.length=X;else delete this.__on}}function wP0(J,Q,Z){return function(){var X=this.__on,Y,K=NP0(Q);if(X){for(var G=0,q=X.length;G<q;++G)if((Y=X[G]).type===J.type&&Y.name===J.name){this.removeEventListener(Y.type,Y.listener,Y.options),this.addEventListener(Y.type,Y.listener=K,Y.options=Z),Y.value=Q;return}}if(this.addEventListener(J.type,K,Z),Y={type:J.type,name:J.name,value:Q,listener:K,options:Z},!X)this.__on=[Y];else X.push(Y)}}function RP0(J,Q,Z){var X=LP0(J+""),Y,K=X.length,G;if(arguments.length<2){var q=this.node().__on;if(q){for(var z=0,U=q.length,W;z<U;++z)for(Y=0,W=q[z];Y<K;++Y)if((G=X[Y]).type===W.type&&G.name===W.name)return W.value}return}q=Q?wP0:AP0;for(Y=0;Y<K;++Y)this.each(q(X[Y],Q,Z));return this}function z$1(J,Q,Z){var X=Z$1(J),Y=X.CustomEvent;if(typeof Y==="function")Y=new Y(Q,Z);else if(Y=X.document.createEvent("Event"),Z)Y.initEvent(Q,Z.bubbles,Z.cancelable),Y.detail=Z.detail;else Y.initEvent(Q,!1,!1);J.dispatchEvent(Y)}function OP0(J,Q){return function(){return z$1(this,J,Q)}}function jP0(J,Q){return function(){return z$1(this,J,Q.apply(this,arguments))}}function $P0(J,Q){return this.each((typeof Q==="function"?jP0:OP0)(J,Q))}function*EP0(){for(var J=this._groups,Q=0,Z=J.length;Q<Z;++Q)for(var X=J[Q],Y=0,K=X.length,G;Y<K;++Y)if(G=X[Y])yield G}function lZ(J,Q){this._groups=J,this._parents=Q}function U$1(){return new lZ([[document.documentElement]],IP0)}function PP0(){return this}function B0(J){return typeof J==="string"?new lZ([[document.querySelector(J)]],[document.documentElement]):new lZ([[J]],IP0)}function xI(J,Q,Z){J.prototype=Q.prototype=Z,Z.constructor=J}function tf(J,Q){var Z=Object.create(J.prototype);for(var X in Q)Z[X]=Q[X];return Z}function yM(){}function Xj1(){return this.rgb().formatHex()}function TP0(){return this.rgb().formatHex8()}function CP0(){return F$1(this).formatHsl()}function Yj1(){return this.rgb().formatRgb()}function kM(J){var Q,Z;return J=(J+"").trim().toLowerCase(),(Q=LA8.exec(J))?(Z=Q[1].length,Q=parseInt(Q[1],16),Z===6?Kj1(Q):Z===3?new MJ(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):Z===8?Rf(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):Z===4?Rf(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|Q&240,((Q&15)<<4|Q&15)/255):null):(Q=AA8.exec(J))?new MJ(Q[1],Q[2],Q[3],1):(Q=wA8.exec(J))?new MJ(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=RA8.exec(J))?Rf(Q[1],Q[2],Q[3],Q[4]):(Q=OA8.exec(J))?Rf(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=jA8.exec(J))?zj1(Q[1],Q[2]/100,Q[3]/100,1):(Q=$A8.exec(J))?zj1(Q[1],Q[2]/100,Q[3]/100,Q[4]):e$0.hasOwnProperty(J)?Kj1(e$0[J]):J==="transparent"?new MJ(NaN,NaN,NaN,0):null}function Kj1(J){return new MJ(J>>16&255,J>>8&255,J&255,1)}function Rf(J,Q,Z,X){if(X<=0)J=Q=Z=NaN;return new MJ(J,Q,Z,X)}function W$1(J){if(!(J instanceof yM))J=kM(J);if(!J)return new MJ;return J=J.rgb(),new MJ(J.r,J.g,J.b,J.opacity)}function bf(J,Q,Z,X){return arguments.length===1?W$1(J):new MJ(J,Q,Z,X==null?1:X)}function MJ(J,Q,Z,X){this.r=+J,this.g=+Q,this.b=+Z,this.opacity=+X}function Gj1(){return`#${SM(this.r)}${SM(this.g)}${SM(this.b)}`}function SP0(){return`#${SM(this.r)}${SM(this.g)}${SM(this.b)}${SM((isNaN(this.opacity)?1:this.opacity)*255)}`}function qj1(){let J=yf(this.opacity);return`${J===1?"rgb(":"rgba("}${vM(this.r)}, ${vM(this.g)}, ${vM(this.b)}${J===1?")":`, ${J})`}`}function yf(J){return isNaN(J)?1:Math.max(0,Math.min(1,J))}function vM(J){return Math.max(0,Math.min(255,Math.round(J)||0))}function SM(J){return J=vM(J),(J<16?"0":"")+J.toString(16)}function zj1(J,Q,Z,X){if(X<=0)J=Q=Z=NaN;else if(Z<=0||Z>=1)J=Q=NaN;else if(Q<=0)J=NaN;return new UK(J,Q,Z,X)}function F$1(J){if(J instanceof UK)return new UK(J.h,J.s,J.l,J.opacity);if(!(J instanceof yM))J=kM(J);if(!J)return new UK;if(J instanceof UK)return J;J=J.rgb();var Q=J.r/255,Z=J.g/255,X=J.b/255,Y=Math.min(Q,Z,X),K=Math.max(Q,Z,X),G=NaN,q=K-Y,z=(K+Y)/2;if(q){if(Q===K)G=(Z-X)/q+(Z<X)*6;else if(Z===K)G=(X-Q)/q+2;else G=(Q-Z)/q+4;q/=z<0.5?K+Y:2-K-Y,G*=60}else q=z>0&&z<1?0:G;return new UK(G,q,z,J.opacity)}function vP0(J,Q,Z,X){return arguments.length===1?F$1(J):new UK(J,Q,Z,X==null?1:X)}function UK(J,Q,Z,X){this.h=+J,this.s=+Q,this.l=+Z,this.opacity=+X}function Uj1(J){return J=(J||0)%360,J<0?J+360:J}function Of(J){return Math.max(0,Math.min(1,J||0))}function U01(J,Q,Z){return(J<60?Q+(Z-Q)*J/60:J<180?Z:J<240?Q+(Z-Q)*(240-J)/60:Q)*255}function H$1(J){if(J instanceof zq)return new zq(J.l,J.a,J.b,J.opacity);if(J instanceof UU)return B$1(J);if(!(J instanceof MJ))J=W$1(J);var Q=B01(J.r),Z=B01(J.g),X=B01(J.b),Y=W01((0.2225045*Q+0.7168786*Z+0.0606169*X)/_P0),K,G;if(Q===Z&&Z===X)K=G=Y;else K=W01((0.4360747*Q+0.3850649*Z+0.1430804*X)/kP0),G=W01((0.0139322*Q+0.0971045*Z+0.7141733*X)/xP0);return new zq(116*Y-16,500*(K-Y),200*(Y-G),J.opacity)}function fP0(J,Q,Z,X){return arguments.length===1?H$1(J):new zq(J,Q,Z,X==null?1:X)}function zq(J,Q,Z,X){this.l=+J,this.a=+Q,this.b=+Z,this.opacity=+X}function W01(J){return J>PA8?Math.pow(J,0.3333333333333333):J/yP0+bP0}function F01(J){return J>II?J*J*J:yP0*(J-bP0)}function H01(J){return 255*(J<=0.0031308?12.92*J:1.055*Math.pow(J,0.4166666666666667)-0.055)}function B01(J){return(J/=255)<=0.04045?J/12.92:Math.pow((J+0.055)/1.055,2.4)}function hP0(J){if(J instanceof UU)return new UU(J.h,J.c,J.l,J.opacity);if(!(J instanceof zq))J=H$1(J);if(J.a===0&&J.b===0)return new UU(NaN,0<J.l&&J.l<100?0:NaN,J.l,J.opacity);var Q=Math.atan2(J.b,J.a)*IA8;return new UU(Q<0?Q+360:Q,Math.sqrt(J.a*J.a+J.b*J.b),J.l,J.opacity)}function E01(J,Q,Z,X){return arguments.length===1?hP0(J):new UU(J,Q,Z,X==null?1:X)}function UU(J,Q,Z,X){this.h=+J,this.c=+Q,this.l=+Z,this.opacity=+X}function B$1(J){if(isNaN(J.h))return new zq(J.l,0,0,J.opacity);var Q=J.h*EA8;return new zq(J.l,Math.cos(Q)*J.c,Math.sin(Q)*J.c,J.opacity)}function D$1(J,Q){return function(Z){return J+Z*Q}}function gP0(J,Q,Z){return J=Math.pow(J,Z),Q=Math.pow(Q,Z)-J,Z=1/Z,function(X){return Math.pow(J+X*Q,Z)}}function mP0(J,Q){var Z=Q-J;return Z?D$1(J,Z>180||Z<-180?Z-360*Math.round(Z/360):Z):i01(isNaN(J)?Q:J)}function uP0(J){return(J=+J)===1?RA:function(Q,Z){return Z-Q?gP0(Q,Z,J):i01(isNaN(Q)?Z:Q)}}function RA(J,Q){var Z=Q-J;return Z?D$1(J,Z):i01(isNaN(J)?Q:J)}function M$1(J){return function(Q,Z){var X=J((Q=E01(Q)).h,(Z=E01(Z)).h),Y=RA(Q.c,Z.c),K=RA(Q.l,Z.l),G=RA(Q.opacity,Z.opacity);return function(q){return Q.h=X(q),Q.c=Y(q),Q.l=K(q),Q.opacity=G(q),Q+""}}}function V$1(J,Q,Z,X,Y){var K=J*J,G=K*J;return((1-3*J+3*K-G)*Q+(4-6*K+3*G)*Z+(1+3*J+3*K-3*G)*X+G*Y)/6}function dP0(J){var Q=J.length-1;return function(Z){var X=Z<=0?Z=0:Z>=1?(Z=1,Q-1):Math.floor(Z*Q),Y=J[X],K=J[X+1],G=X>0?J[X-1]:2*Y-K,q=X<Q-1?J[X+2]:2*K-Y;return V$1((Z-X/Q)*Q,G,Y,K,q)}}function cP0(J){var Q=J.length;return function(Z){var X=Math.floor(((Z%=1)<0?++Z:Z)*Q),Y=J[(X+Q-1)%Q],K=J[X%Q],G=J[(X+1)%Q],q=J[(X+2)%Q];return V$1((Z-X/Q)*Q,Y,K,G,q)}}function N$1(J){return function(Q){var Z=Q.length,X=Array(Z),Y=Array(Z),K=Array(Z),G,q;for(G=0;G<Z;++G)q=bf(Q[G]),X[G]=q.r||0,Y[G]=q.g||0,K[G]=q.b||0;return X=J(X),Y=J(Y),K=J(K),q.opacity=1,function(z){return q.r=X(z),q.g=Y(z),q.b=K(z),q+""}}}function lP0(J,Q){if(!Q)Q=[];var Z=J?Math.min(Q.length,J.length):0,X=Q.slice(),Y;return function(K){for(Y=0;Y<Z;++Y)X[Y]=J[Y]*(1-K)+Q[Y]*K;return X}}function iP0(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function nP0(J,Q){var Z=Q?Q.length:0,X=J?Math.min(Z,J.length):0,Y=Array(X),K=Array(Z),G;for(G=0;G<X;++G)Y[G]=n01(J[G],Q[G]);for(;G<Z;++G)K[G]=Q[G];return function(q){for(G=0;G<X;++G)K[G]=Y[G](q);return K}}function aP0(J,Q){var Z=new Date;return J=+J,Q=+Q,function(X){return Z.setTime(J*(1-X)+Q*X),Z}}function zK(J,Q){return J=+J,Q=+Q,function(Z){return J*(1-Z)+Q*Z}}function rP0(J,Q){var Z={},X={},Y;if(J===null||typeof J!=="object")J={};if(Q===null||typeof Q!=="object")Q={};for(Y in Q)if(Y in J)Z[Y]=n01(J[Y],Q[Y]);else X[Y]=Q[Y];return function(K){for(Y in Z)X[Y]=Z[Y](K);return X}}function sP0(J){return function(){return J}}function oP0(J){return function(Q){return J(Q)+""}}function L$1(J,Q){var Z=Wj1.lastIndex=cO1.lastIndex=0,X,Y,K,G=-1,q=[],z=[];J=J+"",Q=Q+"";while((X=Wj1.exec(J))&&(Y=cO1.exec(Q))){if((K=Y.index)>Z)if(K=Q.slice(Z,K),q[G])q[G]+=K;else q[++G]=K;if((X=X[0])===(Y=Y[0]))if(q[G])q[G]+=Y;else q[++G]=Y;else q[++G]=null,z.push({i:G,x:zK(X,Y)});Z=cO1.lastIndex}if(Z<Q.length)if(K=Q.slice(Z),q[G])q[G]+=K;else q[++G]=K;return q.length<2?z[0]?oP0(z[0].x):sP0(Q):(Q=z.length,function(U){for(var W=0,F;W<Q;++W)q[(F=z[W]).i]=F.x(U);return q.join("")})}function n01(J,Q){var Z=typeof Q,X;return Q==null||Z==="boolean"?i01(Q):(Z==="number"?zK:Z==="string"?(X=kM(Q))?(Q=X,I01):L$1:Q instanceof kM?I01:Q instanceof Date?aP0:iP0(Q)?lP0:Array.isArray(Q)?nP0:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?rP0:zK)(J,Q)}function tP0(J,Q){return J=+J,Q=+Q,function(Z){return Math.round(J*(1-Z)+Q*Z)}}function A$1(J,Q,Z,X,Y,K){var G,q,z;if(G=Math.sqrt(J*J+Q*Q))J/=G,Q/=G;if(z=J*Z+Q*X)Z-=J*z,X-=Q*z;if(q=Math.sqrt(Z*Z+X*X))Z/=q,X/=q,z/=q;if(J*X<Q*Z)J=-J,Q=-Q,z=-z,G=-G;return{translateX:Y,translateY:K,rotate:Math.atan2(Q,J)*JE0,skewX:Math.atan(z)*JE0,scaleX:G,scaleY:q}}function eP0(J){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(J+"");return Q.isIdentity?Fj1:A$1(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function JT0(J){if(J==null)return Fj1;if(!Q01)Q01=document.createElementNS("http://www.w3.org/2000/svg","g");if(Q01.setAttribute("transform",J),!(J=Q01.transform.baseVal.consolidate()))return Fj1;return J=J.matrix,A$1(J.a,J.b,J.c,J.d,J.e,J.f)}function w$1(J,Q,Z,X){function Y(U){return U.length?U.pop()+" ":""}D(Y,"pop");function K(U,W,F,H,B,M){if(U!==F||W!==H){var V=B.push("translate(",null,Q,null,Z);M.push({i:V-4,x:zK(U,F)},{i:V-2,x:zK(W,H)})}else if(F||H)B.push("translate("+F+Q+H+Z)}D(K,"translate");function G(U,W,F,H){if(U!==W){if(U-W>180)W+=360;else if(W-U>180)U+=360;H.push({i:F.push(Y(F)+"rotate(",null,X)-2,x:zK(U,W)})}else if(W)F.push(Y(F)+"rotate("+W+X)}D(G,"rotate");function q(U,W,F,H){if(U!==W)H.push({i:F.push(Y(F)+"skewX(",null,X)-2,x:zK(U,W)});else if(W)F.push(Y(F)+"skewX("+W+X)}D(q,"skewX");function z(U,W,F,H,B,M){if(U!==F||W!==H){var V=B.push(Y(B)+"scale(",null,",",null,")");M.push({i:V-4,x:zK(U,F)},{i:V-2,x:zK(W,H)})}else if(F!==1||H!==1)B.push(Y(B)+"scale("+F+","+H+")")}return D(z,"scale"),function(U,W){var F=[],H=[];return U=J(U),W=J(W),K(U.translateX,U.translateY,W.translateX,W.translateY,F,H),G(U.rotate,W.rotate,F,H),q(U.skewX,W.skewX,F,H),z(U.scaleX,U.scaleY,W.scaleX,W.scaleY,F,H),U=W=null,function(B){var M=-1,V=H.length,N;while(++M<V)F[(N=H[M]).i]=N.x(B);return F.join("")}}}function ef(J,Q){switch(arguments.length){case 0:break;case 1:this.range(J);break;default:this.range(Q).domain(J);break}return this}function vA(){var J=new s$0,Q=[],Z=[],X=QE0;function Y(K){let G=J.get(K);if(G===void 0){if(X!==QE0)return X;J.set(K,G=Q.push(K)-1)}return Z[G%Z.length]}return D(Y,"scale"),Y.domain=function(K){if(!arguments.length)return Q.slice();Q=[],J=new s$0;for(let G of K){if(J.has(G))continue;J.set(G,Q.push(G)-1)}return Y},Y.range=function(K){return arguments.length?(Z=Array.from(K),Y):Z.slice()},Y.unknown=function(K){return arguments.length?(X=K,Y):X},Y.copy=function(){return vA(Q,Z).unknown(X)},ef.apply(Y,arguments),Y}function QT0(J){return function(){return J}}function ZT0(J){return+J}function AA(J){return J}function P01(J,Q){return(Q-=J=+J)?function(Z){return(Z-J)/Q}:QT0(isNaN(Q)?NaN:0.5)}function XT0(J,Q){var Z;if(J>Q)Z=J,J=Q,Q=Z;return function(X){return Math.max(J,Math.min(Q,X))}}function YT0(J,Q,Z){var X=J[0],Y=J[1],K=Q[0],G=Q[1];if(Y<X)X=P01(Y,X),K=Z(G,K);else X=P01(X,Y),K=Z(K,G);return function(q){return K(X(q))}}function KT0(J,Q,Z){var X=Math.min(J.length,Q.length)-1,Y=Array(X),K=Array(X),G=-1;if(J[X]<J[0])J=J.slice().reverse(),Q=Q.slice().reverse();while(++G<X)Y[G]=P01(J[G],J[G+1]),K[G]=Z(Q[G],Q[G+1]);return function(q){var z=HA8(J,q,1,X)-1;return K[z](Y[z](q))}}function R$1(J,Q){return Q.domain(J.domain()).range(J.range()).interpolate(J.interpolate()).clamp(J.clamp()).unknown(J.unknown())}function GT0(){var J=ZE0,Q=ZE0,Z=n01,X,Y,K,G=AA,q,z,U;function W(){var H=Math.min(J.length,Q.length);if(G!==AA)G=XT0(J[0],J[H-1]);return q=H>2?KT0:YT0,z=U=null,F}D(W,"rescale");function F(H){return H==null||isNaN(H=+H)?K:(z||(z=q(J.map(X),Q,Z)))(X(G(H)))}return D(F,"scale"),F.invert=function(H){return G(Y((U||(U=q(Q,J.map(X),zK)))(H)))},F.domain=function(H){return arguments.length?(J=Array.from(H,ZT0),W()):J.slice()},F.range=function(H){return arguments.length?(Q=Array.from(H),W()):Q.slice()},F.rangeRound=function(H){return Q=Array.from(H),Z=tP0,W()},F.clamp=function(H){return arguments.length?(G=H?!0:AA,W()):G!==AA},F.interpolate=function(H){return arguments.length?(Z=H,W()):Z},F.unknown=function(H){return arguments.length?(K=H,F):K},function(H,B){return X=H,Y=B,W()}}function O$1(){return GT0()(AA,AA)}function qT0(J){return Math.abs(J=Math.round(J))>=1000000000000000000000?J.toLocaleString("en").replace(/,/g,""):J.toString(10)}function ff(J,Q){if((Z=(J=Q?J.toExponential(Q-1):J.toExponential()).indexOf("e"))<0)return null;var Z,X=J.slice(0,Z);return[X.length>1?X[0]+X.slice(2):X,+J.slice(Z+1)]}function EA(J){return J=ff(Math.abs(J)),J?J[1]:NaN}function zT0(J,Q){return function(Z,X){var Y=Z.length,K=[],G=0,q=J[0],z=0;while(Y>0&&q>0){if(z+q+1>X)q=Math.max(1,X-z);if(K.push(Z.substring(Y-=q,Y+q)),(z+=q+1)>X)break;q=J[G=(G+1)%J.length]}return K.reverse().join(Q)}}function UT0(J){return function(Q){return Q.replace(/[0-9]/g,function(Z){return J[+Z]})}}function hf(J){if(!(Q=SA8.exec(J)))throw Error("invalid format: "+J);var Q;return new a01({fill:Q[1],align:Q[2],sign:Q[3],symbol:Q[4],zero:Q[5],width:Q[6],comma:Q[7],precision:Q[8]&&Q[8].slice(1),trim:Q[9],type:Q[10]})}function a01(J){this.fill=J.fill===void 0?" ":J.fill+"",this.align=J.align===void 0?">":J.align+"",this.sign=J.sign===void 0?"-":J.sign+"",this.symbol=J.symbol===void 0?"":J.symbol+"",this.zero=!!J.zero,this.width=J.width===void 0?void 0:+J.width,this.comma=!!J.comma,this.precision=J.precision===void 0?void 0:+J.precision,this.trim=!!J.trim,this.type=J.type===void 0?"":J.type+""}function WT0(J){J:for(var Q=J.length,Z=1,X=-1,Y;Z<Q;++Z)switch(J[Z]){case".":X=Y=Z;break;case"0":if(X===0)X=Z;Y=Z;break;default:if(!+J[Z])break J;if(X>0)X=0;break}return X>0?J.slice(0,X)+J.slice(Y+1):J}function HT0(J,Q){var Z=ff(J,Q);if(!Z)return J+"";var X=Z[0],Y=Z[1],K=Y-(FT0=Math.max(-8,Math.min(8,Math.floor(Y/3)))*3)+1,G=X.length;return K===G?X:K>G?X+Array(K-G+1).join("0"):K>0?X.slice(0,K)+"."+X.slice(K):"0."+Array(1-K).join("0")+ff(J,Math.max(0,Q+K-1))[0]}function Hj1(J,Q){var Z=ff(J,Q);if(!Z)return J+"";var X=Z[0],Y=Z[1];return Y<0?"0."+Array(-Y).join("0")+X:X.length>Y+1?X.slice(0,Y+1)+"."+X.slice(Y+1):X+Array(Y-X.length+2).join("0")}function Bj1(J){return J}function BT0(J){var Q=J.grouping===void 0||J.thousands===void 0?Bj1:zT0(YE0.call(J.grouping,Number),J.thousands+""),Z=J.currency===void 0?"":J.currency[0]+"",X=J.currency===void 0?"":J.currency[1]+"",Y=J.decimal===void 0?".":J.decimal+"",K=J.numerals===void 0?Bj1:UT0(YE0.call(J.numerals,String)),G=J.percent===void 0?"%":J.percent+"",q=J.minus===void 0?"−":J.minus+"",z=J.nan===void 0?"NaN":J.nan+"";function U(F){F=hf(F);var{fill:H,align:B,sign:M,symbol:V,zero:N,width:L,comma:A,precision:w,trim:R,type:O}=F;if(O==="n")A=!0,O="g";else if(!XE0[O])w===void 0&&(w=12),R=!0,O="g";if(N||H==="0"&&B==="=")N=!0,H="0",B="=";var j=V==="$"?Z:V==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():"",$=V==="$"?X:/[%p]/.test(O)?G:"",E=XE0[O],I=/[defgprs%]/.test(O);w=w===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function T(S){var x=j,h=$,v,_,b;if(O==="c")h=E(S)+h,S="";else{S=+S;var g=S<0||1/S<0;if(S=isNaN(S)?z:E(Math.abs(S),w),R)S=WT0(S);if(g&&+S===0&&M!=="+")g=!1;if(x=(g?M==="("?M:q:M==="-"||M==="("?"":M)+x,h=(O==="s"?KE0[8+FT0/3]:"")+h+(g&&M==="("?")":""),I){v=-1,_=S.length;while(++v<_)if(b=S.charCodeAt(v),48>b||b>57){h=(b===46?Y+S.slice(v+1):S.slice(v))+h,S=S.slice(0,v);break}}}if(A&&!N)S=Q(S,1/0);var k=x.length+S.length+h.length,y=k<L?Array(L-k+1).join(H):"";if(A&&N)S=Q(y+S,y.length?L-h.length:1/0),y="";switch(B){case"<":S=x+S+h+y;break;case"=":S=x+y+S+h;break;case"^":S=y.slice(0,k=y.length>>1)+x+S+h+y.slice(k);break;default:S=y+x+S+h;break}return K(S)}return D(T,"format"),T.toString=function(){return F+""},T}D(U,"newFormat");function W(F,H){var B=U((F=hf(F),F.type="f",F)),M=Math.max(-8,Math.min(8,Math.floor(EA(H)/3)))*3,V=Math.pow(10,-M),N=KE0[8+M/3];return function(L){return B(V*L)+N}}return D(W,"formatPrefix"),{format:U,formatPrefix:W}}function VT0(J){return Z01=BT0(J),DT0=Z01.format,MT0=Z01.formatPrefix,Z01}function NT0(J){return Math.max(0,-EA(Math.abs(J)))}function LT0(J,Q){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(EA(Q)/3)))*3-EA(Math.abs(J)))}function AT0(J,Q){return J=Math.abs(J),Q=Math.abs(Q)-J,Math.max(0,EA(Q)-EA(J))+1}function wT0(J,Q,Z,X){var Y=O01(J,Q,Z),K;switch(X=hf(X==null?",f":X),X.type){case"s":{var G=Math.max(Math.abs(J),Math.abs(Q));if(X.precision==null&&!isNaN(K=LT0(Y,G)))X.precision=K;return MT0(X,G)}case"":case"e":case"g":case"p":case"r":{if(X.precision==null&&!isNaN(K=AT0(Y,Math.max(Math.abs(J),Math.abs(Q)))))X.precision=K-(X.type==="e");break}case"f":case"%":{if(X.precision==null&&!isNaN(K=NT0(Y)))X.precision=K-(X.type==="%")*2;break}}return DT0(X)}function RT0(J){var Q=J.domain;return J.ticks=function(Z){var X=Q();return dE0(X[0],X[X.length-1],Z==null?10:Z)},J.tickFormat=function(Z,X){var Y=Q();return wT0(Y[0],Y[Y.length-1],Z==null?10:Z,X)},J.nice=function(Z){if(Z==null)Z=10;var X=Q(),Y=0,K=X.length-1,G=X[Y],q=X[K],z,U,W=10;if(q<G)U=G,G=q,q=U,U=Y,Y=K,K=U;while(W-- >0){if(U=R01(G,q,Z),U===z)return X[Y]=G,X[K]=q,Q(X);else if(U>0)G=Math.floor(G/U)*U,q=Math.ceil(q/U)*U;else if(U<0)G=Math.ceil(G*U)/U,q=Math.floor(q*U)/U;else break;z=U}return J},J}function DU(){var J=O$1();return J.copy=function(){return R$1(J,DU())},ef.apply(J,arguments),RT0(J)}function g7(J,Q,Z,X){function Y(K){return J(K=arguments.length===0?new Date:new Date(+K)),K}if(D(Y,"interval"),Y.floor=(K)=>{return J(K=new Date(+K)),K},Y.ceil=(K)=>{return J(K=new Date(K-1)),Q(K,1),J(K),K},Y.round=(K)=>{let G=Y(K),q=Y.ceil(K);return K-G<q-K?G:q},Y.offset=(K,G)=>{return Q(K=new Date(+K),G==null?1:Math.floor(G)),K},Y.range=(K,G,q)=>{let z=[];if(K=Y.ceil(K),q=q==null?1:Math.floor(q),!(K<G)||!(q>0))return z;let U;do z.push(U=new Date(+K)),Q(K,q),J(K);while(U<K&&K<G);return z},Y.filter=(K)=>{return g7((G)=>{if(G>=G)while(J(G),!K(G))G.setTime(G-1)},(G,q)=>{if(G>=G)if(q<0)while(++q<=0)while(Q(G,-1),!K(G));else while(--q>=0)while(Q(G,1),!K(G));})},Z)Y.count=(K,G)=>{return lO1.setTime(+K),iO1.setTime(+G),J(lO1),J(iO1),Math.floor(Z(lO1,iO1))},Y.every=(K)=>{return K=Math.floor(K),!isFinite(K)||!(K>0)?null:!(K>1)?Y:Y.filter(X?(G)=>X(G)%K===0:(G)=>Y.count(0,G)%K===0)};return Y}function hM(J){return g7((Q)=>{Q.setDate(Q.getDate()-(Q.getDay()+7-J)%7),Q.setHours(0,0,0,0)},(Q,Z)=>{Q.setDate(Q.getDate()+Z*7)},(Q,Z)=>{return(Z-Q-(Z.getTimezoneOffset()-Q.getTimezoneOffset())*WK)/j$1})}function gM(J){return g7((Q)=>{Q.setUTCDate(Q.getUTCDate()-(Q.getUTCDay()+7-J)%7),Q.setUTCHours(0,0,0,0)},(Q,Z)=>{Q.setUTCDate(Q.getUTCDate()+Z*7)},(Q,Z)=>{return(Z-Q)/j$1})}function S$1(J,Q,Z,X,Y,K){let G=[[QH,1,eF],[QH,5,5*eF],[QH,15,15*eF],[QH,30,30*eF],[K,1,WK],[K,5,5*WK],[K,15,15*WK],[K,30,30*WK],[Y,1,JH],[Y,3,3*JH],[Y,6,6*JH],[Y,12,12*JH],[X,1,ZH],[X,2,2*ZH],[Z,1,j$1],[Q,1,GE0],[Q,3,3*GE0],[J,1,nO1]];function q(U,W,F){let H=W<U;if(H)[U,W]=[W,U];let B=F&&typeof F.range==="function"?F:z(U,W,F),M=B?B.range(U,+W+1):[];return H?M.reverse():M}D(q,"ticks");function z(U,W,F){let H=Math.abs(W-U)/F,B=d01(([,,N])=>N).right(G,H);if(B===G.length)return J.every(O01(U/nO1,W/nO1,F));if(B===0)return IA.every(Math.max(O01(U,W,F),1));let[M,V]=G[H/G[B-1][2]<G[B][2]/H?B-1:B];return M.every(V)}return D(z,"tickInterval"),[q,z]}function D01(J){if(0<=J.y&&J.y<100){var Q=new Date(-1,J.m,J.d,J.H,J.M,J.S,J.L);return Q.setFullYear(J.y),Q}return new Date(J.y,J.m,J.d,J.H,J.M,J.S,J.L)}function M01(J){if(0<=J.y&&J.y<100){var Q=new Date(Date.UTC(-1,J.m,J.d,J.H,J.M,J.S,J.L));return Q.setUTCFullYear(J.y),Q}return new Date(Date.UTC(J.y,J.m,J.d,J.H,J.M,J.S,J.L))}function RI(J,Q,Z){return{y:J,m:Q,d:Z,H:0,M:0,S:0,L:0}}function IT0(J){var{dateTime:Q,date:Z,time:X,periods:Y,days:K,shortDays:G,months:q,shortMonths:z}=J,U=OI(Y),W=jI(Y),F=OI(K),H=jI(K),B=OI(G),M=jI(G),V=OI(q),N=jI(q),L=OI(z),A=jI(z),w={a:g,A:k,b:y,B:f,c:null,d:Lj1,e:Lj1,f:nT0,g:XC0,G:KC0,H:cT0,I:lT0,j:iT0,L:v$1,m:aT0,M:rT0,p:m,q:n,Q:Rj1,s:Oj1,S:sT0,u:oT0,U:tT0,V:eT0,w:JC0,W:QC0,x:null,X:null,y:ZC0,Y:YC0,Z:GC0,"%":wj1},R={a:p,A:e,b:G1,B:U1,c:null,d:Aj1,e:Aj1,f:WC0,g:wC0,G:OC0,H:qC0,I:zC0,j:UC0,L:_$1,m:FC0,M:HC0,p:Z1,q:F1,Q:Rj1,s:Oj1,S:BC0,u:DC0,U:MC0,V:VC0,w:NC0,W:LC0,x:null,X:null,y:AC0,Y:RC0,Z:jC0,"%":wj1},O={a:T,A:S,b:x,B:h,c:v,d:Vj1,e:Vj1,f:mT0,g:Mj1,G:Dj1,H:Nj1,I:Nj1,j:yT0,L:gT0,m:bT0,M:fT0,p:I,q:xT0,Q:pT0,s:dT0,S:hT0,u:CT0,U:ST0,V:vT0,w:TT0,W:kT0,x:_,X:b,y:Mj1,Y:Dj1,Z:_T0,"%":uT0};w.x=j(Z,w),w.X=j(X,w),w.c=j(Q,w),R.x=j(Z,R),R.X=j(X,R),R.c=j(Q,R);function j(l,d){return function(i){var r=[],o=-1,Y1=0,J1=l.length,H1,z1,W1;if(!(i instanceof Date))i=new Date(+i);while(++o<J1)if(l.charCodeAt(o)===37){if(r.push(l.slice(Y1,o)),(z1=qE0[H1=l.charAt(++o)])!=null)H1=l.charAt(++o);else z1=H1==="e"?" ":"0";if(W1=d[H1])H1=W1(i,z1);r.push(H1),Y1=o+1}return r.push(l.slice(Y1,o)),r.join("")}}D(j,"newFormat");function $(l,d){return function(i){var r=RI(1900,void 0,1),o=E(r,l,i+="",0),Y1,J1;if(o!=i.length)return null;if("Q"in r)return new Date(r.Q);if("s"in r)return new Date(r.s*1000+("L"in r?r.L:0));if(d&&!("Z"in r))r.Z=0;if("p"in r)r.H=r.H%12+r.p*12;if(r.m===void 0)r.m="q"in r?r.q:0;if("V"in r){if(r.V<1||r.V>53)return null;if(!("w"in r))r.w=1;if("Z"in r)Y1=M01(RI(r.y,0,1)),J1=Y1.getUTCDay(),Y1=J1>4||J1===0?T01.ceil(Y1):T01(Y1),Y1=$$1.offset(Y1,(r.V-1)*7),r.y=Y1.getUTCFullYear(),r.m=Y1.getUTCMonth(),r.d=Y1.getUTCDate()+(r.w+6)%7;else Y1=D01(RI(r.y,0,1)),J1=Y1.getDay(),Y1=J1>4||J1===0?TI.ceil(Y1):TI(Y1),Y1=fM.offset(Y1,(r.V-1)*7),r.y=Y1.getFullYear(),r.m=Y1.getMonth(),r.d=Y1.getDate()+(r.w+6)%7}else if("W"in r||"U"in r){if(!("w"in r))r.w="u"in r?r.u%7:("W"in r)?1:0;J1="Z"in r?M01(RI(r.y,0,1)).getUTCDay():D01(RI(r.y,0,1)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+r.W*7-(J1+5)%7:r.w+r.U*7-(J1+6)%7}if("Z"in r)return r.H+=r.Z/100|0,r.M+=r.Z%100,M01(r);return D01(r)}}D($,"newParse");function E(l,d,i,r){var o=0,Y1=d.length,J1=i.length,H1,z1;while(o<Y1){if(r>=J1)return-1;if(H1=d.charCodeAt(o++),H1===37){if(H1=d.charAt(o++),z1=O[H1 in qE0?d.charAt(o++):H1],!z1||(r=z1(l,i,r))<0)return-1}else if(H1!=i.charCodeAt(r++))return-1}return r}D(E,"parseSpecifier");function I(l,d,i){var r=U.exec(d.slice(i));return r?(l.p=W.get(r[0].toLowerCase()),i+r[0].length):-1}D(I,"parsePeriod");function T(l,d,i){var r=B.exec(d.slice(i));return r?(l.w=M.get(r[0].toLowerCase()),i+r[0].length):-1}D(T,"parseShortWeekday");function S(l,d,i){var r=F.exec(d.slice(i));return r?(l.w=H.get(r[0].toLowerCase()),i+r[0].length):-1}D(S,"parseWeekday");function x(l,d,i){var r=L.exec(d.slice(i));return r?(l.m=A.get(r[0].toLowerCase()),i+r[0].length):-1}D(x,"parseShortMonth");function h(l,d,i){var r=V.exec(d.slice(i));return r?(l.m=N.get(r[0].toLowerCase()),i+r[0].length):-1}D(h,"parseMonth");function v(l,d,i){return E(l,Q,d,i)}D(v,"parseLocaleDateTime");function _(l,d,i){return E(l,Z,d,i)}D(_,"parseLocaleDate");function b(l,d,i){return E(l,X,d,i)}D(b,"parseLocaleTime");function g(l){return G[l.getDay()]}D(g,"formatShortWeekday");function k(l){return K[l.getDay()]}D(k,"formatWeekday");function y(l){return z[l.getMonth()]}D(y,"formatShortMonth");function f(l){return q[l.getMonth()]}D(f,"formatMonth");function m(l){return Y[+(l.getHours()>=12)]}D(m,"formatPeriod");function n(l){return 1+~~(l.getMonth()/3)}D(n,"formatQuarter");function p(l){return G[l.getUTCDay()]}D(p,"formatUTCShortWeekday");function e(l){return K[l.getUTCDay()]}D(e,"formatUTCWeekday");function G1(l){return z[l.getUTCMonth()]}D(G1,"formatUTCShortMonth");function U1(l){return q[l.getUTCMonth()]}D(U1,"formatUTCMonth");function Z1(l){return Y[+(l.getUTCHours()>=12)]}D(Z1,"formatUTCPeriod");function F1(l){return 1+~~(l.getUTCMonth()/3)}return D(F1,"formatUTCQuarter"),{format:D(function(l){var d=j(l+="",w);return d.toString=function(){return l},d},"format"),parse:D(function(l){var d=$(l+="",!1);return d.toString=function(){return l},d},"parse"),utcFormat:D(function(l){var d=j(l+="",R);return d.toString=function(){return l},d},"utcFormat"),utcParse:D(function(l){var d=$(l+="",!0);return d.toString=function(){return l},d},"utcParse")}}function Q2(J,Q,Z){var X=J<0?"-":"",Y=(X?-J:J)+"",K=Y.length;return X+(K<Z?Array(Z-K+1).join(Q)+Y:Y)}function PT0(J){return J.replace(hA8,"\\$&")}function OI(J){return new RegExp("^(?:"+J.map(PT0).join("|")+")","i")}function jI(J){return new Map(J.map((Q,Z)=>[Q.toLowerCase(),Z]))}function TT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+1));return X?(J.w=+X[0],Z+X[0].length):-1}function CT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+1));return X?(J.u=+X[0],Z+X[0].length):-1}function ST0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.U=+X[0],Z+X[0].length):-1}function vT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.V=+X[0],Z+X[0].length):-1}function kT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.W=+X[0],Z+X[0].length):-1}function Dj1(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+4));return X?(J.y=+X[0],Z+X[0].length):-1}function Mj1(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.y=+X[0]+(+X[0]>68?1900:2000),Z+X[0].length):-1}function _T0(J,Q,Z){var X=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(Q.slice(Z,Z+6));return X?(J.Z=X[1]?0:-(X[2]+(X[3]||"00")),Z+X[0].length):-1}function xT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+1));return X?(J.q=X[0]*3-3,Z+X[0].length):-1}function bT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.m=X[0]-1,Z+X[0].length):-1}function Vj1(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.d=+X[0],Z+X[0].length):-1}function yT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+3));return X?(J.m=0,J.d=+X[0],Z+X[0].length):-1}function Nj1(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.H=+X[0],Z+X[0].length):-1}function fT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.M=+X[0],Z+X[0].length):-1}function hT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+2));return X?(J.S=+X[0],Z+X[0].length):-1}function gT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+3));return X?(J.L=+X[0],Z+X[0].length):-1}function mT0(J,Q,Z){var X=m5.exec(Q.slice(Z,Z+6));return X?(J.L=Math.floor(X[0]/1000),Z+X[0].length):-1}function uT0(J,Q,Z){var X=fA8.exec(Q.slice(Z,Z+1));return X?Z+X[0].length:-1}function pT0(J,Q,Z){var X=m5.exec(Q.slice(Z));return X?(J.Q=+X[0],Z+X[0].length):-1}function dT0(J,Q,Z){var X=m5.exec(Q.slice(Z));return X?(J.s=+X[0],Z+X[0].length):-1}function Lj1(J,Q){return Q2(J.getDate(),Q,2)}function cT0(J,Q){return Q2(J.getHours(),Q,2)}function lT0(J,Q){return Q2(J.getHours()%12||12,Q,2)}function iT0(J,Q){return Q2(1+fM.count(XH(J),J),Q,3)}function v$1(J,Q){return Q2(J.getMilliseconds(),Q,3)}function nT0(J,Q){return v$1(J,Q)+"000"}function aT0(J,Q){return Q2(J.getMonth()+1,Q,2)}function rT0(J,Q){return Q2(J.getMinutes(),Q,2)}function sT0(J,Q){return Q2(J.getSeconds(),Q,2)}function oT0(J){var Q=J.getDay();return Q===0?7:Q}function tT0(J,Q){return Q2(fI.count(XH(J)-1,J),Q,2)}function k$1(J){var Q=J.getDay();return Q>=4||Q===0?_M(J):_M.ceil(J)}function eT0(J,Q){return J=k$1(J),Q2(_M.count(XH(J),J)+(XH(J).getDay()===4),Q,2)}function JC0(J){return J.getDay()}function QC0(J,Q){return Q2(TI.count(XH(J)-1,J),Q,2)}function ZC0(J,Q){return Q2(J.getFullYear()%100,Q,2)}function XC0(J,Q){return J=k$1(J),Q2(J.getFullYear()%100,Q,2)}function YC0(J,Q){return Q2(J.getFullYear()%1e4,Q,4)}function KC0(J,Q){var Z=J.getDay();return J=Z>=4||Z===0?_M(J):_M.ceil(J),Q2(J.getFullYear()%1e4,Q,4)}function GC0(J){var Q=J.getTimezoneOffset();return(Q>0?"-":(Q*=-1,"+"))+Q2(Q/60|0,"0",2)+Q2(Q%60,"0",2)}function Aj1(J,Q){return Q2(J.getUTCDate(),Q,2)}function qC0(J,Q){return Q2(J.getUTCHours(),Q,2)}function zC0(J,Q){return Q2(J.getUTCHours()%12||12,Q,2)}function UC0(J,Q){return Q2(1+$$1.count(xM(J),J),Q,3)}function _$1(J,Q){return Q2(J.getUTCMilliseconds(),Q,3)}function WC0(J,Q){return _$1(J,Q)+"000"}function FC0(J,Q){return Q2(J.getUTCMonth()+1,Q,2)}function HC0(J,Q){return Q2(J.getUTCMinutes(),Q,2)}function BC0(J,Q){return Q2(J.getUTCSeconds(),Q,2)}function DC0(J){var Q=J.getUTCDay();return Q===0?7:Q}function MC0(J,Q){return Q2(C$1.count(xM(J)-1,J),Q,2)}function x$1(J){var Q=J.getUTCDay();return Q>=4||Q===0?CI(J):CI.ceil(J)}function VC0(J,Q){return J=x$1(J),Q2(CI.count(xM(J),J)+(xM(J).getUTCDay()===4),Q,2)}function NC0(J){return J.getUTCDay()}function LC0(J,Q){return Q2(T01.count(xM(J)-1,J),Q,2)}function AC0(J,Q){return Q2(J.getUTCFullYear()%100,Q,2)}function wC0(J,Q){return J=x$1(J),Q2(J.getUTCFullYear()%100,Q,2)}function RC0(J,Q){return Q2(J.getUTCFullYear()%1e4,Q,4)}function OC0(J,Q){var Z=J.getUTCDay();return J=Z>=4||Z===0?CI(J):CI.ceil(J),Q2(J.getUTCFullYear()%1e4,Q,4)}function jC0(){return"+0000"}function wj1(){return"%"}function Rj1(J){return+J}function Oj1(J){return Math.floor(+J/1000)}function $C0(J){return AI=IT0(J),Jh=AI.format,gA8=AI.parse,mA8=AI.utcFormat,uA8=AI.utcParse,AI}function EC0(J,Q){J=J.slice();var Z=0,X=J.length-1,Y=J[Z],K=J[X],G;if(K<Y)G=Z,Z=X,X=G,G=Y,Y=K,K=G;return J[Z]=Q.floor(Y),J[X]=Q.ceil(K),J}function IC0(J){return new Date(J)}function PC0(J){return J instanceof Date?+J:+new Date(+J)}function b$1(J,Q,Z,X,Y,K,G,q,z,U){var W=O$1(),F=W.invert,H=W.domain,B=U(".%L"),M=U(":%S"),V=U("%I:%M"),N=U("%I %p"),L=U("%a %d"),A=U("%b %d"),w=U("%B"),R=U("%Y");function O(j){return(z(j)<j?B:q(j)<j?M:G(j)<j?V:K(j)<j?N:X(j)<j?Y(j)<j?L:A:Z(j)<j?w:R)(j)}return D(O,"tickFormat"),W.invert=function(j){return new Date(F(j))},W.domain=function(j){return arguments.length?H(Array.from(j,PC0)):H().map(IC0)},W.ticks=function(j){var $=H();return J($[0],$[$.length-1],j==null?10:j)},W.tickFormat=function(j,$){return $==null?O:U($)},W.nice=function(j){var $=H();if(!j||typeof j.range!=="function")j=Q($[0],$[$.length-1],j==null?10:j);return j?H(EC0($,j)):W},W.copy=function(){return R$1(W,b$1(J,Q,Z,X,Y,K,G,q,z,U))},W}function y$1(){return ef.apply(b$1(bA8,yA8,XH,hI,fI,fM,yI,bI,QH,Jh).domain([new Date(2000,0,1),new Date(2000,0,2)]),arguments)}function Qh(){var J=vA().unknown(void 0),Q=J.domain,Z=J.range,X=0,Y=1,K,G,q=!1,z=0,U=0,W=0.5;delete J.unknown;function F(){var H=Q().length,B=Y<X,M=B?Y:X,V=B?X:Y;if(K=(V-M)/Math.max(1,H-z+U*2),q)K=Math.floor(K);if(M+=(V-M-K*(H-z))*W,G=K*(1-z),q)M=Math.round(M),G=Math.round(G);var N=cE0(H).map(function(L){return M+K*L});return Z(B?N.reverse():N)}return D(F,"rescale"),J.domain=function(H){return arguments.length?(Q(H),F()):Q()},J.range=function(H){return arguments.length?([X,Y]=H,X=+X,Y=+Y,F()):[X,Y]},J.rangeRound=function(H){return[X,Y]=H,X=+X,Y=+Y,q=!0,F()},J.bandwidth=function(){return G},J.step=function(){return K},J.round=function(H){return arguments.length?(q=!!H,F()):q},J.padding=function(H){return arguments.length?(z=Math.min(1,U=+H),F()):z},J.paddingInner=function(H){return arguments.length?(z=Math.min(1,H),F()):z},J.paddingOuter=function(H){return arguments.length?(U=+H,F()):U},J.align=function(H){return arguments.length?(W=Math.max(0,Math.min(1,H)),F()):W},J.copy=function(){return Qh(Q(),[X,Y]).round(q).paddingInner(z).paddingOuter(U).align(W)},ef.apply(F(),arguments)}function TC0(J){var Q=J.length/6|0,Z=Array(Q),X=0;while(X<Q)Z[X]="#"+J.slice(X*6,++X*6);return Z}function e4(J){return D(function(){return J},"constant")}function SC0(J){return J>1?0:J<-1?gf:Math.acos(J)}function jj1(J){return J>=1?C01:J<=-1?-C01:Math.asin(J)}function f$1(J){this._+=J[0];for(let Q=1,Z=J.length;Q<Z;++Q)this._+=arguments[Q]+J[Q]}function vC0(J){let Q=Math.floor(J);if(!(Q>=0))throw Error(`invalid digits: ${J}`);if(Q>15)return f$1;let Z=10**Q;return function(X){this._+=X[0];for(let Y=1,K=X.length;Y<K;++Y)this._+=Math.round(arguments[Y]*Z)/Z+X[Y]}}function kC0(){return new h$1}function g$1(J){let Q=3;return J.digits=function(Z){if(!arguments.length)return Q;if(Z==null)Q=null;else{let X=Math.floor(Z);if(!(X>=0))throw RangeError(`invalid digits: ${Z}`);Q=X}return J},()=>new h$1(Q)}function _C0(J){return J.innerRadius}function xC0(J){return J.outerRadius}function bC0(J){return J.startAngle}function yC0(J){return J.endAngle}function fC0(J){return J&&J.padAngle}function hC0(J,Q,Z,X,Y,K,G,q){var z=Z-J,U=X-Q,W=G-Y,F=q-K,H=F*z-W*U;if(H*H<JQ)return;return H=(W*(Q-K)-F*(J-Y))/H,[J+H*z,Q+H*U]}function jf(J,Q,Z,X,Y,K,G){var q=J-Z,z=Q-X,U=(G?K:-K)/$I(q*q+z*z),W=U*z,F=-U*q,H=J+W,B=Q+F,M=Z+W,V=X+F,N=(H+M)/2,L=(B+V)/2,A=M-H,w=V-B,R=A*A+w*w,O=Y-K,j=H*V-M*B,$=(w<0?-1:1)*$I(pA8(0,O*O*R-j*j)),E=(j*w-A*$)/R,I=(-j*A-w*$)/R,T=(j*w+A*$)/R,S=(-j*A+w*$)/R,x=E-N,h=I-L,v=T-N,_=S-L;if(x*x+h*h>v*v+_*_)E=T,I=S;return{cx:E,cy:I,x01:-W,y01:-F,x11:E*(Y/O-1),y11:I*(Y/O-1)}}function MU(){var J=_C0,Q=xC0,Z=e4(0),X=null,Y=bC0,K=yC0,G=fC0,q=null,z=g$1(U);function U(){var W,F,H=+J.apply(this,arguments),B=+Q.apply(this,arguments),M=Y.apply(this,arguments)-C01,V=K.apply(this,arguments)-C01,N=zE0(V-M),L=V>M;if(!q)q=W=z();if(B<H)F=B,B=H,H=F;if(!(B>JQ))q.moveTo(0,0);else if(N>V01-JQ){if(q.moveTo(B*NA(M),B*zU(M)),q.arc(0,0,B,M,V,!L),H>JQ)q.moveTo(H*NA(V),H*zU(V)),q.arc(0,0,H,V,M,L)}else{var A=M,w=V,R=M,O=V,j=N,$=N,E=G.apply(this,arguments)/2,I=E>JQ&&(X?+X.apply(this,arguments):$I(H*H+B*B)),T=aO1(zE0(B-H)/2,+Z.apply(this,arguments)),S=T,x=T,h,v;if(I>JQ){var _=jj1(I/H*zU(E)),b=jj1(I/B*zU(E));if((j-=_*2)>JQ)_*=L?1:-1,R+=_,O-=_;else j=0,R=O=(M+V)/2;if(($-=b*2)>JQ)b*=L?1:-1,A+=b,w-=b;else $=0,A=w=(M+V)/2}var g=B*NA(A),k=B*zU(A),y=H*NA(O),f=H*zU(O);if(T>JQ){var m=B*NA(w),n=B*zU(w),p=H*NA(R),e=H*zU(R),G1;if(N<gf)if(G1=hC0(g,k,p,e,m,n,y,f)){var U1=g-G1[0],Z1=k-G1[1],F1=m-G1[0],l=n-G1[1],d=1/zU(SC0((U1*F1+Z1*l)/($I(U1*U1+Z1*Z1)*$I(F1*F1+l*l)))/2),i=$I(G1[0]*G1[0]+G1[1]*G1[1]);S=aO1(T,(H-i)/(d-1)),x=aO1(T,(B-i)/(d+1))}else S=x=0}if(!($>JQ))q.moveTo(g,k);else if(x>JQ)if(h=jf(p,e,g,k,B,x,L),v=jf(m,n,y,f,B,x,L),q.moveTo(h.cx+h.x01,h.cy+h.y01),x<T)q.arc(h.cx,h.cy,x,tJ(h.y01,h.x01),tJ(v.y01,v.x01),!L);else q.arc(h.cx,h.cy,x,tJ(h.y01,h.x01),tJ(h.y11,h.x11),!L),q.arc(0,0,B,tJ(h.cy+h.y11,h.cx+h.x11),tJ(v.cy+v.y11,v.cx+v.x11),!L),q.arc(v.cx,v.cy,x,tJ(v.y11,v.x11),tJ(v.y01,v.x01),!L);else q.moveTo(g,k),q.arc(0,0,B,A,w,!L);if(!(H>JQ)||!(j>JQ))q.lineTo(y,f);else if(S>JQ)if(h=jf(y,f,m,n,H,-S,L),v=jf(g,k,p,e,H,-S,L),q.lineTo(h.cx+h.x01,h.cy+h.y01),S<T)q.arc(h.cx,h.cy,S,tJ(h.y01,h.x01),tJ(v.y01,v.x01),!L);else q.arc(h.cx,h.cy,S,tJ(h.y01,h.x01),tJ(h.y11,h.x11),!L),q.arc(0,0,H,tJ(h.cy+h.y11,h.cx+h.x11),tJ(v.cy+v.y11,v.cx+v.x11),L),q.arc(v.cx,v.cy,S,tJ(v.y11,v.x11),tJ(v.y01,v.x01),!L);else q.arc(0,0,H,O,R,L)}if(q.closePath(),W)return q=null,W+""||null}return D(U,"arc"),U.centroid=function(){var W=(+J.apply(this,arguments)+ +Q.apply(this,arguments))/2,F=(+Y.apply(this,arguments)+ +K.apply(this,arguments))/2-gf/2;return[NA(F)*W,zU(F)*W]},U.innerRadius=function(W){return arguments.length?(J=typeof W==="function"?W:e4(+W),U):J},U.outerRadius=function(W){return arguments.length?(Q=typeof W==="function"?W:e4(+W),U):Q},U.cornerRadius=function(W){return arguments.length?(Z=typeof W==="function"?W:e4(+W),U):Z},U.padRadius=function(W){return arguments.length?(X=W==null?null:typeof W==="function"?W:e4(+W),U):X},U.startAngle=function(W){return arguments.length?(Y=typeof W==="function"?W:e4(+W),U):Y},U.endAngle=function(W){return arguments.length?(K=typeof W==="function"?W:e4(+W),U):K},U.padAngle=function(W){return arguments.length?(G=typeof W==="function"?W:e4(+W),U):G},U.context=function(W){return arguments.length?(q=W==null?null:W,U):q},U}function m$1(J){this._context=J}function kA(J){return new m$1(J)}function u$1(J){return typeof J==="object"&&"length"in J?J:Array.from(J)}function gC0(J){return J[0]}function mC0(J){return J[1]}function VU(J,Q){var Z=e4(!0),X=null,Y=kA,K=null,G=g$1(q);J=typeof J==="function"?J:J===void 0?gC0:e4(J),Q=typeof Q==="function"?Q:Q===void 0?mC0:e4(Q);function q(z){var U,W=(z=u$1(z)).length,F,H=!1,B;if(X==null)K=Y(B=G());for(U=0;U<=W;++U){if(!(U<W&&Z(F=z[U],U,z))===H)if(H=!H)K.lineStart();else K.lineEnd();if(H)K.point(+J(F,U,z),+Q(F,U,z))}if(B)return K=null,B+""||null}return D(q,"line"),q.x=function(z){return arguments.length?(J=typeof z==="function"?z:e4(+z),q):J},q.y=function(z){return arguments.length?(Q=typeof z==="function"?z:e4(+z),q):Q},q.defined=function(z){return arguments.length?(Z=typeof z==="function"?z:e4(!!z),q):Z},q.curve=function(z){return arguments.length?(Y=z,X!=null&&(K=Y(X)),q):Y},q.context=function(z){return arguments.length?(z==null?X=K=null:K=Y(X=z),q):X},q}function uC0(J,Q){return Q<J?-1:Q>J?1:Q>=J?0:NaN}function pC0(J){return J}function p$1(){var J=pC0,Q=uC0,Z=null,X=e4(0),Y=e4(V01),K=e4(0);function G(q){var z,U=(q=u$1(q)).length,W,F,H=0,B=Array(U),M=Array(U),V=+X.apply(this,arguments),N=Math.min(V01,Math.max(-V01,Y.apply(this,arguments)-V)),L,A=Math.min(Math.abs(N)/U,K.apply(this,arguments)),w=A*(N<0?-1:1),R;for(z=0;z<U;++z)if((R=M[B[z]=z]=+J(q[z],z,q))>0)H+=R;if(Q!=null)B.sort(function(O,j){return Q(M[O],M[j])});else if(Z!=null)B.sort(function(O,j){return Z(q[O],q[j])});for(z=0,F=H?(N-U*w)/H:0;z<U;++z,V=L)W=B[z],R=M[W],L=V+(R>0?R*F:0)+w,M[W]={data:q[W],index:z,value:R,startAngle:V,endAngle:L,padAngle:A};return M}return D(G,"pie"),G.value=function(q){return arguments.length?(J=typeof q==="function"?q:e4(+q),G):J},G.sortValues=function(q){return arguments.length?(Q=q,Z=null,G):Q},G.sort=function(q){return arguments.length?(Z=q,Q=null,G):Z},G.startAngle=function(q){return arguments.length?(X=typeof q==="function"?q:e4(+q),G):X},G.endAngle=function(q){return arguments.length?(Y=typeof q==="function"?q:e4(+q),G):Y},G.padAngle=function(q){return arguments.length?(K=typeof q==="function"?q:e4(+q),G):K},G}function Zh(J){return new dC0(J,!0)}function Xh(J){return new dC0(J,!1)}function mf(J,Q,Z){J._context.bezierCurveTo((2*J._x0+J._x1)/3,(2*J._y0+J._y1)/3,(J._x0+2*J._x1)/3,(J._y0+2*J._y1)/3,(J._x0+4*J._x1+Q)/6,(J._y0+4*J._y1+Z)/6)}function Yh(J){this._context=J}function Hq(J){return new Yh(J)}function YH(){}function d$1(J){this._context=J}function c$1(J){return new d$1(J)}function l$1(J){this._context=J}function i$1(J){return new l$1(J)}function n$1(J,Q){this._basis=new Yh(J),this._beta=Q}function uf(J,Q,Z){J._context.bezierCurveTo(J._x1+J._k*(J._x2-J._x0),J._y1+J._k*(J._y2-J._y0),J._x2+J._k*(J._x1-Q),J._y2+J._k*(J._y1-Z),J._x2,J._y2)}function r01(J,Q){this._context=J,this._k=(1-Q)/6}function o01(J,Q){this._context=J,this._k=(1-Q)/6}function t01(J,Q){this._context=J,this._k=(1-Q)/6}function e01(J,Q,Z){var{_x1:X,_y1:Y,_x2:K,_y2:G}=J;if(J._l01_a>JQ){var q=2*J._l01_2a+3*J._l01_a*J._l12_a+J._l12_2a,z=3*J._l01_a*(J._l01_a+J._l12_a);X=(X*q-J._x0*J._l12_2a+J._x2*J._l01_2a)/z,Y=(Y*q-J._y0*J._l12_2a+J._y2*J._l01_2a)/z}if(J._l23_a>JQ){var U=2*J._l23_2a+3*J._l23_a*J._l12_a+J._l12_2a,W=3*J._l23_a*(J._l23_a+J._l12_a);K=(K*U+J._x1*J._l23_2a-Q*J._l12_2a)/W,G=(G*U+J._y1*J._l23_2a-Z*J._l12_2a)/W}J._context.bezierCurveTo(X,Y,K,G,J._x2,J._y2)}function a$1(J,Q){this._context=J,this._alpha=Q}function r$1(J,Q){this._context=J,this._alpha=Q}function s$1(J,Q){this._context=J,this._alpha=Q}function o$1(J){this._context=J}function t$1(J){return new o$1(J)}function Ij1(J){return J<0?-1:1}function Pj1(J,Q,Z){var X=J._x1-J._x0,Y=Q-J._x1,K=(J._y1-J._y0)/(X||Y<0&&-0),G=(Z-J._y1)/(Y||X<0&&-0),q=(K*Y+G*X)/(X+Y);return(Ij1(K)+Ij1(G))*Math.min(Math.abs(K),Math.abs(G),0.5*Math.abs(q))||0}function Tj1(J,Q){var Z=J._x1-J._x0;return Z?(3*(J._y1-J._y0)/Z-Q)/2:Q}function N01(J,Q,Z){var{_x0:X,_y0:Y,_x1:K,_y1:G}=J,q=(K-X)/3;J._context.bezierCurveTo(X+q,Y+q*Q,K-q,G-q*Z,K,G)}function pf(J){this._context=J}function e$1(J){this._context=new JE1(J)}function JE1(J){this._context=J}function Kh(J){return new pf(J)}function Gh(J){return new e$1(J)}function QE1(J){this._context=J}function Cj1(J){var Q,Z=J.length-1,X,Y=Array(Z),K=Array(Z),G=Array(Z);Y[0]=0,K[0]=2,G[0]=J[0]+2*J[1];for(Q=1;Q<Z-1;++Q)Y[Q]=1,K[Q]=4,G[Q]=4*J[Q]+2*J[Q+1];Y[Z-1]=2,K[Z-1]=7,G[Z-1]=8*J[Z-1]+J[Z];for(Q=1;Q<Z;++Q)X=Y[Q]/K[Q-1],K[Q]-=X,G[Q]-=X*G[Q-1];Y[Z-1]=G[Z-1]/K[Z-1];for(Q=Z-2;Q>=0;--Q)Y[Q]=(G[Q]-Y[Q+1])/K[Q];K[Z-1]=(J[Z]+Y[Z-1])/2;for(Q=0;Q<Z-1;++Q)K[Q]=2*J[Q+1]-Y[Q+1];return[Y,K]}function qh(J){return new QE1(J)}function zh(J,Q){this._context=J,this._t=Q}function Uh(J){return new zh(J,0.5)}function Wh(J){return new zh(J,0)}function Fh(J){return new zh(J,1)}function ZE1(){for(var J=0,Q=arguments.length,Z={},X;J<Q;++J){if(!(X=arguments[J]+"")||X in Z||/[\s.]/.test(X))throw Error("illegal type: "+X);Z[X]=[]}return new Cf(Z)}function Cf(J){this._=J}function rC0(J,Q){return J.trim().split(/^|\s+/).map(function(Z){var X="",Y=Z.indexOf(".");if(Y>=0)X=Z.slice(Y+1),Z=Z.slice(0,Y);if(Z&&!Q.hasOwnProperty(Z))throw Error("unknown type: "+Z);return{type:Z,name:X}})}function sC0(J,Q){for(var Z=0,X=J.length,Y;Z<X;++Z)if((Y=J[Z]).name===Q)return Y.value}function Sj1(J,Q,Z){for(var X=0,Y=J.length;X<Y;++X)if(J[X].name===Q){J[X]=cA8,J=J.slice(0,X).concat(J.slice(X+1));break}if(Z!=null)J.push({name:Q,value:Z});return J}function Z61(){return PA||(tC0(eC0),PA=df.now()+Q61)}function eC0(){PA=0}function cf(){this._call=this._time=this._next=null}function XE1(J,Q,Z){var X=new cf;return X.restart(J,Q,Z),X}function JS0(){Z61(),++SI;var J=S01,Q;while(J){if((Q=PA-J._time)>=0)J._call.call(void 0,Q);J=J._next}--SI}function vj1(){PA=(v01=df.now())+Q61,SI=$f=0;try{JS0()}finally{SI=0,ZS0(),PA=0}}function QS0(){var J=df.now(),Q=J-v01;if(Q>oC0)Q61-=Q,v01=J}function ZS0(){var J,Q=S01,Z,X=1/0;while(Q)if(Q._call){if(X>Q._time)X=Q._time;J=Q,Q=Q._next}else Z=Q._next,Q._next=null,Q=J?J._next=Z:S01=Z;Ef=J,k01(X)}function k01(J){if(SI)return;if($f)$f=clearTimeout($f);var Q=J-PA;if(Q>24){if(J<1/0)$f=setTimeout(vj1,J-df.now()-Q61);if(wf)wf=clearInterval(wf)}else{if(!wf)v01=df.now(),wf=setInterval(QS0,oC0);SI=1,tC0(vj1)}}function kj1(J,Q,Z){var X=new cf;return Q=Q==null?0:+Q,X.restart((Y)=>{X.stop(),J(Y+Q)},Q,Z),X}function Hh(J,Q,Z,X,Y,K){var G=J.__transition;if(!G)J.__transition={};else if(Z in G)return;YS0(J,Z,{name:Q,index:X,group:Y,on:iA8,tween:nA8,time:K.time,delay:K.delay,duration:K.duration,ease:K.ease,timer:null,state:XS0})}function X61(J,Q){var Z=HK(J,Q);if(Z.state>XS0)throw Error("too late; already scheduled");return Z}function Bq(J,Q){var Z=HK(J,Q);if(Z.state>L01)throw Error("too late; already running");return Z}function HK(J,Q){var Z=J.__transition;if(!Z||!(Z=Z[Q]))throw Error("transition not found");return Z}function YS0(J,Q,Z){var X=J.__transition,Y;X[Q]=Z,Z.timer=XE1(K,0,Z.time);function K(U){if(Z.state=UE0,Z.timer.restart(G,Z.delay,Z.time),Z.delay<=U)G(U-Z.delay)}D(K,"schedule");function G(U){var W,F,H,B;if(Z.state!==UE0)return z();for(W in X){if(B=X[W],B.name!==Z.name)continue;if(B.state===L01)return kj1(G);if(B.state===WE0)B.state=A01,B.timer.stop(),B.on.call("interrupt",J,J.__data__,B.index,B.group),delete X[W];else if(+W<Q)B.state=A01,B.timer.stop(),B.on.call("cancel",J,J.__data__,B.index,B.group),delete X[W]}if(kj1(function(){if(Z.state===L01)Z.state=WE0,Z.timer.restart(q,Z.delay,Z.time),q(U)}),Z.state=_j1,Z.on.call("start",J,J.__data__,Z.index,Z.group),Z.state!==_j1)return;Z.state=L01,Y=Array(H=Z.tween.length);for(W=0,F=-1;W<H;++W)if(B=Z.tween[W].value.call(J,J.__data__,Z.index,Z.group))Y[++F]=B;Y.length=F+1}D(G,"start");function q(U){var W=U<Z.duration?Z.ease.call(null,U/Z.duration):(Z.timer.restart(z),Z.state=xj1,1),F=-1,H=Y.length;while(++F<H)Y[F].call(J,W);if(Z.state===xj1)Z.on.call("end",J,J.__data__,Z.index,Z.group),z()}D(q,"tick");function z(){Z.state=A01,Z.timer.stop(),delete X[Q];for(var U in X)return;delete J.__transition}D(z,"stop")}function KS0(J,Q){var Z=J.__transition,X,Y,K=!0,G;if(!Z)return;Q=Q==null?null:Q+"";for(G in Z){if((X=Z[G]).name!==Q){K=!1;continue}Y=X.state>_j1&&X.state<xj1,X.state=A01,X.timer.stop(),X.on.call(Y?"interrupt":"cancel",J,J.__data__,X.index,X.group),delete Z[G]}if(K)delete J.__transition}function GS0(J){return this.each(function(){KS0(this,J)})}function qS0(J,Q){var Z,X;return function(){var Y=Bq(this,J),K=Y.tween;if(K!==Z){X=Z=K;for(var G=0,q=X.length;G<q;++G)if(X[G].name===Q){X=X.slice(),X.splice(G,1);break}}Y.tween=X}}function zS0(J,Q,Z){var X,Y;if(typeof Z!=="function")throw Error();return function(){var K=Bq(this,J),G=K.tween;if(G!==X){Y=(X=G).slice();for(var q={name:Q,value:Z},z=0,U=Y.length;z<U;++z)if(Y[z].name===Q){Y[z]=q;break}if(z===U)Y.push(q)}K.tween=Y}}function US0(J,Q){var Z=this._id;if(J+="",arguments.length<2){var X=HK(this.node(),Z).tween;for(var Y=0,K=X.length,G;Y<K;++Y)if((G=X[Y]).name===J)return G.value;return null}return this.each((Q==null?qS0:zS0)(Z,J,Q))}function Y61(J,Q,Z){var X=J._id;return J.each(function(){var Y=Bq(this,X);(Y.value||(Y.value={}))[Q]=Z.apply(this,arguments)}),function(Y){return HK(Y,X).value[Q]}}function YE1(J,Q){var Z;return(typeof Q==="number"?zK:Q instanceof kM?I01:(Z=kM(Q))?(Q=Z,I01):L$1)(J,Q)}function WS0(J){return function(){this.removeAttribute(J)}}function FS0(J){return function(){this.removeAttributeNS(J.space,J.local)}}function HS0(J,Q,Z){var X,Y=Z+"",K;return function(){var G=this.getAttribute(J);return G===Y?null:G===X?K:K=Q(X=G,Z)}}function BS0(J,Q,Z){var X,Y=Z+"",K;return function(){var G=this.getAttributeNS(J.space,J.local);return G===Y?null:G===X?K:K=Q(X=G,Z)}}function DS0(J,Q,Z){var X,Y,K;return function(){var G,q=Z(this),z;if(q==null)return void this.removeAttribute(J);return G=this.getAttribute(J),z=q+"",G===z?null:G===X&&z===Y?K:(Y=z,K=Q(X=G,q))}}function MS0(J,Q,Z){var X,Y,K;return function(){var G,q=Z(this),z;if(q==null)return void this.removeAttributeNS(J.space,J.local);return G=this.getAttributeNS(J.space,J.local),z=q+"",G===z?null:G===X&&z===Y?K:(Y=z,K=Q(X=G,q))}}function VS0(J,Q){var Z=sf(J),X=Z==="transform"?CA8:YE1;return this.attrTween(J,typeof Q==="function"?(Z.local?MS0:DS0)(Z,X,Y61(this,"attr."+J,Q)):Q==null?(Z.local?FS0:WS0)(Z):(Z.local?BS0:HS0)(Z,X,Q))}function NS0(J,Q){return function(Z){this.setAttribute(J,Q.call(this,Z))}}function LS0(J,Q){return function(Z){this.setAttributeNS(J.space,J.local,Q.call(this,Z))}}function AS0(J,Q){var Z,X;function Y(){var K=Q.apply(this,arguments);if(K!==X)Z=(X=K)&&LS0(J,K);return Z}return D(Y,"tween"),Y._value=Q,Y}function wS0(J,Q){var Z,X;function Y(){var K=Q.apply(this,arguments);if(K!==X)Z=(X=K)&&NS0(J,K);return Z}return D(Y,"tween"),Y._value=Q,Y}function RS0(J,Q){var Z="attr."+J;if(arguments.length<2)return(Z=this.tween(Z))&&Z._value;if(Q==null)return this.tween(Z,null);if(typeof Q!=="function")throw Error();var X=sf(J);return this.tween(Z,(X.local?AS0:wS0)(X,Q))}function OS0(J,Q){return function(){X61(this,J).delay=+Q.apply(this,arguments)}}function jS0(J,Q){return Q=+Q,function(){X61(this,J).delay=Q}}function $S0(J){var Q=this._id;return arguments.length?this.each((typeof J==="function"?OS0:jS0)(Q,J)):HK(this.node(),Q).delay}function ES0(J,Q){return function(){Bq(this,J).duration=+Q.apply(this,arguments)}}function IS0(J,Q){return Q=+Q,function(){Bq(this,J).duration=Q}}function PS0(J){var Q=this._id;return arguments.length?this.each((typeof J==="function"?ES0:IS0)(Q,J)):HK(this.node(),Q).duration}function TS0(J,Q){if(typeof Q!=="function")throw Error();return function(){Bq(this,J).ease=Q}}function CS0(J){var Q=this._id;return arguments.length?this.each(TS0(Q,J)):HK(this.node(),Q).ease}function SS0(J,Q){return function(){var Z=Q.apply(this,arguments);if(typeof Z!=="function")throw Error();Bq(this,J).ease=Z}}function vS0(J){if(typeof J!=="function")throw Error();return this.each(SS0(this._id,J))}function kS0(J){if(typeof J!=="function")J=ej1(J);for(var Q=this._groups,Z=Q.length,X=Array(Z),Y=0;Y<Z;++Y)for(var K=Q[Y],G=K.length,q=X[Y]=[],z,U=0;U<G;++U)if((z=K[U])&&J.call(z,z.__data__,U,K))q.push(z);return new HU(X,this._parents,this._name,this._id)}function _S0(J){if(J._id!==this._id)throw Error();for(var Q=this._groups,Z=J._groups,X=Q.length,Y=Z.length,K=Math.min(X,Y),G=Array(X),q=0;q<K;++q)for(var z=Q[q],U=Z[q],W=z.length,F=G[q]=Array(W),H,B=0;B<W;++B)if(H=z[B]||U[B])F[B]=H;for(;q<X;++q)G[q]=Q[q];return new HU(G,this._parents,this._name,this._id)}function xS0(J){return(J+"").trim().split(/^|\s+/).every(function(Q){var Z=Q.indexOf(".");if(Z>=0)Q=Q.slice(0,Z);return!Q||Q==="start"})}function bS0(J,Q,Z){var X,Y,K=xS0(Q)?X61:Bq;return function(){var G=K(this,J),q=G.on;if(q!==X)(Y=(X=q).copy()).on(Q,Z);G.on=Y}}function yS0(J,Q){var Z=this._id;return arguments.length<2?HK(this.node(),Z).on.on(J):this.each(bS0(Z,J,Q))}function fS0(J){return function(){var Q=this.parentNode;for(var Z in this.__transition)if(+Z!==J)return;if(Q)Q.removeChild(this)}}function hS0(){return this.on("end.remove",fS0(this._id))}function gS0(J){var Q=this._name,Z=this._id;if(typeof J!=="function")J=c01(J);for(var X=this._groups,Y=X.length,K=Array(Y),G=0;G<Y;++G)for(var q=X[G],z=q.length,U=K[G]=Array(z),W,F,H=0;H<z;++H)if((W=q[H])&&(F=J.call(W,W.__data__,H,q))){if("__data__"in W)F.__data__=W.__data__;U[H]=F,Hh(U[H],Q,Z,H,U,HK(W,Z))}return new HU(K,this._parents,Q,Z)}function mS0(J){var Q=this._name,Z=this._id;if(typeof J!=="function")J=tj1(J);for(var X=this._groups,Y=X.length,K=[],G=[],q=0;q<Y;++q)for(var z=X[q],U=z.length,W,F=0;F<U;++F)if(W=z[F]){for(var H=J.call(W,W.__data__,F,z),B,M=HK(W,Z),V=0,N=H.length;V<N;++V)if(B=H[V])Hh(B,Q,Z,V,H,M);K.push(H),G.push(W)}return new HU(K,G,Q,Z)}function uS0(){return new aA8(this._groups,this._parents)}function pS0(J,Q){var Z,X,Y;return function(){var K=$A(this,J),G=(this.style.removeProperty(J),$A(this,J));return K===G?null:K===Z&&G===X?Y:Y=Q(Z=K,X=G)}}function KE1(J){return function(){this.style.removeProperty(J)}}function dS0(J,Q,Z){var X,Y=Z+"",K;return function(){var G=$A(this,J);return G===Y?null:G===X?K:K=Q(X=G,Z)}}function cS0(J,Q,Z){var X,Y,K;return function(){var G=$A(this,J),q=Z(this),z=q+"";if(q==null)z=q=(this.style.removeProperty(J),$A(this,J));return G===z?null:G===X&&z===Y?K:(Y=z,K=Q(X=G,q))}}function lS0(J,Q){var Z,X,Y,K="style."+Q,G="end."+K,q;return function(){var z=Bq(this,J),U=z.on,W=z.value[K]==null?q||(q=KE1(Q)):void 0;if(U!==Z||Y!==W)(X=(Z=U).copy()).on(G,Y=W);z.on=X}}function iS0(J,Q,Z){var X=(J+="")==="transform"?TA8:YE1;return Q==null?this.styleTween(J,pS0(J,X)).on("end.style."+J,KE1(J)):typeof Q==="function"?this.styleTween(J,cS0(J,X,Y61(this,"style."+J,Q))).each(lS0(this._id,J)):this.styleTween(J,dS0(J,X,Q),Z).on("end.style."+J,null)}function nS0(J,Q,Z){return function(X){this.style.setProperty(J,Q.call(this,X),Z)}}function aS0(J,Q,Z){var X,Y;function K(){var G=Q.apply(this,arguments);if(G!==Y)X=(Y=G)&&nS0(J,G,Z);return X}return D(K,"tween"),K._value=Q,K}function rS0(J,Q,Z){var X="style."+(J+="");if(arguments.length<2)return(X=this.tween(X))&&X._value;if(Q==null)return this.tween(X,null);if(typeof Q!=="function")throw Error();return this.tween(X,aS0(J,Q,Z==null?"":Z))}function sS0(J){return function(){this.textContent=J}}function oS0(J){return function(){var Q=J(this);this.textContent=Q==null?"":Q}}function tS0(J){return this.tween("text",typeof J==="function"?oS0(Y61(this,"text",J)):sS0(J==null?"":J+""))}function eS0(J){return function(Q){this.textContent=J.call(this,Q)}}function Jv0(J){var Q,Z;function X(){var Y=J.apply(this,arguments);if(Y!==Z)Q=(Z=Y)&&eS0(Y);return Q}return D(X,"tween"),X._value=J,X}function Qv0(J){var Q="text";if(arguments.length<1)return(Q=this.tween(Q))&&Q._value;if(J==null)return this.tween(Q,null);if(typeof J!=="function")throw Error();return this.tween(Q,Jv0(J))}function Zv0(){var J=this._name,Q=this._id,Z=GE1();for(var X=this._groups,Y=X.length,K=0;K<Y;++K)for(var G=X[K],q=G.length,z,U=0;U<q;++U)if(z=G[U]){var W=HK(z,Q);Hh(z,J,Z,U,G,{time:W.time+W.delay+W.duration,delay:0,duration:W.duration,ease:W.ease})}return new HU(X,this._parents,J,Z)}function Xv0(){var J,Q,Z=this,X=Z._id,Y=Z.size();return new Promise(function(K,G){var q={value:G},z={value:D(function(){if(--Y===0)K()},"value")};if(Z.each(function(){var U=Bq(this,X),W=U.on;if(W!==J)Q=(J=W).copy(),Q._.cancel.push(q),Q._.interrupt.push(q),Q._.end.push(z);U.on=Q}),Y===0)K()})}function HU(J,Q,Z,X){this._groups=J,this._parents=Q,this._name=Z,this._id=X}function Yv0(J){return of().transition(J)}function GE1(){return++rA8}function Kv0(J){return((J*=2)<=1?J*J*J:(J-=2)*J*J+2)/2}function Gv0(J,Q){var Z;while(!(Z=J.__transition)||!(Z=Z[Q]))if(!(J=J.parentNode))throw Error(`transition ${Q} not found`);return Z}function qv0(J){var Q,Z;if(J instanceof HU)Q=J._id,J=J._name;else Q=GE1(),(Z=sA8).time=Z61(),J=J==null?null:J+"";for(var X=this._groups,Y=X.length,K=0;K<Y;++K)for(var G=X[K],q=G.length,z,U=0;U<q;++U)if(z=G[U])Hh(z,J,Q,U,G,Z||Gv0(z,Q));return new HU(X,this._parents,J,Q)}function bj1(J){return[+J[0],+J[1]]}function zv0(J){return[bj1(J[0]),bj1(J[1])]}function K61(J){return{type:J}}function wA(J,Q,Z){this.k=J,this.x=Q,this.y=Z}function Uv0(J){while(!J.__zoom)if(!(J=J.parentNode))return oA8;return J.__zoom}var _01,m38,sF,L1,x01,qK,yj1,vI,u38,fj1,OA,lf,hj1,FE0,HE0,rO1,g4,X01,p38,d38,c38,l38,i38,n38,S8,TM,eJ,a38,r38,s38,o38,t38,b01,BE0,If,Y01,s11,K01,y$0,DE0,o11,e38,Uq,JL8,ME0,QL8,qq,ZL8,kI,XL8,YL8,KL8,GL8,qL8,Wq,zL8,VE0,UL8,N6,WL8,k6,FL8,Q0,HL8,BL8,DL8,q6,y01="#ffffff",f01="#f2f2f2",iQ,ML8,VL8,NL8,LL8,AL8,TA,wL8,RL8,OL8,jL8,WU,oF,NE0,LE0,$L8,u8,Sf,EL8,CA,cZ,AE0,PI,Pf,h01,wE0,RE0,OE0,gj1,mj1,L9,jE0,$E0,nf,IL8,f$0,PL8,EE0,IE0,h$0,TL8,CL8,SL8,nQ,FK,PE0,sO1,oO1,t11,vL8,g$0,Vf,kL8,G01,hO1,m$0,Nf,_L8,xL8,Gq,lQ,Lf,u$0,gO1,mO1,bL8,uO1,yL8,p$0,d$0,pO1,c$0,e11,fL8,hL8,gL8,mL8,uL8,SE0,pL8,dL8,vE0,cL8,l$0,Af,lL8,iL8,i$0,jA,SA,nL8,aL8,_E0,n$0,I9,rL8,sL8,oL8,tL8,xE0,eL8,Z2,JA8,QA8,BU,tO1,ZA8,XA8,a$0,eO1,B5,_I,bM,E0,YA8,KA8,s2,Fq,q01,GA8,qA8,bE0,g01,pj1="",dj1="",cj1="",lj1,P9,_9,h9,g9,m9,X2,u9,r$0,zA8,x1,af,m01,u01,ij1,UA8,w01,rf,p01,WA8,gE0,FA8,l92,i92,HA8,s$0,BA8,DA8,MA8,z01=1,dO1=2,Qj1=3,J01=4,o$0=0.000001,VA8,NA8,Zj1="http://www.w3.org/1999/xhtml",t$0,IP0,of,_f=0.7,j01,EI="\\s*([+-]?\\d+)\\s*",xf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",FU="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",LA8,AA8,wA8,RA8,OA8,jA8,$A8,e$0,EA8,IA8,$01=18,kP0=0.96422,_P0=1,xP0=0.82521,bP0=0.13793103448275862,II=0.20689655172413793,yP0,PA8,i01,pP0,n92,I01,a92,r92,Wj1,cO1,JE0,Fj1,Q01,TA8,CA8,QE0,ZE0,SA8,FT0,XE0,YE0,KE0,Z01,DT0,MT0,lO1,iO1,IA,s92,eF=1000,WK,JH,ZH,j$1,GE0,nO1,QH,o92,bI,t92,OT0,e92,yI,J22,jT0,Q22,fM,Z22,$$1,X22,$T0,Y22,fI,TI,E$1,I$1,_M,P$1,T$1,K22,G22,q22,z22,U22,W22,F22,C$1,T01,vA8,kA8,CI,_A8,xA8,H22,B22,D22,M22,V22,N22,L22,hI,A22,ET0,w22,XH,R22,xM,O22,j22,$22,bA8,yA8,qE0,m5,fA8,hA8,AI,Jh,gA8,mA8,uA8,CC0,zE0,tJ,NA,pA8,aO1,zU,$I,JQ=0.000000000001,gf,C01,V01,$j1,Ej1,LA=0.000001,dA8,h$1,E22,dC0,cC0,s01,lC0,iC0,J61,nC0,aC0,cA8,lA8,SI=0,$f=0,wf=0,oC0=1000,S01,Ef,v01=0,PA=0,Q61=0,df,tC0,iA8,nA8,XS0=0,UE0=1,_j1=2,L01=3,WE0=4,xj1=5,A01=6,aA8,rA8=0,tF,sA8,I22,P22,T22,oA8;var A9=B1(()=>{O6();_01=Q4({"../../node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js"(J,Q){(function(Z,X){typeof J=="object"&&typeof Q<"u"?Q.exports=X():typeof define=="function"&&define.amd?define(X):(Z=typeof globalThis<"u"?globalThis:Z||self).dayjs=X()})(J,function(){var Z=1000,X=60000,Y=3600000,K="millisecond",G="second",q="minute",z="hour",U="day",W="week",F="month",H="quarter",B="year",M="date",V="Invalid Date",N=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,L=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,A={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:D(function(v){var _=["th","st","nd","rd"],b=v%100;return"["+v+(_[(b-20)%10]||_[b]||_[0])+"]"},"ordinal")},w=D(function(v,_,b){var g=String(v);return!g||g.length>=_?v:""+Array(_+1-g.length).join(b)+v},"m"),R={s:w,z:D(function(v){var _=-v.utcOffset(),b=Math.abs(_),g=Math.floor(b/60),k=b%60;return(_<=0?"+":"-")+w(g,2,"0")+":"+w(k,2,"0")},"z"),m:D(function v(_,b){if(_.date()<b.date())return-v(b,_);var g=12*(b.year()-_.year())+(b.month()-_.month()),k=_.clone().add(g,F),y=b-k<0,f=_.clone().add(g+(y?-1:1),F);return+(-(g+(b-k)/(y?k-f:f-k))||0)},"t"),a:D(function(v){return v<0?Math.ceil(v)||0:Math.floor(v)},"a"),p:D(function(v){return{M:F,y:B,w:W,d:U,D:M,h:z,m:q,s:G,ms:K,Q:H}[v]||String(v||"").toLowerCase().replace(/s$/,"")},"p"),u:D(function(v){return v===void 0},"u")},O="en",j={};j[O]=A;var $="$isDayjsObject",E=D(function(v){return v instanceof x||!(!v||!v[$])},"S"),I=D(function v(_,b,g){var k;if(!_)return O;if(typeof _=="string"){var y=_.toLowerCase();j[y]&&(k=y),b&&(j[y]=b,k=y);var f=_.split("-");if(!k&&f.length>1)return v(f[0])}else{var m=_.name;j[m]=_,k=m}return!g&&k&&(O=k),k||!g&&O},"t"),T=D(function(v,_){if(E(v))return v.clone();var b=typeof _=="object"?_:{};return b.date=v,b.args=arguments,new x(b)},"O"),S=R;S.l=I,S.i=E,S.w=function(v,_){return T(v,{locale:_.$L,utc:_.$u,x:_.$x,$offset:_.$offset})};var x=function(){function v(b){this.$L=I(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[$]=!0}D(v,"M");var _=v.prototype;return _.parse=function(b){this.$d=function(g){var{date:k,utc:y}=g;if(k===null)return new Date(NaN);if(S.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var f=k.match(N);if(f){var m=f[2]-1||0,n=(f[7]||"0").substring(0,3);return y?new Date(Date.UTC(f[1],m,f[3]||1,f[4]||0,f[5]||0,f[6]||0,n)):new Date(f[1],m,f[3]||1,f[4]||0,f[5]||0,f[6]||0,n)}}return new Date(k)}(b),this.init()},_.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},_.$utils=function(){return S},_.isValid=function(){return this.$d.toString()!==V},_.isSame=function(b,g){var k=T(b);return this.startOf(g)<=k&&k<=this.endOf(g)},_.isAfter=function(b,g){return T(b)<this.startOf(g)},_.isBefore=function(b,g){return this.endOf(g)<T(b)},_.$g=function(b,g,k){return S.u(b)?this[g]:this.set(k,b)},_.unix=function(){return Math.floor(this.valueOf()/1000)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(b,g){var k=this,y=!!S.u(g)||g,f=S.p(b),m=D(function(l,d){var i=S.w(k.$u?Date.UTC(k.$y,d,l):new Date(k.$y,d,l),k);return y?i:i.endOf(U)},"l"),n=D(function(l,d){return S.w(k.toDate()[l].apply(k.toDate("s"),(y?[0,0,0,0]:[23,59,59,999]).slice(d)),k)},"$"),p=this.$W,e=this.$M,G1=this.$D,U1="set"+(this.$u?"UTC":"");switch(f){case B:return y?m(1,0):m(31,11);case F:return y?m(1,e):m(0,e+1);case W:var Z1=this.$locale().weekStart||0,F1=(p<Z1?p+7:p)-Z1;return m(y?G1-F1:G1+(6-F1),e);case U:case M:return n(U1+"Hours",0);case z:return n(U1+"Minutes",1);case q:return n(U1+"Seconds",2);case G:return n(U1+"Milliseconds",3);default:return this.clone()}},_.endOf=function(b){return this.startOf(b,!1)},_.$set=function(b,g){var k,y=S.p(b),f="set"+(this.$u?"UTC":""),m=(k={},k[U]=f+"Date",k[M]=f+"Date",k[F]=f+"Month",k[B]=f+"FullYear",k[z]=f+"Hours",k[q]=f+"Minutes",k[G]=f+"Seconds",k[K]=f+"Milliseconds",k)[y],n=y===U?this.$D+(g-this.$W):g;if(y===F||y===B){var p=this.clone().set(M,1);p.$d[m](n),p.init(),this.$d=p.set(M,Math.min(this.$D,p.daysInMonth())).$d}else m&&this.$d[m](n);return this.init(),this},_.set=function(b,g){return this.clone().$set(b,g)},_.get=function(b){return this[S.p(b)]()},_.add=function(b,g){var k,y=this;b=Number(b);var f=S.p(g),m=D(function(e){var G1=T(y);return S.w(G1.date(G1.date()+Math.round(e*b)),y)},"y");if(f===F)return this.set(F,this.$M+b);if(f===B)return this.set(B,this.$y+b);if(f===U)return m(1);if(f===W)return m(7);var n=(k={},k[q]=X,k[z]=Y,k[G]=Z,k)[f]||1,p=this.$d.getTime()+b*n;return S.w(p,this)},_.subtract=function(b,g){return this.add(-1*b,g)},_.format=function(b){var g=this,k=this.$locale();if(!this.isValid())return k.invalidDate||V;var y=b||"YYYY-MM-DDTHH:mm:ssZ",f=S.z(this),m=this.$H,n=this.$m,p=this.$M,e=k.weekdays,G1=k.months,U1=k.meridiem,Z1=D(function(d,i,r,o){return d&&(d[i]||d(g,y))||r[i].slice(0,o)},"h"),F1=D(function(d){return S.s(m%12||12,d,"0")},"d"),l=U1||function(d,i,r){var o=d<12?"AM":"PM";return r?o.toLowerCase():o};return y.replace(L,function(d,i){return i||function(r){switch(r){case"YY":return String(g.$y).slice(-2);case"YYYY":return S.s(g.$y,4,"0");case"M":return p+1;case"MM":return S.s(p+1,2,"0");case"MMM":return Z1(k.monthsShort,p,G1,3);case"MMMM":return Z1(G1,p);case"D":return g.$D;case"DD":return S.s(g.$D,2,"0");case"d":return String(g.$W);case"dd":return Z1(k.weekdaysMin,g.$W,e,2);case"ddd":return Z1(k.weekdaysShort,g.$W,e,3);case"dddd":return e[g.$W];case"H":return String(m);case"HH":return S.s(m,2,"0");case"h":return F1(1);case"hh":return F1(2);case"a":return l(m,n,!0);case"A":return l(m,n,!1);case"m":return String(n);case"mm":return S.s(n,2,"0");case"s":return String(g.$s);case"ss":return S.s(g.$s,2,"0");case"SSS":return S.s(g.$ms,3,"0");case"Z":return f}return null}(d)||f.replace(":","")})},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(b,g,k){var y,f=this,m=S.p(g),n=T(b),p=(n.utcOffset()-this.utcOffset())*X,e=this-n,G1=D(function(){return S.m(f,n)},"D");switch(m){case B:y=G1()/12;break;case F:y=G1();break;case H:y=G1()/3;break;case W:y=(e-p)/604800000;break;case U:y=(e-p)/86400000;break;case z:y=e/Y;break;case q:y=e/X;break;case G:y=e/Z;break;default:y=e}return k?y:S.a(y)},_.daysInMonth=function(){return this.endOf(F).$D},_.$locale=function(){return j[this.$L]},_.locale=function(b,g){if(!b)return this.$L;var k=this.clone(),y=I(b,g,!0);return y&&(k.$L=y),k},_.clone=function(){return S.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},v}(),h=x.prototype;return T.prototype=h,[["$ms",K],["$s",G],["$m",q],["$H",z],["$W",U],["$M",F],["$y",B],["$D",M]].forEach(function(v){h[v[1]]=function(_){return this.$g(_,v[0],v[1])}}),T.extend=function(v,_){return v.$i||(v(_,x,T),v.$i=!0),T},T.locale=I,T.isDayjs=E,T.unix=function(v){return T(1000*v)},T.en=j[O],T.Ls=j,T.p={},T})}}),m38=Z4(_01(),1),sF={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},L1={trace:D((...J)=>{},"trace"),debug:D((...J)=>{},"debug"),info:D((...J)=>{},"info"),warn:D((...J)=>{},"warn"),error:D((...J)=>{},"error"),fatal:D((...J)=>{},"fatal")},x01=D(function(J="fatal"){let Q=sF.fatal;if(typeof J==="string"){if(J.toLowerCase()in sF)Q=sF[J]}else if(typeof J==="number")Q=J;if(L1.trace=()=>{},L1.debug=()=>{},L1.info=()=>{},L1.warn=()=>{},L1.error=()=>{},L1.fatal=()=>{},Q<=sF.fatal)L1.fatal=console.error?console.error.bind(console,qK("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",qK("FATAL"));if(Q<=sF.error)L1.error=console.error?console.error.bind(console,qK("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",qK("ERROR"));if(Q<=sF.warn)L1.warn=console.warn?console.warn.bind(console,qK("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",qK("WARN"));if(Q<=sF.info)L1.info=console.info?console.info.bind(console,qK("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",qK("INFO"));if(Q<=sF.debug)L1.debug=console.debug?console.debug.bind(console,qK("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",qK("DEBUG"));if(Q<=sF.trace)L1.trace=console.debug?console.debug.bind(console,qK("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",qK("TRACE"))},"setLogLevel"),qK=D((J)=>{return`%c${(0,m38.default)().format("ss.SSS")} : ${J} : `},"format"),yj1=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,vI=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,u38=/\s*%%.*\n/gm,fj1=class extends Error{static{D(this,"UnknownDiagramError")}constructor(J){super(J);this.name="UnknownDiagramError"}},OA={},lf=D(function(J,Q){J=J.replace(yj1,"").replace(vI,"").replace(u38,`
|
|
2301
2301
|
`);for(let[Z,{detector:X}]of Object.entries(OA))if(X(J,Q))return Z;throw new fj1(`No diagram type detected matching given configuration for text: ${J}`)},"detectType"),hj1=D((...J)=>{for(let{id:Q,detector:Z,loader:X}of J)FE0(Q,Z,X)},"registerLazyLoadedDiagrams"),FE0=D((J,Q,Z)=>{if(OA[J])L1.warn(`Detector with key ${J} already exists. Overwriting.`);OA[J]={detector:Q,loader:Z},L1.debug(`Detector with key ${J} added${Z?" with loader":""}`)},"addDetector"),HE0=D((J)=>{return OA[J].loader},"getDiagramLoader"),rO1=D((J,Q,{depth:Z=2,clobber:X=!1}={})=>{let Y={depth:Z,clobber:X};if(Array.isArray(Q)&&!Array.isArray(J))return Q.forEach((K)=>rO1(J,K,Y)),J;else if(Array.isArray(Q)&&Array.isArray(J))return Q.forEach((K)=>{if(!J.includes(K))J.push(K)}),J;if(J===void 0||Z<=0)if(J!==void 0&&J!==null&&typeof J==="object"&&typeof Q==="object")return Object.assign(J,Q);else return Q;if(Q!==void 0&&typeof J==="object"&&typeof Q==="object")Object.keys(Q).forEach((K)=>{if(typeof Q[K]==="object"&&(J[K]===void 0||typeof J[K]==="object")){if(J[K]===void 0)J[K]=Array.isArray(Q[K])?[]:{};J[K]=rO1(J[K],Q[K],{depth:Z-1,clobber:X})}else if(X||typeof J[K]!=="object"&&typeof Q[K]!=="object")J[K]=Q[K]});return J},"assignWithDepth"),g4=rO1,X01={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:D((J)=>J>=255?255:J<0?0:J,"r"),g:D((J)=>J>=255?255:J<0?0:J,"g"),b:D((J)=>J>=255?255:J<0?0:J,"b"),h:D((J)=>J%360,"h"),s:D((J)=>J>=100?100:J<0?0:J,"s"),l:D((J)=>J>=100?100:J<0?0:J,"l"),a:D((J)=>J>=1?1:J<0?0:J,"a")},toLinear:D((J)=>{let Q=J/255;return J>0.03928?Math.pow((Q+0.055)/1.055,2.4):Q/12.92},"toLinear"),hue2rgb:D((J,Q,Z)=>{if(Z<0)Z+=1;if(Z>1)Z-=1;if(Z<0.16666666666666666)return J+(Q-J)*6*Z;if(Z<0.5)return Q;if(Z<0.6666666666666666)return J+(Q-J)*(0.6666666666666666-Z)*6;return J},"hue2rgb"),hsl2rgb:D(({h:J,s:Q,l:Z},X)=>{if(!Q)return Z*2.55;J/=360,Q/=100,Z/=100;let Y=Z<0.5?Z*(1+Q):Z+Q-Z*Q,K=2*Z-Y;switch(X){case"r":return X01.hue2rgb(K,Y,J+0.3333333333333333)*255;case"g":return X01.hue2rgb(K,Y,J)*255;case"b":return X01.hue2rgb(K,Y,J-0.3333333333333333)*255}},"hsl2rgb"),rgb2hsl:D(({r:J,g:Q,b:Z},X)=>{J/=255,Q/=255,Z/=255;let Y=Math.max(J,Q,Z),K=Math.min(J,Q,Z),G=(Y+K)/2;if(X==="l")return G*100;if(Y===K)return 0;let q=Y-K,z=G>0.5?q/(2-Y-K):q/(Y+K);if(X==="s")return z*100;switch(Y){case J:return((Q-Z)/q+(Q<Z?6:0))*60;case Q:return((Z-J)/q+2)*60;case Z:return((J-Q)/q+4)*60;default:return-1}},"rgb2hsl")},p38=X01,d38={clamp:D((J,Q,Z)=>{if(Q>Z)return Math.min(Q,Math.max(Z,J));return Math.min(Z,Math.max(Q,J))},"clamp"),round:D((J)=>{return Math.round(J*10000000000)/10000000000},"round")},c38=d38,l38={dec2hex:D((J)=>{let Q=Math.round(J).toString(16);return Q.length>1?Q:`0${Q}`},"dec2hex")},i38=l38,n38={channel:p38,lang:c38,unit:i38},S8=n38,TM={};for(let J=0;J<=255;J++)TM[J]=S8.unit.dec2hex(J);eJ={ALL:0,RGB:1,HSL:2},a38=class{static{D(this,"Type")}constructor(){this.type=eJ.ALL}get(){return this.type}set(J){if(this.type&&this.type!==J)throw Error("Cannot change both RGB and HSL channels at the same time");this.type=J}reset(){this.type=eJ.ALL}is(J){return this.type===J}},r38=a38,s38=class{static{D(this,"Channels")}constructor(J,Q){this.color=Q,this.changed=!1,this.data=J,this.type=new r38}set(J,Q){return this.color=Q,this.changed=!1,this.data=J,this.type.type=eJ.ALL,this}_ensureHSL(){let J=this.data,{h:Q,s:Z,l:X}=J;if(Q===void 0)J.h=S8.channel.rgb2hsl(J,"h");if(Z===void 0)J.s=S8.channel.rgb2hsl(J,"s");if(X===void 0)J.l=S8.channel.rgb2hsl(J,"l")}_ensureRGB(){let J=this.data,{r:Q,g:Z,b:X}=J;if(Q===void 0)J.r=S8.channel.hsl2rgb(J,"r");if(Z===void 0)J.g=S8.channel.hsl2rgb(J,"g");if(X===void 0)J.b=S8.channel.hsl2rgb(J,"b")}get r(){let J=this.data,Q=J.r;if(!this.type.is(eJ.HSL)&&Q!==void 0)return Q;return this._ensureHSL(),S8.channel.hsl2rgb(J,"r")}get g(){let J=this.data,Q=J.g;if(!this.type.is(eJ.HSL)&&Q!==void 0)return Q;return this._ensureHSL(),S8.channel.hsl2rgb(J,"g")}get b(){let J=this.data,Q=J.b;if(!this.type.is(eJ.HSL)&&Q!==void 0)return Q;return this._ensureHSL(),S8.channel.hsl2rgb(J,"b")}get h(){let J=this.data,Q=J.h;if(!this.type.is(eJ.RGB)&&Q!==void 0)return Q;return this._ensureRGB(),S8.channel.rgb2hsl(J,"h")}get s(){let J=this.data,Q=J.s;if(!this.type.is(eJ.RGB)&&Q!==void 0)return Q;return this._ensureRGB(),S8.channel.rgb2hsl(J,"s")}get l(){let J=this.data,Q=J.l;if(!this.type.is(eJ.RGB)&&Q!==void 0)return Q;return this._ensureRGB(),S8.channel.rgb2hsl(J,"l")}get a(){return this.data.a}set r(J){this.type.set(eJ.RGB),this.changed=!0,this.data.r=J}set g(J){this.type.set(eJ.RGB),this.changed=!0,this.data.g=J}set b(J){this.type.set(eJ.RGB),this.changed=!0,this.data.b=J}set h(J){this.type.set(eJ.HSL),this.changed=!0,this.data.h=J}set s(J){this.type.set(eJ.HSL),this.changed=!0,this.data.s=J}set l(J){this.type.set(eJ.HSL),this.changed=!0,this.data.l=J}set a(J){this.changed=!0,this.data.a=J}},o38=s38,t38=new o38({r:0,g:0,b:0,a:0},"transparent"),b01=t38,BE0={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:D((J)=>{if(J.charCodeAt(0)!==35)return;let Q=J.match(BE0.re);if(!Q)return;let Z=Q[1],X=parseInt(Z,16),Y=Z.length,K=Y%4===0,G=Y>4,q=G?1:17,z=G?8:4,U=K?0:-1,W=G?255:15;return b01.set({r:(X>>z*(U+3)&W)*q,g:(X>>z*(U+2)&W)*q,b:(X>>z*(U+1)&W)*q,a:K?(X&W)*q/255:1},J)},"parse"),stringify:D((J)=>{let{r:Q,g:Z,b:X,a:Y}=J;if(Y<1)return`#${TM[Math.round(Q)]}${TM[Math.round(Z)]}${TM[Math.round(X)]}${TM[Math.round(Y*255)]}`;else return`#${TM[Math.round(Q)]}${TM[Math.round(Z)]}${TM[Math.round(X)]}`},"stringify")},If=BE0,Y01={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:D((J)=>{let Q=J.match(Y01.hueRe);if(Q){let[,Z,X]=Q;switch(X){case"grad":return S8.channel.clamp.h(parseFloat(Z)*0.9);case"rad":return S8.channel.clamp.h(parseFloat(Z)*180/Math.PI);case"turn":return S8.channel.clamp.h(parseFloat(Z)*360)}}return S8.channel.clamp.h(parseFloat(J))},"_hue2deg"),parse:D((J)=>{let Q=J.charCodeAt(0);if(Q!==104&&Q!==72)return;let Z=J.match(Y01.re);if(!Z)return;let[,X,Y,K,G,q]=Z;return b01.set({h:Y01._hue2deg(X),s:S8.channel.clamp.s(parseFloat(Y)),l:S8.channel.clamp.l(parseFloat(K)),a:G?S8.channel.clamp.a(q?parseFloat(G)/100:parseFloat(G)):1},J)},"parse"),stringify:D((J)=>{let{h:Q,s:Z,l:X,a:Y}=J;if(Y<1)return`hsla(${S8.lang.round(Q)}, ${S8.lang.round(Z)}%, ${S8.lang.round(X)}%, ${Y})`;else return`hsl(${S8.lang.round(Q)}, ${S8.lang.round(Z)}%, ${S8.lang.round(X)}%)`},"stringify")},s11=Y01,K01={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:D((J)=>{J=J.toLowerCase();let Q=K01.colors[J];if(!Q)return;return If.parse(Q)},"parse"),stringify:D((J)=>{let Q=If.stringify(J);for(let Z in K01.colors)if(K01.colors[Z]===Q)return Z;return},"stringify")},y$0=K01,DE0={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:D((J)=>{let Q=J.charCodeAt(0);if(Q!==114&&Q!==82)return;let Z=J.match(DE0.re);if(!Z)return;let[,X,Y,K,G,q,z,U,W]=Z;return b01.set({r:S8.channel.clamp.r(Y?parseFloat(X)*2.55:parseFloat(X)),g:S8.channel.clamp.g(G?parseFloat(K)*2.55:parseFloat(K)),b:S8.channel.clamp.b(z?parseFloat(q)*2.55:parseFloat(q)),a:U?S8.channel.clamp.a(W?parseFloat(U)/100:parseFloat(U)):1},J)},"parse"),stringify:D((J)=>{let{r:Q,g:Z,b:X,a:Y}=J;if(Y<1)return`rgba(${S8.lang.round(Q)}, ${S8.lang.round(Z)}, ${S8.lang.round(X)}, ${S8.lang.round(Y)})`;else return`rgb(${S8.lang.round(Q)}, ${S8.lang.round(Z)}, ${S8.lang.round(X)})`},"stringify")},o11=DE0,e38={format:{keyword:y$0,hex:If,rgb:o11,rgba:o11,hsl:s11,hsla:s11},parse:D((J)=>{if(typeof J!=="string")return J;let Q=If.parse(J)||o11.parse(J)||s11.parse(J)||y$0.parse(J);if(Q)return Q;throw Error(`Unsupported color format: "${J}"`)},"parse"),stringify:D((J)=>{if(!J.changed&&J.color)return J.color;if(J.type.is(eJ.HSL)||J.data.r===void 0)return s11.stringify(J);else if(J.a<1||!Number.isInteger(J.r)||!Number.isInteger(J.g)||!Number.isInteger(J.b))return o11.stringify(J);else return If.stringify(J)},"stringify")},Uq=e38,JL8=D((J,Q)=>{let Z=Uq.parse(J);for(let X in Q)Z[X]=S8.channel.clamp[X](Q[X]);return Uq.stringify(Z)},"change"),ME0=JL8,QL8=D((J,Q,Z=0,X=1)=>{if(typeof J!=="number")return ME0(J,{a:Q});let Y=b01.set({r:S8.channel.clamp.r(J),g:S8.channel.clamp.g(Q),b:S8.channel.clamp.b(Z),a:S8.channel.clamp.a(X)});return Uq.stringify(Y)},"rgba"),qq=QL8,ZL8=D((J,Q)=>{return S8.lang.round(Uq.parse(J)[Q])},"channel"),kI=ZL8,XL8=D((J)=>{let{r:Q,g:Z,b:X}=Uq.parse(J),Y=0.2126*S8.channel.toLinear(Q)+0.7152*S8.channel.toLinear(Z)+0.0722*S8.channel.toLinear(X);return S8.lang.round(Y)},"luminance"),YL8=XL8,KL8=D((J)=>{return YL8(J)>=0.5},"isLight"),GL8=KL8,qL8=D((J)=>{return!GL8(J)},"isDark"),Wq=qL8,zL8=D((J,Q,Z)=>{let X=Uq.parse(J),Y=X[Q],K=S8.channel.clamp[Q](Y+Z);if(Y!==K)X[Q]=K;return Uq.stringify(X)},"adjustChannel"),VE0=zL8,UL8=D((J,Q)=>{return VE0(J,"l",Q)},"lighten"),N6=UL8,WL8=D((J,Q)=>{return VE0(J,"l",-Q)},"darken"),k6=WL8,FL8=D((J,Q)=>{let Z=Uq.parse(J),X={};for(let Y in Q){if(!Q[Y])continue;X[Y]=Z[Y]+Q[Y]}return ME0(J,X)},"adjust"),Q0=FL8,HL8=D((J,Q,Z=50)=>{let{r:X,g:Y,b:K,a:G}=Uq.parse(J),{r:q,g:z,b:U,a:W}=Uq.parse(Q),F=Z/100,H=F*2-1,B=G-W,V=((H*B===-1?H:(H+B)/(1+H*B))+1)/2,N=1-V,L=X*V+q*N,A=Y*V+z*N,w=K*V+U*N,R=G*F+W*(1-F);return qq(L,A,w,R)},"mix"),BL8=HL8,DL8=D((J,Q=100)=>{let Z=Uq.parse(J);return Z.r=255-Z.r,Z.g=255-Z.g,Z.b=255-Z.b,BL8(Z,J,Q)},"invert"),q6=DL8,iQ=D((J,Q)=>Q?Q0(J,{s:-40,l:10}):Q0(J,{s:-40,l:-10}),"mkBorder"),ML8=class{static{D(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||Q0(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||Q0(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||iQ(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||iQ(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||iQ(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||iQ(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||q6(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||q6(this.tertiaryColor),this.lineColor=this.lineColor||q6(this.background),this.arrowheadColor=this.arrowheadColor||q6(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?k6(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||k6(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||q6(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||N6(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode)this.rowOdd=this.rowOdd||k6(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||k6(this.mainBkg,10);else this.rowOdd=this.rowOdd||N6(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||N6(this.mainBkg,5);if(this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Q0(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Q0(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Q0(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Q0(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Q0(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Q0(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||Q0(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Q0(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Q0(this.primaryColor,{h:330}),this.darkMode)for(let Q=0;Q<this.THEME_COLOR_LIMIT;Q++)this["cScale"+Q]=k6(this["cScale"+Q],75);else for(let Q=0;Q<this.THEME_COLOR_LIMIT;Q++)this["cScale"+Q]=k6(this["cScale"+Q],25);for(let Q=0;Q<this.THEME_COLOR_LIMIT;Q++)this["cScaleInv"+Q]=this["cScaleInv"+Q]||q6(this["cScale"+Q]);for(let Q=0;Q<this.THEME_COLOR_LIMIT;Q++)if(this.darkMode)this["cScalePeer"+Q]=this["cScalePeer"+Q]||N6(this["cScale"+Q],10);else this["cScalePeer"+Q]=this["cScalePeer"+Q]||k6(this["cScale"+Q],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let Q=0;Q<this.THEME_COLOR_LIMIT;Q++)this["cScaleLabel"+Q]=this["cScaleLabel"+Q]||this.scaleLabelColor;let J=this.darkMode?-4:-1;for(let Q=0;Q<5;Q++)this["surface"+Q]=this["surface"+Q]||Q0(this.mainBkg,{h:180,s:-15,l:J*(5+Q*3)}),this["surfacePeer"+Q]=this["surfacePeer"+Q]||Q0(this.mainBkg,{h:180,s:-15,l:J*(8+Q*3)});if(this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||Q0(this.primaryColor,{h:64}),this.fillType3=this.fillType3||Q0(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||Q0(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||Q0(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||Q0(this.primaryColor,{h:128}),this.fillType7=this.fillType7||Q0(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Q0(this.primaryColor,{l:-10}),this.pie5=this.pie5||Q0(this.secondaryColor,{l:-10}),this.pie6=this.pie6||Q0(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||Q0(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Q0(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Q0(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Q0(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||Q0(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||Q0(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||0.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||0.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Q0(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Q0(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Q0(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Q0(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Q0(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Q0(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wq(this.quadrant1Fill)?N6(this.quadrant1Fill):k6(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?k6(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Q0(this.primaryColor,{h:-30}),this.git4=this.git4||Q0(this.primaryColor,{h:-60}),this.git5=this.git5||Q0(this.primaryColor,{h:-90}),this.git6=this.git6||Q0(this.primaryColor,{h:60}),this.git7=this.git7||Q0(this.primaryColor,{h:120}),this.darkMode)this.git0=N6(this.git0,25),this.git1=N6(this.git1,25),this.git2=N6(this.git2,25),this.git3=N6(this.git3,25),this.git4=N6(this.git4,25),this.git5=N6(this.git5,25),this.git6=N6(this.git6,25),this.git7=N6(this.git7,25);else this.git0=k6(this.git0,25),this.git1=k6(this.git1,25),this.git2=k6(this.git2,25),this.git3=k6(this.git3,25),this.git4=k6(this.git4,25),this.git5=k6(this.git5,25),this.git6=k6(this.git6,25),this.git7=k6(this.git7,25);this.gitInv0=this.gitInv0||q6(this.git0),this.gitInv1=this.gitInv1||q6(this.git1),this.gitInv2=this.gitInv2||q6(this.git2),this.gitInv3=this.gitInv3||q6(this.git3),this.gitInv4=this.gitInv4||q6(this.git4),this.gitInv5=this.gitInv5||q6(this.git5),this.gitInv6=this.gitInv6||q6(this.git6),this.gitInv7=this.gitInv7||q6(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||y01,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||f01}calculate(J){if(typeof J!=="object"){this.updateColors();return}let Q=Object.keys(J);Q.forEach((Z)=>{this[Z]=J[Z]}),this.updateColors(),Q.forEach((Z)=>{this[Z]=J[Z]})}},VL8=D((J)=>{let Q=new ML8;return Q.calculate(J),Q},"getThemeVariables"),NL8=class{static{D(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=N6(this.primaryColor,16),this.tertiaryColor=Q0(this.primaryColor,{h:-160}),this.primaryBorderColor=q6(this.background),this.secondaryBorderColor=iQ(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=iQ(this.tertiaryColor,this.darkMode),this.primaryTextColor=q6(this.primaryColor),this.secondaryTextColor=q6(this.secondaryColor),this.tertiaryTextColor=q6(this.tertiaryColor),this.lineColor=q6(this.background),this.textColor=q6(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=N6(q6("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=qq(255,255,255,0.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=k6("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=k6(this.sectionBkgColor,10),this.taskBorderColor=qq(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=qq(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||N6(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||k6(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=N6(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=N6(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=N6(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Q0(this.primaryColor,{h:64}),this.fillType3=Q0(this.secondaryColor,{h:64}),this.fillType4=Q0(this.primaryColor,{h:-64}),this.fillType5=Q0(this.secondaryColor,{h:-64}),this.fillType6=Q0(this.primaryColor,{h:128}),this.fillType7=Q0(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Q0(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Q0(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Q0(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Q0(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Q0(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Q0(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Q0(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Q0(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Q0(this.primaryColor,{h:330});for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleInv"+J]=this["cScaleInv"+J]||q6(this["cScale"+J]);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScalePeer"+J]=this["cScalePeer"+J]||N6(this["cScale"+J],10);for(let J=0;J<5;J++)this["surface"+J]=this["surface"+J]||Q0(this.mainBkg,{h:30,s:-30,l:-(-10+J*4)}),this["surfacePeer"+J]=this["surfacePeer"+J]||Q0(this.mainBkg,{h:30,s:-30,l:-(-7+J*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleLabel"+J]=this["cScaleLabel"+J]||this.scaleLabelColor;for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["pie"+J]=this["cScale"+J];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Q0(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Q0(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Q0(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Q0(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Q0(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Q0(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wq(this.quadrant1Fill)?N6(this.quadrant1Fill):k6(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||0.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||0.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?k6(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=N6(this.secondaryColor,20),this.git1=N6(this.pie2||this.secondaryColor,20),this.git2=N6(this.pie3||this.tertiaryColor,20),this.git3=N6(this.pie4||Q0(this.primaryColor,{h:-30}),20),this.git4=N6(this.pie5||Q0(this.primaryColor,{h:-60}),20),this.git5=N6(this.pie6||Q0(this.primaryColor,{h:-90}),10),this.git6=N6(this.pie7||Q0(this.primaryColor,{h:60}),10),this.git7=N6(this.pie8||Q0(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||q6(this.git0),this.gitInv1=this.gitInv1||q6(this.git1),this.gitInv2=this.gitInv2||q6(this.git2),this.gitInv3=this.gitInv3||q6(this.git3),this.gitInv4=this.gitInv4||q6(this.git4),this.gitInv5=this.gitInv5||q6(this.git5),this.gitInv6=this.gitInv6||q6(this.git6),this.gitInv7=this.gitInv7||q6(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||q6(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||q6(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||N6(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||N6(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(J){if(typeof J!=="object"){this.updateColors();return}let Q=Object.keys(J);Q.forEach((Z)=>{this[Z]=J[Z]}),this.updateColors(),Q.forEach((Z)=>{this[Z]=J[Z]})}},LL8=D((J)=>{let Q=new NL8;return Q.calculate(J),Q},"getThemeVariables"),AL8=class{static{D(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=Q0(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=Q0(this.primaryColor,{h:-160}),this.primaryBorderColor=iQ(this.primaryColor,this.darkMode),this.secondaryBorderColor=iQ(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=iQ(this.tertiaryColor,this.darkMode),this.primaryTextColor=q6(this.primaryColor),this.secondaryTextColor=q6(this.secondaryColor),this.tertiaryTextColor=q6(this.tertiaryColor),this.lineColor=q6(this.background),this.textColor=q6(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.sectionBkgColor=qq(102,102,255,0.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Q0(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Q0(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Q0(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Q0(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Q0(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Q0(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Q0(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Q0(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Q0(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||k6(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||k6(this.tertiaryColor,40);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScale"+J]=k6(this["cScale"+J],10),this["cScalePeer"+J]=this["cScalePeer"+J]||k6(this["cScale"+J],25);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleInv"+J]=this["cScaleInv"+J]||Q0(this["cScale"+J],{h:180});for(let J=0;J<5;J++)this["surface"+J]=this["surface"+J]||Q0(this.mainBkg,{h:30,l:-(5+J*5)}),this["surfacePeer"+J]=this["surfacePeer"+J]||Q0(this.mainBkg,{h:30,l:-(7+J*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||q6(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||q6(this.labelTextColor);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleLabel"+J]=this["cScaleLabel"+J]||this.labelTextColor}if(this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=N6(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||N6(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||N6(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Q0(this.primaryColor,{h:64}),this.fillType3=Q0(this.secondaryColor,{h:64}),this.fillType4=Q0(this.primaryColor,{h:-64}),this.fillType5=Q0(this.secondaryColor,{h:-64}),this.fillType6=Q0(this.primaryColor,{h:128}),this.fillType7=Q0(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||Q0(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||Q0(this.primaryColor,{l:-10}),this.pie5=this.pie5||Q0(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Q0(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||Q0(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||Q0(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||Q0(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||Q0(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||Q0(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||Q0(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Q0(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Q0(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Q0(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Q0(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Q0(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Q0(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wq(this.quadrant1Fill)?N6(this.quadrant1Fill):k6(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||0.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||0.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Q0(this.primaryColor,{h:-30}),this.git4=this.git4||Q0(this.primaryColor,{h:-60}),this.git5=this.git5||Q0(this.primaryColor,{h:-90}),this.git6=this.git6||Q0(this.primaryColor,{h:60}),this.git7=this.git7||Q0(this.primaryColor,{h:120}),this.darkMode)this.git0=N6(this.git0,25),this.git1=N6(this.git1,25),this.git2=N6(this.git2,25),this.git3=N6(this.git3,25),this.git4=N6(this.git4,25),this.git5=N6(this.git5,25),this.git6=N6(this.git6,25),this.git7=N6(this.git7,25);else this.git0=k6(this.git0,25),this.git1=k6(this.git1,25),this.git2=k6(this.git2,25),this.git3=k6(this.git3,25),this.git4=k6(this.git4,25),this.git5=k6(this.git5,25),this.git6=k6(this.git6,25),this.git7=k6(this.git7,25);this.gitInv0=this.gitInv0||k6(q6(this.git0),25),this.gitInv1=this.gitInv1||q6(this.git1),this.gitInv2=this.gitInv2||q6(this.git2),this.gitInv3=this.gitInv3||q6(this.git3),this.gitInv4=this.gitInv4||q6(this.git4),this.gitInv5=this.gitInv5||q6(this.git5),this.gitInv6=this.gitInv6||q6(this.git6),this.gitInv7=this.gitInv7||q6(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||q6(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||q6(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||y01,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||f01}calculate(J){if(Object.keys(this).forEach((Z)=>{if(this[Z]==="calculated")this[Z]=void 0}),typeof J!=="object"){this.updateColors();return}let Q=Object.keys(J);Q.forEach((Z)=>{this[Z]=J[Z]}),this.updateColors(),Q.forEach((Z)=>{this[Z]=J[Z]})}},TA=D((J)=>{let Q=new AL8;return Q.calculate(J),Q},"getThemeVariables"),wL8=class{static{D(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=N6("#cde498",10),this.primaryBorderColor=iQ(this.primaryColor,this.darkMode),this.secondaryBorderColor=iQ(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=iQ(this.tertiaryColor,this.darkMode),this.primaryTextColor=q6(this.primaryColor),this.secondaryTextColor=q6(this.secondaryColor),this.tertiaryTextColor=q6(this.primaryColor),this.lineColor=q6(this.background),this.textColor=q6(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.actorBorder=k6(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Q0(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Q0(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Q0(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Q0(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Q0(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Q0(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Q0(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Q0(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Q0(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||k6(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||k6(this.tertiaryColor,40);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScale"+J]=k6(this["cScale"+J],10),this["cScalePeer"+J]=this["cScalePeer"+J]||k6(this["cScale"+J],25);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleInv"+J]=this["cScaleInv"+J]||Q0(this["cScale"+J],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleLabel"+J]=this["cScaleLabel"+J]||this.scaleLabelColor;for(let J=0;J<5;J++)this["surface"+J]=this["surface"+J]||Q0(this.mainBkg,{h:30,s:-30,l:-(5+J*5)}),this["surfacePeer"+J]=this["surfacePeer"+J]||Q0(this.mainBkg,{h:30,s:-30,l:-(8+J*5)});if(this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||N6(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||N6(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Q0(this.primaryColor,{h:64}),this.fillType3=Q0(this.secondaryColor,{h:64}),this.fillType4=Q0(this.primaryColor,{h:-64}),this.fillType5=Q0(this.secondaryColor,{h:-64}),this.fillType6=Q0(this.primaryColor,{h:128}),this.fillType7=Q0(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Q0(this.primaryColor,{l:-30}),this.pie5=this.pie5||Q0(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Q0(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||Q0(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Q0(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Q0(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Q0(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||Q0(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||Q0(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Q0(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Q0(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Q0(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Q0(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Q0(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Q0(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wq(this.quadrant1Fill)?N6(this.quadrant1Fill):k6(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||0.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||0.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Q0(this.primaryColor,{h:-30}),this.git4=this.git4||Q0(this.primaryColor,{h:-60}),this.git5=this.git5||Q0(this.primaryColor,{h:-90}),this.git6=this.git6||Q0(this.primaryColor,{h:60}),this.git7=this.git7||Q0(this.primaryColor,{h:120}),this.darkMode)this.git0=N6(this.git0,25),this.git1=N6(this.git1,25),this.git2=N6(this.git2,25),this.git3=N6(this.git3,25),this.git4=N6(this.git4,25),this.git5=N6(this.git5,25),this.git6=N6(this.git6,25),this.git7=N6(this.git7,25);else this.git0=k6(this.git0,25),this.git1=k6(this.git1,25),this.git2=k6(this.git2,25),this.git3=k6(this.git3,25),this.git4=k6(this.git4,25),this.git5=k6(this.git5,25),this.git6=k6(this.git6,25),this.git7=k6(this.git7,25);this.gitInv0=this.gitInv0||q6(this.git0),this.gitInv1=this.gitInv1||q6(this.git1),this.gitInv2=this.gitInv2||q6(this.git2),this.gitInv3=this.gitInv3||q6(this.git3),this.gitInv4=this.gitInv4||q6(this.git4),this.gitInv5=this.gitInv5||q6(this.git5),this.gitInv6=this.gitInv6||q6(this.git6),this.gitInv7=this.gitInv7||q6(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||q6(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||q6(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||y01,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||f01}calculate(J){if(typeof J!=="object"){this.updateColors();return}let Q=Object.keys(J);Q.forEach((Z)=>{this[Z]=J[Z]}),this.updateColors(),Q.forEach((Z)=>{this[Z]=J[Z]})}},RL8=D((J)=>{let Q=new wL8;return Q.calculate(J),Q},"getThemeVariables"),OL8=class{static{D(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=N6(this.contrast,55),this.background="#ffffff",this.tertiaryColor=Q0(this.primaryColor,{h:-160}),this.primaryBorderColor=iQ(this.primaryColor,this.darkMode),this.secondaryBorderColor=iQ(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=iQ(this.tertiaryColor,this.darkMode),this.primaryTextColor=q6(this.primaryColor),this.secondaryTextColor=q6(this.secondaryColor),this.tertiaryTextColor=q6(this.tertiaryColor),this.lineColor=q6(this.background),this.textColor=q6(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||N6(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=N6(this.contrast,55),this.border2=this.contrast,this.actorBorder=N6(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleInv"+J]=this["cScaleInv"+J]||q6(this["cScale"+J]);for(let J=0;J<this.THEME_COLOR_LIMIT;J++)if(this.darkMode)this["cScalePeer"+J]=this["cScalePeer"+J]||N6(this["cScale"+J],10);else this["cScalePeer"+J]=this["cScalePeer"+J]||k6(this["cScale"+J],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["cScaleLabel"+J]=this["cScaleLabel"+J]||this.scaleLabelColor;for(let J=0;J<5;J++)this["surface"+J]=this["surface"+J]||Q0(this.mainBkg,{l:-(5+J*5)}),this["surfacePeer"+J]=this["surfacePeer"+J]||Q0(this.mainBkg,{l:-(8+J*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=N6(this.contrast,30),this.sectionBkgColor2=N6(this.contrast,30),this.taskBorderColor=k6(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=N6(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=k6(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Q0(this.primaryColor,{h:64}),this.fillType3=Q0(this.secondaryColor,{h:64}),this.fillType4=Q0(this.primaryColor,{h:-64}),this.fillType5=Q0(this.secondaryColor,{h:-64}),this.fillType6=Q0(this.primaryColor,{h:128}),this.fillType7=Q0(this.secondaryColor,{h:128});for(let J=0;J<this.THEME_COLOR_LIMIT;J++)this["pie"+J]=this["cScale"+J];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Q0(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Q0(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Q0(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Q0(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Q0(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Q0(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wq(this.quadrant1Fill)?N6(this.quadrant1Fill):k6(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||0.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||0.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=k6(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||Q0(this.primaryColor,{h:-30}),this.git4=this.pie5||Q0(this.primaryColor,{h:-60}),this.git5=this.pie6||Q0(this.primaryColor,{h:-90}),this.git6=this.pie7||Q0(this.primaryColor,{h:60}),this.git7=this.pie8||Q0(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||q6(this.git0),this.gitInv1=this.gitInv1||q6(this.git1),this.gitInv2=this.gitInv2||q6(this.git2),this.gitInv3=this.gitInv3||q6(this.git3),this.gitInv4=this.gitInv4||q6(this.git4),this.gitInv5=this.gitInv5||q6(this.git5),this.gitInv6=this.gitInv6||q6(this.git6),this.gitInv7=this.gitInv7||q6(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||y01,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||f01}calculate(J){if(typeof J!=="object"){this.updateColors();return}let Q=Object.keys(J);Q.forEach((Z)=>{this[Z]=J[Z]}),this.updateColors(),Q.forEach((Z)=>{this[Z]=J[Z]})}},jL8=D((J)=>{let Q=new OL8;return Q.calculate(J),Q},"getThemeVariables"),WU={base:{getThemeVariables:VL8},dark:{getThemeVariables:LL8},default:{getThemeVariables:TA},forest:{getThemeVariables:RL8},neutral:{getThemeVariables:jL8}},oF={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"]},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:0.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:0.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:50000,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},NE0={...oF,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF"},themeCSS:void 0,themeVariables:WU.default.getThemeVariables(),sequence:{...oF.sequence,messageFont:D(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:D(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:D(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...oF.gantt,tickInterval:void 0,useWidth:void 0},c4:{...oF.c4,useWidth:void 0,personFont:D(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),external_personFont:D(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:D(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:D(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:D(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:D(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:D(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:D(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:D(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:D(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:D(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:D(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:D(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:D(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:D(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:D(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:D(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:D(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:D(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:D(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:D(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:D(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...oF.pie,useWidth:984},xyChart:{...oF.xyChart,useWidth:void 0},requirement:{...oF.requirement,useWidth:void 0},packet:{...oF.packet},radar:{...oF.radar}},LE0=D((J,Q="")=>Object.keys(J).reduce((Z,X)=>{if(Array.isArray(J[X]))return Z;else if(typeof J[X]==="object"&&J[X]!==null)return[...Z,Q+X,...LE0(J[X],"")];return[...Z,Q+X]},[]),"keyify"),$L8=new Set(LE0(NE0,"")),u8=NE0,Sf=D((J)=>{if(L1.debug("sanitizeDirective called with",J),typeof J!=="object"||J==null)return;if(Array.isArray(J)){J.forEach((Q)=>Sf(Q));return}for(let Q of Object.keys(J)){if(L1.debug("Checking key",Q),Q.startsWith("__")||Q.includes("proto")||Q.includes("constr")||!$L8.has(Q)||J[Q]==null){L1.debug("sanitize deleting key: ",Q),delete J[Q];continue}if(typeof J[Q]==="object"){L1.debug("sanitizing object",Q),Sf(J[Q]);continue}let Z=["themeCSS","fontFamily","altFontFamily"];for(let X of Z)if(Q.includes(X))L1.debug("sanitizing css option",Q),J[Q]=EL8(J[Q])}if(J.themeVariables)for(let Q of Object.keys(J.themeVariables)){let Z=J.themeVariables[Q];if(Z?.match&&!Z.match(/^[\d "#%(),.;A-Za-z]+$/))J.themeVariables[Q]=""}L1.debug("After sanitization",J)},"sanitizeDirective"),EL8=D((J)=>{let Q=0,Z=0;for(let X of J){if(Q<Z)return"{ /* ERROR: Unbalanced CSS */ }";if(X==="{")Q++;else if(X==="}")Z++}if(Q!==Z)return"{ /* ERROR: Unbalanced CSS */ }";return J},"sanitizeCss"),CA=Object.freeze(u8),cZ=g4({},CA),PI=[],Pf=g4({},CA),h01=D((J,Q)=>{let Z=g4({},J),X={};for(let Y of Q)jE0(Y),X=g4(X,Y);if(Z=g4(Z,X),X.theme&&X.theme in WU){let Y=g4({},AE0),K=g4(Y.themeVariables||{},X.themeVariables);if(Z.theme&&Z.theme in WU)Z.themeVariables=WU[Z.theme].getThemeVariables(K)}return Pf=Z,EE0(Pf),Pf},"updateCurrentConfig"),wE0=D((J)=>{if(cZ=g4({},CA),cZ=g4(cZ,J),J.theme&&WU[J.theme])cZ.themeVariables=WU[J.theme].getThemeVariables(J.themeVariables);return h01(cZ,PI),cZ},"setSiteConfig"),RE0=D((J)=>{AE0=g4({},J)},"saveConfigFromInitialize"),OE0=D((J)=>{return cZ=g4(cZ,J),h01(cZ,PI),cZ},"updateSiteConfig"),gj1=D(()=>{return g4({},cZ)},"getSiteConfig"),mj1=D((J)=>{return EE0(J),g4(Pf,J),L9()},"setConfig"),L9=D(()=>{return g4({},Pf)},"getConfig"),jE0=D((J)=>{if(!J)return;["secure",...cZ.secure??[]].forEach((Q)=>{if(Object.hasOwn(J,Q))L1.debug(`Denied attempt to modify a secure key ${Q}`,J[Q]),delete J[Q]}),Object.keys(J).forEach((Q)=>{if(Q.startsWith("__"))delete J[Q]}),Object.keys(J).forEach((Q)=>{if(typeof J[Q]==="string"&&(J[Q].includes("<")||J[Q].includes(">")||J[Q].includes("url(data:")))delete J[Q];if(typeof J[Q]==="object")jE0(J[Q])})},"sanitize"),$E0=D((J)=>{if(Sf(J),J.fontFamily&&!J.themeVariables?.fontFamily)J.themeVariables={...J.themeVariables,fontFamily:J.fontFamily};PI.push(J),h01(cZ,PI)},"addDirective"),nf=D((J=cZ)=>{PI=[],h01(J,PI)},"reset"),IL8={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},f$0={},PL8=D((J)=>{if(f$0[J])return;L1.warn(IL8[J]),f$0[J]=!0},"issueWarning"),EE0=D((J)=>{if(!J)return;if(J.lazyLoadedDiagrams||J.loadExternalDiagramsAtStartup)PL8("LAZY_LOAD_DEPRECATED")},"checkConfig"),{entries:IE0,setPrototypeOf:h$0,isFrozen:TL8,getPrototypeOf:CL8,getOwnPropertyDescriptor:SL8}=Object,{freeze:nQ,seal:FK,create:PE0}=Object,{apply:sO1,construct:oO1}=typeof Reflect<"u"&&Reflect;if(!nQ)nQ=D(function(Q){return Q},"freeze");if(!FK)FK=D(function(Q){return Q},"seal");if(!sO1)sO1=D(function(Q,Z,X){return Q.apply(Z,X)},"apply");if(!oO1)oO1=D(function(Q,Z){return new Q(...Z)},"construct");t11=QQ(Array.prototype.forEach),vL8=QQ(Array.prototype.lastIndexOf),g$0=QQ(Array.prototype.pop),Vf=QQ(Array.prototype.push),kL8=QQ(Array.prototype.splice),G01=QQ(String.prototype.toLowerCase),hO1=QQ(String.prototype.toString),m$0=QQ(String.prototype.match),Nf=QQ(String.prototype.replace),_L8=QQ(String.prototype.indexOf),xL8=QQ(String.prototype.trim),Gq=QQ(Object.prototype.hasOwnProperty),lQ=QQ(RegExp.prototype.test),Lf=TE0(TypeError);D(QQ,"unapply");D(TE0,"unconstruct");D(N9,"addToSet");D(CE0,"cleanArray");D(CM,"clone");D(wI,"lookupGetter");u$0=nQ(["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","section","select","shadow","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"]),gO1=nQ(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),mO1=nQ(["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"]),bL8=nQ(["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"]),uO1=nQ(["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"]),yL8=nQ(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),p$0=nQ(["#text"]),d$0=nQ(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pO1=nQ(["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","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","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-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"]),c$0=nQ(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","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"]),e11=nQ(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fL8=FK(/\{\{[\w\W]*|[\w\W]*\}\}/gm),hL8=FK(/<%[\w\W]*|[\w\W]*%>/gm),gL8=FK(/\$\{[\w\W]*/gm),mL8=FK(/^data-[\-\w.\u00B7-\uFFFF]+$/),uL8=FK(/^aria-[\-\w]+$/),SE0=FK(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pL8=FK(/^(?:\w+script|data):/i),dL8=FK(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vE0=FK(/^html$/i),cL8=FK(/^[a-z][.\w]*(-[.\w]+)+$/i),l$0=Object.freeze({__proto__:null,ARIA_ATTR:uL8,ATTR_WHITESPACE:dL8,CUSTOM_ELEMENT:cL8,DATA_ATTR:mL8,DOCTYPE_NAME:vE0,ERB_EXPR:hL8,IS_ALLOWED_URI:SE0,IS_SCRIPT_OR_DATA:pL8,MUSTACHE_EXPR:fL8,TMPLIT_EXPR:gL8}),Af={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},lL8=D(function(){return typeof window>"u"?null:window},"getGlobal"),iL8=D(function(Q,Z){if(typeof Q!=="object"||typeof Q.createPolicy!=="function")return null;let X=null,Y="data-tt-policy-suffix";if(Z&&Z.hasAttribute(Y))X=Z.getAttribute(Y);let K="dompurify"+(X?"#"+X:"");try{return Q.createPolicy(K,{createHTML(G){return G},createScriptURL(G){return G}})}catch(G){return console.warn("TrustedTypes policy "+K+" could not be created."),null}},"_createTrustedTypesPolicy"),i$0=D(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");D(uj1,"createDOMPurify");jA=uj1(),SA=/<br\s*\/?>/gi,nL8=D((J)=>{if(!J)return[""];return xE0(J).replace(/\\n/g,"#br#").split("#br#")},"getRows"),aL8=(()=>{let J=!1;return()=>{if(!J)kE0(),J=!0}})();D(kE0,"setupDompurifyHooks");_E0=D((J)=>{return aL8(),jA.sanitize(J)},"removeScript"),n$0=D((J,Q)=>{if(Q.flowchart?.htmlLabels!==!1){let Z=Q.securityLevel;if(Z==="antiscript"||Z==="strict")J=_E0(J);else if(Z!=="loose")J=xE0(J),J=J.replace(/</g,"<").replace(/>/g,">"),J=J.replace(/=/g,"="),J=tL8(J)}return J},"sanitizeMore"),I9=D((J,Q)=>{if(!J)return J;if(Q.dompurifyConfig)J=jA.sanitize(n$0(J,Q),Q.dompurifyConfig).toString();else J=jA.sanitize(n$0(J,Q),{FORBID_TAGS:["style"]}).toString();return J},"sanitizeText"),rL8=D((J,Q)=>{if(typeof J==="string")return I9(J,Q);return J.flat().map((Z)=>I9(Z,Q))},"sanitizeTextOrArray"),sL8=D((J)=>{return SA.test(J)},"hasBreaks"),oL8=D((J)=>{return J.split(SA)},"splitBreaks"),tL8=D((J)=>{return J.replace(/#br#/g,"<br/>")},"placeholderToBreak"),xE0=D((J)=>{return J.replace(SA,"#br#")},"breakToPlaceholder"),eL8=D((J)=>{let Q="";if(J)Q=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,Q=Q.replaceAll(/\(/g,"\\("),Q=Q.replaceAll(/\)/g,"\\)");return Q},"getUrl"),Z2=D((J)=>J===!1||["false","null","0"].includes(String(J).trim().toLowerCase())?!1:!0,"evaluate"),JA8=D(function(...J){let Q=J.filter((Z)=>{return!isNaN(Z)});return Math.max(...Q)},"getMax"),QA8=D(function(...J){let Q=J.filter((Z)=>{return!isNaN(Z)});return Math.min(...Q)},"getMin"),BU=D(function(J){let Q=J.split(/(,)/),Z=[];for(let X=0;X<Q.length;X++){let Y=Q[X];if(Y===","&&X>0&&X+1<Q.length){let K=Q[X-1],G=Q[X+1];if(ZA8(K,G))Y=K+","+G,X++,Z.pop()}Z.push(XA8(Y))}return Z.join("")},"parseGenericTypes"),tO1=D((J,Q)=>{return Math.max(0,J.split(Q).length-1)},"countOccurrence"),ZA8=D((J,Q)=>{let Z=tO1(J,"~"),X=tO1(Q,"~");return Z===1&&X===1},"shouldCombineSets"),XA8=D((J)=>{let Q=tO1(J,"~"),Z=!1;if(Q<=1)return J;if(Q%2!==0&&J.startsWith("~"))J=J.substring(1),Z=!0;let X=[...J],Y=X.indexOf("~"),K=X.lastIndexOf("~");while(Y!==-1&&K!==-1&&Y!==K)X[Y]="<",X[K]=">",Y=X.indexOf("~"),K=X.lastIndexOf("~");if(Z)X.unshift("~");return X.join("")},"processSet"),a$0=D(()=>window.MathMLElement!==void 0,"isMathMLSupported"),eO1=/\$\$(.*)\$\$/g,B5=D((J)=>(J.match(eO1)?.length??0)>0,"hasKatex"),_I=D(async(J,Q)=>{J=await bM(J,Q);let Z=document.createElement("div");Z.innerHTML=J,Z.id="katex-temp",Z.style.visibility="hidden",Z.style.position="absolute",Z.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",Z);let Y={width:Z.clientWidth,height:Z.clientHeight};return Z.remove(),Y},"calculateMathMLDimensions"),bM=D(async(J,Q)=>{if(!B5(J))return J;if(!(a$0()||Q.legacyMathML||Q.forceLegacyMathML))return J.replace(eO1,"MathML is unsupported in this environment.");let{default:Z}=await Promise.resolve().then(() => (b$0(),x$0)),X=Q.forceLegacyMathML||!a$0()&&Q.legacyMathML?"htmlAndMathml":"mathml";return J.split(SA).map((Y)=>B5(Y)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${Y}</div>`:`<div>${Y}</div>`).join("").replace(eO1,(Y,K)=>Z.renderToString(K,{throwOnError:!0,displayMode:!0,output:X}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))},"renderKatex"),E0={getRows:nL8,sanitizeText:I9,sanitizeTextOrArray:rL8,hasBreaks:sL8,splitBreaks:oL8,lineBreakRegex:SA,removeScript:_E0,getUrl:eL8,evaluate:Z2,getMax:JA8,getMin:QA8},YA8=D(function(J,Q){for(let Z of Q)J.attr(Z[0],Z[1])},"d3Attrs"),KA8=D(function(J,Q,Z){let X=new Map;if(Z)X.set("width","100%"),X.set("style",`max-width: ${Q}px;`);else X.set("height",J),X.set("width",Q);return X},"calculateSvgSizeAttrs"),s2=D(function(J,Q,Z,X){let Y=KA8(Q,Z,X);YA8(J,Y)},"configureSvgSize"),Fq=D(function(J,Q,Z,X){let Y=Q.node().getBBox(),K=Y.width,G=Y.height;L1.info(`SVG bounds: ${K}x${G}`,Y);let q=0,z=0;L1.info(`Graph bounds: ${q}x${z}`,J),q=K+Z*2,z=G+Z*2,L1.info(`Calculated bounds: ${q}x${z}`),s2(Q,z,q,X);let U=`${Y.x-Z} ${Y.y-Z} ${Y.width+2*Z} ${Y.height+2*Z}`;Q.attr("viewBox",U)},"setupGraphViewbox"),q01={},GA8=D((J,Q,Z)=>{let X="";if(J in q01&&q01[J])X=q01[J](Z);else L1.warn(`No theme found for ${J}`);return` & {
|
|
2302
2302
|
font-family: ${Z.fontFamily};
|
|
@@ -6006,11 +6006,11 @@ Actual: ${Y}`)}async function Z59(J,Q,Z){let{execSync:X}=await import("node:ch
|
|
|
6006
6006
|
${B}`;if(Y==="pnpm"&&B.includes("Unable to find the global bin directory"))M+=`
|
|
6007
6007
|
|
|
6008
6008
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
6009
|
-
npm install -g @sourcegraph/amp`;q(Error(M))}},error:(H)=>{if(!W)W=!0,q(Error(`Failed to spawn ${Y}: ${H.message}`))},complete:()=>{if(!W)W=!0,G()}})})}G0();G0();async function y51(J){try{let Z=new AbortController,X=setTimeout(()=>Z.abort(),5000),Y=await fetch("https://registry.npmjs.org/@sourcegraph/amp",{signal:Z.signal});if(clearTimeout(X),!Y.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await Y.json(),G=K["dist-tags"]?.latest;if(!G)return{hasUpdate:!1,currentVersion:J,source:"npm"};let q=q59(J,G),z=q<0,U,W;if(K.time){let F=K.time[J],H=K.time[G],B=Date.now();if(F)U=Math.floor((B-new Date(F).getTime())/3600000);if(H)W=Math.floor((B-new Date(H).getTime())/3600000)}return u.info("NPM version comparison",{currentVersion:J,latestVersion:G,compareResult:q,hasUpdate:z,currentVersionAge:U,latestVersionAge:W}),{hasUpdate:z,latestVersion:G,currentVersion:J,currentVersionAge:U,latestVersionAge:W,source:"npm"}}catch(Z){return u.debug("Error checking npm version",{error:Z}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function q59(J,Q){let Z=(G)=>{let[q,z]=G.split("-");return{parts:q?.split(".").map(Number)||[],label:z}},X=Z(J),Y=Z(Q),K=Math.max(X.parts.length,Y.parts.length);for(let G=0;G<K;G++){let q=X.parts[G]||0,z=Y.parts[G]||0;if(q<z)return-1;if(q>z)return 1}if(X.label===Y.label)return 0;if(!X.label&&Y.label)return 1;if(X.label&&!Y.label)return-1;if(X.label&&Y.label)return X.label<Y.label?-1:1;return 0}C0();function Kf1(J,Q){let Z=new f8,X=Z.pipe(M9({shouldCountRefs:!1}));return setImmediate(async()=>{let Y=new oq().scoped("update"),K=X.subscribe({next:(G)=>{Y.debug("emit new state",G)}});try{let G=process.env.AMP_TEST_UPDATE_STATUS;if(G){Y.debug("using fake update status for testing",{status:G}),await T_(500),Z.next(G);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){Y.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let q=await Q.get("updates.mode");if(q==="disabled"){Y.debug("checking disabled");return}Y.debug("checking",{currentVersion:J,mode:q});let z=await y51(J);if(!(z.latestVersion&&z.hasUpdate)){Y.debug("no update available");return}let U=await b51();if(!q)q=U==="pnpm"?"warn":"auto",Y.debug("no configured update mode; selected default based on package manager",{packageManager:U,mode:q});if(q==="warn"){Z.next("update-available");return}if(!U){Y.debug("auto-update not supported, falling back to warn mode"),Z.next("update-available");return}try{await tu(z.latestVersion,U);let W=await eV(z.latestVersion),F={from:z.currentVersion,to:z.latestVersion,...W};if(W.status==="same")Y.info("success",F),Z.next("updated");else Y.warn("success with warning",F),Z.next("updated-with-warning")}catch(W){Z.next("update-error")}}catch(G){Y.debug("check failed",{error:G})}finally{await T_(5000),Z.next("hidden"),K.unsubscribe(),Z.complete()}}),{state:X}}import{stderr as QW}from"node:process";function tZ6(J){let Q=new Mu().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await Zf1(X.force||!1,X.verbose||!1,"0.0.
|
|
6009
|
+
npm install -g @sourcegraph/amp`;q(Error(M))}},error:(H)=>{if(!W)W=!0,q(Error(`Failed to spawn ${Y}: ${H.message}`))},complete:()=>{if(!W)W=!0,G()}})})}G0();G0();async function y51(J){try{let Z=new AbortController,X=setTimeout(()=>Z.abort(),5000),Y=await fetch("https://registry.npmjs.org/@sourcegraph/amp",{signal:Z.signal});if(clearTimeout(X),!Y.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let K=await Y.json(),G=K["dist-tags"]?.latest;if(!G)return{hasUpdate:!1,currentVersion:J,source:"npm"};let q=q59(J,G),z=q<0,U,W;if(K.time){let F=K.time[J],H=K.time[G],B=Date.now();if(F)U=Math.floor((B-new Date(F).getTime())/3600000);if(H)W=Math.floor((B-new Date(H).getTime())/3600000)}return u.info("NPM version comparison",{currentVersion:J,latestVersion:G,compareResult:q,hasUpdate:z,currentVersionAge:U,latestVersionAge:W}),{hasUpdate:z,latestVersion:G,currentVersion:J,currentVersionAge:U,latestVersionAge:W,source:"npm"}}catch(Z){return u.debug("Error checking npm version",{error:Z}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function q59(J,Q){let Z=(G)=>{let[q,z]=G.split("-");return{parts:q?.split(".").map(Number)||[],label:z}},X=Z(J),Y=Z(Q),K=Math.max(X.parts.length,Y.parts.length);for(let G=0;G<K;G++){let q=X.parts[G]||0,z=Y.parts[G]||0;if(q<z)return-1;if(q>z)return 1}if(X.label===Y.label)return 0;if(!X.label&&Y.label)return 1;if(X.label&&!Y.label)return-1;if(X.label&&Y.label)return X.label<Y.label?-1:1;return 0}C0();function Kf1(J,Q){let Z=new f8,X=Z.pipe(M9({shouldCountRefs:!1}));return setImmediate(async()=>{let Y=new oq().scoped("update"),K=X.subscribe({next:(G)=>{Y.debug("emit new state",G)}});try{let G=process.env.AMP_TEST_UPDATE_STATUS;if(G){Y.debug("using fake update status for testing",{status:G}),await T_(500),Z.next(G);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){Y.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let q=await Q.get("updates.mode");if(q==="disabled"){Y.debug("checking disabled");return}Y.debug("checking",{currentVersion:J,mode:q});let z=await y51(J);if(!(z.latestVersion&&z.hasUpdate)){Y.debug("no update available");return}let U=await b51();if(!q)q=U==="pnpm"?"warn":"auto",Y.debug("no configured update mode; selected default based on package manager",{packageManager:U,mode:q});if(q==="warn"){Z.next("update-available");return}if(!U){Y.debug("auto-update not supported, falling back to warn mode"),Z.next("update-available");return}try{await tu(z.latestVersion,U);let W=await eV(z.latestVersion),F={from:z.currentVersion,to:z.latestVersion,...W};if(W.status==="same")Y.info("success",F),Z.next("updated");else Y.warn("success with warning",F),Z.next("updated-with-warning")}catch(W){Z.next("update-error")}}catch(G){Y.debug("check failed",{error:G})}finally{await T_(5000),Z.next("hidden"),K.unsubscribe(),Z.complete()}}),{state:X}}import{stderr as QW}from"node:process";function tZ6(J){let Q=new Mu().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await Zf1(X.force||!1,X.verbose||!1,"0.0.1761664990-gf5b267"),process.exit()});J.addCommand(Q,{hidden:!0});let Z=new Mu("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await z59(X.version)});J.addCommand(Z)}async function z59(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")QW.write(U8.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
6010
6010
|
|
|
6011
6011
|
`));try{if(!J){QW.write(U8.blue(`Checking for updates...
|
|
6012
|
-
`));let{hasUpdate:Z,latestVersion:X}=await y51("0.0.
|
|
6013
|
-
`));let Y=await eV("0.0.
|
|
6012
|
+
`));let{hasUpdate:Z,latestVersion:X}=await y51("0.0.1761664990-gf5b267");if(!Z){QW.write(U8.green(`✓ Amp CLI is already up to date.
|
|
6013
|
+
`));let Y=await eV("0.0.1761664990-gf5b267");if(Y.warning)QW.write(`
|
|
6014
6014
|
`+U8.yellow(Y.warning)+`
|
|
6015
6015
|
`);process.exit(0)}if(!X)QW.write(U8.yellow("[WARN] could not find latest version")),process.exit(0);J=X}QW.write(U8.blue(`Updating to version ${J}...
|
|
6016
6016
|
`)),await tu(J,void 0,(Z)=>{QW.write(U8.dim(`Running: ${Z}
|
|
@@ -6018,7 +6018,7 @@ Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm in
|
|
|
6018
6018
|
`));let Q=await eV(J);if(Q.warning)QW.write(`
|
|
6019
6019
|
`+U8.yellow(Q.warning)+`
|
|
6020
6020
|
`);process.exit(0)}catch(Q){let Z=Q instanceof Error?Q.message:String(Q);QW.write(U8.red.bold("Error: ")+Z+`
|
|
6021
|
-
`),process.exit(1)}}G0();EB();import{exec as U59}from"node:child_process";import{createServer as eZ6}from"node:http";import{platform as W59}from"node:os";import{createInterface as F59}from"node:readline";import{promisify as H59}from"node:util";var Gf1=H59(U59),RC=null;async function qf1(J=NZ,Q,Z=!0){let Y=`${J.endsWith("/")?J.slice(0,-1):J}/auth/cli-login?authToken=${encodeURIComponent(Q)}`;if(Z)RC=await B59(35789),u.info("Generated callback port",{port:RC}),Y=`${Y}&callbackPort=${encodeURIComponent(RC)}`;return Y}async function B59(J,Q=10){u.info("Finding available port",{startPort:J});for(let Z=0;Z<Q;Z++){let X=J+Z;try{return await new Promise((Y,K)=>{let G=eZ6();G.once("error",(q)=>{if(q.code==="EADDRINUSE")K(Error(`Port ${X} is in use`));else K(q)}),G.once("listening",()=>{G.close(()=>Y())}),G.listen(X,"127.0.0.1")}),u.info("Found available port",{port:X}),X}catch(Y){u.info("Port in use",{port:X,nextPort:X+1});continue}}throw Error(`Could not find an available port after ${Q} attempts`)}async function JX6(J=NZ,Q,Z){
|
|
6021
|
+
`),process.exit(1)}}G0();EB();import{exec as U59}from"node:child_process";import{createServer as eZ6}from"node:http";import{platform as W59}from"node:os";import{createInterface as F59}from"node:readline";import{promisify as H59}from"node:util";var Gf1=H59(U59),RC=null;async function qf1(J=NZ,Q,Z=!0){let Y=`${J.endsWith("/")?J.slice(0,-1):J}/auth/cli-login?authToken=${encodeURIComponent(Q)}`;if(Z)RC=await B59(35789),u.info("Generated callback port",{port:RC}),Y=`${Y}&callbackPort=${encodeURIComponent(RC)}`;return Y}async function B59(J,Q=10){u.info("Finding available port",{startPort:J});for(let Z=0;Z<Q;Z++){let X=J+Z;try{return await new Promise((Y,K)=>{let G=eZ6();G.once("error",(q)=>{if(q.code==="EADDRINUSE")K(Error(`Port ${X} is in use`));else K(q)}),G.once("listening",()=>{G.close(()=>Y())}),G.listen(X,"127.0.0.1")}),u.info("Found available port",{port:X}),X}catch(Y){u.info("Port in use",{port:X,nextPort:X+1});continue}}throw Error(`Could not find an available port after ${Q} attempts`)}async function JX6(J=NZ,Q,Z,X){try{let Y=D59(Q,X.signal),K=M59(Q,X.signal),G=await Promise.race([Y,K]);u.info("Received api key",{source:G.source}),await Z.set("apiKey",G.apiKey,J),u.info("API key stored successfully")}finally{X.abort(Error("close after finalizing login"))}}async function D59(J,Q,Z=300000){if(u.info("Starting local HTTP server to receive API key from browser"),!RC)throw Error("No port selected. Call generateLoginLink first.");let X=RC;return u.info("Callback server listening on port",{port:RC}),new Promise((Y,K)=>{let G=!1,q=eZ6((W,F)=>{if(F.setHeader("Access-Control-Allow-Origin","ampcode.com"),F.setHeader("Access-Control-Allow-Methods","GET"),W.url?.startsWith("/auth/callback")){let B=new URL(W.url,`http://127.0.0.1:${X}`),M=B.searchParams.get("apiKey");if(B.searchParams.get("authToken")!==J){K(Error("Invalid authentication token"));return}if(M){if(u.info("Received API key from server",{apiKey:M.substring(0,8)}),F.writeHead(200,{"Content-Type":"text/html"}),F.end(`
|
|
6022
6022
|
<!DOCTYPE html>
|
|
6023
6023
|
<html>
|
|
6024
6024
|
<head>
|
|
@@ -6047,7 +6047,7 @@ Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm in
|
|
|
6047
6047
|
<p>There was an error processing your login. Please try again.</p>
|
|
6048
6048
|
</body>
|
|
6049
6049
|
</html>
|
|
6050
|
-
`)}else F.writeHead(404),F.end()}),z=()=>{if(!G)q.close(),G=!0,K(Q.reason)};if(Q.aborted){z();return}else Q.addEventListener("abort",z,{once:!0});q.listen(X,"127.0.0.1",()=>{u.info("Listening for auth callback",{port:X})});let U=setTimeout(()=>{q.close(),G=!0,K(Error("Login timed out"))},Z);q.on("error",(W)=>{clearTimeout(U),G=!0,u.error("Callback server error",{error:W}),K(W)})})}async function M59(J,Q){let Z=await QX6("When prompted, paste your code here: ",Q),X,Y=Buffer.from(Z,"base64").toString("utf8");try{X=JSON.parse(Y)}catch(K){throw u.error("Failed to parse decoded JSON",{error:K}),Error("Failed to parse decoded authentication code")}if(X.token!==J)throw Error("Invalid auth token received from decoded authentication code");return{source:"terminal",apiKey:X.key}}async function zf1(J){try{let Q=(await QX6(J)).toLocaleLowerCase();return Q=="y"||Q=="yes"}catch(Q){if(Q instanceof Error&&Q.message=="Interrupt received")return!1;throw Q}}async function QX6(J,Q){let Z=F59({input:process.stdin,output:process.stdout});return new Promise((X,Y)=>{if(Q){let K=()=>{Z.close(),Y(Q.reason)};if(Q.aborted){K();return}else Q.addEventListener("abort",K,{once:!0})}Z.on("SIGINT",()=>{Z.close(),Y(Error("Interrupt received"))}),Z.question(J,{signal:Q},(K)=>{Z.close(),X(K.trim())})})}async function AY(J){try{let
|
|
6050
|
+
`)}else F.writeHead(404),F.end()}),z=()=>{if(!G)q.close(),G=!0,K(Q.reason)};if(Q.aborted){z();return}else Q.addEventListener("abort",z,{once:!0});q.listen(X,"127.0.0.1",()=>{u.info("Listening for auth callback",{port:X})});let U=setTimeout(()=>{q.close(),G=!0,K(Error("Login timed out"))},Z);q.on("error",(W)=>{clearTimeout(U),G=!0,u.error("Callback server error",{error:W}),K(W)})})}async function M59(J,Q){let Z=await QX6("When prompted, paste your code here: ",Q),X,Y=Buffer.from(Z,"base64").toString("utf8");try{X=JSON.parse(Y)}catch(K){throw u.error("Failed to parse decoded JSON",{error:K}),Error("Failed to parse decoded authentication code")}if(X.token!==J)throw Error("Invalid auth token received from decoded authentication code");return{source:"terminal",apiKey:X.key}}async function zf1(J){try{let Q=(await QX6(J)).toLocaleLowerCase();return Q=="y"||Q=="yes"}catch(Q){if(Q instanceof Error&&Q.message=="Interrupt received")return!1;throw Q}}async function QX6(J,Q){let Z=F59({input:process.stdin,output:process.stdout});return new Promise((X,Y)=>{if(Q){let K=()=>{Z.close(),Y(Q.reason)};if(Q.aborted){K();return}else Q.addEventListener("abort",K,{once:!0})}Z.on("SIGINT",()=>{Z.close(),Y(Error("Interrupt received"))}),Z.question(J,{signal:Q},(K)=>{Z.close(),X(K.trim())})})}async function AY(J,Q){try{let Z=W59(),X={timeout:5000,signal:Q};switch(Z){case"win32":await Gf1(`start "" "${J}"`,X);break;case"darwin":await Gf1(`open "${J}"`,X);break;default:await Gf1(`xdg-open "${J}"`,X);break}u.info("Opened browser with auth URL",{url:J})}catch(Z){throw u.error("Failed to open browser",{error:Z}),Z}}function YX6(J,Q){let Z=J.command("mcp").summary("Manage MCP servers").description("Add and manage MCP server configuration under amp.mcpServers");Z.command("add <name> [args...]").summary("Add an MCP server configuration").description(`Add an MCP server to amp.mcpServers in the Amp CLI settings file.
|
|
6051
6051
|
|
|
6052
6052
|
Usage:
|
|
6053
6053
|
amp mcp add <name> -- <command> [args...] (local MCP server, started with command)
|
|
@@ -6382,7 +6382,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||XO}function fX6(J,Q){let
|
|
|
6382
6382
|
`);J.command("use").argument("<tool-name>","The tool to invoke").summary("Invoke a tool with arguments or JSON input from stdin").description(Z).option("--only <field>","Extract only the specified field from the result").allowUnknownOption(!0).allowExcessArguments(!0).action(async function(X,Y,K){let G=K.optsWithGlobals(),q=await Q(K,G),z=0;await q.mcpService.initialized;let U=K.args.slice(1),W;if(bX6()){let F=[];for await(let H of process.stdin)F.push(H);W=Buffer.concat(F).toString("utf-8").trim()}await _X6({toolName:X,rawArgs:U,stdinInput:W,only:Y.only,threadDeps:q,stdout:process.stdout,stderr:process.stderr,exit:(F)=>{z=F}}),await q.asyncDispose(),q.cleanupTerminal(),process.exit(z)})}import{randomBytes as SH9}from"node:crypto";import{homedir as vH9}from"node:os";import Fd from"node:path";C0();G0();var hX6=120000,gX6=180000;function Bf1(J,Q=Date.now()){return Q-J<gX6}function Df1(J,Q,Z=()=>!0,X){let Y=null,K=[],G=5;return _N(t1.of(void 0),xd(hX6).pipe(P7(()=>Z()))).pipe(q8(()=>d6(async(q)=>{let z=await X?.getContext();u.debug("[Ads] Fetching ad from server",{hasContext:!!z});let U=await J.getCurrentAd({context:z,excludeAdIds:K},{config:Q,signal:q});if(!U.ok)throw u.error("[Ads] Failed to fetch ad",{error:U.error.message}),Error(U.error.message);if(U.result){if(Y=U.result,K.length>=G)K.shift();K.push(Y.id),u.debug("[Ads] Received ad from server",{adTitle:Y.title,matchType:Y.matchType,matchedPatterns:Y.matchedPatterns,candidateAdPoolCount:Y.candidateAdPoolCount,recentlyShownCount:K.length})}else u.debug("[Ads] No ad available from server");return Y})),J8((q,z)=>q?.id===z?.id))}G0();ij();z2();eB();t9();$L();z8();v6();function mX6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}function uX6(J,Q,Z){if(J.agentMode)return J.agentMode;if(Q?.agentMode){let X=Q.agentMode;if(X==="free"){if(Z?.canUseAmpFree??!1)return"free";return"smart"}return X}return"smart"}G0();eB();import bJ9 from"node:fs";import pX6 from"node:path";function dX6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!pX6.isAbsolute(Q))return null;return u.debug("Extracted image path",{original:J,extracted:Q}),Q}function cX6(J){try{let Q=pX6.extname(J).toLowerCase(),Z=$10(Q);if(!Z)return u.warn("Unsupported image file extension",{ext:Q}),null;try{let X=bJ9.readFileSync(J);return yJ9(X,Z)}catch(X){u.error(`Failed to read image file ${J}:`,X)}}catch(Q){u.error("Error handling image file path",{imagePath:J,error:Q})}return null}function yJ9(J,Q){if(J.length===0)return u.warn("Image file is empty (0 bytes)"),null;if(J.length>_W)return u.warn(`Image file too large: ${J.length} bytes (max: ${_W})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as SK9}from"node:child_process";Hj();G0();import{spawn as fJ9}from"node:child_process";import{promises as hJ9}from"node:fs";function lX6(J){return J.kind==="executable"}function iX6(J){return J.kind==="markdown"}var tH=50000,nX6=300000;async function Qp(J,Q,Z,X={}){let{timeoutMs:Y=nX6,signal:K}=X;try{let G=await Z.getCommand(J);if(!G)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(u.debug("Executing command",{commandName:J,filePath:G.filePath,args:Q}),iX6(G))return await gJ9(G,Q);else if(lX6(G))return await mJ9(G,Q,Y,K);else return{success:!1,output:"",error:"Unsupported command type"}}catch(G){return u.error("Failed to execute command",{commandName:J,error:G}),{success:!1,output:"",error:G instanceof Error?G.message:"Unknown error occurred"}}}async function gJ9(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await hJ9.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>tH?Z.slice(0,tH)+`
|
|
6383
6383
|
... (output truncated at ${tH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function mJ9(J,Q,Z=nX6,X){return new Promise((Y)=>{let[K,G]=uJ9(J,Q);u.debug("Spawning command",{spawnCommand:K,spawnArgs:G.slice(0,10),filePath:J.filePath,timeoutMs:Z});let q=N10(X),z=!1,U=setTimeout(()=>{z=!0,q.abort(),u.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),W=fJ9(K,G,{stdio:["pipe","pipe","pipe"],signal:q.signal,detached:!0}),F=[],H=[],B=0;W.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=tH)F.push(V);else{let N=tH-(B-V.length);if(N>0)F.push(V.slice(0,N))}}),W.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=tH)H.push(V);else{let N=tH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),W.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:F.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(q.signal.aborted){Y({success:!1,output:F.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=F.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
|
|
6384
6384
|
${L}`:L;if(B>tH)A+=`
|
|
6385
|
-
... (output truncated at ${tH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function uJ9(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return dJ9(Z,X?[...X]:null,Y,Q);else return pJ9(Z,X?[...X]:null,Y,Q)}function pJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function dJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}G0();ij();z2();AW();pX();$z();v6();C0();var d51={};R6(d51,{scrollUp:()=>UQ9,scrollDown:()=>WQ9,link:()=>VQ9,image:()=>NQ9,iTerm:()=>LQ9,exitAlternativeScreen:()=>DQ9,eraseUp:()=>zQ9,eraseStartLine:()=>GQ9,eraseScreen:()=>Mf1,eraseLines:()=>YQ9,eraseLine:()=>oX6,eraseEndLine:()=>KQ9,eraseDown:()=>qQ9,enterAlternativeScreen:()=>BQ9,cursorUp:()=>rX6,cursorTo:()=>iJ9,cursorShow:()=>XQ9,cursorSavePosition:()=>oJ9,cursorRestorePosition:()=>tJ9,cursorPrevLine:()=>QQ9,cursorNextLine:()=>JQ9,cursorMove:()=>nJ9,cursorLeft:()=>sX6,cursorHide:()=>ZQ9,cursorGetPosition:()=>eJ9,cursorForward:()=>rJ9,cursorDown:()=>aJ9,cursorBackward:()=>sJ9,clearTerminal:()=>HQ9,clearScreen:()=>FQ9,beep:()=>MQ9});import Vf1 from"node:process";var p51=globalThis.window?.document!==void 0,iw2=globalThis.process?.versions?.node!==void 0,nw2=globalThis.process?.versions?.bun!==void 0,aw2=globalThis.Deno?.version?.deno!==void 0,rw2=globalThis.process?.versions?.electron!==void 0,sw2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,ow2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,tw2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,ew2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,JR2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Zp=globalThis.navigator?.userAgentData?.platform,QR2=Zp==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",ZR2=Zp==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",XR2=Zp==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",YR2=Zp==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),KR2=Zp==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var R2="\x1B[",Yp="\x1B]",$C="\x07",Xp=";",aX6=!p51&&Vf1.env.TERM_PROGRAM==="Apple_Terminal",cJ9=!p51&&Vf1.platform==="win32",lJ9=p51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Vf1.cwd,iJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return R2+(J+1)+"G";return R2+(Q+1)+Xp+(J+1)+"H"},nJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=R2+-J+"D";else if(J>0)Z+=R2+J+"C";if(Q<0)Z+=R2+-Q+"A";else if(Q>0)Z+=R2+Q+"B";return Z},rX6=(J=1)=>R2+J+"A",aJ9=(J=1)=>R2+J+"B",rJ9=(J=1)=>R2+J+"C",sJ9=(J=1)=>R2+J+"D",sX6=R2+"G",oJ9=aX6?"\x1B7":R2+"s",tJ9=aX6?"\x1B8":R2+"u",eJ9=R2+"6n",JQ9=R2+"E",QQ9=R2+"F",ZQ9=R2+"?25l",XQ9=R2+"?25h",YQ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=oX6+(Z<J-1?rX6():"");if(J)Q+=sX6;return Q},KQ9=R2+"K",GQ9=R2+"1K",oX6=R2+"2K",qQ9=R2+"J",zQ9=R2+"1J",Mf1=R2+"2J",UQ9=R2+"S",WQ9=R2+"T",FQ9="\x1Bc",HQ9=cJ9?`${Mf1}${R2}0f`:`${Mf1}${R2}3J${R2}H`,BQ9=R2+"?1049h",DQ9=R2+"?1049l",MQ9=$C,VQ9=(J,Q)=>[Yp,"8",Xp,Xp,Q,$C,J,Yp,"8",Xp,Xp,$C].join(""),NQ9=(J,Q={})=>{let Z=`${Yp}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+$C},LQ9={setCwd:(J=lJ9())=>`${Yp}50;CurrentDir=${J}${$C}`,annotation(J,Q={}){let Z=`${Yp}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+$C}};var c51=S6(YY6(),1);function ZN(J,Q,{target:Z="stdout",...X}={}){if(!c51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return d51.link(J,Q)}ZN.isSupported=c51.default.stdout;ZN.stderr=(J,Q,Z={})=>ZN(J,Q,{target:"stderr",...Z});ZN.stderr.isSupported=c51.default.stderr;G0();pX();class Kp{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1761663433-g06cac3"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await $a(Q,this.configService)}catch(Q){u.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as i51}from"node:child_process";import{platform as Rf1}from"node:os";import{promisify as OQ9}from"node:util";var l51=OQ9(i51),jQ9=(J)=>`\x1B]52;c;${J}\x1B\\`,$Q9="\x1B]52;c;?\x1B\\",EQ9="\x1B]52;p;?\x1B\\";class KY6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await l51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=i51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=i51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=i51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery($Q9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await l51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await l51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await l51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(EQ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Rf1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Rf1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=jQ9(Z);process.stdout.write(X);return}if(Rf1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var wY=new KY6;G0();class q2{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function n51(J){if(J instanceof q2)return{title:"Info",description:J.message,type:"info"};return u.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var UN=null,vK9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(UN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (N51(),yy1)),G=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{UN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});UN=G,G.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{UN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,W=new URL(`/threads/${U}`,z).toString(),F=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => S6(Vp(),1))).toString(W,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){u.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:F,qrCode:H});else return new q2(`Continue at ${F}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!UN)return new q2("Not connected to Amp web interface");try{UN.disconnect();let Z=UN.clientID;return UN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new q2(`Disconnected from Amp web interface
|
|
6385
|
+
... (output truncated at ${tH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function uJ9(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return dJ9(Z,X?[...X]:null,Y,Q);else return pJ9(Z,X?[...X]:null,Y,Q)}function pJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function dJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}G0();ij();z2();AW();pX();$z();v6();C0();var d51={};R6(d51,{scrollUp:()=>UQ9,scrollDown:()=>WQ9,link:()=>VQ9,image:()=>NQ9,iTerm:()=>LQ9,exitAlternativeScreen:()=>DQ9,eraseUp:()=>zQ9,eraseStartLine:()=>GQ9,eraseScreen:()=>Mf1,eraseLines:()=>YQ9,eraseLine:()=>oX6,eraseEndLine:()=>KQ9,eraseDown:()=>qQ9,enterAlternativeScreen:()=>BQ9,cursorUp:()=>rX6,cursorTo:()=>iJ9,cursorShow:()=>XQ9,cursorSavePosition:()=>oJ9,cursorRestorePosition:()=>tJ9,cursorPrevLine:()=>QQ9,cursorNextLine:()=>JQ9,cursorMove:()=>nJ9,cursorLeft:()=>sX6,cursorHide:()=>ZQ9,cursorGetPosition:()=>eJ9,cursorForward:()=>rJ9,cursorDown:()=>aJ9,cursorBackward:()=>sJ9,clearTerminal:()=>HQ9,clearScreen:()=>FQ9,beep:()=>MQ9});import Vf1 from"node:process";var p51=globalThis.window?.document!==void 0,iw2=globalThis.process?.versions?.node!==void 0,nw2=globalThis.process?.versions?.bun!==void 0,aw2=globalThis.Deno?.version?.deno!==void 0,rw2=globalThis.process?.versions?.electron!==void 0,sw2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,ow2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,tw2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,ew2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,JR2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Zp=globalThis.navigator?.userAgentData?.platform,QR2=Zp==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",ZR2=Zp==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",XR2=Zp==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",YR2=Zp==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),KR2=Zp==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var R2="\x1B[",Yp="\x1B]",$C="\x07",Xp=";",aX6=!p51&&Vf1.env.TERM_PROGRAM==="Apple_Terminal",cJ9=!p51&&Vf1.platform==="win32",lJ9=p51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Vf1.cwd,iJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return R2+(J+1)+"G";return R2+(Q+1)+Xp+(J+1)+"H"},nJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=R2+-J+"D";else if(J>0)Z+=R2+J+"C";if(Q<0)Z+=R2+-Q+"A";else if(Q>0)Z+=R2+Q+"B";return Z},rX6=(J=1)=>R2+J+"A",aJ9=(J=1)=>R2+J+"B",rJ9=(J=1)=>R2+J+"C",sJ9=(J=1)=>R2+J+"D",sX6=R2+"G",oJ9=aX6?"\x1B7":R2+"s",tJ9=aX6?"\x1B8":R2+"u",eJ9=R2+"6n",JQ9=R2+"E",QQ9=R2+"F",ZQ9=R2+"?25l",XQ9=R2+"?25h",YQ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=oX6+(Z<J-1?rX6():"");if(J)Q+=sX6;return Q},KQ9=R2+"K",GQ9=R2+"1K",oX6=R2+"2K",qQ9=R2+"J",zQ9=R2+"1J",Mf1=R2+"2J",UQ9=R2+"S",WQ9=R2+"T",FQ9="\x1Bc",HQ9=cJ9?`${Mf1}${R2}0f`:`${Mf1}${R2}3J${R2}H`,BQ9=R2+"?1049h",DQ9=R2+"?1049l",MQ9=$C,VQ9=(J,Q)=>[Yp,"8",Xp,Xp,Q,$C,J,Yp,"8",Xp,Xp,$C].join(""),NQ9=(J,Q={})=>{let Z=`${Yp}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+$C},LQ9={setCwd:(J=lJ9())=>`${Yp}50;CurrentDir=${J}${$C}`,annotation(J,Q={}){let Z=`${Yp}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+$C}};var c51=S6(YY6(),1);function ZN(J,Q,{target:Z="stdout",...X}={}){if(!c51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return d51.link(J,Q)}ZN.isSupported=c51.default.stdout;ZN.stderr=(J,Q,Z={})=>ZN(J,Q,{target:"stderr",...Z});ZN.stderr.isSupported=c51.default.stderr;G0();pX();class Kp{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1761664990-gf5b267"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await $a(Q,this.configService)}catch(Q){u.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as i51}from"node:child_process";import{platform as Rf1}from"node:os";import{promisify as OQ9}from"node:util";var l51=OQ9(i51),jQ9=(J)=>`\x1B]52;c;${J}\x1B\\`,$Q9="\x1B]52;c;?\x1B\\",EQ9="\x1B]52;p;?\x1B\\";class KY6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await l51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=i51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=i51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=i51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery($Q9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await l51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await l51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await l51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(EQ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Rf1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Rf1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=jQ9(Z);process.stdout.write(X);return}if(Rf1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var wY=new KY6;G0();class q2{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function n51(J){if(J instanceof q2)return{title:"Info",description:J.message,type:"info"};return u.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var UN=null,vK9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(UN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (N51(),yy1)),G=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{UN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});UN=G,G.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{UN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,W=new URL(`/threads/${U}`,z).toString(),F=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => S6(Vp(),1))).toString(W,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){u.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:F,qrCode:H});else return new q2(`Continue at ${F}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!UN)return new q2("Not connected to Amp web interface");try{UN.disconnect();let Z=UN.clientID;return UN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new q2(`Disconnected from Amp web interface
|
|
6386
6386
|
Client ID: ${Z}
|
|
6387
6387
|
Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class Mh1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=MS(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new Kp(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(x0((Z)=>MZ(Z.settings)),J8()).subscribe((Z)=>{this._initBaseCommands(Z.length>1)})}_initBaseCommands(J){if(this.commands={...kK9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,vK9);if(J)Object.assign(this.commands,_K9)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((q)=>{u.debug("Failed to submit command telemetry",q)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((q)=>q.name===J),G=await Qp(J,Z,this.customRegistry,{signal:X});if(G.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:G.output});return}else{Q.submitMessage(G.output);return}return Error(G.error??`Command '${J}' failed`)}query(J,Q,Z){let X=Object.values(this.commands).filter((K)=>{if(!Q||!K.isVisible)return!0;return K.isVisible(Q,Z)}),Y=this.latestCustom.filter((K)=>K.available).map((K)=>({name:K.name,description:"Custom command",requiresArgs:K.kind==="executable",execute:(G,q)=>this.execute(K.name,G,q??[])}));return[...X,...Y]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}getCustomCommand(J){return this.latestCustom.find((Q)=>Q.name===J)}}var kK9={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${_5} file in the current workspace`,execute:async(J,Q)=>{let Z=await J.configService.getLatest(),X=yZ(Z.settings),K=J.getInMemoryAgentModeOverride()??X;J.worker.handle({type:"user:message",message:{content:[{type:"text",text:Ia}],agentMode:K}});return}},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{return J.openInEditor("")}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return VZ("dangerouslyAllowAll",!1),new q2("Amp is now following permissions rules for this session")}catch(K){return u.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return VZ("dangerouslyAllowAll",!0),new q2("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return u.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await ZW();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw u.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:ZW};await OC(Y);return}catch(Y){u.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return u.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},handoff:{name:"handoff",description:"Draft a new thread with relevant context from current thread: /handoff <your goal>",requiresArgs:!0,execute:async()=>{return},isVisible:(J)=>J.messages.length!==0},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new q2(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return u.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((q)=>q.type==="text").map((q)=>q.text).join("").trim()}).filter(Boolean).join(`
|
|
6388
6388
|
`).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=nW(new URL(Y),Z.id).toString(),q=`Thread URL: ${ZN(K,K,{fallback:()=>K})}`,z=Q[0]?.trim().toLowerCase(),U;switch(z){case"private":U={visibility:"private",sharedGroupIDs:[]};break;case"workspace":U={visibility:"thread_workspace_shared"};break;case"group":U={visibility:"private",sharedGroupIDs:[],shareWithAllCreatorGroups:!0};break;case"public":U={visibility:"public_unlisted"};break;default:return Error(`Invalid visibility option: ${z}. Use: private, workspace, group, or public`)}try{return await X.updateThreadMeta(Z.id,U),new q2(`${q}
|
|
@@ -6406,18 +6406,18 @@ These two directives are mutually exclusive. If a parent is to shrink-wrap its c
|
|
|
6406
6406
|
|
|
6407
6407
|
Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible children (using Flexible rather than Expanded). This will allow the flexible children to size themselves to less than the infinite remaining space they would otherwise be forced to take, and then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum constraints provided by the parent.`)}}if(W>0){let M=U/W,V=0;for(let N=0;N<Z.length;N++){let{child:L,flex:A,fit:w}=Z[N],R;if(N===Z.length-1)R=U-V;else R=Math.floor(M*A),V+=R;let O=Q?J.maxHeight:J.maxWidth,j=Q?w==="tight"?new w6(R,R,0,O):w6.loose(R,O):w==="tight"?new w6(0,O,R,R):w6.loose(O,R);if(L.layout(j),Q)K=Math.max(K,L.size.height);else K=Math.max(K,L.size.width)}}let H=Y+(W>0?U:0);if(Q){let M=this._mainAxisSize==="min"||J.maxWidth===1/0?Ep(H,J.minWidth,J.maxWidth):Math.max(J.minWidth,J.maxWidth),V=Ep(K,J.minHeight,J.maxHeight);this.setSize(mu(M,J.minWidth),mu(V,J.minHeight))}else{let M=this._mainAxisSize==="min"||J.maxHeight===1/0?Ep(H,J.minHeight,J.maxHeight):Math.max(J.minHeight,J.maxHeight),V=Ep(K,J.minWidth,J.maxWidth);this.setSize(mu(V,J.minWidth),mu(M,J.minHeight))}let B=Q?this.size.height:this.size.width;this.positionChildren(Q,B,J)}positionChildren(J,Q,Z){let X=this.children;if(X.length===0)return;let Y=0;for(let W of X)Y+=J?W.size.width:W.size.height;let K=J?this.size.width:this.size.height,G=Math.max(0,K-Y),q=0,z=0;switch(this._mainAxisAlignment){case"start":q=0;break;case"end":q=G;break;case"center":q=G/2;break;case"spaceBetween":z=X.length>1?Math.floor(G/(X.length-1)):0;break;case"spaceAround":z=X.length>0?G/X.length:0,q=z/2;break;case"spaceEvenly":z=X.length>0?Math.floor(G/(X.length+1)):0,q=z;break}let U=q;for(let W=0;W<X.length;W++){let F=X[W],H=J?F.size.width:F.size.height,B=J?F.size.height:F.size.width,M=0;switch(this._crossAxisAlignment){case"start":M=0;break;case"end":M=Q-B;break;case"center":M=(Q-B)/2;break;case"stretch":M=0;break;case"baseline":if(!J)throw Error("CrossAxisAlignment.baseline is only supported for horizontal flex (Row)");M=0;break}if(J)F.setOffset(U,M);else F.setOffset(M,U);if(U+=H,W<X.length-1)U+=z}}getMinIntrinsicWidth(J){let Q=this._direction==="horizontal",Z=this.children;if(Q){let X=0,Y=0,K=0;for(let G of Z){let z=G.parentData?.flex??0;if(z>0){Y+=z;let U=G.getMinIntrinsicWidth(J)/z;K=Math.max(K,U)}else X+=G.getMinIntrinsicWidth(J)}return X+K*Y}else{let X=0;for(let Y of Z)X=Math.max(X,Y.getMinIntrinsicWidth(J));return X}}getMaxIntrinsicWidth(J){let Q=this._direction==="horizontal",Z=this.children;if(Q){let X=0,Y=0,K=0;for(let G of Z){let z=G.parentData?.flex??0;if(z>0){Y+=z;let U=G.getMaxIntrinsicWidth(J)/z;K=Math.max(K,U)}else X+=G.getMaxIntrinsicWidth(J)}return X+K*Y}else{let X=0;for(let Y of Z)X=Math.max(X,Y.getMaxIntrinsicWidth(J));return X}}getMaxIntrinsicHeight(J){let Q=this._direction==="horizontal",Z=this.children;if(Q){let X=0,Y=0,K=[],G=[];for(let U of Z){let W=U.parentData;if(W&&W.flex>0)Y+=W.flex,G.push({child:U,flex:W.flex});else K.push(U)}let q=0;for(let U of K)q+=U.getMaxIntrinsicWidth(0);let z=Math.max(0,J-q);for(let U of Z){let W=U.parentData,F=J;if(W&&W.flex>0&&Y>0)F=z/Y*W.flex;X=Math.max(X,U.getMaxIntrinsicHeight(F))}return X}else{let X=0,Y=0,K=0;for(let G of Z){let z=G.parentData?.flex??0;if(z>0){Y+=z;let U=G.getMaxIntrinsicHeight(J)/z;K=Math.max(K,U)}else X+=G.getMaxIntrinsicHeight(J)}return X+K*Y}}getMinIntrinsicHeight(J){let Q=this._direction==="horizontal",Z=this.children;if(Q){let X=0,Y=0,K=[],G=[];for(let U of Z){let W=U.parentData;if(W&&W.flex>0)Y+=W.flex,G.push(U);else K.push(U)}let q=0;for(let U of K)q+=U.getMinIntrinsicWidth(0);let z=Math.max(0,J-q);for(let U of Z){let W=U.parentData,F=J;if(W&&W.flex>0&&Y>0)F=z/Y*W.flex;X=Math.max(X,U.getMinIntrinsicHeight(F))}return X}else{let X=0,Y=0,K=0;for(let G of Z){let z=G.parentData?.flex??0;if(z>0){Y+=z;let U=G.getMinIntrinsicHeight(J)/z;K=Math.max(K,U)}else X+=G.getMinIntrinsicHeight(J)}return X+K*Y}}dispose(){this._direction="vertical",this._mainAxisAlignment="start",this._crossAxisAlignment="start",this._mainAxisSize="min",super.dispose()}}class i0 extends Tp{constructor({key:J,children:Q=[],mainAxisAlignment:Z="start",crossAxisAlignment:X="center",mainAxisSize:Y="max"}={}){super({...J?{key:J}:{},direction:"vertical",children:Q,mainAxisAlignment:Z,crossAxisAlignment:X,mainAxisSize:Y})}static start(J){return new i0({children:J,mainAxisAlignment:"start"})}static center(J){return new i0({children:J,mainAxisAlignment:"center"})}static end(J){return new i0({children:J,mainAxisAlignment:"end"})}static spaceBetween(J){return new i0({children:J,mainAxisAlignment:"spaceBetween"})}static spaceAround(J){return new i0({children:J,mainAxisAlignment:"spaceAround"})}static spaceEvenly(J){return new i0({children:J,mainAxisAlignment:"spaceEvenly"})}}b2();G9();class i8{color;border;constructor(J,Q){this.color=J;this.border=Q}}class x8{top;right;bottom;left;constructor(J,Q,Z,X){this.top=J;this.right=Q;this.bottom=Z;this.left=X}static all(J){return new x8(J,J,J,J)}static symmetric(J,Q){return new x8(Q,J,Q,J)}}class w8{color;width;style;constructor(J=E1.black,Q=1,Z="rounded"){this.color=J;this.width=Q;this.style=Z}}class y0 extends R4{width;height;padding;margin;decoration;constraints;constructor({key:J,child:Q,width:Z,height:X,padding:Y,margin:K,decoration:G,constraints:q}={}){super({...J?{key:J}:{},...Q?{child:Q}:{}});this.width=Z,this.height=X,this.padding=Y,this.margin=K,this.decoration=G,this.constraints=q}createRenderObject(){return new HJ1(this.width,this.height,this.padding,this.margin,this.decoration,this.constraints)}updateRenderObject(J){if(!(J instanceof HJ1))throw Error("renderObject must be an instance of ContainerRenderObject");J.updateProperties(this.width,this.height,this.padding,this.margin,this.decoration,this.constraints)}}class HJ1 extends Z8{_width;_height;_padding;_margin;_decoration;_constraints;constructor(J,Q,Z,X,Y,K){super();this._width=J;this._height=Q;this._padding=Z;this._margin=X;this._decoration=Y;this._constraints=K}updateProperties(J,Q,Z,X,Y,K){this._width=J,this._height=Q,this._padding=Z,this._margin=X,this._decoration=Y,this._constraints=K,this.markNeedsLayout(),this.markNeedsPaint()}performLayout(){super.performLayout();let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this._margin?.horizontal??0,Z=this._margin?.vertical??0,X=this._padding?.horizontal??0,Y=this._padding?.vertical??0,K=this._decoration?.border,G=(K?.left?1:0)+(K?.right?1:0),q=(K?.top?1:0)+(K?.bottom?1:0);this.sendDebugData({margin:this._margin,padding:this._padding,decoration:this._decoration,width:this._width,height:this._height,constraints:this._constraints});let z=this._width!==void 0||this._height!==void 0?this._constraints?.tighten({width:this._width,height:this._height})??w6.tightFor({width:this._width,height:this._height}):this._constraints,U=z?J.enforce(z):J,W=U.maxWidth-Q-X-G,F=U.maxHeight-Z-Y-q,H=new w6(Math.max(0,U.minWidth-Q-X-G),Math.max(0,W),Math.max(0,U.minHeight-Z-Y-q),Math.max(0,F)),B,M;if(this.children.length>0){let L=this.children[0];if(!(L instanceof Z8))throw Error("Child must be a RenderBox");L.layout(H),B=L.size.width,M=L.size.height;let A=K?.left?1:0,w=K?.top?1:0,R=(this._margin?.left??0)+A+(this._padding?.left??0),O=(this._margin?.top??0)+w+(this._padding?.top??0);L.setOffset(R,O)}else if(H.maxWidth!==1/0&&H.maxHeight!==1/0)B=H.maxWidth,M=H.maxHeight;else B=H.minWidth,M=H.minHeight;let V,N;if(U.minWidth===U.maxWidth&&isFinite(U.maxWidth))V=U.maxWidth;else V=B+X+G+Q;if(U.minHeight===U.maxHeight&&isFinite(U.maxHeight))N=U.maxHeight;else N=M+Y+q+Z;this.setSize(U.constrain(V,N).width,U.constrain(V,N).height)}getMinIntrinsicWidth(J){if(this._width!==void 0)return this._width;if(this._constraints&&this._constraints.minWidth!==0)return this._constraints.minWidth;let Q=this._margin?.horizontal??0,Z=this._padding?.horizontal??0,X=this._decoration?.border,Y=(X?.left?1:0)+(X?.right?1:0),K=0;if(this.children.length>0){let G=this.children[0],q=Math.max(0,J-(this._margin?.vertical??0)-(this._padding?.vertical??0)-((X?.top?1:0)+(X?.bottom?1:0)));K=G.getMinIntrinsicWidth(q)}return K+Q+Z+Y}getMaxIntrinsicWidth(J){if(this._width!==void 0)return this._width;if(this._constraints&&this._constraints.maxWidth!==1/0)return this._constraints.maxWidth;let Q=this._margin?.horizontal??0,Z=this._padding?.horizontal??0,X=this._decoration?.border,Y=(X?.left?1:0)+(X?.right?1:0),K=0;if(this.children.length>0){let G=this.children[0],q=Math.max(0,J-(this._margin?.vertical??0)-(this._padding?.vertical??0)-((X?.top?1:0)+(X?.bottom?1:0)));K=G.getMaxIntrinsicWidth(q)}if(K===1/0)return 1/0;return K+Q+Z+Y}getMinIntrinsicHeight(J){if(this._height!==void 0)return this._height;if(this._constraints&&this._constraints.minHeight!==0)return this._constraints.minHeight;let Q=this._margin?.vertical??0,Z=this._padding?.vertical??0,X=this._decoration?.border,Y=(X?.top?1:0)+(X?.bottom?1:0),K=0;if(this.children.length>0){let q=this.children[0],z=Math.max(0,J-(this._margin?.horizontal??0)-(this._padding?.horizontal??0)-((X?.left?1:0)+(X?.right?1:0)));K=q.getMinIntrinsicHeight(z)}let G=K+Q+Z+Y;if(this._constraints&&this._constraints.maxHeight!==1/0)return Math.min(G,this._constraints.maxHeight);return G}getMaxIntrinsicHeight(J){if(this._height!==void 0)return this._height;if(this._constraints&&this._constraints.maxHeight!==1/0)return this._constraints.maxHeight;let Q=this._margin?.vertical??0,Z=this._padding?.vertical??0,X=this._decoration?.border,Y=(X?.top?1:0)+(X?.bottom?1:0),K=0;if(this.children.length>0){let G=this.children[0],q=Math.max(0,J-(this._margin?.horizontal??0)-(this._padding?.horizontal??0)-((X?.left?1:0)+(X?.right?1:0)));K=G.getMaxIntrinsicHeight(q)}if(K===1/0)return 1/0;return K+Q+Z+Y}paint(J,Q=0,Z=0){let X=Math.floor(Q+this.offset.x),Y=Math.floor(Z+this.offset.y);if(this._decoration?.color){let K={bg:this._decoration.color};J.fill(X,Y,this.size.width,this.size.height," ",K)}if(this._decoration?.border)this._paintBorder(J,X,Y);super.paint(J,Q,Z)}_paintBorder(J,Q,Z){let X=this._decoration.border,Y=this.size.width,K=this.size.height,G=(H)=>{switch(H){case 1:return"─";case 2:return"━";case 3:return"━";default:return"━"}},q=(H)=>{switch(H){case 1:return"│";case 2:return"┃";case 3:return"┃";default:return"┃"}},z=(H,B)=>{if(H===1)return B?{tl:"╭",tr:"╮",bl:"╰",br:"╯"}:{tl:"┌",tr:"┐",bl:"└",br:"┘"};else return B?{tl:"╭",tr:"╮",bl:"╰",br:"╯"}:{tl:"┏",tr:"┓",bl:"┗",br:"┛"}};if(X.top){let H={fg:X.top.color},B=G(X.top.width);for(let M=0;M<Y;M++)J.setChar(Q+M,Z,B,H,1)}if(X.bottom){let H={fg:X.bottom.color},B=G(X.bottom.width);for(let M=0;M<Y;M++)J.setChar(Q+M,Z+K-1,B,H,1)}if(X.left){let H={fg:X.left.color},B=q(X.left.width);for(let M=0;M<K;M++)J.setChar(Q,Z+M,B,H,1)}if(X.right){let H={fg:X.right.color},B=q(X.right.width);for(let M=0;M<K;M++)J.setChar(Q+Y-1,Z+M,B,H,1)}let U=X.top?.style==="rounded",W=Math.max(X.top?.width??1,X.right?.width??1,X.bottom?.width??1,X.left?.width??1),F=z(W,U);if(X.top&&X.left){let H={fg:X.top.color};J.setChar(Q,Z,F.tl,H,1)}if(X.top&&X.right){let H={fg:X.top.color};J.setChar(Q+Y-1,Z,F.tr,H,1)}if(X.bottom&&X.left){let H={fg:X.bottom.color};J.setChar(Q,Z+K-1,F.bl,H,1)}if(X.bottom&&X.right){let H={fg:X.bottom.color};J.setChar(Q+Y-1,Z+K-1,F.br,H,1)}}hitTest(J,Q,Z=0,X=0){return super.hitTest(J,Q,Z,X)}_getBorderWidth(){let J=this._decoration?.border;if(!J)return 0;let Q=[J.top,J.right,J.bottom,J.left].filter((Z)=>Z!==void 0);return Q.length>0?Math.max(...Q.map((Z)=>Z.width)):0}dispose(){this._decoration=void 0,this._constraints=void 0,this._padding=void 0,this._margin=void 0,super.dispose()}}sH();class Cp extends DQ{child;constructor(J,Q){super(Q);this.child=J}createElement(){return new eG6(this)}}class eG6 extends LY{_child;constructor(J){super(J)}get parentDataWidget(){return this.widget}get child(){return this._child}get renderObject(){return this._child?.renderObject}mount(){this._child=this.parentDataWidget.child.createElement(),this.addChild(this._child),this._child.mount(),this._applyParentData()}unmount(){if(this._child)this._child.unmount(),this.removeChild(this._child),this._child=void 0;super.unmount()}update(J){super.update(J);let Q=J;if(this._child)if(this._child.widget.canUpdate(Q.child))this._child.update(Q.child);else this._child.unmount(),this.removeChild(this._child),this._child=Q.child.createElement(),this.addChild(this._child),this._child.mount();else this._child=Q.child.createElement(),this.addChild(this._child),this._child.mount();this._applyParentData()}performRebuild(){this._applyParentData()}_applyParentData(){let J=this._child;if(!J)return;let Q=J.renderObject;if(!Q)return;if(!this.parentDataWidget.debugIsValidRenderObject(Q))throw Error(`ParentDataWidget ${this.parentDataWidget.constructor.name} provided parent data to ${Q.constructor.name}, but ${Q.constructor.name} doesn't support this type of parent data.`);if(!Q.parentData||Q.parentData.constructor!==this.parentDataWidget.createParentData().constructor)Q.parentData=this.parentDataWidget.createParentData();this.parentDataWidget.applyParentData(Q)}}class R8 extends Cp{flex;constructor({child:J,flex:Q=1,key:Z}){super(J,Z);this.flex=Q}createParentData(){return new Pp(this.flex,"tight")}applyParentData(J){let Q=J.parentData;if(Q)Q.flex=this.flex,Q.fit="tight"}debugIsValidRenderObject(J){return!0}toString(){return`Expanded(flex: ${this.flex}, child: ${this.child})`}}b2();G9();sH();class V0{left;top;right;bottom;constructor(J,Q,Z,X){this.left=J;this.top=Q;this.right=Z;this.bottom=X}static all(J){return new V0(J,J,J,J)}static symmetric(J=0,Q=0){return new V0(J,Q,J,Q)}static horizontal(J){return new V0(J,0,J,0)}static vertical(J){return new V0(0,J,0,J)}static only(J){return new V0(J.left??0,J.top??0,J.right??0,J.bottom??0)}get horizontal(){return this.left+this.right}get vertical(){return this.top+this.bottom}}class x6 extends DQ{padding;child;constructor({key:J,padding:Q,child:Z}){super(J?{key:J}:{});this.padding=Q,this.child=Z}createElement(){return new mh1(this)}}class mh1 extends LY{_child;_renderObject;constructor(J){super(J)}get paddingWidget(){return this.widget}get child(){return this._child}get renderObject(){return this._renderObject}mount(){if(this._renderObject=new uh1(this.paddingWidget.padding),this._renderObject.attach(),this.paddingWidget.child){if(this._child=this.paddingWidget.child.createElement(),this.addChild(this._child),this._child.mount(),this._child.renderObject)this._renderObject.adoptChild(this._child.renderObject)}}unmount(){if(this._child)this._child.unmount(),this.removeChild(this._child),this._child=void 0;if(this._renderObject)this._renderObject.detach(),this._renderObject=void 0;super.unmount()}update(J){super.update(J);let Q=this.paddingWidget;if(this._renderObject)this._renderObject.updatePadding(Q.padding);if(Q.child&&this._child){if(this._child.widget.canUpdate(Q.child))this._child.update(Q.child);else if(this._child.unmount(),this.removeChild(this._child),this._child=Q.child.createElement(),this.addChild(this._child),this._child.mount(),this._renderObject&&this._child.renderObject)this._renderObject.removeAllChildren(),this._renderObject.adoptChild(this._child.renderObject)}else if(Q.child&&!this._child){if(this._child=Q.child.createElement(),this.addChild(this._child),this._child.mount(),this._renderObject&&this._child.renderObject)this._renderObject.adoptChild(this._child.renderObject)}else if(!Q.child&&this._child){if(this._child.unmount(),this.removeChild(this._child),this._child=void 0,this._renderObject)this._renderObject.removeAllChildren()}}performRebuild(){}}class uh1 extends Z8{_padding;constructor(J){super();this._padding=J}updatePadding(J){this._padding=J,this.markNeedsLayout()}get padding(){return this._padding}performLayout(){super.performLayout(),this.sendDebugData({padding:this.padding});let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this._padding.horizontal,Z=this._padding.vertical;if(this.children.length>0){let X=new w6(Math.max(0,J.minWidth-Q),Math.max(0,J.maxWidth-Q),Math.max(0,J.minHeight-Z),Math.max(0,J.maxHeight-Z)),Y=this.children[0];Y.layout(X),Y.setOffset(this._padding.left,this._padding.top);let K=J.constrain(Y.size.width+Q,Y.size.height+Z);this.setSize(K.width,K.height)}else{let X=J.constrain(Q,Z);this.setSize(X.width,X.height)}}getMinIntrinsicWidth(J){let Q=this._padding.horizontal,Z=this._padding.vertical;if(this.children.length>0){let X=this.children[0],Y=Math.max(0,J-Z);return X.getMinIntrinsicWidth(Y)+Q}return Q}getMinIntrinsicHeight(J){let Q=this._padding.horizontal,Z=this._padding.vertical;if(this.children.length>0){let X=this.children[0],Y=Math.max(0,J-Q);return X.getMinIntrinsicHeight(Y)+Z}return Z}getMaxIntrinsicWidth(J){let Q=this._padding.horizontal,Z=this._padding.vertical;if(this.children.length>0){let X=this.children[0],Y=Math.max(0,J-Z);return X.getMaxIntrinsicWidth(Y)+Q}return Q}getMaxIntrinsicHeight(J){let Q=this._padding.horizontal,Z=this._padding.vertical;if(this.children.length>0){let X=this.children[0],Y=Math.max(0,J-Q);return X.getMaxIntrinsicHeight(Y)+Z}return Z}hitTest(J,Q,Z=0,X=0){let Y=Z+this.offset.x,K=X+this.offset.y,G=Q.x>=Y&&Q.x<Y+this.size.width,q=Q.y>=K&&Q.y<K+this.size.height;if(G&&q){let W={x:Q.x-Y,y:Q.y-K};J.add({target:this,localPosition:W});for(let F=this.children.length-1;F>=0;F--){let H=this.children[F];if(H&&"hitTest"in H&&typeof H.hitTest==="function")H.hitTest(J,Q,Y,K)}return!0}let z=Z+this.offset.x,U=X+this.offset.y;for(let W of this.children)if("hitTest"in W&&typeof W.hitTest==="function")W.hitTest(J,Q,z,U);return!1}}b2();G9();class TJ extends OY{fit;constructor({key:J,fit:Q="loose",children:Z=[]}={}){super({...J?{key:J}:{},children:Z});this.fit=Q}createRenderObject(){return new ph1(this.fit)}updateRenderObject(J){if(J instanceof ph1)J.fit=this.fit}}class Sp extends Ip{left;top;right;bottom;width;height;constructor(J,Q,Z,X,Y,K){super();this.left=J,this.top=Q,this.right=Z,this.bottom=X,this.width=Y,this.height=K}isPositioned(){return this.top!==void 0||this.right!==void 0||this.bottom!==void 0||this.left!==void 0||this.width!==void 0||this.height!==void 0}positionedChildConstraints(J){m6(this.isPositioned(),"positionedChildConstraints called on non-positioned child");let Q;if(this.left!==void 0&&this.right!==void 0)Q=Math.max(0,J.width-this.right-this.left);else if(this.width!==void 0)Q=this.width;let Z;if(this.top!==void 0&&this.bottom!==void 0)Z=Math.max(0,J.height-this.bottom-this.top);else if(this.height!==void 0)Z=this.height;return new w6(Q??0,Q??Number.POSITIVE_INFINITY,Z??0,Z??Number.POSITIVE_INFINITY)}}class ph1 extends Z8{fit;constructor(J="loose"){super();this.fit=J,this.allowHitTestOutsideBounds=!0}setupParentData(J){if(!(J.parentData instanceof Sp))J.parentData=new Sp}getMinIntrinsicWidth(J){return this.getIntrinsicDimension((Q)=>Q.getMinIntrinsicWidth(J))}getMaxIntrinsicWidth(J){return this.getIntrinsicDimension((Q)=>Q.getMaxIntrinsicWidth(J))}getMinIntrinsicHeight(J){return this.getIntrinsicDimension((Q)=>Q.getMinIntrinsicHeight(J))}getMaxIntrinsicHeight(J){return this.getIntrinsicDimension((Q)=>Q.getMaxIntrinsicHeight(J))}getIntrinsicDimension(J){let Q=0;for(let Z of this.children)if(!Z.parentData.isPositioned())Q=Math.max(Q,J(Z));return Q}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this.children;if(Q.length===0){let G=J.biggest;if(Number.isFinite(G.width)&&Number.isFinite(G.height))this.setSize(G.width,G.height);else{let q=J.smallest;this.setSize(q.width,q.height)}super.performLayout();return}let Z;switch(this.fit){case"loose":Z=J.loosen();break;case"expand":Z=w6.tight(J.biggest.width,J.biggest.height);break;case"passthrough":Z=J;break}let X=!1,Y=J.minWidth,K=J.minHeight;for(let G of Q)if(!G.parentData.isPositioned())X=!0,G.layout(Z),Y=Math.max(Y,G.size.width),K=Math.max(K,G.size.height);if(X)this.setSize(Y,K);else{let G=J.biggest;this.setSize(G.width,G.height)}for(let G of Q){let q=G.parentData;if(q.isPositioned())this.layoutPositionedChild(G,q);else G.setOffset(0,0)}super.performLayout()}layoutPositionedChild(J,Q){let Z=Q.positionedChildConstraints(this.size);J.layout(Z);let X=0,Y=0;if(Q.left!==void 0)X=Q.left;else if(Q.right!==void 0)X=this.size.width-Q.right-J.size.width;if(Q.top!==void 0)Y=Q.top;else if(Q.bottom!==void 0)Y=this.size.height-Q.bottom-J.size.height;J.setOffset(X,Y)}}class wX extends Cp{left;top;right;bottom;width;height;constructor({key:J,left:Q,top:Z,right:X,bottom:Y,width:K,height:G,child:q}){if(Q!==void 0&&X!==void 0&&K!==void 0)throw Error("Positioned: Only two out of the three horizontal values (left, right, width) can be set");if(Z!==void 0&&Y!==void 0&&G!==void 0)throw Error("Positioned: Only two out of the three vertical values (top, bottom, height) can be set");super(q,J);this.left=Q,this.top=Z,this.right=X,this.bottom=Y,this.width=K,this.height=G}createParentData(){return new Sp(this.left,this.top,this.right,this.bottom,this.width,this.height)}applyParentData(J){let Q=J.parentData;if(Q)Q.left=this.left,Q.top=this.top,Q.right=this.right,Q.bottom=this.bottom,Q.width=this.width,Q.height=this.height}debugIsValidRenderObject(J){return!0}updateParentData(J){let Q=J.parentData,Z=!1;if(Q.left!==this.left)Q.left=this.left,Z=!0;if(Q.top!==this.top)Q.top=this.top,Z=!0;if(Q.right!==this.right)Q.right=this.right,Z=!0;if(Q.bottom!==this.bottom)Q.bottom=this.bottom,Z=!0;if(Q.width!==this.width)Q.width=this.width,Z=!0;if(Q.height!==this.height)Q.height=this.height,Z=!0;if(Z){let X=J.parent;if(X&&"markNeedsLayout"in X)X.markNeedsLayout()}}}class X8 extends Tp{constructor({key:J,children:Q=[],mainAxisAlignment:Z="start",crossAxisAlignment:X="center",mainAxisSize:Y="max"}={}){super({...J?{key:J}:{},direction:"horizontal",children:Q,mainAxisAlignment:Z,crossAxisAlignment:X,mainAxisSize:Y})}static start(J){return new X8({children:J,mainAxisAlignment:"start"})}static center(J){return new X8({children:J,mainAxisAlignment:"center"})}static end(J){return new X8({children:J,mainAxisAlignment:"end"})}static spaceBetween(J){return new X8({children:J,mainAxisAlignment:"spaceBetween"})}static spaceAround(J){return new X8({children:J,mainAxisAlignment:"spaceAround"})}static spaceEvenly(J){return new X8({children:J,mainAxisAlignment:"spaceEvenly"})}}b2();G9();class U0 extends R4{width;height;constructor({key:J,width:Q,height:Z,child:X}={}){super({key:J,child:X});this.width=Q,this.height=Z}createRenderObject(){return new dh1(this.width,this.height)}updateRenderObject(J){J.updateDimensions(this.width,this.height)}static fromSize(J,Q,Z){return Z?new U0({width:J,height:Q,child:Z}):new U0({width:J,height:Q})}static expand(J){return J?new U0({width:1/0,height:1/0,child:J}):new U0({width:1/0,height:1/0})}static shrink(J){return J?new U0({width:0,height:0,child:J}):new U0({width:0,height:0})}static height(J,Q){return Q?new U0({height:J,child:Q}):new U0({height:J})}static width(J,Q){return Q?new U0({width:J,child:Q}):new U0({width:J})}}class dh1 extends Z8{_width;_height;constructor(J,Q){super();this._width=J;this._height=Q}updateDimensions(J,Q){let Z=this._width,X=this._height;if(this._width=J,this._height=Q,Z!==J||X!==Q)this.markNeedsLayout()}getMinIntrinsicWidth(J){if(this._width!==void 0)return this._width===1/0?0:this._width;if(this.children.length>0)return this.children[0].getMinIntrinsicWidth(J);return 0}getMaxIntrinsicWidth(J){if(this._width!==void 0)return this._width===1/0?1/0:this._width;if(this.children.length>0)return this.children[0].getMaxIntrinsicWidth(J);return 0}getMinIntrinsicHeight(J){if(this._height!==void 0)return this._height===1/0?0:this._height;if(this.children.length>0)return this.children[0].getMinIntrinsicHeight(J);return 0}getMaxIntrinsicHeight(J){if(this._height!==void 0)return this._height===1/0?1/0:this._height;if(this.children.length>0)return this.children[0].getMaxIntrinsicHeight(J);return 0}performLayout(){super.performLayout();let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q,Z;if(this._width!==void 0)if(this._width===1/0)Q=J.maxWidth;else Q=this._width;else if(this.children.length>0){let Y=this.children[0];Y.layout(J),Q=Y.size.width}else Q=0;if(this._height!==void 0)if(this._height===1/0)Z=J.maxHeight;else Z=this._height;else if(this.children.length>0){let Y=this.children[0];Y.layout(J),Z=Y.size.height}else Z=0;let X=J.constrain(Q,Z);if(this.setSize(X.width,X.height),this.children.length>0){let Y=this.children[0],K=w6.tight(X.width,X.height);Y.layout(K),Y.setOffset(0,0)}}}sH();class r7 extends DQ{flex;width;height;constructor({key:J,flex:Q=1,width:Z,height:X}={}){super(J?{key:J}:{});this.flex=Q,this.width=Z,this.height=X}createElement(){if(this.width!==void 0||this.height!==void 0){let J={child:new y0};if(this.width!==void 0)J.width=this.width;if(this.height!==void 0)J.height=this.height;return new U0(J).createElement()}else return new R8({flex:this.flex,child:U0.shrink()}).createElement()}static horizontal(J){return new r7({width:J})}static vertical(J){return new r7({height:J})}static flexible(J=1){return new r7({flex:J})}}G9();b2();G9();G9();class fC extends R4{constructor(J){super({child:J.child})}createRenderObject(){return new Jq6}updateRenderObject(J){}}class Jq6 extends Z8{performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight),super.performLayout();return}let Q=this.children[0],Z=J.minHeight===J.maxHeight,X;if(Z)X=J;else{let Y=Q.getMaxIntrinsicHeight(J.maxWidth);X=new w6(J.minWidth,J.maxWidth,Y,Y)}Q.layout(X),Q.setOffset(0,0),this.setSize(Q.size.width,Q.size.height),super.performLayout()}getMinIntrinsicHeight(J){return this.getMaxIntrinsicHeight(J)}getMaxIntrinsicHeight(J){if(this.children.length===0)return 0;return this.children[0].getMaxIntrinsicHeight(J)}getMinIntrinsicWidth(J){if(this.children.length===0)return 0;let Q=this.children[0];if(!Number.isFinite(J))J=Q.getMaxIntrinsicHeight(Number.POSITIVE_INFINITY);return Q.getMinIntrinsicWidth(J)}getMaxIntrinsicWidth(J){if(this.children.length===0)return 0;let Q=this.children[0];if(!Number.isFinite(J))J=Q.getMaxIntrinsicHeight(Number.POSITIVE_INFINITY);return Q.getMaxIntrinsicWidth(J)}}G9();l8();uu();sH();class I6 extends DQ{createElement(){return new ch1(this)}}class ch1 extends LY{_child;_context;constructor(J){super(J)}get statelessWidget(){return this.widget}get child(){return this._child}get renderObject(){return this._child?.renderObject}mount(){this._context=new rH(this,this.widget),this.rebuild(),this.markMounted()}unmount(){if(this._child)this._child.unmount(),this.removeChild(this._child),this._child=void 0;this._context=void 0,super.unmount()}update(J){if(this.widget===J)return;if(super.update(J),this._context)this._context.widget=J;this.rebuild()}performRebuild(){this.rebuild()}rebuild(){if(!this._context)throw Error("Cannot rebuild unmounted element");let J=this.statelessWidget.build(this._context);if(this._child){if(this._child.widget===J)return;if(this._child.widget.canUpdate(J))this._child.update(J);else this._child.unmount(),this.removeChild(this._child),this._child=J.createElement(),this.addChild(this._child),this._child.mount()}else this._child=J.createElement(),this.addChild(this._child),this._child.mount()}}sH();b2();uu();G9();class OR extends FZ{controller;constructor({key:J,controller:Q,child:Z}){super({key:J,child:Z});this.controller=Q}static of(J){let Q=J.dependOnInheritedWidgetOfExactType(OR);if(Q)return Q.widget.controller;return null}static require(J){let Q=OR.of(J);if(!Q)throw Error(`InheritedSelectionArea.require() called with a context that does not contain an InheritedSelectionArea.
|
|
6408
6408
|
No InheritedSelectionArea ancestor could be found starting from the given context. This can happen if the context comes from a widget above the SelectionArea.
|
|
6409
|
-
The context used was: `+J.widget.constructor.name);return Q}updateShouldNotify(J){return this.controller!==J.controller}}var Qq6={left:1,top:1,right:0,bottom:0};function Zq6(J,Q,Z){if(J.selectableId===Q.selectableId)return J.offset-Q.offset;return Z(J.selectableId,Q.selectableId)}class hC{foreground;mutedForeground;background;primary;secondary;accent;border;success;warning;info;destructive;selection;copyHighlight;tableBorder;constructor({foreground:J,mutedForeground:Q,background:Z,primary:X,secondary:Y,accent:K,border:G,success:q,warning:z,info:U,destructive:W,selection:F,copyHighlight:H,tableBorder:B}){this.foreground=J,this.mutedForeground=Q,this.background=Z,this.primary=X,this.secondary=Y,this.accent=K,this.border=G,this.success=q,this.warning=z,this.info=U,this.destructive=W,this.selection=F,this.copyHighlight=H,this.tableBorder=B}static default(){return new hC({foreground:E1.default(),mutedForeground:E1.index(7),background:E1.default(),primary:E1.blue,secondary:E1.cyan,accent:E1.magenta,border:E1.index(7),success:E1.green,warning:E1.yellow,info:E1.index(12),destructive:E1.red,selection:E1.index(8),copyHighlight:E1.yellow,tableBorder:E1.index(7)})}static fromRgb(J){return new hC({foreground:E1.rgb(J.fg.r,J.fg.g,J.fg.b),mutedForeground:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b),background:E1.rgb(J.bg.r,J.bg.g,J.bg.b),primary:E1.rgb(J.indices[4].r,J.indices[4].g,J.indices[4].b),secondary:E1.rgb(J.indices[6].r,J.indices[6].g,J.indices[6].b),accent:E1.rgb(J.indices[5].r,J.indices[5].g,J.indices[5].b),border:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b),success:E1.rgb(J.indices[2].r,J.indices[2].g,J.indices[2].b),warning:E1.rgb(J.indices[3].r,J.indices[3].g,J.indices[3].b),info:E1.rgb(J.indices[6].r,J.indices[6].g,J.indices[6].b),destructive:E1.rgb(J.indices[1].r,J.indices[1].g,J.indices[1].b),selection:E1.index(8),copyHighlight:E1.rgb(J.indices[3].r,J.indices[3].g,J.indices[3].b),tableBorder:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b)})}}class tK{colorScheme;constructor({colorScheme:J}){this.colorScheme=J}static default(){return new tK({colorScheme:hC.default()})}static withRgb(J){return new tK({colorScheme:hC.fromRgb(J)})}}class e6 extends FZ{data;constructor({key:J,data:Q,child:Z}){super({key:J,child:Z});this.data=Q}static of(J){let Q=J.dependOnInheritedWidgetOfExactType(e6);if(Q)return Q.widget.data;return tK.default()}static maybeOf(J){let Q=J.dependOnInheritedWidgetOfExactType(e6);if(Q)return Q.widget.data;return null}updateShouldNotify(J){return this.data!==J.data}}class $1{color;backgroundColor;bold;italic;underline;strikethrough;dim;constructor({color:J,backgroundColor:Q,bold:Z,italic:X,underline:Y,strikethrough:K,dim:G}={}){if(J!==void 0)this.color=J;if(Q!==void 0)this.backgroundColor=Q;if(Z!==void 0)this.bold=Z;if(X!==void 0)this.italic=X;if(Y!==void 0)this.underline=Y;if(K!==void 0)this.strikethrough=K;if(G!==void 0)this.dim=G}copyWith({color:J,backgroundColor:Q,bold:Z,italic:X,underline:Y,strikethrough:K,dim:G}){let q={};if(J!==void 0||this.color!==void 0)q.color=J??this.color;if(Q!==void 0||this.backgroundColor!==void 0)q.backgroundColor=Q??this.backgroundColor;if(Z!==void 0||this.bold!==void 0)q.bold=Z??this.bold;if(X!==void 0||this.italic!==void 0)q.italic=X??this.italic;if(Y!==void 0||this.underline!==void 0)q.underline=Y??this.underline;if(K!==void 0||this.strikethrough!==void 0)q.strikethrough=K??this.strikethrough;if(G!==void 0||this.dim!==void 0)q.dim=G??this.dim;return new $1(q)}merge(J){if(!J)return this;let Q={};if(J.color!==void 0||this.color!==void 0)Q.color=J.color??this.color;if(J.backgroundColor!==void 0||this.backgroundColor!==void 0)Q.backgroundColor=J.backgroundColor??this.backgroundColor;if(J.bold!==void 0||this.bold!==void 0)Q.bold=J.bold??this.bold;if(J.italic!==void 0||this.italic!==void 0)Q.italic=J.italic??this.italic;if(J.underline!==void 0||this.underline!==void 0)Q.underline=J.underline??this.underline;if(J.strikethrough!==void 0||this.strikethrough!==void 0)Q.strikethrough=J.strikethrough??this.strikethrough;if(J.dim!==void 0||this.dim!==void 0)Q.dim=J.dim??this.dim;return new $1(Q)}static normal(J){return J?new $1({color:J}):new $1}static bold(J){return J?new $1({color:J,bold:!0}):new $1({bold:!0})}static italic(J){return J?new $1({color:J,italic:!0}):new $1({italic:!0})}static underline(J){return J?new $1({color:J,underline:!0}):new $1({underline:!0})}static colored(J){return new $1({color:J})}static background(J){return new $1({backgroundColor:J})}}class N1{text;style;children;hyperlink;constructor(J,Q,Z,X){this.text=J;this.style=Q;this.children=Z;this.hyperlink=X}toPlainText(){let J=this.text??"";if(this.children)for(let Q of this.children)J+=Q.toPlainText();return String(J)}equals(J){if(!J)return!1;if(this.text!==J.text)return!1;if(this.hyperlink?.uri!==J.hyperlink?.uri)return!1;if(this.style!==J.style){if(!this.style||!J.style)return!1;if(this.style.color!==J.style.color)return!1;if(this.style.backgroundColor!==J.style.backgroundColor)return!1;if(this.style.bold!==J.style.bold)return!1;if(this.style.italic!==J.style.italic)return!1;if(this.style.underline!==J.style.underline)return!1}if(this.children?.length!==J.children?.length)return!1;if(this.children&&J.children)for(let Q=0;Q<this.children.length;Q++){let Z=this.children[Q],X=J.children[Q];if(!Z||!X||!Z.equals(X))return!1}return!0}visitTextSpan(J){if(!J(this))return;if(this.children)for(let Q of this.children)Q.visitTextSpan(J)}}class n1 extends QB{text;textAlign;maxLines;overflow;selectable;constructor({key:J,text:Q,textAlign:Z="left",maxLines:X,overflow:Y="clip",selectable:K=!1}){super(J?{key:J}:{});this.text=Q,this.textAlign=Z,this.maxLines=X,this.overflow=Y,this.selectable=K,this.sendDebugData({text:Q})}createElement(){return new Xq6(this)}createRenderObject(){return new Yq6(this.text,this.textAlign,this.maxLines,this.overflow,!1,E1.index(8),E1.yellow,this.selectable)}updateRenderObject(J){}}class Xq6 extends HN{constructor(J){super(J)}get richTextWidget(){return this.widget}mount(){super.mount(),this._updateRenderObjectWithMediaQuery()}performRebuild(){super.performRebuild(),setTimeout(()=>this._ensureRenderObjectContext(),0)}_ensureRenderObjectContext(){if(!this.renderObject)return;let J=this.renderObject,Q=new rH(this,this.widget);J.setContext(Q)}update(J){super.update(J),this._updateRenderObjectWithMediaQuery()}_updateRenderObjectWithMediaQuery(){if(!this.renderObject)return;try{let J=new rH(this,this.widget),Q=_8.of(J),Z=e6.maybeOf(J),X=Z?.colorScheme.selection??E1.index(8),Y=Z?.colorScheme.copyHighlight??E1.yellow,K=this.renderObject;K.setContext(J),K.updateText(this.richTextWidget.text,this.richTextWidget.textAlign,this.richTextWidget.maxLines,this.richTextWidget.overflow,Q.supportsEmojiWidth,X,Y,this.richTextWidget.selectable)}catch(J){let Q=new rH(this,this.widget),Z=this.renderObject;Z.setContext(Q),Z.updateText(this.richTextWidget.text,this.richTextWidget.textAlign,this.richTextWidget.maxLines,this.richTextWidget.overflow,!1,E1.index(8),E1.yellow,this.richTextWidget.selectable)}}}class Yq6 extends Z8{_text;_textAlign;_maxLines;_overflow;_emojiWidthSupported;_selectable;selectableId=0;_selectionArea;_selectedRanges=[];set selectionArea(J){this._selectionArea=J}get selectionArea(){return this._selectionArea}_cachedStyledCells;_selectionStart=null;_selectionEnd=null;_characterPositions=[];_visualLines=[];_selectionColor=E1.index(8);_copyHighlightColor=E1.yellow;_highlightMode="selection";constructor(J,Q,Z,X="clip",Y=!1,K=E1.index(8),G=E1.yellow,q=!1){super();this._text=J;this._textAlign=Q;this._maxLines=Z;this._overflow=X;this._emojiWidthSupported=Y;this._selectable=q;this._selectionColor=K,this._copyHighlightColor=G}get text(){return this._text}get textAlign(){return this._textAlign}get maxLines(){return this._maxLines}get overflow(){return this._overflow}updateSelection(J,Q,Z="selection"){if(this._selectionStart!==J||this._selectionEnd!==Q||this._highlightMode!==Z)this._selectionStart=J,this._selectionEnd=Q,this._highlightMode=Z,this.markNeedsPaint()}setHighlightMode(J){if(this._highlightMode!==J)this._highlightMode=J,this.markNeedsPaint()}get plainText(){return this._text.toPlainText()}getCharacterRect(J){if(J<0||J>=this._characterPositions.length)return null;let Q=this._characterPositions[J];if(!Q)return null;return{x:Q.x,y:Q.y,width:Q.width,height:1}}getOffsetForPosition(J,Q){if(this._characterPositions.length===0)return null;let Z=Math.round(J),X=Math.floor(Q),Y=1/0,K=1/0,G=-1/0,q=-1/0;for(let W of this._characterPositions)Y=Math.min(Y,W.x),K=Math.min(K,W.y),G=Math.max(G,W.x+W.width),q=Math.max(q,W.y+1);if(Z<Y||Z>=G||X<K||X>=q)return null;for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;if(Z>=F.x&&Z<F.x+F.width&&X>=F.y&&X<F.y+1)return W}for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;if(X>=F.y&&X<F.y+1){if(Z<F.x)return W;if(W===this._characterPositions.length-1||this._characterPositions[W+1]&&this._characterPositions[W+1].y>F.y){if(Z>=F.x+F.width)return W+1}}}let z=0,U=1/0;for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;let H=Math.abs(X-F.y)+Math.abs(Z-F.x);if(H<U)U=H,z=W}return z}getVisualLines(){return this._visualLines}getRenderableCharacterCount(){return this._characterPositions.length}updateText(J,Q,Z,X="clip",Y=!1,K=E1.index(8),G=E1.yellow,q=!1){this._text=J,this._textAlign=Q,this._maxLines=Z,this._overflow=X,this._emojiWidthSupported=Y,this._selectionColor=K,this._copyHighlightColor=G,this._selectable=q,this._cachedStyledCells=void 0,this._characterPositions=[],this._visualLines=[],this._cachedStyledCells=this.getStyledCells(),this.markNeedsLayout(),this.markNeedsPaint()}getStyledCells(){let J=[],Q=this.getStyledSegments(this._text,new $1({color:E1.white}));for(let Z of Q){let X=O2(Z.text);for(let Y of X){let K=c4(Y,this._emojiWidthSupported),G={};if(Z.style.color)G.fg=Z.style.color;if(Z.style.backgroundColor)G.bg=Z.style.backgroundColor;if(Z.style.bold)G.bold=Z.style.bold;if(Z.style.italic)G.italic=Z.style.italic;if(Z.style.underline)G.underline=Z.style.underline;if(Z.style.strikethrough)G.strikethrough=Z.style.strikethrough;if(Z.style.dim)G.dim=Z.style.dim;J.push(D9(Y,G,K,Z.hyperlink))}}return J}getCachedStyledCells(){return this._cachedStyledCells??this.getStyledCells()}getTotalCellsWidth(J){let Q=0;for(let Z of J)Q+=Z.width;return Q}wrapCells(J,Q){if(Q===1/0)return this.handleExplicitLineBreaksInCells(J);let Z=[],X=[],Y=0,K=0;while(K<J.length){let G=J[K];if(!G){K++;continue}if(G.char===`
|
|
6409
|
+
The context used was: `+J.widget.constructor.name);return Q}updateShouldNotify(J){return this.controller!==J.controller}}var Qq6={left:1,top:1,right:0,bottom:0};function Zq6(J,Q,Z){if(J.selectableId===Q.selectableId)return J.offset-Q.offset;return Z(J.selectableId,Q.selectableId)}class hC{foreground;mutedForeground;background;primary;secondary;accent;border;success;warning;info;destructive;selection;copyHighlight;tableBorder;constructor({foreground:J,mutedForeground:Q,background:Z,primary:X,secondary:Y,accent:K,border:G,success:q,warning:z,info:U,destructive:W,selection:F,copyHighlight:H,tableBorder:B}){this.foreground=J,this.mutedForeground=Q,this.background=Z,this.primary=X,this.secondary=Y,this.accent=K,this.border=G,this.success=q,this.warning=z,this.info=U,this.destructive=W,this.selection=F,this.copyHighlight=H,this.tableBorder=B}static default(){return new hC({foreground:E1.default(),mutedForeground:E1.index(7),background:E1.default(),primary:E1.blue,secondary:E1.cyan,accent:E1.magenta,border:E1.index(7),success:E1.green,warning:E1.yellow,info:E1.index(12),destructive:E1.red,selection:E1.index(8),copyHighlight:E1.yellow,tableBorder:E1.index(7)})}static fromRgb(J){return new hC({foreground:E1.rgb(J.fg.r,J.fg.g,J.fg.b),mutedForeground:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b),background:E1.rgb(J.bg.r,J.bg.g,J.bg.b),primary:E1.rgb(J.indices[4].r,J.indices[4].g,J.indices[4].b),secondary:E1.rgb(J.indices[6].r,J.indices[6].g,J.indices[6].b),accent:E1.rgb(J.indices[5].r,J.indices[5].g,J.indices[5].b),border:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b),success:E1.rgb(J.indices[2].r,J.indices[2].g,J.indices[2].b),warning:E1.rgb(J.indices[3].r,J.indices[3].g,J.indices[3].b),info:E1.rgb(J.indices[6].r,J.indices[6].g,J.indices[6].b),destructive:E1.rgb(J.indices[1].r,J.indices[1].g,J.indices[1].b),selection:E1.index(8),copyHighlight:E1.rgb(J.indices[3].r,J.indices[3].g,J.indices[3].b),tableBorder:E1.rgb(J.indices[7].r,J.indices[7].g,J.indices[7].b)})}}class tK{colorScheme;constructor({colorScheme:J}){this.colorScheme=J}static default(){return new tK({colorScheme:hC.default()})}static withRgb(J){return new tK({colorScheme:hC.fromRgb(J)})}}class e6 extends FZ{data;constructor({key:J,data:Q,child:Z}){super({key:J,child:Z});this.data=Q}static of(J){let Q=J.dependOnInheritedWidgetOfExactType(e6);if(Q)return Q.widget.data;return tK.default()}static maybeOf(J){let Q=J.dependOnInheritedWidgetOfExactType(e6);if(Q)return Q.widget.data;return null}updateShouldNotify(J){return this.data!==J.data}}class j1{color;backgroundColor;bold;italic;underline;strikethrough;dim;constructor({color:J,backgroundColor:Q,bold:Z,italic:X,underline:Y,strikethrough:K,dim:G}={}){if(J!==void 0)this.color=J;if(Q!==void 0)this.backgroundColor=Q;if(Z!==void 0)this.bold=Z;if(X!==void 0)this.italic=X;if(Y!==void 0)this.underline=Y;if(K!==void 0)this.strikethrough=K;if(G!==void 0)this.dim=G}copyWith({color:J,backgroundColor:Q,bold:Z,italic:X,underline:Y,strikethrough:K,dim:G}){let q={};if(J!==void 0||this.color!==void 0)q.color=J??this.color;if(Q!==void 0||this.backgroundColor!==void 0)q.backgroundColor=Q??this.backgroundColor;if(Z!==void 0||this.bold!==void 0)q.bold=Z??this.bold;if(X!==void 0||this.italic!==void 0)q.italic=X??this.italic;if(Y!==void 0||this.underline!==void 0)q.underline=Y??this.underline;if(K!==void 0||this.strikethrough!==void 0)q.strikethrough=K??this.strikethrough;if(G!==void 0||this.dim!==void 0)q.dim=G??this.dim;return new j1(q)}merge(J){if(!J)return this;let Q={};if(J.color!==void 0||this.color!==void 0)Q.color=J.color??this.color;if(J.backgroundColor!==void 0||this.backgroundColor!==void 0)Q.backgroundColor=J.backgroundColor??this.backgroundColor;if(J.bold!==void 0||this.bold!==void 0)Q.bold=J.bold??this.bold;if(J.italic!==void 0||this.italic!==void 0)Q.italic=J.italic??this.italic;if(J.underline!==void 0||this.underline!==void 0)Q.underline=J.underline??this.underline;if(J.strikethrough!==void 0||this.strikethrough!==void 0)Q.strikethrough=J.strikethrough??this.strikethrough;if(J.dim!==void 0||this.dim!==void 0)Q.dim=J.dim??this.dim;return new j1(Q)}static normal(J){return J?new j1({color:J}):new j1}static bold(J){return J?new j1({color:J,bold:!0}):new j1({bold:!0})}static italic(J){return J?new j1({color:J,italic:!0}):new j1({italic:!0})}static underline(J){return J?new j1({color:J,underline:!0}):new j1({underline:!0})}static colored(J){return new j1({color:J})}static background(J){return new j1({backgroundColor:J})}}class N1{text;style;children;hyperlink;constructor(J,Q,Z,X){this.text=J;this.style=Q;this.children=Z;this.hyperlink=X}toPlainText(){let J=this.text??"";if(this.children)for(let Q of this.children)J+=Q.toPlainText();return String(J)}equals(J){if(!J)return!1;if(this.text!==J.text)return!1;if(this.hyperlink?.uri!==J.hyperlink?.uri)return!1;if(this.style!==J.style){if(!this.style||!J.style)return!1;if(this.style.color!==J.style.color)return!1;if(this.style.backgroundColor!==J.style.backgroundColor)return!1;if(this.style.bold!==J.style.bold)return!1;if(this.style.italic!==J.style.italic)return!1;if(this.style.underline!==J.style.underline)return!1}if(this.children?.length!==J.children?.length)return!1;if(this.children&&J.children)for(let Q=0;Q<this.children.length;Q++){let Z=this.children[Q],X=J.children[Q];if(!Z||!X||!Z.equals(X))return!1}return!0}visitTextSpan(J){if(!J(this))return;if(this.children)for(let Q of this.children)Q.visitTextSpan(J)}}class n1 extends QB{text;textAlign;maxLines;overflow;selectable;constructor({key:J,text:Q,textAlign:Z="left",maxLines:X,overflow:Y="clip",selectable:K=!1}){super(J?{key:J}:{});this.text=Q,this.textAlign=Z,this.maxLines=X,this.overflow=Y,this.selectable=K,this.sendDebugData({text:Q})}createElement(){return new Xq6(this)}createRenderObject(){return new Yq6(this.text,this.textAlign,this.maxLines,this.overflow,!1,E1.index(8),E1.yellow,this.selectable)}updateRenderObject(J){}}class Xq6 extends HN{constructor(J){super(J)}get richTextWidget(){return this.widget}mount(){super.mount(),this._updateRenderObjectWithMediaQuery()}performRebuild(){super.performRebuild(),setTimeout(()=>this._ensureRenderObjectContext(),0)}_ensureRenderObjectContext(){if(!this.renderObject)return;let J=this.renderObject,Q=new rH(this,this.widget);J.setContext(Q)}update(J){super.update(J),this._updateRenderObjectWithMediaQuery()}_updateRenderObjectWithMediaQuery(){if(!this.renderObject)return;try{let J=new rH(this,this.widget),Q=_8.of(J),Z=e6.maybeOf(J),X=Z?.colorScheme.selection??E1.index(8),Y=Z?.colorScheme.copyHighlight??E1.yellow,K=this.renderObject;K.setContext(J),K.updateText(this.richTextWidget.text,this.richTextWidget.textAlign,this.richTextWidget.maxLines,this.richTextWidget.overflow,Q.supportsEmojiWidth,X,Y,this.richTextWidget.selectable)}catch(J){let Q=new rH(this,this.widget),Z=this.renderObject;Z.setContext(Q),Z.updateText(this.richTextWidget.text,this.richTextWidget.textAlign,this.richTextWidget.maxLines,this.richTextWidget.overflow,!1,E1.index(8),E1.yellow,this.richTextWidget.selectable)}}}class Yq6 extends Z8{_text;_textAlign;_maxLines;_overflow;_emojiWidthSupported;_selectable;selectableId=0;_selectionArea;_selectedRanges=[];set selectionArea(J){this._selectionArea=J}get selectionArea(){return this._selectionArea}_cachedStyledCells;_selectionStart=null;_selectionEnd=null;_characterPositions=[];_visualLines=[];_selectionColor=E1.index(8);_copyHighlightColor=E1.yellow;_highlightMode="selection";constructor(J,Q,Z,X="clip",Y=!1,K=E1.index(8),G=E1.yellow,q=!1){super();this._text=J;this._textAlign=Q;this._maxLines=Z;this._overflow=X;this._emojiWidthSupported=Y;this._selectable=q;this._selectionColor=K,this._copyHighlightColor=G}get text(){return this._text}get textAlign(){return this._textAlign}get maxLines(){return this._maxLines}get overflow(){return this._overflow}updateSelection(J,Q,Z="selection"){if(this._selectionStart!==J||this._selectionEnd!==Q||this._highlightMode!==Z)this._selectionStart=J,this._selectionEnd=Q,this._highlightMode=Z,this.markNeedsPaint()}setHighlightMode(J){if(this._highlightMode!==J)this._highlightMode=J,this.markNeedsPaint()}get plainText(){return this._text.toPlainText()}getCharacterRect(J){if(J<0||J>=this._characterPositions.length)return null;let Q=this._characterPositions[J];if(!Q)return null;return{x:Q.x,y:Q.y,width:Q.width,height:1}}getOffsetForPosition(J,Q){if(this._characterPositions.length===0)return null;let Z=Math.round(J),X=Math.floor(Q),Y=1/0,K=1/0,G=-1/0,q=-1/0;for(let W of this._characterPositions)Y=Math.min(Y,W.x),K=Math.min(K,W.y),G=Math.max(G,W.x+W.width),q=Math.max(q,W.y+1);if(Z<Y||Z>=G||X<K||X>=q)return null;for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;if(Z>=F.x&&Z<F.x+F.width&&X>=F.y&&X<F.y+1)return W}for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;if(X>=F.y&&X<F.y+1){if(Z<F.x)return W;if(W===this._characterPositions.length-1||this._characterPositions[W+1]&&this._characterPositions[W+1].y>F.y){if(Z>=F.x+F.width)return W+1}}}let z=0,U=1/0;for(let W=0;W<this._characterPositions.length;W++){let F=this._characterPositions[W];if(!F)continue;let H=Math.abs(X-F.y)+Math.abs(Z-F.x);if(H<U)U=H,z=W}return z}getVisualLines(){return this._visualLines}getRenderableCharacterCount(){return this._characterPositions.length}updateText(J,Q,Z,X="clip",Y=!1,K=E1.index(8),G=E1.yellow,q=!1){this._text=J,this._textAlign=Q,this._maxLines=Z,this._overflow=X,this._emojiWidthSupported=Y,this._selectionColor=K,this._copyHighlightColor=G,this._selectable=q,this._cachedStyledCells=void 0,this._characterPositions=[],this._visualLines=[],this._cachedStyledCells=this.getStyledCells(),this.markNeedsLayout(),this.markNeedsPaint()}getStyledCells(){let J=[],Q=this.getStyledSegments(this._text,new j1({color:E1.white}));for(let Z of Q){let X=O2(Z.text);for(let Y of X){let K=c4(Y,this._emojiWidthSupported),G={};if(Z.style.color)G.fg=Z.style.color;if(Z.style.backgroundColor)G.bg=Z.style.backgroundColor;if(Z.style.bold)G.bold=Z.style.bold;if(Z.style.italic)G.italic=Z.style.italic;if(Z.style.underline)G.underline=Z.style.underline;if(Z.style.strikethrough)G.strikethrough=Z.style.strikethrough;if(Z.style.dim)G.dim=Z.style.dim;J.push(D9(Y,G,K,Z.hyperlink))}}return J}getCachedStyledCells(){return this._cachedStyledCells??this.getStyledCells()}getTotalCellsWidth(J){let Q=0;for(let Z of J)Q+=Z.width;return Q}wrapCells(J,Q){if(Q===1/0)return this.handleExplicitLineBreaksInCells(J);let Z=[],X=[],Y=0,K=0;while(K<J.length){let G=J[K];if(!G){K++;continue}if(G.char===`
|
|
6410
6410
|
`){X.push(G),Z.push(X),X=[],Y=0,K++;continue}if(Y+G.width>Q&&X.length>0){let q=X.length-1;while(q>=0&&!/\s/.test(X[q].char))q--;if(q>=0){let z=X.slice(q+1);X=X.slice(0,q+1),Z.push(X),X=z,Y=0;for(let U of z)Y+=U.width}else Z.push(X),X=[],Y=0}X.push(G),Y+=G.width,K++}if(X.length>0)Z.push(X);return Z.length>0?Z:[[]]}handleExplicitLineBreaksInCells(J){let Q=[],Z=[];for(let X of J)if(X.char===`
|
|
6411
6411
|
`)Z.push(X),Q.push(Z),Z=[];else Z.push(X);if(Z.length>0)Q.push(Z);return Q.length>0?Q:[[]]}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this.getCachedStyledCells(),Z=isFinite(J.maxWidth)?J.maxWidth:this.getTotalCellsWidth(Q),X=this.wrapCells(Q,Z),Y=this._maxLines?X.slice(0,this._maxLines):X,K=0;for(let W of Y){let F=0;for(let H of W)F+=H.width;K=Math.max(K,F)}let G=Y.length,q=Y.length>1,z,U;if(!isFinite(J.maxWidth))z=K;else{let W;if(this._textAlign==="center"||this._textAlign==="right")W=J.maxWidth;else W=q?J.maxWidth:K;z=Math.max(J.minWidth,Math.min(J.maxWidth,W))}if(!isFinite(J.maxHeight))U=G;else{let W=q?G:Math.min(G,J.maxHeight);U=Math.max(J.minHeight,W)}z=Math.max(0,z),U=Math.max(0,U),this.setSize(z,U),super.performLayout()}getMinIntrinsicWidth(J){let Q=this.getCachedStyledCells();if(this._maxLines===1)return Math.max(this.getTotalCellsWidth(Q),1);let Z=0,X=0,Y=!1;for(let K of Q){if(K.char===`
|
|
6412
6412
|
`){if(Y)Z=Math.max(Z,X),X=0,Y=!1;continue}if(/\s/.test(K.char)){if(Y)Z=Math.max(Z,X),X=0,Y=!1}else{if(!Y)X=0,Y=!0;X+=K.width}}if(Y)Z=Math.max(Z,X);return Math.max(Z,1)}getMaxIntrinsicWidth(J){let Q=this.getCachedStyledCells();return Math.max(this.getTotalCellsWidth(Q),1)}getMinIntrinsicHeight(J){let Q=this.getCachedStyledCells(),Z=this.wrapCells(Q,J),X=this._maxLines?Z.slice(0,this._maxLines):Z;return Math.max(X.length,1)}getMaxIntrinsicHeight(J){return this.getMinIntrinsicHeight(J)}paint(J,Q=0,Z=0){let X=Q+this.offset.x,Y=Z+this.offset.y,K=this.getCachedStyledCells(),G=this.wrapCells(K,this.size.width),q=this._maxLines?G.slice(0,this._maxLines):G;if(this._maxLines&&G.length>this._maxLines)q=this.applyCellOverflow(q,this.size.width);if(q.length>this.size.height)q=q.slice(0,this.size.height);this._characterPositions=[],this._visualLines=[];let z=0;for(let U=0;U<q.length;U++){let W=q[U];if(!W)continue;let F=Y+U;if(F>=0&&F<J.getSize().height){let H=X;if(this._textAlign==="center"||this._textAlign==="right"){let V=0,N=W.length-1;while(N>=0&&W[N]&&/\s/.test(W[N]?.char||""))N--;for(let L=0;L<=N;L++){let A=W[L];if(A)V+=A.width}if(this._textAlign==="center")H=Math.max(X,X+Math.floor((this.size.width-V)/2));else H=Math.max(X,X+this.size.width-V)}let B=Math.floor(H),M=X+this.size.width;for(let V of W){if(V.char===`
|
|
6413
|
-
`){this._characterPositions.push({x:B-X,y:U,width:0}),z++;continue}if(B>=M)break;if(B>=X){let N=this._isCharacterSelected(z),L={...V};if(!V.style.bg&&!N){let A=J.getCell(B,F);if(A?.style.bg)L={...L,style:{...L.style,bg:A.style.bg}}}if(N)if(this._highlightMode==="copy")L={...L,style:{...L.style,fg:this._copyHighlightColor,reverse:!0}};else L={...L,style:{...L.style,bg:this._selectionColor}};J.setCell(B,F,L)}this._characterPositions.push({x:B-X,y:U,width:V.width}),B+=V.width,z++}}else for(let H of W)this._characterPositions.push({x:0,y:U,width:H.width}),z++;if(W.length>0){let H=this._characterPositions.length-W.length,B=this._characterPositions.length-1;this._visualLines.push({y:U,start:H,end:B})}}}getStyledLines(){let J=this.getStyledSegments(this._text,new
|
|
6413
|
+
`){this._characterPositions.push({x:B-X,y:U,width:0}),z++;continue}if(B>=M)break;if(B>=X){let N=this._isCharacterSelected(z),L={...V};if(!V.style.bg&&!N){let A=J.getCell(B,F);if(A?.style.bg)L={...L,style:{...L.style,bg:A.style.bg}}}if(N)if(this._highlightMode==="copy")L={...L,style:{...L.style,fg:this._copyHighlightColor,reverse:!0}};else L={...L,style:{...L.style,bg:this._selectionColor}};J.setCell(B,F,L)}this._characterPositions.push({x:B-X,y:U,width:V.width}),B+=V.width,z++}}else for(let H of W)this._characterPositions.push({x:0,y:U,width:H.width}),z++;if(W.length>0){let H=this._characterPositions.length-W.length,B=this._characterPositions.length-1;this._visualLines.push({y:U,start:H,end:B})}}}getStyledLines(){let J=this.getStyledSegments(this._text,new j1({color:E1.white})),Q=this.wrapStyledSegments(J,this.size.width),Z=this._maxLines?Q.slice(0,this._maxLines):Q;if(this._maxLines&&Q.length>this._maxLines)Z=this.applyTextOverflow(Z,this.size.width);if(Z.length>this.size.height)Z=Z.slice(0,this.size.height);this._characterPositions=[],this._visualLines=[];for(let X=0;X<Z.length;X++){let Y=Z[X];if(Y)this._addLineCharacterPositions(Y,X)}return Z}wrapStyledSegments(J,Q){if(Q===1/0)return this.handleExplicitLineBreaks(J);let Z=[],X=[],Y=0,K=!1;for(let G of J){if(!G.text||typeof G.text!=="string")continue;let q=G.text.split(`
|
|
6414
6414
|
`),z=G.text.endsWith(`
|
|
6415
6415
|
`);for(let U=0;U<q.length;U++){let W=q[U];if(W===void 0)continue;if(U>0){if(X.length>0){let H=X[X.length-1];if(H)H.text+=`
|
|
6416
6416
|
`}else X.push({text:`
|
|
6417
|
-
`,style:G.style,hyperlink:G.hyperlink});Z.push({segments:X,alignment:this._textAlign}),X=[],Y=0}if(W.length===0)continue;let F=this.splitIntoWords(W);for(let H=0;H<F.length;H++){let B=F[H];if(B===void 0)continue;let M=RY(B,this._emojiWidthSupported),V=/^\s+$/.test(B);if(Y+M>Q&&X.length>0)Z.push({segments:X,alignment:this._textAlign}),X=[],Y=0;let N=U>0&&H===0||U===0&&H===0&&K;if(V&&X.length===0&&!N)continue;if(U===0&&H===0)K=!1;let L=X[X.length-1];if(X.length>0&&L&&this.segmentsEqual(L,G))L.text+=B;else X.push({text:B,style:G.style,hyperlink:G.hyperlink});Y+=M}}K=z}if(X.length>0)Z.push({segments:X,alignment:this._textAlign});if(Z.length===0)Z.push({segments:[{text:"",style:new
|
|
6417
|
+
`,style:G.style,hyperlink:G.hyperlink});Z.push({segments:X,alignment:this._textAlign}),X=[],Y=0}if(W.length===0)continue;let F=this.splitIntoWords(W);for(let H=0;H<F.length;H++){let B=F[H];if(B===void 0)continue;let M=RY(B,this._emojiWidthSupported),V=/^\s+$/.test(B);if(Y+M>Q&&X.length>0)Z.push({segments:X,alignment:this._textAlign}),X=[],Y=0;let N=U>0&&H===0||U===0&&H===0&&K;if(V&&X.length===0&&!N)continue;if(U===0&&H===0)K=!1;let L=X[X.length-1];if(X.length>0&&L&&this.segmentsEqual(L,G))L.text+=B;else X.push({text:B,style:G.style,hyperlink:G.hyperlink});Y+=M}}K=z}if(X.length>0)Z.push({segments:X,alignment:this._textAlign});if(Z.length===0)Z.push({segments:[{text:"",style:new j1({color:E1.white})}],alignment:this._textAlign});return Z}handleExplicitLineBreaks(J){let Q=[],Z=[];for(let X of J){if(!X.text||typeof X.text!=="string")continue;let Y=X.text.split(`
|
|
6418
6418
|
`);for(let K=0;K<Y.length;K++){if(K>0){if(Z.length>0){let q=Z[Z.length-1];if(q)q.text+=`
|
|
6419
6419
|
`}else Z.push({text:`
|
|
6420
|
-
`,style:X.style,hyperlink:X.hyperlink});Q.push({segments:Z,alignment:this._textAlign}),Z=[]}let G=Y[K];if(G!==void 0&&G.length>0)Z.push({text:G,style:X.style,hyperlink:X.hyperlink})}}if(Z.length>0)Q.push({segments:Z,alignment:this._textAlign});if(Q.length===0)Q.push({segments:[{text:"",style:new
|
|
6420
|
+
`,style:X.style,hyperlink:X.hyperlink});Q.push({segments:Z,alignment:this._textAlign}),Z=[]}let G=Y[K];if(G!==void 0&&G.length>0)Z.push({text:G,style:X.style,hyperlink:X.hyperlink})}}if(Z.length>0)Q.push({segments:Z,alignment:this._textAlign});if(Q.length===0)Q.push({segments:[{text:"",style:new j1({color:E1.white})}],alignment:this._textAlign});return Q}stylesEqual(J,Q){return J.color===Q.color&&J.backgroundColor===Q.backgroundColor&&J.bold===Q.bold&&J.italic===Q.italic&&J.underline===Q.underline&&J.strikethrough===Q.strikethrough&&J.dim===Q.dim}segmentsEqual(J,Q){return this.stylesEqual(J.style,Q.style)&&(J.hyperlink?.uri===Q.hyperlink?.uri&&J.hyperlink?.id===Q.hyperlink?.id||J.hyperlink===void 0&&Q.hyperlink===void 0)}splitIntoWords(J){let Q=[],Z="",X=!1,Y=O2(J);for(let K of Y){let G=/\s/.test(K);if(G!==X){if(Z.length>0)Q.push(Z),Z="";X=G}Z+=K}if(Z.length>0)Q.push(Z);return Q}applyTextOverflow(J,Q){if(J.length===0)return J;let Z=J[J.length-1];if(!Z)return J;let X=[...J],Y=RY("…",this._emojiWidthSupported),K=Q-Y,G=[],q=0,z=[],U=Q;switch(this._overflow){case"ellipsis":{for(let H of Z.segments){let B=RY(H.text,this._emojiWidthSupported);if(q+B<=K)G.push(H),q+=B;else if(q<K){let M=K-q,V=Ah1(H.text,M,this._emojiWidthSupported,"");if(V.length>0)G.push({text:V,style:H.style,hyperlink:H.hyperlink});break}else break}let W=Z.segments[Z.segments.length-1],F=Z.segments.length>0&&W?W.style:new j1({color:E1.white});G.push({text:"…",style:F}),X[X.length-1]={segments:G,alignment:Z.alignment};break}case"fade":case"clip":{for(let W of Z.segments){if(U<=0)break;let F=RY(W.text,this._emojiWidthSupported);if(F<=U)z.push(W),U-=F;else{let H=Ah1(W.text,U,this._emojiWidthSupported,"");if(H.length>0)z.push({text:H,style:W.style,hyperlink:W.hyperlink});break}}X[X.length-1]={segments:z,alignment:Z.alignment};break}case"visible":default:break}return X}getStyledSegments(J,Q,Z){let X=[],Y=Q.merge(J.style),K=J.hyperlink??Z;if(J.text)X.push({text:J.text,style:Y,hyperlink:K});if(J.children)for(let G of J.children)X.push(...this.getStyledSegments(G,Y,K));return X}_addLineCharacterPositions(J,Q){let Z=0;if(J.alignment==="center"||J.alignment==="right"){let G=0;for(let q of J.segments)G+=RY(q.text,this._emojiWidthSupported);if(J.alignment==="center")Z=Math.max(0,Math.floor((this.size.width-G)/2));else Z=Math.max(0,this.size.width-G)}let X=this._characterPositions.length,Y=Z;for(let G of J.segments){let q=O2(G.text);for(let z of q){let U=c4(z,this._emojiWidthSupported);if(this._characterPositions.push({x:Y,y:Q,width:z===`
|
|
6421
6421
|
`?0:U}),z!==`
|
|
6422
6422
|
`)Y+=U}}let K=this._characterPositions.length-1;if(K>=X)this._visualLines.push({y:Q,start:X,end:K})}applyCellOverflow(J,Q){if(J.length===0)return J;if(this._overflow==="visible")return J;let Z=[...J],X=Z[Z.length-1];if(!X)return Z;switch(this._overflow){case"ellipsis":{let Y=RY("…",this._emojiWidthSupported),K=Q-Y,G=[],q=0;for(let W of X)if(q+W.width<=K)G.push(W),q+=W.width;else break;let z=X[X.length-1],U=z?z.style:{};G.push(D9("…",U,Y)),Z[Z.length-1]=G;break}case"clip":{let Y=[],K=0;for(let G of X)if(K+G.width<=Q)Y.push(G),K+=G.width;else break;Z[Z.length-1]=Y;break}default:break}return Z}_isCharacterSelected(J){if(this._selectionStart===null||this._selectionEnd===null)return!1;let Q=Math.min(this._selectionStart,this._selectionEnd),Z=Math.max(this._selectionStart,this._selectionEnd);return J>=Q&&J<Z}attach(){super.attach()}setContext(J){if(!this._selectable)return;let Q=OR.of(J);if(Q&&!this.selectionArea){if(this.selectionArea=Q,Q.register(this),this.selectableId<=0)this.selectableId=Math.floor(Math.random()*1e6)+1}}detach(){if(this.selectionArea)this.selectionArea.unregister(this),this.selectionArea=void 0;super.detach()}onAttachToSelectionArea(J){}onDetachFromSelectionArea(J){}globalBounds(){if(this.size.width<=0||this.size.height<=0)return Qq6;let J=this.offset.x,Q=this.offset.y,Z=this.parent;while(Z){if(Z instanceof Z8)J+=Z.offset.x,Q+=Z.offset.y;Z=Z.parent}return{left:J,top:Q,right:J+this.size.width,bottom:Q+this.size.height}}globalToLocal(J){let Q=this.offset.x,Z=this.offset.y,X=this.parent;while(X){if(X instanceof Z8)Q+=X.offset.x,Z+=X.offset.y;X=X.parent}return{x:J.x-Q,y:J.y-Z}}hitTestSelection(J){if(J.x<0||J.y<0||J.x>=this.size.width||J.y>=this.size.height)return null;let Q=this.getOffsetForPosition(J.x,J.y);return Q!==null?{offset:Q}:null}nearestCaretPosition(J){let Q=Math.max(0,Math.min(J.x,this.size.width)),Z=Math.max(0,Math.min(J.y,this.size.height-1)),X=this.getOffsetForPosition(Q,Z);if(X===null){let Y=Math.floor(Z),K=this._visualLines.find((G)=>G.y===Y);if(K)X=K.end+1;else X=0}return{offset:X}}wordBoundary(J){let Q=this.plainText,Z=Math.max(0,Math.min(J.offset,Q.length)),X=Z,Y=Z;while(X>0){let K=Q[X-1];if(!K||!/\w/.test(K))break;X--}while(Y<Q.length){let K=Q[Y];if(!K||!/\w/.test(K))break;Y++}if(X===Y)Y=Math.min(Z+1,Q.length);return{start:X,end:Y}}lineBoundary(J){let Q=this.plainText,Z=Math.max(0,Math.min(J.offset,Q.length)),X=0,Y=Q.length;for(let K=Z-1;K>=0;K--)if(Q[K]===`
|
|
6423
6423
|
`){X=K+1;break}for(let K=Z;K<Q.length;K++)if(Q[K]===`
|
|
@@ -6426,7 +6426,7 @@ The context used was: `+J.widget.constructor.name);return Q}updateShouldNotify(J
|
|
|
6426
6426
|
`){X=K+1;break}for(let K=Z;K<Q.length-1;K++)if(Q[K]===`
|
|
6427
6427
|
`&&Q[K+1]===`
|
|
6428
6428
|
`){Y=K;break}return{start:X,end:Y}}getSelectionContext(){return this.plainText.includes(`
|
|
6429
|
-
`)?"paragraph":"line"}textLength(){return this.plainText.length}getText(J){let Q=this.plainText;if(!J)return Q;let Z=Math.max(0,Math.min(J.start,Q.length)),X=Math.max(Z,Math.min(J.end,Q.length));return Q.slice(Z,X)}setSelectedRanges(J){if(!this._rangesEqual(this._selectedRanges,J))if(this._selectedRanges=J,J.length>0){let Q=J[0];if(Q)this.updateSelection(Q.start,Q.end,"selection");else this.updateSelection(null,null,"selection")}else this.updateSelection(null,null,"selection")}_rangesEqual(J,Q){if(J.length!==Q.length)return!1;for(let Z=0;Z<J.length;Z++){let X=J[Z],Y=Q[Z];if(!X||!Y||X.start!==Y.start||X.end!==Y.end)return!1}return!0}dispose(){this._text=new N1(""),this._cachedStyledCells=void 0,this._characterPositions=[],this._visualLines=[],this._selectionStart=null,this._selectionEnd=null,super.dispose()}}DR();G9();l8();class s7{constructor(){}toString(){return`${this.constructor.name}()`}}class vp extends s7{constructor(){super()}}class kp extends s7{constructor(){super()}}class _p extends s7{constructor(){super()}}class xp extends s7{constructor(){super()}}class bp extends s7{constructor(){super()}}class yp extends s7{constructor(){super()}}class fp extends s7{constructor(){super()}}class gC extends s7{constructor(){super()}}class mC extends s7{direction;constructor(J){super();this.direction=J}toString(){return`NavigateToPromptHistoryIntent(direction: ${this.direction})`}}class lh1{constructor(){}isEnabled(J){return!0}consumesKey(J){return!0}toString(){return`${this.constructor.name}()`}}class S9 extends lh1{onInvoke;constructor(J){super();this.onInvoke=J}invoke(J){return this.onInvoke(J)}}l8();l8();class q9 extends c0{focusNode;child;autofocus;canRequestFocus;skipTraversal;onKey;onPaste;onFocusChange;debugLabel;constructor({key:J,focusNode:Q,child:Z,autofocus:X=!1,canRequestFocus:Y=!0,skipTraversal:K=!1,onKey:G,onPaste:q,onFocusChange:z,debugLabel:U}){super({key:J});this.focusNode=Q,this.child=Z,this.autofocus=X,this.canRequestFocus=Y,this.skipTraversal=K,this.onKey=G||null,this.onPaste=q||null,this.onFocusChange=z||null,this.debugLabel=U||null}createState(){return new BJ1}}class BJ1 extends d0{_internalFocusNode=null;_isDisposed=!1;_focusChangeHandler=null;get effectiveFocusNode(){return this.widget.focusNode??this._internalFocusNode}initState(){if(super.initState(),!this.widget.focusNode){let Z={canRequestFocus:this.widget.canRequestFocus,skipTraversal:this.widget.skipTraversal};if(this.widget.onKey)Z.onKey=this.widget.onKey;if(this.widget.onPaste)Z.onPaste=this.widget.onPaste;if(this.widget.debugLabel)Z.debugLabel=this.widget.debugLabel;this._internalFocusNode=new Q9(Z)}if(this.widget.onKey&&this.widget.focusNode)this.effectiveFocusNode.addKeyHandler(this.widget.onKey);if(this.widget.onPaste)this.effectiveFocusNode.onPaste=this.widget.onPaste;if(this.widget.onFocusChange)this._focusChangeHandler=(Z)=>{if(!this._isDisposed&&this.widget.onFocusChange)this.widget.onFocusChange(Z.hasFocus)},this.effectiveFocusNode.addListener(this._focusChangeHandler);let Q=this.context.findAncestorStateOfType(BJ1)?.effectiveFocusNode||null;if(rK.instance.registerNode(this.effectiveFocusNode,Q),this.widget.autofocus)setTimeout(()=>{if(!this._isDisposed)this.effectiveFocusNode.requestFocus()},0)}dispose(){if(this.widget.onKey)this.effectiveFocusNode.removeKeyHandler(this.widget.onKey);if(rK.instance.unregisterNode(this.effectiveFocusNode),this._isDisposed=!0,this._focusChangeHandler)this.effectiveFocusNode.removeListener(this._focusChangeHandler),this._focusChangeHandler=null;if(this._internalFocusNode)this._internalFocusNode.dispose(),this._internalFocusNode=null;super.dispose()}build(J){return this.widget.child}}l8();class ih1{invokeAction(J,Q){let Z=this.findAction(J,Q);if(Z&&Z.enabled)return Z.action.invoke(J);return null}findAction(J,Q){let Z=Q;while(Z){let X=Z.findAncestorStateOfType(jR);if(X){let Y=X.getActionForIntent(J);if(Y)return{action:Y,enabled:Y.isEnabled(J)}}Z=Z.parent}return null}}class HZ extends c0{actions;child;dispatcher;constructor({actions:J,child:Q,dispatcher:Z,key:X}){super({key:X});this.actions=J,this.child=Q,this.dispatcher=Z}createState(){return new jR}static invoke(J,Q){return HZ.of(J).invokeAction(Q,J)}static maybeInvoke(J,Q){try{return HZ.invoke(J,Q)}catch{return null}}static find(J,Q){let Z=HZ.maybeFind(J,Q);if(!Z){let X=Q?.constructor.name||"unknown";throw Error(`No action found for intent type: ${X}`)}return Z}static maybeFind(J,Q){let Z=J;while(Z){let X=Z.findAncestorStateOfType(jR);if(X&&Q){let Y=X.getActionForIntent(Q);if(Y)return Y}Z=Z.parent}return null}static of(J){let Q=J.findAncestorStateOfType(jR);if(!Q)throw Error("No Actions widget found in context");return Q.dispatcher}static handler(J,Q){let Z=HZ.of(J).findAction(Q,J);if(Z&&Z.enabled)return()=>Z.action.invoke(Q);return null}}class jR extends d0{dispatcher=new ih1;getActionForIntent(J){let Q=J.constructor;return this.widget.actions.get(Q)}build(J){return this.widget.child}}class b6{key;shift;ctrl;alt;meta;constructor(J,Q={}){this.key=J;this.shift=Q.shift??!1,this.ctrl=Q.ctrl??!1,this.alt=Q.alt??!1,this.meta=Q.meta??!1}accepts(J){return J.key===this.key&&J.shiftKey===this.shift&&J.ctrlKey===this.ctrl&&J.altKey===this.alt&&J.metaKey===this.meta}static key(J){return new b6(J)}static ctrl(J){return new b6(J,{ctrl:!0})}static shift(J){return new b6(J,{shift:!0})}static alt(J){return new b6(J,{alt:!0})}static meta(J){return new b6(J,{meta:!0})}toString(){let J=[];if(this.meta)J.push("Meta");if(this.ctrl)J.push("Ctrl");if(this.alt)J.push("Alt");if(this.shift)J.push("Shift");return J.length>0?`${J.join("+")}+${this.key}`:this.key}}class DJ1{shortcuts=new Map;constructor(J=new Map){this.shortcuts=new Map(J)}handleKeyEvent(J){for(let[Q,Z]of this.shortcuts)if(Q.accepts(J))return Z;return null}addShortcut(J,Q){this.shortcuts.set(J,Q)}removeShortcut(J){return this.shortcuts.delete(J)}getAllShortcuts(){return new Map(this.shortcuts)}copyWith(J){let Q=new Map([...this.shortcuts,...J]);return new DJ1(Q)}}class dq extends c0{shortcuts;child;manager;debugLabel;focusNode;constructor({shortcuts:J,child:Q,manager:Z,debugLabel:X,focusNode:Y,key:K}){super({key:K});this.shortcuts=J,this.child=Q,this.manager=Z,this.debugLabel=X,this.focusNode=Y}createState(){return new Kq6}}class Kq6 extends d0{manager=null;initState(){if(super.initState(),this.createManager(),this.widget.focusNode)this.widget.focusNode.addKeyHandler(this.handleKeyEvent)}didUpdateWidget(J){if(super.didUpdateWidget(J),J.shortcuts!==this.widget.shortcuts||J.manager!==this.widget.manager)this.createManager()}createManager(){if(this.widget.manager)this.manager=this.widget.manager;else this.manager=new DJ1(this.widget.shortcuts)}dispose(){if(this.widget.focusNode)this.widget.focusNode.removeKeyHandler(this.handleKeyEvent);super.dispose()}handleKeyEvent=(J)=>{if(!this.manager)return"ignored";let Q=this.manager.handleKeyEvent(J);if(Q){if(this.invokeIntent(Q)==="handled")return"handled"}return"ignored"};invokeIntent(J){let Q=this.context.findAncestorStateOfType(jR);if(Q){let Z=Q.getActionForIntent(J);if(Z&&Z.isEnabled(J))return Z.invoke(J)}return null}build(J){if(this.widget.focusNode)return this.widget.child;else return new q9({onKey:this.handleKeyEvent,autofocus:!1,canRequestFocus:!0,skipTraversal:!1,debugLabel:this.widget.debugLabel,child:this.widget.child})}}class nh1 extends I6{text;onPressed;padding;cursor;color;reverse;constructor({text:J,onPressed:Q,padding:Z,cursor:X,color:Y,reverse:K,key:G}){super({key:G});this.text=J,this.onPressed=Q,this.padding=Z??V0.symmetric(2,1),this.cursor=X??"pointer",this.color=Y,this.reverse=K??!1}build(J){let Q=this.reverse?new $1({color:E1.black}):this.color?new $1({color:this.color}):void 0,Z=new n1({text:new N1(this.text,Q)}),X=new y0({padding:this.padding,decoration:this.reverse?new i8(this.color??E1.white):void 0,child:Z});return new x9({onClick:async()=>{await this.onPressed()},cursor:this.cursor,child:X})}}l8();class ah1 extends c0{title;child;expanded;onChanged;constructor({key:J,title:Q,child:Z,expanded:X=!1,onChanged:Y}){super({key:J});this.title=Q,this.child=Z,this.expanded=X,this.onChanged=Y}createState(){return new Gq6}}class Gq6 extends d0{get expanded(){return this.widget.expanded}toggle(){this.widget.onChanged?.(!this.expanded)}initState(){super.initState()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.expanded!==this.widget.expanded)this.setState()}build(J){let Q=new n1({text:new N1(this.expanded?"▼":"▶",new $1({color:E1.index(8)}))}),X=[new x9({onClick:this._handleClick.bind(this),cursor:"pointer",child:new X8({mainAxisSize:"min",children:[this.widget.title,new U0({width:1}),Q]})})];if(this.expanded)X.push(this.widget.child);return new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:X})}_handleClick(J){this.toggle()}}G0();l8();class rh1 extends c0{child;constructor(J){super();this.child=J}createState(){return new qq6}}class qq6 extends d0{themeData=tK.default();unsubscribe;initState(){this.checkAndUpdateRgbColors(),this.unsubscribe=D2.instance.onRgbColorsChanged(()=>{this.checkAndUpdateRgbColors()})}dispose(){if(this.unsubscribe)this.unsubscribe()}checkAndUpdateRgbColors(){let Q=D2.instance.getRgbColors();if(u.info("RgbThemeProvider checking for RGB colors",{found:!!Q}),Q)u.info("RgbThemeProvider updating theme with RGB colors"),this.setState(()=>{this.themeData=tK.withRgb(Q)})}build(J){return new e6({data:this.themeData,child:this.widget.child})}}b2();G9();b2();G9();l8();class sh1{scrollableState;context=null;constructor(J){this.scrollableState=J}updateContext(J){this.context=J}handleKeyEvent(J){let{key:Q}=J;if(this.scrollableState.widget.axisDirection==="vertical")switch(Q){case"ArrowUp":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"ArrowDown":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"k":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"j":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"PageUp":return this.scrollableState.handleScrollDelta(-this.getPageScrollStep()),"handled";case"PageDown":return this.scrollableState.handleScrollDelta(this.getPageScrollStep()),"handled";case"u":if(J.ctrlKey)return this.scrollableState.handleScrollDelta(-this.getPageScrollStep()),"handled";break;case"d":if(J.ctrlKey)return this.scrollableState.handleScrollDelta(this.getPageScrollStep()),"handled";break;case"Home":return this.scrollableState.controller.scrollToTop(),"handled";case"End":return this.scrollableState.controller.scrollToBottom(),"handled";case"g":if(J.shiftKey)return this.scrollableState.controller.scrollToBottom(),"handled";else return this.scrollableState.controller.scrollToTop(),"handled"}if(this.scrollableState.widget.axisDirection==="horizontal")switch(Q){case"ArrowLeft":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"ArrowRight":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"h":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"l":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"Home":return this.scrollableState.controller.scrollToTop(),"handled";case"End":return this.scrollableState.controller.scrollToBottom(),"handled";case"g":if(J.shiftKey)return this.scrollableState.controller.scrollToBottom(),"handled";else return this.scrollableState.controller.scrollToTop(),"handled"}return"ignored"}handleMouseWheel(J){let Q=J*this.getScrollStep();this.scrollableState.handleScrollDelta(Q)}handleMouseEvent(J){if(J.button>=64&&J.button<=67&&J.pressed)switch(J.button){case 64:if(this.scrollableState.widget.axisDirection==="vertical")return this.scrollableState.handleScrollDelta(-this.getScrollStep()),!0;break;case 65:if(this.scrollableState.widget.axisDirection==="vertical")return this.scrollableState.handleScrollDelta(this.getScrollStep()),!0;break;case 66:if(this.scrollableState.widget.axisDirection==="horizontal")return this.scrollableState.handleScrollDelta(-this.getScrollStep()),!0;break;case 67:if(this.scrollableState.widget.axisDirection==="horizontal")return this.scrollableState.handleScrollDelta(this.getScrollStep()),!0;break}return!1}getScrollStep(){if(this.context)try{return _8.capabilitiesOf(this.context).scrollStep()}catch{}return 3}getPageScrollStep(){return 10}}G0();class jY{_offset=0;_listeners=[];_disposed=!1;_maxScrollExtent=0;_hasInitialOffset=!1;_animationTimer=null;_animationTarget=null;_animationStartTime=0;_animationDuration=0;_followMode=!0;_shouldFollowToBottom=!1;get offset(){return this._offset}get currentLine(){return this._offset}get maxScrollExtent(){return this._maxScrollExtent}get atTop(){return this._offset<=0}get atBottom(){return this._offset>=this._maxScrollExtent}get atEdge(){return this.atTop||this.atBottom}get followMode(){return this._followMode}set followMode(J){this._followMode=J}get isDisposed(){return this._disposed}get hasInitialOffset(){return this._hasInitialOffset}addListener(J){if(this._disposed)throw Error("ScrollController is disposed");this._listeners.push(J)}removeListener(J){let Q=this._listeners.indexOf(J);if(Q!==-1)this._listeners.splice(Q,1)}updateMaxScrollExtent(J){if(this._disposed)return;let Q=this._maxScrollExtent;if(this._maxScrollExtent=J,Q!==J)this._notifyListeners()}updateOffset(J){if(this._disposed)return;if(this._offset!==J)this._offset=J,this._hasInitialOffset=!0,this._notifyListeners()}animateTo(J,Q=150){if(this._disposed)return;let Z=Math.max(0,Math.min(this._maxScrollExtent,J));if(Math.abs(this._offset-Z)<=1){this.jumpTo(Z);return}if(this._animationTimer&&this._animationTarget!==null){this._animationTarget=Z;return}this._animationTarget=Z,this._animationStartTime=Date.now(),this._animationDuration=Q;let X=this._offset,Y=16;this._animationTimer=setInterval(()=>{let K=Date.now()-this._animationStartTime,G=this._animationTarget,q=G-X,z=Math.min(K/this._animationDuration,1);if(z>=1){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=null,this._animationTarget=null;this.updateOffset(G)}else{let U=X+q*z;this.updateOffset(Math.round(U))}},Y)}jumpTo(J){if(this._disposed)return;let Q=Math.max(0,Math.min(this._maxScrollExtent,J));this.updateOffset(Q)}animateToLine(J,Q){this.animateTo(J,Q)}jumpToLine(J){this.jumpTo(J)}scrollToTop(){this.jumpTo(0)}scrollToBottom(){this.jumpTo(this._maxScrollExtent)}animateToBottom(J=150){this.animateTo(this._maxScrollExtent,J)}enableFollowMode(){this._followMode=!0}disableFollowMode(){this._followMode=!1,this._shouldFollowToBottom=!1}toggleFollowMode(){if(this._followMode=!this._followMode,!this._followMode)this._shouldFollowToBottom=!1}scrollUp(J){if(this._disposed)return;let Q=Math.max(0,this._offset-J);this._shouldFollowToBottom=!1,this.jumpTo(Q)}scrollDown(J){if(this._disposed)return;let Q=Math.min(this._maxScrollExtent,this._offset+J);if(Q<this._maxScrollExtent)this._shouldFollowToBottom=!1;this.jumpTo(Q)}animateScrollUp(J,Q){if(this._disposed)return;let Z=this._animationTarget??this._offset,X=Math.max(0,Z-J);this.animateTo(X,Q)}animateScrollDown(J,Q){if(this._disposed)return;let X=(this._animationTarget??this._offset)+J;this.animateTo(X,Q)}scrollPageUp(J){let Q=Math.max(1,Math.floor(J/2));this.scrollUp(Q)}scrollPageDown(J){let Q=Math.max(1,Math.floor(J/2));this.scrollDown(Q)}animatePageUp(J,Q){let Z=Math.max(1,J);this.animateScrollUp(Z,Q??100)}animatePageDown(J,Q){let Z=Math.max(1,J);this.animateScrollDown(Z,Q??100)}dispose(){if(this._disposed)return;if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=null,this._animationTarget=null;this._shouldFollowToBottom=!1,this._listeners.length=0,this._disposed=!0}_notifyListeners(){let J=[...this._listeners];for(let Q of J)try{Q()}catch(Z){u.error("Error in scroll listener:",Z)}}}class zq6{shouldAcceptUserOffset(){return!0}applyTo(J){return this}}class oh1 extends zq6{applyBoundaryConditions(J,Q,Z){return Math.max(Q,Math.min(Z,J))}}class eh1 extends c0{axisDirection;controller;physics;viewportBuilder;autofocus;constructor({key:J,axisDirection:Q="vertical",controller:Z,physics:X,viewportBuilder:Y,autofocus:K=!1}){super(J?{key:J}:{});this.axisDirection=Q,this.controller=Z,this.physics=X,this.viewportBuilder=Y,this.autofocus=K}createState(){return new Uq6}}class Uq6 extends d0{_controller=null;_physics=null;_scrollBehavior=null;_isDisposed=!1;_boundOnScrollChanged=this._onScrollChanged.bind(this);_boundHandleKeyEvent=this.handleKeyEvent.bind(this);_boundHandleMouseScrollEvent=this.handleMouseScrollEvent.bind(this);get controller(){return this._controller}get physics(){return this._physics}initState(){super.initState(),this._controller=this.widget.controller||new jY,this._physics=this.widget.physics||new oh1,this._scrollBehavior=new sh1(this),this._controller.addListener(this._boundOnScrollChanged)}dispose(){if(this._isDisposed=!0,this._controller)this._controller.removeListener(this._boundOnScrollChanged);if(!this.widget.controller)this._controller?.dispose();super.dispose()}build(J){let Q=this._controller.offset;this._scrollBehavior?.updateContext(J);let Z=this._controller.followMode&&this._controller.atBottom,X=this.widget.viewportBuilder(J,Q,Z,this._controller||void 0);if(X instanceof th1&&X.child)X=new th1(X.child,{axisDirection:X.axisDirection,offset:X.offset,scrollController:this._controller||void 0});return new q9({onKey:this._boundHandleKeyEvent,autofocus:this.widget.autofocus,debugLabel:"Scrollable",child:new x9({onScroll:this._boundHandleMouseScrollEvent,opaque:!1,child:X})})}_onScrollChanged(){this.setState(()=>{})}handleKeyEvent(J){if(!this._scrollBehavior)return"ignored";try{return this._scrollBehavior.handleKeyEvent(J)}catch(Q){return"ignored"}}handleMouseScrollEvent(J){let Q=this.getScrollStep(),Z=J.direction==="down"?Q:-Q;this.handleScrollDelta(Z)}getScrollStep(){return 1}handleMouseEvent(J){return this._scrollBehavior.handleMouseEvent(J)}handleScrollDelta(J){if(!this._physics.shouldAcceptUserOffset())return;let Z=this._controller.offset+J,X=0,Y=this._controller.maxScrollExtent,K=this._physics.applyBoundaryConditions(Z,X,Y);this._controller.updateOffset(K)}}class th1 extends R4{axisDirection;offset;scrollController;constructor(J,{key:Q,axisDirection:Z="vertical",offset:X=0,scrollController:Y}={}){super(Q?{child:J,key:Q}:{child:J});this.axisDirection=Z,this.offset=X,this.scrollController=Y}createRenderObject(){return new Wq6(this.axisDirection,this.offset,this.scrollController)}updateRenderObject(J){J.updateProperties(this.axisDirection,this.offset,this.scrollController)}}class Wq6 extends Z8{_axisDirection;_scrollOffset;_scrollController;constructor(J,Q,Z){super();this._axisDirection=J,this._scrollOffset=Q,this._scrollController=Z}updateProperties(J,Q,Z){let X=!1;if(this._axisDirection!==J)this._axisDirection=J,X=!0;if(this._scrollOffset!==Q)this._scrollOffset=Q,X=!0;if(this._scrollController!==Z)this._scrollController=Z,X=!0;if(X)this.markNeedsLayout()}performLayout(){super.performLayout();let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight);return}let Q=this.children[0];if(this._scrollController&&typeof Q?.getTotalContentHeight==="function"){let X=Q.getTotalContentHeight(),Y=Math.max(0,X-J.maxHeight),K=this._scrollController.atBottom;if(this._scrollController.updateMaxScrollExtent(Y),this._scrollController.followMode&&K)this._scrollController.jumpTo(Y);else if(this._scrollController.offset>Y)this._scrollController.jumpTo(Y);this._scrollOffset=this._scrollController.offset}if(typeof Q.setScrollOffset==="function")Q.setScrollOffset(this._scrollOffset);Q.layout(J),this.handleBottomPositioning(J,Q);let Z=-this._scrollOffset;Q.setOffset(0,Z),this.setSize(J.maxWidth,J.maxHeight)}handleBottomPositioning(J,Q){if(typeof Q.getTotalContentHeight!=="function"||typeof Q.getPosition!=="function")return;let Z=J.maxHeight,X=Q.getTotalContentHeight(),Y=Q.getPosition();if(X<=Z&&Y==="bottom"){let K=-(Z-X);this._scrollOffset=K}}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X){let Y=X,K=Q+Y.offset.x,G=Z+Y.offset.y,q=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(q,K,G)}else X.paint(J,Q,Z)}get axisDirection(){return this._axisDirection}get scrollOffset(){return this._scrollOffset}getMaxScrollExtent(){if(this.children.length===0)return 0;return this.children[0]?.totalScrollExtent||0}dispose(){super.dispose()}}class $Y extends I6{child;controller;scrollDirection;autofocus;position;constructor({key:J,child:Q,controller:Z,scrollDirection:X="vertical",autofocus:Y=!0,position:K="top"}){super(J?{key:J}:{});this.child=Q,this.controller=Z,this.scrollDirection=X,this.autofocus=Y,this.position=K}build(J){return new eh1({controller:this.controller,axisDirection:this.scrollDirection,autofocus:this.autofocus,viewportBuilder:(Q,Z,X,Y)=>{return new Fq6(this.child,{axisDirection:this.scrollDirection,offset:Z,scrollController:Y||this.controller,position:this.position})}})}}class Fq6 extends R4{axisDirection;offset;scrollController;position;constructor(J,{key:Q,axisDirection:Z="vertical",offset:X=0,scrollController:Y,position:K="top"}={}){super(Q?{child:J,key:Q}:{child:J});this.axisDirection=Z,this.offset=X,this.scrollController=Y,this.position=K}createRenderObject(){return new Hq6(this.axisDirection,this.offset,this.scrollController,this.position)}updateRenderObject(J){J.updateProperties(this.axisDirection,this.offset,this.scrollController,this.position)}}class Hq6 extends Z8{_axisDirection;_scrollOffset;_scrollController;_position;get scrollController(){return this._scrollController}constructor(J,Q,Z,X="top"){super();this._axisDirection=J,this._scrollOffset=Q,this._scrollController=Z,this._position=X}updateProperties(J,Q,Z,X="top"){if(this._axisDirection!==J)this._axisDirection=J,this.markNeedsLayout();if(this._scrollController!==Z)this._scrollController=Z,this.markNeedsLayout();if(this._position!==X)this._position=X,this.markNeedsLayout();if(this._scrollOffset!==Q)this._scrollOffset=Q,this.updateChildOffset()}updateChildOffset(){if(this.children.length===0)return;let J=this.children[0],Q=0,Z=0;if(this._axisDirection==="vertical")Z=-this._scrollOffset;else Q=-this._scrollOffset;J.setOffset(Q,Z)}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight),super.performLayout();return}let Q=this.children[0];if(this._axisDirection==="vertical"){let Z=new w6(J.minWidth,J.maxWidth,0,Number.POSITIVE_INFINITY);Q.layout(Z)}else{let Z=new w6(0,Number.POSITIVE_INFINITY,J.minHeight,J.maxHeight);Q.layout(Z)}if(this.setSize(J.maxWidth,J.maxHeight),this._scrollController){let Z=this.totalScrollExtent,X=this._scrollController.atBottom;if(this._scrollController.updateMaxScrollExtent(Z),this._scrollController.followMode&&X)this._scrollController.jumpTo(Z);else if(this._scrollController.offset>Z)this._scrollController.jumpTo(Z);this._scrollOffset=this._scrollController.offset}this.handleBottomPositioning(J,Q),this.updateChildOffset(),super.performLayout()}handleBottomPositioning(J,Q){if(this._position!=="bottom")return;let Z=this._axisDirection==="vertical"?J.maxHeight:J.maxWidth,X=this._axisDirection==="vertical"?Q.size.height:Q.size.width;if(X<=Z){let Y=-(Z-X);this._scrollOffset=Y}}get totalScrollExtent(){if(this.children.length===0)return 0;let J=this.children[0];if(J.size.width<=0||J.size.height<=0||this.size.width<=0||this.size.height<=0)return 0;if(this._axisDirection==="vertical"){let Q=J.size.height,Z=this.size.height;if(!Number.isFinite(Q)||!Number.isFinite(Z))return 0;return Math.max(0,Q-Z)}else{let Q=J.size.width,Z=this.size.width;if(!Number.isFinite(Q)||!Number.isFinite(Z))return 0;return Math.max(0,Q-Z)}}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X&&"paint"in X){let Y=X,K=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(K,Q,Z)}}}G0();l8();G0();class Jg1{_selectables=[];_idToSelectable=new Map;_nextId=1;_selection=null;_isDragging=!1;_dragAnchor=null;_orderedCache=[];_orderDirty=!0;_listeners=new Set;_copyHighlightTimer;_clearSelectionTimer;_onCopyCallback;register(J){let Q=this._nextId++;return J.selectableId=Q,this._selectables.push(J),this._idToSelectable.set(Q,J),this._orderDirty=!0,J.onAttachToSelectionArea(this),Q}unregister(J){let Q=this._selectables.indexOf(J);if(Q===-1)return;if(this._selectables.splice(Q,1),this._idToSelectable.delete(J.selectableId),this._orderDirty=!0,this._selection&&this._involvesSelectable(this._selection,J.selectableId))this.clear();J.setSelectedRanges([]),J.onDetachFromSelectionArea(this)}getAllSelectables(){return[...this._selectables]}hitTest(J){this._ensureOrder();for(let Q=this._orderedCache.length-1;Q>=0;Q--){let Z=this._orderedCache[Q];if(Z){let X=Z.selectable.globalBounds();if(this._pointInRect(J,X))return Z.selectable}}return null}setSelection(J){if(this._selectionsEqual(this._selection,J))return;this._selection=J,this._propagateSelection(),this._notifyListeners()}getSelection(){return this._selection}clear(){this.setSelection(null),this._isDragging=!1,this._dragAnchor=null}selectAll(){if(this._selectables.length===0){this.clear();return}this._ensureOrder();let J=this._orderedCache[0],Q=this._orderedCache[this._orderedCache.length-1];if(!J||!Q){this.clear();return}this.setSelection({anchor:{selectableId:J.selectable.selectableId,offset:0},extent:{selectableId:Q.selectable.selectableId,offset:Q.selectable.textLength()}})}copySelection(){if(!this._selection)return"";let J=this._splitSelectionBySelectable(this._selection),Q=[];this._ensureOrder();for(let{selectable:Z}of this._orderedCache){let X=J.get(Z.selectableId);if(!X||X.length===0)continue;let Y=[];for(let K of X){let G=Z.getText(K);if(G)Y.push(G)}if(Y.length>0){if(Q.length>0&&!Q[Q.length-1]?.endsWith(`
|
|
6429
|
+
`)?"paragraph":"line"}textLength(){return this.plainText.length}getText(J){let Q=this.plainText;if(!J)return Q;let Z=Math.max(0,Math.min(J.start,Q.length)),X=Math.max(Z,Math.min(J.end,Q.length));return Q.slice(Z,X)}setSelectedRanges(J){if(!this._rangesEqual(this._selectedRanges,J))if(this._selectedRanges=J,J.length>0){let Q=J[0];if(Q)this.updateSelection(Q.start,Q.end,"selection");else this.updateSelection(null,null,"selection")}else this.updateSelection(null,null,"selection")}_rangesEqual(J,Q){if(J.length!==Q.length)return!1;for(let Z=0;Z<J.length;Z++){let X=J[Z],Y=Q[Z];if(!X||!Y||X.start!==Y.start||X.end!==Y.end)return!1}return!0}dispose(){this._text=new N1(""),this._cachedStyledCells=void 0,this._characterPositions=[],this._visualLines=[],this._selectionStart=null,this._selectionEnd=null,super.dispose()}}DR();G9();l8();class s7{constructor(){}toString(){return`${this.constructor.name}()`}}class vp extends s7{constructor(){super()}}class kp extends s7{constructor(){super()}}class _p extends s7{constructor(){super()}}class xp extends s7{constructor(){super()}}class bp extends s7{constructor(){super()}}class yp extends s7{constructor(){super()}}class fp extends s7{constructor(){super()}}class gC extends s7{constructor(){super()}}class mC extends s7{direction;constructor(J){super();this.direction=J}toString(){return`NavigateToPromptHistoryIntent(direction: ${this.direction})`}}class lh1{constructor(){}isEnabled(J){return!0}consumesKey(J){return!0}toString(){return`${this.constructor.name}()`}}class S9 extends lh1{onInvoke;constructor(J){super();this.onInvoke=J}invoke(J){return this.onInvoke(J)}}l8();l8();class q9 extends c0{focusNode;child;autofocus;canRequestFocus;skipTraversal;onKey;onPaste;onFocusChange;debugLabel;constructor({key:J,focusNode:Q,child:Z,autofocus:X=!1,canRequestFocus:Y=!0,skipTraversal:K=!1,onKey:G,onPaste:q,onFocusChange:z,debugLabel:U}){super({key:J});this.focusNode=Q,this.child=Z,this.autofocus=X,this.canRequestFocus=Y,this.skipTraversal=K,this.onKey=G||null,this.onPaste=q||null,this.onFocusChange=z||null,this.debugLabel=U||null}createState(){return new BJ1}}class BJ1 extends d0{_internalFocusNode=null;_isDisposed=!1;_focusChangeHandler=null;get effectiveFocusNode(){return this.widget.focusNode??this._internalFocusNode}initState(){if(super.initState(),!this.widget.focusNode){let Z={canRequestFocus:this.widget.canRequestFocus,skipTraversal:this.widget.skipTraversal};if(this.widget.onKey)Z.onKey=this.widget.onKey;if(this.widget.onPaste)Z.onPaste=this.widget.onPaste;if(this.widget.debugLabel)Z.debugLabel=this.widget.debugLabel;this._internalFocusNode=new Q9(Z)}if(this.widget.onKey&&this.widget.focusNode)this.effectiveFocusNode.addKeyHandler(this.widget.onKey);if(this.widget.onPaste)this.effectiveFocusNode.onPaste=this.widget.onPaste;if(this.widget.onFocusChange)this._focusChangeHandler=(Z)=>{if(!this._isDisposed&&this.widget.onFocusChange)this.widget.onFocusChange(Z.hasFocus)},this.effectiveFocusNode.addListener(this._focusChangeHandler);let Q=this.context.findAncestorStateOfType(BJ1)?.effectiveFocusNode||null;if(rK.instance.registerNode(this.effectiveFocusNode,Q),this.widget.autofocus)setTimeout(()=>{if(!this._isDisposed)this.effectiveFocusNode.requestFocus()},0)}dispose(){if(this.widget.onKey)this.effectiveFocusNode.removeKeyHandler(this.widget.onKey);if(rK.instance.unregisterNode(this.effectiveFocusNode),this._isDisposed=!0,this._focusChangeHandler)this.effectiveFocusNode.removeListener(this._focusChangeHandler),this._focusChangeHandler=null;if(this._internalFocusNode)this._internalFocusNode.dispose(),this._internalFocusNode=null;super.dispose()}build(J){return this.widget.child}}l8();class ih1{invokeAction(J,Q){let Z=this.findAction(J,Q);if(Z&&Z.enabled)return Z.action.invoke(J);return null}findAction(J,Q){let Z=Q;while(Z){let X=Z.findAncestorStateOfType(jR);if(X){let Y=X.getActionForIntent(J);if(Y)return{action:Y,enabled:Y.isEnabled(J)}}Z=Z.parent}return null}}class HZ extends c0{actions;child;dispatcher;constructor({actions:J,child:Q,dispatcher:Z,key:X}){super({key:X});this.actions=J,this.child=Q,this.dispatcher=Z}createState(){return new jR}static invoke(J,Q){return HZ.of(J).invokeAction(Q,J)}static maybeInvoke(J,Q){try{return HZ.invoke(J,Q)}catch{return null}}static find(J,Q){let Z=HZ.maybeFind(J,Q);if(!Z){let X=Q?.constructor.name||"unknown";throw Error(`No action found for intent type: ${X}`)}return Z}static maybeFind(J,Q){let Z=J;while(Z){let X=Z.findAncestorStateOfType(jR);if(X&&Q){let Y=X.getActionForIntent(Q);if(Y)return Y}Z=Z.parent}return null}static of(J){let Q=J.findAncestorStateOfType(jR);if(!Q)throw Error("No Actions widget found in context");return Q.dispatcher}static handler(J,Q){let Z=HZ.of(J).findAction(Q,J);if(Z&&Z.enabled)return()=>Z.action.invoke(Q);return null}}class jR extends d0{dispatcher=new ih1;getActionForIntent(J){let Q=J.constructor;return this.widget.actions.get(Q)}build(J){return this.widget.child}}class b6{key;shift;ctrl;alt;meta;constructor(J,Q={}){this.key=J;this.shift=Q.shift??!1,this.ctrl=Q.ctrl??!1,this.alt=Q.alt??!1,this.meta=Q.meta??!1}accepts(J){return J.key===this.key&&J.shiftKey===this.shift&&J.ctrlKey===this.ctrl&&J.altKey===this.alt&&J.metaKey===this.meta}static key(J){return new b6(J)}static ctrl(J){return new b6(J,{ctrl:!0})}static shift(J){return new b6(J,{shift:!0})}static alt(J){return new b6(J,{alt:!0})}static meta(J){return new b6(J,{meta:!0})}toString(){let J=[];if(this.meta)J.push("Meta");if(this.ctrl)J.push("Ctrl");if(this.alt)J.push("Alt");if(this.shift)J.push("Shift");return J.length>0?`${J.join("+")}+${this.key}`:this.key}}class DJ1{shortcuts=new Map;constructor(J=new Map){this.shortcuts=new Map(J)}handleKeyEvent(J){for(let[Q,Z]of this.shortcuts)if(Q.accepts(J))return Z;return null}addShortcut(J,Q){this.shortcuts.set(J,Q)}removeShortcut(J){return this.shortcuts.delete(J)}getAllShortcuts(){return new Map(this.shortcuts)}copyWith(J){let Q=new Map([...this.shortcuts,...J]);return new DJ1(Q)}}class dq extends c0{shortcuts;child;manager;debugLabel;focusNode;constructor({shortcuts:J,child:Q,manager:Z,debugLabel:X,focusNode:Y,key:K}){super({key:K});this.shortcuts=J,this.child=Q,this.manager=Z,this.debugLabel=X,this.focusNode=Y}createState(){return new Kq6}}class Kq6 extends d0{manager=null;initState(){if(super.initState(),this.createManager(),this.widget.focusNode)this.widget.focusNode.addKeyHandler(this.handleKeyEvent)}didUpdateWidget(J){if(super.didUpdateWidget(J),J.shortcuts!==this.widget.shortcuts||J.manager!==this.widget.manager)this.createManager()}createManager(){if(this.widget.manager)this.manager=this.widget.manager;else this.manager=new DJ1(this.widget.shortcuts)}dispose(){if(this.widget.focusNode)this.widget.focusNode.removeKeyHandler(this.handleKeyEvent);super.dispose()}handleKeyEvent=(J)=>{if(!this.manager)return"ignored";let Q=this.manager.handleKeyEvent(J);if(Q){if(this.invokeIntent(Q)==="handled")return"handled"}return"ignored"};invokeIntent(J){let Q=this.context.findAncestorStateOfType(jR);if(Q){let Z=Q.getActionForIntent(J);if(Z&&Z.isEnabled(J))return Z.invoke(J)}return null}build(J){if(this.widget.focusNode)return this.widget.child;else return new q9({onKey:this.handleKeyEvent,autofocus:!1,canRequestFocus:!0,skipTraversal:!1,debugLabel:this.widget.debugLabel,child:this.widget.child})}}class nh1 extends I6{text;onPressed;padding;cursor;color;reverse;constructor({text:J,onPressed:Q,padding:Z,cursor:X,color:Y,reverse:K,key:G}){super({key:G});this.text=J,this.onPressed=Q,this.padding=Z??V0.symmetric(2,1),this.cursor=X??"pointer",this.color=Y,this.reverse=K??!1}build(J){let Q=this.reverse?new j1({color:E1.black}):this.color?new j1({color:this.color}):void 0,Z=new n1({text:new N1(this.text,Q)}),X=new y0({padding:this.padding,decoration:this.reverse?new i8(this.color??E1.white):void 0,child:Z});return new x9({onClick:async()=>{await this.onPressed()},cursor:this.cursor,child:X})}}l8();class ah1 extends c0{title;child;expanded;onChanged;constructor({key:J,title:Q,child:Z,expanded:X=!1,onChanged:Y}){super({key:J});this.title=Q,this.child=Z,this.expanded=X,this.onChanged=Y}createState(){return new Gq6}}class Gq6 extends d0{get expanded(){return this.widget.expanded}toggle(){this.widget.onChanged?.(!this.expanded)}initState(){super.initState()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.expanded!==this.widget.expanded)this.setState()}build(J){let Q=new n1({text:new N1(this.expanded?"▼":"▶",new j1({color:E1.index(8)}))}),X=[new x9({onClick:this._handleClick.bind(this),cursor:"pointer",child:new X8({mainAxisSize:"min",children:[this.widget.title,new U0({width:1}),Q]})})];if(this.expanded)X.push(this.widget.child);return new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:X})}_handleClick(J){this.toggle()}}G0();l8();class rh1 extends c0{child;constructor(J){super();this.child=J}createState(){return new qq6}}class qq6 extends d0{themeData=tK.default();unsubscribe;initState(){this.checkAndUpdateRgbColors(),this.unsubscribe=D2.instance.onRgbColorsChanged(()=>{this.checkAndUpdateRgbColors()})}dispose(){if(this.unsubscribe)this.unsubscribe()}checkAndUpdateRgbColors(){let Q=D2.instance.getRgbColors();if(u.info("RgbThemeProvider checking for RGB colors",{found:!!Q}),Q)u.info("RgbThemeProvider updating theme with RGB colors"),this.setState(()=>{this.themeData=tK.withRgb(Q)})}build(J){return new e6({data:this.themeData,child:this.widget.child})}}b2();G9();b2();G9();l8();class sh1{scrollableState;context=null;constructor(J){this.scrollableState=J}updateContext(J){this.context=J}handleKeyEvent(J){let{key:Q}=J;if(this.scrollableState.widget.axisDirection==="vertical")switch(Q){case"ArrowUp":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"ArrowDown":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"k":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"j":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"PageUp":return this.scrollableState.handleScrollDelta(-this.getPageScrollStep()),"handled";case"PageDown":return this.scrollableState.handleScrollDelta(this.getPageScrollStep()),"handled";case"u":if(J.ctrlKey)return this.scrollableState.handleScrollDelta(-this.getPageScrollStep()),"handled";break;case"d":if(J.ctrlKey)return this.scrollableState.handleScrollDelta(this.getPageScrollStep()),"handled";break;case"Home":return this.scrollableState.controller.scrollToTop(),"handled";case"End":return this.scrollableState.controller.scrollToBottom(),"handled";case"g":if(J.shiftKey)return this.scrollableState.controller.scrollToBottom(),"handled";else return this.scrollableState.controller.scrollToTop(),"handled"}if(this.scrollableState.widget.axisDirection==="horizontal")switch(Q){case"ArrowLeft":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"ArrowRight":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"h":return this.scrollableState.handleScrollDelta(-this.getScrollStep()),"handled";case"l":return this.scrollableState.handleScrollDelta(this.getScrollStep()),"handled";case"Home":return this.scrollableState.controller.scrollToTop(),"handled";case"End":return this.scrollableState.controller.scrollToBottom(),"handled";case"g":if(J.shiftKey)return this.scrollableState.controller.scrollToBottom(),"handled";else return this.scrollableState.controller.scrollToTop(),"handled"}return"ignored"}handleMouseWheel(J){let Q=J*this.getScrollStep();this.scrollableState.handleScrollDelta(Q)}handleMouseEvent(J){if(J.button>=64&&J.button<=67&&J.pressed)switch(J.button){case 64:if(this.scrollableState.widget.axisDirection==="vertical")return this.scrollableState.handleScrollDelta(-this.getScrollStep()),!0;break;case 65:if(this.scrollableState.widget.axisDirection==="vertical")return this.scrollableState.handleScrollDelta(this.getScrollStep()),!0;break;case 66:if(this.scrollableState.widget.axisDirection==="horizontal")return this.scrollableState.handleScrollDelta(-this.getScrollStep()),!0;break;case 67:if(this.scrollableState.widget.axisDirection==="horizontal")return this.scrollableState.handleScrollDelta(this.getScrollStep()),!0;break}return!1}getScrollStep(){if(this.context)try{return _8.capabilitiesOf(this.context).scrollStep()}catch{}return 3}getPageScrollStep(){return 10}}G0();class jY{_offset=0;_listeners=[];_disposed=!1;_maxScrollExtent=0;_hasInitialOffset=!1;_animationTimer=null;_animationTarget=null;_animationStartTime=0;_animationDuration=0;_followMode=!0;_shouldFollowToBottom=!1;get offset(){return this._offset}get currentLine(){return this._offset}get maxScrollExtent(){return this._maxScrollExtent}get atTop(){return this._offset<=0}get atBottom(){return this._offset>=this._maxScrollExtent}get atEdge(){return this.atTop||this.atBottom}get followMode(){return this._followMode}set followMode(J){this._followMode=J}get isDisposed(){return this._disposed}get hasInitialOffset(){return this._hasInitialOffset}addListener(J){if(this._disposed)throw Error("ScrollController is disposed");this._listeners.push(J)}removeListener(J){let Q=this._listeners.indexOf(J);if(Q!==-1)this._listeners.splice(Q,1)}updateMaxScrollExtent(J){if(this._disposed)return;let Q=this._maxScrollExtent;if(this._maxScrollExtent=J,Q!==J)this._notifyListeners()}updateOffset(J){if(this._disposed)return;if(this._offset!==J)this._offset=J,this._hasInitialOffset=!0,this._notifyListeners()}animateTo(J,Q=150){if(this._disposed)return;let Z=Math.max(0,Math.min(this._maxScrollExtent,J));if(Math.abs(this._offset-Z)<=1){this.jumpTo(Z);return}if(this._animationTimer&&this._animationTarget!==null){this._animationTarget=Z;return}this._animationTarget=Z,this._animationStartTime=Date.now(),this._animationDuration=Q;let X=this._offset,Y=16;this._animationTimer=setInterval(()=>{let K=Date.now()-this._animationStartTime,G=this._animationTarget,q=G-X,z=Math.min(K/this._animationDuration,1);if(z>=1){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=null,this._animationTarget=null;this.updateOffset(G)}else{let U=X+q*z;this.updateOffset(Math.round(U))}},Y)}jumpTo(J){if(this._disposed)return;let Q=Math.max(0,Math.min(this._maxScrollExtent,J));this.updateOffset(Q)}animateToLine(J,Q){this.animateTo(J,Q)}jumpToLine(J){this.jumpTo(J)}scrollToTop(){this.jumpTo(0)}scrollToBottom(){this.jumpTo(this._maxScrollExtent)}animateToBottom(J=150){this.animateTo(this._maxScrollExtent,J)}enableFollowMode(){this._followMode=!0}disableFollowMode(){this._followMode=!1,this._shouldFollowToBottom=!1}toggleFollowMode(){if(this._followMode=!this._followMode,!this._followMode)this._shouldFollowToBottom=!1}scrollUp(J){if(this._disposed)return;let Q=Math.max(0,this._offset-J);this._shouldFollowToBottom=!1,this.jumpTo(Q)}scrollDown(J){if(this._disposed)return;let Q=Math.min(this._maxScrollExtent,this._offset+J);if(Q<this._maxScrollExtent)this._shouldFollowToBottom=!1;this.jumpTo(Q)}animateScrollUp(J,Q){if(this._disposed)return;let Z=this._animationTarget??this._offset,X=Math.max(0,Z-J);this.animateTo(X,Q)}animateScrollDown(J,Q){if(this._disposed)return;let X=(this._animationTarget??this._offset)+J;this.animateTo(X,Q)}scrollPageUp(J){let Q=Math.max(1,Math.floor(J/2));this.scrollUp(Q)}scrollPageDown(J){let Q=Math.max(1,Math.floor(J/2));this.scrollDown(Q)}animatePageUp(J,Q){let Z=Math.max(1,J);this.animateScrollUp(Z,Q??100)}animatePageDown(J,Q){let Z=Math.max(1,J);this.animateScrollDown(Z,Q??100)}dispose(){if(this._disposed)return;if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=null,this._animationTarget=null;this._shouldFollowToBottom=!1,this._listeners.length=0,this._disposed=!0}_notifyListeners(){let J=[...this._listeners];for(let Q of J)try{Q()}catch(Z){u.error("Error in scroll listener:",Z)}}}class zq6{shouldAcceptUserOffset(){return!0}applyTo(J){return this}}class oh1 extends zq6{applyBoundaryConditions(J,Q,Z){return Math.max(Q,Math.min(Z,J))}}class eh1 extends c0{axisDirection;controller;physics;viewportBuilder;autofocus;constructor({key:J,axisDirection:Q="vertical",controller:Z,physics:X,viewportBuilder:Y,autofocus:K=!1}){super(J?{key:J}:{});this.axisDirection=Q,this.controller=Z,this.physics=X,this.viewportBuilder=Y,this.autofocus=K}createState(){return new Uq6}}class Uq6 extends d0{_controller=null;_physics=null;_scrollBehavior=null;_isDisposed=!1;_boundOnScrollChanged=this._onScrollChanged.bind(this);_boundHandleKeyEvent=this.handleKeyEvent.bind(this);_boundHandleMouseScrollEvent=this.handleMouseScrollEvent.bind(this);get controller(){return this._controller}get physics(){return this._physics}initState(){super.initState(),this._controller=this.widget.controller||new jY,this._physics=this.widget.physics||new oh1,this._scrollBehavior=new sh1(this),this._controller.addListener(this._boundOnScrollChanged)}dispose(){if(this._isDisposed=!0,this._controller)this._controller.removeListener(this._boundOnScrollChanged);if(!this.widget.controller)this._controller?.dispose();super.dispose()}build(J){let Q=this._controller.offset;this._scrollBehavior?.updateContext(J);let Z=this._controller.followMode&&this._controller.atBottom,X=this.widget.viewportBuilder(J,Q,Z,this._controller||void 0);if(X instanceof th1&&X.child)X=new th1(X.child,{axisDirection:X.axisDirection,offset:X.offset,scrollController:this._controller||void 0});return new q9({onKey:this._boundHandleKeyEvent,autofocus:this.widget.autofocus,debugLabel:"Scrollable",child:new x9({onScroll:this._boundHandleMouseScrollEvent,opaque:!1,child:X})})}_onScrollChanged(){this.setState(()=>{})}handleKeyEvent(J){if(!this._scrollBehavior)return"ignored";try{return this._scrollBehavior.handleKeyEvent(J)}catch(Q){return"ignored"}}handleMouseScrollEvent(J){let Q=this.getScrollStep(),Z=J.direction==="down"?Q:-Q;this.handleScrollDelta(Z)}getScrollStep(){return 1}handleMouseEvent(J){return this._scrollBehavior.handleMouseEvent(J)}handleScrollDelta(J){if(!this._physics.shouldAcceptUserOffset())return;let Z=this._controller.offset+J,X=0,Y=this._controller.maxScrollExtent,K=this._physics.applyBoundaryConditions(Z,X,Y);this._controller.updateOffset(K)}}class th1 extends R4{axisDirection;offset;scrollController;constructor(J,{key:Q,axisDirection:Z="vertical",offset:X=0,scrollController:Y}={}){super(Q?{child:J,key:Q}:{child:J});this.axisDirection=Z,this.offset=X,this.scrollController=Y}createRenderObject(){return new Wq6(this.axisDirection,this.offset,this.scrollController)}updateRenderObject(J){J.updateProperties(this.axisDirection,this.offset,this.scrollController)}}class Wq6 extends Z8{_axisDirection;_scrollOffset;_scrollController;constructor(J,Q,Z){super();this._axisDirection=J,this._scrollOffset=Q,this._scrollController=Z}updateProperties(J,Q,Z){let X=!1;if(this._axisDirection!==J)this._axisDirection=J,X=!0;if(this._scrollOffset!==Q)this._scrollOffset=Q,X=!0;if(this._scrollController!==Z)this._scrollController=Z,X=!0;if(X)this.markNeedsLayout()}performLayout(){super.performLayout();let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight);return}let Q=this.children[0];if(this._scrollController&&typeof Q?.getTotalContentHeight==="function"){let X=Q.getTotalContentHeight(),Y=Math.max(0,X-J.maxHeight),K=this._scrollController.atBottom;if(this._scrollController.updateMaxScrollExtent(Y),this._scrollController.followMode&&K)this._scrollController.jumpTo(Y);else if(this._scrollController.offset>Y)this._scrollController.jumpTo(Y);this._scrollOffset=this._scrollController.offset}if(typeof Q.setScrollOffset==="function")Q.setScrollOffset(this._scrollOffset);Q.layout(J),this.handleBottomPositioning(J,Q);let Z=-this._scrollOffset;Q.setOffset(0,Z),this.setSize(J.maxWidth,J.maxHeight)}handleBottomPositioning(J,Q){if(typeof Q.getTotalContentHeight!=="function"||typeof Q.getPosition!=="function")return;let Z=J.maxHeight,X=Q.getTotalContentHeight(),Y=Q.getPosition();if(X<=Z&&Y==="bottom"){let K=-(Z-X);this._scrollOffset=K}}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X){let Y=X,K=Q+Y.offset.x,G=Z+Y.offset.y,q=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(q,K,G)}else X.paint(J,Q,Z)}get axisDirection(){return this._axisDirection}get scrollOffset(){return this._scrollOffset}getMaxScrollExtent(){if(this.children.length===0)return 0;return this.children[0]?.totalScrollExtent||0}dispose(){super.dispose()}}class $Y extends I6{child;controller;scrollDirection;autofocus;position;constructor({key:J,child:Q,controller:Z,scrollDirection:X="vertical",autofocus:Y=!0,position:K="top"}){super(J?{key:J}:{});this.child=Q,this.controller=Z,this.scrollDirection=X,this.autofocus=Y,this.position=K}build(J){return new eh1({controller:this.controller,axisDirection:this.scrollDirection,autofocus:this.autofocus,viewportBuilder:(Q,Z,X,Y)=>{return new Fq6(this.child,{axisDirection:this.scrollDirection,offset:Z,scrollController:Y||this.controller,position:this.position})}})}}class Fq6 extends R4{axisDirection;offset;scrollController;position;constructor(J,{key:Q,axisDirection:Z="vertical",offset:X=0,scrollController:Y,position:K="top"}={}){super(Q?{child:J,key:Q}:{child:J});this.axisDirection=Z,this.offset=X,this.scrollController=Y,this.position=K}createRenderObject(){return new Hq6(this.axisDirection,this.offset,this.scrollController,this.position)}updateRenderObject(J){J.updateProperties(this.axisDirection,this.offset,this.scrollController,this.position)}}class Hq6 extends Z8{_axisDirection;_scrollOffset;_scrollController;_position;get scrollController(){return this._scrollController}constructor(J,Q,Z,X="top"){super();this._axisDirection=J,this._scrollOffset=Q,this._scrollController=Z,this._position=X}updateProperties(J,Q,Z,X="top"){if(this._axisDirection!==J)this._axisDirection=J,this.markNeedsLayout();if(this._scrollController!==Z)this._scrollController=Z,this.markNeedsLayout();if(this._position!==X)this._position=X,this.markNeedsLayout();if(this._scrollOffset!==Q)this._scrollOffset=Q,this.updateChildOffset()}updateChildOffset(){if(this.children.length===0)return;let J=this.children[0],Q=0,Z=0;if(this._axisDirection==="vertical")Z=-this._scrollOffset;else Q=-this._scrollOffset;J.setOffset(Q,Z)}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight),super.performLayout();return}let Q=this.children[0];if(this._axisDirection==="vertical"){let Z=new w6(J.minWidth,J.maxWidth,0,Number.POSITIVE_INFINITY);Q.layout(Z)}else{let Z=new w6(0,Number.POSITIVE_INFINITY,J.minHeight,J.maxHeight);Q.layout(Z)}if(this.setSize(J.maxWidth,J.maxHeight),this._scrollController){let Z=this.totalScrollExtent,X=this._scrollController.atBottom;if(this._scrollController.updateMaxScrollExtent(Z),this._scrollController.followMode&&X)this._scrollController.jumpTo(Z);else if(this._scrollController.offset>Z)this._scrollController.jumpTo(Z);this._scrollOffset=this._scrollController.offset}this.handleBottomPositioning(J,Q),this.updateChildOffset(),super.performLayout()}handleBottomPositioning(J,Q){if(this._position!=="bottom")return;let Z=this._axisDirection==="vertical"?J.maxHeight:J.maxWidth,X=this._axisDirection==="vertical"?Q.size.height:Q.size.width;if(X<=Z){let Y=-(Z-X);this._scrollOffset=Y}}get totalScrollExtent(){if(this.children.length===0)return 0;let J=this.children[0];if(J.size.width<=0||J.size.height<=0||this.size.width<=0||this.size.height<=0)return 0;if(this._axisDirection==="vertical"){let Q=J.size.height,Z=this.size.height;if(!Number.isFinite(Q)||!Number.isFinite(Z))return 0;return Math.max(0,Q-Z)}else{let Q=J.size.width,Z=this.size.width;if(!Number.isFinite(Q)||!Number.isFinite(Z))return 0;return Math.max(0,Q-Z)}}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X&&"paint"in X){let Y=X,K=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(K,Q,Z)}}}G0();l8();G0();class Jg1{_selectables=[];_idToSelectable=new Map;_nextId=1;_selection=null;_isDragging=!1;_dragAnchor=null;_orderedCache=[];_orderDirty=!0;_listeners=new Set;_copyHighlightTimer;_clearSelectionTimer;_onCopyCallback;register(J){let Q=this._nextId++;return J.selectableId=Q,this._selectables.push(J),this._idToSelectable.set(Q,J),this._orderDirty=!0,J.onAttachToSelectionArea(this),Q}unregister(J){let Q=this._selectables.indexOf(J);if(Q===-1)return;if(this._selectables.splice(Q,1),this._idToSelectable.delete(J.selectableId),this._orderDirty=!0,this._selection&&this._involvesSelectable(this._selection,J.selectableId))this.clear();J.setSelectedRanges([]),J.onDetachFromSelectionArea(this)}getAllSelectables(){return[...this._selectables]}hitTest(J){this._ensureOrder();for(let Q=this._orderedCache.length-1;Q>=0;Q--){let Z=this._orderedCache[Q];if(Z){let X=Z.selectable.globalBounds();if(this._pointInRect(J,X))return Z.selectable}}return null}setSelection(J){if(this._selectionsEqual(this._selection,J))return;this._selection=J,this._propagateSelection(),this._notifyListeners()}getSelection(){return this._selection}clear(){this.setSelection(null),this._isDragging=!1,this._dragAnchor=null}selectAll(){if(this._selectables.length===0){this.clear();return}this._ensureOrder();let J=this._orderedCache[0],Q=this._orderedCache[this._orderedCache.length-1];if(!J||!Q){this.clear();return}this.setSelection({anchor:{selectableId:J.selectable.selectableId,offset:0},extent:{selectableId:Q.selectable.selectableId,offset:Q.selectable.textLength()}})}copySelection(){if(!this._selection)return"";let J=this._splitSelectionBySelectable(this._selection),Q=[];this._ensureOrder();for(let{selectable:Z}of this._orderedCache){let X=J.get(Z.selectableId);if(!X||X.length===0)continue;let Y=[];for(let K of X){let G=Z.getText(K);if(G)Y.push(G)}if(Y.length>0){if(Q.length>0&&!Q[Q.length-1]?.endsWith(`
|
|
6430
6430
|
`))Q.push(`
|
|
6431
6431
|
`);Q.push(...Y)}}return Q.join("")}startCopyHighlight(){if(!this._selection)return;this._applyHighlightMode("copy")}endCopyHighlight(){if(!this._selection)return;this._applyHighlightMode("selection")}_startCopyHighlightWithTimer(){if(this._copyHighlightTimer)clearTimeout(this._copyHighlightTimer),this._copyHighlightTimer=void 0;if(this._clearSelectionTimer)clearTimeout(this._clearSelectionTimer),this._clearSelectionTimer=void 0;this.startCopyHighlight(),this._copyHighlightTimer=setTimeout(()=>{this.endCopyHighlight(),this._copyHighlightTimer=void 0},300)}beginDrag(J){this._isDragging=!0,this._dragAnchor=J,this.setSelection({anchor:J,extent:J})}updateDrag(J){if(!this._isDragging||!this._dragAnchor)return;this.setSelection({anchor:this._dragAnchor,extent:J})}async endDrag(){this._isDragging=!1,await this._autoCopySelection()}async autoCopySelection(){await this._autoCopySelection()}async _autoCopySelection(){if(this._selection){let J=this.copySelection();if(J){try{await wY.writeText(J)}catch(Q){u.debug("Failed to write selection to clipboard:",Q)}this._startCopyHighlightWithTimer(),this._clearSelectionTimer=setTimeout(()=>{this.clear(),this._clearSelectionTimer=void 0},300),this._onCopyCallback?.(J)}}}isDragging(){return this._isDragging}addListener(J){return this._listeners.add(J),()=>this._listeners.delete(J)}setOnCopyCallback(J){this._onCopyCallback=J}dispose(){for(let J of this._selectables)J.setSelectedRanges([]),J.onDetachFromSelectionArea(this);if(this._selectables.length=0,this._idToSelectable.clear(),this._orderedCache.length=0,this._selection=null,this._isDragging=!1,this._dragAnchor=null,this._listeners.clear(),this._copyHighlightTimer)clearTimeout(this._copyHighlightTimer),this._copyHighlightTimer=void 0;if(this._clearSelectionTimer)clearTimeout(this._clearSelectionTimer),this._clearSelectionTimer=void 0}_ensureOrder(){if(!this._orderDirty)return;this._orderedCache=this._selectables.map((J)=>({selectable:J})).sort((J,Q)=>{let Z=J.selectable.globalBounds(),X=Q.selectable.globalBounds(),Y=Z.top-X.top;if(Y!==0)return Y;return Z.left-X.left}),this._orderDirty=!1}_propagateSelection(){if(!this._selection){for(let Q of this._selectables)Q.setSelectedRanges([]);return}let J=this._splitSelectionBySelectable(this._selection);for(let Q of this._selectables){let Z=J.get(Q.selectableId)??[];Q.setSelectedRanges(Z)}}_applyHighlightMode(J){if(!this._selection)return;for(let Q of this._selectables)Q.setHighlightMode?.(J)}_splitSelectionBySelectable(J){let[Q,Z]=this._compareDocumentPositions(J.anchor,J.extent)<=0?[J.anchor,J.extent]:[J.extent,J.anchor],X=new Map;if(Q.selectableId===Z.selectableId)return X.set(Q.selectableId,[{start:Q.offset,end:Z.offset}]),X;this._ensureOrder();let Y=!1;for(let{selectable:K}of this._orderedCache){let G=K.selectableId;if(!Y){if(G===Q.selectableId)Y=!0,X.set(G,[{start:Q.offset,end:K.textLength()}])}else if(G===Z.selectableId){X.set(G,[{start:0,end:Z.offset}]);break}else X.set(G,[{start:0,end:K.textLength()}])}return X}_compareDocumentPositions(J,Q){return Zq6(J,Q,(Z,X)=>{this._ensureOrder();let Y=this._orderedCache.findIndex((G)=>G.selectable.selectableId===Z),K=this._orderedCache.findIndex((G)=>G.selectable.selectableId===X);if(Y===-1||K===-1)return Z-X;return Y-K})}_involvesSelectable(J,Q){return J.anchor.selectableId===Q||J.extent.selectableId===Q}_pointInRect(J,Q){return J.x>=Q.left&&J.x<=Q.right&&J.y>=Q.top&&J.y<=Q.bottom}_selectionsEqual(J,Q){if(J===null&&Q===null)return!0;if(J===null||Q===null)return!1;return J.anchor.selectableId===Q.anchor.selectableId&&J.anchor.offset===Q.anchor.offset&&J.extent.selectableId===Q.extent.selectableId&&J.extent.offset===Q.extent.offset}_notifyListeners(){for(let J of this._listeners)try{J()}catch(Q){}}getDebugInfo(){return{selectableCount:this._selectables.length,hasSelection:this._selection!==null,isDragging:this._isDragging,selection:this._selection}}}class $R extends c0{child;focusNode;enabled;onCopy;constructor({key:J,child:Q,focusNode:Z,enabled:X=!0,onCopy:Y}){super({key:J});this.child=Q,this.focusNode=Z,this.enabled=X,this.onCopy=Y}createState(){return new Bq6}}class Bq6 extends d0{_controller;_focusNode;_globalReleaseCallback;_globalMoveCallback;_globalClickCallback;_doubleClickTimer;_tripleClickTimer;_lastHoverCheck=0;_lastHoverPosition={x:-1,y:-1};_currentCursor=z7.DEFAULT;get controller(){return this._controller}get focusNode(){return this._focusNode}initState(){super.initState(),this._controller=new Jg1,this._controller.setOnCopyCallback(this.widget.onCopy),this._focusNode=this.widget.focusNode??new Q9({debugLabel:"SelectionArea",onKey:this._handleKeyEvent.bind(this)}),this._globalClickCallback=this._handleGlobalClick.bind(this),I5.instance.addGlobalClickCallback(this._globalClickCallback)}build(J){if(!this.widget.enabled)return this.widget.child;let Q=new x9({onClick:this._handleMouseClick.bind(this),onDrag:this._handleMouseDrag.bind(this),onHover:this._handleMouseHover.bind(this),onExit:this._handleMouseExit.bind(this),cursor:this._currentCursor,opaque:!1,child:this.widget.child});return new q9({focusNode:this._focusNode,child:new OR({controller:this._controller,child:Q})})}_handleMouseClick(J){if(J.button!=="left")return;let Q={x:J.position.x,y:J.position.y},Z=this._controller.hitTest(Q);if(!Z)return;let X=Z.globalToLocal(Q),Y=Z.hitTestSelection(X)??Z.nearestCaretPosition(X);if(J.clickCount===2){let G=Z.wordBoundary(Y),q={selectableId:Z.selectableId,offset:G.start},z={selectableId:Z.selectableId,offset:G.end};this._controller.setSelection({anchor:q,extent:z}),this._doubleClickTimer=setTimeout(()=>{this._controller.autoCopySelection(),this._doubleClickTimer=void 0},500);return}else if(J.clickCount===3){if(this._doubleClickTimer)clearTimeout(this._doubleClickTimer),this._doubleClickTimer=void 0;let G=Z.getSelectionContext?.()??"line",q;if(G==="paragraph"&&Z.paragraphBoundary)q=Z.paragraphBoundary(Y);else q=Z.lineBoundary(Y);let z={selectableId:Z.selectableId,offset:q.start},U={selectableId:Z.selectableId,offset:q.end};this._controller.setSelection({anchor:z,extent:U}),this._tripleClickTimer=setTimeout(()=>{this._controller.autoCopySelection(),this._tripleClickTimer=void 0},200);return}if(this._doubleClickTimer)clearTimeout(this._doubleClickTimer),this._doubleClickTimer=void 0;if(this._tripleClickTimer)clearTimeout(this._tripleClickTimer),this._tripleClickTimer=void 0;let K={selectableId:Z.selectableId,offset:Y.offset};this._controller.beginDrag(K),this._captureGlobalMouse()}_handleMouseDrag(J){if(!this._controller.isDragging())return;let Q={x:J.position.x,y:J.position.y},Z=this._controller.hitTest(Q);if(!Z)Z=this._findClosestSelectable(Q);if(!Z)return;let X=Z.globalToLocal(Q),Y=Z.nearestCaretPosition(X);if(!this._controller.hitTest(Q))Y=this._getOutOfBoundsPosition(Z,Q,X);let K={selectableId:Z.selectableId,offset:Y.offset};this._controller.updateDrag(K)}_handleMouseHover(J){let Q={x:J.position.x,y:J.position.y},Z=Date.now();if(Z-this._lastHoverCheck<16)return;if(Q.x===this._lastHoverPosition.x&&Q.y===this._lastHoverPosition.y)return;this._lastHoverCheck=Z,this._lastHoverPosition={x:Q.x,y:Q.y};let X,Y;if(this._controller.isDragging())X=z7.TEXT,Y=!0;else{let K=this._controller.hitTest(Q);X=K?z7.TEXT:z7.DEFAULT,Y=K!==null}if(X!==this._currentCursor&&this.mounted){this._currentCursor=X;let K=this.context.findRenderObject();if(K instanceof uq)K.cursor=X}}_handleMouseExit(J){if(this._currentCursor!==z7.DEFAULT&&this.mounted){this._currentCursor=z7.DEFAULT;let Q=this.context.findRenderObject();if(Q instanceof uq)Q.cursor=z7.DEFAULT}}_handleGlobalClick=(J)=>{if(J.event.button!=="left")return;if(!this._controller.getSelection())return;if(!this._controller.hitTest(J.globalPosition))this._controller.clear()};_findClosestSelectable(J){let Q=this._controller.getAllSelectables();if(Q.length===0)return null;let Z=Q.filter((X)=>{let Y=X.globalBounds();return J.y>=Y.top&&J.y<=Y.bottom});if(Z.length===0)return null;return Z.reduce((X,Y)=>{let K=Y.globalBounds(),G=X.globalBounds(),q=Math.min(Math.abs(J.x-K.left),Math.abs(J.x-K.right)),z=Math.min(Math.abs(J.x-G.left),Math.abs(J.x-G.right));return q<z?Y:X})}_getOutOfBoundsPosition(J,Q,Z){let X=J.globalBounds();if(Q.y<X.top)return{offset:0};if(Q.y>=X.bottom)return{offset:J.textLength?J.textLength():J.plainText?.length??0};return J.nearestCaretPosition(Z)}_handleGlobalMouseMove=()=>{};_handleGlobalMouseRelease=()=>{if(this._controller.isDragging())this._controller.endDrag(),this._releaseGlobalMouse()};_captureGlobalMouse(){this._globalReleaseCallback=this._handleGlobalMouseRelease,I5.instance.addGlobalReleaseCallback(this._globalReleaseCallback)}_releaseGlobalMouse(){if(this._globalReleaseCallback)I5.instance.removeGlobalReleaseCallback(this._globalReleaseCallback),this._globalReleaseCallback=void 0;if(this._globalMoveCallback)this._globalMoveCallback=void 0}_handleKeyEvent(J){if(J.key==="a"&&J.ctrlKey)return this._controller.selectAll(),"handled";if(J.key==="c"&&J.ctrlKey){let Q=this._controller.copySelection();if(Q)return wY.writeText(Q).then(()=>{this._controller.startCopyHighlight(),setTimeout(()=>{this._controller.endCopyHighlight(),this._controller.clear()},300),this.widget.onCopy?.(Q)}).catch((Z)=>{u.debug("Failed to write selection to clipboard:",Z)}),"handled"}if(J.key==="Escape"){if(this._controller.copySelection())return this._controller.clear(),"handled"}return"ignored"}dispose(){if(this._doubleClickTimer)clearTimeout(this._doubleClickTimer),this._doubleClickTimer=void 0;if(this._tripleClickTimer)clearTimeout(this._tripleClickTimer),this._tripleClickTimer=void 0;if(this._releaseGlobalMouse(),this._globalClickCallback)I5.instance.removeGlobalClickCallback(this._globalClickCallback),this._globalClickCallback=void 0;if(this._controller.dispose(),!this.widget.focusNode)this._focusNode.dispose();super.dispose()}}class ER{toString(){return`${this.constructor.name}()`}}class MJ1 extends ER{get intentType(){return"pageUp"}}class VJ1 extends ER{get intentType(){return"pageDown"}}class NJ1 extends ER{get intentType(){return"home"}}class LJ1 extends ER{get intentType(){return"end"}}class hp extends ER{get intentType(){return"focusMessageView"}}class AJ1 extends ER{get intentType(){return"showCommandPalette"}}DR();G0();b2();G9();l8();class DN extends c0{props;constructor(J={}){super();this.props=J}static of(J){let Q=J.findAncestorStateOfType(wJ1);if(Q)return Q;throw Error("Overlay.of() called with a context that does not contain an Overlay widget")}createState(){return new wJ1}}class wJ1 extends d0{entries=[];needsRebuild=!1;initState(){super.initState();let J=this.widget.props.initialEntries||[];for(let Q of J)this._addEntry(Q)}dispose(){for(let J of this.entries)J._setOverlayState(void 0);this.entries=[],super.dispose()}insert(J,Q){if(J.mounted)throw Error("OverlayEntry is already mounted in an overlay");if(Q){let Z=this.entries.indexOf(Q);if(Z===-1)throw Error('The "above" entry is not in this overlay');this.entries.splice(Z+1,0,J),J._setOverlayState(this),J.markNeedsBuild()}else this._addEntry(J);this.setState(()=>{})}remove(J){let Q=this.entries.indexOf(J);if(Q===-1)return;this.entries.splice(Q,1),J._setOverlayState(void 0),this.setState(()=>{})}removeAll(){for(let J of this.entries)J._setOverlayState(void 0);this.entries=[],this.setState(()=>{})}rearrange(J){for(let Q of J)if(!this.entries.includes(Q))throw Error("Cannot rearrange: entry is not in this overlay");if(J.length!==this.entries.length)throw Error("Cannot rearrange: entry count mismatch");this.entries=[...J],this.setState(()=>{})}_markNeedsRebuild(){this.needsRebuild=!0,this.setState(()=>{})}_addEntry(J){this.entries.push(J),J._setOverlayState(this),J.markNeedsBuild()}build(J){let Q=[];if(this.widget.props.child)Q.push(this.widget.props.child);for(let Z of this.entries)try{let X=Z.builder(J);Q.push(X),Z._clearNeedsRebuild()}catch(X){u.error("Error building overlay entry:",X)}return new Dq6({children:Q})}}class Dq6 extends OY{constructor({children:J=[]}={}){super({children:J})}createRenderObject(){return new Mq6}updateRenderObject(J){}}class Mq6 extends Z8{constructor(){super();this.allowHitTestOutsideBounds=!0}performLayout(){super.performLayout();let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this.children,Z=J.minWidth,X=J.minHeight;for(let Y of Q)Y.layout(J),Z=Math.max(Z,Y.size.width),X=Math.max(X,Y.size.height);this.setSize(Math.min(J.maxWidth,Z),Math.min(J.maxHeight,X))}}class Qg1{builder;maintainState;_overlayState;_needsBuild=!0;constructor(J,Q=!1){this.builder=J;this.maintainState=Q}get mounted(){return this._overlayState!==void 0}remove(){if(this._overlayState)this._overlayState.remove(this)}markNeedsBuild(){if(this._needsBuild=!0,this._overlayState)this._overlayState._markNeedsRebuild()}_setOverlayState(J){this._overlayState=J}_needsRebuild(){return this._needsBuild}_clearNeedsRebuild(){this._needsBuild=!1}}G9();l8();G0();class Vq6{_listeners=new Set;_disposed=!1;addListener(J){if(this._disposed)throw Error("Cannot add listener to disposed ChangeNotifier");this._listeners.add(J)}removeListener(J){this._listeners.delete(J)}notifyListeners(){if(this._disposed)return;let J=Array.from(this._listeners);for(let Q of J)try{Q()}catch(Z){}}dispose(){this._disposed=!0,this._listeners.clear()}get disposed(){return this._disposed}get hasListeners(){return this._listeners.size>0}}class IR extends Vq6{_value;constructor(J){super();this._value=J}get value(){return this._value}set value(J){let Q=typeof J==="object"||this._value!==J;if(this._value=J,Q)this.notifyListeners()}}function Nq6(J,Q){let Z=()=>{Q()};return J.addListener(Z),{dispose:()=>J.removeListener(Z)}}l8();b2();G9();class Zg1 extends R4{link;showWhenUnlinked;offset;constructor({key:J,link:Q,showWhenUnlinked:Z=!0,offset:X={x:0,y:0},child:Y}){super({key:J,child:Y});this.link=Q,this.showWhenUnlinked=Z,this.offset=X}createElement(){return new FN(this)}createRenderObject(){return new Lq6(this.link,this.showWhenUnlinked,this.offset)}updateRenderObject(J){J.link=this.link,J.showWhenUnlinked=this.showWhenUnlinked,J.setFollowerOffset(this.offset)}}class Lq6 extends Z8{_link;_showWhenUnlinked;_followerOffset;_cachedPosition=null;_instanceId;constructor(J,Q,Z){super();this._link=J,this._showWhenUnlinked=Q,this._followerOffset=Z,this._instanceId=Math.random().toString(36).substring(2,8)}get link(){return this._link}set link(J){this._link=J,this._cachedPosition=null,this.markNeedsLayout()}get showWhenUnlinked(){return this._showWhenUnlinked}set showWhenUnlinked(J){if(this._showWhenUnlinked!==J)this._showWhenUnlinked=J,this.markNeedsLayout()}setFollowerOffset(J){if(this._followerOffset.x!==J.x||this._followerOffset.y!==J.y)this._followerOffset={...J},this.markNeedsLayout()}calculatePosition(){let J=this._link.getTargetTransform();if(!J)return null;return{x:J.position.x+this._followerOffset.x,y:J.position.y+this._followerOffset.y}}shouldShow(){return this._link.target!==null||this._showWhenUnlinked}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),!this.shouldShow()){this.setSize(0,0),super.performLayout();return}let Q=this.calculatePosition();if(this._cachedPosition=Q,Q)this.setOffset(Q.x,Q.y);if(this.children.length>0){let Z=this.children[0];Z.layout(J);let X=Z.size;this.setSize(X.width,X.height)}else this.setSize(0,0);super.performLayout()}getCurrentPosition(){return this._cachedPosition}setOffset(J,Q){super.setOffset(J,Q)}paint(J,Q=0,Z=0){super.paint(J,Q,Z)}}b2();G9();class Xg1 extends R4{link;constructor({key:J,link:Q,child:Z}){super({key:J,child:Z});this.link=Q}createElement(){return new FN(this)}createRenderObject(){return new Aq6(this.link)}updateRenderObject(J){J.link=this.link}}class Aq6 extends Z8{_link;_globalPosition={x:0,y:0};constructor(J){super();this._link=J}get link(){return this._link}set link(J){if(this._link===J)return;this._link._setTarget(null),this._link=J,this._link._setTarget(this)}attach(){super.attach(),this._link._setTarget(this)}detach(){this._link._setTarget(null),super.detach()}getGlobalPosition(){let J=this.offset.x,Q=this.offset.y,Z=this.parent;while(Z&&Z instanceof Z8)J+=Z.offset.x,Q+=Z.offset.y,Z=Z.parent;return{x:J,y:Q}}getSize(){let J=this.size;return{width:J.width,height:J.height}}updateGlobalPosition(){let J={...this._globalPosition};if(this._globalPosition=this.getGlobalPosition(),J.x!==this._globalPosition.x||J.y!==this._globalPosition.y)this._link._notifyFollowers()}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length>0){let Q=this.children[0];Q.layout(J);let Z=Q.size;this.setSize(Z.width,Z.height)}else this.setSize(0,0);this.updateGlobalPosition(),super.performLayout()}}G0();class Yg1{_target=null;_followers=new Set;get target(){return this._target}_setTarget(J){if(this._target===J)return;this._target=J,this._notifyFollowers()}_addFollower(J){this._followers.add(J)}_removeFollower(J){this._followers.delete(J)}_notifyFollowers(){for(let J of this._followers)try{J()}catch(Q){u.error("Error in LayerLink follower callback:",Q)}}getTargetTransform(){if(!this._target)return null;return{position:this._target.getGlobalPosition(),size:this._target.getSize()}}}G0();b2();var nG9=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Backspace","Delete","Insert","Tab","Enter","Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","Escape","PrintScreen","Pause","ContextMenu","MediaPlayPause","MediaStop","MediaTrackNext","MediaTrackPrevious","AudioVolumeDown","AudioVolumeMute","AudioVolumeUp","BrowserBack","BrowserFavorites","BrowserForward","BrowserHome","BrowserRefresh","BrowserSearch","BrowserStop","Clear","Copy","Cut","Paste","Undo","Redo","Find","Help","Menu","Select","Execute","Sleep","WakeUp"]);function wq6(J){if(nG9.has(J.key))return!0;if(J.ctrlKey||J.altKey||J.metaKey)return!0;if(J.key.length===1){if(J.key.charCodeAt(0)<32)return!0}return!1}G9();function RJ1(J,Q,Z={}){let X=Z.padding??1,Y=J.findRenderObject();if(!Y)return;let K=aG9(Y);if(!K)return;let G=K.scrollController;if(!G)return;let q=rG9(Y,Q,K);if(!q)return;let z=K.size.height,U=G.offset,W=U;if(q.top<X)W=U+q.top-X;else if(q.bottom>z-X)W=U+(q.bottom-(z-X));else return;let F=G.maxScrollExtent;if(W=Math.max(0,Math.min(W,F)),W!==U)G.jumpTo(W)}function aG9(J){let Q=J.parent;while(Q){if("scrollController"in Q&&Q.scrollController)return Q;if(Q=Q.parent,Q&&!("size"in Q))break}return null}function rG9(J,Q,Z){let{top:X,bottom:Y}=Q,K=J;while(K&&K!==Z){let G=K.offset;if(X+=G.y,Y+=G.y,K=K.parent,K&&!("size"in K))return null}if(K!==Z)return null;return{top:X,bottom:Y}}l8();class gp{_text="";_config;_lines=null;_graphemes=null;constructor(J,Q){this._text=J,this._config=Q}updateText(J){if(this._text!==J)this._text=J,this._invalidateCache()}updateConfig(J){if(JSON.stringify(this._config)!==JSON.stringify(J))this._config=J,this._invalidateCache()}get lines(){if(this._lines===null)this._computeLines();return this._lines}get graphemes(){if(this._graphemes===null)this._graphemes=O2(this._text);return this._graphemes}getLineCount(){return this._text.split(`
|
|
6432
6432
|
`).length}getLine(J){let Q=this.lines;return J>=0&&J<Q.length?Q[J]??null:null}offsetToLineIndex(J){let Q=this.lines;for(let Z=0;Z<Q.length;Z++){let X=Q[Z];if(X&&J>=X.startOffset&&J<=X.endOffset)return Z}return Math.max(0,Q.length-1)}offsetToPosition(J){let Q=this.graphemes,Z=0,X=0;for(let Y=0;Y<J&&Y<Q.length;Y++)if(Q[Y]===`
|
|
@@ -6453,8 +6453,8 @@ The context used was: `+J.widget.constructor.name);return Q}updateShouldNotify(J
|
|
|
6453
6453
|
`),"handled";return"ignored"}else if(V.key==="Backspace"){try{if(V.altKey)N.deleteWordLeft();else N.deleteSelectedOrText(1)}catch(O){throw u.error("TextField: Error in deleteText:",O),O}return"handled"}else if(V.key==="Delete"){if(N.hasSelection)N.deleteSelectedText();else N.deleteForward(1);return"handled"}else if(V.key==="Tab")return"ignored";else if(V.key==="Escape")return"ignored";if(V.ctrlKey){if(V.key==="g"){if(this.widget.onOpenInEditor)this.widget.onOpenInEditor(N.text);return"handled"}if(V.key==="a"){if(this.widget.isMultiline)N.moveCursorToLineStart(V.shiftKey);else N.moveCursorToStart(V.shiftKey);return"handled"}else if(V.key==="e"){if(this.widget.isMultiline)N.moveCursorToLineEnd(V.shiftKey);else N.moveCursorToEnd(V.shiftKey);return"handled"}else if(V.key==="u")return N.deleteToLineStart(),"handled";else if(V.key==="k")return N.deleteToLineEnd(),"handled";else if(V.key==="f")return N.moveCursorRight(1,V.shiftKey),"handled";else if(V.key==="b")return N.moveCursorLeft(1,V.shiftKey),"handled";else if(V.key==="n"){let{line:O,column:j}=N.cursorTextPosition,$=N.getLineCount();if(O===$-1){let I=N.getLine(O),T=O2(I).length;if(j===T)return"ignored";else return N.moveCursorToLineEnd(V.shiftKey),"handled"}else{let I=N.cursorPosition;return N.moveCursorDown(1,V.shiftKey),N.cursorPosition===I?"ignored":"handled"}}else if(V.key==="p"){let{line:O,column:j}=N.cursorTextPosition;if(O===0&&j===0)return"ignored";else if(O===0)return N.moveCursorToLineStart(V.shiftKey),"handled";else{let $=N.cursorPosition;return N.moveCursorUp(1,V.shiftKey),N.cursorPosition===$?"ignored":"handled"}}else if(V.key==="d")return N.deleteForward(1),"handled";else if(V.key==="h")return N.deleteText(1),"handled";else if(V.key==="ArrowLeft")return N.moveCursorWordBoundary(-1,V.shiftKey),"handled";else if(V.key==="ArrowRight")return N.moveCursorWordBoundary(1,V.shiftKey),"handled";else if(V.key==="w")return N.deleteWordLeft(),"handled";else if(V.key==="y")return N.yankText(),"handled"}else if(V.altKey||V.metaKey){if(V.metaKey&&V.key==="ArrowLeft"){if(this.widget.isMultiline)N.moveCursorToLineStart(V.shiftKey);else N.moveCursorToStart(V.shiftKey);return"handled"}else if(V.metaKey&&V.key==="ArrowRight"){if(this.widget.isMultiline)N.moveCursorToLineEnd(V.shiftKey);else N.moveCursorToEnd(V.shiftKey);return"handled"}else if(V.key==="ArrowUp"){let{line:$,column:E}=N.cursorTextPosition;if($===0&&E===0)return"ignored";else if($===0)return N.moveCursorToLineStart(V.shiftKey),"handled";else{let I=N.cursorPosition;return N.moveCursorUp(1,V.shiftKey),N.cursorPosition===I?"ignored":"handled"}}else if(V.key==="ArrowDown"){let{line:$,column:E}=N.cursorTextPosition,I=N.getLineCount();if($===I-1){let S=N.getLine($),x=O2(S).length;if(E===x)return"ignored";else return N.moveCursorToLineEnd(V.shiftKey),"handled"}else{let S=N.cursorPosition;return N.moveCursorDown(1,V.shiftKey),N.cursorPosition===S?"ignored":"handled"}}let O=V.key==="ArrowLeft"||V.key.toLowerCase()==="b",j=V.key==="ArrowRight"||V.key.toLowerCase()==="f";if(O||j)return N.moveCursorWordBoundary(O?-1:1,V.shiftKey),"handled"}else if(V.key==="ArrowLeft")return N.moveCursorLeft(1,V.shiftKey),"handled";else if(V.key==="ArrowRight")return N.moveCursorRight(1,V.shiftKey),"handled";else if(V.key==="ArrowUp"){let{line:O,column:j}=N.cursorTextPosition;if(O===0&&j===0)return"ignored";else if(O===0)return N.moveCursorToLineStart(V.shiftKey),"handled";else{let $=N.cursorPosition;return N.moveCursorUp(1,V.shiftKey),N.cursorPosition===$?"ignored":"handled"}}else if(V.key==="ArrowDown"){let{line:O,column:j}=N.cursorTextPosition,$=N.getLineCount();if(O===$-1){let I=N.getLine(O),T=O2(I).length;if(j===T)return"ignored";else return N.moveCursorToLineEnd(V.shiftKey),"handled"}else{let I=N.cursorPosition;return N.moveCursorDown(1,V.shiftKey),N.cursorPosition===I?"ignored":"handled"}}else if(V.key==="Home"||V.key==="End")return"ignored";else if(V.key==="PageUp"||V.key==="PageDown")return"ignored";if(V.key&&!wq6(V))return N.insertText(V.key),"handled";return"ignored"},K=(V)=>{if(!this.widget.enabled)return"ignored";let N=this.widget.controller,L=this.widget.isMultiline,A=V.text;if(!L)A=A.replace(/[\r\n]+/g," ");return N.insertText(A),"handled"},G=(V)=>{if(!this.widget.enabled||!this.widget.isMultiline)return;let N=this.widget.controller,L=N.getLayoutLines();if(L.length<=1)return;let A=N.getScrollOffset(),w=3;if(V.direction==="up")A=Math.max(0,A-w);else{let R=this.widget.style,O=R.padding||V0.all(0),j=R.border?1:0,E=(J.findRenderObject()?.size?.height||10)-j*2-O.top-O.bottom,I=Math.max(0,L.length-E);A=Math.min(I,A+w)}N.setScrollOffset(A),this.setState(()=>{})},q=(V)=>{if(!this.widget.enabled)return;if(V.button==="middle"){this.widget.clipboard.readPrimarySelection().then((N)=>{if(N)K({type:"paste",text:N})}).catch((N)=>{u.debug("Failed to read primary selection for middle-click paste:",N)});return}if(V.button==="left"){let N=W(V.localPosition.x,V.localPosition.y);if(V.clickCount===3)this.widget.controller.selectLineAt(N);else if(V.clickCount===2)this.widget.controller.selectWordAt(N);else if(V.clickCount===1)this.widget.controller.startSelectionAt(N),this._isDragging=!0,this.effectiveFocusNode.requestFocus(),this._captureGlobalMouse()}},z=(V)=>{if(!this.widget.enabled||!this._isDragging)return;if(V.button!=="left")return;let N=W(V.localPosition.x,V.localPosition.y);this.widget.controller.extendSelectionTo(N)},U=(V)=>{if(V.button==="left")this._endDrag()},W=(V,N)=>{let A=_8.of(J).supportsEmojiWidth,w=this.widget.style.padding||V0.all(0),R=this.widget.style.border?1:0,O=V-R-w.left,j=N-R-w.top,$=this.widget.controller.text,E=this.widget.prompts.find((x)=>x.match($)),I=this.widget.controller.graphemes,T=this.widget.isMultiline,S=0;if(T){let x=this.widget.controller.getLayoutLines(),h=Math.max(0,Math.min(Math.floor(j)+this.widget.controller.getScrollOffset(),x.length-1));if(E&&h===0){O-=E.spacing??0;let v=RY(E.display,A),_=E.spacing??0;if(O<v+_)return v}if(h<x.length){let v=x[h],_=I.slice(v.startOffset,v.endOffset),b=0,g=0;for(let k=0;k<_.length;k++){let y=c4(_[k],A),f=b+y;if(O<=f){if((O-b)/y<0.6)g=k;else g=k+1;break}b=f,g=k+1}S=v.startOffset+g}}else{if(E){O-=E.spacing??0;let h=RY(E.display,A),v=E.spacing??0;if(O<h+v)return h}let x=0;for(let h=0;h<I.length;h++){let v=c4(I[h],A),_=x+v;if(O<=_){if((O-x)/v<0.6)S=h;else S=h+1;break}x=_,S=h+1}}return S},H=_8.of(J).supportsEmojiWidth,B=new Rq6({controller:this.widget.controller,style:X,placeholder:this.widget.placeholder,hScrollOffset:this._hScrollOffset,vScrollOffset:this._vScrollOffset,maxWidth:this.widget.maxWidth,maxLines:this.widget.maxLines,minLines:this.widget.minLines,expands:this.widget.expands,wrap:this.widget.wrap,enabled:this.widget.enabled,emojiSupported:H,prompts:this.widget.prompts}),M=new x9({onClick:q,onDrag:z,onRelease:U,onScroll:G,cursor:this.widget.enabled?z7.TEXT:z7.DEFAULT,child:B});return new q9({key:this.widget.key??void 0,autofocus:this.widget.autofocus,focusNode:this.effectiveFocusNode,onKey:Y,onPaste:K,child:M})}}class Rq6 extends QB{controller;style;placeholder;hScrollOffset;vScrollOffset;maxWidth;maxLines;minLines;expands;wrap;enabled;emojiSupported;prompts;constructor({controller:J,style:Q,placeholder:Z,hScrollOffset:X,vScrollOffset:Y,maxWidth:K,maxLines:G,minLines:q,expands:z,wrap:U,enabled:W,emojiSupported:F,prompts:H}){super({});this.controller=J,this.style=Q,this.placeholder=Z,this.hScrollOffset=X,this.vScrollOffset=Y,this.maxWidth=K,this.maxLines=G,this.minLines=q,this.expands=z,this.wrap=U,this.enabled=W,this.emojiSupported=F,this.prompts=H}createRenderObject(){return new Oq6(this.controller,this.style,this.placeholder,this.hScrollOffset,this.vScrollOffset,this.maxWidth,this.maxLines,this.minLines,this.expands,this.wrap,this.enabled,this.emojiSupported,this.prompts)}updateRenderObject(J){J.updateProperties(this.controller,this.style,this.placeholder,this.hScrollOffset,this.vScrollOffset,this.maxWidth,this.maxLines,this.minLines,this.expands,this.wrap,this.enabled,this.emojiSupported,this.prompts)}}class Oq6 extends Z8{_controller;_style;_placeholder;_hScrollOffset;_vScrollOffset;_maxWidth;_maxLines;_minLines;_expands;_wrap;_enabled;_emojiSupported;_prompts;_contentChanged=!1;constructor(J,Q,Z,X,Y,K,G,q,z,U,W=!0,F=!1,H=[]){super();this._controller=J,this._style=Q,this._placeholder=Z,this._hScrollOffset=X,this._vScrollOffset=Y,this._maxWidth=K,this._maxLines=G,this._minLines=q,this._expands=z,this._wrap=U,this._enabled=W,this._emojiSupported=F,this._prompts=H}get isMultiline(){return this._maxLines===null||this._maxLines>1||this._minLines>1}updateProperties(J,Q,Z,X,Y,K,G,q,z,U,W=!0,F=!1,H=[]){this._controller=J,this._style=Q,this._placeholder=Z,this._hScrollOffset=X,this._vScrollOffset=Y,this._maxWidth=K,this._maxLines=G,this._minLines=q,this._expands=z,this._wrap=U,this._enabled=W,this._emojiSupported=F,this._prompts=H,this.markNeedsLayout(),this.markNeedsPaint()}performLayout(){super.performLayout();let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this._style.padding||V0.all(0),X=this._style.border?1:0,Y=Q.left+Q.right+X*2+1,K=Q.top+Q.bottom+X*2+1,G=this._maxWidth||J.maxWidth,q=Math.max(Y,Number.isFinite(G)?Math.min(G,J.maxWidth):Y),z;if(this._expands)if(J.minHeight===J.maxHeight)z=J.maxHeight;else{let F=this.getMinIntrinsicHeight(q);z=Math.min(Math.max(F,J.minHeight),J.maxHeight)}else{let F=this.getMinIntrinsicHeight(q);if(z=Math.max(K,F),z>J.maxHeight)z=J.maxHeight}this.setSize(q,z);let U=this.getPromptPrefixWidth(),W=q-X*2-Q.left-Q.right-U;if(this._controller.updateLayoutConfig(Math.max(1,W),this._wrap?"word":"none",this._emojiSupported),this.isMultiline&&this._expands)this._updateScrollOffsetFromLayout(J,z)}getPromptPrefixWidth(){let J=this._controller.text;return this._prompts.find((Q)=>Q.match(J))?.spacing??0}getMinIntrinsicWidth(J){let Q=this._style.padding||V0.all(0),X=this._style.border?1:0,Y=this.getPromptPrefixWidth(),K=this._maxWidth||20;return Math.max(Q.left+Q.right+X*2+K+Y,Q.left+Q.right+X*2+1+Y)}getMaxIntrinsicWidth(J){let Q=this.getPromptPrefixWidth();if(this._maxWidth)return this._maxWidth+Q;return Number.POSITIVE_INFINITY}getMinIntrinsicHeight(J){let Q=this._style.padding||V0.all(0),X=this._style.border?1:0,Y=this.getPromptPrefixWidth(),K=J-X*2-Q.left-Q.right-Y,G=this._wrap?"word":"none",z=this._controller.calculateLayoutLines(Math.max(1,K),G,!1).length,U=this._minLines,W=this._maxLines===null?Number.MAX_SAFE_INTEGER:this._maxLines,F=Math.max(U,Math.min(z,W));return Q.top+Q.bottom+X*2+F}getMaxIntrinsicHeight(J){let Q=this._style.padding||V0.all(0),X=this._style.border?1:0,Y=this.getPromptPrefixWidth(),K=J-X*2-Q.left-Q.right-Y,G=this._wrap?"word":"none",z=this._controller.calculateLayoutLines(Math.max(1,K),G,!1).length,U=this._minLines,W=this._maxLines===null?Number.MAX_SAFE_INTEGER:this._maxLines,F=Math.max(U,Math.min(z,W));return Q.top+Q.bottom+X*2+F}dispose(){super.dispose()}paint(J,Q=0,Z=0){let X=Q+this.offset.x,Y=Z+this.offset.y,K=this.size.width,G=this.size.height,q=this._style.backgroundColor||E1.default();for(let O=0;O<G;O++)for(let j=0;j<K;j++)J.setChar(X+j,Y+O," ",{bg:q,fg:this._style.textColor||E1.default()},1);let z=this._style.border;if(z){for(let O=0;O<K;O++)J.setChar(X+O,Y,"─",{fg:z.top?.color||E1.default(),bg:q},1);for(let O=0;O<K;O++)J.setChar(X+O,Y+G-1,"─",{fg:z.bottom?.color||E1.default(),bg:q},1);for(let O=0;O<G;O++)J.setChar(X,Y+O,"│",{fg:z.left?.color||E1.default(),bg:q},1);for(let O=0;O<G;O++)J.setChar(X+K-1,Y+O,"│",{fg:z.right?.color||E1.default(),bg:q},1);J.setChar(X,Y,"╭",{fg:z.top?.color||E1.default(),bg:q},1),J.setChar(X+K-1,Y,"╮",{fg:z.top?.color||E1.default(),bg:q},1),J.setChar(X,Y+G-1,"╰",{fg:z.bottom?.color||E1.default(),bg:q},1),J.setChar(X+K-1,Y+G-1,"╯",{fg:z.bottom?.color||E1.default(),bg:q},1)}let U=this._style.padding||V0.all(0),W=z?1:0,F=X+W+U.left,H=Y+W+U.top,B=K-W*2-U.left-U.right,M=G-W*2-U.top-U.bottom;if(B<=0||M<=0)return;let V=this._emojiSupported,N=this.isMultiline,L=this._controller.text,A=L||this._placeholder,w=L?this._style.textColor||E1.default():this._style.placeholderColor||E1.index(8),R=!this._enabled;if(N)this._paintMultilineText(J,A,w,q,F,H,B,M,V,R);else this._paintSingleLineText(J,A,w,q,F,H,B,V,R);if(this._enabled)this._paintCursor(J,F,H,B,M,V)}_paintSingleLineText(J,Q,Z,X,Y,K,G,q,z=!1){if(!Q)return;let U=O2(Q),W=Y,F=this._controller.text,H=this._prompts.find((N)=>N.match(F));if(H){let N=O2(H.display),L=H.style?.color??Z;for(let w of N){let R=c4(w,q);if(W+R<=Y+G)J.setChar(W,K,w,{fg:L,bg:X},R),W+=R}let A=H.spacing??0;for(let w=0;w<A;w++)if(W<Y+G)J.setChar(W,K," ",{fg:Z,bg:X},1),W+=1}let B=H?.concealPrefix?O2(H.display).length:0,M=Math.max(this._hScrollOffset,B),V=this._controller.selectionRange;for(let N=M;N<U.length&&W<Y+G;N++){let L=U[N];if(L===`
|
|
6454
6454
|
`)continue;let A=c4(L,q);if(W+A<=Y+G){let R=V&&N>=V.start&&N<V.end?this._style.selectionBackgroundColor??E1.blue:X;J.setChar(W,K,L,{fg:Z,bg:R,dim:z},A),W+=A}else break}}_paintMultilineText(J,Q,Z,X,Y,K,G,q,z,U=!1){if(!Q)return;let W=this._controller.text,F,H,B;if(W)F=this._controller.getLayoutLines(),H=this._controller.getScrollOffset(),B=this._controller.graphemes;else F=new gp(Q,{maxWidth:G,wrapMode:this._wrap?"word":"none",emojiSupported:z}).lines,H=0,B=O2(Q);let M=Math.min(H+q,F.length),V=this._controller.selectionRange;for(let N=H;N<M;N++){let L=K+(N-H),A=F[N];if(A){let w=B.slice(A.startOffset,A.endOffset),R=Y,O=N===0,j=this._controller.text,$=O?this._prompts.find((I)=>I.match(j)):void 0;if($){let I=O2($.display),T=$.style?.color??Z;for(let x of I){let h=c4(x,z);if(R+h<=Y+G)J.setChar(R,L,x,{fg:T,bg:X},h),R+=h}let S=$.spacing??0;for(let x=0;x<S;x++)if(R<Y+G)J.setChar(R,L," ",{fg:Z,bg:X},1),R+=1}let E=$?.concealPrefix?O2($.display).length:0;for(let I=E;I<w.length&&R<Y+G;I++){let T=w[I],S=c4(T,z);if(R+S<=Y+G){let x=A.startOffset+I,v=V&&x>=V.start&&x<V.end?this._style.selectionBackgroundColor??E1.blue:X;J.setChar(R,L,T,{fg:Z,bg:v,dim:U},S),R+=S}else break}}}}_paintCursor(J,Q,Z,X,Y,K){if(this.isMultiline){let q=this._controller.cursorPosition,z=this._controller.getLayoutLines(),U=-1,W=0;for(let H=0;H<z.length;H++){let B=z[H];if(q>=B.startOffset&&q<=B.endOffset){U=H,W=q-B.startOffset;break}}let F=this._controller.getScrollOffset();if(U>=F&&U<F+Y){let H=Z+(U-F),B=z[U],M=this._controller.graphemes,V=Q,N=U===0,L=this._controller.text,A=N?this._prompts.find((O)=>O.match(L)):void 0;if(A){let O=O2(A.display);for(let j of O)V+=c4(j,K);V+=A.spacing??0}let w=A?.concealPrefix?O2(A.display).length:0,R=Math.max(0,W-w);for(let O=0;O<R;O++){let j=B.startOffset+w+O;if(j<M.length){let $=M[j],E=c4($,K);V+=E}}if(V>=Q&&V<=Q+X)J.setCursor(V,H);else J.clearCursor()}else J.clearCursor()}else{let q=this._controller.cursorPosition,z=this._controller.graphemes,U=this._controller.text,W=this._prompts.find((V)=>V.match(U)),F=Q;if(W){let V=O2(W.display);for(let N of V)F+=c4(N,K);F+=W.spacing??0}let H=W?.concealPrefix?O2(W.display).length:0,B=Math.max(this._hScrollOffset,H),M=Math.max(q,H);for(let V=B;V<M&&V<z.length;V++){let N=z[V];if(N!==`
|
|
6455
6455
|
`)F+=c4(N,K)}if(F>=Q&&F<=Q+X)J.setCursor(F,Z);else J.clearCursor()}}_updateScrollOffsetFromLayout(J,Q){let Z=this._controller;if(!(Q>=J.maxHeight)){Z.setScrollOffset(0);return}let Y=Z.getLayoutLines(),K=Z.cursorPosition,G=-1;for(let L=0;L<Y.length;L++){let A=Y[L];if(K>=A.startOffset&&K<=A.endOffset){G=L;break}}if(G===-1)return;let q=this._style.padding||V0.all(0),U=this._style.border?1:0,W=Q-q.top-q.bottom-U*2,F=Z.getScrollOffset(),H=F,B=F+W-1;if(G<H)Z.setScrollOffset(G);else if(G>B){let L=G-W+1;Z.setScrollOffset(L)}let M=Math.max(0,Y.length-W),V=Z.getScrollOffset(),N=Math.max(0,Math.min(V,M));Z.setScrollOffset(N)}}var sG9=new Set([" ","\t",`
|
|
6456
|
-
`,"\r","\v","\f"," "," "," "," "," "," "," "," "," "," "," "," "," ","\u2028","\u2029"," "," "," ","\uFEFF"]),oG9=new Set(["/","\\",".",",",";",":","!","?","(",")","[","]","{","}","<",">","'",'"',"=","+","-","*","&","|","^","%","$","#","@","~","`","_"]);G0();class Kg1{_state;_textController=null;_triggers=[];_optionsBuilder=null;_onSelected=null;_disposed=!1;constructor(){let J={trigger:null,options:[],selectedIndex:-1,isActive:!1,generationId:0};this._state=new IR(J)}get state(){return this._state}get currentState(){return this._state.value}initialize({textController:J,triggers:Q,optionsBuilder:Z,onSelected:X}){if(this._disposed)throw Error("Cannot initialize disposed AutocompleteController");this._cleanup(),this._textController=J,this._triggers=Q,this._optionsBuilder=Z,this._onSelected=X||null,this._textController.addListener(this._handleTextChange)}selectNext(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex<J.options.length-1?J.selectedIndex+1:0;this._updateState({selectedIndex:Q})}selectPrevious(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex>0?J.selectedIndex-1:J.options.length-1;this._updateState({selectedIndex:Q})}acceptSelected(){let J=this.currentState;if(!J.isActive||J.selectedIndex<0||J.selectedIndex>=J.options.length)return;let Q=J.options[J.selectedIndex];if(!Q)return;if(this.dismiss(),this._onSelected)this._onSelected(Q)}dismiss(){this._updateState({trigger:null,options:[],selectedIndex:-1,isActive:!1})}dispose(){this._disposed=!0,this._cleanup(),this._state.dispose()}_handleTextChange=()=>{if(!this._textController||!this._optionsBuilder)return;let J=this._textController.text,Q=this._textController.cursorPosition,Z=null;for(let Y of this._triggers){let K=Y.detect(J,Q);if(K&&(!Z||K.start>Z.start))Z=K}if(!Z){if(this.currentState.isActive)this.dismiss();return}let X=this.currentState.generationId+1;this._updateState({trigger:Z,generationId:X,isActive:!0,selectedIndex:-1}),this._buildOptions(Z.query,X)};async _buildOptions(J,Q){if(!this._optionsBuilder)return;try{let Z=await this._optionsBuilder(J);if(this.currentState.generationId===Q&&!this._disposed)this._updateState({options:Z,selectedIndex:Z.length>0?0:-1,isActive:Z.length>0})}catch(Z){if(u.error("Error building autocomplete options:",Z),this.currentState.generationId===Q&&!this._disposed)this._updateState({options:[],selectedIndex:-1,isActive:!1})}}_updateState(J){if(this._disposed)return;this._state.value={...this.currentState,...J}}_cleanup(){if(this._textController)this._textController.removeListener(this._handleTextChange)}}class mp{}class up{}class pp{}class jJ1{}class $J1 extends c0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new jq6(this.props)}}class jq6 extends d0{props;controller;stateListener=null;overlayEntry=null;layerLink=new Yg1;scrollOffset=0;_effectiveFocusNode;constructor(J){super();this.props=J}initState(){if(super.initState(),this._effectiveFocusNode=this.props.focusNode||new Q9({debugLabel:"AutocompleteFocusOwned"}),this.controller=new Kg1,this.controller.initialize({textController:this.props.controller,triggers:this.props.triggers,optionsBuilder:this.props.optionsBuilder,onSelected:this.props.onSelected}),this.stateListener=Nq6(this.controller.state,()=>{this.updateOverlay(),this.setState(()=>{})}),this.props.canStealFocus)c9.instance.addPostFrameCallback(()=>{this._effectiveFocusNode.requestFocus()})}didUpdateWidget(J){super.didUpdateWidget(J);let Q=J.props,Z=this.widget.props;if(this.props=Z,Q.controller!==Z.controller||Q.triggers!==Z.triggers||Q.optionsBuilder!==Z.optionsBuilder||Q.textFieldProps!==Z.textFieldProps||Q.onSelected!==Z.onSelected)this.controller.initialize({textController:Z.controller,triggers:Z.triggers,optionsBuilder:Z.optionsBuilder,onSelected:Z.onSelected});this.setState(()=>{})}dispose(){this.removeOverlay(),this.stateListener?.dispose(),this.controller.dispose(),this._effectiveFocusNode.dispose(),super.dispose()}invoke=(J)=>{if(!this.controller.currentState.isActive)return"ignored";if(J instanceof mp)return this.controller.selectNext(),this.updateScrollPosition(),"handled";if(J instanceof up)return this.controller.selectPrevious(),this.updateScrollPosition(),"handled";if(J instanceof pp)return this.controller.acceptSelected(),"handled";if(J instanceof jJ1)return this.controller.dismiss(),"handled";return"ignored"};updateScrollPosition(){let J=this.controller.currentState;if(!J.isActive||J.selectedIndex<0)return;let Q=J.selectedIndex,Z=J.options.length,X=Z;try{let z=this.layerLink.getTargetTransform();if(z){let U=z.position.y,W=2,F=U-2;X=Math.min(Z,Math.max(1,F))}}catch{}if(X>=Z){this.scrollOffset=0;return}let Y=Q-this.scrollOffset,K=1,G=this.scrollOffset;if(Y>=X-K)G=Math.max(0,Q-(X-K-1));if(Y<K)G=Math.max(0,Q-K);let q=Math.max(0,Z-X);G=Math.min(G,q),this.scrollOffset=G}build(J){let Q=new cq({...this.props.textFieldProps,controller:this.props.controller,focusNode:this._effectiveFocusNode,autofocus:!1}),Z=new dq({shortcuts:new Map([[new b6("ArrowDown"),new mp],[new b6("ArrowUp"),new up],[new b6("n",{ctrl:!0}),new mp],[new b6("p",{ctrl:!0}),new up],[new b6("Enter"),new pp],[new b6("Escape"),new jJ1],[new b6("Tab"),new pp]]),focusNode:this._effectiveFocusNode,child:Q}),X=new HZ({actions:new Map([[mp,new S9(this.invoke)],[up,new S9(this.invoke)],[pp,new S9(this.invoke)],[jJ1,new S9(this.invoke)]]),child:Z});return new Xg1({link:this.layerLink,child:X})}updateOverlay(){let J=this.controller.currentState;if(J.isActive&&J.options.length>0)if(!this.overlayEntry)this.createOverlay();else this.overlayEntry.markNeedsBuild();else this.removeOverlay()}createOverlay(){if(this.overlayEntry)return;this.overlayEntry=new Qg1((J)=>{let Q=this.controller.currentState;return this.buildOverlayContent(J,Q)});try{DN.of(this.context).insert(this.overlayEntry)}catch(J){u.error("Failed to insert autocomplete overlay:",J),this.overlayEntry=null}}removeOverlay(){if(this.overlayEntry)this.overlayEntry.remove(),this.overlayEntry=null}buildOverlayContent(J,Q){let Z=e6.maybeOf(J),X=Z?.colorScheme.background??E1.black,Y=this.props.overlayBorderColor??Z?.colorScheme.border??E1.white,K=Q.options.length;try{let w=this.layerLink.getTargetTransform();if(w){let R=w.position.y,O=2,j=R-2;K=Math.min(K,Math.max(1,j))}}catch{}this.updateScrollPosition();let G=this.scrollOffset,q=Math.min(Q.options.length,G+K),z=[],U=0;for(let w=G;w<q;w++){let R=Q.options[w];if(!R)continue;let O=w===Q.selectedIndex,j,$;if(this.props.optionViewBuilder){j=this.props.optionViewBuilder(J,R,O);let T=this.props.displayStringForOption?.(R)??String(R),S="",x=T,h="",v=R;if(v&&typeof v==="object"&&"type"in v)switch(v.type){case"command":S="/",x=v.name||T,h=v.description||"";break;case"file":S="@",x=v.path||T;break;case"thread":x=v.title||T,h=v.description||"";break;case"argument":x=v.value||T,h=v.description||"";break}$=S+x+(h?" - "+h:"")}else{let T=this.props.displayStringForOption?.(R)??String(R),S=Z?.colorScheme.selection??E1.index(8),x=Z?.colorScheme.foreground??E1.white;j=new n1({text:new N1(T,new $1({color:x,backgroundColor:O?S:void 0}))}),$=T}let E=_8.of(J),I=RY($,E.supportsEmojiWidth);U=Math.max(U,I),z.push(j)}let W=_8.sizeOf(J).width,F=U+4,H=Math.floor(W*0.9),B=Math.max(Math.min(F,H),Math.min(30,H)),N=z.length+2,L=-N,A=new U0({width:B,child:new y0({height:N,padding:V0.symmetric(1,0),decoration:new i8(X,x8.all(new w8(Y,1,"rounded"))),child:new i0({crossAxisAlignment:"start",children:z})})});return new Zg1({link:this.layerLink,showWhenUnlinked:!1,offset:{x:0,y:L},child:A})}}G9();var Bg1=S6(yq6(),1);l8();b2();var fq6=20,hq6=" .:-=+*#%@",Vq9=" ",Nq9=[0,55,0],Lq9=[0,255,136],Aq9=[128,51,0],wq9=[255,215,0],Rq9=[0,26,51],Oq9=[0,184,255],gq6=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],kJ1=0.5,Hg1=(J,Q,Z)=>J+(Q-J)*Z;function jq9(J,Q){let Z=Math.max(0,Math.min(1,J));if(Q==="low"){let Y=Math.floor(Z*(gq6.length-1));return E1.index(gq6[Y])}if(Q==="fast"){let Y=Aq9.map((K,G)=>Math.round(Hg1(K,wq9[G],Z)));return E1.rgb(Y[0],Y[1],Y[2])}if(Q==="free"){let Y=Rq9.map((K,G)=>Math.round(Hg1(K,Oq9[G],Z)));return E1.rgb(Y[0],Y[1],Y[2])}let X=Nq9.map((Y,K)=>Math.round(Hg1(Y,Lq9[K],Z)));return E1.rgb(X[0],X[1],X[2])}var Dg1=1,$q9=30,mq6=3;class Mg1 extends c0{width;height;minWidth;minHeight;maxWidth;maxHeight;colorMode;t;onFrame;fps;seed;constructor({key:J,width:Q=40,height:Z=40,minWidth:X,minHeight:Y,maxWidth:K,maxHeight:G,colorMode:q="high",t:z,onFrame:U,fps:W=60,seed:F}){super(J?{key:J}:{});this.width=Q,this.height=Z,this.minWidth=X??8,this.minHeight=Y??8,this.maxWidth=K??40,this.maxHeight=G??40,this.colorMode=q,this.t=z,this.onFrame=U,this.fps=W,this.seed=F}createState(){return new uq6}}class uq6 extends d0{_t=0;_timer=null;_shockwaves=[];initState(){if(super.initState(),this.widget.t!==void 0||this.widget.fps===0){this._t=this.widget.t??0;return}if(this.widget.fps==0)return;this._timer=setInterval(()=>{if(this._t+=1/this.widget.fps,this.widget.onFrame){let J=this._t;setImmediate(()=>this.widget.onFrame?.(J))}this._shockwaves=this._shockwaves.filter((J)=>this._t-J.startTime<Dg1),this.setState(()=>{})},1000/this.widget.fps)}didUpdateWidget(J){if(super.didUpdateWidget(J),this.widget.t!==void 0&&this.widget.t!==J.t)this._t=this.widget.t,this.setState(()=>{})}dispose(){if(this._timer)clearInterval(this._timer),this._timer=null;super.dispose()}handleClick=(J)=>{this._shockwaves.push({x:J.localPosition.x,y:J.localPosition.y,startTime:this._t}),this.setState(()=>{})};build(J){let Q=new pq6({width:this.widget.width,height:this.widget.height,minWidth:this.widget.minWidth,minHeight:this.widget.minHeight,maxWidth:this.widget.maxWidth,maxHeight:this.widget.maxHeight,time:this._t,colorMode:this.widget.colorMode,seed:this.widget.seed,shockwaves:this._shockwaves});return new x9({onClick:this.handleClick,child:Q})}}class pq6 extends QB{props;constructor(J,Q){super(Q?{key:Q}:{});this.props=J}createElement(){return new HN(this)}createRenderObject(){return new dq6(this.props.width,this.props.height,this.props.minWidth,this.props.minHeight,this.props.maxWidth,this.props.maxHeight,this.props.time,this.props.colorMode,this.props.seed,this.props.shockwaves)}updateRenderObject(J){J.update(this.props.width,this.props.height,this.props.minWidth,this.props.minHeight,this.props.maxWidth,this.props.maxHeight,this.props.time,this.props.colorMode,this.props.seed,this.props.shockwaves)}}class dq6 extends Z8{_width;_height;_minWidth;_minHeight;_maxWidth;_maxHeight;_time;_colorMode;_seed;_shockwaves;_noise2D;constructor(J,Q,Z,X,Y,K,G,q,z,U=[]){super();this._width=J;this._height=Q;this._minWidth=Z;this._minHeight=X;this._maxWidth=Y;this._maxHeight=K;this._time=G;this._colorMode=q;this._seed=z;this._shockwaves=U;this._noise2D=Bg1.makeNoise2D(this._seed??Date.now())}getMinIntrinsicWidth(J){return this._minWidth}getMaxIntrinsicWidth(J){return this._maxWidth}getMinIntrinsicHeight(J){return this._minHeight}getMaxIntrinsicHeight(J){return this._maxHeight}update(J,Q,Z,X,Y,K,G,q,z,U=[]){let W=!1;if(J!==this._width||Q!==this._height||Z!==this._minWidth||X!==this._minHeight||Y!==this._maxWidth||K!==this._maxHeight)this._width=J,this._height=Q,this._minWidth=Z,this._minHeight=X,this._maxWidth=Y,this._maxHeight=K,W=!0;if(z!==this._seed)this._seed=z,this._noise2D=Bg1.makeNoise2D(this._seed??Date.now());if(this._time=G,this._colorMode=q,this._shockwaves=U,W)this.markNeedsLayout();this.markNeedsPaint()}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=J.constrain(this._width,this._height);this.setSize(Q.width,Q.height),super.performLayout()}paint(J,Q=0,Z=0){let X=Q+this.offset.x,Y=Z+this.offset.y,K=Math.floor(this.size.width),G=Math.floor(this.size.height),q=K/2,z=G/2,U=Math.max(1,K/2-1),W=Math.max(1,G/(2*kJ1)-1),F=Math.min(U,W);for(let H=0;H<G;H++){let B=Y+H,M=!0;if(H>0){M=!0;for(let N=0;N<K;N++){let L=N-q,A=(H-1-z)/kJ1;if(Math.sqrt(L*L+A*A)/F<1){M=!1;break}}}let V=!0;for(let N=0;N<K;N++){let L=N-q,A=(H-z)/kJ1,w=Math.sqrt(L*L+A*A),R=w/F;if(R>=1)continue;let O=1-R*R,j=this._colorMode==="fast"?2.5:1,E=(this._noise2D(N/fq6,H/fq6+this._time*j)+1)*0.5*O;for(let x of this._shockwaves){let h=this._time-x.startTime;if(h<0||h>Dg1)continue;let v=N-x.x,_=(H-x.y)/kJ1,b=Math.sqrt(v*v+_*_),g=h*$q9,k=Math.abs(b-g);if(k<mq6){let y=w/F;if(y<0.95){let f=1-h/Dg1,m=(1-k/mq6)*f,n=1-Math.pow(y,3);E=Math.min(1,E+m*0.8*n)}}}let I=hq6[Math.floor(E*hq6.length)]||Vq9,T=jq9(E,this._colorMode),S=X+N;if(S<0||S>=J.getSize().width)continue;J.setCell(S,B,{char:I,width:1,style:{fg:T}}),V=!1}if(V&&M)continue}}}class _J1{toolRunning;toolSuccess;toolError;toolCancelled;toolName;userMessage;assistantMessage;systemMessage;codeBlock;inlineCode;syntaxHighlight;fileReference;processing;waiting;completed;cancelled;recommendation;suggestion;command;filename;keybind;button;shellMode;shellModeHidden;diffAdded;diffRemoved;diffChanged;diffContext;ideConnected;ideDisconnected;ideWarning;scrollbarThumb;scrollbarTrack;tableBorder;constructor({toolRunning:J,toolSuccess:Q,toolError:Z,toolCancelled:X,toolName:Y,userMessage:K,assistantMessage:G,systemMessage:q,codeBlock:z,inlineCode:U,syntaxHighlight:W,fileReference:F,processing:H,waiting:B,completed:M,cancelled:V,suggestion:N,command:L,filename:A,keybind:w,button:R,shellMode:O,shellModeHidden:j,diffAdded:$,diffRemoved:E,diffChanged:I,diffContext:T,ideConnected:S,ideDisconnected:x,ideWarning:h,scrollbarThumb:v,scrollbarTrack:_,tableBorder:b,recommendation:g}){this.toolRunning=J,this.toolSuccess=Q,this.toolError=Z,this.toolCancelled=X,this.toolName=Y,this.userMessage=K,this.assistantMessage=G,this.systemMessage=q,this.codeBlock=z,this.inlineCode=U,this.syntaxHighlight=W,this.fileReference=F,this.processing=H,this.waiting=B,this.completed=M,this.cancelled=V,this.suggestion=N,this.command=L,this.filename=A,this.keybind=w,this.button=R,this.shellMode=O,this.shellModeHidden=j,this.diffAdded=$,this.diffRemoved=E,this.diffChanged=I,this.diffContext=T,this.ideConnected=S,this.ideDisconnected=x,this.ideWarning=h,this.scrollbarThumb=v,this.scrollbarTrack=_,this.tableBorder=b,this.recommendation=g}static default(){return new _J1({toolRunning:E1.blue,toolSuccess:E1.green,toolError:E1.red,toolCancelled:E1.yellow,toolName:E1.default(),userMessage:E1.cyan,assistantMessage:E1.white,systemMessage:E1.index(8),codeBlock:E1.default(),inlineCode:E1.yellow,syntaxHighlight:{keyword:E1.blue,string:E1.green,number:E1.yellow,comment:E1.index(8),function:E1.cyan,variable:E1.default(),type:E1.magenta,operator:E1.white},fileReference:E1.cyan,processing:E1.blue,waiting:E1.yellow,completed:E1.green,cancelled:E1.index(8),recommendation:E1.blue,suggestion:E1.magenta,command:E1.yellow,filename:E1.cyan,keybind:E1.blue,button:E1.cyan,shellMode:E1.blue,shellModeHidden:E1.index(8),diffAdded:E1.green,diffRemoved:E1.red,diffChanged:E1.yellow,diffContext:E1.index(8),ideConnected:E1.green,ideDisconnected:E1.red,ideWarning:E1.yellow,scrollbarThumb:E1.index(7),scrollbarTrack:E1.index(8),tableBorder:E1.index(8)})}}class pC{base;app;constructor({base:J,app:Q}){this.base=J,this.app=Q}get colors(){return this.base.colorScheme}static default(){return new pC({base:tK.default(),app:_J1.default()})}static fromBaseTheme(J){return new pC({base:J,app:_J1.default()})}}class i6 extends FZ{data;constructor({key:J,data:Q,child:Z}){super({key:J,child:Z});this.data=Q}static of(J){let Q=J.dependOnInheritedWidgetOfExactType(i6);if(Q)return Q.widget.data;return pC.default()}static maybeOf(J){let Q=J.dependOnInheritedWidgetOfExactType(i6);if(Q)return Q.widget.data;return null}updateShouldNotify(J){return this.data!==J.data}}G9();class cq6{vertical="│";tee="├";elbow="╰";horizontal="─";indent=4;connectorColor=E1.white;connectorDim=!0}class ip extends OY{style;showTreeCharacters;constructor({key:J,children:Q,style:Z,showTreeCharacters:X=!0}){super({key:J,children:Q});this.style=Z??new cq6,this.showTreeCharacters=X}createRenderObject(){return new lq6({style:this.style,showTreeCharacters:this.showTreeCharacters})}updateRenderObject(J){J.updateTreeView({style:this.style,showTreeCharacters:this.showTreeCharacters})}}class lq6 extends Z8{style;showTreeCharacters;constructor({style:J,showTreeCharacters:Q}){super();this.style=J,this.showTreeCharacters=Q}updateTreeView({style:J,showTreeCharacters:Q}){this.style=J,this.showTreeCharacters=Q,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;if(!J)return;let Z=(this.style.tee+this.style.horizontal+" ").length,X=Math.max(0,J.maxWidth-Z),Y=0;for(let G of this.children){let q=G,z=new w6(X,X,0,1/0);q.layout(z),q.setOffset(Z,Y),Y+=q.size.height}let K=J.constrain(J.maxWidth,Y);this.setSize(K.width,K.height)}paint(J,Q,Z){if(this.showTreeCharacters){let X=Z+this.offset.y;for(let Y=0;Y<this.children.length;Y++){let G=this.children[Y],q=Y===this.children.length-1,z=G.size.height,W=(q?this.style.elbow:this.style.tee)+this.style.horizontal+" ",F=Q+this.offset.x;for(let H of W){let B=D9(H,{fg:this.style.connectorColor,dim:this.style.connectorDim});J.setCell(F,X,B),F++}if(F=Q+this.offset.x,!q){let H=D9(this.style.vertical,{fg:this.style.connectorColor,dim:this.style.connectorDim});for(let B=1;B<z;B++)J.setCell(F,X+B,H)}X+=G.size.height}}super.paint(J,Q,Z)}}class xJ1 extends I6{bashInvocations;constructor({bashInvocations:J,key:Q}){super(Q?{key:Q}:{});this.bashInvocations=J}build(J){if(this.bashInvocations.length===0)return new i0({children:[]});let Q=i6.of(J),Z=Q.colors,X=this.bashInvocations.map((K)=>{let G=K.hidden,q=G?Q.app.shellModeHidden:Q.app.shellMode,U=[new n1({text:new N1("",void 0,[new N1(`${G?"$$":"$"} `,new $1({color:q,bold:!0})),new N1(K.args.cmd,new $1({color:E1.green}))]),selectable:!0})];if(K.toolRun.status==="in-progress"||K.toolRun.status==="done"){let W=K.toolRun.progress;if(W?.output){let F=this.getLastOutputLines(W.output);U.push(...F.map((H)=>new n1({text:new N1(H,new $1({color:E1.white,dim:!0})),selectable:!0})))}}if(K.toolRun.status==="blocked-on-user"){let W=K.toolRun.reason?` (${K.toolRun.reason})`:"";U.push(new n1({text:new N1(`Waiting for confirmation${W}`,new $1({color:E1.white,italic:!0})),selectable:!0}))}return new i0({crossAxisAlignment:"start",children:U})}),Y=[new U0({height:1}),new n1({text:new N1("Shell Mode:",new $1({color:E1.blue,bold:!0})),selectable:!0}),new ip({children:X})];return new i0({crossAxisAlignment:"start",children:Y})}getLastOutputLines(J){if(!J)return[];return J.split(`
|
|
6457
|
-
`).filter((Z)=>Z.trim()!=="").slice(-3)}}G9();b2();class Vg1 extends I6{leftChild;rightChild1;rightChild2;maxHeight;borderColor;borderStyle;overlayTexts;hasBanner;constructor({key:J,leftChild:Q,rightChild1:Z,rightChild2:X,maxHeight:Y,borderColor:K=E1.index(7),borderStyle:G="rounded",overlayTexts:q=[],hasBanner:z=!1}){super({key:J});this.leftChild=Q,this.rightChild1=Z,this.rightChild2=X,this.maxHeight=Y,this.borderColor=K,this.borderStyle=G,this.overlayTexts=q,this.hasBanner=z}build(J){let Q=[];for(let Z of this.overlayTexts){let X=0,Y,K=0,G;switch(Z.position){case"top-left":X=2+(Z.offsetX??0),K=0+(Z.offsetY??0);break;case"top-right":Y=2+(Z.offsetX??0),K=0+(Z.offsetY??0);break;case"bottom-left":X=2+(Z.offsetX??0),G=0+(Z.offsetY??0);break;case"bottom-right":Y=2+(Z.offsetX??0),G=0+(Z.offsetY??0);break}let q=new n1({text:Z.text}),z=Z.onClick?new x9({child:q,onClick:Z.onClick,cursor:"pointer"}):q;Q.push(new wX({left:X!==0?X:void 0,right:Y!==void 0?Y:void 0,top:K!==0?K:void 0,bottom:G!==void 0?G:void 0,child:z}))}return new fC({child:new TJ({children:[new iq6({children:[this.leftChild,...this.rightChild1?[this.rightChild1]:[],...this.rightChild2?[this.rightChild2]:[]],maxHeight:this.maxHeight,borderColor:this.borderColor,borderStyle:this.borderStyle,hasBanner:this.hasBanner}),...Q]})})}}class iq6 extends OY{maxHeight;borderColor;borderStyle;hasBanner;constructor({children:J,maxHeight:Q,borderColor:Z,borderStyle:X,hasBanner:Y}){super({children:J});this.maxHeight=Q,this.borderColor=Z,this.borderStyle=X,this.hasBanner=Y}createRenderObject(){return new nq6(this.maxHeight,this.borderColor,this.borderStyle,this.hasBanner)}updateRenderObject(J){J.maxHeight=this.maxHeight,J.borderColor=this.borderColor,J.borderStyle=this.borderStyle,J.hasBanner=this.hasBanner}}class nq6 extends Z8{maxHeight;borderColor;borderStyle;hasBanner;constructor(J,Q=E1.index(7),Z="rounded",X=!1){super();this.maxHeight=J,this.borderColor=Q,this.borderStyle=Z,this.hasBanner=X}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this.children;if(Q.length===0){this.setSize(J.minWidth,2),super.performLayout();return}let Z=Q[0];if(!Z){this.setSize(J.minWidth,2),super.performLayout();return}let X=Q.length>1?Q[1]:void 0,Y=Q.length>2?Q[2]:void 0,K=J.maxWidth,G=Math.floor(K/2),q=this.getMinIntrinsicHeight(K),z=Math.min(q,J.maxHeight);if(this.maxHeight)z=Math.min(z,this.maxHeight);this.setSize(K,z);let U=z-2,F=X||Y?G-2:K-2,H=new w6(0,F,0,Math.max(0,U));if(Z.layout(H),Z.setOffset(1,1),X||Y){let B=K-G-2,M=Math.max(0,Math.floor(U)),V=(w)=>new w6(0,B,0,Math.max(0,Math.floor(w))),N=M,L=0;if(X){let w=X.getMinIntrinsicHeight(B),R=Math.min(w,N);X.layout(V(R)),L=X.size.height,X.setOffset(G+1,1),N=Math.max(0,N-L)}if(!!(X&&Y&&L>0))N=Math.max(0,N-1);if(Y){let w=Y.getMinIntrinsicHeight(B),R=Math.min(w,N);Y.layout(V(R));let O=L>0?L+2:1;Y.setOffset(G+1,O)}}super.performLayout()}getMinIntrinsicHeight(J){let Q=this.children;if(Q.length===0)return 2;let Z=Q[0];if(!Z)return 2;let X=Q.length>1?Q[1]:void 0,Y=Q.length>2?Q[2]:void 0,K=Math.floor(J/2),q=X||Y?K:J,z=Z.getMinIntrinsicHeight(q-2),U=Math.min(z,50),W=0;if(X||Y){let B=J-K-2,M=X?X.getMinIntrinsicHeight(B):0,V=Y?Y.getMinIntrinsicHeight(B):0;W=M+V+(M>0&&V>0?1:0)}return Math.max(U,W)+2}getMaxIntrinsicHeight(J){return this.getMinIntrinsicHeight(J)}paint(J,Q=0,Z=0){let X=Math.floor(Q+this.offset.x),Y=Math.floor(Z+this.offset.y);super.paint(J,Q,Z),this._paintGridBorders(J,X,Y)}_paintGridBorders(J,Q,Z){let X=this.size.width,Y=this.size.height,K=this.children,G=K.length>1,q=K.length>1?K[1]:void 0,z=K.length>2?K[2]:void 0,U={fg:this.borderColor},W=Math.floor(X/2),H=(()=>{return this.borderStyle==="rounded"?{tl:"╭",tr:"╮",bl:"╰",br:"╯"}:{tl:"┌",tr:"┐",bl:"└",br:"┘"}})();for(let B=0;B<X;B++)J.setChar(Q+B,Z,"─",U,1);for(let B=0;B<X;B++)J.setChar(Q+B,Z+Y-1,"─",U,1);for(let B=0;B<Y;B++)J.setChar(Q,Z+B,"│",U,1);for(let B=0;B<Y;B++)J.setChar(Q+X-1,Z+B,"│",U,1);if(this.hasBanner)J.setChar(Q,Z,"├",U,1),J.setChar(Q+X-1,Z,"┤",U,1);else J.setChar(Q,Z,H.tl,U,1),J.setChar(Q+X-1,Z,H.tr,U,1);if(J.setChar(Q,Z+Y-1,H.bl,U,1),J.setChar(Q+X-1,Z+Y-1,H.br,U,1),G){for(let B=1;B<Y-1;B++)J.setChar(Q+W,Z+B,"│",U,1);J.setChar(Q+W,Z,"┬",U,1),J.setChar(Q+W,Z+Y-1,"┴",U,1)}if(q&&z&&q.size.height>0){let B=q.offset.y+q.size.height;for(let M=W+1;M<X-1;M++)J.setChar(Q+M,Z+B,"─",U,1);J.setChar(Q+W,Z+B,"├",U,1),J.setChar(Q+X-1,Z+B,"┤",U,1)}}}t9();vy();class Ng1 extends I6{status;constructor({status:J,key:Q}){super(Q?{key:Q}:{});this.status=J}build(J){if(this.status===null||!this.status.enabled)return new U0({width:0,height:0});let Q=this.status,Z=Q.connected===!0,X=!!Q.errorMessage,Y=Q.clientID||"unknown",K,G;if(X)K="×",G=E1.red;else if(Z)K="✓",G=E1.green;else K="○",G=E1.yellow;let q=`${K} Client: ${Y}`;return new X8({mainAxisSize:"min",children:[new n1({text:new N1(q,new $1({color:G}))})]})}}G0();C0();function np(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Z=Array.isArray(J),X=Array.isArray(Q);if(Z!==X)return!1;if(Z&&X)return J.length===Q.length&&J.every((K,G)=>np(K,Q[G]));let Y=new Set([...Object.keys(J),...Object.keys(Q)]);for(let K of Y)if(!np(J[K],Q[K]))return!1;return!0}G0();AD();function aq6(J){return xd(600000).pipe(p2(void 0),q8(()=>J.config.pipe(x0(({settings:Q,secrets:Z})=>({settings:{url:Q.url,proxy:Q.proxy},secrets:Z})),J8((Q,Z)=>np(Q.settings,Z.settings)&&Q.secrets===Z.secrets),yN(()=>d6(async(Q)=>{let Z=await GJ.getUserInfo({},{signal:Q,config:J});if(Z.ok)return Z.result;if(Z.error&&Z.error.code==="auth-required")return null;throw u.error("getUserInfo failed",{error:Z.error}),Error(`getUserInfo error: ${Z.error.code}`)})))),x0((Q)=>{return Q instanceof Error?{error:{message:String(Q)}}:Q===kJ?"pending":Q?{user:Q,workspace:Q?.team}:{error:{message:"User not found"}}}),J8((Q,Z)=>np(Q,Z)),M9({shouldCountRefs:!0}))}function rq6(J){return Boolean(typeof J==="object"&&"user"in J&&J.user)}C0();l8();var Lg1=!1;class Ag1 extends c0{props;constructor(J){super();this.props=J}createState(){return new sq6}}class sq6 extends d0{showCost=Lg1;subscription=null;initState(){super.initState(),this.subscription=b9(aq6(this.widget.props.configService).pipe(P7((J)=>J!=="pending")),this.widget.props.configService.config).pipe(x0(([J,Q])=>{let Z=rq6(J)?J.user.email:"",X=Z.toLowerCase().endsWith("@sourcegraph.com"),Y=Lg1||X,K=Q.settings["internal.showCost"]??!0,G=Y&&K;return u.debug("CostDisplayProvider computed showCost",{email:Z,isTeammate:X,isEligible:Y,setting:K,computedShowCost:G,currentShowCost:this.showCost}),G}),J8()).subscribe((J)=>{u.debug("CostDisplayProvider setState called",{previousShowCost:this.showCost,newShowCost:J}),this.setState(()=>{this.showCost=J})})}dispose(){this.subscription?.unsubscribe(),this.subscription=null,super.dispose()}build(J){return new wg1({showCost:this.showCost,child:this.widget.props.child})}}class wg1 extends FZ{showCost;constructor({showCost:J,child:Q}){super({child:Q});this.showCost=J}updateShouldNotify(J){return this.showCost!==J.showCost}}function XB(J){let Q=J.dependOnInheritedWidgetOfExactType(wg1);if(Q)return Q.widget.showCost;return Lg1}class Rg1 extends I6{totalCredits;onClick;constructor({totalCredits:J,onClick:Q,key:Z}){super(Z?{key:Z}:{});this.totalCredits=J,this.onClick=Q}build(J){if(!XB(J))return new U0({width:0,height:0});if(!this.totalCredits)return new U0({width:0,height:0});let Z=e6.of(J).colorScheme,X=ZB(this.totalCredits),Y=new n1({text:new N1(X,new $1({color:Z.foreground,dim:!0}))});if(this.onClick)return new x9({onClick:this.onClick,child:Y});return Y}}G0();AW();$L();Tc();v6();l8();G0();b2();class MN extends FZ{onError;constructor({onError:J,child:Q}){super({child:Q});this.onError=J}updateShouldNotify(J){return!1}static of(J){return J.dependOnInheritedWidgetOfExactType(MN)?.widget?.onError}}class NQ extends I6{uri;text;style;maxLines;overflow;onError;constructor({uri:J,text:Q,style:Z,maxLines:X,overflow:Y,onError:K,key:G}){super({key:G});this.uri=J,this.text=Q,this.style=Z,this.maxLines=X,this.overflow=Y,this.onError=K}build(J){let Q=MN.of(J),Z=this.onError??Q;return m6(Z!==void 0,"Link widget requires either onError prop or ErrorHandlerProvider in context"),NQ.createWidget(this.uri,this.text,Z,this.style,this.maxLines,this.overflow)}static createWidget(J,Q,Z,X,Y,K){let G=new n1({text:NQ.createSpan(J,Q,X),selectable:!0,maxLines:Y,overflow:K});return new x9({onClick:async()=>{try{await AY(J)}catch(q){u.error("[Link] Error opening link",{uri:J,error:q});let z=q instanceof Error?q:Error(String(q));z.uri=J,u.error("[Link] Calling error handler"),Z(z)}},cursor:"pointer",child:G})}static createSpan(J,Q,Z){let X=lK(),Y=X?J:Q,K=X?new $1({color:Z?.color,dim:!0}):Z||new $1({underline:!0}),G=X?void 0:NG6(J);return new N1(Y,K,void 0,G)}}AW();v6();l8();class Og1 extends c0{props;constructor(J){super();this.props=J}createState(){return new oq6}}class oq6 extends d0{displayPathEnvInfo=null;subscription=null;constructor(){super()}initState(){super.initState(),this.subscription=this.widget.props.configService.displayPathEnvInfo.subscribe((J)=>{Vc(J),this.setState(()=>{this.displayPathEnvInfo=J})})}dispose(){this.subscription?.unsubscribe(),super.dispose()}build(J){return new jg1({displayPathEnvInfo:this.displayPathEnvInfo,child:this.widget.props.child})}}class jg1 extends FZ{displayPathEnvInfo;constructor({displayPathEnvInfo:J,child:Q}){super({child:Q});this.displayPathEnvInfo=J}updateShouldNotify(J){return this.displayPathEnvInfo!==J.displayPathEnvInfo}}function PR(J){let Q=J.dependOnInheritedWidgetOfExactType(jg1);if(!Q)return null;return Q.widget.displayPathEnvInfo}function dC(J,Q){if(J.startsWith("/")||/^[A-Za-z]:[\\/]/.test(J)){let X=PR(Q),Y=O0.file(J);return XJ(Y,X??void 0)}return J}M51();function $g1(J,Q,Z){return new n1({text:new N1(`${J}${Q}`,new $1({color:Z})),maxLines:1})}function tq6(J,Q,Z,X){return[$g1("+",J,X.success),r7.horizontal(1),$g1("~",Q,X.warning),r7.horizontal(1),$g1("-",Z,X.destructive)]}class Eg1 extends c0{threadViewState;threadID;onFileChangesClick;constructor({threadViewState:J,threadID:Q,onFileChangesClick:Z,key:X}){super(X?{key:X}:{});this.threadViewState=J,this.threadID=Q,this.onFileChangesClick=Z}createState(){return new eq6}}class eq6 extends d0{build(J){let Z=i6.of(J).colors;if(this.widget.threadViewState.state!=="active")return new U0({width:0,height:0});let{fileChanges:X}=this.widget.threadViewState,Y=mX1(X);if(Y.totalFiles===0)return new U0({width:0,height:0});let K=Y.totalFiles-Y.revertedFiles,G=`${K} ${K===1?"file":"files"} changed`,q=new n1({text:new N1(G,new $1({color:Z.foreground,dim:!0})),maxLines:1}),z;if(Y.totalAdded>0||Y.totalModified>0||Y.totalRemoved>0){let U=tq6(Y.totalAdded,Y.totalModified,Y.totalRemoved,Z);z=new X8({children:[q,r7.horizontal(1),...U],mainAxisSize:"min"})}else z=q;return new x9({onClick:()=>{if(this.widget.onFileChangesClick)this.widget.onFileChangesClick()},cursor:"pointer",child:z})}}class Ig1 extends c0{createState(){return new Jz6}}class Jz6 extends d0{build(J){let Z=e6.of(J).colorScheme,Y=i6.of(J).app,K=_8.of(J),G=D51();if(!G)return new U0({width:0,height:0});let q=G.getThreadData(),z=q.viewState,U=q.mainThread?.id;if(z.state!=="active"||!U)return new U0({width:0,height:0});let{fileChanges:W}=z,F=mX1(W);if(F.totalFiles===0)return new U0({width:0,height:0});let H=F.totalFiles-F.revertedFiles,B=F.allReverted?`${F.revertedFiles} ${F.revertedFiles===1?"change":"changes"} reverted`:`${H} ${H===1?"file":"files"} changed`,M=new C9({child:new n1({text:new N1(B,new $1({color:Z.primary,bold:!0}))})}),V=PR(J),N=[];for(let v of W.files){let _=O0.parse(v.uri),b=XJ(_,V??void 0),g=v.reverted,k=[];if(k.push(new R8({child:new NQ({uri:v.uri,text:b,style:new $1({color:E1.cyan,dim:g,underline:!g}),maxLines:1,overflow:"ellipsis"})})),k.push(r7.horizontal(1)),g)k.push(new n1({text:new N1("Reverted",new $1({color:Z.foreground,dim:!0,italic:!0}))}));else{let f=tq6(v.diffStat.added,v.diffStat.modified,v.diffStat.removed,Z);k.push(...f),k.push(r7.horizontal(1)),k.push(new x9({onClick:async(m)=>{try{await HJ.revertFileChanges(U,v.uri),this.setState(()=>{})}catch(n){u.error(`Error reverting file ${v.uri} (thread id: ${U}):`,n)}},cursor:"pointer",child:new n1({text:new N1("↶",new $1({color:Y.button}))})}))}let y=new X8({mainAxisSize:"max",crossAxisAlignment:"center",children:k});N.push(new x6({padding:V0.only({left:2,right:2,top:0,bottom:0}),child:y}))}let L=[];L.push(M),L.push(new U0({height:1}));for(let v of N)L.push(v);if(!F.allReverted&&H>0){let v=new x6({padding:V0.only({top:1,left:2,right:2}),child:new X8({mainAxisSize:"max",crossAxisAlignment:"center",children:[new R8({child:new n1({text:new N1(`${H} ${H===1?"file":"files"} changed`,new $1({color:Z.foreground}))})}),r7.horizontal(1),new x9({onClick:async(_)=>{try{await HJ.revertFileChanges(U),this.setState(()=>{})}catch(b){u.error(`Error reverting all files (thread id: ${U}):`,b)}},cursor:"pointer",child:new n1({text:new N1("Revert All",new $1({color:Y.button}))})})]})});L.push(v)}let A=K.size.width,w=K.size.height,R=A-4,O=w-4,j=Math.min(60,R),$=new C9({child:new n1({text:new N1("",new $1({color:Z.foreground}),[new N1("Press ",new $1({color:Z.foreground})),new N1("Escape",new $1({color:Y.keybind})),new N1(" to close",new $1({color:Z.foreground}))])})}),E=[...L,new U0({height:1}),$],I=2+N.length+(H>0?2:0)+1+1+4+2,T=Math.min(I,O),S=new x6({padding:V0.all(1),child:new i0({crossAxisAlignment:"stretch",children:E})}),h=I>O?new $Y({autofocus:!0,child:S}):S;return new C9({child:new y0({constraints:new w6(j,j,T,T),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:h})})}}hv();import Qz6 from"node:path";l8();function Eq9(J,Q){try{return decodeURIComponent(J)}catch(Z){if(Q!==void 0)return Q;throw Z}}class Pg1 extends c0{ideStatus;onShowIdePicker;constructor({ideStatus:J,onShowIdePicker:Q,key:Z}){super(Z?{key:Z}:{});this.ideStatus=J,this.onShowIdePicker=Q}createState(){return new Zz6}}class Zz6 extends d0{ideCount=0;intervalId;initState(){this.loadConfigs(),this.intervalId=setInterval(()=>{this.loadConfigs()},5000)}dispose(){if(this.intervalId)clearInterval(this.intervalId)}loadConfigs(){this.ideCount=gB({includeAll:!0}).length,this.setState()}build(J){if(this.widget.ideStatus===null||!this.widget.ideStatus.enabled)return this.statusIdle();let Q=this.widget.ideStatus,Z=Q.connectionState;if(!Z||Z==="never-connected")return this.statusIdle();if(Z==="reconnecting")return this.statusReconnecting(Q);if(Z==="disconnected")return this.statusDisconnected(Q);let X=Q.authenticated,Y=Q.selections?.[0],K=!ge(Y)&&Y?Y.range.endLine-Y.range.startLine+1:0,G=[];if(!X)if(Q.errorMessage)G.push(Q.errorMessage);else if(Q.connected===!1)G.push("IDE Not Connected");else G.push("IDE Error");else if(!Q.openFile&&!Y)G.push(`${Q.ideName?Q.ideName:"Unknown IDE"}`);if(Q.openFile)G.push(Qz6.basename(Eq9(Q.openFile,Q.openFile)));if(Y&&K>0)G.push(`${K} selected ${_J(K,"line")}`);let q=G.join(" • "),z=X?"✓":"×",U=X?E1.index(10):E1.index(9),F=`${z} ${q}${!X?" • Use /ide to connect":""}`;return this.idePickerText(F,U)}statusIdle(){if(this.ideCount===0)return new U0({width:0,height:0});else{let J=`${this.ideCount} ${_J(this.ideCount,"IDE")} available`;return this.idePickerText(J)}}statusDisconnected(J){if((J.reconnectElapsedMs??0)>=60000)return this.statusIdle();let Z="IDE disconnected. Use /ide to connect";return this.idePickerText(Z)}statusReconnecting(J){let Q=J.ideName||"IDE",Z=J.workspace?` in ${Qz6.basename(J.workspace)}`:"",X=`Reconnecting to ${Q}${Z}...`,Y=J.reconnectElapsedMs??0;return this.idePickerText(X,Y<5000?E1.yellow:E1.index(8))}idePickerText(J,Q=E1.index(8)){let Z=new n1({text:new N1(J,new $1({color:Q})),maxLines:1}),X=this.widget.onShowIdePicker?new x9({onClick:this.widget.onShowIdePicker,cursor:"pointer",child:Z}):Z;return new X8({children:[X],mainAxisSize:"min"})}}l8();function Iq9(J){return J.toLowerCase().includes("sonnet")}function Pq9(J){return{recommendation:Iq9(J)?0.2:0.6,warning:0.8,danger:0.9}}function Tq9(J,Q){let Z=Pq9(Q);if(J>=Z.danger)return"danger";else if(J>=Z.warning)return"warning";else if(J>=Z.recommendation)return"recommendation";return!1}function Tg1(J){let Q=J.totalInputTokens/J.maxInputTokens;return Tq9(Q,J.model||"")}class Cg1 extends c0{threadViewState;tokenUsage;thread;waitingForConfirmation;showingEphemeralError;executingCommand;executingCommandMessage;runningBashInvocations;constructor({threadViewState:J,tokenUsage:Q,thread:Z,waitingForConfirmation:X=!1,showingEphemeralError:Y=!1,executingCommand:K=null,executingCommandMessage:G=null,runningBashInvocations:q=!1,key:z}={}){super(z?{key:z}:{});this.threadViewState=J,this.tokenUsage=Q,this.thread=Z,this.waitingForConfirmation=X,this.showingEphemeralError=Y,this.executingCommand=K,this.executingCommandMessage=G,this.runningBashInvocations=q}createState(){return new Xz6}}class Xz6 extends d0{animationFrame=0;animationTimer=null;animationFrames=["∿","∾","∽","≋","≈","∼"];initState(){this.startAnimationIfNeeded()}didUpdateWidget(J){this.startAnimationIfNeeded()}dispose(){this.stopAnimation()}startAnimationIfNeeded(){let J=this.shouldShowSpinner();if(J&&!this.animationTimer)this.startAnimation();else if(!J&&this.animationTimer)this.stopAnimation()}startAnimation(){if(this.animationTimer)return;this.animationTimer=setInterval(()=>{this.setState(()=>{this.animationFrame=(this.animationFrame+1)%this.animationFrames.length})},200)}stopAnimation(){if(this.animationTimer)clearInterval(this.animationTimer),this.animationTimer=null}shouldShowSpinner(){let{threadViewState:J,waitingForConfirmation:Q,runningBashInvocations:Z}=this.widget;return Boolean(Z||J&&J.state==="active"&&(J.inferenceState==="running"||J.interactionState==="tool-running")&&!this.isShowingTokenUsageNote()&&!Q)}isShowingTokenUsageNote(){let{tokenUsage:J,showingEphemeralError:Q}=this.widget;if(!J||Q)return!1;let Z=Tg1(J);return Z==="recommendation"||Z==="warning"||Z==="danger"}getSpinnerColor(){let{threadViewState:J}=this.widget;if(!J)return E1.index(8);if(J.state==="active"){if(J.inferenceState==="running")return E1.index(12)}return E1.index(8)}getStatusMessageColor(J,Q){let{threadViewState:Z,tokenUsage:X,showingEphemeralError:Y,executingCommand:K,runningBashInvocations:G}=this.widget;if(K)return Q.command;if(G)return J.foreground;if(X&&!Y){let q=Tg1(X);if(q==="recommendation")return Q.recommendation;if(q==="warning")return J.warning;if(q==="danger")return J.destructive}if(Z?.state==="active"&&Z.inferenceState==="cancelled")return E1.index(8);return J.foreground}build(J){let Q=i6.of(J),Z=Q.colors,X=Q.app,Y=Sg1(this.widget);if(!Y)return new U0({width:0,height:0});let K=[];if(this.shouldShowSpinner()){let q=this.animationFrames[this.animationFrame];K.push(new n1({text:new N1(q,new $1({color:this.getSpinnerColor()})),maxLines:1})),K.push(r7.horizontal(1))}return K.push(new n1({text:new N1(Y,new $1({color:this.getStatusMessageColor(Z,X),italic:this.widget.threadViewState?.state==="active"&&this.widget.threadViewState.inferenceState==="cancelled"})),textAlign:"left",maxLines:1,overflow:"clip"})),new X8({children:K,mainAxisSize:"min"})}}function Sg1(J){let{threadViewState:Q,tokenUsage:Z,showingEphemeralError:X,executingCommand:Y,executingCommandMessage:K,runningBashInvocations:G}=J;if(Y)return K??`Executing /${Y}...`;if(G)return"Running shell command...";if(!Q||Q.state!=="active")return null;if(Q.interactionState==="tool-running"){let q=Q.toolState.running;if(q>1)return`Running ${q} tools...`;return"Running tools..."}if(Q.inferenceState==="running"){let q=J.thread?.messages.at(-1);if(!(q?.role==="assistant"&&q.state.type==="streaming"))return"Waiting for response...";if(J.runningBashInvocations)return"Running tools...";return"Streaming response..."}if(Z&&!X&&J.thread?.agentMode!=="free"){let q=Tg1(Z);if(q==="recommendation")return"Optimize context: /handoff to focus on specific tasks or /new for a fresh start";if(q==="warning")return"High context usage. Use /handoff to focus on specific tasks or /new to restart";if(q==="danger")return"Context window is close to full. Use /handoff to focus on specific tasks or /new to restart"}return null}function Cq9(J){if(J>=900000)return{recommendation:0.2,warning:0.8,danger:0.9};else if(J>=400000)return{recommendation:0.7,warning:0.8,danger:0.9};else return{recommendation:0.8,warning:0.9,danger:0.95}}function Sq9(J){if(J>=1e6)return`${Math.round(J/1e6)}M`;else if(J>=1000)return`${Math.round(J/1000)}k`;return J.toString()}function vq9(J,Q){let Z=Cq9(Q);if(J>=Z.danger)return"danger";else if(J>=Z.warning)return"warning";else if(J>=Z.recommendation)return"recommendation";return!1}class vg1 extends I6{tokenUsage;isNarrow;constructor({tokenUsage:J,isNarrow:Q=!1,key:Z}){super(Z?{key:Z}:{});this.tokenUsage=J,this.isNarrow=Q}build(J){let Z=i6.of(J).colors,X=this.tokenUsage.totalInputTokens/this.tokenUsage.maxInputTokens,Y=Math.round(X*100),K=Math.max(0,Math.min(Y,100)),G=this.isNarrow?`${K}%`:`${K}% of ${Sq9(this.tokenUsage.maxInputTokens)}`,q=new $1({color:Z.foreground,dim:!0}),z=vq9(X,this.tokenUsage.maxInputTokens);if(z==="danger")q=new $1({color:Z.destructive});else if(z==="warning")q=new $1({color:Z.warning});else if(z==="recommendation")q=new $1({color:Z.info});return new n1({text:new N1(G,q),textAlign:"left",maxLines:1,overflow:"clip"})}}class kg1 extends I6{hint;constructor({hint:J,key:Q}={}){super(Q?{key:Q}:{});this.hint=J}build(J){if(!this.hint)return new U0({width:0,height:0});return new n1({text:this.hint,textAlign:"left",maxLines:1,overflow:"clip"})}}class bJ1 extends I6{statusText;isAnimated;statusType;threadViewState;threadTokenUsage;threadID;thread;onFileChangesClick;onCostBreakdownClick;onShowIdePicker;ideStatus;connectedClientsStatus;isNarrow;uiHint;waitingForConfirmation;showingEphemeralError;executingCommand;executingCommandMessage;runningBashInvocations;constructor({statusText:J,isAnimated:Q=!1,statusType:Z="idle",threadViewState:X,threadTokenUsage:Y,threadID:K,thread:G,onFileChangesClick:q,onCostBreakdownClick:z,onShowIdePicker:U,ideStatus:W=null,connectedClientsStatus:F=null,isNarrow:H=!1,uiHint:B,waitingForConfirmation:M=!1,showingEphemeralError:V=!1,executingCommand:N=null,executingCommandMessage:L=null,runningBashInvocations:A=!1,key:w}={}){super(w?{key:w}:{});this.statusText=J,this.isAnimated=Q,this.statusType=Z,this.threadViewState=X,this.threadTokenUsage=Y,this.threadID=K,this.thread=G,this.onFileChangesClick=q,this.onCostBreakdownClick=z,this.onShowIdePicker=U,this.ideStatus=W,this.connectedClientsStatus=F,this.isNarrow=H,this.uiHint=B,this.waitingForConfirmation=M,this.showingEphemeralError=V,this.executingCommand=N,this.executingCommandMessage=L,this.runningBashInvocations=A}build(J){let Q=[],Z=!1;if(this.threadViewState){let X=new Cg1({threadViewState:this.threadViewState,tokenUsage:this.threadTokenUsage,thread:this.thread,waitingForConfirmation:this.waitingForConfirmation,showingEphemeralError:this.showingEphemeralError,executingCommand:this.executingCommand,executingCommandMessage:this.executingCommandMessage,runningBashInvocations:this.runningBashInvocations});if(Sg1(X))Z=!0;Q.push(X)}if(this.uiHint){if(Z)Q.push(r7.horizontal(2));Q.push(new kg1({hint:this.uiHint}))}if(Q.push(r7.flexible()),this.ideStatus)Q.push(new Pg1({ideStatus:this.ideStatus,onShowIdePicker:this.onShowIdePicker})),Q.push(r7.horizontal(1));if(this.connectedClientsStatus)Q.push(new Ng1({status:this.connectedClientsStatus})),Q.push(r7.horizontal(1));if(this.threadViewState&&!this.isNarrow&&this.threadID&&HG(this.threadID))Q.push(new Eg1({threadViewState:this.threadViewState,threadID:this.threadID,onFileChangesClick:this.onFileChangesClick})),Q.push(r7.horizontal(1));if(this.threadTokenUsage){if(Q.push(new vg1({tokenUsage:this.threadTokenUsage,isNarrow:this.isNarrow})),this.thread&&XB(J)){let X=z30(this.thread);if(X>0)Q.push(r7.horizontal(2)),Q.push(new Rg1({totalCredits:X,onClick:this.onCostBreakdownClick}))}}return new X8({children:Q,mainAxisSize:"min",mainAxisAlignment:"start"})}}var kq9={};function TR(J,Q){let Z=Q||kq9,X=typeof Z.includeImageAlt==="boolean"?Z.includeImageAlt:!0,Y=typeof Z.includeHtml==="boolean"?Z.includeHtml:!0;return Kz6(J,X,Y)}function Kz6(J,Q,Z){if(_q9(J)){if("value"in J)return J.type==="html"&&!Z?"":J.value;if(Q&&"alt"in J&&J.alt)return J.alt;if("children"in J)return Yz6(J.children,Q,Z)}if(Array.isArray(J))return Yz6(J,Q,Z);return""}function Yz6(J,Q,Z){let X=[],Y=-1;while(++Y<J.length)X[Y]=Kz6(J[Y],Q,Z);return X.join("")}function _q9(J){return Boolean(J&&typeof J==="object")}var _g1={AElig:"Æ",AMP:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"\uD835\uDD04",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"\uD835\uDD38",ApplyFunction:"",Aring:"Å",Ascr:"\uD835\uDC9C",Assign:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",Barv:"⫧",Barwed:"⌆",Bcy:"Б",Because:"∵",Bernoullis:"ℬ",Beta:"Β",Bfr:"\uD835\uDD05",Bopf:"\uD835\uDD39",Breve:"˘",Bscr:"ℬ",Bumpeq:"≎",CHcy:"Ч",COPY:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",Cayleys:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",CenterDot:"·",Cfr:"ℭ",Chi:"Χ",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",Colon:"∷",Colone:"⩴",Congruent:"≡",Conint:"∯",ContourIntegral:"∮",Copf:"ℂ",Coproduct:"∐",CounterClockwiseContourIntegral:"∳",Cross:"⨯",Cscr:"\uD835\uDC9E",Cup:"⋓",CupCap:"≍",DD:"ⅅ",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",Darr:"↡",Dashv:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",Delta:"Δ",Dfr:"\uD835\uDD07",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",Diamond:"⋄",DifferentialD:"ⅆ",Dopf:"\uD835\uDD3B",Dot:"¨",DotDot:"⃜",DotEqual:"≐",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",Downarrow:"⇓",Dscr:"\uD835\uDC9F",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"\uD835\uDD08",Egrave:"È",Element:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"\uD835\uDD3C",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",Equilibrium:"⇌",Escr:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",ExponentialE:"ⅇ",Fcy:"Ф",Ffr:"\uD835\uDD09",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",Fopf:"\uD835\uDD3D",ForAll:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"\uD835\uDD0A",Gg:"⋙",Gopf:"\uD835\uDD3E",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",Gt:"≫",HARDcy:"Ъ",Hacek:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",HilbertSpace:"ℋ",Hopf:"ℍ",HorizontalLine:"─",Hscr:"ℋ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Igrave:"Ì",Im:"ℑ",Imacr:"Ī",ImaginaryI:"ⅈ",Implies:"⇒",Int:"∬",Integral:"∫",Intersection:"⋂",InvisibleComma:"",InvisibleTimes:"",Iogon:"Į",Iopf:"\uD835\uDD40",Iota:"Ι",Iscr:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"\uD835\uDD0D",Jopf:"\uD835\uDD41",Jscr:"\uD835\uDCA5",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"\uD835\uDD0E",Kopf:"\uD835\uDD42",Kscr:"\uD835\uDCA6",LJcy:"Љ",LT:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Larr:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",LeftRightArrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessLess:"⪡",LessSlantEqual:"⩽",LessTilde:"≲",Lfr:"\uD835\uDD0F",Ll:"⋘",Lleftarrow:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lopf:"\uD835\uDD43",LowerLeftArrow:"↙",LowerRightArrow:"↘",Lscr:"ℒ",Lsh:"↰",Lstrok:"Ł",Lt:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",MinusPlus:"∓",Mopf:"\uD835\uDD44",Mscr:"ℳ",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
6456
|
+
`,"\r","\v","\f"," "," "," "," "," "," "," "," "," "," "," "," "," ","\u2028","\u2029"," "," "," ","\uFEFF"]),oG9=new Set(["/","\\",".",",",";",":","!","?","(",")","[","]","{","}","<",">","'",'"',"=","+","-","*","&","|","^","%","$","#","@","~","`","_"]);G0();class Kg1{_state;_textController=null;_triggers=[];_optionsBuilder=null;_onSelected=null;_disposed=!1;constructor(){let J={trigger:null,options:[],selectedIndex:-1,isActive:!1,generationId:0};this._state=new IR(J)}get state(){return this._state}get currentState(){return this._state.value}initialize({textController:J,triggers:Q,optionsBuilder:Z,onSelected:X}){if(this._disposed)throw Error("Cannot initialize disposed AutocompleteController");this._cleanup(),this._textController=J,this._triggers=Q,this._optionsBuilder=Z,this._onSelected=X||null,this._textController.addListener(this._handleTextChange)}selectNext(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex<J.options.length-1?J.selectedIndex+1:0;this._updateState({selectedIndex:Q})}selectPrevious(){let J=this.currentState;if(!J.isActive||J.options.length===0)return;let Q=J.selectedIndex>0?J.selectedIndex-1:J.options.length-1;this._updateState({selectedIndex:Q})}acceptSelected(){let J=this.currentState;if(!J.isActive||J.selectedIndex<0||J.selectedIndex>=J.options.length)return;let Q=J.options[J.selectedIndex];if(!Q)return;if(this.dismiss(),this._onSelected)this._onSelected(Q)}dismiss(){this._updateState({trigger:null,options:[],selectedIndex:-1,isActive:!1})}dispose(){this._disposed=!0,this._cleanup(),this._state.dispose()}_handleTextChange=()=>{if(!this._textController||!this._optionsBuilder)return;let J=this._textController.text,Q=this._textController.cursorPosition,Z=null;for(let Y of this._triggers){let K=Y.detect(J,Q);if(K&&(!Z||K.start>Z.start))Z=K}if(!Z){if(this.currentState.isActive)this.dismiss();return}let X=this.currentState.generationId+1;this._updateState({trigger:Z,generationId:X,isActive:!0,selectedIndex:-1}),this._buildOptions(Z.query,X)};async _buildOptions(J,Q){if(!this._optionsBuilder)return;try{let Z=await this._optionsBuilder(J);if(this.currentState.generationId===Q&&!this._disposed)this._updateState({options:Z,selectedIndex:Z.length>0?0:-1,isActive:Z.length>0})}catch(Z){if(u.error("Error building autocomplete options:",Z),this.currentState.generationId===Q&&!this._disposed)this._updateState({options:[],selectedIndex:-1,isActive:!1})}}_updateState(J){if(this._disposed)return;this._state.value={...this.currentState,...J}}_cleanup(){if(this._textController)this._textController.removeListener(this._handleTextChange)}}class mp{}class up{}class pp{}class jJ1{}class $J1 extends c0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new jq6(this.props)}}class jq6 extends d0{props;controller;stateListener=null;overlayEntry=null;layerLink=new Yg1;scrollOffset=0;_effectiveFocusNode;constructor(J){super();this.props=J}initState(){if(super.initState(),this._effectiveFocusNode=this.props.focusNode||new Q9({debugLabel:"AutocompleteFocusOwned"}),this.controller=new Kg1,this.controller.initialize({textController:this.props.controller,triggers:this.props.triggers,optionsBuilder:this.props.optionsBuilder,onSelected:this.props.onSelected}),this.stateListener=Nq6(this.controller.state,()=>{this.updateOverlay(),this.setState(()=>{})}),this.props.canStealFocus)c9.instance.addPostFrameCallback(()=>{this._effectiveFocusNode.requestFocus()})}didUpdateWidget(J){super.didUpdateWidget(J);let Q=J.props,Z=this.widget.props;if(this.props=Z,Q.controller!==Z.controller||Q.triggers!==Z.triggers||Q.optionsBuilder!==Z.optionsBuilder||Q.textFieldProps!==Z.textFieldProps||Q.onSelected!==Z.onSelected)this.controller.initialize({textController:Z.controller,triggers:Z.triggers,optionsBuilder:Z.optionsBuilder,onSelected:Z.onSelected});this.setState(()=>{})}dispose(){this.removeOverlay(),this.stateListener?.dispose(),this.controller.dispose(),this._effectiveFocusNode.dispose(),super.dispose()}invoke=(J)=>{if(!this.controller.currentState.isActive)return"ignored";if(J instanceof mp)return this.controller.selectNext(),this.updateScrollPosition(),"handled";if(J instanceof up)return this.controller.selectPrevious(),this.updateScrollPosition(),"handled";if(J instanceof pp)return this.controller.acceptSelected(),"handled";if(J instanceof jJ1)return this.controller.dismiss(),"handled";return"ignored"};updateScrollPosition(){let J=this.controller.currentState;if(!J.isActive||J.selectedIndex<0)return;let Q=J.selectedIndex,Z=J.options.length,X=Z;try{let z=this.layerLink.getTargetTransform();if(z){let U=z.position.y,W=2,F=U-2;X=Math.min(Z,Math.max(1,F))}}catch{}if(X>=Z){this.scrollOffset=0;return}let Y=Q-this.scrollOffset,K=1,G=this.scrollOffset;if(Y>=X-K)G=Math.max(0,Q-(X-K-1));if(Y<K)G=Math.max(0,Q-K);let q=Math.max(0,Z-X);G=Math.min(G,q),this.scrollOffset=G}build(J){let Q=new cq({...this.props.textFieldProps,controller:this.props.controller,focusNode:this._effectiveFocusNode,autofocus:!1}),Z=new dq({shortcuts:new Map([[new b6("ArrowDown"),new mp],[new b6("ArrowUp"),new up],[new b6("n",{ctrl:!0}),new mp],[new b6("p",{ctrl:!0}),new up],[new b6("Enter"),new pp],[new b6("Escape"),new jJ1],[new b6("Tab"),new pp]]),focusNode:this._effectiveFocusNode,child:Q}),X=new HZ({actions:new Map([[mp,new S9(this.invoke)],[up,new S9(this.invoke)],[pp,new S9(this.invoke)],[jJ1,new S9(this.invoke)]]),child:Z});return new Xg1({link:this.layerLink,child:X})}updateOverlay(){let J=this.controller.currentState;if(J.isActive&&J.options.length>0)if(!this.overlayEntry)this.createOverlay();else this.overlayEntry.markNeedsBuild();else this.removeOverlay()}createOverlay(){if(this.overlayEntry)return;this.overlayEntry=new Qg1((J)=>{let Q=this.controller.currentState;return this.buildOverlayContent(J,Q)});try{DN.of(this.context).insert(this.overlayEntry)}catch(J){u.error("Failed to insert autocomplete overlay:",J),this.overlayEntry=null}}removeOverlay(){if(this.overlayEntry)this.overlayEntry.remove(),this.overlayEntry=null}buildOverlayContent(J,Q){let Z=e6.maybeOf(J),X=Z?.colorScheme.background??E1.black,Y=this.props.overlayBorderColor??Z?.colorScheme.border??E1.white,K=Q.options.length;try{let w=this.layerLink.getTargetTransform();if(w){let R=w.position.y,O=2,j=R-2;K=Math.min(K,Math.max(1,j))}}catch{}this.updateScrollPosition();let G=this.scrollOffset,q=Math.min(Q.options.length,G+K),z=[],U=0;for(let w=G;w<q;w++){let R=Q.options[w];if(!R)continue;let O=w===Q.selectedIndex,j,$;if(this.props.optionViewBuilder){j=this.props.optionViewBuilder(J,R,O);let T=this.props.displayStringForOption?.(R)??String(R),S="",x=T,h="",v=R;if(v&&typeof v==="object"&&"type"in v)switch(v.type){case"command":S="/",x=v.name||T,h=v.description||"";break;case"file":S="@",x=v.path||T;break;case"thread":x=v.title||T,h=v.description||"";break;case"argument":x=v.value||T,h=v.description||"";break}$=S+x+(h?" - "+h:"")}else{let T=this.props.displayStringForOption?.(R)??String(R),S=Z?.colorScheme.selection??E1.index(8),x=Z?.colorScheme.foreground??E1.white;j=new n1({text:new N1(T,new j1({color:x,backgroundColor:O?S:void 0}))}),$=T}let E=_8.of(J),I=RY($,E.supportsEmojiWidth);U=Math.max(U,I),z.push(j)}let W=_8.sizeOf(J).width,F=U+4,H=Math.floor(W*0.9),B=Math.max(Math.min(F,H),Math.min(30,H)),N=z.length+2,L=-N,A=new U0({width:B,child:new y0({height:N,padding:V0.symmetric(1,0),decoration:new i8(X,x8.all(new w8(Y,1,"rounded"))),child:new i0({crossAxisAlignment:"start",children:z})})});return new Zg1({link:this.layerLink,showWhenUnlinked:!1,offset:{x:0,y:L},child:A})}}G9();var Bg1=S6(yq6(),1);l8();b2();var fq6=20,hq6=" .:-=+*#%@",Vq9=" ",Nq9=[0,55,0],Lq9=[0,255,136],Aq9=[128,51,0],wq9=[255,215,0],Rq9=[0,26,51],Oq9=[0,184,255],gq6=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],kJ1=0.5,Hg1=(J,Q,Z)=>J+(Q-J)*Z;function jq9(J,Q){let Z=Math.max(0,Math.min(1,J));if(Q==="low"){let Y=Math.floor(Z*(gq6.length-1));return E1.index(gq6[Y])}if(Q==="fast"){let Y=Aq9.map((K,G)=>Math.round(Hg1(K,wq9[G],Z)));return E1.rgb(Y[0],Y[1],Y[2])}if(Q==="free"){let Y=Rq9.map((K,G)=>Math.round(Hg1(K,Oq9[G],Z)));return E1.rgb(Y[0],Y[1],Y[2])}let X=Nq9.map((Y,K)=>Math.round(Hg1(Y,Lq9[K],Z)));return E1.rgb(X[0],X[1],X[2])}var Dg1=1,$q9=30,mq6=3;class Mg1 extends c0{width;height;minWidth;minHeight;maxWidth;maxHeight;colorMode;t;onFrame;fps;seed;constructor({key:J,width:Q=40,height:Z=40,minWidth:X,minHeight:Y,maxWidth:K,maxHeight:G,colorMode:q="high",t:z,onFrame:U,fps:W=60,seed:F}){super(J?{key:J}:{});this.width=Q,this.height=Z,this.minWidth=X??8,this.minHeight=Y??8,this.maxWidth=K??40,this.maxHeight=G??40,this.colorMode=q,this.t=z,this.onFrame=U,this.fps=W,this.seed=F}createState(){return new uq6}}class uq6 extends d0{_t=0;_timer=null;_shockwaves=[];initState(){if(super.initState(),this.widget.t!==void 0||this.widget.fps===0){this._t=this.widget.t??0;return}if(this.widget.fps==0)return;this._timer=setInterval(()=>{if(this._t+=1/this.widget.fps,this.widget.onFrame){let J=this._t;setImmediate(()=>this.widget.onFrame?.(J))}this._shockwaves=this._shockwaves.filter((J)=>this._t-J.startTime<Dg1),this.setState(()=>{})},1000/this.widget.fps)}didUpdateWidget(J){if(super.didUpdateWidget(J),this.widget.t!==void 0&&this.widget.t!==J.t)this._t=this.widget.t,this.setState(()=>{})}dispose(){if(this._timer)clearInterval(this._timer),this._timer=null;super.dispose()}handleClick=(J)=>{this._shockwaves.push({x:J.localPosition.x,y:J.localPosition.y,startTime:this._t}),this.setState(()=>{})};build(J){let Q=new pq6({width:this.widget.width,height:this.widget.height,minWidth:this.widget.minWidth,minHeight:this.widget.minHeight,maxWidth:this.widget.maxWidth,maxHeight:this.widget.maxHeight,time:this._t,colorMode:this.widget.colorMode,seed:this.widget.seed,shockwaves:this._shockwaves});return new x9({onClick:this.handleClick,child:Q})}}class pq6 extends QB{props;constructor(J,Q){super(Q?{key:Q}:{});this.props=J}createElement(){return new HN(this)}createRenderObject(){return new dq6(this.props.width,this.props.height,this.props.minWidth,this.props.minHeight,this.props.maxWidth,this.props.maxHeight,this.props.time,this.props.colorMode,this.props.seed,this.props.shockwaves)}updateRenderObject(J){J.update(this.props.width,this.props.height,this.props.minWidth,this.props.minHeight,this.props.maxWidth,this.props.maxHeight,this.props.time,this.props.colorMode,this.props.seed,this.props.shockwaves)}}class dq6 extends Z8{_width;_height;_minWidth;_minHeight;_maxWidth;_maxHeight;_time;_colorMode;_seed;_shockwaves;_noise2D;constructor(J,Q,Z,X,Y,K,G,q,z,U=[]){super();this._width=J;this._height=Q;this._minWidth=Z;this._minHeight=X;this._maxWidth=Y;this._maxHeight=K;this._time=G;this._colorMode=q;this._seed=z;this._shockwaves=U;this._noise2D=Bg1.makeNoise2D(this._seed??Date.now())}getMinIntrinsicWidth(J){return this._minWidth}getMaxIntrinsicWidth(J){return this._maxWidth}getMinIntrinsicHeight(J){return this._minHeight}getMaxIntrinsicHeight(J){return this._maxHeight}update(J,Q,Z,X,Y,K,G,q,z,U=[]){let W=!1;if(J!==this._width||Q!==this._height||Z!==this._minWidth||X!==this._minHeight||Y!==this._maxWidth||K!==this._maxHeight)this._width=J,this._height=Q,this._minWidth=Z,this._minHeight=X,this._maxWidth=Y,this._maxHeight=K,W=!0;if(z!==this._seed)this._seed=z,this._noise2D=Bg1.makeNoise2D(this._seed??Date.now());if(this._time=G,this._colorMode=q,this._shockwaves=U,W)this.markNeedsLayout();this.markNeedsPaint()}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=J.constrain(this._width,this._height);this.setSize(Q.width,Q.height),super.performLayout()}paint(J,Q=0,Z=0){let X=Q+this.offset.x,Y=Z+this.offset.y,K=Math.floor(this.size.width),G=Math.floor(this.size.height),q=K/2,z=G/2,U=Math.max(1,K/2-1),W=Math.max(1,G/(2*kJ1)-1),F=Math.min(U,W);for(let H=0;H<G;H++){let B=Y+H,M=!0;if(H>0){M=!0;for(let N=0;N<K;N++){let L=N-q,A=(H-1-z)/kJ1;if(Math.sqrt(L*L+A*A)/F<1){M=!1;break}}}let V=!0;for(let N=0;N<K;N++){let L=N-q,A=(H-z)/kJ1,w=Math.sqrt(L*L+A*A),R=w/F;if(R>=1)continue;let O=1-R*R,j=this._colorMode==="fast"?2.5:1,E=(this._noise2D(N/fq6,H/fq6+this._time*j)+1)*0.5*O;for(let x of this._shockwaves){let h=this._time-x.startTime;if(h<0||h>Dg1)continue;let v=N-x.x,_=(H-x.y)/kJ1,b=Math.sqrt(v*v+_*_),g=h*$q9,k=Math.abs(b-g);if(k<mq6){let y=w/F;if(y<0.95){let f=1-h/Dg1,m=(1-k/mq6)*f,n=1-Math.pow(y,3);E=Math.min(1,E+m*0.8*n)}}}let I=hq6[Math.floor(E*hq6.length)]||Vq9,T=jq9(E,this._colorMode),S=X+N;if(S<0||S>=J.getSize().width)continue;J.setCell(S,B,{char:I,width:1,style:{fg:T}}),V=!1}if(V&&M)continue}}}class _J1{toolRunning;toolSuccess;toolError;toolCancelled;toolName;userMessage;assistantMessage;systemMessage;codeBlock;inlineCode;syntaxHighlight;fileReference;processing;waiting;completed;cancelled;recommendation;suggestion;command;filename;keybind;button;shellMode;shellModeHidden;diffAdded;diffRemoved;diffChanged;diffContext;ideConnected;ideDisconnected;ideWarning;scrollbarThumb;scrollbarTrack;tableBorder;constructor({toolRunning:J,toolSuccess:Q,toolError:Z,toolCancelled:X,toolName:Y,userMessage:K,assistantMessage:G,systemMessage:q,codeBlock:z,inlineCode:U,syntaxHighlight:W,fileReference:F,processing:H,waiting:B,completed:M,cancelled:V,suggestion:N,command:L,filename:A,keybind:w,button:R,shellMode:O,shellModeHidden:j,diffAdded:$,diffRemoved:E,diffChanged:I,diffContext:T,ideConnected:S,ideDisconnected:x,ideWarning:h,scrollbarThumb:v,scrollbarTrack:_,tableBorder:b,recommendation:g}){this.toolRunning=J,this.toolSuccess=Q,this.toolError=Z,this.toolCancelled=X,this.toolName=Y,this.userMessage=K,this.assistantMessage=G,this.systemMessage=q,this.codeBlock=z,this.inlineCode=U,this.syntaxHighlight=W,this.fileReference=F,this.processing=H,this.waiting=B,this.completed=M,this.cancelled=V,this.suggestion=N,this.command=L,this.filename=A,this.keybind=w,this.button=R,this.shellMode=O,this.shellModeHidden=j,this.diffAdded=$,this.diffRemoved=E,this.diffChanged=I,this.diffContext=T,this.ideConnected=S,this.ideDisconnected=x,this.ideWarning=h,this.scrollbarThumb=v,this.scrollbarTrack=_,this.tableBorder=b,this.recommendation=g}static default(){return new _J1({toolRunning:E1.blue,toolSuccess:E1.green,toolError:E1.red,toolCancelled:E1.yellow,toolName:E1.default(),userMessage:E1.cyan,assistantMessage:E1.white,systemMessage:E1.index(8),codeBlock:E1.default(),inlineCode:E1.yellow,syntaxHighlight:{keyword:E1.blue,string:E1.green,number:E1.yellow,comment:E1.index(8),function:E1.cyan,variable:E1.default(),type:E1.magenta,operator:E1.white},fileReference:E1.cyan,processing:E1.blue,waiting:E1.yellow,completed:E1.green,cancelled:E1.index(8),recommendation:E1.blue,suggestion:E1.magenta,command:E1.yellow,filename:E1.cyan,keybind:E1.blue,button:E1.cyan,shellMode:E1.blue,shellModeHidden:E1.index(8),diffAdded:E1.green,diffRemoved:E1.red,diffChanged:E1.yellow,diffContext:E1.index(8),ideConnected:E1.green,ideDisconnected:E1.red,ideWarning:E1.yellow,scrollbarThumb:E1.index(7),scrollbarTrack:E1.index(8),tableBorder:E1.index(8)})}}class pC{base;app;constructor({base:J,app:Q}){this.base=J,this.app=Q}get colors(){return this.base.colorScheme}static default(){return new pC({base:tK.default(),app:_J1.default()})}static fromBaseTheme(J){return new pC({base:J,app:_J1.default()})}}class i6 extends FZ{data;constructor({key:J,data:Q,child:Z}){super({key:J,child:Z});this.data=Q}static of(J){let Q=J.dependOnInheritedWidgetOfExactType(i6);if(Q)return Q.widget.data;return pC.default()}static maybeOf(J){let Q=J.dependOnInheritedWidgetOfExactType(i6);if(Q)return Q.widget.data;return null}updateShouldNotify(J){return this.data!==J.data}}G9();class cq6{vertical="│";tee="├";elbow="╰";horizontal="─";indent=4;connectorColor=E1.white;connectorDim=!0}class ip extends OY{style;showTreeCharacters;constructor({key:J,children:Q,style:Z,showTreeCharacters:X=!0}){super({key:J,children:Q});this.style=Z??new cq6,this.showTreeCharacters=X}createRenderObject(){return new lq6({style:this.style,showTreeCharacters:this.showTreeCharacters})}updateRenderObject(J){J.updateTreeView({style:this.style,showTreeCharacters:this.showTreeCharacters})}}class lq6 extends Z8{style;showTreeCharacters;constructor({style:J,showTreeCharacters:Q}){super();this.style=J,this.showTreeCharacters=Q}updateTreeView({style:J,showTreeCharacters:Q}){this.style=J,this.showTreeCharacters=Q,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;if(!J)return;let Z=(this.style.tee+this.style.horizontal+" ").length,X=Math.max(0,J.maxWidth-Z),Y=0;for(let G of this.children){let q=G,z=new w6(X,X,0,1/0);q.layout(z),q.setOffset(Z,Y),Y+=q.size.height}let K=J.constrain(J.maxWidth,Y);this.setSize(K.width,K.height)}paint(J,Q,Z){if(this.showTreeCharacters){let X=Z+this.offset.y;for(let Y=0;Y<this.children.length;Y++){let G=this.children[Y],q=Y===this.children.length-1,z=G.size.height,W=(q?this.style.elbow:this.style.tee)+this.style.horizontal+" ",F=Q+this.offset.x;for(let H of W){let B=D9(H,{fg:this.style.connectorColor,dim:this.style.connectorDim});J.setCell(F,X,B),F++}if(F=Q+this.offset.x,!q){let H=D9(this.style.vertical,{fg:this.style.connectorColor,dim:this.style.connectorDim});for(let B=1;B<z;B++)J.setCell(F,X+B,H)}X+=G.size.height}}super.paint(J,Q,Z)}}class xJ1 extends I6{bashInvocations;constructor({bashInvocations:J,key:Q}){super(Q?{key:Q}:{});this.bashInvocations=J}build(J){if(this.bashInvocations.length===0)return new i0({children:[]});let Q=i6.of(J),Z=Q.colors,X=this.bashInvocations.map((K)=>{let G=K.hidden,q=G?Q.app.shellModeHidden:Q.app.shellMode,U=[new n1({text:new N1("",void 0,[new N1(`${G?"$$":"$"} `,new j1({color:q,bold:!0})),new N1(K.args.cmd,new j1({color:E1.green}))]),selectable:!0})];if(K.toolRun.status==="in-progress"||K.toolRun.status==="done"){let W=K.toolRun.progress;if(W?.output){let F=this.getLastOutputLines(W.output);U.push(...F.map((H)=>new n1({text:new N1(H,new j1({color:E1.white,dim:!0})),selectable:!0})))}}if(K.toolRun.status==="blocked-on-user"){let W=K.toolRun.reason?` (${K.toolRun.reason})`:"";U.push(new n1({text:new N1(`Waiting for confirmation${W}`,new j1({color:E1.white,italic:!0})),selectable:!0}))}return new i0({crossAxisAlignment:"start",children:U})}),Y=[new U0({height:1}),new n1({text:new N1("Shell Mode:",new j1({color:E1.blue,bold:!0})),selectable:!0}),new ip({children:X})];return new i0({crossAxisAlignment:"start",children:Y})}getLastOutputLines(J){if(!J)return[];return J.split(`
|
|
6457
|
+
`).filter((Z)=>Z.trim()!=="").slice(-3)}}G9();b2();class Vg1 extends I6{leftChild;rightChild1;rightChild2;maxHeight;borderColor;borderStyle;overlayTexts;hasBanner;constructor({key:J,leftChild:Q,rightChild1:Z,rightChild2:X,maxHeight:Y,borderColor:K=E1.index(7),borderStyle:G="rounded",overlayTexts:q=[],hasBanner:z=!1}){super({key:J});this.leftChild=Q,this.rightChild1=Z,this.rightChild2=X,this.maxHeight=Y,this.borderColor=K,this.borderStyle=G,this.overlayTexts=q,this.hasBanner=z}build(J){let Q=[];for(let Z of this.overlayTexts){let X=0,Y,K=0,G;switch(Z.position){case"top-left":X=2+(Z.offsetX??0),K=0+(Z.offsetY??0);break;case"top-right":Y=2+(Z.offsetX??0),K=0+(Z.offsetY??0);break;case"bottom-left":X=2+(Z.offsetX??0),G=0+(Z.offsetY??0);break;case"bottom-right":Y=2+(Z.offsetX??0),G=0+(Z.offsetY??0);break}let q=new n1({text:Z.text}),z=Z.onClick?new x9({child:q,onClick:Z.onClick,cursor:"pointer"}):q;Q.push(new wX({left:X!==0?X:void 0,right:Y!==void 0?Y:void 0,top:K!==0?K:void 0,bottom:G!==void 0?G:void 0,child:z}))}return new fC({child:new TJ({children:[new iq6({children:[this.leftChild,...this.rightChild1?[this.rightChild1]:[],...this.rightChild2?[this.rightChild2]:[]],maxHeight:this.maxHeight,borderColor:this.borderColor,borderStyle:this.borderStyle,hasBanner:this.hasBanner}),...Q]})})}}class iq6 extends OY{maxHeight;borderColor;borderStyle;hasBanner;constructor({children:J,maxHeight:Q,borderColor:Z,borderStyle:X,hasBanner:Y}){super({children:J});this.maxHeight=Q,this.borderColor=Z,this.borderStyle=X,this.hasBanner=Y}createRenderObject(){return new nq6(this.maxHeight,this.borderColor,this.borderStyle,this.hasBanner)}updateRenderObject(J){J.maxHeight=this.maxHeight,J.borderColor=this.borderColor,J.borderStyle=this.borderStyle,J.hasBanner=this.hasBanner}}class nq6 extends Z8{maxHeight;borderColor;borderStyle;hasBanner;constructor(J,Q=E1.index(7),Z="rounded",X=!1){super();this.maxHeight=J,this.borderColor=Q,this.borderStyle=Z,this.hasBanner=X}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=this.children;if(Q.length===0){this.setSize(J.minWidth,2),super.performLayout();return}let Z=Q[0];if(!Z){this.setSize(J.minWidth,2),super.performLayout();return}let X=Q.length>1?Q[1]:void 0,Y=Q.length>2?Q[2]:void 0,K=J.maxWidth,G=Math.floor(K/2),q=this.getMinIntrinsicHeight(K),z=Math.min(q,J.maxHeight);if(this.maxHeight)z=Math.min(z,this.maxHeight);this.setSize(K,z);let U=z-2,F=X||Y?G-2:K-2,H=new w6(0,F,0,Math.max(0,U));if(Z.layout(H),Z.setOffset(1,1),X||Y){let B=K-G-2,M=Math.max(0,Math.floor(U)),V=(w)=>new w6(0,B,0,Math.max(0,Math.floor(w))),N=M,L=0;if(X){let w=X.getMinIntrinsicHeight(B),R=Math.min(w,N);X.layout(V(R)),L=X.size.height,X.setOffset(G+1,1),N=Math.max(0,N-L)}if(!!(X&&Y&&L>0))N=Math.max(0,N-1);if(Y){let w=Y.getMinIntrinsicHeight(B),R=Math.min(w,N);Y.layout(V(R));let O=L>0?L+2:1;Y.setOffset(G+1,O)}}super.performLayout()}getMinIntrinsicHeight(J){let Q=this.children;if(Q.length===0)return 2;let Z=Q[0];if(!Z)return 2;let X=Q.length>1?Q[1]:void 0,Y=Q.length>2?Q[2]:void 0,K=Math.floor(J/2),q=X||Y?K:J,z=Z.getMinIntrinsicHeight(q-2),U=Math.min(z,50),W=0;if(X||Y){let B=J-K-2,M=X?X.getMinIntrinsicHeight(B):0,V=Y?Y.getMinIntrinsicHeight(B):0;W=M+V+(M>0&&V>0?1:0)}return Math.max(U,W)+2}getMaxIntrinsicHeight(J){return this.getMinIntrinsicHeight(J)}paint(J,Q=0,Z=0){let X=Math.floor(Q+this.offset.x),Y=Math.floor(Z+this.offset.y);super.paint(J,Q,Z),this._paintGridBorders(J,X,Y)}_paintGridBorders(J,Q,Z){let X=this.size.width,Y=this.size.height,K=this.children,G=K.length>1,q=K.length>1?K[1]:void 0,z=K.length>2?K[2]:void 0,U={fg:this.borderColor},W=Math.floor(X/2),H=(()=>{return this.borderStyle==="rounded"?{tl:"╭",tr:"╮",bl:"╰",br:"╯"}:{tl:"┌",tr:"┐",bl:"└",br:"┘"}})();for(let B=0;B<X;B++)J.setChar(Q+B,Z,"─",U,1);for(let B=0;B<X;B++)J.setChar(Q+B,Z+Y-1,"─",U,1);for(let B=0;B<Y;B++)J.setChar(Q,Z+B,"│",U,1);for(let B=0;B<Y;B++)J.setChar(Q+X-1,Z+B,"│",U,1);if(this.hasBanner)J.setChar(Q,Z,"├",U,1),J.setChar(Q+X-1,Z,"┤",U,1);else J.setChar(Q,Z,H.tl,U,1),J.setChar(Q+X-1,Z,H.tr,U,1);if(J.setChar(Q,Z+Y-1,H.bl,U,1),J.setChar(Q+X-1,Z+Y-1,H.br,U,1),G){for(let B=1;B<Y-1;B++)J.setChar(Q+W,Z+B,"│",U,1);J.setChar(Q+W,Z,"┬",U,1),J.setChar(Q+W,Z+Y-1,"┴",U,1)}if(q&&z&&q.size.height>0){let B=q.offset.y+q.size.height;for(let M=W+1;M<X-1;M++)J.setChar(Q+M,Z+B,"─",U,1);J.setChar(Q+W,Z+B,"├",U,1),J.setChar(Q+X-1,Z+B,"┤",U,1)}}}t9();vy();class Ng1 extends I6{status;constructor({status:J,key:Q}){super(Q?{key:Q}:{});this.status=J}build(J){if(this.status===null||!this.status.enabled)return new U0({width:0,height:0});let Q=this.status,Z=Q.connected===!0,X=!!Q.errorMessage,Y=Q.clientID||"unknown",K,G;if(X)K="×",G=E1.red;else if(Z)K="✓",G=E1.green;else K="○",G=E1.yellow;let q=`${K} Client: ${Y}`;return new X8({mainAxisSize:"min",children:[new n1({text:new N1(q,new j1({color:G}))})]})}}G0();C0();function np(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Z=Array.isArray(J),X=Array.isArray(Q);if(Z!==X)return!1;if(Z&&X)return J.length===Q.length&&J.every((K,G)=>np(K,Q[G]));let Y=new Set([...Object.keys(J),...Object.keys(Q)]);for(let K of Y)if(!np(J[K],Q[K]))return!1;return!0}G0();AD();function aq6(J){return xd(600000).pipe(p2(void 0),q8(()=>J.config.pipe(x0(({settings:Q,secrets:Z})=>({settings:{url:Q.url,proxy:Q.proxy},secrets:Z})),J8((Q,Z)=>np(Q.settings,Z.settings)&&Q.secrets===Z.secrets),yN(()=>d6(async(Q)=>{let Z=await GJ.getUserInfo({},{signal:Q,config:J});if(Z.ok)return Z.result;if(Z.error&&Z.error.code==="auth-required")return null;throw u.error("getUserInfo failed",{error:Z.error}),Error(`getUserInfo error: ${Z.error.code}`)})))),x0((Q)=>{return Q instanceof Error?{error:{message:String(Q)}}:Q===kJ?"pending":Q?{user:Q,workspace:Q?.team}:{error:{message:"User not found"}}}),J8((Q,Z)=>np(Q,Z)),M9({shouldCountRefs:!0}))}function rq6(J){return Boolean(typeof J==="object"&&"user"in J&&J.user)}C0();l8();var Lg1=!1;class Ag1 extends c0{props;constructor(J){super();this.props=J}createState(){return new sq6}}class sq6 extends d0{showCost=Lg1;subscription=null;initState(){super.initState(),this.subscription=b9(aq6(this.widget.props.configService).pipe(P7((J)=>J!=="pending")),this.widget.props.configService.config).pipe(x0(([J,Q])=>{let Z=rq6(J)?J.user.email:"",X=Z.toLowerCase().endsWith("@sourcegraph.com"),Y=Lg1||X,K=Q.settings["internal.showCost"]??!0,G=Y&&K;return u.debug("CostDisplayProvider computed showCost",{email:Z,isTeammate:X,isEligible:Y,setting:K,computedShowCost:G,currentShowCost:this.showCost}),G}),J8()).subscribe((J)=>{u.debug("CostDisplayProvider setState called",{previousShowCost:this.showCost,newShowCost:J}),this.setState(()=>{this.showCost=J})})}dispose(){this.subscription?.unsubscribe(),this.subscription=null,super.dispose()}build(J){return new wg1({showCost:this.showCost,child:this.widget.props.child})}}class wg1 extends FZ{showCost;constructor({showCost:J,child:Q}){super({child:Q});this.showCost=J}updateShouldNotify(J){return this.showCost!==J.showCost}}function XB(J){let Q=J.dependOnInheritedWidgetOfExactType(wg1);if(Q)return Q.widget.showCost;return Lg1}class Rg1 extends I6{totalCredits;onClick;constructor({totalCredits:J,onClick:Q,key:Z}){super(Z?{key:Z}:{});this.totalCredits=J,this.onClick=Q}build(J){if(!XB(J))return new U0({width:0,height:0});if(!this.totalCredits)return new U0({width:0,height:0});let Z=e6.of(J).colorScheme,X=ZB(this.totalCredits),Y=new n1({text:new N1(X,new j1({color:Z.foreground,dim:!0}))});if(this.onClick)return new x9({onClick:this.onClick,child:Y});return Y}}G0();AW();$L();Tc();v6();l8();G0();b2();class MN extends FZ{onError;constructor({onError:J,child:Q}){super({child:Q});this.onError=J}updateShouldNotify(J){return!1}static of(J){return J.dependOnInheritedWidgetOfExactType(MN)?.widget?.onError}}class NQ extends I6{uri;text;style;maxLines;overflow;onError;constructor({uri:J,text:Q,style:Z,maxLines:X,overflow:Y,onError:K,key:G}){super({key:G});this.uri=J,this.text=Q,this.style=Z,this.maxLines=X,this.overflow=Y,this.onError=K}build(J){let Q=MN.of(J),Z=this.onError??Q;return m6(Z!==void 0,"Link widget requires either onError prop or ErrorHandlerProvider in context"),NQ.createWidget(this.uri,this.text,Z,this.style,this.maxLines,this.overflow)}static createWidget(J,Q,Z,X,Y,K){let G=new n1({text:NQ.createSpan(J,Q,X),selectable:!0,maxLines:Y,overflow:K});return new x9({onClick:async()=>{try{await AY(J)}catch(q){u.error("[Link] Error opening link",{uri:J,error:q});let z=q instanceof Error?q:Error(String(q));z.uri=J,u.error("[Link] Calling error handler"),Z(z)}},cursor:"pointer",child:G})}static createSpan(J,Q,Z){let X=lK(),Y=X?J:Q,K=X?new j1({color:Z?.color,dim:!0}):Z||new j1({underline:!0}),G=X?void 0:NG6(J);return new N1(Y,K,void 0,G)}}AW();v6();l8();class Og1 extends c0{props;constructor(J){super();this.props=J}createState(){return new oq6}}class oq6 extends d0{displayPathEnvInfo=null;subscription=null;constructor(){super()}initState(){super.initState(),this.subscription=this.widget.props.configService.displayPathEnvInfo.subscribe((J)=>{Vc(J),this.setState(()=>{this.displayPathEnvInfo=J})})}dispose(){this.subscription?.unsubscribe(),super.dispose()}build(J){return new jg1({displayPathEnvInfo:this.displayPathEnvInfo,child:this.widget.props.child})}}class jg1 extends FZ{displayPathEnvInfo;constructor({displayPathEnvInfo:J,child:Q}){super({child:Q});this.displayPathEnvInfo=J}updateShouldNotify(J){return this.displayPathEnvInfo!==J.displayPathEnvInfo}}function PR(J){let Q=J.dependOnInheritedWidgetOfExactType(jg1);if(!Q)return null;return Q.widget.displayPathEnvInfo}function dC(J,Q){if(J.startsWith("/")||/^[A-Za-z]:[\\/]/.test(J)){let X=PR(Q),Y=O0.file(J);return XJ(Y,X??void 0)}return J}M51();function $g1(J,Q,Z){return new n1({text:new N1(`${J}${Q}`,new j1({color:Z})),maxLines:1})}function tq6(J,Q,Z,X){return[$g1("+",J,X.success),r7.horizontal(1),$g1("~",Q,X.warning),r7.horizontal(1),$g1("-",Z,X.destructive)]}class Eg1 extends c0{threadViewState;threadID;onFileChangesClick;constructor({threadViewState:J,threadID:Q,onFileChangesClick:Z,key:X}){super(X?{key:X}:{});this.threadViewState=J,this.threadID=Q,this.onFileChangesClick=Z}createState(){return new eq6}}class eq6 extends d0{build(J){let Z=i6.of(J).colors;if(this.widget.threadViewState.state!=="active")return new U0({width:0,height:0});let{fileChanges:X}=this.widget.threadViewState,Y=mX1(X);if(Y.totalFiles===0)return new U0({width:0,height:0});let K=Y.totalFiles-Y.revertedFiles,G=`${K} ${K===1?"file":"files"} changed`,q=new n1({text:new N1(G,new j1({color:Z.foreground,dim:!0})),maxLines:1}),z;if(Y.totalAdded>0||Y.totalModified>0||Y.totalRemoved>0){let U=tq6(Y.totalAdded,Y.totalModified,Y.totalRemoved,Z);z=new X8({children:[q,r7.horizontal(1),...U],mainAxisSize:"min"})}else z=q;return new x9({onClick:()=>{if(this.widget.onFileChangesClick)this.widget.onFileChangesClick()},cursor:"pointer",child:z})}}class Ig1 extends c0{createState(){return new Jz6}}class Jz6 extends d0{build(J){let Z=e6.of(J).colorScheme,Y=i6.of(J).app,K=_8.of(J),G=D51();if(!G)return new U0({width:0,height:0});let q=G.getThreadData(),z=q.viewState,U=q.mainThread?.id;if(z.state!=="active"||!U)return new U0({width:0,height:0});let{fileChanges:W}=z,F=mX1(W);if(F.totalFiles===0)return new U0({width:0,height:0});let H=F.totalFiles-F.revertedFiles,B=F.allReverted?`${F.revertedFiles} ${F.revertedFiles===1?"change":"changes"} reverted`:`${H} ${H===1?"file":"files"} changed`,M=new C9({child:new n1({text:new N1(B,new j1({color:Z.primary,bold:!0}))})}),V=PR(J),N=[];for(let v of W.files){let _=O0.parse(v.uri),b=XJ(_,V??void 0),g=v.reverted,k=[];if(k.push(new R8({child:new NQ({uri:v.uri,text:b,style:new j1({color:E1.cyan,dim:g,underline:!g}),maxLines:1,overflow:"ellipsis"})})),k.push(r7.horizontal(1)),g)k.push(new n1({text:new N1("Reverted",new j1({color:Z.foreground,dim:!0,italic:!0}))}));else{let f=tq6(v.diffStat.added,v.diffStat.modified,v.diffStat.removed,Z);k.push(...f),k.push(r7.horizontal(1)),k.push(new x9({onClick:async(m)=>{try{await HJ.revertFileChanges(U,v.uri),this.setState(()=>{})}catch(n){u.error(`Error reverting file ${v.uri} (thread id: ${U}):`,n)}},cursor:"pointer",child:new n1({text:new N1("↶",new j1({color:Y.button}))})}))}let y=new X8({mainAxisSize:"max",crossAxisAlignment:"center",children:k});N.push(new x6({padding:V0.only({left:2,right:2,top:0,bottom:0}),child:y}))}let L=[];L.push(M),L.push(new U0({height:1}));for(let v of N)L.push(v);if(!F.allReverted&&H>0){let v=new x6({padding:V0.only({top:1,left:2,right:2}),child:new X8({mainAxisSize:"max",crossAxisAlignment:"center",children:[new R8({child:new n1({text:new N1(`${H} ${H===1?"file":"files"} changed`,new j1({color:Z.foreground}))})}),r7.horizontal(1),new x9({onClick:async(_)=>{try{await HJ.revertFileChanges(U),this.setState(()=>{})}catch(b){u.error(`Error reverting all files (thread id: ${U}):`,b)}},cursor:"pointer",child:new n1({text:new N1("Revert All",new j1({color:Y.button}))})})]})});L.push(v)}let A=K.size.width,w=K.size.height,R=A-4,O=w-4,j=Math.min(60,R),$=new C9({child:new n1({text:new N1("",new j1({color:Z.foreground}),[new N1("Press ",new j1({color:Z.foreground})),new N1("Escape",new j1({color:Y.keybind})),new N1(" to close",new j1({color:Z.foreground}))])})}),E=[...L,new U0({height:1}),$],I=2+N.length+(H>0?2:0)+1+1+4+2,T=Math.min(I,O),S=new x6({padding:V0.all(1),child:new i0({crossAxisAlignment:"stretch",children:E})}),h=I>O?new $Y({autofocus:!0,child:S}):S;return new C9({child:new y0({constraints:new w6(j,j,T,T),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:h})})}}hv();import Qz6 from"node:path";l8();function Eq9(J,Q){try{return decodeURIComponent(J)}catch(Z){if(Q!==void 0)return Q;throw Z}}class Pg1 extends c0{ideStatus;onShowIdePicker;constructor({ideStatus:J,onShowIdePicker:Q,key:Z}){super(Z?{key:Z}:{});this.ideStatus=J,this.onShowIdePicker=Q}createState(){return new Zz6}}class Zz6 extends d0{ideCount=0;intervalId;initState(){this.loadConfigs(),this.intervalId=setInterval(()=>{this.loadConfigs()},5000)}dispose(){if(this.intervalId)clearInterval(this.intervalId)}loadConfigs(){this.ideCount=gB({includeAll:!0}).length,this.setState()}build(J){if(this.widget.ideStatus===null||!this.widget.ideStatus.enabled)return this.statusIdle();let Q=this.widget.ideStatus,Z=Q.connectionState;if(!Z||Z==="never-connected")return this.statusIdle();if(Z==="reconnecting")return this.statusReconnecting(Q);if(Z==="disconnected")return this.statusDisconnected(Q);let X=Q.authenticated,Y=Q.selections?.[0],K=!ge(Y)&&Y?Y.range.endLine-Y.range.startLine+1:0,G=[];if(!X)if(Q.errorMessage)G.push(Q.errorMessage);else if(Q.connected===!1)G.push("IDE Not Connected");else G.push("IDE Error");else if(!Q.openFile&&!Y)G.push(`${Q.ideName?Q.ideName:"Unknown IDE"}`);if(Q.openFile)G.push(Qz6.basename(Eq9(Q.openFile,Q.openFile)));if(Y&&K>0)G.push(`${K} selected ${_J(K,"line")}`);let q=G.join(" • "),z=X?"✓":"×",U=X?E1.index(10):E1.index(9),F=`${z} ${q}${!X?" • Use /ide to connect":""}`;return this.idePickerText(F,U)}statusIdle(){if(this.ideCount===0)return new U0({width:0,height:0});else{let J=`${this.ideCount} ${_J(this.ideCount,"IDE")} available`;return this.idePickerText(J)}}statusDisconnected(J){if((J.reconnectElapsedMs??0)>=60000)return this.statusIdle();let Z="IDE disconnected. Use /ide to connect";return this.idePickerText(Z)}statusReconnecting(J){let Q=J.ideName||"IDE",Z=J.workspace?` in ${Qz6.basename(J.workspace)}`:"",X=`Reconnecting to ${Q}${Z}...`,Y=J.reconnectElapsedMs??0;return this.idePickerText(X,Y<5000?E1.yellow:E1.index(8))}idePickerText(J,Q=E1.index(8)){let Z=new n1({text:new N1(J,new j1({color:Q})),maxLines:1}),X=this.widget.onShowIdePicker?new x9({onClick:this.widget.onShowIdePicker,cursor:"pointer",child:Z}):Z;return new X8({children:[X],mainAxisSize:"min"})}}l8();function Iq9(J){return J.toLowerCase().includes("sonnet")}function Pq9(J){return{recommendation:Iq9(J)?0.2:0.6,warning:0.8,danger:0.9}}function Tq9(J,Q){let Z=Pq9(Q);if(J>=Z.danger)return"danger";else if(J>=Z.warning)return"warning";else if(J>=Z.recommendation)return"recommendation";return!1}function Tg1(J){let Q=J.totalInputTokens/J.maxInputTokens;return Tq9(Q,J.model||"")}class Cg1 extends c0{threadViewState;tokenUsage;thread;waitingForConfirmation;showingEphemeralError;executingCommand;executingCommandMessage;runningBashInvocations;constructor({threadViewState:J,tokenUsage:Q,thread:Z,waitingForConfirmation:X=!1,showingEphemeralError:Y=!1,executingCommand:K=null,executingCommandMessage:G=null,runningBashInvocations:q=!1,key:z}={}){super(z?{key:z}:{});this.threadViewState=J,this.tokenUsage=Q,this.thread=Z,this.waitingForConfirmation=X,this.showingEphemeralError=Y,this.executingCommand=K,this.executingCommandMessage=G,this.runningBashInvocations=q}createState(){return new Xz6}}class Xz6 extends d0{animationFrame=0;animationTimer=null;animationFrames=["∿","∾","∽","≋","≈","∼"];initState(){this.startAnimationIfNeeded()}didUpdateWidget(J){this.startAnimationIfNeeded()}dispose(){this.stopAnimation()}startAnimationIfNeeded(){let J=this.shouldShowSpinner();if(J&&!this.animationTimer)this.startAnimation();else if(!J&&this.animationTimer)this.stopAnimation()}startAnimation(){if(this.animationTimer)return;this.animationTimer=setInterval(()=>{this.setState(()=>{this.animationFrame=(this.animationFrame+1)%this.animationFrames.length})},200)}stopAnimation(){if(this.animationTimer)clearInterval(this.animationTimer),this.animationTimer=null}shouldShowSpinner(){let{threadViewState:J,waitingForConfirmation:Q,runningBashInvocations:Z}=this.widget;return Boolean(Z||J&&J.state==="active"&&(J.inferenceState==="running"||J.interactionState==="tool-running")&&!this.isShowingTokenUsageNote()&&!Q)}isShowingTokenUsageNote(){let{tokenUsage:J,showingEphemeralError:Q}=this.widget;if(!J||Q)return!1;let Z=Tg1(J);return Z==="recommendation"||Z==="warning"||Z==="danger"}getSpinnerColor(){let{threadViewState:J}=this.widget;if(!J)return E1.index(8);if(J.state==="active"){if(J.inferenceState==="running")return E1.index(12)}return E1.index(8)}getStatusMessageColor(J,Q){let{threadViewState:Z,tokenUsage:X,showingEphemeralError:Y,executingCommand:K,runningBashInvocations:G}=this.widget;if(K)return Q.command;if(G)return J.foreground;if(X&&!Y){let q=Tg1(X);if(q==="recommendation")return Q.recommendation;if(q==="warning")return J.warning;if(q==="danger")return J.destructive}if(Z?.state==="active"&&Z.inferenceState==="cancelled")return E1.index(8);return J.foreground}build(J){let Q=i6.of(J),Z=Q.colors,X=Q.app,Y=Sg1(this.widget);if(!Y)return new U0({width:0,height:0});let K=[];if(this.shouldShowSpinner()){let q=this.animationFrames[this.animationFrame];K.push(new n1({text:new N1(q,new j1({color:this.getSpinnerColor()})),maxLines:1})),K.push(r7.horizontal(1))}return K.push(new n1({text:new N1(Y,new j1({color:this.getStatusMessageColor(Z,X),italic:this.widget.threadViewState?.state==="active"&&this.widget.threadViewState.inferenceState==="cancelled"})),textAlign:"left",maxLines:1,overflow:"clip"})),new X8({children:K,mainAxisSize:"min"})}}function Sg1(J){let{threadViewState:Q,tokenUsage:Z,showingEphemeralError:X,executingCommand:Y,executingCommandMessage:K,runningBashInvocations:G}=J;if(Y)return K??`Executing /${Y}...`;if(G)return"Running shell command...";if(!Q||Q.state!=="active")return null;if(Q.interactionState==="tool-running"){let q=Q.toolState.running;if(q>1)return`Running ${q} tools...`;return"Running tools..."}if(Q.inferenceState==="running"){let q=J.thread?.messages.at(-1);if(!(q?.role==="assistant"&&q.state.type==="streaming"))return"Waiting for response...";if(J.runningBashInvocations)return"Running tools...";return"Streaming response..."}if(Z&&!X&&J.thread?.agentMode!=="free"){let q=Tg1(Z);if(q==="recommendation")return"Optimize context: /handoff to focus on specific tasks or /new for a fresh start";if(q==="warning")return"High context usage. Use /handoff to focus on specific tasks or /new to restart";if(q==="danger")return"Context window is close to full. Use /handoff to focus on specific tasks or /new to restart"}return null}function Cq9(J){if(J>=900000)return{recommendation:0.2,warning:0.8,danger:0.9};else if(J>=400000)return{recommendation:0.7,warning:0.8,danger:0.9};else return{recommendation:0.8,warning:0.9,danger:0.95}}function Sq9(J){if(J>=1e6)return`${Math.round(J/1e6)}M`;else if(J>=1000)return`${Math.round(J/1000)}k`;return J.toString()}function vq9(J,Q){let Z=Cq9(Q);if(J>=Z.danger)return"danger";else if(J>=Z.warning)return"warning";else if(J>=Z.recommendation)return"recommendation";return!1}class vg1 extends I6{tokenUsage;isNarrow;constructor({tokenUsage:J,isNarrow:Q=!1,key:Z}){super(Z?{key:Z}:{});this.tokenUsage=J,this.isNarrow=Q}build(J){let Z=i6.of(J).colors,X=this.tokenUsage.totalInputTokens/this.tokenUsage.maxInputTokens,Y=Math.round(X*100),K=Math.max(0,Math.min(Y,100)),G=this.isNarrow?`${K}%`:`${K}% of ${Sq9(this.tokenUsage.maxInputTokens)}`,q=new j1({color:Z.foreground,dim:!0}),z=vq9(X,this.tokenUsage.maxInputTokens);if(z==="danger")q=new j1({color:Z.destructive});else if(z==="warning")q=new j1({color:Z.warning});else if(z==="recommendation")q=new j1({color:Z.info});return new n1({text:new N1(G,q),textAlign:"left",maxLines:1,overflow:"clip"})}}class kg1 extends I6{hint;constructor({hint:J,key:Q}={}){super(Q?{key:Q}:{});this.hint=J}build(J){if(!this.hint)return new U0({width:0,height:0});return new n1({text:this.hint,textAlign:"left",maxLines:1,overflow:"clip"})}}class bJ1 extends I6{statusText;isAnimated;statusType;threadViewState;threadTokenUsage;threadID;thread;onFileChangesClick;onCostBreakdownClick;onShowIdePicker;ideStatus;connectedClientsStatus;isNarrow;uiHint;waitingForConfirmation;showingEphemeralError;executingCommand;executingCommandMessage;runningBashInvocations;constructor({statusText:J,isAnimated:Q=!1,statusType:Z="idle",threadViewState:X,threadTokenUsage:Y,threadID:K,thread:G,onFileChangesClick:q,onCostBreakdownClick:z,onShowIdePicker:U,ideStatus:W=null,connectedClientsStatus:F=null,isNarrow:H=!1,uiHint:B,waitingForConfirmation:M=!1,showingEphemeralError:V=!1,executingCommand:N=null,executingCommandMessage:L=null,runningBashInvocations:A=!1,key:w}={}){super(w?{key:w}:{});this.statusText=J,this.isAnimated=Q,this.statusType=Z,this.threadViewState=X,this.threadTokenUsage=Y,this.threadID=K,this.thread=G,this.onFileChangesClick=q,this.onCostBreakdownClick=z,this.onShowIdePicker=U,this.ideStatus=W,this.connectedClientsStatus=F,this.isNarrow=H,this.uiHint=B,this.waitingForConfirmation=M,this.showingEphemeralError=V,this.executingCommand=N,this.executingCommandMessage=L,this.runningBashInvocations=A}build(J){let Q=[],Z=!1;if(this.threadViewState){let X=new Cg1({threadViewState:this.threadViewState,tokenUsage:this.threadTokenUsage,thread:this.thread,waitingForConfirmation:this.waitingForConfirmation,showingEphemeralError:this.showingEphemeralError,executingCommand:this.executingCommand,executingCommandMessage:this.executingCommandMessage,runningBashInvocations:this.runningBashInvocations});if(Sg1(X))Z=!0;Q.push(X)}if(this.uiHint){if(Z)Q.push(r7.horizontal(2));Q.push(new kg1({hint:this.uiHint}))}if(Q.push(r7.flexible()),this.ideStatus)Q.push(new Pg1({ideStatus:this.ideStatus,onShowIdePicker:this.onShowIdePicker})),Q.push(r7.horizontal(1));if(this.connectedClientsStatus)Q.push(new Ng1({status:this.connectedClientsStatus})),Q.push(r7.horizontal(1));if(this.threadViewState&&!this.isNarrow&&this.threadID&&HG(this.threadID))Q.push(new Eg1({threadViewState:this.threadViewState,threadID:this.threadID,onFileChangesClick:this.onFileChangesClick})),Q.push(r7.horizontal(1));if(this.threadTokenUsage){if(Q.push(new vg1({tokenUsage:this.threadTokenUsage,isNarrow:this.isNarrow})),this.thread&&XB(J)){let X=z30(this.thread);if(X>0)Q.push(r7.horizontal(2)),Q.push(new Rg1({totalCredits:X,onClick:this.onCostBreakdownClick}))}}return new X8({children:Q,mainAxisSize:"min",mainAxisAlignment:"start"})}}var kq9={};function TR(J,Q){let Z=Q||kq9,X=typeof Z.includeImageAlt==="boolean"?Z.includeImageAlt:!0,Y=typeof Z.includeHtml==="boolean"?Z.includeHtml:!0;return Kz6(J,X,Y)}function Kz6(J,Q,Z){if(_q9(J)){if("value"in J)return J.type==="html"&&!Z?"":J.value;if(Q&&"alt"in J&&J.alt)return J.alt;if("children"in J)return Yz6(J.children,Q,Z)}if(Array.isArray(J))return Yz6(J,Q,Z);return""}function Yz6(J,Q,Z){let X=[],Y=-1;while(++Y<J.length)X[Y]=Kz6(J[Y],Q,Z);return X.join("")}function _q9(J){return Boolean(J&&typeof J==="object")}var _g1={AElig:"Æ",AMP:"&",Aacute:"Á",Abreve:"Ă",Acirc:"Â",Acy:"А",Afr:"\uD835\uDD04",Agrave:"À",Alpha:"Α",Amacr:"Ā",And:"⩓",Aogon:"Ą",Aopf:"\uD835\uDD38",ApplyFunction:"",Aring:"Å",Ascr:"\uD835\uDC9C",Assign:"≔",Atilde:"Ã",Auml:"Ä",Backslash:"∖",Barv:"⫧",Barwed:"⌆",Bcy:"Б",Because:"∵",Bernoullis:"ℬ",Beta:"Β",Bfr:"\uD835\uDD05",Bopf:"\uD835\uDD39",Breve:"˘",Bscr:"ℬ",Bumpeq:"≎",CHcy:"Ч",COPY:"©",Cacute:"Ć",Cap:"⋒",CapitalDifferentialD:"ⅅ",Cayleys:"ℭ",Ccaron:"Č",Ccedil:"Ç",Ccirc:"Ĉ",Cconint:"∰",Cdot:"Ċ",Cedilla:"¸",CenterDot:"·",Cfr:"ℭ",Chi:"Χ",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",Colon:"∷",Colone:"⩴",Congruent:"≡",Conint:"∯",ContourIntegral:"∮",Copf:"ℂ",Coproduct:"∐",CounterClockwiseContourIntegral:"∳",Cross:"⨯",Cscr:"\uD835\uDC9E",Cup:"⋓",CupCap:"≍",DD:"ⅅ",DDotrahd:"⤑",DJcy:"Ђ",DScy:"Ѕ",DZcy:"Џ",Dagger:"‡",Darr:"↡",Dashv:"⫤",Dcaron:"Ď",Dcy:"Д",Del:"∇",Delta:"Δ",Dfr:"\uD835\uDD07",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",Diamond:"⋄",DifferentialD:"ⅆ",Dopf:"\uD835\uDD3B",Dot:"¨",DotDot:"⃜",DotEqual:"≐",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",Downarrow:"⇓",Dscr:"\uD835\uDC9F",Dstrok:"Đ",ENG:"Ŋ",ETH:"Ð",Eacute:"É",Ecaron:"Ě",Ecirc:"Ê",Ecy:"Э",Edot:"Ė",Efr:"\uD835\uDD08",Egrave:"È",Element:"∈",Emacr:"Ē",EmptySmallSquare:"◻",EmptyVerySmallSquare:"▫",Eogon:"Ę",Eopf:"\uD835\uDD3C",Epsilon:"Ε",Equal:"⩵",EqualTilde:"≂",Equilibrium:"⇌",Escr:"ℰ",Esim:"⩳",Eta:"Η",Euml:"Ë",Exists:"∃",ExponentialE:"ⅇ",Fcy:"Ф",Ffr:"\uD835\uDD09",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",Fopf:"\uD835\uDD3D",ForAll:"∀",Fouriertrf:"ℱ",Fscr:"ℱ",GJcy:"Ѓ",GT:">",Gamma:"Γ",Gammad:"Ϝ",Gbreve:"Ğ",Gcedil:"Ģ",Gcirc:"Ĝ",Gcy:"Г",Gdot:"Ġ",Gfr:"\uD835\uDD0A",Gg:"⋙",Gopf:"\uD835\uDD3E",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",Gt:"≫",HARDcy:"Ъ",Hacek:"ˇ",Hat:"^",Hcirc:"Ĥ",Hfr:"ℌ",HilbertSpace:"ℋ",Hopf:"ℍ",HorizontalLine:"─",Hscr:"ℋ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",IEcy:"Е",IJlig:"IJ",IOcy:"Ё",Iacute:"Í",Icirc:"Î",Icy:"И",Idot:"İ",Ifr:"ℑ",Igrave:"Ì",Im:"ℑ",Imacr:"Ī",ImaginaryI:"ⅈ",Implies:"⇒",Int:"∬",Integral:"∫",Intersection:"⋂",InvisibleComma:"",InvisibleTimes:"",Iogon:"Į",Iopf:"\uD835\uDD40",Iota:"Ι",Iscr:"ℐ",Itilde:"Ĩ",Iukcy:"І",Iuml:"Ï",Jcirc:"Ĵ",Jcy:"Й",Jfr:"\uD835\uDD0D",Jopf:"\uD835\uDD41",Jscr:"\uD835\uDCA5",Jsercy:"Ј",Jukcy:"Є",KHcy:"Х",KJcy:"Ќ",Kappa:"Κ",Kcedil:"Ķ",Kcy:"К",Kfr:"\uD835\uDD0E",Kopf:"\uD835\uDD42",Kscr:"\uD835\uDCA6",LJcy:"Љ",LT:"<",Lacute:"Ĺ",Lambda:"Λ",Lang:"⟪",Laplacetrf:"ℒ",Larr:"↞",Lcaron:"Ľ",Lcedil:"Ļ",Lcy:"Л",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",LeftRightArrow:"↔",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessLess:"⪡",LessSlantEqual:"⩽",LessTilde:"≲",Lfr:"\uD835\uDD0F",Ll:"⋘",Lleftarrow:"⇚",Lmidot:"Ŀ",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lopf:"\uD835\uDD43",LowerLeftArrow:"↙",LowerRightArrow:"↘",Lscr:"ℒ",Lsh:"↰",Lstrok:"Ł",Lt:"≪",Map:"⤅",Mcy:"М",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",MinusPlus:"∓",Mopf:"\uD835\uDD44",Mscr:"ℳ",Mu:"Μ",NJcy:"Њ",Nacute:"Ń",Ncaron:"Ň",Ncedil:"Ņ",Ncy:"Н",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
6458
6458
|
`,Nfr:"\uD835\uDD11",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",Not:"⫬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",Nscr:"\uD835\uDCA9",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"\uD835\uDD12",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",Omicron:"Ο",Oopf:"\uD835\uDD46",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",Or:"⩔",Oscr:"\uD835\uDCAA",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",PartialD:"∂",Pcy:"П",Pfr:"\uD835\uDD13",Phi:"Φ",Pi:"Π",PlusMinus:"±",Poincareplane:"ℌ",Popf:"ℙ",Pr:"⪻",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",Prime:"″",Product:"∏",Proportion:"∷",Proportional:"∝",Pscr:"\uD835\uDCAB",Psi:"Ψ",QUOT:'"',Qfr:"\uD835\uDD14",Qopf:"ℚ",Qscr:"\uD835\uDCAC",RBarr:"⤐",REG:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"ℜ",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",Rfr:"ℜ",Rho:"Ρ",RightAngleBracket:"⟩",RightArrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",Rightarrow:"⇒",Ropf:"ℝ",RoundImplies:"⥰",Rrightarrow:"⇛",Rscr:"ℛ",Rsh:"↱",RuleDelayed:"⧴",SHCHcy:"Щ",SHcy:"Ш",SOFTcy:"Ь",Sacute:"Ś",Sc:"⪼",Scaron:"Š",Scedil:"Ş",Scirc:"Ŝ",Scy:"С",Sfr:"\uD835\uDD16",ShortDownArrow:"↓",ShortLeftArrow:"←",ShortRightArrow:"→",ShortUpArrow:"↑",Sigma:"Σ",SmallCircle:"∘",Sopf:"\uD835\uDD4A",Sqrt:"√",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",Sscr:"\uD835\uDCAE",Star:"⋆",Sub:"⋐",Subset:"⋐",SubsetEqual:"⊆",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",SuchThat:"∋",Sum:"∑",Sup:"⋑",Superset:"⊃",SupersetEqual:"⊇",Supset:"⋑",THORN:"Þ",TRADE:"™",TSHcy:"Ћ",TScy:"Ц",Tab:"\t",Tau:"Τ",Tcaron:"Ť",Tcedil:"Ţ",Tcy:"Т",Tfr:"\uD835\uDD17",Therefore:"∴",Theta:"Θ",ThickSpace:" ",ThinSpace:" ",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",Topf:"\uD835\uDD4B",TripleDot:"⃛",Tscr:"\uD835\uDCAF",Tstrok:"Ŧ",Uacute:"Ú",Uarr:"↟",Uarrocir:"⥉",Ubrcy:"Ў",Ubreve:"Ŭ",Ucirc:"Û",Ucy:"У",Udblac:"Ű",Ufr:"\uD835\uDD18",Ugrave:"Ù",Umacr:"Ū",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",Uopf:"\uD835\uDD4C",UpArrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",UpEquilibrium:"⥮",UpTee:"⊥",UpTeeArrow:"↥",Uparrow:"⇑",Updownarrow:"⇕",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",Upsilon:"Υ",Uring:"Ů",Uscr:"\uD835\uDCB0",Utilde:"Ũ",Uuml:"Ü",VDash:"⊫",Vbar:"⫫",Vcy:"В",Vdash:"⊩",Vdashl:"⫦",Vee:"⋁",Verbar:"‖",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"\uD835\uDD19",Vopf:"\uD835\uDD4D",Vscr:"\uD835\uDCB1",Vvdash:"⊪",Wcirc:"Ŵ",Wedge:"⋀",Wfr:"\uD835\uDD1A",Wopf:"\uD835\uDD4E",Wscr:"\uD835\uDCB2",Xfr:"\uD835\uDD1B",Xi:"Ξ",Xopf:"\uD835\uDD4F",Xscr:"\uD835\uDCB3",YAcy:"Я",YIcy:"Ї",YUcy:"Ю",Yacute:"Ý",Ycirc:"Ŷ",Ycy:"Ы",Yfr:"\uD835\uDD1C",Yopf:"\uD835\uDD50",Yscr:"\uD835\uDCB4",Yuml:"Ÿ",ZHcy:"Ж",Zacute:"Ź",Zcaron:"Ž",Zcy:"З",Zdot:"Ż",ZeroWidthSpace:"",Zeta:"Ζ",Zfr:"ℨ",Zopf:"ℤ",Zscr:"\uD835\uDCB5",aacute:"á",abreve:"ă",ac:"∾",acE:"∾̳",acd:"∿",acirc:"â",acute:"´",acy:"а",aelig:"æ",af:"",afr:"\uD835\uDD1E",agrave:"à",alefsym:"ℵ",aleph:"ℵ",alpha:"α",amacr:"ā",amalg:"⨿",amp:"&",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",aogon:"ą",aopf:"\uD835\uDD52",ap:"≈",apE:"⩰",apacir:"⩯",ape:"≊",apid:"≋",apos:"'",approx:"≈",approxeq:"≊",aring:"å",ascr:"\uD835\uDCB6",ast:"*",asymp:"≈",asympeq:"≍",atilde:"ã",auml:"ä",awconint:"∳",awint:"⨑",bNot:"⫭",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",barvee:"⊽",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",beta:"β",beth:"ℶ",between:"≬",bfr:"\uD835\uDD1F",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bopf:"\uD835\uDD53",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxDL:"╗",boxDR:"╔",boxDl:"╖",boxDr:"╓",boxH:"═",boxHD:"╦",boxHU:"╩",boxHd:"╤",boxHu:"╧",boxUL:"╝",boxUR:"╚",boxUl:"╜",boxUr:"╙",boxV:"║",boxVH:"╬",boxVL:"╣",boxVR:"╠",boxVh:"╫",boxVl:"╢",boxVr:"╟",boxbox:"⧉",boxdL:"╕",boxdR:"╒",boxdl:"┐",boxdr:"┌",boxh:"─",boxhD:"╥",boxhU:"╨",boxhd:"┬",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxuL:"╛",boxuR:"╘",boxul:"┘",boxur:"└",boxv:"│",boxvH:"╪",boxvL:"╡",boxvR:"╞",boxvh:"┼",boxvl:"┤",boxvr:"├",bprime:"‵",breve:"˘",brvbar:"¦",bscr:"\uD835\uDCB7",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",bumpeq:"≏",cacute:"ć",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",caps:"∩︀",caret:"⁁",caron:"ˇ",ccaps:"⩍",ccaron:"č",ccedil:"ç",ccirc:"ĉ",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",cedil:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",cfr:"\uD835\uDD20",chcy:"ч",check:"✓",checkmark:"✓",chi:"χ",cir:"○",cirE:"⧃",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledR:"®",circledS:"Ⓢ",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",clubs:"♣",clubsuit:"♣",colon:":",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",conint:"∮",copf:"\uD835\uDD54",coprod:"∐",copy:"©",copysr:"℗",crarr:"↵",cross:"✗",cscr:"\uD835\uDCB8",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cup:"∪",cupbrcap:"⩈",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dArr:"⇓",dHar:"⥥",dagger:"†",daleth:"ℸ",darr:"↓",dash:"‐",dashv:"⊣",dbkarow:"⤏",dblac:"˝",dcaron:"ď",dcy:"д",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",ddotseq:"⩷",deg:"°",delta:"δ",demptyv:"⦱",dfisht:"⥿",dfr:"\uD835\uDD21",dharl:"⇃",dharr:"⇂",diam:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",dopf:"\uD835\uDD55",dot:"˙",doteq:"≐",doteqdot:"≑",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",downarrow:"↓",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",dscr:"\uD835\uDCB9",dscy:"ѕ",dsol:"⧶",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",dzcy:"џ",dzigrarr:"⟿",eDDot:"⩷",eDot:"≑",eacute:"é",easter:"⩮",ecaron:"ě",ecir:"≖",ecirc:"ê",ecolon:"≕",ecy:"э",edot:"ė",ee:"ⅇ",efDot:"≒",efr:"\uD835\uDD22",eg:"⪚",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",emacr:"ē",empty:"∅",emptyset:"∅",emptyv:"∅",emsp13:" ",emsp14:" ",emsp:" ",eng:"ŋ",ensp:" ",eogon:"ę",eopf:"\uD835\uDD56",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",equals:"=",equest:"≟",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erDot:"≓",erarr:"⥱",escr:"ℯ",esdot:"≐",esim:"≂",eta:"η",eth:"ð",euml:"ë",euro:"€",excl:"!",exist:"∃",expectation:"ℰ",exponentiale:"ⅇ",fallingdotseq:"≒",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"\uD835\uDD23",filig:"fi",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"\uD835\uDD57",forall:"∀",fork:"⋔",forkv:"⫙",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"\uD835\uDCBB",gE:"≧",gEl:"⪌",gacute:"ǵ",gamma:"γ",gammad:"ϝ",gap:"⪆",gbreve:"ğ",gcirc:"ĝ",gcy:"г",gdot:"ġ",ge:"≥",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"\uD835\uDD24",gg:"≫",ggg:"⋙",gimel:"ℷ",gjcy:"ѓ",gl:"≷",glE:"⪒",gla:"⪥",glj:"⪤",gnE:"≩",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",gopf:"\uD835\uDD58",grave:"`",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",hArr:"⇔",hairsp:" ",half:"½",hamilt:"ℋ",hardcy:"ъ",harr:"↔",harrcir:"⥈",harrw:"↭",hbar:"ℏ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"\uD835\uDD25",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"\uD835\uDD59",horbar:"―",hscr:"\uD835\uDCBD",hslash:"ℏ",hstrok:"ħ",hybull:"⁃",hyphen:"‐",iacute:"í",ic:"",icirc:"î",icy:"и",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"\uD835\uDD26",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",imacr:"ī",image:"ℑ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",int:"∫",intcal:"⊺",integers:"ℤ",intercal:"⊺",intlarhk:"⨗",intprod:"⨼",iocy:"ё",iogon:"į",iopf:"\uD835\uDD5A",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"\uD835\uDCBE",isin:"∈",isinE:"⋹",isindot:"⋵",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",itilde:"ĩ",iukcy:"і",iuml:"ï",jcirc:"ĵ",jcy:"й",jfr:"\uD835\uDD27",jmath:"ȷ",jopf:"\uD835\uDD5B",jscr:"\uD835\uDCBF",jsercy:"ј",jukcy:"є",kappa:"κ",kappav:"ϰ",kcedil:"ķ",kcy:"к",kfr:"\uD835\uDD28",kgreen:"ĸ",khcy:"х",kjcy:"ќ",kopf:"\uD835\uDD5C",kscr:"\uD835\uDCC0",lAarr:"⇚",lArr:"⇐",lAtail:"⤛",lBarr:"⤎",lE:"≦",lEg:"⪋",lHar:"⥢",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",lambda:"λ",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",laquo:"«",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",latail:"⤙",late:"⪭",lates:"⪭︀",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",lcedil:"ļ",lceil:"⌈",lcub:"{",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",leftarrow:"←",leftarrowtail:"↢",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",leftthreetimes:"⋋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",lessgtr:"≶",lesssim:"≲",lfisht:"⥼",lfloor:"⌊",lfr:"\uD835\uDD29",lg:"≶",lgE:"⪑",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",ljcy:"љ",ll:"≪",llarr:"⇇",llcorner:"⌞",llhard:"⥫",lltri:"◺",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnE:"≨",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",longleftrightarrow:"⟷",longmapsto:"⟼",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"\uD835\uDCC1",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",lstrok:"ł",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltrPar:"⦖",ltri:"◃",ltrie:"⊴",ltrif:"◂",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",mDDot:"∺",macr:"¯",male:"♂",malt:"✠",maltese:"✠",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",mcy:"м",mdash:"—",measuredangle:"∡",mfr:"\uD835\uDD2A",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",mopf:"\uD835\uDD5E",mp:"∓",mscr:"\uD835\uDCC2",mstpos:"∾",mu:"μ",multimap:"⊸",mumap:"⊸",nGg:"⋙̸",nGt:"≫⃒",nGtv:"≫̸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nLl:"⋘̸",nLt:"≪⃒",nLtv:"≪̸",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",nabla:"∇",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",ncaron:"ň",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",ndash:"–",ne:"≠",neArr:"⇗",nearhk:"⤤",nearr:"↗",nearrow:"↗",nedot:"≐̸",nequiv:"≢",nesear:"⤨",nesim:"≂̸",nexist:"∄",nexists:"∄",nfr:"\uD835\uDD2B",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",ngsim:"≵",ngt:"≯",ngtr:"≯",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",njcy:"њ",nlArr:"⇍",nlE:"≦̸",nlarr:"↚",nldr:"‥",nle:"≰",nleftarrow:"↚",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nlsim:"≴",nlt:"≮",nltri:"⋪",nltrie:"⋬",nmid:"∤",nopf:"\uD835\uDD5F",not:"¬",notin:"∉",notinE:"⋹̸",notindot:"⋵̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",nscr:"\uD835\uDCC3",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",nu:"ν",num:"#",numero:"№",numsp:" ",nvDash:"⊭",nvHarr:"⤄",nvap:"≍⃒",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwArr:"⇖",nwarhk:"⤣",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",oS:"Ⓢ",oacute:"ó",oast:"⊛",ocir:"⊚",ocirc:"ô",ocy:"о",odash:"⊝",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",oelig:"œ",ofcir:"⦿",ofr:"\uD835\uDD2C",ogon:"˛",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",omacr:"ō",omega:"ω",omicron:"ο",omid:"⦶",ominus:"⊖",oopf:"\uD835\uDD60",opar:"⦷",operp:"⦹",oplus:"⊕",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oscr:"ℴ",oslash:"ø",osol:"⊘",otilde:"õ",otimes:"⊗",otimesas:"⨶",ouml:"ö",ovbar:"⌽",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",pfr:"\uD835\uDD2D",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",pointint:"⨕",popf:"\uD835\uDD61",pound:"£",pr:"≺",prE:"⪳",prap:"⪷",prcue:"≼",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",prime:"′",primes:"ℙ",prnE:"⪵",prnap:"⪹",prnsim:"⋨",prod:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",propto:"∝",prsim:"≾",prurel:"⊰",pscr:"\uD835\uDCC5",psi:"ψ",puncsp:" ",qfr:"\uD835\uDD2E",qint:"⨌",qopf:"\uD835\uDD62",qprime:"⁗",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',rAarr:"⇛",rArr:"⇒",rAtail:"⤜",rBarr:"⤏",rHar:"⥤",race:"∽̱",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",rarrw:"↝",ratail:"⤚",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",rcedil:"ŗ",rceil:"⌉",rcub:"}",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",reg:"®",rfisht:"⥽",rfloor:"⌋",rfr:"\uD835\uDD2F",rhard:"⇁",rharu:"⇀",rharul:"⥬",rho:"ρ",rhov:"ϱ",rightarrow:"→",rightarrowtail:"↣",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",rightthreetimes:"⋌",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",rsaquo:"›",rscr:"\uD835\uDCC7",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",ruluhar:"⥨",rx:"℞",sacute:"ś",sbquo:"‚",sc:"≻",scE:"⪴",scap:"⪸",scaron:"š",sccue:"≽",sce:"⪰",scedil:"ş",scirc:"ŝ",scnE:"⪶",scnap:"⪺",scnsim:"⋩",scpolint:"⨓",scsim:"≿",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",seArr:"⇘",searhk:"⤥",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",shchcy:"щ",shcy:"ш",shortmid:"∣",shortparallel:"∥",shy:"",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"\uD835\uDD64",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",square:"□",squarf:"▪",squf:"▪",srarr:"→",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",subE:"⫅",subdot:"⪽",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",supE:"⫆",supdot:"⪾",supdsub:"⫘",supe:"⊇",supedot:"⫄",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swArr:"⇙",swarhk:"⤦",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",target:"⌖",tau:"τ",tbrk:"⎴",tcaron:"ť",tcedil:"ţ",tcy:"т",tdot:"⃛",telrec:"⌕",tfr:"\uD835\uDD31",there4:"∴",therefore:"∴",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",thinsp:" ",thkap:"≈",thksim:"∼",thorn:"þ",tilde:"˜",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"\uD835\uDCC9",tscy:"ц",tshcy:"ћ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",uArr:"⇑",uHar:"⥣",uacute:"ú",uarr:"↑",ubrcy:"ў",ubreve:"ŭ",ucirc:"û",ucy:"у",udarr:"⇅",udblac:"ű",udhar:"⥮",ufisht:"⥾",ufr:"\uD835\uDD32",ugrave:"ù",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",uml:"¨",uogon:"ų",uopf:"\uD835\uDD66",uparrow:"↑",updownarrow:"↕",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",upsi:"υ",upsih:"ϒ",upsilon:"υ",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",urtri:"◹",uscr:"\uD835\uDCCA",utdot:"⋰",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",uuml:"ü",uwangle:"⦧",vArr:"⇕",vBar:"⫨",vBarv:"⫩",vDash:"⊨",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vcy:"в",vdash:"⊢",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",verbar:"|",vert:"|",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",vzigzag:"⦚",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",wedgeq:"≙",weierp:"℘",wfr:"\uD835\uDD34",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",yacute:"ý",yacy:"я",ycirc:"ŷ",ycy:"ы",yen:"¥",yfr:"\uD835\uDD36",yicy:"ї",yopf:"\uD835\uDD6A",yscr:"\uD835\uDCCE",yucy:"ю",yuml:"ÿ",zacute:"ź",zcaron:"ž",zcy:"з",zdot:"ż",zeetrf:"ℨ",zeta:"ζ",zfr:"\uD835\uDD37",zhcy:"ж",zigrarr:"⇝",zopf:"\uD835\uDD6B",zscr:"\uD835\uDCCF",zwj:"",zwnj:""};var xq9={}.hasOwnProperty;function cC(J){return xq9.call(_g1,J)?_g1[J]:!1}function E7(J,Q,Z,X){let Y=J.length,K=0,G;if(Q<0)Q=-Q>Y?0:Y+Q;else Q=Q>Y?Y:Q;if(Z=Z>0?Z:0,X.length<1e4)G=Array.from(X),G.unshift(Q,Z),J.splice(...G);else{if(Z)J.splice(Q,Z);while(K<X.length)G=X.slice(K,K+1e4),G.unshift(Q,0),J.splice(...G),K+=1e4,Q+=1e4}}function BZ(J,Q){if(J.length>0)return E7(J,J.length,0,Q),J;return Q}var Gz6={}.hasOwnProperty;function yJ1(J){let Q={},Z=-1;while(++Z<J.length)bq9(Q,J[Z]);return Q}function bq9(J,Q){let Z;for(Z in Q){let Y=(Gz6.call(J,Z)?J[Z]:void 0)||(J[Z]={}),K=Q[Z],G;if(K)for(G in K){if(!Gz6.call(Y,G))Y[G]=[];let q=K[G];yq9(Y[G],Array.isArray(q)?q:q?[q]:[])}}}function yq9(J,Q){let Z=-1,X=[];while(++Z<Q.length)(Q[Z].add==="after"?J:X).push(Q[Z]);E7(J,0,0,X)}function fJ1(J,Q){let Z=Number.parseInt(J,Q);if(Z<9||Z===11||Z>13&&Z<32||Z>126&&Z<160||Z>55295&&Z<57344||Z>64975&&Z<65008||(Z&65535)===65535||(Z&65535)===65534||Z>1114111)return"�";return String.fromCodePoint(Z)}function LQ(J){return J.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var P5=VN(/[A-Za-z]/),T5=VN(/[\dA-Za-z]/),qz6=VN(/[#-'*+\--9=?A-Z^-~]/);function CR(J){return J!==null&&(J<32||J===127)}var ap=VN(/\d/),zz6=VN(/[\dA-Fa-f]/),Uz6=VN(/[!-/:-@[-`{-~]/);function D6(J){return J!==null&&J<-2}function R9(J){return J!==null&&(J<0||J===32)}function W8(J){return J===-2||J===-1||J===32}var SR=VN(/\p{P}|\p{S}/u),GW=VN(/\s/);function VN(J){return Q;function Q(Z){return Z!==null&&Z>-1&&J.test(String.fromCharCode(Z))}}function G8(J,Q,Z,X){let Y=X?X-1:Number.POSITIVE_INFINITY,K=0;return G;function G(z){if(W8(z))return J.enter(Z),q(z);return Q(z)}function q(z){if(W8(z)&&K++<Y)return J.consume(z),q;return J.exit(Z),Q(z)}}var Wz6={tokenize:fq9};function fq9(J){let Q=J.attempt(this.parser.constructs.contentInitial,X,Y),Z;return Q;function X(q){if(q===null){J.consume(q);return}return J.enter("lineEnding"),J.consume(q),J.exit("lineEnding"),G8(J,Q,"linePrefix")}function Y(q){return J.enter("paragraph"),K(q)}function K(q){let z=J.enter("chunkText",{contentType:"text",previous:Z});if(Z)Z.next=z;return Z=z,G(q)}function G(q){if(q===null){J.exit("chunkText"),J.exit("paragraph"),J.consume(q);return}if(D6(q))return J.consume(q),J.exit("chunkText"),K;return J.consume(q),G}}var Hz6={tokenize:hq9},Fz6={tokenize:gq9};function hq9(J){let Q=this,Z=[],X=0,Y,K,G;return q;function q(w){if(X<Z.length){let R=Z[X];return Q.containerState=R[1],J.attempt(R[0].continuation,z,U)(w)}return U(w)}function z(w){if(X++,Q.containerState._closeFlow){if(Q.containerState._closeFlow=void 0,Y)A();let R=Q.events.length,O=R,j;while(O--)if(Q.events[O][0]==="exit"&&Q.events[O][1].type==="chunkFlow"){j=Q.events[O][1].end;break}L(X);let $=R;while($<Q.events.length)Q.events[$][1].end={...j},$++;return E7(Q.events,O+1,0,Q.events.slice(R)),Q.events.length=$,U(w)}return q(w)}function U(w){if(X===Z.length){if(!Y)return H(w);if(Y.currentConstruct&&Y.currentConstruct.concrete)return M(w);Q.interrupt=Boolean(Y.currentConstruct&&!Y._gfmTableDynamicInterruptHack)}return Q.containerState={},J.check(Fz6,W,F)(w)}function W(w){if(Y)A();return L(X),H(w)}function F(w){return Q.parser.lazy[Q.now().line]=X!==Z.length,G=Q.now().offset,M(w)}function H(w){return Q.containerState={},J.attempt(Fz6,B,M)(w)}function B(w){return X++,Z.push([Q.currentConstruct,Q.containerState]),H(w)}function M(w){if(w===null){if(Y)A();L(0),J.consume(w);return}return Y=Y||Q.parser.flow(Q.now()),J.enter("chunkFlow",{_tokenizer:Y,contentType:"flow",previous:K}),V(w)}function V(w){if(w===null){N(J.exit("chunkFlow"),!0),L(0),J.consume(w);return}if(D6(w))return J.consume(w),N(J.exit("chunkFlow")),X=0,Q.interrupt=void 0,q;return J.consume(w),V}function N(w,R){let O=Q.sliceStream(w);if(R)O.push(null);if(w.previous=K,K)K.next=w;if(K=w,Y.defineSkip(w.start),Y.write(O),Q.parser.lazy[w.start.line]){let j=Y.events.length;while(j--)if(Y.events[j][1].start.offset<G&&(!Y.events[j][1].end||Y.events[j][1].end.offset>G))return;let $=Q.events.length,E=$,I,T;while(E--)if(Q.events[E][0]==="exit"&&Q.events[E][1].type==="chunkFlow"){if(I){T=Q.events[E][1].end;break}I=!0}L(X),j=$;while(j<Q.events.length)Q.events[j][1].end={...T},j++;E7(Q.events,E+1,0,Q.events.slice($)),Q.events.length=j}}function L(w){let R=Z.length;while(R-- >w){let O=Z[R];Q.containerState=O[1],O[0].exit.call(Q,J)}Z.length=w}function A(){Y.write([null]),K=void 0,Y=void 0,Q.containerState._closeFlow=void 0}}function gq9(J,Q,Z){return G8(J,J.attempt(this.parser.constructs.document,Q,Z),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function YB(J){if(J===null||R9(J)||GW(J))return 1;if(SR(J))return 2}function NN(J,Q,Z){let X=[],Y=-1;while(++Y<J.length){let K=J[Y].resolveAll;if(K&&!X.includes(K))Q=K(Q,Z),X.push(K)}return Q}var rp={name:"attention",resolveAll:mq9,tokenize:uq9};function mq9(J,Q){let Z=-1,X,Y,K,G,q,z,U,W;while(++Z<J.length)if(J[Z][0]==="enter"&&J[Z][1].type==="attentionSequence"&&J[Z][1]._close){X=Z;while(X--)if(J[X][0]==="exit"&&J[X][1].type==="attentionSequence"&&J[X][1]._open&&Q.sliceSerialize(J[X][1]).charCodeAt(0)===Q.sliceSerialize(J[Z][1]).charCodeAt(0)){if((J[X][1]._close||J[Z][1]._open)&&(J[Z][1].end.offset-J[Z][1].start.offset)%3&&!((J[X][1].end.offset-J[X][1].start.offset+J[Z][1].end.offset-J[Z][1].start.offset)%3))continue;z=J[X][1].end.offset-J[X][1].start.offset>1&&J[Z][1].end.offset-J[Z][1].start.offset>1?2:1;let F={...J[X][1].end},H={...J[Z][1].start};if(Bz6(F,-z),Bz6(H,z),G={type:z>1?"strongSequence":"emphasisSequence",start:F,end:{...J[X][1].end}},q={type:z>1?"strongSequence":"emphasisSequence",start:{...J[Z][1].start},end:H},K={type:z>1?"strongText":"emphasisText",start:{...J[X][1].end},end:{...J[Z][1].start}},Y={type:z>1?"strong":"emphasis",start:{...G.start},end:{...q.end}},J[X][1].end={...G.start},J[Z][1].start={...q.end},U=[],J[X][1].end.offset-J[X][1].start.offset)U=BZ(U,[["enter",J[X][1],Q],["exit",J[X][1],Q]]);if(U=BZ(U,[["enter",Y,Q],["enter",G,Q],["exit",G,Q],["enter",K,Q]]),U=BZ(U,NN(Q.parser.constructs.insideSpan.null,J.slice(X+1,Z),Q)),U=BZ(U,[["exit",K,Q],["enter",q,Q],["exit",q,Q],["exit",Y,Q]]),J[Z][1].end.offset-J[Z][1].start.offset)W=2,U=BZ(U,[["enter",J[Z][1],Q],["exit",J[Z][1],Q]]);else W=0;E7(J,X-1,Z-X+3,U),Z=X+U.length-W-2;break}}Z=-1;while(++Z<J.length)if(J[Z][1].type==="attentionSequence")J[Z][1].type="data";return J}function uq9(J,Q){let Z=this.parser.constructs.attentionMarkers.null,X=this.previous,Y=YB(X),K;return G;function G(z){return K=z,J.enter("attentionSequence"),q(z)}function q(z){if(z===K)return J.consume(z),q;let U=J.exit("attentionSequence"),W=YB(z),F=!W||W===2&&Y||Z.includes(z),H=!Y||Y===2&&W||Z.includes(X);return U._open=Boolean(K===42?F:F&&(Y||!H)),U._close=Boolean(K===42?H:H&&(W||!F)),Q(z)}}function Bz6(J,Q){J.column+=Q,J.offset+=Q,J._bufferIndex+=Q}var xg1={name:"autolink",tokenize:pq9};function pq9(J,Q,Z){let X=0;return Y;function Y(B){return J.enter("autolink"),J.enter("autolinkMarker"),J.consume(B),J.exit("autolinkMarker"),J.enter("autolinkProtocol"),K}function K(B){if(P5(B))return J.consume(B),G;if(B===64)return Z(B);return U(B)}function G(B){if(B===43||B===45||B===46||T5(B))return X=1,q(B);return U(B)}function q(B){if(B===58)return J.consume(B),X=0,z;if((B===43||B===45||B===46||T5(B))&&X++<32)return J.consume(B),q;return X=0,U(B)}function z(B){if(B===62)return J.exit("autolinkProtocol"),J.enter("autolinkMarker"),J.consume(B),J.exit("autolinkMarker"),J.exit("autolink"),Q;if(B===null||B===32||B===60||CR(B))return Z(B);return J.consume(B),z}function U(B){if(B===64)return J.consume(B),W;if(qz6(B))return J.consume(B),U;return Z(B)}function W(B){return T5(B)?F(B):Z(B)}function F(B){if(B===46)return J.consume(B),X=0,W;if(B===62)return J.exit("autolinkProtocol").type="autolinkEmail",J.enter("autolinkMarker"),J.consume(B),J.exit("autolinkMarker"),J.exit("autolink"),Q;return H(B)}function H(B){if((B===45||T5(B))&&X++<63){let M=B===45?H:F;return J.consume(B),M}return Z(B)}}var qW={partial:!0,tokenize:dq9};function dq9(J,Q,Z){return X;function X(K){return W8(K)?G8(J,Y,"linePrefix")(K):Y(K)}function Y(K){return K===null||D6(K)?Q(K):Z(K)}}var hJ1={continuation:{tokenize:lq9},exit:iq9,name:"blockQuote",tokenize:cq9};function cq9(J,Q,Z){let X=this;return Y;function Y(G){if(G===62){let q=X.containerState;if(!q.open)J.enter("blockQuote",{_container:!0}),q.open=!0;return J.enter("blockQuotePrefix"),J.enter("blockQuoteMarker"),J.consume(G),J.exit("blockQuoteMarker"),K}return Z(G)}function K(G){if(W8(G))return J.enter("blockQuotePrefixWhitespace"),J.consume(G),J.exit("blockQuotePrefixWhitespace"),J.exit("blockQuotePrefix"),Q;return J.exit("blockQuotePrefix"),Q(G)}}function lq9(J,Q,Z){let X=this;return Y;function Y(G){if(W8(G))return G8(J,K,"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G);return K(G)}function K(G){return J.attempt(hJ1,Q,Z)(G)}}function iq9(J){J.exit("blockQuote")}var gJ1={name:"characterEscape",tokenize:nq9};function nq9(J,Q,Z){return X;function X(K){return J.enter("characterEscape"),J.enter("escapeMarker"),J.consume(K),J.exit("escapeMarker"),Y}function Y(K){if(Uz6(K))return J.enter("characterEscapeValue"),J.consume(K),J.exit("characterEscapeValue"),J.exit("characterEscape"),Q;return Z(K)}}var mJ1={name:"characterReference",tokenize:aq9};function aq9(J,Q,Z){let X=this,Y=0,K,G;return q;function q(F){return J.enter("characterReference"),J.enter("characterReferenceMarker"),J.consume(F),J.exit("characterReferenceMarker"),z}function z(F){if(F===35)return J.enter("characterReferenceMarkerNumeric"),J.consume(F),J.exit("characterReferenceMarkerNumeric"),U;return J.enter("characterReferenceValue"),K=31,G=T5,W(F)}function U(F){if(F===88||F===120)return J.enter("characterReferenceMarkerHexadecimal"),J.consume(F),J.exit("characterReferenceMarkerHexadecimal"),J.enter("characterReferenceValue"),K=6,G=zz6,W;return J.enter("characterReferenceValue"),K=7,G=ap,W(F)}function W(F){if(F===59&&Y){let H=J.exit("characterReferenceValue");if(G===T5&&!cC(X.sliceSerialize(H)))return Z(F);return J.enter("characterReferenceMarker"),J.consume(F),J.exit("characterReferenceMarker"),J.exit("characterReference"),Q}if(G(F)&&Y++<K)return J.consume(F),W;return Z(F)}}var Dz6={partial:!0,tokenize:sq9},uJ1={concrete:!0,name:"codeFenced",tokenize:rq9};function rq9(J,Q,Z){let X=this,Y={partial:!0,tokenize:O},K=0,G=0,q;return z;function z(j){return U(j)}function U(j){let $=X.events[X.events.length-1];return K=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,q=j,J.enter("codeFenced"),J.enter("codeFencedFence"),J.enter("codeFencedFenceSequence"),W(j)}function W(j){if(j===q)return G++,J.consume(j),W;if(G<3)return Z(j);return J.exit("codeFencedFenceSequence"),W8(j)?G8(J,F,"whitespace")(j):F(j)}function F(j){if(j===null||D6(j))return J.exit("codeFencedFence"),X.interrupt?Q(j):J.check(Dz6,V,R)(j);return J.enter("codeFencedFenceInfo"),J.enter("chunkString",{contentType:"string"}),H(j)}function H(j){if(j===null||D6(j))return J.exit("chunkString"),J.exit("codeFencedFenceInfo"),F(j);if(W8(j))return J.exit("chunkString"),J.exit("codeFencedFenceInfo"),G8(J,B,"whitespace")(j);if(j===96&&j===q)return Z(j);return J.consume(j),H}function B(j){if(j===null||D6(j))return F(j);return J.enter("codeFencedFenceMeta"),J.enter("chunkString",{contentType:"string"}),M(j)}function M(j){if(j===null||D6(j))return J.exit("chunkString"),J.exit("codeFencedFenceMeta"),F(j);if(j===96&&j===q)return Z(j);return J.consume(j),M}function V(j){return J.attempt(Y,R,N)(j)}function N(j){return J.enter("lineEnding"),J.consume(j),J.exit("lineEnding"),L}function L(j){return K>0&&W8(j)?G8(J,A,"linePrefix",K+1)(j):A(j)}function A(j){if(j===null||D6(j))return J.check(Dz6,V,R)(j);return J.enter("codeFlowValue"),w(j)}function w(j){if(j===null||D6(j))return J.exit("codeFlowValue"),A(j);return J.consume(j),w}function R(j){return J.exit("codeFenced"),Q(j)}function O(j,$,E){let I=0;return T;function T(_){return j.enter("lineEnding"),j.consume(_),j.exit("lineEnding"),S}function S(_){return j.enter("codeFencedFence"),W8(_)?G8(j,x,"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):x(_)}function x(_){if(_===q)return j.enter("codeFencedFenceSequence"),h(_);return E(_)}function h(_){if(_===q)return I++,j.consume(_),h;if(I>=G)return j.exit("codeFencedFenceSequence"),W8(_)?G8(j,v,"whitespace")(_):v(_);return E(_)}function v(_){if(_===null||D6(_))return j.exit("codeFencedFence"),$(_);return E(_)}}}function sq9(J,Q,Z){let X=this;return Y;function Y(G){if(G===null)return Z(G);return J.enter("lineEnding"),J.consume(G),J.exit("lineEnding"),K}function K(G){return X.parser.lazy[X.now().line]?Z(G):Q(G)}}var sp={name:"codeIndented",tokenize:tq9},oq9={partial:!0,tokenize:eq9};function tq9(J,Q,Z){let X=this;return Y;function Y(U){return J.enter("codeIndented"),G8(J,K,"linePrefix",5)(U)}function K(U){let W=X.events[X.events.length-1];return W&&W[1].type==="linePrefix"&&W[2].sliceSerialize(W[1],!0).length>=4?G(U):Z(U)}function G(U){if(U===null)return z(U);if(D6(U))return J.attempt(oq9,G,z)(U);return J.enter("codeFlowValue"),q(U)}function q(U){if(U===null||D6(U))return J.exit("codeFlowValue"),G(U);return J.consume(U),q}function z(U){return J.exit("codeIndented"),Q(U)}}function eq9(J,Q,Z){let X=this;return Y;function Y(G){if(X.parser.lazy[X.now().line])return Z(G);if(D6(G))return J.enter("lineEnding"),J.consume(G),J.exit("lineEnding"),Y;return G8(J,K,"linePrefix",5)(G)}function K(G){let q=X.events[X.events.length-1];return q&&q[1].type==="linePrefix"&&q[2].sliceSerialize(q[1],!0).length>=4?Q(G):D6(G)?Y(G):Z(G)}}var bg1={name:"codeText",previous:Qz9,resolve:Jz9,tokenize:Zz9};function Jz9(J){let Q=J.length-4,Z=3,X,Y;if((J[Z][1].type==="lineEnding"||J[Z][1].type==="space")&&(J[Q][1].type==="lineEnding"||J[Q][1].type==="space")){X=Z;while(++X<Q)if(J[X][1].type==="codeTextData"){J[Z][1].type="codeTextPadding",J[Q][1].type="codeTextPadding",Z+=2,Q-=2;break}}X=Z-1,Q++;while(++X<=Q)if(Y===void 0){if(X!==Q&&J[X][1].type!=="lineEnding")Y=X}else if(X===Q||J[X][1].type==="lineEnding"){if(J[Y][1].type="codeTextData",X!==Y+2)J[Y][1].end=J[X-1][1].end,J.splice(Y+2,X-Y-2),Q-=X-Y-2,X=Y+2;Y=void 0}return J}function Qz9(J){return J!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Zz9(J,Q,Z){let X=this,Y=0,K,G;return q;function q(H){return J.enter("codeText"),J.enter("codeTextSequence"),z(H)}function z(H){if(H===96)return J.consume(H),Y++,z;return J.exit("codeTextSequence"),U(H)}function U(H){if(H===null)return Z(H);if(H===32)return J.enter("space"),J.consume(H),J.exit("space"),U;if(H===96)return G=J.enter("codeTextSequence"),K=0,F(H);if(D6(H))return J.enter("lineEnding"),J.consume(H),J.exit("lineEnding"),U;return J.enter("codeTextData"),W(H)}function W(H){if(H===null||H===32||H===96||D6(H))return J.exit("codeTextData"),U(H);return J.consume(H),W}function F(H){if(H===96)return J.consume(H),K++,F;if(K===Y)return J.exit("codeTextSequence"),J.exit("codeText"),Q(H);return G.type="codeTextData",W(H)}}class yg1{constructor(J){this.left=J?[...J]:[],this.right=[]}get(J){if(J<0||J>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+J+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");if(J<this.left.length)return this.left[J];return this.right[this.right.length-J+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(J,Q){let Z=Q===null||Q===void 0?Number.POSITIVE_INFINITY:Q;if(Z<this.left.length)return this.left.slice(J,Z);if(J>this.left.length)return this.right.slice(this.right.length-Z+this.left.length,this.right.length-J+this.left.length).reverse();return this.left.slice(J).concat(this.right.slice(this.right.length-Z+this.left.length).reverse())}splice(J,Q,Z){let X=Q||0;this.setCursor(Math.trunc(J));let Y=this.right.splice(this.right.length-X,Number.POSITIVE_INFINITY);if(Z)op(this.left,Z);return Y.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(J){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(J)}pushMany(J){this.setCursor(Number.POSITIVE_INFINITY),op(this.left,J)}unshift(J){this.setCursor(0),this.right.push(J)}unshiftMany(J){this.setCursor(0),op(this.right,J.reverse())}setCursor(J){if(J===this.left.length||J>this.left.length&&this.right.length===0||J<0&&this.left.length===0)return;if(J<this.left.length){let Q=this.left.splice(J,Number.POSITIVE_INFINITY);op(this.right,Q.reverse())}else{let Q=this.right.splice(this.left.length+this.right.length-J,Number.POSITIVE_INFINITY);op(this.left,Q.reverse())}}}function op(J,Q){let Z=0;if(Q.length<1e4)J.push(...Q);else while(Z<Q.length)J.push(...Q.slice(Z,Z+1e4)),Z+=1e4}function pJ1(J){let Q={},Z=-1,X,Y,K,G,q,z,U,W=new yg1(J);while(++Z<W.length){while(Z in Q)Z=Q[Z];if(X=W.get(Z),Z&&X[1].type==="chunkFlow"&&W.get(Z-1)[1].type==="listItemPrefix"){if(z=X[1]._tokenizer.events,K=0,K<z.length&&z[K][1].type==="lineEndingBlank")K+=2;if(K<z.length&&z[K][1].type==="content")while(++K<z.length){if(z[K][1].type==="content")break;if(z[K][1].type==="chunkText")z[K][1]._isInFirstContentOfListItem=!0,K++}}if(X[0]==="enter"){if(X[1].contentType)Object.assign(Q,Xz9(W,Z)),Z=Q[Z],U=!0}else if(X[1]._container){K=Z,Y=void 0;while(K--)if(G=W.get(K),G[1].type==="lineEnding"||G[1].type==="lineEndingBlank"){if(G[0]==="enter"){if(Y)W.get(Y)[1].type="lineEndingBlank";G[1].type="lineEnding",Y=K}}else if(G[1].type==="linePrefix"||G[1].type==="listItemIndent");else break;if(Y)X[1].end={...W.get(Y)[1].start},q=W.slice(Y,Z),q.unshift(X),W.splice(Y,Z-Y+1,q)}}return E7(J,0,Number.POSITIVE_INFINITY,W.slice(0)),!U}function Xz9(J,Q){let Z=J.get(Q)[1],X=J.get(Q)[2],Y=Q-1,K=[],G=Z._tokenizer;if(!G){if(G=X.parser[Z.contentType](Z.start),Z._contentTypeTextTrailing)G._contentTypeTextTrailing=!0}let q=G.events,z=[],U={},W,F,H=-1,B=Z,M=0,V=0,N=[V];while(B){while(J.get(++Y)[1]!==B);if(K.push(Y),!B._tokenizer){if(W=X.sliceStream(B),!B.next)W.push(null);if(F)G.defineSkip(B.start);if(B._isInFirstContentOfListItem)G._gfmTasklistFirstContentOfListItem=!0;if(G.write(W),B._isInFirstContentOfListItem)G._gfmTasklistFirstContentOfListItem=void 0}F=B,B=B.next}B=Z;while(++H<q.length)if(q[H][0]==="exit"&&q[H-1][0]==="enter"&&q[H][1].type===q[H-1][1].type&&q[H][1].start.line!==q[H][1].end.line)V=H+1,N.push(V),B._tokenizer=void 0,B.previous=void 0,B=B.next;if(G.events=[],B)B._tokenizer=void 0,B.previous=void 0;else N.pop();H=N.length;while(H--){let L=q.slice(N[H],N[H+1]),A=K.pop();z.push([A,A+L.length-1]),J.splice(A,2,L)}z.reverse(),H=-1;while(++H<z.length)U[M+z[H][0]]=M+z[H][1],M+=z[H][1]-z[H][0]-1;return U}var fg1={resolve:Kz9,tokenize:Gz9},Yz9={partial:!0,tokenize:qz9};function Kz9(J){return pJ1(J),J}function Gz9(J,Q){let Z;return X;function X(q){return J.enter("content"),Z=J.enter("chunkContent",{contentType:"content"}),Y(q)}function Y(q){if(q===null)return K(q);if(D6(q))return J.check(Yz9,G,K)(q);return J.consume(q),Y}function K(q){return J.exit("chunkContent"),J.exit("content"),Q(q)}function G(q){return J.consume(q),J.exit("chunkContent"),Z.next=J.enter("chunkContent",{contentType:"content",previous:Z}),Z=Z.next,Y}}function qz9(J,Q,Z){let X=this;return Y;function Y(G){return J.exit("chunkContent"),J.enter("lineEnding"),J.consume(G),J.exit("lineEnding"),G8(J,K,"linePrefix")}function K(G){if(G===null||D6(G))return Z(G);let q=X.events[X.events.length-1];if(!X.parser.constructs.disable.null.includes("codeIndented")&&q&&q[1].type==="linePrefix"&&q[2].sliceSerialize(q[1],!0).length>=4)return Q(G);return J.interrupt(X.parser.constructs.flow,Z,Q)(G)}}function dJ1(J,Q,Z,X,Y,K,G,q,z){let U=z||Number.POSITIVE_INFINITY,W=0;return F;function F(L){if(L===60)return J.enter(X),J.enter(Y),J.enter(K),J.consume(L),J.exit(K),H;if(L===null||L===32||L===41||CR(L))return Z(L);return J.enter(X),J.enter(G),J.enter(q),J.enter("chunkString",{contentType:"string"}),V(L)}function H(L){if(L===62)return J.enter(K),J.consume(L),J.exit(K),J.exit(Y),J.exit(X),Q;return J.enter(q),J.enter("chunkString",{contentType:"string"}),B(L)}function B(L){if(L===62)return J.exit("chunkString"),J.exit(q),H(L);if(L===null||L===60||D6(L))return Z(L);return J.consume(L),L===92?M:B}function M(L){if(L===60||L===62||L===92)return J.consume(L),B;return B(L)}function V(L){if(!W&&(L===null||L===41||R9(L)))return J.exit("chunkString"),J.exit(q),J.exit(G),J.exit(X),Q(L);if(W<U&&L===40)return J.consume(L),W++,V;if(L===41)return J.consume(L),W--,V;if(L===null||L===32||L===40||CR(L))return Z(L);return J.consume(L),L===92?N:V}function N(L){if(L===40||L===41||L===92)return J.consume(L),V;return V(L)}}function cJ1(J,Q,Z,X,Y,K){let G=this,q=0,z;return U;function U(B){return J.enter(X),J.enter(Y),J.consume(B),J.exit(Y),J.enter(K),W}function W(B){if(q>999||B===null||B===91||B===93&&!z||B===94&&!q&&"_hiddenFootnoteSupport"in G.parser.constructs)return Z(B);if(B===93)return J.exit(K),J.enter(Y),J.consume(B),J.exit(Y),J.exit(X),Q;if(D6(B))return J.enter("lineEnding"),J.consume(B),J.exit("lineEnding"),W;return J.enter("chunkString",{contentType:"string"}),F(B)}function F(B){if(B===null||B===91||B===93||D6(B)||q++>999)return J.exit("chunkString"),W(B);if(J.consume(B),!z)z=!W8(B);return B===92?H:F}function H(B){if(B===91||B===92||B===93)return J.consume(B),q++,F;return F(B)}}function lJ1(J,Q,Z,X,Y,K){let G;return q;function q(H){if(H===34||H===39||H===40)return J.enter(X),J.enter(Y),J.consume(H),J.exit(Y),G=H===40?41:H,z;return Z(H)}function z(H){if(H===G)return J.enter(Y),J.consume(H),J.exit(Y),J.exit(X),Q;return J.enter(K),U(H)}function U(H){if(H===G)return J.exit(K),z(G);if(H===null)return Z(H);if(D6(H))return J.enter("lineEnding"),J.consume(H),J.exit("lineEnding"),G8(J,U,"linePrefix");return J.enter("chunkString",{contentType:"string"}),W(H)}function W(H){if(H===G||H===null||D6(H))return J.exit("chunkString"),U(H);return J.consume(H),H===92?F:W}function F(H){if(H===G||H===92)return J.consume(H),W;return W(H)}}function vR(J,Q){let Z;return X;function X(Y){if(D6(Y))return J.enter("lineEnding"),J.consume(Y),J.exit("lineEnding"),Z=!0,X;if(W8(Y))return G8(J,X,Z?"linePrefix":"lineSuffix")(Y);return Q(Y)}}var hg1={name:"definition",tokenize:Uz9},zz9={partial:!0,tokenize:Wz9};function Uz9(J,Q,Z){let X=this,Y;return K;function K(B){return J.enter("definition"),G(B)}function G(B){return cJ1.call(X,J,q,Z,"definitionLabel","definitionLabelMarker","definitionLabelString")(B)}function q(B){if(Y=LQ(X.sliceSerialize(X.events[X.events.length-1][1]).slice(1,-1)),B===58)return J.enter("definitionMarker"),J.consume(B),J.exit("definitionMarker"),z;return Z(B)}function z(B){return R9(B)?vR(J,U)(B):U(B)}function U(B){return dJ1(J,W,Z,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(B)}function W(B){return J.attempt(zz9,F,F)(B)}function F(B){return W8(B)?G8(J,H,"whitespace")(B):H(B)}function H(B){if(B===null||D6(B))return J.exit("definition"),X.parser.defined.push(Y),Q(B);return Z(B)}}function Wz9(J,Q,Z){return X;function X(q){return R9(q)?vR(J,Y)(q):Z(q)}function Y(q){return lJ1(J,K,Z,"definitionTitle","definitionTitleMarker","definitionTitleString")(q)}function K(q){return W8(q)?G8(J,G,"whitespace")(q):G(q)}function G(q){return q===null||D6(q)?Q(q):Z(q)}}var gg1={name:"hardBreakEscape",tokenize:Fz9};function Fz9(J,Q,Z){return X;function X(K){return J.enter("hardBreakEscape"),J.consume(K),Y}function Y(K){if(D6(K))return J.exit("hardBreakEscape"),Q(K);return Z(K)}}var mg1={name:"headingAtx",resolve:Hz9,tokenize:Bz9};function Hz9(J,Q){let Z=J.length-2,X=3,Y,K;if(J[X][1].type==="whitespace")X+=2;if(Z-2>X&&J[Z][1].type==="whitespace")Z-=2;if(J[Z][1].type==="atxHeadingSequence"&&(X===Z-1||Z-4>X&&J[Z-2][1].type==="whitespace"))Z-=X+1===Z?2:4;if(Z>X)Y={type:"atxHeadingText",start:J[X][1].start,end:J[Z][1].end},K={type:"chunkText",start:J[X][1].start,end:J[Z][1].end,contentType:"text"},E7(J,X,Z-X+1,[["enter",Y,Q],["enter",K,Q],["exit",K,Q],["exit",Y,Q]]);return J}function Bz9(J,Q,Z){let X=0;return Y;function Y(W){return J.enter("atxHeading"),K(W)}function K(W){return J.enter("atxHeadingSequence"),G(W)}function G(W){if(W===35&&X++<6)return J.consume(W),G;if(W===null||R9(W))return J.exit("atxHeadingSequence"),q(W);return Z(W)}function q(W){if(W===35)return J.enter("atxHeadingSequence"),z(W);if(W===null||D6(W))return J.exit("atxHeading"),Q(W);if(W8(W))return G8(J,q,"whitespace")(W);return J.enter("atxHeadingText"),U(W)}function z(W){if(W===35)return J.consume(W),z;return J.exit("atxHeadingSequence"),q(W)}function U(W){if(W===null||W===35||R9(W))return J.exit("atxHeadingText"),q(W);return J.consume(W),U}}var Mz6=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ug1=["pre","script","style","textarea"];var pg1={concrete:!0,name:"htmlFlow",resolveTo:Vz9,tokenize:Nz9},Dz9={partial:!0,tokenize:Az9},Mz9={partial:!0,tokenize:Lz9};function Vz9(J){let Q=J.length;while(Q--)if(J[Q][0]==="enter"&&J[Q][1].type==="htmlFlow")break;if(Q>1&&J[Q-2][1].type==="linePrefix")J[Q][1].start=J[Q-2][1].start,J[Q+1][1].start=J[Q-2][1].start,J.splice(Q-2,2);return J}function Nz9(J,Q,Z){let X=this,Y,K,G,q,z;return U;function U(p){return W(p)}function W(p){return J.enter("htmlFlow"),J.enter("htmlFlowData"),J.consume(p),F}function F(p){if(p===33)return J.consume(p),H;if(p===47)return J.consume(p),K=!0,V;if(p===63)return J.consume(p),Y=3,X.interrupt?Q:f;if(P5(p))return J.consume(p),G=String.fromCharCode(p),N;return Z(p)}function H(p){if(p===45)return J.consume(p),Y=2,B;if(p===91)return J.consume(p),Y=5,q=0,M;if(P5(p))return J.consume(p),Y=4,X.interrupt?Q:f;return Z(p)}function B(p){if(p===45)return J.consume(p),X.interrupt?Q:f;return Z(p)}function M(p){if(p==="CDATA[".charCodeAt(q++)){if(J.consume(p),q===6)return X.interrupt?Q:x;return M}return Z(p)}function V(p){if(P5(p))return J.consume(p),G=String.fromCharCode(p),N;return Z(p)}function N(p){if(p===null||p===47||p===62||R9(p)){let e=p===47,G1=G.toLowerCase();if(!e&&!K&&ug1.includes(G1))return Y=1,X.interrupt?Q(p):x(p);if(Mz6.includes(G.toLowerCase())){if(Y=6,e)return J.consume(p),L;return X.interrupt?Q(p):x(p)}return Y=7,X.interrupt&&!X.parser.lazy[X.now().line]?Z(p):K?A(p):w(p)}if(p===45||T5(p))return J.consume(p),G+=String.fromCharCode(p),N;return Z(p)}function L(p){if(p===62)return J.consume(p),X.interrupt?Q:x;return Z(p)}function A(p){if(W8(p))return J.consume(p),A;return T(p)}function w(p){if(p===47)return J.consume(p),T;if(p===58||p===95||P5(p))return J.consume(p),R;if(W8(p))return J.consume(p),w;return T(p)}function R(p){if(p===45||p===46||p===58||p===95||T5(p))return J.consume(p),R;return O(p)}function O(p){if(p===61)return J.consume(p),j;if(W8(p))return J.consume(p),O;return w(p)}function j(p){if(p===null||p===60||p===61||p===62||p===96)return Z(p);if(p===34||p===39)return J.consume(p),z=p,$;if(W8(p))return J.consume(p),j;return E(p)}function $(p){if(p===z)return J.consume(p),z=null,I;if(p===null||D6(p))return Z(p);return J.consume(p),$}function E(p){if(p===null||p===34||p===39||p===47||p===60||p===61||p===62||p===96||R9(p))return O(p);return J.consume(p),E}function I(p){if(p===47||p===62||W8(p))return w(p);return Z(p)}function T(p){if(p===62)return J.consume(p),S;return Z(p)}function S(p){if(p===null||D6(p))return x(p);if(W8(p))return J.consume(p),S;return Z(p)}function x(p){if(p===45&&Y===2)return J.consume(p),b;if(p===60&&Y===1)return J.consume(p),g;if(p===62&&Y===4)return J.consume(p),m;if(p===63&&Y===3)return J.consume(p),f;if(p===93&&Y===5)return J.consume(p),y;if(D6(p)&&(Y===6||Y===7))return J.exit("htmlFlowData"),J.check(Dz9,n,h)(p);if(p===null||D6(p))return J.exit("htmlFlowData"),h(p);return J.consume(p),x}function h(p){return J.check(Mz9,v,n)(p)}function v(p){return J.enter("lineEnding"),J.consume(p),J.exit("lineEnding"),_}function _(p){if(p===null||D6(p))return h(p);return J.enter("htmlFlowData"),x(p)}function b(p){if(p===45)return J.consume(p),f;return x(p)}function g(p){if(p===47)return J.consume(p),G="",k;return x(p)}function k(p){if(p===62){let e=G.toLowerCase();if(ug1.includes(e))return J.consume(p),m;return x(p)}if(P5(p)&&G.length<8)return J.consume(p),G+=String.fromCharCode(p),k;return x(p)}function y(p){if(p===93)return J.consume(p),f;return x(p)}function f(p){if(p===62)return J.consume(p),m;if(p===45&&Y===2)return J.consume(p),f;return x(p)}function m(p){if(p===null||D6(p))return J.exit("htmlFlowData"),n(p);return J.consume(p),m}function n(p){return J.exit("htmlFlow"),Q(p)}}function Lz9(J,Q,Z){let X=this;return Y;function Y(G){if(D6(G))return J.enter("lineEnding"),J.consume(G),J.exit("lineEnding"),K;return Z(G)}function K(G){return X.parser.lazy[X.now().line]?Z(G):Q(G)}}function Az9(J,Q,Z){return X;function X(Y){return J.enter("lineEnding"),J.consume(Y),J.exit("lineEnding"),J.attempt(qW,Q,Z)}}var dg1={name:"htmlText",tokenize:wz9};function wz9(J,Q,Z){let X=this,Y,K,G;return q;function q(f){return J.enter("htmlText"),J.enter("htmlTextData"),J.consume(f),z}function z(f){if(f===33)return J.consume(f),U;if(f===47)return J.consume(f),O;if(f===63)return J.consume(f),w;if(P5(f))return J.consume(f),E;return Z(f)}function U(f){if(f===45)return J.consume(f),W;if(f===91)return J.consume(f),K=0,M;if(P5(f))return J.consume(f),A;return Z(f)}function W(f){if(f===45)return J.consume(f),B;return Z(f)}function F(f){if(f===null)return Z(f);if(f===45)return J.consume(f),H;if(D6(f))return G=F,g(f);return J.consume(f),F}function H(f){if(f===45)return J.consume(f),B;return F(f)}function B(f){return f===62?b(f):f===45?H(f):F(f)}function M(f){if(f==="CDATA[".charCodeAt(K++))return J.consume(f),K===6?V:M;return Z(f)}function V(f){if(f===null)return Z(f);if(f===93)return J.consume(f),N;if(D6(f))return G=V,g(f);return J.consume(f),V}function N(f){if(f===93)return J.consume(f),L;return V(f)}function L(f){if(f===62)return b(f);if(f===93)return J.consume(f),L;return V(f)}function A(f){if(f===null||f===62)return b(f);if(D6(f))return G=A,g(f);return J.consume(f),A}function w(f){if(f===null)return Z(f);if(f===63)return J.consume(f),R;if(D6(f))return G=w,g(f);return J.consume(f),w}function R(f){return f===62?b(f):w(f)}function O(f){if(P5(f))return J.consume(f),j;return Z(f)}function j(f){if(f===45||T5(f))return J.consume(f),j;return $(f)}function $(f){if(D6(f))return G=$,g(f);if(W8(f))return J.consume(f),$;return b(f)}function E(f){if(f===45||T5(f))return J.consume(f),E;if(f===47||f===62||R9(f))return I(f);return Z(f)}function I(f){if(f===47)return J.consume(f),b;if(f===58||f===95||P5(f))return J.consume(f),T;if(D6(f))return G=I,g(f);if(W8(f))return J.consume(f),I;return b(f)}function T(f){if(f===45||f===46||f===58||f===95||T5(f))return J.consume(f),T;return S(f)}function S(f){if(f===61)return J.consume(f),x;if(D6(f))return G=S,g(f);if(W8(f))return J.consume(f),S;return I(f)}function x(f){if(f===null||f===60||f===61||f===62||f===96)return Z(f);if(f===34||f===39)return J.consume(f),Y=f,h;if(D6(f))return G=x,g(f);if(W8(f))return J.consume(f),x;return J.consume(f),v}function h(f){if(f===Y)return J.consume(f),Y=void 0,_;if(f===null)return Z(f);if(D6(f))return G=h,g(f);return J.consume(f),h}function v(f){if(f===null||f===34||f===39||f===60||f===61||f===96)return Z(f);if(f===47||f===62||R9(f))return I(f);return J.consume(f),v}function _(f){if(f===47||f===62||R9(f))return I(f);return Z(f)}function b(f){if(f===62)return J.consume(f),J.exit("htmlTextData"),J.exit("htmlText"),Q;return Z(f)}function g(f){return J.exit("htmlTextData"),J.enter("lineEnding"),J.consume(f),J.exit("lineEnding"),k}function k(f){return W8(f)?G8(J,y,"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):y(f)}function y(f){return J.enter("htmlTextData"),G(f)}}var kR={name:"labelEnd",resolveAll:$z9,resolveTo:Ez9,tokenize:Iz9},Rz9={tokenize:Pz9},Oz9={tokenize:Tz9},jz9={tokenize:Cz9};function $z9(J){let Q=-1,Z=[];while(++Q<J.length){let X=J[Q][1];if(Z.push(J[Q]),X.type==="labelImage"||X.type==="labelLink"||X.type==="labelEnd"){let Y=X.type==="labelImage"?4:2;X.type="data",Q+=Y}}if(J.length!==Z.length)E7(J,0,J.length,Z);return J}function Ez9(J,Q){let Z=J.length,X=0,Y,K,G,q;while(Z--)if(Y=J[Z][1],K){if(Y.type==="link"||Y.type==="labelLink"&&Y._inactive)break;if(J[Z][0]==="enter"&&Y.type==="labelLink")Y._inactive=!0}else if(G){if(J[Z][0]==="enter"&&(Y.type==="labelImage"||Y.type==="labelLink")&&!Y._balanced){if(K=Z,Y.type!=="labelLink"){X=2;break}}}else if(Y.type==="labelEnd")G=Z;let z={type:J[K][1].type==="labelLink"?"link":"image",start:{...J[K][1].start},end:{...J[J.length-1][1].end}},U={type:"label",start:{...J[K][1].start},end:{...J[G][1].end}},W={type:"labelText",start:{...J[K+X+2][1].end},end:{...J[G-2][1].start}};return q=[["enter",z,Q],["enter",U,Q]],q=BZ(q,J.slice(K+1,K+X+3)),q=BZ(q,[["enter",W,Q]]),q=BZ(q,NN(Q.parser.constructs.insideSpan.null,J.slice(K+X+4,G-3),Q)),q=BZ(q,[["exit",W,Q],J[G-2],J[G-1],["exit",U,Q]]),q=BZ(q,J.slice(G+1)),q=BZ(q,[["exit",z,Q]]),E7(J,K,J.length,q),J}function Iz9(J,Q,Z){let X=this,Y=X.events.length,K,G;while(Y--)if((X.events[Y][1].type==="labelImage"||X.events[Y][1].type==="labelLink")&&!X.events[Y][1]._balanced){K=X.events[Y][1];break}return q;function q(H){if(!K)return Z(H);if(K._inactive)return F(H);return G=X.parser.defined.includes(LQ(X.sliceSerialize({start:K.end,end:X.now()}))),J.enter("labelEnd"),J.enter("labelMarker"),J.consume(H),J.exit("labelMarker"),J.exit("labelEnd"),z}function z(H){if(H===40)return J.attempt(Rz9,W,G?W:F)(H);if(H===91)return J.attempt(Oz9,W,G?U:F)(H);return G?W(H):F(H)}function U(H){return J.attempt(jz9,W,F)(H)}function W(H){return Q(H)}function F(H){return K._balanced=!0,Z(H)}}function Pz9(J,Q,Z){return X;function X(F){return J.enter("resource"),J.enter("resourceMarker"),J.consume(F),J.exit("resourceMarker"),Y}function Y(F){return R9(F)?vR(J,K)(F):K(F)}function K(F){if(F===41)return W(F);return dJ1(J,G,q,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(F)}function G(F){return R9(F)?vR(J,z)(F):W(F)}function q(F){return Z(F)}function z(F){if(F===34||F===39||F===40)return lJ1(J,U,Z,"resourceTitle","resourceTitleMarker","resourceTitleString")(F);return W(F)}function U(F){return R9(F)?vR(J,W)(F):W(F)}function W(F){if(F===41)return J.enter("resourceMarker"),J.consume(F),J.exit("resourceMarker"),J.exit("resource"),Q;return Z(F)}}function Tz9(J,Q,Z){let X=this;return Y;function Y(q){return cJ1.call(X,J,K,G,"reference","referenceMarker","referenceString")(q)}function K(q){return X.parser.defined.includes(LQ(X.sliceSerialize(X.events[X.events.length-1][1]).slice(1,-1)))?Q(q):Z(q)}function G(q){return Z(q)}}function Cz9(J,Q,Z){return X;function X(K){return J.enter("reference"),J.enter("referenceMarker"),J.consume(K),J.exit("referenceMarker"),Y}function Y(K){if(K===93)return J.enter("referenceMarker"),J.consume(K),J.exit("referenceMarker"),J.exit("reference"),Q;return Z(K)}}var cg1={name:"labelStartImage",resolveAll:kR.resolveAll,tokenize:Sz9};function Sz9(J,Q,Z){let X=this;return Y;function Y(q){return J.enter("labelImage"),J.enter("labelImageMarker"),J.consume(q),J.exit("labelImageMarker"),K}function K(q){if(q===91)return J.enter("labelMarker"),J.consume(q),J.exit("labelMarker"),J.exit("labelImage"),G;return Z(q)}function G(q){return q===94&&"_hiddenFootnoteSupport"in X.parser.constructs?Z(q):Q(q)}}var lg1={name:"labelStartLink",resolveAll:kR.resolveAll,tokenize:vz9};function vz9(J,Q,Z){let X=this;return Y;function Y(G){return J.enter("labelLink"),J.enter("labelMarker"),J.consume(G),J.exit("labelMarker"),J.exit("labelLink"),K}function K(G){return G===94&&"_hiddenFootnoteSupport"in X.parser.constructs?Z(G):Q(G)}}var tp={name:"lineEnding",tokenize:kz9};function kz9(J,Q){return Z;function Z(X){return J.enter("lineEnding"),J.consume(X),J.exit("lineEnding"),G8(J,Q,"linePrefix")}}var _R={name:"thematicBreak",tokenize:_z9};function _z9(J,Q,Z){let X=0,Y;return K;function K(U){return J.enter("thematicBreak"),G(U)}function G(U){return Y=U,q(U)}function q(U){if(U===Y)return J.enter("thematicBreakSequence"),z(U);if(X>=3&&(U===null||D6(U)))return J.exit("thematicBreak"),Q(U);return Z(U)}function z(U){if(U===Y)return J.consume(U),X++,z;return J.exit("thematicBreakSequence"),W8(U)?G8(J,q,"whitespace")(U):q(U)}}var AQ={continuation:{tokenize:fz9},exit:gz9,name:"list",tokenize:yz9},xz9={partial:!0,tokenize:mz9},bz9={partial:!0,tokenize:hz9};function yz9(J,Q,Z){let X=this,Y=X.events[X.events.length-1],K=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,G=0;return q;function q(B){let M=X.containerState.type||(B===42||B===43||B===45?"listUnordered":"listOrdered");if(M==="listUnordered"?!X.containerState.marker||B===X.containerState.marker:ap(B)){if(!X.containerState.type)X.containerState.type=M,J.enter(M,{_container:!0});if(M==="listUnordered")return J.enter("listItemPrefix"),B===42||B===45?J.check(_R,Z,U)(B):U(B);if(!X.interrupt||B===49)return J.enter("listItemPrefix"),J.enter("listItemValue"),z(B)}return Z(B)}function z(B){if(ap(B)&&++G<10)return J.consume(B),z;if((!X.interrupt||G<2)&&(X.containerState.marker?B===X.containerState.marker:B===41||B===46))return J.exit("listItemValue"),U(B);return Z(B)}function U(B){return J.enter("listItemMarker"),J.consume(B),J.exit("listItemMarker"),X.containerState.marker=X.containerState.marker||B,J.check(qW,X.interrupt?Z:W,J.attempt(xz9,H,F))}function W(B){return X.containerState.initialBlankLine=!0,K++,H(B)}function F(B){if(W8(B))return J.enter("listItemPrefixWhitespace"),J.consume(B),J.exit("listItemPrefixWhitespace"),H;return Z(B)}function H(B){return X.containerState.size=K+X.sliceSerialize(J.exit("listItemPrefix"),!0).length,Q(B)}}function fz9(J,Q,Z){let X=this;return X.containerState._closeFlow=void 0,J.check(qW,Y,K);function Y(q){return X.containerState.furtherBlankLines=X.containerState.furtherBlankLines||X.containerState.initialBlankLine,G8(J,Q,"listItemIndent",X.containerState.size+1)(q)}function K(q){if(X.containerState.furtherBlankLines||!W8(q))return X.containerState.furtherBlankLines=void 0,X.containerState.initialBlankLine=void 0,G(q);return X.containerState.furtherBlankLines=void 0,X.containerState.initialBlankLine=void 0,J.attempt(bz9,Q,G)(q)}function G(q){return X.containerState._closeFlow=!0,X.interrupt=void 0,G8(J,J.attempt(AQ,Q,Z),"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q)}}function hz9(J,Q,Z){let X=this;return G8(J,Y,"listItemIndent",X.containerState.size+1);function Y(K){let G=X.events[X.events.length-1];return G&&G[1].type==="listItemIndent"&&G[2].sliceSerialize(G[1],!0).length===X.containerState.size?Q(K):Z(K)}}function gz9(J){J.exit(this.containerState.type)}function mz9(J,Q,Z){let X=this;return G8(J,Y,"listItemPrefixWhitespace",X.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function Y(K){let G=X.events[X.events.length-1];return!W8(K)&&G&&G[1].type==="listItemPrefixWhitespace"?Q(K):Z(K)}}var iJ1={name:"setextUnderline",resolveTo:uz9,tokenize:pz9};function uz9(J,Q){let Z=J.length,X,Y,K;while(Z--)if(J[Z][0]==="enter"){if(J[Z][1].type==="content"){X=Z;break}if(J[Z][1].type==="paragraph")Y=Z}else{if(J[Z][1].type==="content")J.splice(Z,1);if(!K&&J[Z][1].type==="definition")K=Z}let G={type:"setextHeading",start:{...J[X][1].start},end:{...J[J.length-1][1].end}};if(J[Y][1].type="setextHeadingText",K)J.splice(Y,0,["enter",G,Q]),J.splice(K+1,0,["exit",J[X][1],Q]),J[X][1].end={...J[K][1].end};else J[X][1]=G;return J.push(["exit",G,Q]),J}function pz9(J,Q,Z){let X=this,Y;return K;function K(U){let W=X.events.length,F;while(W--)if(X.events[W][1].type!=="lineEnding"&&X.events[W][1].type!=="linePrefix"&&X.events[W][1].type!=="content"){F=X.events[W][1].type==="paragraph";break}if(!X.parser.lazy[X.now().line]&&(X.interrupt||F))return J.enter("setextHeadingLine"),Y=U,G(U);return Z(U)}function G(U){return J.enter("setextHeadingLineSequence"),q(U)}function q(U){if(U===Y)return J.consume(U),q;return J.exit("setextHeadingLineSequence"),W8(U)?G8(J,z,"lineSuffix")(U):z(U)}function z(U){if(U===null||D6(U))return J.exit("setextHeadingLine"),Q(U);return Z(U)}}var Vz6={tokenize:dz9};function dz9(J){let Q=this,Z=J.attempt(qW,X,J.attempt(this.parser.constructs.flowInitial,Y,G8(J,J.attempt(this.parser.constructs.flow,Y,J.attempt(fg1,Y)),"linePrefix")));return Z;function X(K){if(K===null){J.consume(K);return}return J.enter("lineEndingBlank"),J.consume(K),J.exit("lineEndingBlank"),Q.currentConstruct=void 0,Z}function Y(K){if(K===null){J.consume(K);return}return J.enter("lineEnding"),J.consume(K),J.exit("lineEnding"),Q.currentConstruct=void 0,Z}}var Nz6={resolveAll:Rz6()},Lz6=wz6("string"),Az6=wz6("text");function wz6(J){return{resolveAll:Rz6(J==="text"?cz9:void 0),tokenize:Q};function Q(Z){let X=this,Y=this.parser.constructs[J],K=Z.attempt(Y,G,q);return G;function G(W){return U(W)?K(W):q(W)}function q(W){if(W===null){Z.consume(W);return}return Z.enter("data"),Z.consume(W),z}function z(W){if(U(W))return Z.exit("data"),K(W);return Z.consume(W),z}function U(W){if(W===null)return!0;let F=Y[W],H=-1;if(F)while(++H<F.length){let B=F[H];if(!B.previous||B.previous.call(X,X.previous))return!0}return!1}}}function Rz6(J){return Q;function Q(Z,X){let Y=-1,K;while(++Y<=Z.length)if(K===void 0){if(Z[Y]&&Z[Y][1].type==="data")K=Y,Y++}else if(!Z[Y]||Z[Y][1].type!=="data"){if(Y!==K+2)Z[K][1].end=Z[Y-1][1].end,Z.splice(K+2,Y-K-2),Y=K+2;K=void 0}return J?J(Z,X):Z}}function cz9(J,Q){let Z=0;while(++Z<=J.length)if((Z===J.length||J[Z][1].type==="lineEnding")&&J[Z-1][1].type==="data"){let X=J[Z-1][1],Y=Q.sliceStream(X),K=Y.length,G=-1,q=0,z;while(K--){let U=Y[K];if(typeof U==="string"){G=U.length;while(U.charCodeAt(G-1)===32)q++,G--;if(G)break;G=-1}else if(U===-2)z=!0,q++;else if(U===-1);else{K++;break}}if(Q._contentTypeTextTrailing&&Z===J.length)q=0;if(q){let U={type:Z===J.length||z||q<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:K?G:X.start._bufferIndex+G,_index:X.start._index+K,line:X.end.line,column:X.end.column-q,offset:X.end.offset-q},end:{...X.end}};if(X.end={...U.start},X.start.offset===X.end.offset)Object.assign(X,U);else J.splice(Z,0,["enter",U,Q],["exit",U,Q]),Z+=2}Z++}return J}var ig1={};R6(ig1,{text:()=>sz9,string:()=>rz9,insideSpan:()=>oz9,flowInitial:()=>nz9,flow:()=>az9,document:()=>lz9,disable:()=>ez9,contentInitial:()=>iz9,attentionMarkers:()=>tz9});var lz9={[42]:AQ,[43]:AQ,[45]:AQ,[48]:AQ,[49]:AQ,[50]:AQ,[51]:AQ,[52]:AQ,[53]:AQ,[54]:AQ,[55]:AQ,[56]:AQ,[57]:AQ,[62]:hJ1},iz9={[91]:hg1},nz9={[-2]:sp,[-1]:sp,[32]:sp},az9={[35]:mg1,[42]:_R,[45]:[iJ1,_R],[60]:pg1,[61]:iJ1,[95]:_R,[96]:uJ1,[126]:uJ1},rz9={[38]:mJ1,[92]:gJ1},sz9={[-5]:tp,[-4]:tp,[-3]:tp,[33]:cg1,[38]:mJ1,[42]:rp,[60]:[xg1,dg1],[91]:lg1,[92]:[gg1,gJ1],[93]:kR,[95]:rp,[96]:bg1},oz9={null:[rp,Nz6]},tz9={null:[42,95]},ez9={null:[]};function Oz6(J,Q,Z){let X={_bufferIndex:-1,_index:0,line:Z&&Z.line||1,column:Z&&Z.column||1,offset:Z&&Z.offset||0},Y={},K=[],G=[],q=[],z=!0,U={attempt:I($),check:I(E),consume:R,enter:O,exit:j,interrupt:I(E,{interrupt:!0})},W={code:null,containerState:{},defineSkip:L,events:[],now:N,parser:J,previous:null,sliceSerialize:M,sliceStream:V,write:B},F=Q.tokenize.call(W,U),H;if(Q.resolveAll)K.push(Q);return W;function B(h){if(G=BZ(G,h),A(),G[G.length-1]!==null)return[];return T(Q,0),W.events=NN(K,W.events,W),W.events}function M(h,v){return QU9(V(h),v)}function V(h){return JU9(G,h)}function N(){let{_bufferIndex:h,_index:v,line:_,column:b,offset:g}=X;return{_bufferIndex:h,_index:v,line:_,column:b,offset:g}}function L(h){Y[h.line]=h.column,x()}function A(){let h;while(X._index<G.length){let v=G[X._index];if(typeof v==="string"){if(h=X._index,X._bufferIndex<0)X._bufferIndex=0;while(X._index===h&&X._bufferIndex<v.length)w(v.charCodeAt(X._bufferIndex))}else w(v)}}function w(h){z=void 0,H=h,F=F(h)}function R(h){if(D6(h))X.line++,X.column=1,X.offset+=h===-3?2:1,x();else if(h!==-1)X.column++,X.offset++;if(X._bufferIndex<0)X._index++;else if(X._bufferIndex++,X._bufferIndex===G[X._index].length)X._bufferIndex=-1,X._index++;W.previous=h,z=!0}function O(h,v){let _=v||{};return _.type=h,_.start=N(),W.events.push(["enter",_,W]),q.push(_),_}function j(h){let v=q.pop();return v.end=N(),W.events.push(["exit",v,W]),v}function $(h,v){T(h,v.from)}function E(h,v){v.restore()}function I(h,v){return _;function _(b,g,k){let y,f,m,n;return Array.isArray(b)?e(b):("tokenize"in b)?e([b]):p(b);function p(F1){return l;function l(d){let i=d!==null&&F1[d],r=d!==null&&F1.null,o=[...Array.isArray(i)?i:i?[i]:[],...Array.isArray(r)?r:r?[r]:[]];return e(o)(d)}}function e(F1){if(y=F1,f=0,F1.length===0)return k;return G1(F1[f])}function G1(F1){return l;function l(d){if(n=S(),m=F1,!F1.partial)W.currentConstruct=F1;if(F1.name&&W.parser.constructs.disable.null.includes(F1.name))return Z1(d);return F1.tokenize.call(v?Object.assign(Object.create(W),v):W,U,U1,Z1)(d)}}function U1(F1){return z=!0,h(m,n),g}function Z1(F1){if(z=!0,n.restore(),++f<y.length)return G1(y[f]);return k}}}function T(h,v){if(h.resolveAll&&!K.includes(h))K.push(h);if(h.resolve)E7(W.events,v,W.events.length-v,h.resolve(W.events.slice(v),W));if(h.resolveTo)W.events=h.resolveTo(W.events,W)}function S(){let h=N(),v=W.previous,_=W.currentConstruct,b=W.events.length,g=Array.from(q);return{from:b,restore:k};function k(){X=h,W.previous=v,W.currentConstruct=_,W.events.length=b,q=g,x()}}function x(){if(X.line in Y&&X.column<2)X.column=Y[X.line],X.offset+=Y[X.line]-1}}function JU9(J,Q){let Z=Q.start._index,X=Q.start._bufferIndex,Y=Q.end._index,K=Q.end._bufferIndex,G;if(Z===Y)G=[J[Z].slice(X,K)];else{if(G=J.slice(Z,Y),X>-1){let q=G[0];if(typeof q==="string")G[0]=q.slice(X);else G.shift()}if(K>0)G.push(J[Y].slice(0,K))}return G}function QU9(J,Q){let Z=-1,X=[],Y;while(++Z<J.length){let K=J[Z],G;if(typeof K==="string")G=K;else switch(K){case-5:{G="\r";break}case-4:{G=`
|
|
6459
6459
|
`;break}case-3:{G=`\r
|
|
6460
6460
|
`;break}case-2:{G=Q?" ":"\t";break}case-1:{if(!Q&&Y)continue;G=" ";break}default:G=String.fromCharCode(K)}Y=K===-2,X.push(G)}return X.join("")}function ng1(J){let X={constructs:yJ1([ig1,...(J||{}).extensions||[]]),content:Y(Wz6),defined:[],document:Y(Hz6),flow:Y(Vz6),lazy:{},string:Y(Lz6),text:Y(Az6)};return X;function Y(K){return G;function G(q){return Oz6(X,K,q)}}}function ag1(J){while(!pJ1(J));return J}var jz6=/[\0\t\n\r]/g;function rg1(){let J=1,Q="",Z=!0,X;return Y;function Y(K,G,q){let z=[],U,W,F,H,B;if(K=Q+(typeof K==="string"?K.toString():new TextDecoder(G||void 0).decode(K)),F=0,Q="",Z){if(K.charCodeAt(0)===65279)F++;Z=void 0}while(F<K.length){if(jz6.lastIndex=F,U=jz6.exec(K),H=U&&U.index!==void 0?U.index:K.length,B=K.charCodeAt(H),!U){Q=K.slice(F);break}if(B===10&&F===H&&X)z.push(-3),X=void 0;else{if(X)z.push(-5),X=void 0;if(F<H)z.push(K.slice(F,H)),J+=H-F;switch(B){case 0:{z.push(65533),J++;break}case 9:{W=Math.ceil(J/4)*4,z.push(-2);while(J++<W)z.push(-1);break}case 10:{z.push(-4),J=1;break}default:X=!0,J=1}}F=H+1}if(q){if(X)z.push(-5);if(Q)z.push(Q);z.push(null)}return z}}var ZU9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nJ1(J){return J.replace(ZU9,XU9)}function XU9(J,Q,Z){if(Q)return Q;if(Z.charCodeAt(0)===35){let Y=Z.charCodeAt(1),K=Y===120||Y===88;return fJ1(Z.slice(K?2:1),K?16:10)}return cC(Z)||J}function LN(J){if(!J||typeof J!=="object")return"";if("position"in J||"type"in J)return $z6(J.position);if("start"in J||"end"in J)return $z6(J);if("line"in J||"column"in J)return sg1(J);return""}function sg1(J){return Ez6(J&&J.line)+":"+Ez6(J&&J.column)}function $z6(J){return sg1(J&&J.start)+"-"+sg1(J&&J.end)}function Ez6(J){return J&&typeof J==="number"?J:1}var Pz6={}.hasOwnProperty;function og1(J,Q,Z){if(typeof Q!=="string")Z=Q,Q=void 0;return YU9(Z)(ag1(ng1(Z).document().write(rg1()(J,Q,!0))))}function YU9(J){let Q={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:K(w1),autolinkProtocol:I,autolinkEmail:I,atxHeading:K(J1),blockQuote:K(d),characterEscape:I,characterReference:I,codeFenced:K(i),codeFencedFenceInfo:G,codeFencedFenceMeta:G,codeIndented:K(i,G),codeText:K(r,G),codeTextData:I,data:I,codeFlowValue:I,definition:K(o),definitionDestinationString:G,definitionLabelString:G,definitionTitleString:G,emphasis:K(Y1),hardBreakEscape:K(H1),hardBreakTrailing:K(H1),htmlFlow:K(z1,G),htmlFlowData:I,htmlText:K(z1,G),htmlTextData:I,image:K(W1),label:G,link:K(w1),listItem:K(y1),listItemValue:H,listOrdered:K(D1,F),listUnordered:K(D1),paragraph:K(l1),reference:p,referenceString:G,resourceDestinationString:G,resourceTitleString:G,setextHeading:K(J1),strong:K(s1),thematicBreak:K(r1)},exit:{atxHeading:z(),atxHeadingSequence:O,autolink:z(),autolinkEmail:l,autolinkProtocol:F1,blockQuote:z(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:G1,characterReferenceMarkerNumeric:G1,characterReferenceValue:U1,characterReference:Z1,codeFenced:z(N),codeFencedFence:V,codeFencedFenceInfo:B,codeFencedFenceMeta:M,codeFlowValue:T,codeIndented:z(L),codeText:z(_),codeTextData:T,data:T,definition:z(),definitionDestinationString:R,definitionLabelString:A,definitionTitleString:w,emphasis:z(),hardBreakEscape:z(x),hardBreakTrailing:z(x),htmlFlow:z(h),htmlFlowData:T,htmlText:z(v),htmlTextData:T,image:z(g),label:y,labelText:k,lineEnding:S,link:z(b),listItem:z(),listOrdered:z(),listUnordered:z(),paragraph:z(),referenceString:e,resourceDestinationString:f,resourceTitleString:m,resource:n,setextHeading:z(E),setextHeadingLineSequence:$,setextHeadingText:j,strong:z(),thematicBreak:z()}};Tz6(Q,(J||{}).mdastExtensions||[]);let Z={};return X;function X(V1){let t={type:"root",children:[]},O1={stack:[t],tokenStack:[],config:Q,enter:q,exit:U,buffer:G,resume:W,data:Z},M1=[],I1=-1;while(++I1<V1.length)if(V1[I1][1].type==="listOrdered"||V1[I1][1].type==="listUnordered")if(V1[I1][0]==="enter")M1.push(I1);else{let X1=M1.pop();I1=Y(V1,X1,I1)}I1=-1;while(++I1<V1.length){let X1=Q[V1[I1][0]];if(Pz6.call(X1,V1[I1][1].type))X1[V1[I1][1].type].call(Object.assign({sliceSerialize:V1[I1][2].sliceSerialize},O1),V1[I1][1])}if(O1.tokenStack.length>0){let X1=O1.tokenStack[O1.tokenStack.length-1];(X1[1]||Iz6).call(O1,void 0,X1[0])}t.position={start:AN(V1.length>0?V1[0][1].start:{line:1,column:1,offset:0}),end:AN(V1.length>0?V1[V1.length-2][1].end:{line:1,column:1,offset:0})},I1=-1;while(++I1<Q.transforms.length)t=Q.transforms[I1](t)||t;return t}function Y(V1,t,O1){let M1=t-1,I1=-1,X1=!1,v1,q1,P1,T1;while(++M1<=O1){let b1=V1[M1];switch(b1[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{if(b1[0]==="enter")I1++;else I1--;T1=void 0;break}case"lineEndingBlank":{if(b1[0]==="enter"){if(v1&&!T1&&!I1&&!P1)P1=M1;T1=void 0}break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:T1=void 0}if(!I1&&b1[0]==="enter"&&b1[1].type==="listItemPrefix"||I1===-1&&b1[0]==="exit"&&(b1[1].type==="listUnordered"||b1[1].type==="listOrdered")){if(v1){let h1=M1;q1=void 0;while(h1--){let c1=V1[h1];if(c1[1].type==="lineEnding"||c1[1].type==="lineEndingBlank"){if(c1[0]==="exit")continue;if(q1)V1[q1][1].type="lineEndingBlank",X1=!0;c1[1].type="lineEnding",q1=h1}else if(c1[1].type==="linePrefix"||c1[1].type==="blockQuotePrefix"||c1[1].type==="blockQuotePrefixWhitespace"||c1[1].type==="blockQuoteMarker"||c1[1].type==="listItemIndent");else break}if(P1&&(!q1||P1<q1))v1._spread=!0;v1.end=Object.assign({},q1?V1[q1][1].start:b1[1].end),V1.splice(q1||M1,0,["exit",v1,b1[2]]),M1++,O1++}if(b1[1].type==="listItemPrefix"){let h1={type:"listItem",_spread:!1,start:Object.assign({},b1[1].start),end:void 0};v1=h1,V1.splice(M1,0,["enter",h1,b1[2]]),M1++,O1++,P1=void 0,T1=!0}}}return V1[t][1]._spread=X1,O1}function K(V1,t){return O1;function O1(M1){if(q.call(this,V1(M1),M1),t)t.call(this,M1)}}function G(){this.stack.push({type:"fragment",children:[]})}function q(V1,t,O1){this.stack[this.stack.length-1].children.push(V1),this.stack.push(V1),this.tokenStack.push([t,O1||void 0]),V1.position={start:AN(t.start),end:void 0}}function z(V1){return t;function t(O1){if(V1)V1.call(this,O1);U.call(this,O1)}}function U(V1,t){let O1=this.stack.pop(),M1=this.tokenStack.pop();if(!M1)throw Error("Cannot close `"+V1.type+"` ("+LN({start:V1.start,end:V1.end})+"): it’s not open");else if(M1[0].type!==V1.type)if(t)t.call(this,V1,M1[0]);else(M1[1]||Iz6).call(this,V1,M1[0]);O1.position.end=AN(V1.end)}function W(){return TR(this.stack.pop())}function F(){this.data.expectingFirstListItemValue=!0}function H(V1){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(V1),10),this.data.expectingFirstListItemValue=void 0}}function B(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.lang=V1}function M(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.meta=V1}function V(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function N(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.value=V1.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function L(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.value=V1.replace(/(\r?\n|\r)$/g,"")}function A(V1){let t=this.resume(),O1=this.stack[this.stack.length-1];O1.label=t,O1.identifier=LQ(this.sliceSerialize(V1)).toLowerCase()}function w(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.title=V1}function R(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.url=V1}function O(V1){let t=this.stack[this.stack.length-1];if(!t.depth){let O1=this.sliceSerialize(V1).length;t.depth=O1}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function $(V1){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(V1).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function I(V1){let O1=this.stack[this.stack.length-1].children,M1=O1[O1.length-1];if(!M1||M1.type!=="text")M1=d1(),M1.position={start:AN(V1.start),end:void 0},O1.push(M1);this.stack.push(M1)}function T(V1){let t=this.stack.pop();t.value+=this.sliceSerialize(V1),t.position.end=AN(V1.end)}function S(V1){let t=this.stack[this.stack.length-1];if(this.data.atHardBreak){let O1=t.children[t.children.length-1];O1.position.end=AN(V1.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&Q.canContainEols.includes(t.type))I.call(this,V1),T.call(this,V1)}function x(){this.data.atHardBreak=!0}function h(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.value=V1}function v(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.value=V1}function _(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.value=V1}function b(){let V1=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";V1.type+="Reference",V1.referenceType=t,delete V1.url,delete V1.title}else delete V1.identifier,delete V1.label;this.data.referenceType=void 0}function g(){let V1=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";V1.type+="Reference",V1.referenceType=t,delete V1.url,delete V1.title}else delete V1.identifier,delete V1.label;this.data.referenceType=void 0}function k(V1){let t=this.sliceSerialize(V1),O1=this.stack[this.stack.length-2];O1.label=nJ1(t),O1.identifier=LQ(t).toLowerCase()}function y(){let V1=this.stack[this.stack.length-1],t=this.resume(),O1=this.stack[this.stack.length-1];if(this.data.inReference=!0,O1.type==="link"){let M1=V1.children;O1.children=M1}else O1.alt=t}function f(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.url=V1}function m(){let V1=this.resume(),t=this.stack[this.stack.length-1];t.title=V1}function n(){this.data.inReference=void 0}function p(){this.data.referenceType="collapsed"}function e(V1){let t=this.resume(),O1=this.stack[this.stack.length-1];O1.label=t,O1.identifier=LQ(this.sliceSerialize(V1)).toLowerCase(),this.data.referenceType="full"}function G1(V1){this.data.characterReferenceType=V1.type}function U1(V1){let t=this.sliceSerialize(V1),O1=this.data.characterReferenceType,M1;if(O1)M1=fJ1(t,O1==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0;else M1=cC(t);let I1=this.stack[this.stack.length-1];I1.value+=M1}function Z1(V1){let t=this.stack.pop();t.position.end=AN(V1.end)}function F1(V1){T.call(this,V1);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(V1)}function l(V1){T.call(this,V1);let t=this.stack[this.stack.length-1];t.url="mailto:"+this.sliceSerialize(V1)}function d(){return{type:"blockquote",children:[]}}function i(){return{type:"code",lang:null,meta:null,value:""}}function r(){return{type:"inlineCode",value:""}}function o(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Y1(){return{type:"emphasis",children:[]}}function J1(){return{type:"heading",depth:0,children:[]}}function H1(){return{type:"break"}}function z1(){return{type:"html",value:""}}function W1(){return{type:"image",title:null,url:"",alt:null}}function w1(){return{type:"link",title:null,url:"",children:[]}}function D1(V1){return{type:"list",ordered:V1.type==="listOrdered",start:null,spread:V1._spread,children:[]}}function y1(V1){return{type:"listItem",spread:V1._spread,checked:null,children:[]}}function l1(){return{type:"paragraph",children:[]}}function s1(){return{type:"strong",children:[]}}function d1(){return{type:"text",value:""}}function r1(){return{type:"thematicBreak"}}}function AN(J){return{line:J.line,column:J.column,offset:J.offset}}function Tz6(J,Q){let Z=-1;while(++Z<Q.length){let X=Q[Z];if(Array.isArray(X))Tz6(J,X);else KU9(J,X)}}function KU9(J,Q){let Z;for(Z in Q)if(Pz6.call(Q,Z))switch(Z){case"canContainEols":{let X=Q[Z];if(X)J[Z].push(...X);break}case"transforms":{let X=Q[Z];if(X)J[Z].push(...X);break}case"enter":case"exit":{let X=Q[Z];if(X)Object.assign(J[Z],X);break}}}function Iz6(J,Q){if(J)throw Error("Cannot close `"+J.type+"` ("+LN({start:J.start,end:J.end})+"): a different token (`"+Q.type+"`, "+LN({start:Q.start,end:Q.end})+") is open");else throw Error("Cannot close document, a token (`"+Q.type+"`, "+LN({start:Q.start,end:Q.end})+") is still open")}function aJ1(J){let Q=this;Q.parser=Z;function Z(X){return og1(X,{...Q.data("settings"),...J,extensions:Q.data("micromarkExtensions")||[],mdastExtensions:Q.data("fromMarkdownExtensions")||[]})}}var Cz6={}.hasOwnProperty;function Sz6(J,Q){let Z=Q||{};function X(Y,...K){let{invalid:G,handlers:q}=X;if(Y&&Cz6.call(Y,J)){let z=String(Y[J]);G=Cz6.call(q,z)?q[z]:X.unknown}if(G)return G.call(this,Y,...K)}return X.handlers=Z.handlers||{},X.invalid=Z.invalid,X.unknown=Z.unknown,X}var GU9={}.hasOwnProperty;function tg1(J,Q){let Z=-1,X;if(Q.extensions)while(++Z<Q.extensions.length)tg1(J,Q.extensions[Z]);for(X in Q)if(GU9.call(Q,X))switch(X){case"extensions":break;case"unsafe":{vz6(J[X],Q[X]);break}case"join":{vz6(J[X],Q[X]);break}case"handlers":{qU9(J[X],Q[X]);break}default:J.options[X]=Q[X]}return J}function vz6(J,Q){if(Q)J.push(...Q)}function qU9(J,Q){if(Q)Object.assign(J,Q)}function kz6(J,Q,Z,X){let Y=Z.enter("blockquote"),K=Z.createTracker(X);K.move("> "),K.shift(2);let G=Z.indentLines(Z.containerFlow(J,K.current()),zU9);return Y(),G}function zU9(J,Q,Z){return">"+(Z?"":" ")+J}function rJ1(J,Q){return _z6(J,Q.inConstruct,!0)&&!_z6(J,Q.notInConstruct,!1)}function _z6(J,Q,Z){if(typeof Q==="string")Q=[Q];if(!Q||Q.length===0)return Z;let X=-1;while(++X<Q.length)if(J.includes(Q[X]))return!0;return!1}function eg1(J,Q,Z,X){let Y=-1;while(++Y<Z.unsafe.length)if(Z.unsafe[Y].character===`
|
|
@@ -6490,52 +6490,52 @@ The context used was: `+J.widget.constructor.name);return Q}updateShouldNotify(J
|
|
|
6490
6490
|
`:" ")+K.indentLines(K.containerFlow(X,q.current()),Q?AU6:qW9));return U(),z}}function qW9(J,Q,Z){return Q===0?J:AU6(J,Q,Z)}function AU6(J,Q,Z){return(Z?"":" ")+J}var zW9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];wU6.peek=FW9;function km1(){return{canContainEols:["delete"],enter:{strikethrough:UW9},exit:{strikethrough:WW9}}}function _m1(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:zW9}],handlers:{delete:wU6}}}function UW9(J){this.enter({type:"delete",children:[]},J)}function WW9(J){this.exit(J)}function wU6(J,Q,Z,X){let Y=Z.createTracker(X),K=Z.enter("strikethrough"),G=Y.move("~~");return G+=Z.containerPhrasing(J,{...Y.current(),before:G,after:"~"}),G+=Y.move("~~"),K(),G}function FW9(){return"~"}function HW9(J){return J.length}function OU6(J,Q){let Z=Q||{},X=(Z.align||[]).concat(),Y=Z.stringLength||HW9,K=[],G=[],q=[],z=[],U=0,W=-1;while(++W<J.length){let V=[],N=[],L=-1;if(J[W].length>U)U=J[W].length;while(++L<J[W].length){let A=BW9(J[W][L]);if(Z.alignDelimiters!==!1){let w=Y(A);if(N[L]=w,z[L]===void 0||w>z[L])z[L]=w}V.push(A)}G[W]=V,q[W]=N}let F=-1;if(typeof X==="object"&&"length"in X)while(++F<U)K[F]=RU6(X[F]);else{let V=RU6(X);while(++F<U)K[F]=V}F=-1;let H=[],B=[];while(++F<U){let V=K[F],N="",L="";if(V===99)N=":",L=":";else if(V===108)N=":";else if(V===114)L=":";let A=Z.alignDelimiters===!1?1:Math.max(1,z[F]-N.length-L.length),w=N+"-".repeat(A)+L;if(Z.alignDelimiters!==!1){if(A=N.length+A+L.length,A>z[F])z[F]=A;B[F]=A}H[F]=w}G.splice(1,0,H),q.splice(1,0,B),W=-1;let M=[];while(++W<G.length){let V=G[W],N=q[W];F=-1;let L=[];while(++F<U){let A=V[F]||"",w="",R="";if(Z.alignDelimiters!==!1){let O=z[F]-(N[F]||0),j=K[F];if(j===114)w=" ".repeat(O);else if(j===99)if(O%2)w=" ".repeat(O/2+0.5),R=" ".repeat(O/2-0.5);else w=" ".repeat(O/2),R=w;else R=" ".repeat(O)}if(Z.delimiterStart!==!1&&!F)L.push("|");if(Z.padding!==!1&&!(Z.alignDelimiters===!1&&A==="")&&(Z.delimiterStart!==!1||F))L.push(" ");if(Z.alignDelimiters!==!1)L.push(w);if(L.push(A),Z.alignDelimiters!==!1)L.push(R);if(Z.padding!==!1)L.push(" ");if(Z.delimiterEnd!==!1||F!==U-1)L.push("|")}M.push(Z.delimiterEnd===!1?L.join("").replace(/ +$/,""):L.join(""))}return M.join(`
|
|
6491
6491
|
`)}function BW9(J){return J===null||J===void 0?"":String(J)}function RU6(J){let Q=typeof J==="string"?J.codePointAt(0):0;return Q===67||Q===99?99:Q===76||Q===108?108:Q===82||Q===114?114:0}function bm1(){return{enter:{table:DW9,tableData:jU6,tableHeader:jU6,tableRow:VW9},exit:{codeText:NW9,table:MW9,tableData:xm1,tableHeader:xm1,tableRow:xm1}}}function DW9(J){let Q=J._align;SJ(Q,"expected `_align` on table"),this.enter({type:"table",align:Q.map(function(Z){return Z==="none"?null:Z}),children:[]},J),this.data.inTable=!0}function MW9(J){this.exit(J),this.data.inTable=void 0}function VW9(J){this.enter({type:"tableRow",children:[]},J)}function xm1(J){this.exit(J)}function jU6(J){this.enter({type:"tableCell",children:[]},J)}function NW9(J){let Q=this.resume();if(this.data.inTable)Q=Q.replace(/\\([\\|])/g,LW9);let Z=this.stack[this.stack.length-1];SJ(Z.type==="inlineCode"),Z.value=Q,this.exit(J)}function LW9(J,Q){return Q==="|"?Q:J}function ym1(J){let Q=J||{},Z=Q.tableCellPadding,X=Q.tablePipeAlign,Y=Q.stringLength,K=Z?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
6492
6492
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:H,table:G,tableCell:z,tableRow:q}};function G(B,M,V,N){return U(W(B,V,N),B.align)}function q(B,M,V,N){let L=F(B,V,N),A=U([L]);return A.slice(0,A.indexOf(`
|
|
6493
|
-
`))}function z(B,M,V,N){let L=V.enter("tableCell"),A=V.enter("phrasing"),w=V.containerPhrasing(B,{...N,before:K,after:K});return A(),L(),w}function U(B,M){return OU6(B,{align:M,alignDelimiters:X,padding:Z,stringLength:Y})}function W(B,M,V){let N=B.children,L=-1,A=[],w=M.enter("table");while(++L<N.length)A[L]=F(N[L],M,V);return w(),A}function F(B,M,V){let N=B.children,L=-1,A=[],w=M.enter("tableRow");while(++L<N.length)A[L]=z(N[L],B,M,V);return w(),A}function H(B,M,V){let N=bR.inlineCode(B,M,V);if(V.stack.includes("tableCell"))N=N.replace(/\|/g,"\\$&");return N}}function fm1(){return{exit:{taskListCheckValueChecked:$U6,taskListCheckValueUnchecked:$U6,paragraph:AW9}}}function hm1(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wW9}}}function $U6(J){let Q=this.stack[this.stack.length-2];SJ(Q.type==="listItem"),Q.checked=J.type==="taskListCheckValueChecked"}function AW9(J){let Q=this.stack[this.stack.length-2];if(Q&&Q.type==="listItem"&&typeof Q.checked==="boolean"){let Z=this.stack[this.stack.length-1];SJ(Z.type==="paragraph");let X=Z.children[0];if(X&&X.type==="text"){let Y=Q.children,K=-1,G;while(++K<Y.length){let q=Y[K];if(q.type==="paragraph"){G=q;break}}if(G===Z){if(X.value=X.value.slice(1),X.value.length===0)Z.children.shift();else if(Z.position&&X.position&&typeof X.position.start.offset==="number")X.position.start.column++,X.position.start.offset++,Z.position.start=Object.assign({},X.position.start)}}}this.exit(J)}function wW9(J,Q,Z,X){let Y=J.children[0],K=typeof J.checked==="boolean"&&Y&&Y.type==="paragraph",G="["+(J.checked?"x":" ")+"] ",q=Z.createTracker(X);if(K)q.move(G);let z=bR.listItem(J,Q,Z,{...X,...q.current()});if(K)z=z.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,U);return z;function U(W){return W+G}}function gm1(){return[Tm1(),Sm1(),km1(),bm1(),fm1()]}function mm1(J){return{extensions:[Cm1(),vm1(J),_m1(),ym1(J),hm1()]}}var RW9={tokenize:IW9,partial:!0},EU6={tokenize:PW9,partial:!0},IU6={tokenize:TW9,partial:!0},PU6={tokenize:CW9,partial:!0},OW9={tokenize:SW9,partial:!0},TU6={name:"wwwAutolink",tokenize:$W9,previous:SU6},CU6={name:"protocolAutolink",tokenize:EW9,previous:vU6},KB={name:"emailAutolink",tokenize:jW9,previous:kU6},zW={};function pm1(){return{text:zW}}var fR=48;while(fR<123)if(zW[fR]=KB,fR++,fR===58)fR=65;else if(fR===91)fR=97;zW[43]=KB;zW[45]=KB;zW[46]=KB;zW[95]=KB;zW[72]=[KB,CU6];zW[104]=[KB,CU6];zW[87]=[KB,TU6];zW[119]=[KB,TU6];function jW9(J,Q,Z){let X=this,Y,K;return G;function G(F){if(!um1(F)||!kU6.call(X,X.previous)||dm1(X.events))return Z(F);return J.enter("literalAutolink"),J.enter("literalAutolinkEmail"),q(F)}function q(F){if(um1(F))return J.consume(F),q;if(F===64)return J.consume(F),z;return Z(F)}function z(F){if(F===46)return J.check(OW9,W,U)(F);if(F===45||F===95||T5(F))return K=!0,J.consume(F),z;return W(F)}function U(F){return J.consume(F),Y=!0,z}function W(F){if(K&&Y&&P5(X.previous))return J.exit("literalAutolinkEmail"),J.exit("literalAutolink"),Q(F);return Z(F)}}function $W9(J,Q,Z){let X=this;return Y;function Y(G){if(G!==87&&G!==119||!SU6.call(X,X.previous)||dm1(X.events))return Z(G);return J.enter("literalAutolink"),J.enter("literalAutolinkWww"),J.check(RW9,J.attempt(EU6,J.attempt(IU6,K),Z),Z)(G)}function K(G){return J.exit("literalAutolinkWww"),J.exit("literalAutolink"),Q(G)}}function EW9(J,Q,Z){let X=this,Y="",K=!1;return G;function G(F){if((F===72||F===104)&&vU6.call(X,X.previous)&&!dm1(X.events))return J.enter("literalAutolink"),J.enter("literalAutolinkHttp"),Y+=String.fromCodePoint(F),J.consume(F),q;return Z(F)}function q(F){if(P5(F)&&Y.length<5)return Y+=String.fromCodePoint(F),J.consume(F),q;if(F===58){let H=Y.toLowerCase();if(H==="http"||H==="https")return J.consume(F),z}return Z(F)}function z(F){if(F===47){if(J.consume(F),K)return U;return K=!0,z}return Z(F)}function U(F){return F===null||CR(F)||R9(F)||GW(F)||SR(F)?Z(F):J.attempt(EU6,J.attempt(IU6,W),Z)(F)}function W(F){return J.exit("literalAutolinkHttp"),J.exit("literalAutolink"),Q(F)}}function IW9(J,Q,Z){let X=0;return Y;function Y(G){if((G===87||G===119)&&X<3)return X++,J.consume(G),Y;if(G===46&&X===3)return J.consume(G),K;return Z(G)}function K(G){return G===null?Z(G):Q(G)}}function PW9(J,Q,Z){let X,Y,K;return G;function G(U){if(U===46||U===95)return J.check(PU6,z,q)(U);if(U===null||R9(U)||GW(U)||U!==45&&SR(U))return z(U);return K=!0,J.consume(U),G}function q(U){if(U===95)X=!0;else Y=X,X=void 0;return J.consume(U),G}function z(U){if(Y||X||!K)return Z(U);return Q(U)}}function TW9(J,Q){let Z=0,X=0;return Y;function Y(G){if(G===40)return Z++,J.consume(G),Y;if(G===41&&X<Z)return K(G);if(G===33||G===34||G===38||G===39||G===41||G===42||G===44||G===46||G===58||G===59||G===60||G===63||G===93||G===95||G===126)return J.check(PU6,Q,K)(G);if(G===null||R9(G)||GW(G))return Q(G);return J.consume(G),Y}function K(G){if(G===41)X++;return J.consume(G),Y}}function CW9(J,Q,Z){return X;function X(q){if(q===33||q===34||q===39||q===41||q===42||q===44||q===46||q===58||q===59||q===63||q===95||q===126)return J.consume(q),X;if(q===38)return J.consume(q),K;if(q===93)return J.consume(q),Y;if(q===60||q===null||R9(q)||GW(q))return Q(q);return Z(q)}function Y(q){if(q===null||q===40||q===91||R9(q)||GW(q))return Q(q);return X(q)}function K(q){return P5(q)?G(q):Z(q)}function G(q){if(q===59)return J.consume(q),X;if(P5(q))return J.consume(q),G;return Z(q)}}function SW9(J,Q,Z){return X;function X(K){return J.consume(K),Y}function Y(K){return T5(K)?Z(K):Q(K)}}function SU6(J){return J===null||J===40||J===42||J===95||J===91||J===93||J===126||R9(J)}function vU6(J){return!P5(J)}function kU6(J){return!(J===47||um1(J))}function um1(J){return J===43||J===45||J===46||J===95||T5(J)}function dm1(J){let Q=J.length,Z=!1;while(Q--){let X=J[Q][1];if((X.type==="labelLink"||X.type==="labelImage")&&!X._balanced){Z=!0;break}if(X._gfmAutolinkLiteralWalkedInto){Z=!1;break}}if(J.length>0&&!Z)J[J.length-1][1]._gfmAutolinkLiteralWalkedInto=!0;return Z}var vW9={tokenize:hW9,partial:!0};function cm1(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:bW9,continuation:{tokenize:yW9},exit:fW9}},text:{[91]:{name:"gfmFootnoteCall",tokenize:xW9},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kW9,resolveTo:_W9}}}}function kW9(J,Q,Z){let X=this,Y=X.events.length,K=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),G;while(Y--){let z=X.events[Y][1];if(z.type==="labelImage"){G=z;break}if(z.type==="gfmFootnoteCall"||z.type==="labelLink"||z.type==="label"||z.type==="image"||z.type==="link")break}return q;function q(z){if(!G||!G._balanced)return Z(z);let U=LQ(X.sliceSerialize({start:G.end,end:X.now()}));if(U.codePointAt(0)!==94||!K.includes(U.slice(1)))return Z(z);return J.enter("gfmFootnoteCallLabelMarker"),J.consume(z),J.exit("gfmFootnoteCallLabelMarker"),Q(z)}}function _W9(J,Q){let Z=J.length,X;while(Z--)if(J[Z][1].type==="labelImage"&&J[Z][0]==="enter"){X=J[Z][1];break}J[Z+1][1].type="data",J[Z+3][1].type="gfmFootnoteCallLabelMarker";let Y={type:"gfmFootnoteCall",start:Object.assign({},J[Z+3][1].start),end:Object.assign({},J[J.length-1][1].end)},K={type:"gfmFootnoteCallMarker",start:Object.assign({},J[Z+3][1].end),end:Object.assign({},J[Z+3][1].end)};K.end.column++,K.end.offset++,K.end._bufferIndex++;let G={type:"gfmFootnoteCallString",start:Object.assign({},K.end),end:Object.assign({},J[J.length-1][1].start)},q={type:"chunkString",contentType:"string",start:Object.assign({},G.start),end:Object.assign({},G.end)},z=[J[Z+1],J[Z+2],["enter",Y,Q],J[Z+3],J[Z+4],["enter",K,Q],["exit",K,Q],["enter",G,Q],["enter",q,Q],["exit",q,Q],["exit",G,Q],J[J.length-2],J[J.length-1],["exit",Y,Q]];return J.splice(Z,J.length-Z+1,...z),J}function xW9(J,Q,Z){let X=this,Y=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),K=0,G;return q;function q(F){return J.enter("gfmFootnoteCall"),J.enter("gfmFootnoteCallLabelMarker"),J.consume(F),J.exit("gfmFootnoteCallLabelMarker"),z}function z(F){if(F!==94)return Z(F);return J.enter("gfmFootnoteCallMarker"),J.consume(F),J.exit("gfmFootnoteCallMarker"),J.enter("gfmFootnoteCallString"),J.enter("chunkString").contentType="string",U}function U(F){if(K>999||F===93&&!G||F===null||F===91||R9(F))return Z(F);if(F===93){J.exit("chunkString");let H=J.exit("gfmFootnoteCallString");if(!Y.includes(LQ(X.sliceSerialize(H))))return Z(F);return J.enter("gfmFootnoteCallLabelMarker"),J.consume(F),J.exit("gfmFootnoteCallLabelMarker"),J.exit("gfmFootnoteCall"),Q}if(!R9(F))G=!0;return K++,J.consume(F),F===92?W:U}function W(F){if(F===91||F===92||F===93)return J.consume(F),K++,U;return U(F)}}function bW9(J,Q,Z){let X=this,Y=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),K,G=0,q;return z;function z(M){return J.enter("gfmFootnoteDefinition")._container=!0,J.enter("gfmFootnoteDefinitionLabel"),J.enter("gfmFootnoteDefinitionLabelMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionLabelMarker"),U}function U(M){if(M===94)return J.enter("gfmFootnoteDefinitionMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionMarker"),J.enter("gfmFootnoteDefinitionLabelString"),J.enter("chunkString").contentType="string",W;return Z(M)}function W(M){if(G>999||M===93&&!q||M===null||M===91||R9(M))return Z(M);if(M===93){J.exit("chunkString");let V=J.exit("gfmFootnoteDefinitionLabelString");return K=LQ(X.sliceSerialize(V)),J.enter("gfmFootnoteDefinitionLabelMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionLabelMarker"),J.exit("gfmFootnoteDefinitionLabel"),H}if(!R9(M))q=!0;return G++,J.consume(M),M===92?F:W}function F(M){if(M===91||M===92||M===93)return J.consume(M),G++,W;return W(M)}function H(M){if(M===58){if(J.enter("definitionMarker"),J.consume(M),J.exit("definitionMarker"),!Y.includes(K))Y.push(K);return G8(J,B,"gfmFootnoteDefinitionWhitespace")}return Z(M)}function B(M){return Q(M)}}function yW9(J,Q,Z){return J.check(qW,Q,J.attempt(vW9,Q,Z))}function fW9(J){J.exit("gfmFootnoteDefinition")}function hW9(J,Q,Z){let X=this;return G8(J,Y,"gfmFootnoteDefinitionIndent",5);function Y(K){let G=X.events[X.events.length-1];return G&&G[1].type==="gfmFootnoteDefinitionIndent"&&G[2].sliceSerialize(G[1],!0).length===4?Q(K):Z(K)}}function lm1(J){let Z=(J||{}).singleTilde,X={name:"strikethrough",tokenize:K,resolveAll:Y};if(Z===null||Z===void 0)Z=!0;return{text:{[126]:X},insideSpan:{null:[X]},attentionMarkers:{null:[126]}};function Y(G,q){let z=-1;while(++z<G.length)if(G[z][0]==="enter"&&G[z][1].type==="strikethroughSequenceTemporary"&&G[z][1]._close){let U=z;while(U--)if(G[U][0]==="exit"&&G[U][1].type==="strikethroughSequenceTemporary"&&G[U][1]._open&&G[z][1].end.offset-G[z][1].start.offset===G[U][1].end.offset-G[U][1].start.offset){G[z][1].type="strikethroughSequence",G[U][1].type="strikethroughSequence";let W={type:"strikethrough",start:Object.assign({},G[U][1].start),end:Object.assign({},G[z][1].end)},F={type:"strikethroughText",start:Object.assign({},G[U][1].end),end:Object.assign({},G[z][1].start)},H=[["enter",W,q],["enter",G[U][1],q],["exit",G[U][1],q],["enter",F,q]],B=q.parser.constructs.insideSpan.null;if(B)E7(H,H.length,0,NN(B,G.slice(U+1,z),q));E7(H,H.length,0,[["exit",F,q],["enter",G[z][1],q],["exit",G[z][1],q],["exit",W,q]]),E7(G,U-1,z-U+3,H),z=U+H.length-2;break}}z=-1;while(++z<G.length)if(G[z][1].type==="strikethroughSequenceTemporary")G[z][1].type="data";return G}function K(G,q,z){let U=this.previous,W=this.events,F=0;return H;function H(M){if(U===126&&W[W.length-1][1].type!=="characterEscape")return z(M);return G.enter("strikethroughSequenceTemporary"),B(M)}function B(M){let V=YB(U);if(M===126){if(F>1)return z(M);return G.consume(M),F++,B}if(F<2&&!Z)return z(M);let N=G.exit("strikethroughSequenceTemporary"),L=YB(M);return N._open=!L||L===2&&Boolean(V),N._close=!V||V===2&&Boolean(L),q(M)}}}class im1{constructor(){this.map=[]}add(J,Q,Z){gW9(this,J,Q,Z)}consume(J){if(this.map.sort(function(Y,K){return Y[0]-K[0]}),this.map.length===0)return;let Q=this.map.length,Z=[];while(Q>0)Q-=1,Z.push(J.slice(this.map[Q][0]+this.map[Q][1]),this.map[Q][2]),J.length=this.map[Q][0];Z.push(J.slice()),J.length=0;let X=Z.pop();while(X){for(let Y of X)J.push(Y);X=Z.pop()}this.map.length=0}}function gW9(J,Q,Z,X){let Y=0;if(Z===0&&X.length===0)return;while(Y<J.map.length){if(J.map[Y][0]===Q){J.map[Y][1]+=Z,J.map[Y][2].push(...X);return}Y+=1}J.map.push([Q,Z,X])}function _U6(J,Q){let Z=!1,X=[];while(Q<J.length){let Y=J[Q];if(Z){if(Y[0]==="enter"){if(Y[1].type==="tableContent")X.push(J[Q+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(Y[1].type==="tableContent"){if(J[Q-1][1].type==="tableDelimiterMarker"){let K=X.length-1;X[K]=X[K]==="left"?"center":"right"}}else if(Y[1].type==="tableDelimiterRow")break}else if(Y[0]==="enter"&&Y[1].type==="tableDelimiterRow")Z=!0;Q+=1}return X}function nm1(){return{flow:{null:{name:"table",tokenize:mW9,resolveAll:uW9}}}}function mW9(J,Q,Z){let X=this,Y=0,K=0,G;return q;function q(T){let S=X.events.length-1;while(S>-1){let v=X.events[S][1].type;if(v==="lineEnding"||v==="linePrefix")S--;else break}let x=S>-1?X.events[S][1].type:null,h=x==="tableHead"||x==="tableRow"?j:z;if(h===j&&X.parser.lazy[X.now().line])return Z(T);return h(T)}function z(T){return J.enter("tableHead"),J.enter("tableRow"),U(T)}function U(T){if(T===124)return W(T);return G=!0,K+=1,W(T)}function W(T){if(T===null)return Z(T);if(D6(T)){if(K>1)return K=0,X.interrupt=!0,J.exit("tableRow"),J.enter("lineEnding"),J.consume(T),J.exit("lineEnding"),B;return Z(T)}if(W8(T))return G8(J,W,"whitespace")(T);if(K+=1,G)G=!1,Y+=1;if(T===124)return J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),G=!0,W;return J.enter("data"),F(T)}function F(T){if(T===null||T===124||R9(T))return J.exit("data"),W(T);return J.consume(T),T===92?H:F}function H(T){if(T===92||T===124)return J.consume(T),F;return F(T)}function B(T){if(X.interrupt=!1,X.parser.lazy[X.now().line])return Z(T);if(J.enter("tableDelimiterRow"),G=!1,W8(T))return G8(J,M,"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T);return M(T)}function M(T){if(T===45||T===58)return N(T);if(T===124)return G=!0,J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),V;return O(T)}function V(T){if(W8(T))return G8(J,N,"whitespace")(T);return N(T)}function N(T){if(T===58)return K+=1,G=!0,J.enter("tableDelimiterMarker"),J.consume(T),J.exit("tableDelimiterMarker"),L;if(T===45)return K+=1,L(T);if(T===null||D6(T))return R(T);return O(T)}function L(T){if(T===45)return J.enter("tableDelimiterFiller"),A(T);return O(T)}function A(T){if(T===45)return J.consume(T),A;if(T===58)return G=!0,J.exit("tableDelimiterFiller"),J.enter("tableDelimiterMarker"),J.consume(T),J.exit("tableDelimiterMarker"),w;return J.exit("tableDelimiterFiller"),w(T)}function w(T){if(W8(T))return G8(J,R,"whitespace")(T);return R(T)}function R(T){if(T===124)return M(T);if(T===null||D6(T)){if(!G||Y!==K)return O(T);return J.exit("tableDelimiterRow"),J.exit("tableHead"),Q(T)}return O(T)}function O(T){return Z(T)}function j(T){return J.enter("tableRow"),$(T)}function $(T){if(T===124)return J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),$;if(T===null||D6(T))return J.exit("tableRow"),Q(T);if(W8(T))return G8(J,$,"whitespace")(T);return J.enter("data"),E(T)}function E(T){if(T===null||T===124||R9(T))return J.exit("data"),$(T);return J.consume(T),T===92?I:E}function I(T){if(T===92||T===124)return J.consume(T),E;return E(T)}}function uW9(J,Q){let Z=-1,X=!0,Y=0,K=[0,0,0,0],G=[0,0,0,0],q=!1,z=0,U,W,F,H=new im1;while(++Z<J.length){let B=J[Z],M=B[1];if(B[0]==="enter"){if(M.type==="tableHead"){if(q=!1,z!==0)xU6(H,Q,z,U,W),W=void 0,z=0;U={type:"table",start:Object.assign({},M.start),end:Object.assign({},M.end)},H.add(Z,0,[["enter",U,Q]])}else if(M.type==="tableRow"||M.type==="tableDelimiterRow"){if(X=!0,F=void 0,K=[0,0,0,0],G=[0,Z+1,0,0],q)q=!1,W={type:"tableBody",start:Object.assign({},M.start),end:Object.assign({},M.end)},H.add(Z,0,[["enter",W,Q]]);Y=M.type==="tableDelimiterRow"?2:W?3:1}else if(Y&&(M.type==="data"||M.type==="tableDelimiterMarker"||M.type==="tableDelimiterFiller")){if(X=!1,G[2]===0){if(K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,void 0,F),K=[0,0,0,0];G[2]=Z}}else if(M.type==="tableCellDivider")if(X)X=!1;else{if(K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,void 0,F);K=G,G=[K[1],Z,0,0]}}else if(M.type==="tableHead")q=!0,z=Z;else if(M.type==="tableRow"||M.type==="tableDelimiterRow"){if(z=Z,K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,Z,F);else if(G[1]!==0)F=GQ1(H,Q,G,Y,Z,F);Y=0}else if(Y&&(M.type==="data"||M.type==="tableDelimiterMarker"||M.type==="tableDelimiterFiller"))G[3]=Z}if(z!==0)xU6(H,Q,z,U,W);H.consume(Q.events),Z=-1;while(++Z<Q.events.length){let B=Q.events[Z];if(B[0]==="enter"&&B[1].type==="table")B[1]._align=_U6(Q.events,Z)}return J}function GQ1(J,Q,Z,X,Y,K){let G=X===1?"tableHeader":X===2?"tableDelimiter":"tableData",q="tableContent";if(Z[0]!==0)K.end=Object.assign({},aC(Q.events,Z[0])),J.add(Z[0],0,[["exit",K,Q]]);let z=aC(Q.events,Z[1]);if(K={type:G,start:Object.assign({},z),end:Object.assign({},z)},J.add(Z[1],0,[["enter",K,Q]]),Z[2]!==0){let U=aC(Q.events,Z[2]),W=aC(Q.events,Z[3]),F={type:"tableContent",start:Object.assign({},U),end:Object.assign({},W)};if(J.add(Z[2],0,[["enter",F,Q]]),X!==2){let H=Q.events[Z[2]],B=Q.events[Z[3]];if(H[1].end=Object.assign({},B[1].end),H[1].type="chunkText",H[1].contentType="text",Z[3]>Z[2]+1){let M=Z[2]+1,V=Z[3]-Z[2]-1;J.add(M,V,[])}}J.add(Z[3]+1,0,[["exit",F,Q]])}if(Y!==void 0)K.end=Object.assign({},aC(Q.events,Y)),J.add(Y,0,[["exit",K,Q]]),K=void 0;return K}function xU6(J,Q,Z,X,Y){let K=[],G=aC(Q.events,Z);if(Y)Y.end=Object.assign({},G),K.push(["exit",Y,Q]);X.end=Object.assign({},G),K.push(["exit",X,Q]),J.add(Z+1,0,K)}function aC(J,Q){let Z=J[Q],X=Z[0]==="enter"?"start":"end";return Z[1][X]}var pW9={name:"tasklistCheck",tokenize:dW9};function am1(){return{text:{[91]:pW9}}}function dW9(J,Q,Z){let X=this;return Y;function Y(z){if(X.previous!==null||!X._gfmTasklistFirstContentOfListItem)return Z(z);return J.enter("taskListCheck"),J.enter("taskListCheckMarker"),J.consume(z),J.exit("taskListCheckMarker"),K}function K(z){if(R9(z))return J.enter("taskListCheckValueUnchecked"),J.consume(z),J.exit("taskListCheckValueUnchecked"),G;if(z===88||z===120)return J.enter("taskListCheckValueChecked"),J.consume(z),J.exit("taskListCheckValueChecked"),G;return Z(z)}function G(z){if(z===93)return J.enter("taskListCheckMarker"),J.consume(z),J.exit("taskListCheckMarker"),J.exit("taskListCheck"),q;return Z(z)}function q(z){if(D6(z))return Q(z);if(W8(z))return J.check({tokenize:cW9},Q,Z)(z);return Z(z)}}function cW9(J,Q,Z){return G8(J,X,"whitespace");function X(Y){return Y===null?Z(Y):Q(Y)}}function bU6(J){return yJ1([pm1(),cm1(),lm1(J),nm1(),am1()])}var lW9={};function qQ1(J){let Q=this,Z=J||lW9,X=Q.data(),Y=X.micromarkExtensions||(X.micromarkExtensions=[]),K=X.fromMarkdownExtensions||(X.fromMarkdownExtensions=[]),G=X.toMarkdownExtensions||(X.toMarkdownExtensions=[]);Y.push(bU6(Z)),K.push(gm1()),G.push(mm1(Z))}DR();b2();G9();class rm1 extends OY{rows;columnConfigs;borderColor;showBorders;cellPadding;constructor({key:J,rows:Q,columnConfigs:Z,borderColor:X,showBorders:Y=!0,cellPadding:K=V0.symmetric(1,0)}){let G=[];for(let q of Q)for(let z of q.cells){let U=new x6({padding:K,child:z.child});G.push(U)}super({key:J,children:G});this.rows=Q,this.columnConfigs=Z,this.borderColor=X,this.showBorders=Y,this.cellPadding=K}createRenderObject(){return new yU6({rows:this.rows,columnConfigs:this.columnConfigs,borderColor:this.borderColor,showBorders:this.showBorders,cellPadding:this.cellPadding})}updateRenderObject(J){J.updateTable({rows:this.rows,columnConfigs:this.columnConfigs,borderColor:this.borderColor,showBorders:this.showBorders,cellPadding:this.cellPadding})}}class yU6 extends Z8{rows;columnConfigs;borderColor;showBorders;cellPadding;columnWidths=[];rowHeights=[];constructor({rows:J,columnConfigs:Q,borderColor:Z,showBorders:X,cellPadding:Y}){super();this.rows=J,this.columnConfigs=Q,this.borderColor=Z,this.showBorders=X,this.cellPadding=Y}updateTable({rows:J,columnConfigs:Q,borderColor:Z,showBorders:X,cellPadding:Y}){this.rows=J,this.columnConfigs=Q,this.borderColor=Z,this.showBorders=X,this.cellPadding=Y,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;if(!J)return;this.columnWidths=this.calculateColumnWidths(J),this.rowHeights=this.calculateRowHeights(),this.layoutCells();let Q=this.getTotalTableWidth(),Z=this.getTotalTableHeight();this.setSize(Q,Z)}calculateColumnWidths(J){let Q=[],Z=0,X=0;for(let Y=0;Y<this.columnConfigs.length;Y++){let K=this.columnConfigs[Y];if(!K)continue;switch(K.widthType){case"fixed":{m6(K.fixedWidth!==void 0,`Fixed width column ${Y} must have fixedWidth specified`);let G=K.fixedWidth;Q[Y]=G,Z+=G;break}case"intrinsic":{let G=this.calculateIntrinsicColumnWidth(Y);Q[Y]=G,Z+=G;break}case"flex":X++,Q[Y]=0;break}}if(X>0){let Y=0;if(this.showBorders)Y+=2,Y+=Math.max(0,this.columnConfigs.length-1);let K=Math.max(0,J.maxWidth-Z-Y),G=Math.floor(K/X);for(let q=0;q<Q.length;q++)if(this.columnConfigs[q]?.widthType==="flex")Q[q]=G}return Q}calculateIntrinsicColumnWidth(J){let Q=0,Z=0;for(let X=0;X<this.rows.length;X++){let Y=this.rows[X];if(!Y)continue;for(let K=0;K<Y.cells.length;K++){if(K===J){let G=Y.cells[K],q=this.children[Z];if(G&&q){let z=q.getMaxIntrinsicWidth(Number.POSITIVE_INFINITY);Q=Math.max(Q,z)}}Z++}}return Q}calculateRowHeights(){let J=[],Q=0;for(let Z=0;Z<this.rows.length;Z++){let X=this.rows[Z];if(!X)continue;let Y=1;for(let K=0;K<X.cells.length;K++){let G=X.cells[K],q=this.children[Q],z=this.columnWidths[K];if(!G||!q){Q++;continue}let U=this.measureCellHeight(q,z||0);Y=Math.max(Y,U),Q++}J[Z]=Y}return J}layoutCells(){let J=0;for(let Q=0;Q<this.rows.length;Q++){let Z=this.rows[Q];if(!Z)continue;for(let X=0;X<Z.cells.length;X++){let Y=Z.cells[X],K=this.children[J];if(!Y||!K){J++;continue}let G=this.columnWidths[X]||0,q=this.rowHeights[Q]||1,z=w6.tight(G,q);K.layout(z);let U=this.getColumnOffset(X),W=this.getRowOffset(Q),F=U,H=W;K.setOffset(F,H),J++}}}getTotalTableWidth(){let Q=this.columnWidths.reduce((Z,X)=>Z+X,0);if(this.showBorders)Q+=2,Q+=Math.max(0,this.columnWidths.length-1);return Q}getTotalTableHeight(){let Q=this.rowHeights.reduce((Z,X)=>Z+X,0);if(this.showBorders)Q+=2,Q+=Math.max(0,this.rowHeights.length-1);return Q}getColumnOffset(J){let Q=this.showBorders?1:0;for(let Z=0;Z<J;Z++)if(Q+=this.columnWidths[Z]||0,this.showBorders)Q+=1;return Q}getRowOffset(J){let Q=this.showBorders?1:0;for(let Z=0;Z<J;Z++)if(Q+=this.rowHeights[Z]||0,this.showBorders)Q+=1;return Q}getMaxIntrinsicWidth(J){let Q=0;for(let Z=0;Z<this.columnConfigs.length;Z++){let X=this.columnConfigs[Z];if(!X)continue;switch(X.widthType){case"fixed":Q+=X.fixedWidth||0;break;case"intrinsic":{let Y=this.calculateIntrinsicColumnWidth(Z);Q+=Y;break}case"flex":Q+=0;break}}if(this.showBorders)Q+=2,Q+=Math.max(0,this.columnConfigs.length-1);return Q}measureCellHeight(J,Q){let Z=new w6(Q,Q,0,Number.POSITIVE_INFINITY);return J.layout(Z),J.size.height}paint(J,Q,Z){let X=Q+this.offset.x,Y=Z+this.offset.y;if(!this.showBorders){super.paint(J,Q,Z);return}this.paintTableBorders(J,X,Y),super.paint(J,Q,Z)}paintTableBorders(J,Q,Z){let X=this.getTotalTableWidth(),Y=this.getTotalTableHeight();this.drawBox(J,Q,Z,X,Y);let K=Z+1;for(let q=0;q<this.rowHeights.length-1;q++){K+=this.rowHeights[q]||0;for(let z=Q+1;z<Q+X-1;z++)J.setCell(z,K,D9("─",{fg:this.borderColor}));J.setCell(Q,K,D9("├",{fg:this.borderColor})),J.setCell(Q+X-1,K,D9("┤",{fg:this.borderColor})),K+=1}let G=Q+1;for(let q=0;q<this.columnWidths.length-1;q++){G+=this.columnWidths[q]||0;for(let z=Z+1;z<Z+Y-1;z++)if(J.getCell(G,z)?.char==="─")J.setCell(G,z,D9("┼",{fg:this.borderColor}));else J.setCell(G,z,D9("│",{fg:this.borderColor}));J.setCell(G,Z,D9("┬",{fg:this.borderColor})),J.setCell(G,Z+Y-1,D9("┴",{fg:this.borderColor})),G+=1}}drawBox(J,Q,Z,X,Y){for(let K=1;K<X-1;K++)J.setCell(Q+K,Z,D9("─",{fg:this.borderColor}));for(let K=1;K<X-1;K++)J.setCell(Q+K,Z+Y-1,D9("─",{fg:this.borderColor}));for(let K=1;K<Y-1;K++)J.setCell(Q,Z+K,D9("│",{fg:this.borderColor}));for(let K=1;K<Y-1;K++)J.setCell(Q+X-1,Z+K,D9("│",{fg:this.borderColor}));J.setCell(Q,Z,D9("╭",{fg:this.borderColor})),J.setCell(Q+X-1,Z,D9("╮",{fg:this.borderColor})),J.setCell(Q,Z+Y-1,D9("╰",{fg:this.borderColor})),J.setCell(Q+X-1,Z+Y-1,D9("╯",{fg:this.borderColor}))}}function fU6(J,Q){return{child:J,alignment:Q}}function hU6(J,Q=!1){return{cells:J.map((X)=>("child"in X)?X:{child:X}),isHeader:Q}}function gU6(J,Q="intrinsic",Z){return{alignment:J,widthType:Q,fixedWidth:Z}}function sm1(){return{text:new $1({color:E1.default()}),inlineCode:new $1({color:E1.yellow,bold:!0}),codeBlock:new $1({color:E1.default()}),tableBorder:E1.index(8),link:new $1({color:E1.blue,underline:!0}),syntaxHighlight:{keyword:E1.blue,string:E1.green,number:E1.yellow,comment:E1.index(8),function:E1.cyan,variable:E1.default(),type:E1.magenta,operator:E1.white}}}class RX extends I6{markdown;textAlign;maxLines;overflow;styleScheme;constructor({key:J,markdown:Q,textAlign:Z="left",maxLines:X,overflow:Y="clip",styleScheme:K}){super(J?{key:J}:{});this.markdown=Q,this.textAlign=Z,this.maxLines=X,this.overflow=Y,this.styleScheme=K}build(J){let Q=this.styleScheme??sm1(),Z=this.key?`${this.key.toString()}-`:void 0,X=nW9(this.markdown,Q,Z);return new i0({crossAxisAlignment:"start",children:X})}}function iW9(J,Q,Z,X,Y){let K=WN.default.languages[Q]||WN.default.languages.clike,G=Y?.copyWith({color:X})??new $1({color:X});if(!K)return[new N1(J,G)];try{let q=zJ1(J,Z,`file.${Q}`),z=[];for(let U of q){let W=U.color??X,F=Y?.copyWith({color:W})??new $1({color:W});z.push(new N1(U.content,F))}return z.length>0?z:[new N1(J,G)]}catch{return[new N1(J,G)]}}function nW9(J,Q,Z){try{let X=VU6().use(qQ1).parse(J);return hR(X,Q,Z)}catch{let X=new N1(J,Q.text),Y=Z?new a7(`${Z}fallback`):void 0;return[new n1({key:Y,text:X,selectable:!0})]}}function hR(J,Q,Z,X=0,Y){let K=[],G=0;switch(J.type){case"root":{let q=J;for(let z=0;z<q.children.length;z++){let U=q.children[z];if(U){if(K.push(...hR(U,Q,Z,X)),z<q.children.length-1)K.push(new n1({text:new N1(`
|
|
6493
|
+
`))}function z(B,M,V,N){let L=V.enter("tableCell"),A=V.enter("phrasing"),w=V.containerPhrasing(B,{...N,before:K,after:K});return A(),L(),w}function U(B,M){return OU6(B,{align:M,alignDelimiters:X,padding:Z,stringLength:Y})}function W(B,M,V){let N=B.children,L=-1,A=[],w=M.enter("table");while(++L<N.length)A[L]=F(N[L],M,V);return w(),A}function F(B,M,V){let N=B.children,L=-1,A=[],w=M.enter("tableRow");while(++L<N.length)A[L]=z(N[L],B,M,V);return w(),A}function H(B,M,V){let N=bR.inlineCode(B,M,V);if(V.stack.includes("tableCell"))N=N.replace(/\|/g,"\\$&");return N}}function fm1(){return{exit:{taskListCheckValueChecked:$U6,taskListCheckValueUnchecked:$U6,paragraph:AW9}}}function hm1(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wW9}}}function $U6(J){let Q=this.stack[this.stack.length-2];SJ(Q.type==="listItem"),Q.checked=J.type==="taskListCheckValueChecked"}function AW9(J){let Q=this.stack[this.stack.length-2];if(Q&&Q.type==="listItem"&&typeof Q.checked==="boolean"){let Z=this.stack[this.stack.length-1];SJ(Z.type==="paragraph");let X=Z.children[0];if(X&&X.type==="text"){let Y=Q.children,K=-1,G;while(++K<Y.length){let q=Y[K];if(q.type==="paragraph"){G=q;break}}if(G===Z){if(X.value=X.value.slice(1),X.value.length===0)Z.children.shift();else if(Z.position&&X.position&&typeof X.position.start.offset==="number")X.position.start.column++,X.position.start.offset++,Z.position.start=Object.assign({},X.position.start)}}}this.exit(J)}function wW9(J,Q,Z,X){let Y=J.children[0],K=typeof J.checked==="boolean"&&Y&&Y.type==="paragraph",G="["+(J.checked?"x":" ")+"] ",q=Z.createTracker(X);if(K)q.move(G);let z=bR.listItem(J,Q,Z,{...X,...q.current()});if(K)z=z.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,U);return z;function U(W){return W+G}}function gm1(){return[Tm1(),Sm1(),km1(),bm1(),fm1()]}function mm1(J){return{extensions:[Cm1(),vm1(J),_m1(),ym1(J),hm1()]}}var RW9={tokenize:IW9,partial:!0},EU6={tokenize:PW9,partial:!0},IU6={tokenize:TW9,partial:!0},PU6={tokenize:CW9,partial:!0},OW9={tokenize:SW9,partial:!0},TU6={name:"wwwAutolink",tokenize:$W9,previous:SU6},CU6={name:"protocolAutolink",tokenize:EW9,previous:vU6},KB={name:"emailAutolink",tokenize:jW9,previous:kU6},zW={};function pm1(){return{text:zW}}var fR=48;while(fR<123)if(zW[fR]=KB,fR++,fR===58)fR=65;else if(fR===91)fR=97;zW[43]=KB;zW[45]=KB;zW[46]=KB;zW[95]=KB;zW[72]=[KB,CU6];zW[104]=[KB,CU6];zW[87]=[KB,TU6];zW[119]=[KB,TU6];function jW9(J,Q,Z){let X=this,Y,K;return G;function G(F){if(!um1(F)||!kU6.call(X,X.previous)||dm1(X.events))return Z(F);return J.enter("literalAutolink"),J.enter("literalAutolinkEmail"),q(F)}function q(F){if(um1(F))return J.consume(F),q;if(F===64)return J.consume(F),z;return Z(F)}function z(F){if(F===46)return J.check(OW9,W,U)(F);if(F===45||F===95||T5(F))return K=!0,J.consume(F),z;return W(F)}function U(F){return J.consume(F),Y=!0,z}function W(F){if(K&&Y&&P5(X.previous))return J.exit("literalAutolinkEmail"),J.exit("literalAutolink"),Q(F);return Z(F)}}function $W9(J,Q,Z){let X=this;return Y;function Y(G){if(G!==87&&G!==119||!SU6.call(X,X.previous)||dm1(X.events))return Z(G);return J.enter("literalAutolink"),J.enter("literalAutolinkWww"),J.check(RW9,J.attempt(EU6,J.attempt(IU6,K),Z),Z)(G)}function K(G){return J.exit("literalAutolinkWww"),J.exit("literalAutolink"),Q(G)}}function EW9(J,Q,Z){let X=this,Y="",K=!1;return G;function G(F){if((F===72||F===104)&&vU6.call(X,X.previous)&&!dm1(X.events))return J.enter("literalAutolink"),J.enter("literalAutolinkHttp"),Y+=String.fromCodePoint(F),J.consume(F),q;return Z(F)}function q(F){if(P5(F)&&Y.length<5)return Y+=String.fromCodePoint(F),J.consume(F),q;if(F===58){let H=Y.toLowerCase();if(H==="http"||H==="https")return J.consume(F),z}return Z(F)}function z(F){if(F===47){if(J.consume(F),K)return U;return K=!0,z}return Z(F)}function U(F){return F===null||CR(F)||R9(F)||GW(F)||SR(F)?Z(F):J.attempt(EU6,J.attempt(IU6,W),Z)(F)}function W(F){return J.exit("literalAutolinkHttp"),J.exit("literalAutolink"),Q(F)}}function IW9(J,Q,Z){let X=0;return Y;function Y(G){if((G===87||G===119)&&X<3)return X++,J.consume(G),Y;if(G===46&&X===3)return J.consume(G),K;return Z(G)}function K(G){return G===null?Z(G):Q(G)}}function PW9(J,Q,Z){let X,Y,K;return G;function G(U){if(U===46||U===95)return J.check(PU6,z,q)(U);if(U===null||R9(U)||GW(U)||U!==45&&SR(U))return z(U);return K=!0,J.consume(U),G}function q(U){if(U===95)X=!0;else Y=X,X=void 0;return J.consume(U),G}function z(U){if(Y||X||!K)return Z(U);return Q(U)}}function TW9(J,Q){let Z=0,X=0;return Y;function Y(G){if(G===40)return Z++,J.consume(G),Y;if(G===41&&X<Z)return K(G);if(G===33||G===34||G===38||G===39||G===41||G===42||G===44||G===46||G===58||G===59||G===60||G===63||G===93||G===95||G===126)return J.check(PU6,Q,K)(G);if(G===null||R9(G)||GW(G))return Q(G);return J.consume(G),Y}function K(G){if(G===41)X++;return J.consume(G),Y}}function CW9(J,Q,Z){return X;function X(q){if(q===33||q===34||q===39||q===41||q===42||q===44||q===46||q===58||q===59||q===63||q===95||q===126)return J.consume(q),X;if(q===38)return J.consume(q),K;if(q===93)return J.consume(q),Y;if(q===60||q===null||R9(q)||GW(q))return Q(q);return Z(q)}function Y(q){if(q===null||q===40||q===91||R9(q)||GW(q))return Q(q);return X(q)}function K(q){return P5(q)?G(q):Z(q)}function G(q){if(q===59)return J.consume(q),X;if(P5(q))return J.consume(q),G;return Z(q)}}function SW9(J,Q,Z){return X;function X(K){return J.consume(K),Y}function Y(K){return T5(K)?Z(K):Q(K)}}function SU6(J){return J===null||J===40||J===42||J===95||J===91||J===93||J===126||R9(J)}function vU6(J){return!P5(J)}function kU6(J){return!(J===47||um1(J))}function um1(J){return J===43||J===45||J===46||J===95||T5(J)}function dm1(J){let Q=J.length,Z=!1;while(Q--){let X=J[Q][1];if((X.type==="labelLink"||X.type==="labelImage")&&!X._balanced){Z=!0;break}if(X._gfmAutolinkLiteralWalkedInto){Z=!1;break}}if(J.length>0&&!Z)J[J.length-1][1]._gfmAutolinkLiteralWalkedInto=!0;return Z}var vW9={tokenize:hW9,partial:!0};function cm1(){return{document:{[91]:{name:"gfmFootnoteDefinition",tokenize:bW9,continuation:{tokenize:yW9},exit:fW9}},text:{[91]:{name:"gfmFootnoteCall",tokenize:xW9},[93]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kW9,resolveTo:_W9}}}}function kW9(J,Q,Z){let X=this,Y=X.events.length,K=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),G;while(Y--){let z=X.events[Y][1];if(z.type==="labelImage"){G=z;break}if(z.type==="gfmFootnoteCall"||z.type==="labelLink"||z.type==="label"||z.type==="image"||z.type==="link")break}return q;function q(z){if(!G||!G._balanced)return Z(z);let U=LQ(X.sliceSerialize({start:G.end,end:X.now()}));if(U.codePointAt(0)!==94||!K.includes(U.slice(1)))return Z(z);return J.enter("gfmFootnoteCallLabelMarker"),J.consume(z),J.exit("gfmFootnoteCallLabelMarker"),Q(z)}}function _W9(J,Q){let Z=J.length,X;while(Z--)if(J[Z][1].type==="labelImage"&&J[Z][0]==="enter"){X=J[Z][1];break}J[Z+1][1].type="data",J[Z+3][1].type="gfmFootnoteCallLabelMarker";let Y={type:"gfmFootnoteCall",start:Object.assign({},J[Z+3][1].start),end:Object.assign({},J[J.length-1][1].end)},K={type:"gfmFootnoteCallMarker",start:Object.assign({},J[Z+3][1].end),end:Object.assign({},J[Z+3][1].end)};K.end.column++,K.end.offset++,K.end._bufferIndex++;let G={type:"gfmFootnoteCallString",start:Object.assign({},K.end),end:Object.assign({},J[J.length-1][1].start)},q={type:"chunkString",contentType:"string",start:Object.assign({},G.start),end:Object.assign({},G.end)},z=[J[Z+1],J[Z+2],["enter",Y,Q],J[Z+3],J[Z+4],["enter",K,Q],["exit",K,Q],["enter",G,Q],["enter",q,Q],["exit",q,Q],["exit",G,Q],J[J.length-2],J[J.length-1],["exit",Y,Q]];return J.splice(Z,J.length-Z+1,...z),J}function xW9(J,Q,Z){let X=this,Y=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),K=0,G;return q;function q(F){return J.enter("gfmFootnoteCall"),J.enter("gfmFootnoteCallLabelMarker"),J.consume(F),J.exit("gfmFootnoteCallLabelMarker"),z}function z(F){if(F!==94)return Z(F);return J.enter("gfmFootnoteCallMarker"),J.consume(F),J.exit("gfmFootnoteCallMarker"),J.enter("gfmFootnoteCallString"),J.enter("chunkString").contentType="string",U}function U(F){if(K>999||F===93&&!G||F===null||F===91||R9(F))return Z(F);if(F===93){J.exit("chunkString");let H=J.exit("gfmFootnoteCallString");if(!Y.includes(LQ(X.sliceSerialize(H))))return Z(F);return J.enter("gfmFootnoteCallLabelMarker"),J.consume(F),J.exit("gfmFootnoteCallLabelMarker"),J.exit("gfmFootnoteCall"),Q}if(!R9(F))G=!0;return K++,J.consume(F),F===92?W:U}function W(F){if(F===91||F===92||F===93)return J.consume(F),K++,U;return U(F)}}function bW9(J,Q,Z){let X=this,Y=X.parser.gfmFootnotes||(X.parser.gfmFootnotes=[]),K,G=0,q;return z;function z(M){return J.enter("gfmFootnoteDefinition")._container=!0,J.enter("gfmFootnoteDefinitionLabel"),J.enter("gfmFootnoteDefinitionLabelMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionLabelMarker"),U}function U(M){if(M===94)return J.enter("gfmFootnoteDefinitionMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionMarker"),J.enter("gfmFootnoteDefinitionLabelString"),J.enter("chunkString").contentType="string",W;return Z(M)}function W(M){if(G>999||M===93&&!q||M===null||M===91||R9(M))return Z(M);if(M===93){J.exit("chunkString");let V=J.exit("gfmFootnoteDefinitionLabelString");return K=LQ(X.sliceSerialize(V)),J.enter("gfmFootnoteDefinitionLabelMarker"),J.consume(M),J.exit("gfmFootnoteDefinitionLabelMarker"),J.exit("gfmFootnoteDefinitionLabel"),H}if(!R9(M))q=!0;return G++,J.consume(M),M===92?F:W}function F(M){if(M===91||M===92||M===93)return J.consume(M),G++,W;return W(M)}function H(M){if(M===58){if(J.enter("definitionMarker"),J.consume(M),J.exit("definitionMarker"),!Y.includes(K))Y.push(K);return G8(J,B,"gfmFootnoteDefinitionWhitespace")}return Z(M)}function B(M){return Q(M)}}function yW9(J,Q,Z){return J.check(qW,Q,J.attempt(vW9,Q,Z))}function fW9(J){J.exit("gfmFootnoteDefinition")}function hW9(J,Q,Z){let X=this;return G8(J,Y,"gfmFootnoteDefinitionIndent",5);function Y(K){let G=X.events[X.events.length-1];return G&&G[1].type==="gfmFootnoteDefinitionIndent"&&G[2].sliceSerialize(G[1],!0).length===4?Q(K):Z(K)}}function lm1(J){let Z=(J||{}).singleTilde,X={name:"strikethrough",tokenize:K,resolveAll:Y};if(Z===null||Z===void 0)Z=!0;return{text:{[126]:X},insideSpan:{null:[X]},attentionMarkers:{null:[126]}};function Y(G,q){let z=-1;while(++z<G.length)if(G[z][0]==="enter"&&G[z][1].type==="strikethroughSequenceTemporary"&&G[z][1]._close){let U=z;while(U--)if(G[U][0]==="exit"&&G[U][1].type==="strikethroughSequenceTemporary"&&G[U][1]._open&&G[z][1].end.offset-G[z][1].start.offset===G[U][1].end.offset-G[U][1].start.offset){G[z][1].type="strikethroughSequence",G[U][1].type="strikethroughSequence";let W={type:"strikethrough",start:Object.assign({},G[U][1].start),end:Object.assign({},G[z][1].end)},F={type:"strikethroughText",start:Object.assign({},G[U][1].end),end:Object.assign({},G[z][1].start)},H=[["enter",W,q],["enter",G[U][1],q],["exit",G[U][1],q],["enter",F,q]],B=q.parser.constructs.insideSpan.null;if(B)E7(H,H.length,0,NN(B,G.slice(U+1,z),q));E7(H,H.length,0,[["exit",F,q],["enter",G[z][1],q],["exit",G[z][1],q],["exit",W,q]]),E7(G,U-1,z-U+3,H),z=U+H.length-2;break}}z=-1;while(++z<G.length)if(G[z][1].type==="strikethroughSequenceTemporary")G[z][1].type="data";return G}function K(G,q,z){let U=this.previous,W=this.events,F=0;return H;function H(M){if(U===126&&W[W.length-1][1].type!=="characterEscape")return z(M);return G.enter("strikethroughSequenceTemporary"),B(M)}function B(M){let V=YB(U);if(M===126){if(F>1)return z(M);return G.consume(M),F++,B}if(F<2&&!Z)return z(M);let N=G.exit("strikethroughSequenceTemporary"),L=YB(M);return N._open=!L||L===2&&Boolean(V),N._close=!V||V===2&&Boolean(L),q(M)}}}class im1{constructor(){this.map=[]}add(J,Q,Z){gW9(this,J,Q,Z)}consume(J){if(this.map.sort(function(Y,K){return Y[0]-K[0]}),this.map.length===0)return;let Q=this.map.length,Z=[];while(Q>0)Q-=1,Z.push(J.slice(this.map[Q][0]+this.map[Q][1]),this.map[Q][2]),J.length=this.map[Q][0];Z.push(J.slice()),J.length=0;let X=Z.pop();while(X){for(let Y of X)J.push(Y);X=Z.pop()}this.map.length=0}}function gW9(J,Q,Z,X){let Y=0;if(Z===0&&X.length===0)return;while(Y<J.map.length){if(J.map[Y][0]===Q){J.map[Y][1]+=Z,J.map[Y][2].push(...X);return}Y+=1}J.map.push([Q,Z,X])}function _U6(J,Q){let Z=!1,X=[];while(Q<J.length){let Y=J[Q];if(Z){if(Y[0]==="enter"){if(Y[1].type==="tableContent")X.push(J[Q+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(Y[1].type==="tableContent"){if(J[Q-1][1].type==="tableDelimiterMarker"){let K=X.length-1;X[K]=X[K]==="left"?"center":"right"}}else if(Y[1].type==="tableDelimiterRow")break}else if(Y[0]==="enter"&&Y[1].type==="tableDelimiterRow")Z=!0;Q+=1}return X}function nm1(){return{flow:{null:{name:"table",tokenize:mW9,resolveAll:uW9}}}}function mW9(J,Q,Z){let X=this,Y=0,K=0,G;return q;function q(T){let S=X.events.length-1;while(S>-1){let v=X.events[S][1].type;if(v==="lineEnding"||v==="linePrefix")S--;else break}let x=S>-1?X.events[S][1].type:null,h=x==="tableHead"||x==="tableRow"?j:z;if(h===j&&X.parser.lazy[X.now().line])return Z(T);return h(T)}function z(T){return J.enter("tableHead"),J.enter("tableRow"),U(T)}function U(T){if(T===124)return W(T);return G=!0,K+=1,W(T)}function W(T){if(T===null)return Z(T);if(D6(T)){if(K>1)return K=0,X.interrupt=!0,J.exit("tableRow"),J.enter("lineEnding"),J.consume(T),J.exit("lineEnding"),B;return Z(T)}if(W8(T))return G8(J,W,"whitespace")(T);if(K+=1,G)G=!1,Y+=1;if(T===124)return J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),G=!0,W;return J.enter("data"),F(T)}function F(T){if(T===null||T===124||R9(T))return J.exit("data"),W(T);return J.consume(T),T===92?H:F}function H(T){if(T===92||T===124)return J.consume(T),F;return F(T)}function B(T){if(X.interrupt=!1,X.parser.lazy[X.now().line])return Z(T);if(J.enter("tableDelimiterRow"),G=!1,W8(T))return G8(J,M,"linePrefix",X.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T);return M(T)}function M(T){if(T===45||T===58)return N(T);if(T===124)return G=!0,J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),V;return O(T)}function V(T){if(W8(T))return G8(J,N,"whitespace")(T);return N(T)}function N(T){if(T===58)return K+=1,G=!0,J.enter("tableDelimiterMarker"),J.consume(T),J.exit("tableDelimiterMarker"),L;if(T===45)return K+=1,L(T);if(T===null||D6(T))return R(T);return O(T)}function L(T){if(T===45)return J.enter("tableDelimiterFiller"),A(T);return O(T)}function A(T){if(T===45)return J.consume(T),A;if(T===58)return G=!0,J.exit("tableDelimiterFiller"),J.enter("tableDelimiterMarker"),J.consume(T),J.exit("tableDelimiterMarker"),w;return J.exit("tableDelimiterFiller"),w(T)}function w(T){if(W8(T))return G8(J,R,"whitespace")(T);return R(T)}function R(T){if(T===124)return M(T);if(T===null||D6(T)){if(!G||Y!==K)return O(T);return J.exit("tableDelimiterRow"),J.exit("tableHead"),Q(T)}return O(T)}function O(T){return Z(T)}function j(T){return J.enter("tableRow"),$(T)}function $(T){if(T===124)return J.enter("tableCellDivider"),J.consume(T),J.exit("tableCellDivider"),$;if(T===null||D6(T))return J.exit("tableRow"),Q(T);if(W8(T))return G8(J,$,"whitespace")(T);return J.enter("data"),E(T)}function E(T){if(T===null||T===124||R9(T))return J.exit("data"),$(T);return J.consume(T),T===92?I:E}function I(T){if(T===92||T===124)return J.consume(T),E;return E(T)}}function uW9(J,Q){let Z=-1,X=!0,Y=0,K=[0,0,0,0],G=[0,0,0,0],q=!1,z=0,U,W,F,H=new im1;while(++Z<J.length){let B=J[Z],M=B[1];if(B[0]==="enter"){if(M.type==="tableHead"){if(q=!1,z!==0)xU6(H,Q,z,U,W),W=void 0,z=0;U={type:"table",start:Object.assign({},M.start),end:Object.assign({},M.end)},H.add(Z,0,[["enter",U,Q]])}else if(M.type==="tableRow"||M.type==="tableDelimiterRow"){if(X=!0,F=void 0,K=[0,0,0,0],G=[0,Z+1,0,0],q)q=!1,W={type:"tableBody",start:Object.assign({},M.start),end:Object.assign({},M.end)},H.add(Z,0,[["enter",W,Q]]);Y=M.type==="tableDelimiterRow"?2:W?3:1}else if(Y&&(M.type==="data"||M.type==="tableDelimiterMarker"||M.type==="tableDelimiterFiller")){if(X=!1,G[2]===0){if(K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,void 0,F),K=[0,0,0,0];G[2]=Z}}else if(M.type==="tableCellDivider")if(X)X=!1;else{if(K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,void 0,F);K=G,G=[K[1],Z,0,0]}}else if(M.type==="tableHead")q=!0,z=Z;else if(M.type==="tableRow"||M.type==="tableDelimiterRow"){if(z=Z,K[1]!==0)G[0]=G[1],F=GQ1(H,Q,K,Y,Z,F);else if(G[1]!==0)F=GQ1(H,Q,G,Y,Z,F);Y=0}else if(Y&&(M.type==="data"||M.type==="tableDelimiterMarker"||M.type==="tableDelimiterFiller"))G[3]=Z}if(z!==0)xU6(H,Q,z,U,W);H.consume(Q.events),Z=-1;while(++Z<Q.events.length){let B=Q.events[Z];if(B[0]==="enter"&&B[1].type==="table")B[1]._align=_U6(Q.events,Z)}return J}function GQ1(J,Q,Z,X,Y,K){let G=X===1?"tableHeader":X===2?"tableDelimiter":"tableData",q="tableContent";if(Z[0]!==0)K.end=Object.assign({},aC(Q.events,Z[0])),J.add(Z[0],0,[["exit",K,Q]]);let z=aC(Q.events,Z[1]);if(K={type:G,start:Object.assign({},z),end:Object.assign({},z)},J.add(Z[1],0,[["enter",K,Q]]),Z[2]!==0){let U=aC(Q.events,Z[2]),W=aC(Q.events,Z[3]),F={type:"tableContent",start:Object.assign({},U),end:Object.assign({},W)};if(J.add(Z[2],0,[["enter",F,Q]]),X!==2){let H=Q.events[Z[2]],B=Q.events[Z[3]];if(H[1].end=Object.assign({},B[1].end),H[1].type="chunkText",H[1].contentType="text",Z[3]>Z[2]+1){let M=Z[2]+1,V=Z[3]-Z[2]-1;J.add(M,V,[])}}J.add(Z[3]+1,0,[["exit",F,Q]])}if(Y!==void 0)K.end=Object.assign({},aC(Q.events,Y)),J.add(Y,0,[["exit",K,Q]]),K=void 0;return K}function xU6(J,Q,Z,X,Y){let K=[],G=aC(Q.events,Z);if(Y)Y.end=Object.assign({},G),K.push(["exit",Y,Q]);X.end=Object.assign({},G),K.push(["exit",X,Q]),J.add(Z+1,0,K)}function aC(J,Q){let Z=J[Q],X=Z[0]==="enter"?"start":"end";return Z[1][X]}var pW9={name:"tasklistCheck",tokenize:dW9};function am1(){return{text:{[91]:pW9}}}function dW9(J,Q,Z){let X=this;return Y;function Y(z){if(X.previous!==null||!X._gfmTasklistFirstContentOfListItem)return Z(z);return J.enter("taskListCheck"),J.enter("taskListCheckMarker"),J.consume(z),J.exit("taskListCheckMarker"),K}function K(z){if(R9(z))return J.enter("taskListCheckValueUnchecked"),J.consume(z),J.exit("taskListCheckValueUnchecked"),G;if(z===88||z===120)return J.enter("taskListCheckValueChecked"),J.consume(z),J.exit("taskListCheckValueChecked"),G;return Z(z)}function G(z){if(z===93)return J.enter("taskListCheckMarker"),J.consume(z),J.exit("taskListCheckMarker"),J.exit("taskListCheck"),q;return Z(z)}function q(z){if(D6(z))return Q(z);if(W8(z))return J.check({tokenize:cW9},Q,Z)(z);return Z(z)}}function cW9(J,Q,Z){return G8(J,X,"whitespace");function X(Y){return Y===null?Z(Y):Q(Y)}}function bU6(J){return yJ1([pm1(),cm1(),lm1(J),nm1(),am1()])}var lW9={};function qQ1(J){let Q=this,Z=J||lW9,X=Q.data(),Y=X.micromarkExtensions||(X.micromarkExtensions=[]),K=X.fromMarkdownExtensions||(X.fromMarkdownExtensions=[]),G=X.toMarkdownExtensions||(X.toMarkdownExtensions=[]);Y.push(bU6(Z)),K.push(gm1()),G.push(mm1(Z))}DR();b2();G9();class rm1 extends OY{rows;columnConfigs;borderColor;showBorders;cellPadding;constructor({key:J,rows:Q,columnConfigs:Z,borderColor:X,showBorders:Y=!0,cellPadding:K=V0.symmetric(1,0)}){let G=[];for(let q of Q)for(let z of q.cells){let U=new x6({padding:K,child:z.child});G.push(U)}super({key:J,children:G});this.rows=Q,this.columnConfigs=Z,this.borderColor=X,this.showBorders=Y,this.cellPadding=K}createRenderObject(){return new yU6({rows:this.rows,columnConfigs:this.columnConfigs,borderColor:this.borderColor,showBorders:this.showBorders,cellPadding:this.cellPadding})}updateRenderObject(J){J.updateTable({rows:this.rows,columnConfigs:this.columnConfigs,borderColor:this.borderColor,showBorders:this.showBorders,cellPadding:this.cellPadding})}}class yU6 extends Z8{rows;columnConfigs;borderColor;showBorders;cellPadding;columnWidths=[];rowHeights=[];constructor({rows:J,columnConfigs:Q,borderColor:Z,showBorders:X,cellPadding:Y}){super();this.rows=J,this.columnConfigs=Q,this.borderColor=Z,this.showBorders=X,this.cellPadding=Y}updateTable({rows:J,columnConfigs:Q,borderColor:Z,showBorders:X,cellPadding:Y}){this.rows=J,this.columnConfigs=Q,this.borderColor=Z,this.showBorders=X,this.cellPadding=Y,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;if(!J)return;this.columnWidths=this.calculateColumnWidths(J),this.rowHeights=this.calculateRowHeights(),this.layoutCells();let Q=this.getTotalTableWidth(),Z=this.getTotalTableHeight();this.setSize(Q,Z)}calculateColumnWidths(J){let Q=[],Z=0,X=0;for(let Y=0;Y<this.columnConfigs.length;Y++){let K=this.columnConfigs[Y];if(!K)continue;switch(K.widthType){case"fixed":{m6(K.fixedWidth!==void 0,`Fixed width column ${Y} must have fixedWidth specified`);let G=K.fixedWidth;Q[Y]=G,Z+=G;break}case"intrinsic":{let G=this.calculateIntrinsicColumnWidth(Y);Q[Y]=G,Z+=G;break}case"flex":X++,Q[Y]=0;break}}if(X>0){let Y=0;if(this.showBorders)Y+=2,Y+=Math.max(0,this.columnConfigs.length-1);let K=Math.max(0,J.maxWidth-Z-Y),G=Math.floor(K/X);for(let q=0;q<Q.length;q++)if(this.columnConfigs[q]?.widthType==="flex")Q[q]=G}return Q}calculateIntrinsicColumnWidth(J){let Q=0,Z=0;for(let X=0;X<this.rows.length;X++){let Y=this.rows[X];if(!Y)continue;for(let K=0;K<Y.cells.length;K++){if(K===J){let G=Y.cells[K],q=this.children[Z];if(G&&q){let z=q.getMaxIntrinsicWidth(Number.POSITIVE_INFINITY);Q=Math.max(Q,z)}}Z++}}return Q}calculateRowHeights(){let J=[],Q=0;for(let Z=0;Z<this.rows.length;Z++){let X=this.rows[Z];if(!X)continue;let Y=1;for(let K=0;K<X.cells.length;K++){let G=X.cells[K],q=this.children[Q],z=this.columnWidths[K];if(!G||!q){Q++;continue}let U=this.measureCellHeight(q,z||0);Y=Math.max(Y,U),Q++}J[Z]=Y}return J}layoutCells(){let J=0;for(let Q=0;Q<this.rows.length;Q++){let Z=this.rows[Q];if(!Z)continue;for(let X=0;X<Z.cells.length;X++){let Y=Z.cells[X],K=this.children[J];if(!Y||!K){J++;continue}let G=this.columnWidths[X]||0,q=this.rowHeights[Q]||1,z=w6.tight(G,q);K.layout(z);let U=this.getColumnOffset(X),W=this.getRowOffset(Q),F=U,H=W;K.setOffset(F,H),J++}}}getTotalTableWidth(){let Q=this.columnWidths.reduce((Z,X)=>Z+X,0);if(this.showBorders)Q+=2,Q+=Math.max(0,this.columnWidths.length-1);return Q}getTotalTableHeight(){let Q=this.rowHeights.reduce((Z,X)=>Z+X,0);if(this.showBorders)Q+=2,Q+=Math.max(0,this.rowHeights.length-1);return Q}getColumnOffset(J){let Q=this.showBorders?1:0;for(let Z=0;Z<J;Z++)if(Q+=this.columnWidths[Z]||0,this.showBorders)Q+=1;return Q}getRowOffset(J){let Q=this.showBorders?1:0;for(let Z=0;Z<J;Z++)if(Q+=this.rowHeights[Z]||0,this.showBorders)Q+=1;return Q}getMaxIntrinsicWidth(J){let Q=0;for(let Z=0;Z<this.columnConfigs.length;Z++){let X=this.columnConfigs[Z];if(!X)continue;switch(X.widthType){case"fixed":Q+=X.fixedWidth||0;break;case"intrinsic":{let Y=this.calculateIntrinsicColumnWidth(Z);Q+=Y;break}case"flex":Q+=0;break}}if(this.showBorders)Q+=2,Q+=Math.max(0,this.columnConfigs.length-1);return Q}measureCellHeight(J,Q){let Z=new w6(Q,Q,0,Number.POSITIVE_INFINITY);return J.layout(Z),J.size.height}paint(J,Q,Z){let X=Q+this.offset.x,Y=Z+this.offset.y;if(!this.showBorders){super.paint(J,Q,Z);return}this.paintTableBorders(J,X,Y),super.paint(J,Q,Z)}paintTableBorders(J,Q,Z){let X=this.getTotalTableWidth(),Y=this.getTotalTableHeight();this.drawBox(J,Q,Z,X,Y);let K=Z+1;for(let q=0;q<this.rowHeights.length-1;q++){K+=this.rowHeights[q]||0;for(let z=Q+1;z<Q+X-1;z++)J.setCell(z,K,D9("─",{fg:this.borderColor}));J.setCell(Q,K,D9("├",{fg:this.borderColor})),J.setCell(Q+X-1,K,D9("┤",{fg:this.borderColor})),K+=1}let G=Q+1;for(let q=0;q<this.columnWidths.length-1;q++){G+=this.columnWidths[q]||0;for(let z=Z+1;z<Z+Y-1;z++)if(J.getCell(G,z)?.char==="─")J.setCell(G,z,D9("┼",{fg:this.borderColor}));else J.setCell(G,z,D9("│",{fg:this.borderColor}));J.setCell(G,Z,D9("┬",{fg:this.borderColor})),J.setCell(G,Z+Y-1,D9("┴",{fg:this.borderColor})),G+=1}}drawBox(J,Q,Z,X,Y){for(let K=1;K<X-1;K++)J.setCell(Q+K,Z,D9("─",{fg:this.borderColor}));for(let K=1;K<X-1;K++)J.setCell(Q+K,Z+Y-1,D9("─",{fg:this.borderColor}));for(let K=1;K<Y-1;K++)J.setCell(Q,Z+K,D9("│",{fg:this.borderColor}));for(let K=1;K<Y-1;K++)J.setCell(Q+X-1,Z+K,D9("│",{fg:this.borderColor}));J.setCell(Q,Z,D9("╭",{fg:this.borderColor})),J.setCell(Q+X-1,Z,D9("╮",{fg:this.borderColor})),J.setCell(Q,Z+Y-1,D9("╰",{fg:this.borderColor})),J.setCell(Q+X-1,Z+Y-1,D9("╯",{fg:this.borderColor}))}}function fU6(J,Q){return{child:J,alignment:Q}}function hU6(J,Q=!1){return{cells:J.map((X)=>("child"in X)?X:{child:X}),isHeader:Q}}function gU6(J,Q="intrinsic",Z){return{alignment:J,widthType:Q,fixedWidth:Z}}function sm1(){return{text:new j1({color:E1.default()}),inlineCode:new j1({color:E1.yellow,bold:!0}),codeBlock:new j1({color:E1.default()}),tableBorder:E1.index(8),link:new j1({color:E1.blue,underline:!0}),syntaxHighlight:{keyword:E1.blue,string:E1.green,number:E1.yellow,comment:E1.index(8),function:E1.cyan,variable:E1.default(),type:E1.magenta,operator:E1.white}}}class RX extends I6{markdown;textAlign;maxLines;overflow;styleScheme;constructor({key:J,markdown:Q,textAlign:Z="left",maxLines:X,overflow:Y="clip",styleScheme:K}){super(J?{key:J}:{});this.markdown=Q,this.textAlign=Z,this.maxLines=X,this.overflow=Y,this.styleScheme=K}build(J){let Q=this.styleScheme??sm1(),Z=this.key?`${this.key.toString()}-`:void 0,X=nW9(this.markdown,Q,Z);return new i0({crossAxisAlignment:"start",children:X})}}function iW9(J,Q,Z,X,Y){let K=WN.default.languages[Q]||WN.default.languages.clike,G=Y?.copyWith({color:X})??new j1({color:X});if(!K)return[new N1(J,G)];try{let q=zJ1(J,Z,`file.${Q}`),z=[];for(let U of q){let W=U.color??X,F=Y?.copyWith({color:W})??new j1({color:W});z.push(new N1(U.content,F))}return z.length>0?z:[new N1(J,G)]}catch{return[new N1(J,G)]}}function nW9(J,Q,Z){try{let X=VU6().use(qQ1).parse(J);return hR(X,Q,Z)}catch{let X=new N1(J,Q.text),Y=Z?new a7(`${Z}fallback`):void 0;return[new n1({key:Y,text:X,selectable:!0})]}}function hR(J,Q,Z,X=0,Y){let K=[],G=0;switch(J.type){case"root":{let q=J;for(let z=0;z<q.children.length;z++){let U=q.children[z];if(U){if(K.push(...hR(U,Q,Z,X)),z<q.children.length-1)K.push(new n1({text:new N1(`
|
|
6494
6494
|
`,Q.text),selectable:!0}))}}break}case"paragraph":{let z=GB(J.children,Q),U=z.length===1&&z[0]?z[0]:new N1(void 0,Q.text,z),W=Z?new a7(`${Z}p-${G++}`):void 0;K.push(new n1({key:W,text:U,selectable:!0}));break}case"heading":{let q=J,z=q.depth,W={1:E1.yellow,2:E1.cyan,3:E1.yellow,4:E1.cyan,5:Q.text.color??E1.white,6:Q.text.color??E1.white}[z],F=z<=2,H=Q.text.copyWith({color:W,bold:F}),B=GB(q.children,Q,H),M=B.length===1&&B[0]?B[0]:new N1(void 0,H,B),V=Z?new a7(`${Z}h${z}-${G++}`):void 0;K.push(new n1({key:V,text:M,selectable:!0}));break}case"blockquote":{let q=J,z=[];for(let W of q.children)z.push(...hR(W,Q,Z,X));let U=new y0({padding:V0.only({left:2,right:4}),child:new y0({padding:V0.only({left:1}),decoration:new i8(void 0,new x8(void 0,void 0,void 0,new w8(E1.white,1))),child:new i0({crossAxisAlignment:"start",children:z})})});K.push(U);break}case"thematicBreak":{let q=new N1("---",Q.text);K.push(new n1({text:q,selectable:!0}));break}case"html":{let z=new N1(J.value,Q.inlineCode);K.push(new n1({text:z,selectable:!0}));break}case"list":{let q=J,z=[];for(let W=0;W<q.children.length;W++){let F=q.children[W];if(!F)continue;let H={ordered:q.ordered??!1,itemIndex:W+1};z.push(...hR(F,Q,Z,X,H))}let U=new i0({crossAxisAlignment:"start",children:z});if(X>0){let W=X*2;K.push(new y0({padding:V0.only({left:W}),child:U}))}else K.push(U);break}case"listItem":{let q=J,z;if(typeof q.checked==="boolean"){let F=q.checked?"[✓] ":"[ ] ";z=new n1({text:new N1(F,Q.text),selectable:!1})}else if(Y?.ordered){let F=`${Y.itemIndex}. `;z=new n1({text:new N1(F,Q.text),selectable:!1})}else z=new n1({text:new N1("• ",Q.text),selectable:!1});let U=[];for(let F=0;F<q.children.length;F++){let H=q.children[F];if(!H)continue;if(H.type==="paragraph"){let V=GB(H.children,Q),N=V.length===1&&V[0]?V[0]:new N1(void 0,Q.text,V);U.push(new n1({text:N,selectable:!0}))}else if(H.type==="list")U.push(...hR(H,Q,Z,X+1));else U.push(...hR(H,Q,Z,X));let B=q.children[F+1];if(B&&H.type!=="list"&&B.type!=="list")U.push(new n1({text:new N1(`
|
|
6495
6495
|
`,Q.text),selectable:!0}))}let W=new X8({crossAxisAlignment:"start",mainAxisAlignment:"start",children:[z,new R8({child:new i0({crossAxisAlignment:"start",children:U})})]});K.push(W);break}case"code":{let q=J,z=q.lang||"",U=q.value;if(U.trim()){let W=iW9(U,z,Q.syntaxHighlight,Q.codeBlock.color??E1.default(),Q.codeBlock),F=new N1(void 0,Q.codeBlock,W),H=new y0({padding:V0.only({left:4,right:4}),child:new n1({text:F,selectable:!0})});K.push(H)}break}case"table":{let q=J,z=[],U=q.children[0],W=U?U.children.length:0,F=Array.from({length:W},(B,M)=>{let V=q.align?.[M],N=(()=>{switch(V){case"center":return"center";case"right":return"right";case"left":default:return"left"}})();return gU6(N,"flex")});for(let B=0;B<q.children.length;B++){let M=q.children[B];if(!M)continue;let V=M.children.map((L,A)=>{let w=GB(L.children,Q),R=w.length===1&&w[0]?w[0]:new N1(void 0,Q.text,w),O=F[A],j=(()=>{switch(O?.alignment){case"center":return"center";case"right":return"right";case"left":default:return"left"}})(),$=new n1({text:R,selectable:!0,textAlign:j});return fU6($)}),N=B===0;z.push(hU6(V,N))}let H=new rm1({rows:z,columnConfigs:F,borderColor:Q.tableBorder,showBorders:!0});K.push(H);break}case"tableRow":case"tableCell":break;case"image":{let z=J.alt||"Image",U=new n1({text:new N1(`[Image: ${z}]`,Q.link.copyWith({italic:!0})),selectable:!0});K.push(U);break}default:{if("children"in J&&Array.isArray(J.children)){let q=J;for(let z of q.children)K.push(...hR(z,Q,Z,X))}break}}return K}function GB(J,Q,Z){let X=[],Y=Z??Q.text;for(let K of J)switch(K.type){case"text":{let G=K;X.push(new N1(G.value,Y));break}case"strong":{let G=K,q=Y.copyWith({bold:!0});X.push(...GB(G.children,Q,q));break}case"emphasis":{let G=K,q=Y.copyWith({italic:!0});X.push(...GB(G.children,Q,q));break}case"delete":{let G=K,q=Y.copyWith({strikethrough:!0});X.push(...GB(G.children,Q,q));break}case"inlineCode":{let G=K,q=Y.merge(Q.inlineCode);X.push(new N1(G.value,q));break}case"link":{let G=K,q=Y.merge(Q.link),z={uri:G.url,id:Math.random().toString(36)},U=GB(G.children,Q,q);for(let W of U)X.push(new N1(W.text,W.style,W.children,z));break}case"break":{X.push(new N1(`
|
|
6496
|
-
`,Y));break}default:{if("children"in K&&Array.isArray(K.children))X.push(...GB(K.children,Q,Z));break}}return X}t9();DR();l8();l8();class om1 extends c0{markdown;defaultColor;textAlign;maxLines;overflow;constructor({key:J,markdown:Q,defaultColor:Z=E1.white,textAlign:X="left",maxLines:Y,overflow:K="clip"}){super(J?{key:J}:{});this.markdown=Q,this.defaultColor=Z,this.textAlign=X,this.maxLines=Y,this.overflow=K}createState(){return new mU6}}class mU6 extends d0{animationOffset=0;isAnimating=!1;intervalId;animationTimeoutId;targetPhrase="You're absolutely right!";initState(){if(super.initState(),this.widget.markdown.includes(this.targetPhrase))this.intervalId=setInterval(()=>{this.startRainbowAnimation()},3000)}cleanup=()=>{if(this.intervalId)clearInterval(this.intervalId),this.intervalId=void 0;if(this.animationTimeoutId)clearTimeout(this.animationTimeoutId),this.animationTimeoutId=void 0};dispose(){this.cleanup(),super.dispose()}startRainbowAnimation(){this.isAnimating=!0,this.animationOffset=0,this.setState(()=>{});let J=60,Q=0,Z=()=>{if(Q<J)this.animationOffset=Q/J,this.setState(()=>{}),Q++,this.animationTimeoutId=setTimeout(Z,33);else this.isAnimating=!1,this.setState(()=>{})};Z()}build(J){if(this.widget.markdown.indexOf(this.targetPhrase)===-1)return new RX({markdown:this.widget.markdown,textAlign:this.widget.textAlign,maxLines:this.widget.maxLines,overflow:this.widget.overflow});let X=new RX({markdown:this.widget.markdown,textAlign:this.widget.textAlign,maxLines:this.widget.maxLines,overflow:this.widget.overflow}).build(J);if(!this.isAnimating)return X;return this.applyRainbowToWidget(X,this.widget.defaultColor)}applyRainbowToWidget(J,Q){if(J instanceof n1){let Z=this.applyRainbowToTextSpan(J.text,Q);return new n1({text:Z,textAlign:J.textAlign,maxLines:J.maxLines,overflow:J.overflow})}if("children"in J&&Array.isArray(J.children)){let Z=J,X=Z.children.map((K)=>this.applyRainbowToWidget(K,Q));return new J.constructor({children:X,...Z.mainAxisAlignment!==void 0&&{mainAxisAlignment:Z.mainAxisAlignment},...Z.crossAxisAlignment!==void 0&&{crossAxisAlignment:Z.crossAxisAlignment},...Z.mainAxisSize!==void 0&&{mainAxisSize:Z.mainAxisSize},...Z.crossAxisSize!==void 0&&{crossAxisSize:Z.crossAxisSize}})}return J}applyRainbowToTextSpan(J,Q){if(J.text&&J.text.includes(this.targetPhrase))return this.createRainbowSpansForText(J,Q);if(J.children&&J.children.length>0){let Z=J.children.map((X)=>this.applyRainbowToTextSpan(X,Q));return new N1(J.text,J.style,Z,J.hyperlink)}return J}getSpanText(J){let Q=J.text||"";if(J.children)Q+=J.children.map((Z)=>this.getSpanText(Z)).join("");return Q}createRainbowSpansForText(J,Q){let Z=J.text||"",X=Z.indexOf(this.targetPhrase);if(X===-1)return J;let Y=Z.slice(0,X),K=Z.slice(X+this.targetPhrase.length),G=[];if(Y)G.push(new N1(Y,J.style||new
|
|
6497
|
-
`){if(G>=Y&&G<Y+8){let U=(G-Y)%Q.length;K.push(new N1(z,J.copyWith({color:Q[U]})))}else K.push(new N1(z,J));G++}else K.push(new N1(z,J))}return K}}G9();l8();b2();class gR extends c0{controller;getScrollInfo;thickness;trackChar;thumbChar;showTrack;thumbColor;trackColor;constructor({key:J,controller:Q,getScrollInfo:Z,thickness:X=1,trackChar:Y="█",thumbChar:K="█",showTrack:G=!0,thumbColor:q,trackColor:z}){super(J?{key:J}:{});this.controller=Q,this.getScrollInfo=Z,this.thickness=X,this.trackChar=Y,this.thumbChar=K,this.showTrack=G,this.thumbColor=q,this.trackColor=z}createState(){return new uU6}}class uU6 extends d0{_dragStartY=null;_dragStartOffset=null;_isOverThumb=!1;_isPositionOverThumb(J){let{totalContentHeight:Q,viewportHeight:Z}=this.widget.getScrollInfo(),Y=this.context.findRenderObject()?.size.height??0;if(Y===0||Q<=Z)return!1;let K=this.widget.getScrollInfo(),G=Math.min(1,Z/Q),q=Math.max(1,Y*G),z=Math.max(0,Math.min(1,K.scrollOffset/(Q-Z))),U=Y-q,W=Math.max(0,U*z),F=W+q;return J>=W&&J<=F}_handleHover=(J)=>{let Q=this._isOverThumb;if(this._isOverThumb=this._isPositionOverThumb(J.localPosition.y),Q!==this._isOverThumb)this.setState()};_handleDrag=(J)=>{let{totalContentHeight:Q,viewportHeight:Z,scrollOffset:X}=this.widget.getScrollInfo(),K=this.context.findRenderObject()?.size.height??0;if(K===0||Q<=Z)return;if(this._dragStartY===null)this._dragStartY=J.localPosition.y,this._dragStartOffset=X;let G=J.localPosition.y-this._dragStartY,q=Math.min(1,Z/Q),z=Math.max(1,K*q),U=K-z;if(U<=0)return;let W=Q-Z,F=U/W,H=G/F,B=Math.max(0,Math.min(W,this._dragStartOffset+H));this.widget.controller.jumpTo(B)};_handleRelease=()=>{this._dragStartY=null,this._dragStartOffset=null};_handleClick=(J)=>{if(J.button!=="left")return;let Q=J.localPosition.y,{totalContentHeight:Z,viewportHeight:X,scrollOffset:Y}=this.widget.getScrollInfo(),G=this.context.findRenderObject()?.size.height??0;if(G===0||Z<=X)return;let q=Math.min(1,X/Z),z=Math.max(1,G*q),U=Z-X,W=G-z,F=Math.max(0,Math.min(1,Y/(Z-X))),H=Math.max(0,W*F),B=H+z;if(Q>=H&&Q<=B)return;if(Q<H)this.widget.controller.animateTo(Math.max(0,Y-X));else this.widget.controller.animateTo(Math.min(U,Y+X))};build(J){return new x9({onClick:this._handleClick,onHover:this._handleHover,onDrag:this._handleDrag,onRelease:this._handleRelease,cursor:this._isOverThumb?z7.POINTER:z7.DEFAULT,child:new pU6({controller:this.widget.controller,getScrollInfo:this.widget.getScrollInfo,thickness:this.widget.thickness,trackChar:this.widget.trackChar,thumbChar:this.widget.thumbChar,showTrack:this.widget.showTrack,thumbColor:this.widget.thumbColor,trackColor:this.widget.trackColor})})}}class pU6 extends bC{controller;getScrollInfo;thickness;trackChar;thumbChar;showTrack;thumbColor;trackColor;constructor({key:J,controller:Q,getScrollInfo:Z,thickness:X=1,trackChar:Y="█",thumbChar:K="█",showTrack:G=!0,thumbColor:q,trackColor:z}){super(J?{key:J}:{});this.controller=Q,this.getScrollInfo=Z,this.thickness=X,this.trackChar=Y,this.thumbChar=K,this.showTrack=G,this.thumbColor=q,this.trackColor=z}createRenderObject(){return new dU6(this)}updateRenderObject(J){J.updateWidget(this)}}class dU6 extends Z8{_widget;constructor(J){super();this._widget=J}updateWidget(J){this._widget=J,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=Math.min(J.maxWidth,this._widget.thickness),Z=J.maxHeight;this.setSize(Q,Z),super.performLayout()}getMinIntrinsicWidth(J){return this._widget.thickness}getMaxIntrinsicWidth(J){return this._widget.thickness}getMinIntrinsicHeight(J){return 0}getMaxIntrinsicHeight(J){return 1/0}paint(J,Q,Z){let{thumbStartFloat:X,thumbSizeFloat:Y,showScrollbar:K}=this._calculateScrollbarMetrics();if(!K)return;let G=this._widget.trackColor,q=this._widget.thumbColor,z=["▁","▂","▃","▄","▅","▆","▇","█"],U=X,W=X+Y;for(let F=0;F<this.size.height;F++){let H="█",B=G,M=q;if(F===Math.floor(U)){let V=1-(U-F),N=Math.floor(V*8);H=z[N]||"█",B=q,M=G}else if(F===Math.floor(W)){let V=1-(W-F),N=Math.floor(V*8);H=z[N]||"█",B=G,M=q}else if(F>U&&F<W)B=q;J.setChar(Q,Z+F,H,{fg:B,bg:M},1)}}_calculateScrollbarMetrics(){let{totalContentHeight:J,viewportHeight:Q,scrollOffset:Z}=this._widget.getScrollInfo(),X=this.size.height;if(J<=Q||X<=0)return{thumbStartFloat:0,thumbSizeFloat:0,showScrollbar:!1};let Y=Math.max(0,Math.min(1,Z/(J-Q))),K=Math.min(1,Q/J),G=Math.max(1,X*K),q=X-G;return{thumbStartFloat:Math.max(0,q*Y),thumbSizeFloat:G,showScrollbar:!0}}}l8();class RN{state=[!0,!1,!0,!1,!0,!1,!0,!1];previousState=[];generation=0;maxGenerations=15;neighborMap=[[1,3,4,5,7],[0,2,4,5,6],[1,3,5,6,7],[0,2,4,6,7],[0,1,3,5,7],[0,1,2,4,6],[1,2,3,5,7],[0,2,3,4,6]];step(){let J=this.state.map((K,G)=>{let q=this.neighborMap[G].filter((z)=>this.state[z]).length;if(K)return q===2||q===3;return q===3||q===6}),Q=J.every((K,G)=>K===this.state[G]),Z=this.previousState.length>0&&J.every((K,G)=>K===this.previousState[G]);this.previousState=[...this.state],this.state=J,this.generation++;let X=J.every((K)=>!K),Y=J.filter((K)=>K).length;if(Q||Z||this.generation>=this.maxGenerations||X||Y<2){let K;do K=Array.from({length:8},()=>Math.random()>0.6);while(K.filter((G)=>G).length<3);this.state=K,this.previousState=[],this.generation=0}}toBraille(){let J=[0,1,2,6,3,4,5,7],Q=10240;for(let Z=0;Z<8;Z++)if(this.state[Z])Q|=1<<J[Z];return String.fromCharCode(Q)}}var aW9=/<[^>]+>/g,rW9=/<ENCRYPTED>[\s\S]*?<\/ENCRYPTED>/g,sW9=/<ID>[\s\S]*?<\/ID>/g;function tm1(J){return J.replace(rW9,"").replace(sW9,"").replace(aW9,"").trim()}class Zd extends c0{thinkingBlock;expanded;onToggle;isStreaming;constructor({key:J,thinkingBlock:Q,expanded:Z=!1,onToggle:X,isStreaming:Y=!1}){super(J?{key:J}:{});this.thinkingBlock=Q,this.expanded=Z,this.onToggle=X,this.isStreaming=Y}createState(){return new cU6}}class cU6 extends d0{_animationTimer;_spinner=new RN;get isComplete(){return!this.widget.isStreaming}initState(){if(super.initState(),!this.isComplete)this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.isStreaming&&!this.widget.isStreaming)this._stopAnimation();else if(!J.isStreaming&&this.widget.isStreaming)this._startAnimation();if(J.expanded!==this.widget.expanded)this.setState(()=>{})}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Z=e6.of(J).colorScheme,X=this.isComplete?Z.success:Z.accent,Y=this.isComplete?"✓ ":`${this._spinner.toBraille()} `,K=new n1({text:new N1("",void 0,[new N1(Y,new
|
|
6496
|
+
`,Y));break}default:{if("children"in K&&Array.isArray(K.children))X.push(...GB(K.children,Q,Z));break}}return X}t9();DR();l8();l8();class om1 extends c0{markdown;defaultColor;textAlign;maxLines;overflow;constructor({key:J,markdown:Q,defaultColor:Z=E1.white,textAlign:X="left",maxLines:Y,overflow:K="clip"}){super(J?{key:J}:{});this.markdown=Q,this.defaultColor=Z,this.textAlign=X,this.maxLines=Y,this.overflow=K}createState(){return new mU6}}class mU6 extends d0{animationOffset=0;isAnimating=!1;intervalId;animationTimeoutId;targetPhrase="You're absolutely right!";initState(){if(super.initState(),this.widget.markdown.includes(this.targetPhrase))this.intervalId=setInterval(()=>{this.startRainbowAnimation()},3000)}cleanup=()=>{if(this.intervalId)clearInterval(this.intervalId),this.intervalId=void 0;if(this.animationTimeoutId)clearTimeout(this.animationTimeoutId),this.animationTimeoutId=void 0};dispose(){this.cleanup(),super.dispose()}startRainbowAnimation(){this.isAnimating=!0,this.animationOffset=0,this.setState(()=>{});let J=60,Q=0,Z=()=>{if(Q<J)this.animationOffset=Q/J,this.setState(()=>{}),Q++,this.animationTimeoutId=setTimeout(Z,33);else this.isAnimating=!1,this.setState(()=>{})};Z()}build(J){if(this.widget.markdown.indexOf(this.targetPhrase)===-1)return new RX({markdown:this.widget.markdown,textAlign:this.widget.textAlign,maxLines:this.widget.maxLines,overflow:this.widget.overflow});let X=new RX({markdown:this.widget.markdown,textAlign:this.widget.textAlign,maxLines:this.widget.maxLines,overflow:this.widget.overflow}).build(J);if(!this.isAnimating)return X;return this.applyRainbowToWidget(X,this.widget.defaultColor)}applyRainbowToWidget(J,Q){if(J instanceof n1){let Z=this.applyRainbowToTextSpan(J.text,Q);return new n1({text:Z,textAlign:J.textAlign,maxLines:J.maxLines,overflow:J.overflow})}if("children"in J&&Array.isArray(J.children)){let Z=J,X=Z.children.map((K)=>this.applyRainbowToWidget(K,Q));return new J.constructor({children:X,...Z.mainAxisAlignment!==void 0&&{mainAxisAlignment:Z.mainAxisAlignment},...Z.crossAxisAlignment!==void 0&&{crossAxisAlignment:Z.crossAxisAlignment},...Z.mainAxisSize!==void 0&&{mainAxisSize:Z.mainAxisSize},...Z.crossAxisSize!==void 0&&{crossAxisSize:Z.crossAxisSize}})}return J}applyRainbowToTextSpan(J,Q){if(J.text&&J.text.includes(this.targetPhrase))return this.createRainbowSpansForText(J,Q);if(J.children&&J.children.length>0){let Z=J.children.map((X)=>this.applyRainbowToTextSpan(X,Q));return new N1(J.text,J.style,Z,J.hyperlink)}return J}getSpanText(J){let Q=J.text||"";if(J.children)Q+=J.children.map((Z)=>this.getSpanText(Z)).join("");return Q}createRainbowSpansForText(J,Q){let Z=J.text||"",X=Z.indexOf(this.targetPhrase);if(X===-1)return J;let Y=Z.slice(0,X),K=Z.slice(X+this.targetPhrase.length),G=[];if(Y)G.push(new N1(Y,J.style||new j1({color:Q})));if(G.push(...this.createAnimatedRainbowSpans(J.style||new j1({color:Q}))),K)G.push(new N1(K,J.style||new j1({color:Q})));return new N1(void 0,J.style,G,J.hyperlink)}createAnimatedRainbowSpans(J){let Q=[E1.red,E1.yellow,E1.green,E1.cyan,E1.blue,E1.magenta],Z=8,X=this.targetPhrase.replace(/\s/g,"").length,Y=Math.floor(this.animationOffset*(X+8))-8,K=[],G=0;for(let q=0;q<this.targetPhrase.length;q++){let z=this.targetPhrase[q];if(z!==" "&&z!=="\t"&&z!==`
|
|
6497
|
+
`){if(G>=Y&&G<Y+8){let U=(G-Y)%Q.length;K.push(new N1(z,J.copyWith({color:Q[U]})))}else K.push(new N1(z,J));G++}else K.push(new N1(z,J))}return K}}G9();l8();b2();class gR extends c0{controller;getScrollInfo;thickness;trackChar;thumbChar;showTrack;thumbColor;trackColor;constructor({key:J,controller:Q,getScrollInfo:Z,thickness:X=1,trackChar:Y="█",thumbChar:K="█",showTrack:G=!0,thumbColor:q,trackColor:z}){super(J?{key:J}:{});this.controller=Q,this.getScrollInfo=Z,this.thickness=X,this.trackChar=Y,this.thumbChar=K,this.showTrack=G,this.thumbColor=q,this.trackColor=z}createState(){return new uU6}}class uU6 extends d0{_dragStartY=null;_dragStartOffset=null;_isOverThumb=!1;_isPositionOverThumb(J){let{totalContentHeight:Q,viewportHeight:Z}=this.widget.getScrollInfo(),Y=this.context.findRenderObject()?.size.height??0;if(Y===0||Q<=Z)return!1;let K=this.widget.getScrollInfo(),G=Math.min(1,Z/Q),q=Math.max(1,Y*G),z=Math.max(0,Math.min(1,K.scrollOffset/(Q-Z))),U=Y-q,W=Math.max(0,U*z),F=W+q;return J>=W&&J<=F}_handleHover=(J)=>{let Q=this._isOverThumb;if(this._isOverThumb=this._isPositionOverThumb(J.localPosition.y),Q!==this._isOverThumb)this.setState()};_handleDrag=(J)=>{let{totalContentHeight:Q,viewportHeight:Z,scrollOffset:X}=this.widget.getScrollInfo(),K=this.context.findRenderObject()?.size.height??0;if(K===0||Q<=Z)return;if(this._dragStartY===null)this._dragStartY=J.localPosition.y,this._dragStartOffset=X;let G=J.localPosition.y-this._dragStartY,q=Math.min(1,Z/Q),z=Math.max(1,K*q),U=K-z;if(U<=0)return;let W=Q-Z,F=U/W,H=G/F,B=Math.max(0,Math.min(W,this._dragStartOffset+H));this.widget.controller.jumpTo(B)};_handleRelease=()=>{this._dragStartY=null,this._dragStartOffset=null};_handleClick=(J)=>{if(J.button!=="left")return;let Q=J.localPosition.y,{totalContentHeight:Z,viewportHeight:X,scrollOffset:Y}=this.widget.getScrollInfo(),G=this.context.findRenderObject()?.size.height??0;if(G===0||Z<=X)return;let q=Math.min(1,X/Z),z=Math.max(1,G*q),U=Z-X,W=G-z,F=Math.max(0,Math.min(1,Y/(Z-X))),H=Math.max(0,W*F),B=H+z;if(Q>=H&&Q<=B)return;if(Q<H)this.widget.controller.animateTo(Math.max(0,Y-X));else this.widget.controller.animateTo(Math.min(U,Y+X))};build(J){return new x9({onClick:this._handleClick,onHover:this._handleHover,onDrag:this._handleDrag,onRelease:this._handleRelease,cursor:this._isOverThumb?z7.POINTER:z7.DEFAULT,child:new pU6({controller:this.widget.controller,getScrollInfo:this.widget.getScrollInfo,thickness:this.widget.thickness,trackChar:this.widget.trackChar,thumbChar:this.widget.thumbChar,showTrack:this.widget.showTrack,thumbColor:this.widget.thumbColor,trackColor:this.widget.trackColor})})}}class pU6 extends bC{controller;getScrollInfo;thickness;trackChar;thumbChar;showTrack;thumbColor;trackColor;constructor({key:J,controller:Q,getScrollInfo:Z,thickness:X=1,trackChar:Y="█",thumbChar:K="█",showTrack:G=!0,thumbColor:q,trackColor:z}){super(J?{key:J}:{});this.controller=Q,this.getScrollInfo=Z,this.thickness=X,this.trackChar=Y,this.thumbChar=K,this.showTrack=G,this.thumbColor=q,this.trackColor=z}createRenderObject(){return new dU6(this)}updateRenderObject(J){J.updateWidget(this)}}class dU6 extends Z8{_widget;constructor(J){super();this._widget=J}updateWidget(J){this._widget=J,this.markNeedsLayout()}performLayout(){let J=this._lastConstraints;m6(!!J,"performLayout called without constraints");let Q=Math.min(J.maxWidth,this._widget.thickness),Z=J.maxHeight;this.setSize(Q,Z),super.performLayout()}getMinIntrinsicWidth(J){return this._widget.thickness}getMaxIntrinsicWidth(J){return this._widget.thickness}getMinIntrinsicHeight(J){return 0}getMaxIntrinsicHeight(J){return 1/0}paint(J,Q,Z){let{thumbStartFloat:X,thumbSizeFloat:Y,showScrollbar:K}=this._calculateScrollbarMetrics();if(!K)return;let G=this._widget.trackColor,q=this._widget.thumbColor,z=["▁","▂","▃","▄","▅","▆","▇","█"],U=X,W=X+Y;for(let F=0;F<this.size.height;F++){let H="█",B=G,M=q;if(F===Math.floor(U)){let V=1-(U-F),N=Math.floor(V*8);H=z[N]||"█",B=q,M=G}else if(F===Math.floor(W)){let V=1-(W-F),N=Math.floor(V*8);H=z[N]||"█",B=G,M=q}else if(F>U&&F<W)B=q;J.setChar(Q,Z+F,H,{fg:B,bg:M},1)}}_calculateScrollbarMetrics(){let{totalContentHeight:J,viewportHeight:Q,scrollOffset:Z}=this._widget.getScrollInfo(),X=this.size.height;if(J<=Q||X<=0)return{thumbStartFloat:0,thumbSizeFloat:0,showScrollbar:!1};let Y=Math.max(0,Math.min(1,Z/(J-Q))),K=Math.min(1,Q/J),G=Math.max(1,X*K),q=X-G;return{thumbStartFloat:Math.max(0,q*Y),thumbSizeFloat:G,showScrollbar:!0}}}l8();class RN{state=[!0,!1,!0,!1,!0,!1,!0,!1];previousState=[];generation=0;maxGenerations=15;neighborMap=[[1,3,4,5,7],[0,2,4,5,6],[1,3,5,6,7],[0,2,4,6,7],[0,1,3,5,7],[0,1,2,4,6],[1,2,3,5,7],[0,2,3,4,6]];step(){let J=this.state.map((K,G)=>{let q=this.neighborMap[G].filter((z)=>this.state[z]).length;if(K)return q===2||q===3;return q===3||q===6}),Q=J.every((K,G)=>K===this.state[G]),Z=this.previousState.length>0&&J.every((K,G)=>K===this.previousState[G]);this.previousState=[...this.state],this.state=J,this.generation++;let X=J.every((K)=>!K),Y=J.filter((K)=>K).length;if(Q||Z||this.generation>=this.maxGenerations||X||Y<2){let K;do K=Array.from({length:8},()=>Math.random()>0.6);while(K.filter((G)=>G).length<3);this.state=K,this.previousState=[],this.generation=0}}toBraille(){let J=[0,1,2,6,3,4,5,7],Q=10240;for(let Z=0;Z<8;Z++)if(this.state[Z])Q|=1<<J[Z];return String.fromCharCode(Q)}}var aW9=/<[^>]+>/g,rW9=/<ENCRYPTED>[\s\S]*?<\/ENCRYPTED>/g,sW9=/<ID>[\s\S]*?<\/ID>/g;function tm1(J){return J.replace(rW9,"").replace(sW9,"").replace(aW9,"").trim()}class Zd extends c0{thinkingBlock;expanded;onToggle;isStreaming;constructor({key:J,thinkingBlock:Q,expanded:Z=!1,onToggle:X,isStreaming:Y=!1}){super(J?{key:J}:{});this.thinkingBlock=Q,this.expanded=Z,this.onToggle=X,this.isStreaming=Y}createState(){return new cU6}}class cU6 extends d0{_animationTimer;_spinner=new RN;get isComplete(){return!this.widget.isStreaming}initState(){if(super.initState(),!this.isComplete)this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.isStreaming&&!this.widget.isStreaming)this._stopAnimation();else if(!J.isStreaming&&this.widget.isStreaming)this._startAnimation();if(J.expanded!==this.widget.expanded)this.setState(()=>{})}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Z=e6.of(J).colorScheme,X=this.isComplete?Z.success:Z.accent,Y=this.isComplete?"✓ ":`${this._spinner.toBraille()} `,K=new n1({text:new N1("",void 0,[new N1(Y,new j1({color:X,bold:!0})),new N1("Thinking",new j1({color:Z.foreground,bold:!0}))]),selectable:!0}),G=tm1(this.widget.thinkingBlock.thinking);if(!(G.length>0))return K;let z=new x6({padding:V0.only({left:2}),child:new RX({markdown:G,styleScheme:{...sm1(),text:new j1({color:Z.foreground,dim:!0,italic:!0}),inlineCode:new j1({color:Z.foreground,dim:!0,italic:!0,bold:!0}),codeBlock:new j1({color:Z.foreground,dim:!0,italic:!0}),link:new j1({color:Z.foreground,dim:!0,italic:!0,underline:!0})}})});return new ah1({title:K,child:z,expanded:this.widget.expanded,onChanged:this.widget.onToggle})}}class wQ{static _instance=null;_allExpanded=!1;_listeners=new Set;static get instance(){if(!this._instance)this._instance=new wQ;return this._instance}get allExpanded(){return this._allExpanded}toggleAll(){this._allExpanded=!this._allExpanded,this._notifyListeners()}addListener(J){return this._listeners.add(J),()=>this.removeListener(J)}removeListener(J){this._listeners.delete(J)}_notifyListeners(){for(let J of this._listeners)J()}}function em1(J){if(!J)return"";let Q=J.match(/^refs\/(heads|tags)\/(.+)$/);if(Q)return Q[2]||"";let Z=J.match(/^(\^)?([0-9a-f]{7,40})(\^\d+|\^+|~\d*)?$/i);if(Z){let X=Z[1]||"",Y=Z[2]||"",K=Z[3]||"";return X+Y.slice(0,7)+K}return J}AW();z8();v6();l8();Tc();G0();v6();b2();import{access as oW9,constants as tW9}from"node:fs/promises";async function eW9(J){try{return await oW9(J,tW9.F_OK),!0}catch{return!1}}function JF9(J){return`Failed to open link:
|
|
6498
6498
|
${J}
|
|
6499
6499
|
|
|
6500
6500
|
File does not exist.`}function QF9(J,Q){let Z=Q instanceof Error?Q.message:String(Q),X="Failed to open link";if(J)X+=`:
|
|
6501
6501
|
${J}`;return X+=`
|
|
6502
6502
|
|
|
6503
|
-
${Z}`,X}async function ZF9(J){u.error("Failed to open file link",{error:J});let Q=J.uri;if(Q?.startsWith("file://")){let Z=O0.parse(Q).fsPath;if(!await eW9(Z))return JF9(Q)}return QF9(Q,J)}class Ju1 extends I6{uri;text;style;maxLines;overflow;constructor({uri:J,text:Q,style:Z,maxLines:X,overflow:Y,key:K}){super({key:K});this.uri=J,this.text=Q,this.style=Z,this.maxLines=X,this.overflow=Y}build(J){let Q=MN.of(J);return m6(Q!==void 0,"FileLink widget requires ErrorHandlerProvider in context"),new NQ({uri:this.uri,text:this.text,style:this.style,maxLines:this.maxLines,overflow:this.overflow,onError:async(Z)=>{let X=await ZF9(Z);Q(Error(X))}})}}G0();class Qu1 extends I6{props;highlightedLines=new Map;cachedDiffLines;cachedLineNumDimensions;constructor(J){super();this.props=J;this.cachedDiffLines=this.parseDiffLines(this.props.diff),this.cachedLineNumDimensions=this.calculateLineNumberDimensions()}createHighlightedSpan(J,Q,Z,X,Y,K){if(!Z)return new N1(`${J}${Q}`,new
|
|
6504
|
-
`).filter((q)=>!q.startsWith("Index:")&&!q.startsWith("===")&&!q.match(/^--- .*/)&&!q.match(/^\+\+\+ .*/)),X=this.calculateMinIndentation(Z),Y=Z.map((q)=>{if(q.match(/^@@ .* @@/)||!q.trim())return q;let z=q[0],U=q.slice(1);if(U.length>X)return z+" "+U.slice(X);return q}),K=0,G=0;for(let q of Y)if(q.match(/^@@ .* @@/)){let z=q.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(z)K=parseInt(z[1],10),G=parseInt(z[2],10),Q.push({type:"chunk",content:q})}else if(q.startsWith("+"))Q.push({type:"add",content:q.slice(1),newLineNum:G++});else if(q.startsWith("-"))Q.push({type:"remove",content:q.slice(1),oldLineNum:K++});else Q.push({type:"context",content:q.startsWith(" ")?q.slice(1):q,oldLineNum:K++,newLineNum:G++});return Q}formatUnifiedDiff(J){let Q=new $1({color:J.foreground,dim:!0}),Z=xG6(J.success,J.destructive,J.background),X=process.env.TERM_PROGRAM==="Apple_Terminal",Y=!Z,K={type:"index",value:2},G={type:"index",value:1},q=X?{type:"index",value:52}:Z?.removed,z=X?{type:"index",value:23}:Z?.added,U=[];U.push(new n1({text:new N1(" Diff:",new $1({color:J.foreground,dim:!0}))}));let{lineNumWidth:W,totalWidth:F}=this.cachedLineNumDimensions;for(let H=0;H<this.cachedDiffLines.length;H++){let B=this.cachedDiffLines[H],M=this.highlightedLines.get(H);if(B.type==="chunk")U.push(new n1({text:new N1(" ...",Q)}));else if(B.type==="add"){let V=B.newLineNum.toString().padStart(W),N=this.createHighlightedSpan("+",B.content,Y?void 0:M,Y?K:E1.green,J);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:Y?new n1({text:N}):new y0({decoration:new i8(z),child:new n1({text:N})})})]}))}else if(B.type==="remove"){let V=B.oldLineNum.toString().padStart(W),N=this.createHighlightedSpan("-",B.content,Y?void 0:M,Y?G:E1.red,J);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:Y?new n1({text:N}):new y0({decoration:new i8(q),child:new n1({text:N})})})]}))}else{let V=B.newLineNum.toString().padStart(W),N=this.createHighlightedSpan(" ",B.content,M,Q.color,J,!0);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:new n1({text:N})})]}))}}return new i0({crossAxisAlignment:"start",children:U})}calculateMinIndentation(J){let Q=Number.POSITIVE_INFINITY;for(let Z of J){if(Z.match(/^@@ .* @@/)||!Z.trim())continue;let X=Z.slice(1);if(!X.trim())continue;let Y=X.match(/^[\t ]*/)?.[0].length??0;Q=Math.min(Q,Y)}return Q===Number.POSITIVE_INFINITY?0:Q}calculateLineNumberDimensions(){let J=Math.max(0,...this.cachedDiffLines.map((X)=>Math.max(X.oldLineNum??0,X.newLineNum??0))),Q=Math.max(4,String(J).length),Z=1+Q+1;return{lineNumWidth:Q,totalWidth:Z}}}class U7 extends c0{props;constructor(J){super();this.props=J}createState(){return new lU6}}class lU6 extends d0{_animationTimer;_spinner=new RN;initState(){if(super.initState(),this.widget.props.status==="in-progress")this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.props.status!=="in-progress"&&this.widget.props.status==="in-progress")this._startAnimation();else if(J.props.status==="in-progress"&&this.widget.props.status!=="in-progress")this._stopAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let{name:Q,status:Z,children:X,tail:Y,content:K}=this.widget.props,G=i6.of(J),q=Z==="in-progress"?this._spinner.toBraille():XF9(Z),z=zQ1(Z),U=[];U.push(new N1(`${q} `,new $1({color:z}))),U.push(new N1(Q,new $1({color:G.app.toolName,bold:!0})));let W=new n1({text:new N1("",void 0,U),selectable:!0}),F;if(!X||X.length===0)F=W;else{let B=[W];for(let M of X)B.push(new U0({width:1})),B.push(M);F=new X8({children:B,mainAxisSize:"min"})}if((!Y||Y.length===0)&&!K)return F;let H=[F];if(Y&&Y.length>0)H.push(new n1({text:new N1("",void 0,Y),selectable:!0}));if(K)H.push(K);return new i0({crossAxisAlignment:"start",children:H})}}function XF9(J){switch(J){case"done":return"✓";case"error":case"cancelled":case"rejected-by-user":case"cancellation-requested":return"✕";case"in-progress":case"queued":case"blocked-on-user":return"⋯"}}function zQ1(J){switch(J){case"done":return E1.green;case"error":return E1.red;case"cancellation-requested":case"cancelled":case"rejected-by-user":return E1.yellow;case"in-progress":return E1.blue;case"queued":return E1.cyan;case"blocked-on-user":return E1.magenta}}class Zu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,X=Z?.status??"in-progress",Y=[];if(!Q.input)return new U7({name:"Edit",status:X,children:Y});let K=Q.input;if(K.path){let z=dC(K.path,J);Y.push(new Ju1({uri:`file://${K.path}`,text:z,style:new $1({color:E1.cyan,dim:!0,underline:!0})}))}let G=[];if(X==="done"&&K.old_str&&K.new_str){let z=Pc(K.old_str,K.new_str);if(z.added>0||z.deleted>0||z.changed>0){if(z.added>0)G.push(new N1(`+${z.added}`,new $1({color:E1.green})));if(z.changed>0)G.push(new N1(` ~${z.changed}`,new $1({color:E1.yellow})));if(z.deleted>0)G.push(new N1(` -${z.deleted}`,new $1({color:E1.red})))}}if(G.length>0)Y.push(new n1({text:new N1("",void 0,G)}));let q;if(YF9(Z))q=new Qu1({diff:Z.result.diff,filePath:K.path});return new U7({name:"Edit",status:X,children:Y,content:q})}}function YF9(J){return J?.status==="done"&&typeof J.result==="object"}vy();class ON extends c0{toolUse;toolRun;name;detail;inputSection;outputSection;subagentTools;thread;constructor(J){super();this.toolUse=J.toolUse,this.toolRun=J.toolRun,this.name=J.name,this.detail=J.detail,this.inputSection=J.inputSection,this.outputSection=J.outputSection,this.subagentTools=J.subagentTools,this.thread=J.thread}createState(){return new iU6}}class iU6 extends d0{_thinkingBlockStates=new Map;_listenerUnsubscribe;initState(){this._listenerUnsubscribe=wQ.instance.addListener(()=>{this.setState(()=>{this._thinkingBlockStates.clear()})})}dispose(){this._listenerUnsubscribe?.()}getThinkingBlockExpanded(J){return this._thinkingBlockStates.get(J)??wQ.instance.allExpanded}toggleThinking=(J)=>{return(Q)=>{this.setState(()=>{this._thinkingBlockStates.set(J,Q)})}};build(J){let{toolRun:Q,name:Z,detail:X,inputSection:Y,outputSection:K,subagentTools:G,thread:q}=this.widget,z=q&&Q.status==="done"?F30(q,this.widget.toolUse.id):void 0,U=[];if(XB(J)&&z&&z>0){let M=i6.of(J);U.push(new n1({text:new N1(` ${ZB(z)}`,new $1({color:M.colors.foreground,dim:!0}))}))}if(X&&X.length>0)U.push(new n1({text:new N1("",void 0,X)}));let F=new U7({name:Z,status:Q.status,children:U}),H=[];if(Y)H.push(new RX({markdown:Y.content}));if((Q.status==="in-progress"||Q.status==="done"||Q.status==="cancelled"||Q.status==="error")&&Q.progress){let M=Q.progress??[],V=G??[],N=0,L=0;for(let A=0;A<M.length;A++){let w=M[A];if(w?.reasoning){let R=A===M.length-1,O=Q.status==="in-progress"&&R,j=new Zd({key:new a7(`thinking-${L}`),thinkingBlock:{type:"thinking",thinking:w.reasoning,signature:""},expanded:this.getThinkingBlockExpanded(L),onToggle:this.toggleThinking(L),isStreaming:O});H.push(j),L++}if(w?.tool_uses)for(let R of w.tool_uses){let O=V[N];if(O)H.push(new mR({toolUse:O.toolUse,toolRun:O.toolRun})),N++}}for(;N<V.length;N++){let A=V[N];if(A)H.push(new mR({toolUse:A.toolUse,toolRun:A.toolRun}))}}else if(G&&G.length>0)for(let M of G)H.push(new mR({toolUse:M.toolUse,toolRun:M.toolRun}));if(K)H.push(new RX({markdown:K.content}));return new i0({crossAxisAlignment:"start",children:[F,new x6({padding:new V0(2,0,2,0),child:new ip({children:H})})]})}}class Xu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,subagentTools:X,thread:Y}=this.props,K=Z.status==="done"?Z.result:Z.status==="in-progress"?Z.result:void 0;return new ON({toolUse:Q,toolRun:Z,name:"Oracle",inputSection:Q.input?.task&&typeof Q.input.task==="string"?{content:Q.input.task}:void 0,outputSection:K?{content:K}:void 0,subagentTools:X,thread:Y})}}class Yu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,subagentTools:X,thread:Y}=this.props,K=[];if(Q.input?.description&&typeof Q.input.description==="string")K.push(new N1(Q.input.description,new $1({color:E1.blue,bold:!0})));return new ON({toolUse:Q,toolRun:Z,name:"Subagent",detail:K,inputSection:Q.input?.prompt&&typeof Q.input.prompt==="string"?{content:Q.input.prompt}:void 0,subagentTools:X,thread:Y})}}class mR extends I6{props;constructor(J){super();this.props=J}build(J){return this.buildToolWidget(J)}buildToolWidget(J){let{toolUse:Q,toolRun:Z}=this.props;if(Q.name.startsWith("tb__"))return this.buildToolboxTool(J,Q,Z);switch(Q.name){case"todo_write":return this.buildTodoWriteTool(J,Q,Z);case"todo_read":return this.buildGenericTool(J,Q,Z,void 0,"Read TODOs");case"Read":return this.buildReadTool(Q,Z);case"create_file":return this.buildCreateFileTool(Q,Z);case"edit_file":return this.buildEditFileTool(Q,Z);case"undo_edit":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Undo Edit");case"glob":case"Glob":return this.buildGenericTool(J,Q,Z,Q.input?.filePattern,"Glob");case C5:return this.buildCodebaseSearchTool(J,Q,Z);case tq:return this.buildCodebaseSearchTool(J,Q,Z);case eq:return this.buildCodebaseSearchTool(J,Q,Z);case AB:return this.buildCodebaseSearchTool(J,Q,Z);case wB:return this.buildCodebaseSearchTool(J,Q,Z);case"Grep":return this.buildGrepTool(Q,Z);case nd:return this.buildLibrarianReadTool(J,Q,Z);case ad:return this.buildLibrarianSearchTool(J,Q,Z);case td:return this.buildLibrarianGlobTool(J,Q,Z);case sd:return this.buildLibrarianListDirectoryTool(J,Q,Z);case od:return this.buildLibrarianListRepositoriesTool(J,Q,Z);case rd:return this.buildLibrarianCommitSearchTool(J,Q,Z);case ed:return this.buildLibrarianDiffTool(J,Q,Z);case jB:return this.buildWebSearchTool(J,Q,Z);case"read_web_page":return this.buildReadWebPageTool(J,Q,Z);case qO:return this.buildReadThreadTool(J,Q,Z);case"Bash":return this.buildBashTool(Q,Z);case"Task":return this.buildTaskTool(J,Q,Z);case"oracle":return this.buildOracleTool(J,Q,Z);case"librarian":return this.buildLibrarianTool(J,Q,Z);case"mermaid":return this.buildMermaidTool(J,Q,Z);case"format_file":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Format");case"get_diagnostics":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Get Diagnostics");case"call_openai":return this.buildGenericTool(J,Q,Z,Q.input?.model,"OpenAI Call");case"run_routine":return this.buildGenericTool(J,Q,Z,Q.input?.routine,"Run Routine");case"run_javascript":{let X=Q.input?.code?.split(`
|
|
6505
|
-
`).length||0;return this.buildGenericTool(J,Q,Z,`${X} lines`,"Run JavaScript")}default:return this.buildGenericTool(J,Q,Z,JSON.stringify(Q.input))}}buildTodoWriteTool(J,Q,Z){return new U7({name:"Update TODOs",status:Z.status})}buildLibrarianTool(J,Q,Z){let X=Z,Y=X.status==="done"||X.status==="in-progress"?X.result:void 0;return new ON({toolUse:Q,toolRun:X,name:"Librarian",inputSection:Q.input?.query&&typeof Q.input.query==="string"?{content:Q.input.query}:void 0,outputSection:Y&&typeof Y==="string"?{content:Y}:void 0,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildOracleTool(J,Q,Z){return new Xu1({toolUse:Q,toolRun:Z,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildReadTool(J,Q){return new nU6({toolUse:J,toolRun:Q})}buildEditFileTool(J,Q){return new Zu1({toolUse:J,toolRun:Q})}buildCodebaseSearchTool(J,Q,Z){let X=Z.status==="done"?Z.result:Z.status==="in-progress"?Z.result:void 0;return new ON({toolUse:Q,toolRun:Z,name:"Search",inputSection:typeof Q.input?.query==="string"?{content:Q.input.query}:void 0,outputSection:X&&typeof X==="string"?{content:X}:void 0,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildGrepTool(J,Q){return new rU6({toolUse:J,toolRun:Q})}buildWebSearchTool(J,Q,Z){return new KW6({context:J,toolUse:Q,toolRun:Z})}buildReadWebPageTool(J,Q,Z){let X=[];if(typeof Q.input?.url==="string")X.push(new n1({text:new N1(Q.input.url,new
|
|
6506
|
-
`).length,z=[];if(G.trim())z.push(new n1({text:new N1(`diagram (${q} lines)`,new
|
|
6507
|
-
`)),U.push(new N1(` Error: ${Z.error.message}`,new
|
|
6508
|
-
`)),U.push(new N1(` Error: ${Z.error.message}`,new
|
|
6509
|
-
`),B=H[0]||"",M=H.slice(1),V=[];if(q==="in-progress"){let N=this._spinner.toBraille();V.push(new N1(`${N} `,new
|
|
6503
|
+
${Z}`,X}async function ZF9(J){u.error("Failed to open file link",{error:J});let Q=J.uri;if(Q?.startsWith("file://")){let Z=O0.parse(Q).fsPath;if(!await eW9(Z))return JF9(Q)}return QF9(Q,J)}class Ju1 extends I6{uri;text;style;maxLines;overflow;constructor({uri:J,text:Q,style:Z,maxLines:X,overflow:Y,key:K}){super({key:K});this.uri=J,this.text=Q,this.style=Z,this.maxLines=X,this.overflow=Y}build(J){let Q=MN.of(J);return m6(Q!==void 0,"FileLink widget requires ErrorHandlerProvider in context"),new NQ({uri:this.uri,text:this.text,style:this.style,maxLines:this.maxLines,overflow:this.overflow,onError:async(Z)=>{let X=await ZF9(Z);Q(Error(X))}})}}G0();class Qu1 extends I6{props;highlightedLines=new Map;cachedDiffLines;cachedLineNumDimensions;constructor(J){super();this.props=J;this.cachedDiffLines=this.parseDiffLines(this.props.diff),this.cachedLineNumDimensions=this.calculateLineNumberDimensions()}createHighlightedSpan(J,Q,Z,X,Y,K){if(!Z)return new N1(`${J}${Q}`,new j1({color:X,dim:K}));let G=Y.foreground,q=[new N1(J,new j1({color:X}))];for(let z of Z)q.push(new N1(z.content,new j1({color:z.color??G})));return new N1("",void 0,q)}build(J){let Q=i6.of(J);if(this.props.filePath&&this.highlightedLines.size===0)for(let Z=0;Z<this.cachedDiffLines.length;Z++){let X=this.cachedDiffLines[Z];if(X.type!=="chunk"&&X.content.trim())try{let Y=zJ1(X.content,Q.app.syntaxHighlight,this.props.filePath);this.highlightedLines.set(Z,Y)}catch(Y){u.error("failed to highlight syntax",Y)}}return this.formatUnifiedDiff(Q.colors)}parseDiffLines(J){let Q=[],Z=J.replace(/^`{3,}diff\n|`{3,}$/g,"").split(`
|
|
6504
|
+
`).filter((q)=>!q.startsWith("Index:")&&!q.startsWith("===")&&!q.match(/^--- .*/)&&!q.match(/^\+\+\+ .*/)),X=this.calculateMinIndentation(Z),Y=Z.map((q)=>{if(q.match(/^@@ .* @@/)||!q.trim())return q;let z=q[0],U=q.slice(1);if(U.length>X)return z+" "+U.slice(X);return q}),K=0,G=0;for(let q of Y)if(q.match(/^@@ .* @@/)){let z=q.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(z)K=parseInt(z[1],10),G=parseInt(z[2],10),Q.push({type:"chunk",content:q})}else if(q.startsWith("+"))Q.push({type:"add",content:q.slice(1),newLineNum:G++});else if(q.startsWith("-"))Q.push({type:"remove",content:q.slice(1),oldLineNum:K++});else Q.push({type:"context",content:q.startsWith(" ")?q.slice(1):q,oldLineNum:K++,newLineNum:G++});return Q}formatUnifiedDiff(J){let Q=new j1({color:J.foreground,dim:!0}),Z=xG6(J.success,J.destructive,J.background),X=process.env.TERM_PROGRAM==="Apple_Terminal",Y=!Z,K={type:"index",value:2},G={type:"index",value:1},q=X?{type:"index",value:52}:Z?.removed,z=X?{type:"index",value:23}:Z?.added,U=[];U.push(new n1({text:new N1(" Diff:",new j1({color:J.foreground,dim:!0}))}));let{lineNumWidth:W,totalWidth:F}=this.cachedLineNumDimensions;for(let H=0;H<this.cachedDiffLines.length;H++){let B=this.cachedDiffLines[H],M=this.highlightedLines.get(H);if(B.type==="chunk")U.push(new n1({text:new N1(" ...",Q)}));else if(B.type==="add"){let V=B.newLineNum.toString().padStart(W),N=this.createHighlightedSpan("+",B.content,Y?void 0:M,Y?K:E1.green,J);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:Y?new n1({text:N}):new y0({decoration:new i8(z),child:new n1({text:N})})})]}))}else if(B.type==="remove"){let V=B.oldLineNum.toString().padStart(W),N=this.createHighlightedSpan("-",B.content,Y?void 0:M,Y?G:E1.red,J);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:Y?new n1({text:N}):new y0({decoration:new i8(q),child:new n1({text:N})})})]}))}else{let V=B.newLineNum.toString().padStart(W),N=this.createHighlightedSpan(" ",B.content,M,Q.color,J,!0);U.push(new X8({crossAxisAlignment:"start",children:[new U0({width:F,child:new n1({text:new N1(` ${V} `,Q)})}),new R8({child:new n1({text:N})})]}))}}return new i0({crossAxisAlignment:"start",children:U})}calculateMinIndentation(J){let Q=Number.POSITIVE_INFINITY;for(let Z of J){if(Z.match(/^@@ .* @@/)||!Z.trim())continue;let X=Z.slice(1);if(!X.trim())continue;let Y=X.match(/^[\t ]*/)?.[0].length??0;Q=Math.min(Q,Y)}return Q===Number.POSITIVE_INFINITY?0:Q}calculateLineNumberDimensions(){let J=Math.max(0,...this.cachedDiffLines.map((X)=>Math.max(X.oldLineNum??0,X.newLineNum??0))),Q=Math.max(4,String(J).length),Z=1+Q+1;return{lineNumWidth:Q,totalWidth:Z}}}class U7 extends c0{props;constructor(J){super();this.props=J}createState(){return new lU6}}class lU6 extends d0{_animationTimer;_spinner=new RN;initState(){if(super.initState(),this.widget.props.status==="in-progress")this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.props.status!=="in-progress"&&this.widget.props.status==="in-progress")this._startAnimation();else if(J.props.status==="in-progress"&&this.widget.props.status!=="in-progress")this._stopAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let{name:Q,status:Z,children:X,tail:Y,content:K}=this.widget.props,G=i6.of(J),q=Z==="in-progress"?this._spinner.toBraille():XF9(Z),z=zQ1(Z),U=[];U.push(new N1(`${q} `,new j1({color:z}))),U.push(new N1(Q,new j1({color:G.app.toolName,bold:!0})));let W=new n1({text:new N1("",void 0,U),selectable:!0}),F;if(!X||X.length===0)F=W;else{let B=[W];for(let M of X)B.push(new U0({width:1})),B.push(M);F=new X8({children:B,mainAxisSize:"min"})}if((!Y||Y.length===0)&&!K)return F;let H=[F];if(Y&&Y.length>0)H.push(new n1({text:new N1("",void 0,Y),selectable:!0}));if(K)H.push(K);return new i0({crossAxisAlignment:"start",children:H})}}function XF9(J){switch(J){case"done":return"✓";case"error":case"cancelled":case"rejected-by-user":case"cancellation-requested":return"✕";case"in-progress":case"queued":case"blocked-on-user":return"⋯"}}function zQ1(J){switch(J){case"done":return E1.green;case"error":return E1.red;case"cancellation-requested":case"cancelled":case"rejected-by-user":return E1.yellow;case"in-progress":return E1.blue;case"queued":return E1.cyan;case"blocked-on-user":return E1.magenta}}class Zu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,X=Z?.status??"in-progress",Y=[];if(!Q.input)return new U7({name:"Edit",status:X,children:Y});let K=Q.input;if(K.path){let z=dC(K.path,J);Y.push(new Ju1({uri:`file://${K.path}`,text:z,style:new j1({color:E1.cyan,dim:!0,underline:!0})}))}let G=[];if(X==="done"&&K.old_str&&K.new_str){let z=Pc(K.old_str,K.new_str);if(z.added>0||z.deleted>0||z.changed>0){if(z.added>0)G.push(new N1(`+${z.added}`,new j1({color:E1.green})));if(z.changed>0)G.push(new N1(` ~${z.changed}`,new j1({color:E1.yellow})));if(z.deleted>0)G.push(new N1(` -${z.deleted}`,new j1({color:E1.red})))}}if(G.length>0)Y.push(new n1({text:new N1("",void 0,G)}));let q;if(YF9(Z))q=new Qu1({diff:Z.result.diff,filePath:K.path});return new U7({name:"Edit",status:X,children:Y,content:q})}}function YF9(J){return J?.status==="done"&&typeof J.result==="object"}vy();class ON extends c0{toolUse;toolRun;name;detail;inputSection;outputSection;subagentTools;thread;constructor(J){super();this.toolUse=J.toolUse,this.toolRun=J.toolRun,this.name=J.name,this.detail=J.detail,this.inputSection=J.inputSection,this.outputSection=J.outputSection,this.subagentTools=J.subagentTools,this.thread=J.thread}createState(){return new iU6}}class iU6 extends d0{_thinkingBlockStates=new Map;_listenerUnsubscribe;initState(){this._listenerUnsubscribe=wQ.instance.addListener(()=>{this.setState(()=>{this._thinkingBlockStates.clear()})})}dispose(){this._listenerUnsubscribe?.()}getThinkingBlockExpanded(J){return this._thinkingBlockStates.get(J)??wQ.instance.allExpanded}toggleThinking=(J)=>{return(Q)=>{this.setState(()=>{this._thinkingBlockStates.set(J,Q)})}};build(J){let{toolRun:Q,name:Z,detail:X,inputSection:Y,outputSection:K,subagentTools:G,thread:q}=this.widget,z=q&&Q.status==="done"?F30(q,this.widget.toolUse.id):void 0,U=[];if(XB(J)&&z&&z>0){let M=i6.of(J);U.push(new n1({text:new N1(` ${ZB(z)}`,new j1({color:M.colors.foreground,dim:!0}))}))}if(X&&X.length>0)U.push(new n1({text:new N1("",void 0,X)}));let F=new U7({name:Z,status:Q.status,children:U}),H=[];if(Y)H.push(new RX({markdown:Y.content}));if((Q.status==="in-progress"||Q.status==="done"||Q.status==="cancelled"||Q.status==="error")&&Q.progress){let M=Q.progress??[],V=G??[],N=0,L=0;for(let A=0;A<M.length;A++){let w=M[A];if(w?.reasoning){let R=A===M.length-1,O=Q.status==="in-progress"&&R,j=new Zd({key:new a7(`thinking-${L}`),thinkingBlock:{type:"thinking",thinking:w.reasoning,signature:""},expanded:this.getThinkingBlockExpanded(L),onToggle:this.toggleThinking(L),isStreaming:O});H.push(j),L++}if(w?.tool_uses)for(let R of w.tool_uses){let O=V[N];if(O)H.push(new mR({toolUse:O.toolUse,toolRun:O.toolRun})),N++}}for(;N<V.length;N++){let A=V[N];if(A)H.push(new mR({toolUse:A.toolUse,toolRun:A.toolRun}))}}else if(G&&G.length>0)for(let M of G)H.push(new mR({toolUse:M.toolUse,toolRun:M.toolRun}));if(K)H.push(new RX({markdown:K.content}));return new i0({crossAxisAlignment:"start",children:[F,new x6({padding:new V0(2,0,2,0),child:new ip({children:H})})]})}}class Xu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,subagentTools:X,thread:Y}=this.props,K=Z.status==="done"?Z.result:Z.status==="in-progress"?Z.result:void 0;return new ON({toolUse:Q,toolRun:Z,name:"Oracle",inputSection:Q.input?.task&&typeof Q.input.task==="string"?{content:Q.input.task}:void 0,outputSection:K?{content:K}:void 0,subagentTools:X,thread:Y})}}class Yu1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,subagentTools:X,thread:Y}=this.props,K=[];if(Q.input?.description&&typeof Q.input.description==="string")K.push(new N1(Q.input.description,new j1({color:E1.blue,bold:!0})));return new ON({toolUse:Q,toolRun:Z,name:"Subagent",detail:K,inputSection:Q.input?.prompt&&typeof Q.input.prompt==="string"?{content:Q.input.prompt}:void 0,subagentTools:X,thread:Y})}}class mR extends I6{props;constructor(J){super();this.props=J}build(J){return this.buildToolWidget(J)}buildToolWidget(J){let{toolUse:Q,toolRun:Z}=this.props;if(Q.name.startsWith("tb__"))return this.buildToolboxTool(J,Q,Z);switch(Q.name){case"todo_write":return this.buildTodoWriteTool(J,Q,Z);case"todo_read":return this.buildGenericTool(J,Q,Z,void 0,"Read TODOs");case"Read":return this.buildReadTool(Q,Z);case"create_file":return this.buildCreateFileTool(Q,Z);case"edit_file":return this.buildEditFileTool(Q,Z);case"undo_edit":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Undo Edit");case"glob":case"Glob":return this.buildGenericTool(J,Q,Z,Q.input?.filePattern,"Glob");case C5:return this.buildCodebaseSearchTool(J,Q,Z);case tq:return this.buildCodebaseSearchTool(J,Q,Z);case eq:return this.buildCodebaseSearchTool(J,Q,Z);case AB:return this.buildCodebaseSearchTool(J,Q,Z);case wB:return this.buildCodebaseSearchTool(J,Q,Z);case"Grep":return this.buildGrepTool(Q,Z);case nd:return this.buildLibrarianReadTool(J,Q,Z);case ad:return this.buildLibrarianSearchTool(J,Q,Z);case td:return this.buildLibrarianGlobTool(J,Q,Z);case sd:return this.buildLibrarianListDirectoryTool(J,Q,Z);case od:return this.buildLibrarianListRepositoriesTool(J,Q,Z);case rd:return this.buildLibrarianCommitSearchTool(J,Q,Z);case ed:return this.buildLibrarianDiffTool(J,Q,Z);case jB:return this.buildWebSearchTool(J,Q,Z);case"read_web_page":return this.buildReadWebPageTool(J,Q,Z);case qO:return this.buildReadThreadTool(J,Q,Z);case"Bash":return this.buildBashTool(Q,Z);case"Task":return this.buildTaskTool(J,Q,Z);case"oracle":return this.buildOracleTool(J,Q,Z);case"librarian":return this.buildLibrarianTool(J,Q,Z);case"mermaid":return this.buildMermaidTool(J,Q,Z);case"format_file":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Format");case"get_diagnostics":return this.buildGenericTool(J,Q,Z,Q.input?.path,"Get Diagnostics");case"call_openai":return this.buildGenericTool(J,Q,Z,Q.input?.model,"OpenAI Call");case"run_routine":return this.buildGenericTool(J,Q,Z,Q.input?.routine,"Run Routine");case"run_javascript":{let X=Q.input?.code?.split(`
|
|
6505
|
+
`).length||0;return this.buildGenericTool(J,Q,Z,`${X} lines`,"Run JavaScript")}default:return this.buildGenericTool(J,Q,Z,JSON.stringify(Q.input))}}buildTodoWriteTool(J,Q,Z){return new U7({name:"Update TODOs",status:Z.status})}buildLibrarianTool(J,Q,Z){let X=Z,Y=X.status==="done"||X.status==="in-progress"?X.result:void 0;return new ON({toolUse:Q,toolRun:X,name:"Librarian",inputSection:Q.input?.query&&typeof Q.input.query==="string"?{content:Q.input.query}:void 0,outputSection:Y&&typeof Y==="string"?{content:Y}:void 0,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildOracleTool(J,Q,Z){return new Xu1({toolUse:Q,toolRun:Z,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildReadTool(J,Q){return new nU6({toolUse:J,toolRun:Q})}buildEditFileTool(J,Q){return new Zu1({toolUse:J,toolRun:Q})}buildCodebaseSearchTool(J,Q,Z){let X=Z.status==="done"?Z.result:Z.status==="in-progress"?Z.result:void 0;return new ON({toolUse:Q,toolRun:Z,name:"Search",inputSection:typeof Q.input?.query==="string"?{content:Q.input.query}:void 0,outputSection:X&&typeof X==="string"?{content:X}:void 0,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildGrepTool(J,Q){return new rU6({toolUse:J,toolRun:Q})}buildWebSearchTool(J,Q,Z){return new KW6({context:J,toolUse:Q,toolRun:Z})}buildReadWebPageTool(J,Q,Z){let X=[];if(typeof Q.input?.url==="string")X.push(new n1({text:new N1(Q.input.url,new j1),selectable:!0}));return new U7({name:"Read Web",status:Z.status,children:X})}buildReadThreadTool(J,Q,Z){return new GW6({toolUse:Q,toolRun:Z})}buildBashTool(J,Q){return new oU6({toolUse:J,toolRun:Q})}buildToolboxTool(J,Q,Z){return new eU6({context:J,toolUse:Q,toolRun:Z})}buildTaskTool(J,Q,Z){return new Yu1({toolUse:Q,toolRun:Z,subagentTools:this.props.subagentTools,thread:this.props.thread})}buildMermaidTool(J,Q,Z){let Y=i6.of(J).colors,G=Q.input?.code||"",q=G.split(`
|
|
6506
|
+
`).length,z=[];if(G.trim())z.push(new n1({text:new N1(`diagram (${q} lines)`,new j1({color:Y.foreground,dim:!0})),selectable:!0}));let U=[];if(Z.status==="error"&&Z.error?.message)U.push(new N1(`
|
|
6507
|
+
`)),U.push(new N1(` Error: ${Z.error.message}`,new j1({color:E1.red})));else if(Z.status==="done"&&G.trim()){let W=`https://mermaid.live/edit#base64:${Buffer.from(JSON.stringify({code:G})).toString("base64")}`,F=new x9({onClick:()=>{AY(W)},cursor:"pointer",child:new n1({text:new N1("View",new j1({color:E1.cyan})),selectable:!0})});z.push(F)}return new U7({name:"Mermaid",status:Z.status,children:z,tail:U.length>0?U:void 0})}buildCreateFileTool(J,Q){return new aU6({toolUse:J,toolRun:Q})}buildLibrarianReadTool(J,Q,Z){return new QW6({toolUse:Q,toolRun:Z})}buildLibrarianSearchTool(J,Q,Z){return new UQ1({toolUse:Q,toolRun:Z,name:"Search",patternField:"pattern"})}buildLibrarianGlobTool(J,Q,Z){return new UQ1({toolUse:Q,toolRun:Z,name:"Glob",patternField:"filePattern"})}buildLibrarianListDirectoryTool(J,Q,Z){return new ZW6({toolUse:Q,toolRun:Z})}buildLibrarianListRepositoriesTool(J,Q,Z){return new XW6({toolUse:Q,toolRun:Z})}buildLibrarianCommitSearchTool(J,Q,Z){return new UQ1({toolUse:Q,toolRun:Z,name:"Commit Search",patternField:"query"})}buildLibrarianDiffTool(J,Q,Z){return new YW6({toolUse:Q,toolRun:Z})}buildGenericTool(J,Q,Z,X,Y){return new sU6({context:J,toolUse:Q,toolRun:Z,detail:X,name:Y})}}class nU6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,X=PR(J),Y=[];if(Q.input?.path){let K=Q.input.path,G=dC(K,J);if(Y.push(new NQ({uri:`file://${K}`,text:G,style:new j1({color:E1.cyan,dim:!0,underline:!0})})),Q.input.read_range){let[q,z]=Q.input.read_range;if(typeof q==="number"&&typeof z==="number"&&q>=0&&z>=0)Y.push(new n1({text:new N1(` @${q}-${z}`,new j1({color:E1.yellow,dim:!0})),selectable:!0}))}}return new U7({name:"Read",status:Z.status,children:Y})}}class aU6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,X=[];if(Q.input?.path){let Y=Q.input.path,K=dC(Y,J);X.push(new NQ({uri:`file://${Y}`,text:K,style:new j1({color:E1.cyan,dim:!0,underline:!0})}))}return new U7({name:"Create",status:Z.status,children:X})}}class rU6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=[];if(Q.input?.pattern)G.push(new N1(Q.input.pattern,new j1({color:E1.yellow})));if(Q.input?.path){let z=dC(Q.input.path,J);if(z.length>0)G.push(new N1(` in ${z}`,K))}let q=[];if(G.length>0)q.push(new n1({text:new N1("",void 0,G),selectable:!0}));return new U7({name:"Grep",status:Z.status,children:q})}}class sU6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,detail:X,name:Y}=this.props,G=i6.of(J).colors,q=new j1({color:G.foreground,dim:!0}),z=[];if(X){let W=Q.name===xJ||Q.name===cd||Q.name===t8||Q.name===id||Q.name===uN,F;if(W)try{let H=PR(J),B=O0.file(X);F=XJ(B,H??void 0)}catch{F=X}else F=X;z.push(new n1({text:new N1(F,q),selectable:!0}))}let U=[];if(Z.status==="error"&&Z.error?.message)U.push(new N1(`
|
|
6508
|
+
`)),U.push(new N1(` Error: ${Z.error.message}`,new j1({color:E1.red})));return new U7({name:Y||Q.name,status:Z.status,children:z,tail:U.length>0?U:void 0})}}class oU6 extends c0{props;constructor(J){super();this.props=J}createState(){return new tU6}}class tU6 extends d0{_animationTimer;_spinner=new RN;initState(){if(super.initState(),this.widget.props.toolRun.status==="in-progress")this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.props.toolRun.status!=="in-progress"&&this.widget.props.toolRun.status==="in-progress")this._startAnimation();else if(J.props.toolRun.status==="in-progress"&&this.widget.props.toolRun.status!=="in-progress")this._stopAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let{toolUse:Q,toolRun:Z}=this.widget.props,Y=i6.of(J).colors,K=Q.input,G=K?.cmd||"",q=Z.status,z=zQ1(Z.status),U=q==="done"&&typeof Z.result.exitCode==="number"&&Z.result.exitCode!==0,W=new j1({color:Y.foreground,bold:!0}),F=q==="cancelled"?W.copyWith({strikethrough:!0}):q==="rejected-by-user"?W.copyWith({dim:!0}):W,H=G.split(`
|
|
6509
|
+
`),B=H[0]||"",M=H.slice(1),V=[];if(q==="in-progress"){let N=this._spinner.toBraille();V.push(new N1(`${N} `,new j1({color:z})))}else{let N=new j1({color:U?E1.red:z,bold:!0});V.push(new N1("$ ",N))}if(V.push(new N1(B,F)),q!=="rejected-by-user"){let N=KF9(K,Z,J);if(N.length>0)V.push(new N1("",void 0,N))}if(q==="rejected-by-user")V.push(new N1(" (rejected)",new j1({dim:!0,italic:!0})));else if(q==="cancelled")V.push(new N1(" (cancelled)",new j1({color:E1.yellow,italic:!0})));V.push(new N1(`
|
|
6510
6510
|
`));for(let N of M)V.push(new N1(` ${N}
|
|
6511
6511
|
`,F));if(q==="error"&&Z.error.message)V.push(new N1(` Error: ${Z.error.message}
|
|
6512
|
-
`,new
|
|
6513
|
-
`),K=15,G=new
|
|
6512
|
+
`,new j1({color:E1.red})));else if(q==="done")V.push(...rC(Z.result.output,Y));else if(q==="cancelled")V.push(...rC(Z.progress?.output,Y));else if(q==="in-progress"&&Z.progress?.output)V.push(...rC(Z.progress.output,Y));return new n1({text:new N1("",void 0,V),selectable:!0})}}function rC(J,Q){if(!J)return[];let Z=[],Y=J.replace(/\r/g,"").trimEnd().split(`
|
|
6513
|
+
`),K=15,G=new j1({color:Q.foreground,dim:!0});if(Y.length>K){let q=Y.length-K;Z.push(new N1(`[... ${q} lines truncated ...]
|
|
6514
6514
|
`,G));let z=Y.slice(-K).join(`
|
|
6515
6515
|
`)+`
|
|
6516
6516
|
`;Z.push(new N1(z,G))}else{let q=Y.join(`
|
|
6517
6517
|
`)+`
|
|
6518
|
-
`;Z.push(new N1(q,G))}return Z}function KF9(J,Q,Z){let X=new
|
|
6518
|
+
`;Z.push(new N1(q,G))}return Z}function KF9(J,Q,Z){let X=new j1({italic:!0}),Y=[];if(J?.cwd){let K=PR(Z),G=O0.file(J.cwd),q=XJ(G,K??void 0);if(q.length>0)Y.push(new N1(" (",X)),Y.push(new N1("in: ",X.copyWith({dim:!0}))),Y.push(new N1(q,X.copyWith({dim:!0})))}if(Q.status==="done"&&typeof Q.result.exitCode==="number"&&Q.result.exitCode!==0){if(Y.length>0)Y.push(new N1(", ",X));else Y.push(new N1(" (",X));Y.push(new N1("exit code: ",X)),Y.push(new N1(String(Q.result.exitCode),X.copyWith({color:E1.red})))}if(Y.length>0)Y.push(new N1(")",X));return Y}class eU6 extends c0{props;constructor(J){super();this.props=J}createState(){return new JW6}}class JW6 extends d0{_animationTimer;_spinner=new RN;initState(){if(super.initState(),this.widget.props.toolRun.status==="in-progress")this._startAnimation()}didUpdateWidget(J){if(super.didUpdateWidget(J),J.props.toolRun.status!=="in-progress"&&this.widget.props.toolRun.status==="in-progress")this._startAnimation();else if(J.props.toolRun.status==="in-progress"&&this.widget.props.toolRun.status!=="in-progress")this._stopAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._spinner.step()})},200)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let{toolUse:Q,toolRun:Z}=this.widget.props,Y=i6.of(J).colors,K=Q.input,G=Z.status,q=zQ1(Z.status),z=G==="done"&&typeof Z.result.exitCode==="number"&&Z.result.exitCode!==0,U=Q.name.replace(/^tb__/,""),W=new j1({color:Y.foreground,bold:!0}),F="";if(K&&Object.keys(K).length>0)F=Object.entries(K).map(([B,M])=>`${B}: ${JSON.stringify(M)}`).join(", ");let H=[];if(G==="in-progress"){let B=this._spinner.toBraille();H.push(new N1(`${B} `,new j1({color:q})))}else{let B=new j1({color:z?E1.red:q,bold:!0});H.push(new N1("• ",B))}if(H.push(new N1(U,W)),F){let B=new j1({color:Y.foreground,dim:!0});H.push(new N1(" ",void 0)),H.push(new N1(F,B))}if(z){let B=new j1({italic:!0});H.push(new N1(" (",B)),H.push(new N1("exit code: ",B)),H.push(new N1(String(Z.result.exitCode),B.copyWith({color:E1.red}))),H.push(new N1(")",B))}if(G==="rejected-by-user")H.push(new N1(" (rejected)",new j1({dim:!0,italic:!0})));else if(G==="cancelled")H.push(new N1(" (cancelled)",new j1({color:E1.yellow,italic:!0})));if(H.push(new N1(`
|
|
6519
6519
|
`)),G==="error"&&Z.error.message)H.push(new N1(` Error: ${Z.error.message}
|
|
6520
|
-
`,new $1({color:E1.red})));else if(G==="done")H.push(...rC(Z.result.output,Y));else if(G==="cancelled")H.push(...rC(Z.progress?.output,Y));else if(G==="in-progress"&&Z.progress?.output)H.push(...rC(Z.progress.output,Y));return new n1({text:new N1("",void 0,H),selectable:!0})}}class QW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=Q.input,q=G.repository,z=G.path,U=G.read_range,W=[];if(z&&q){let F=q.startsWith("http")?`${q}/blob/main/${z}`:`https://github.com/${q}/blob/main/${z}`,H=q.replace(/^https?:\/\/github\.com\//,"");if(W.push(new NQ({uri:F,text:`${H}/${z}`,style:new $1({color:E1.cyan,dim:!0,underline:!0})})),U&&Array.isArray(U))W.push(new n1({text:new N1(` @${U[0]}-${U[1]}`,K),selectable:!0}))}return new U7({name:"Read",status:Z.status,children:W})}}class UQ1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,name:X,patternField:Y}=this.props,G=i6.of(J).colors,q=new $1({color:G.foreground,dim:!0}),z=Q.input,U=z[Y],W=z.repository,F=z.path,H=[];if(U)H.push(new N1(U,new $1({color:E1.yellow})));if(W){let M=W.replace(/^https?:\/\/github\.com\//,"");if(H.push(new N1(` in ${M}`,q)),F)H.push(new N1(`/${F}`,q))}let B=[];if(H.length>0)B.push(new n1({text:new N1("",void 0,H),selectable:!0}));return new U7({name:X,status:Z.status,children:B})}}class ZW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=Q.input,q=G.repository,z=G.path||"/",U=[];if(z)U.push(new N1(z,new $1({color:E1.yellow})));if(q)U.push(new N1(` in ${q}`,K));let W=[];if(U.length>0)W.push(new n1({text:new N1("",void 0,U),selectable:!0}));return new U7({name:"List",status:Z.status,children:W})}}class XW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=Q.input,q=G.pattern,z=G.organization,U=G.language,W=[],F=[];if(q)F.push(q);if(z)F.push(`org:${z}`);if(U)F.push(`language:${U}`);if(F.length>0)W.push(new N1(F.join(" "),new $1({color:E1.yellow})));let H=[];if(W.length>0)H.push(new n1({text:new N1("",void 0,W),selectable:!0}));return new U7({name:"List Repositories",status:Z.status,children:H})}}class YW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=Q.input,q=[];if(G.base&&G.head){let U=em1(G.base),W=em1(G.head);q.push(new N1(`${U}...${W}`,new $1({color:E1.yellow})))}if(G.repository){let U=G.repository.replace(/^https?:\/\/github\.com\//,"");q.push(new N1(` in ${U}`,K))}let z=[];if(q.length>0)z.push(new n1({text:new N1("",void 0,q),selectable:!0}));return new U7({name:"Diff",status:Z.status,children:z})}}class KW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=[],q=Q.input,z="Web search";if(q?.objective)z=q.objective;else if(q?.search_queries&&Array.isArray(q.search_queries))z=q.search_queries.join(", ");else if(q&&"query"in q&&q.query&&typeof q.query==="string")z=q.query;if(G.push(new n1({text:new N1(z,K),selectable:!0})),Z["~debug"]&&typeof Z["~debug"]==="object"&&"showParallelAttribution"in Z["~debug"]&&Z["~debug"].showParallelAttribution===!0)G.push(new n1({text:new N1(" • Powered by Parallel",new $1({dim:!0})),selectable:!1}));return new U7({name:"Web Search",status:Z.status,children:G})}}class GW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new $1({color:Y.foreground,dim:!0}),G=Q.input;if(!G)return new U7({name:"Read Thread",status:Z.status});let q=new U7({name:"Read Thread",status:Z.status,children:[new n1({text:new N1(`${G.threadID}`,K),selectable:!0})],content:G.goal?new x6({padding:new V0(2,0,2,1),child:new n1({text:new N1(G.goal,K),selectable:!0})}):void 0});return new i0({crossAxisAlignment:"start",children:[q,new x6({padding:new V0(2,0,2,0),child:Z.status==="done"?new RX({markdown:Z.result}):void 0})]})}}t9();l8();class WQ1 extends I6{title;subtitle;leading;trailing;selected;onTap;enabled;selectedColor;textColor;backgroundColor;constructor({key:J,title:Q,subtitle:Z,leading:X,trailing:Y,selected:K=!1,onTap:G,enabled:q=!0,selectedColor:z=E1.blue,textColor:U=E1.default(),backgroundColor:W}){super({key:J});this.title=Q,this.subtitle=Z,this.leading=X,this.trailing=Y,this.selected=K,this.onTap=G,this.enabled=q,this.selectedColor=z,this.textColor=U,this.backgroundColor=W}build(J){let Q=this.selected?this.selectedColor:this.textColor,Z=E1.index(8),X=new n1({text:new N1(this.title,new $1({color:Q,bold:this.selected}))}),Y=this.selected?new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new n1({text:new N1("‣",new $1({color:Q,bold:this.selected}))}),new U0({width:1}),X]}):new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new U0({width:2}),X]}),K;if(this.subtitle)K=new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[Y,new U0({height:0}),new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new U0({width:2}),new n1({text:new N1(this.subtitle,new $1({color:Z}))})]})]});else K=Y;let G=[];if(this.leading)G.push(this.leading),G.push(new U0({width:1}));if(G.push(new R8({child:K})),this.trailing)G.push(new U0({width:1})),G.push(this.trailing);let q=new X8({crossAxisAlignment:"start",children:G}),z=q;if(this.backgroundColor)z=new y0({child:q});if(this.onTap&&this.enabled)return new x9({onClick:(W)=>{if(this.enabled)this.onTap?.()},cursor:"pointer",child:z});return z}}function FQ1(J,Q,Z){return new WQ1({title:J.label,subtitle:J.description,selected:Q,onTap:Z,enabled:J.enabled??!0})}var sC=E1.green;function Ku1(J,Q,Z){if(Q.length===0)return null;let Y=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,K=[new N1("Images: ",new $1({color:Y.foreground,dim:!0}))];for(let G=0;G<Q.length;G++)if(K.push(new N1(`[image ${G+1}]`,Z)),G<Q.length-1)K.push(new N1(" ",new $1({color:Y.foreground,dim:!0})));return new x6({padding:V0.only({}),child:new n1({text:new N1("",void 0,K),selectable:!0})})}function Gu1(J,Q,Z){let X=[];if(X.push(new N1(J,Q)),Z)X.push(new N1(" (interrupted)",new $1({color:E1.yellow,italic:!0})));return new n1({text:new N1("",void 0,X),selectable:!0})}class Xd extends I6{props;constructor(J){super();this.props=J}build(J){let Z=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,X=this.props.message.interrupted?E1.yellow:Z.success,Y=this.props.message.interrupted?E1.yellow:E1.green,K=new $1({color:X,italic:!0}),G=[],q=this.props.message.content.filter((F)=>F.type==="image"),z=Ku1(J,q,K);if(z)G.push(z);let U=o7(this.props.message.content).trim();if(U){if(z)G.push(new U0({height:1}));G.push(Gu1(U,K,this.props.message.interrupted))}let W;if(G.length===0)W=new y0;else if(G.length===1)W=G[0];else W=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:G});return new y0({decoration:{border:new x8(void 0,void 0,void 0,new w8(Y,2,"solid"))},padding:V0.only({left:1}),child:W})}}class qu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new qW6}}class qW6 extends d0{selectedOptionIndex=0;focusNode=new Q9({debugLabel:"restore-confirmation"});initState(){super.initState(),this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){if(!this.widget.props.isShowingRestoreConfirmation)return"ignored";let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("j")||Q("Tab"))return this.setState(()=>{this.selectedOptionIndex=(this.selectedOptionIndex+1)%2}),"handled";if(Q("ArrowUp")||Q("k")||Q("Tab",{shift:!0}))return this.setState(()=>{this.selectedOptionIndex=(this.selectedOptionIndex-1+2)%2}),"handled";if(Q("Enter")){if(this.selectedOptionIndex===0)this.widget.props.onRestoreConfirm();else this.widget.props.onRestoreCancel();return"handled"}if(Q("Escape"))return this.widget.props.onRestoreCancel(),"handled";return"ignored"}build(J){let Q=i6.maybeOf(J),Z=Q?.colors??e6.of(J).colorScheme,X=Q?.app;if(this.widget.props.isShowingRestoreConfirmation){let B=new $1({color:sC,italic:!0}),M=[],V=this.widget.props.message.content.filter((O)=>O.type==="image"),N=Ku1(J,V,B);if(N)M.push(N);let L=o7(this.widget.props.message.content).trim();if(L)M.push(Gu1(L,B,this.widget.props.message.interrupted));M.push(new U0({height:1})),M.push(new n1({text:new N1("This will delete this message and any subsequent messages in the thread, and will restore any edits made by the agent from this message onwards.",new $1({color:E1.white,bold:!0}))})),M.push(new U0({height:1}));let A=[{value:"confirm",label:"Delete and restore"},{value:"cancel",label:"Cancel"}];for(let O=0;O<A.length;O++){let j=A[O],$=O===this.selectedOptionIndex;M.push(FQ1(j,$,void 0))}let w=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:M}),R=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),width:1/0,child:w});return new q9({focusNode:this.focusNode,autofocus:!0,child:R})}let Y=new $1({color:sC,italic:!0}),K=[],G=this.widget.props.message.content.filter((B)=>B.type==="image"),q=Ku1(J,G,Y);if(q)K.push(q);let z=o7(this.widget.props.message.content).trim();if(z)K.push(Gu1(z,Y,this.widget.props.message.interrupted));let U;if(K.length===0)U=new y0;else if(K.length===1)U=K[0];else U=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:K});let W=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),width:1/0,child:U}),F=[new N1("e",new $1({color:X?.keybind??E1.blue})),new N1(" to edit",new $1({color:Z.foreground,dim:!0}))];if(this.widget.props.isFirstMessage)F.push(new N1(", ",new $1({color:Z.foreground,dim:!0})),new N1("r",new $1({color:X?.keybind??E1.blue})),new N1(" to delete and restore",new $1({color:Z.foreground,dim:!0})),new N1(", ",new $1({color:Z.foreground,dim:!0})),new N1("f",new $1({color:X?.keybind??E1.blue})),new N1(" to fork",new $1({color:Z.foreground,dim:!0})));let H=new wX({left:2,bottom:0,child:new n1({text:new N1("",void 0,F)})});return new x6({padding:V0.only({}),child:new fC({child:new TJ({children:[W,H]})})})}}class zu1 extends c0{initialText;onSubmitted;constructor(J){super();this.initialText=J.initialText,this.onSubmitted=J.onSubmitted}createState(){return new zW6}}class zW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"user-message-editing-focus-node"});initState(){this.controller.text=this.widget.initialText}dispose(){this.controller.dispose(),this.focusNode.dispose(),super.dispose()}build(J){let Q=new cq({controller:this.controller,placeholder:"",autofocus:!0,expands:!0,minLines:1,maxLines:null,wrap:!0,submitKey:{character:"Enter"},onSubmitted:this.widget.onSubmitted,style:{padding:void 0,border:null,textColor:sC},ensureVisible:!0}),Z=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),child:Q}),X=i6.maybeOf(J),Y=X?.colors??e6.of(J).colorScheme,K=X?.app,G=new wX({right:2,top:0,child:new n1({text:new N1("",void 0,[new N1("esc",new $1({color:K?.keybind??E1.blue})),new N1(" to cancel",new $1({color:Y.foreground,dim:!0}))])})});return new fC({child:new TJ({children:[Z,G]})})}}class HQ1 extends s7{}class BQ1 extends s7{}class Uu1 extends s7{}class Wu1 extends s7{}class Fu1 extends s7{}class Hu1 extends s7{}class Bu1 extends s7{}class Du1 extends s7{}function GF9(J,Q,Z){let Y=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,G=Q.trimStart().startsWith("You're absolutely right!"),q=new a7(`${Z}-text`),z=[];if(G)z.push(new om1({key:q,markdown:Q,defaultColor:Y.foreground}));else z.push(new RX({key:q,markdown:Q}));if(z.length===1)return z[0];return new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:z})}function qF9(J,Q){let X=e6.of(J).colorScheme;if(Q.summary.type!=="message")return new y0;return new i0({crossAxisAlignment:"start",children:[new n1({text:new N1("Summary:",new $1({color:X.foreground,dim:!0,bold:!0,italic:!0})),selectable:!0}),new U0({height:1}),new RX({markdown:Q.summary.summary,styleScheme:{text:new $1({color:X.foreground,dim:!0,italic:!0}),inlineCode:new $1({color:X.foreground,dim:!0,italic:!0}),codeBlock:new $1({color:X.foreground,dim:!0,italic:!0}),tableBorder:X.foreground,link:new $1({color:X.foreground,dim:!0,italic:!0}),syntaxHighlight:{keyword:X.foreground,string:X.foreground,number:X.foreground,comment:X.foreground,function:X.foreground,variable:X.foreground,type:X.foreground,operator:X.foreground}}})]})}function zF9(J,Q){let Z=i6.maybeOf(J),X=Z?.colors??e6.of(J).colorScheme,Y=Q.hidden===!0,K=Y?"$$":"$",G=Q.toolRun.status==="done"?Q.toolRun.result.output:("progress"in Q.toolRun)?Q.toolRun.progress?.output:void 0,q=Q.toolRun.status==="done"?Q.toolRun.result.exitCode:void 0,z=Q.toolRun.status==="cancelled"?"Cancelled":Q.toolRun.status==="error"?"Errored":void 0,U=[],W=Y?Z?.app.shellModeHidden??X.mutedForeground:Z?.app.shellMode??X.primary;if(U.push(new N1(`${K} ${Q.args.cmd}`,new $1({color:W,italic:!0}))),G&&G.trim())U.push(new N1(`
|
|
6521
|
-
`+G.trimEnd(),new
|
|
6520
|
+
`,new j1({color:E1.red})));else if(G==="done")H.push(...rC(Z.result.output,Y));else if(G==="cancelled")H.push(...rC(Z.progress?.output,Y));else if(G==="in-progress"&&Z.progress?.output)H.push(...rC(Z.progress.output,Y));return new n1({text:new N1("",void 0,H),selectable:!0})}}class QW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=Q.input,q=G.repository,z=G.path,U=G.read_range,W=[];if(z&&q){let F=q.startsWith("http")?`${q}/blob/main/${z}`:`https://github.com/${q}/blob/main/${z}`,H=q.replace(/^https?:\/\/github\.com\//,"");if(W.push(new NQ({uri:F,text:`${H}/${z}`,style:new j1({color:E1.cyan,dim:!0,underline:!0})})),U&&Array.isArray(U))W.push(new n1({text:new N1(` @${U[0]}-${U[1]}`,K),selectable:!0}))}return new U7({name:"Read",status:Z.status,children:W})}}class UQ1 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z,name:X,patternField:Y}=this.props,G=i6.of(J).colors,q=new j1({color:G.foreground,dim:!0}),z=Q.input,U=z[Y],W=z.repository,F=z.path,H=[];if(U)H.push(new N1(U,new j1({color:E1.yellow})));if(W){let M=W.replace(/^https?:\/\/github\.com\//,"");if(H.push(new N1(` in ${M}`,q)),F)H.push(new N1(`/${F}`,q))}let B=[];if(H.length>0)B.push(new n1({text:new N1("",void 0,H),selectable:!0}));return new U7({name:X,status:Z.status,children:B})}}class ZW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=Q.input,q=G.repository,z=G.path||"/",U=[];if(z)U.push(new N1(z,new j1({color:E1.yellow})));if(q)U.push(new N1(` in ${q}`,K));let W=[];if(U.length>0)W.push(new n1({text:new N1("",void 0,U),selectable:!0}));return new U7({name:"List",status:Z.status,children:W})}}class XW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=Q.input,q=G.pattern,z=G.organization,U=G.language,W=[],F=[];if(q)F.push(q);if(z)F.push(`org:${z}`);if(U)F.push(`language:${U}`);if(F.length>0)W.push(new N1(F.join(" "),new j1({color:E1.yellow})));let H=[];if(W.length>0)H.push(new n1({text:new N1("",void 0,W),selectable:!0}));return new U7({name:"List Repositories",status:Z.status,children:H})}}class YW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=Q.input,q=[];if(G.base&&G.head){let U=em1(G.base),W=em1(G.head);q.push(new N1(`${U}...${W}`,new j1({color:E1.yellow})))}if(G.repository){let U=G.repository.replace(/^https?:\/\/github\.com\//,"");q.push(new N1(` in ${U}`,K))}let z=[];if(q.length>0)z.push(new n1({text:new N1("",void 0,q),selectable:!0}));return new U7({name:"Diff",status:Z.status,children:z})}}class KW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=[],q=Q.input,z="Web search";if(q?.objective)z=q.objective;else if(q?.search_queries&&Array.isArray(q.search_queries))z=q.search_queries.join(", ");else if(q&&"query"in q&&q.query&&typeof q.query==="string")z=q.query;if(G.push(new n1({text:new N1(z,K),selectable:!0})),Z["~debug"]&&typeof Z["~debug"]==="object"&&"showParallelAttribution"in Z["~debug"]&&Z["~debug"].showParallelAttribution===!0)G.push(new n1({text:new N1(" • Powered by Parallel",new j1({dim:!0})),selectable:!1}));return new U7({name:"Web Search",status:Z.status,children:G})}}class GW6 extends I6{props;constructor(J){super();this.props=J}build(J){let{toolUse:Q,toolRun:Z}=this.props,Y=i6.of(J).colors,K=new j1({color:Y.foreground,dim:!0}),G=Q.input;if(!G)return new U7({name:"Read Thread",status:Z.status});let q=new U7({name:"Read Thread",status:Z.status,children:[new n1({text:new N1(`${G.threadID}`,K),selectable:!0})],content:G.goal?new x6({padding:new V0(2,0,2,1),child:new n1({text:new N1(G.goal,K),selectable:!0})}):void 0});return new i0({crossAxisAlignment:"start",children:[q,new x6({padding:new V0(2,0,2,0),child:Z.status==="done"?new RX({markdown:Z.result}):void 0})]})}}t9();l8();class WQ1 extends I6{title;subtitle;leading;trailing;selected;onTap;enabled;selectedColor;textColor;backgroundColor;constructor({key:J,title:Q,subtitle:Z,leading:X,trailing:Y,selected:K=!1,onTap:G,enabled:q=!0,selectedColor:z=E1.blue,textColor:U=E1.default(),backgroundColor:W}){super({key:J});this.title=Q,this.subtitle=Z,this.leading=X,this.trailing=Y,this.selected=K,this.onTap=G,this.enabled=q,this.selectedColor=z,this.textColor=U,this.backgroundColor=W}build(J){let Q=this.selected?this.selectedColor:this.textColor,Z=E1.index(8),X=new n1({text:new N1(this.title,new j1({color:Q,bold:this.selected}))}),Y=this.selected?new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new n1({text:new N1("‣",new j1({color:Q,bold:this.selected}))}),new U0({width:1}),X]}):new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new U0({width:2}),X]}),K;if(this.subtitle)K=new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[Y,new U0({height:0}),new X8({mainAxisAlignment:"start",crossAxisAlignment:"center",children:[new U0({width:2}),new n1({text:new N1(this.subtitle,new j1({color:Z}))})]})]});else K=Y;let G=[];if(this.leading)G.push(this.leading),G.push(new U0({width:1}));if(G.push(new R8({child:K})),this.trailing)G.push(new U0({width:1})),G.push(this.trailing);let q=new X8({crossAxisAlignment:"start",children:G}),z=q;if(this.backgroundColor)z=new y0({child:q});if(this.onTap&&this.enabled)return new x9({onClick:(W)=>{if(this.enabled)this.onTap?.()},cursor:"pointer",child:z});return z}}function FQ1(J,Q,Z){return new WQ1({title:J.label,subtitle:J.description,selected:Q,onTap:Z,enabled:J.enabled??!0})}var sC=E1.green;function Ku1(J,Q,Z){if(Q.length===0)return null;let Y=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,K=[new N1("Images: ",new j1({color:Y.foreground,dim:!0}))];for(let G=0;G<Q.length;G++)if(K.push(new N1(`[image ${G+1}]`,Z)),G<Q.length-1)K.push(new N1(" ",new j1({color:Y.foreground,dim:!0})));return new x6({padding:V0.only({}),child:new n1({text:new N1("",void 0,K),selectable:!0})})}function Gu1(J,Q,Z){let X=[];if(X.push(new N1(J,Q)),Z)X.push(new N1(" (interrupted)",new j1({color:E1.yellow,italic:!0})));return new n1({text:new N1("",void 0,X),selectable:!0})}class Xd extends I6{props;constructor(J){super();this.props=J}build(J){let Z=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,X=this.props.message.interrupted?E1.yellow:Z.success,Y=this.props.message.interrupted?E1.yellow:E1.green,K=new j1({color:X,italic:!0}),G=[],q=this.props.message.content.filter((F)=>F.type==="image"),z=Ku1(J,q,K);if(z)G.push(z);let U=o7(this.props.message.content).trim();if(U){if(z)G.push(new U0({height:1}));G.push(Gu1(U,K,this.props.message.interrupted))}let W;if(G.length===0)W=new y0;else if(G.length===1)W=G[0];else W=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:G});return new y0({decoration:{border:new x8(void 0,void 0,void 0,new w8(Y,2,"solid"))},padding:V0.only({left:1}),child:W})}}class qu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new qW6}}class qW6 extends d0{selectedOptionIndex=0;focusNode=new Q9({debugLabel:"restore-confirmation"});initState(){super.initState(),this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){if(!this.widget.props.isShowingRestoreConfirmation)return"ignored";let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("j")||Q("Tab"))return this.setState(()=>{this.selectedOptionIndex=(this.selectedOptionIndex+1)%2}),"handled";if(Q("ArrowUp")||Q("k")||Q("Tab",{shift:!0}))return this.setState(()=>{this.selectedOptionIndex=(this.selectedOptionIndex-1+2)%2}),"handled";if(Q("Enter")){if(this.selectedOptionIndex===0)this.widget.props.onRestoreConfirm();else this.widget.props.onRestoreCancel();return"handled"}if(Q("Escape"))return this.widget.props.onRestoreCancel(),"handled";return"ignored"}build(J){let Q=i6.maybeOf(J),Z=Q?.colors??e6.of(J).colorScheme,X=Q?.app;if(this.widget.props.isShowingRestoreConfirmation){let B=new j1({color:sC,italic:!0}),M=[],V=this.widget.props.message.content.filter((O)=>O.type==="image"),N=Ku1(J,V,B);if(N)M.push(N);let L=o7(this.widget.props.message.content).trim();if(L)M.push(Gu1(L,B,this.widget.props.message.interrupted));M.push(new U0({height:1})),M.push(new n1({text:new N1("This will delete this message and any subsequent messages in the thread, and will restore any edits made by the agent from this message onwards.",new j1({color:E1.white,bold:!0}))})),M.push(new U0({height:1}));let A=[{value:"confirm",label:"Delete and restore"},{value:"cancel",label:"Cancel"}];for(let O=0;O<A.length;O++){let j=A[O],$=O===this.selectedOptionIndex;M.push(FQ1(j,$,void 0))}let w=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:M}),R=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),width:1/0,child:w});return new q9({focusNode:this.focusNode,autofocus:!0,child:R})}let Y=new j1({color:sC,italic:!0}),K=[],G=this.widget.props.message.content.filter((B)=>B.type==="image"),q=Ku1(J,G,Y);if(q)K.push(q);let z=o7(this.widget.props.message.content).trim();if(z)K.push(Gu1(z,Y,this.widget.props.message.interrupted));let U;if(K.length===0)U=new y0;else if(K.length===1)U=K[0];else U=new i0({mainAxisSize:"min",crossAxisAlignment:"start",children:K});let W=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),width:1/0,child:U}),F=[new N1("e",new j1({color:X?.keybind??E1.blue})),new N1(" to edit",new j1({color:Z.foreground,dim:!0}))];if(this.widget.props.isFirstMessage)F.push(new N1(", ",new j1({color:Z.foreground,dim:!0})),new N1("r",new j1({color:X?.keybind??E1.blue})),new N1(" to delete and restore",new j1({color:Z.foreground,dim:!0})),new N1(", ",new j1({color:Z.foreground,dim:!0})),new N1("f",new j1({color:X?.keybind??E1.blue})),new N1(" to fork",new j1({color:Z.foreground,dim:!0})));let H=new wX({left:2,bottom:0,child:new n1({text:new N1("",void 0,F)})});return new x6({padding:V0.only({}),child:new fC({child:new TJ({children:[W,H]})})})}}class zu1 extends c0{initialText;onSubmitted;constructor(J){super();this.initialText=J.initialText,this.onSubmitted=J.onSubmitted}createState(){return new zW6}}class zW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"user-message-editing-focus-node"});initState(){this.controller.text=this.widget.initialText}dispose(){this.controller.dispose(),this.focusNode.dispose(),super.dispose()}build(J){let Q=new cq({controller:this.controller,placeholder:"",autofocus:!0,expands:!0,minLines:1,maxLines:null,wrap:!0,submitKey:{character:"Enter"},onSubmitted:this.widget.onSubmitted,style:{padding:void 0,border:null,textColor:sC},ensureVisible:!0}),Z=new y0({decoration:{border:x8.all(new w8(sC,2,"solid"))},padding:V0.only({left:1,right:1}),child:Q}),X=i6.maybeOf(J),Y=X?.colors??e6.of(J).colorScheme,K=X?.app,G=new wX({right:2,top:0,child:new n1({text:new N1("",void 0,[new N1("esc",new j1({color:K?.keybind??E1.blue})),new N1(" to cancel",new j1({color:Y.foreground,dim:!0}))])})});return new fC({child:new TJ({children:[Z,G]})})}}class HQ1 extends s7{}class BQ1 extends s7{}class Uu1 extends s7{}class Wu1 extends s7{}class Fu1 extends s7{}class Hu1 extends s7{}class Bu1 extends s7{}class Du1 extends s7{}function GF9(J,Q,Z){let Y=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,G=Q.trimStart().startsWith("You're absolutely right!"),q=new a7(`${Z}-text`),z=[];if(G)z.push(new om1({key:q,markdown:Q,defaultColor:Y.foreground}));else z.push(new RX({key:q,markdown:Q}));if(z.length===1)return z[0];return new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:z})}function qF9(J,Q){let X=e6.of(J).colorScheme;if(Q.summary.type!=="message")return new y0;return new i0({crossAxisAlignment:"start",children:[new n1({text:new N1("Summary:",new j1({color:X.foreground,dim:!0,bold:!0,italic:!0})),selectable:!0}),new U0({height:1}),new RX({markdown:Q.summary.summary,styleScheme:{text:new j1({color:X.foreground,dim:!0,italic:!0}),inlineCode:new j1({color:X.foreground,dim:!0,italic:!0}),codeBlock:new j1({color:X.foreground,dim:!0,italic:!0}),tableBorder:X.foreground,link:new j1({color:X.foreground,dim:!0,italic:!0}),syntaxHighlight:{keyword:X.foreground,string:X.foreground,number:X.foreground,comment:X.foreground,function:X.foreground,variable:X.foreground,type:X.foreground,operator:X.foreground}}})]})}function zF9(J,Q){let Z=i6.maybeOf(J),X=Z?.colors??e6.of(J).colorScheme,Y=Q.hidden===!0,K=Y?"$$":"$",G=Q.toolRun.status==="done"?Q.toolRun.result.output:("progress"in Q.toolRun)?Q.toolRun.progress?.output:void 0,q=Q.toolRun.status==="done"?Q.toolRun.result.exitCode:void 0,z=Q.toolRun.status==="cancelled"?"Cancelled":Q.toolRun.status==="error"?"Errored":void 0,U=[],W=Y?Z?.app.shellModeHidden??X.mutedForeground:Z?.app.shellMode??X.primary;if(U.push(new N1(`${K} ${Q.args.cmd}`,new j1({color:W,italic:!0}))),G&&G.trim())U.push(new N1(`
|
|
6521
|
+
`+G.trimEnd(),new j1({color:W,dim:!0})));if(q!==void 0&&q!==0)U.push(new N1(`
|
|
6522
6522
|
|
|
6523
|
-
exit code: ${q}`,new
|
|
6523
|
+
exit code: ${q}`,new j1({color:X.foreground,dim:!0,italic:!0})));if(z)U.push(new N1(`
|
|
6524
6524
|
|
|
6525
|
-
(${z}, command and output not shown to agent)`,new
|
|
6525
|
+
(${z}, command and output not shown to agent)`,new j1({color:X.foreground,dim:!0,italic:!0})));else if(Y)U.push(new N1(`
|
|
6526
6526
|
|
|
6527
|
-
(Command and output not shown to agent)`,new $1({color:X.foreground,dim:!0,italic:!0})));return new n1({text:new N1("",void 0,U)})}class DQ1 extends c0{items;subagentToolsByParentID;controller;autofocus;onNewMessage;showScrollbar;onCopy;onMessageEditSubmit;onMessageRestoreSubmit;onMessageForkSubmit;thread;focusNode;onDismissFocus;isInSelectionMode=!1;get userMessageIndices(){let J=[];for(let Q=0;Q<this.items.length;Q++){let Z=this.items[Q];if(Z?.type==="message"&&Z.message.role==="user")J.push(Q)}return J}constructor({key:J,items:Q,subagentToolsByParentID:Z={},controller:X,autofocus:Y=!1,onNewMessage:K,showScrollbar:G=!0,onCopy:q,onMessageEditSubmit:z,onMessageRestoreSubmit:U,onMessageForkSubmit:W,thread:F,focusNode:H,onDismissFocus:B,isInSelectionMode:M=!1}){super(J?{key:J}:{});this.items=Q,this.subagentToolsByParentID=Z,this.controller=X,this.autofocus=Y,this.onNewMessage=K,this.showScrollbar=G,this.onCopy=q,this.onMessageEditSubmit=z,this.onMessageRestoreSubmit=U,this.onMessageForkSubmit=W,this.thread=F,this.focusNode=H,this.onDismissFocus=B,this.isInSelectionMode=M}createState(){return new UW6}}class UW6 extends d0{_controller=null;_isDisposed=!1;_thinkingBlockStates=new Map;_globalToggleListener;_streamingIndexes=new Set;_viewportHeight=25;_widgetCache=new Map;_lastCostDisplayState=null;_selectedUserMessageOrdinal=null;_editingMessageOrdinal=null;_isShowingRestoreConfirmation=!1;get controller(){return this._controller}dismiss(){c9.instance.addPostFrameCallback(()=>{this.widget.focusNode?.unfocus()}),this.widget.onDismissFocus?.()}_navigateUp(J,Q){if(Q<=0)return null;if(J===null)return Q-1;if(J<=0)return 0;return J-1}_navigateDown(J,Q){if(Q<=0)return null;if(J===null)return null;if(J>=Q-1)return null;return J+1}_ordinalToIndex(J,Q){if(Q===null)return null;if(Q<0||Q>=J.length)return null;return J[Q]??null}_getUserCount(){return this.widget.userMessageIndices.length}_clearSelectedUserMessage(){let J=this._selectedUserMessageOrdinal,Q=J!==null?this.getUserMessageIndexFromOrdinal(J):null;this.setState(()=>{if(Q!=null)this._widgetCache.delete(Q);this._selectedUserMessageOrdinal=null})}_selectUserMessageByOrdinal(J){let Q=this._selectedUserMessageOrdinal,Z=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,Y=this.getUserMessageIndexFromOrdinal(Z);if(X!==null)this._widgetCache.delete(X);if(Y!==null)this._widgetCache.delete(Y);if(this.setState(()=>{this._selectedUserMessageOrdinal=Z}),Y!==null)c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(Y,{animated:!0,offset:0,edge:"top",duration:200})})}_selectEditingUserMessageByOrdinal(J){let Q=this._editingMessageOrdinal,Z=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,Y=Z!==null?this.getUserMessageIndexFromOrdinal(Z):null;if(X!==null)this._widgetCache.delete(X);if(Y!==null)this._widgetCache.delete(Y);this.setState(()=>{this._editingMessageOrdinal=Z})}getUserMessageIndexFromOrdinal(J){return this.widget.userMessageIndices[J]??null}getOrdinalFromUserMessageIndex(J){let Z=this.widget.userMessageIndices.indexOf(J);return Z>=0?Z:null}getLatestUserMessageOrdinal(){let J=this.widget.userMessageIndices;return J.length>0?J.length-1:null}navigateToUserMessage(J){let Q=this._getUserCount(),Z=J==="up"?this._navigateUp(this._selectedUserMessageOrdinal,Q):this._navigateDown(this._selectedUserMessageOrdinal,Q);if(Z===null&&J==="down"){this._controller?.animateToBottom(100),this._clearSelectedUserMessage(),this.dismiss();return}if(Z!==null)this._selectUserMessageByOrdinal(Z)}handleNavigateUserMessageUp=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("up"),"handled"};handleNavigateUserMessageDown=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("down"),"handled"};handleEscape=()=>{if(this._editingMessageOrdinal!==null)return this.setState(()=>{let J=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(J!=null)this._widgetCache.delete(J);this._editingMessageOrdinal=null}),"handled";else if(this._selectedUserMessageOrdinal!==null)return this._clearSelectedUserMessage(),this.setState(()=>{this._editingMessageOrdinal=null}),this.dismiss(),this._controller?.animateToBottom(100),"handled";return"ignored"};handleScrollDown=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollDown(1),"handled";return"ignored"};handleScrollUp=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollUp(1),"handled";return"ignored"};handleEditMessage=()=>{if(this._selectedUserMessageOrdinal!==null)return this._selectEditingUserMessageByOrdinal(this._selectedUserMessageOrdinal),"handled";return"ignored"};handleRestoreMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user")this.setState(()=>{this._widgetCache.delete(J),this._isShowingRestoreConfirmation=!0}),c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}return"handled"}return"ignored"};handleRestoreConfirm=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user")this.widget.onMessageRestoreSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{this._isShowingRestoreConfirmation=!1}),this.dismiss()}return"handled"}return"ignored"};handleRestoreCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null)this.setState(()=>{this._widgetCache.delete(J),this._isShowingRestoreConfirmation=!1}),c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}return"handled"};handleForkMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user"){if(J===0)return"ignored";this.widget.onMessageForkSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{}),this.dismiss()}}return"handled"}return"ignored"};_signatureFor(J){if(J.type==="message"){let Q=J.message;if(Q.role==="user"){let Z=o7(Q.content),X=Q.content.filter((Y)=>Y.type==="image").length;return`${J.id}|user|${Q.interrupted?1:0}|${X}|${Z}`}else if(Q.role==="assistant"){let Z=o7(Q.content),X=Q.state.type==="complete",Y=Q.content.filter((G)=>G.type==="thinking"),K=Q.content.filter((G)=>G.type==="tool_use");return`${J.id}|assistant|${X?1:0}|${Y.length}|${K.length}|${Z}`}else{let X=Q.content.map((Y)=>Y.type).join(",");return`${J.id}|info|${X}`}}else{let Z=J.toolResult.run.status;return`${J.id}|tool|${Z}|${J.toolUse.id}`}}getThinkingBlockExpanded(J,Q){let Z=`${J}-${Q}`;return this._thinkingBlockStates.get(Z)??wQ.instance.allExpanded}toggleThinkingBlock=(J,Q)=>{return(Z)=>{let X=`${J}-${Q}`;this.setState(()=>{this._thinkingBlockStates.set(X,Z),this._widgetCache.delete(J)})}};buildThinkingBlock(J,Q,Z,X){let Y=Z===X.content.length-1,K=X.state?.type==="streaming"&&Y;return new Zd({key:new a7(`thinking-${Q}-${Z}`),thinkingBlock:J,expanded:this.getThinkingBlockExpanded(Q,Z),onToggle:this.toggleThinkingBlock(Q,Z),isStreaming:K})}buildAssistantMessageWidget(J,Q,Z,X){let Y=Q.content.map((H,B)=>({block:H,index:B})).filter((H)=>H.block.type==="thinking"),K=Y.some(({block:H})=>tm1(H.thinking).length>0),G=Q.content.filter((H)=>H.type==="text"),q=[];if(q.push(...Y.map(({block:H,index:B})=>this.buildThinkingBlock(H,Z,B,Q))),K&&G.length>0)q.push(new U0({height:1}));let z=o7(G);if(z.trim())q.push(GF9(J,z,X));let U=XB(J),W=Q.usage!=null&&(Q.usage.inputTokens>0||Q.usage.outputTokens>0);if(U&&W){let B=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,M=sG6(Q.usage);q.push(new x6({padding:V0.only({top:1}),child:new n1({text:new N1(M,new $1({color:B.foreground,dim:!0}))})}))}let F;if(q.length===0)F=new y0;else if(q.length===1)F=q[0];else F=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:q});return F}buildThreadItemWidget(J,Q,Z){let X=new a7(`thread-item-${Q.id}`);if(Q.type==="message"){let Y=Q.message;if(Y.role==="user"){if(!this.widget.isInSelectionMode)return new Xd({message:Y});let K=this.getOrdinalFromUserMessageIndex(Z);if(K===null)return new Xd({message:Y});if(this._editingMessageOrdinal===K)return new zu1({initialText:o7(Y.content),onSubmitted:(q)=>{if(q.trim()==="")return;this.widget.onMessageEditSubmit?.(Y,q),this._selectEditingUserMessageByOrdinal(null),this._clearSelectedUserMessage(),this.dismiss(),this.controller.animateToBottom(100)}});if(this._selectedUserMessageOrdinal===K)return new qu1({message:Y,isFirstMessage:Z>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()}});else return new Xd({message:Y})}else if(Y.role==="assistant"){let K=this.buildAssistantMessageWidget(J,Y,Z,Q.id);return new y0({key:X,child:K})}else{let K=Y,G=[];for(let q of K.content)if(q.type==="manual_bash_invocation")G.push(zF9(J,q));else if(q.type==="summary"&&q.summary.type==="message")G.push(qF9(J,q));if(G.length===0)return new y0;if(G.length===1)return G[0];return new i0({crossAxisAlignment:"stretch",children:G})}}else{let Y=new mR({toolUse:Q.toolUse,toolRun:Q.toolResult.run,subagentTools:this.widget.subagentToolsByParentID[Q.toolUse.id],thread:this.widget.thread});return new y0({key:X,child:Y})}return new y0}initState(){if(super.initState(),this._controller=this.widget.controller||new jY,this._globalToggleListener=()=>{this.setState(()=>{this._thinkingBlockStates.clear(),this._widgetCache.clear()})},wQ.instance.addListener(this._globalToggleListener),this.widget.items.length>0)c9.instance.requestFrame()}didUpdateWidget(J){if(super.didUpdateWidget(J),!J.isInSelectionMode&&this.widget.isInSelectionMode){this.widget.focusNode?.requestFocus();let Z=this.getLatestUserMessageOrdinal();if(Z!==null)this._selectUserMessageByOrdinal(Z)}if(J.items===this.widget.items)return;let Q=Math.min(J.items.length,this.widget.items.length);for(let Z=0;Z<Q;Z++){let X=J.items[Z],Y=this.widget.items[Z];if(X&&Y){if(X.type!==Y.type){this._widgetCache.delete(Z);continue}if(X.type==="toolResult"&&Y.type==="toolResult"){let K=X.toolResult.run,G=Y.toolResult.run;if(K.status!==G.status||"result"in K!=="result"in G||"error"in K!=="error"in G)this._widgetCache.delete(Z)}}}if(this.widget.items.length<J.items.length)this._cleanupOrphanedCacheEntries();this._updateStreamingIndexes();for(let Z of this._streamingIndexes)if(Z>=this.widget.items.length)this._streamingIndexes.delete(Z)}_cleanupOrphanedCacheEntries(){for(let J of this._widgetCache.keys())if(J>=this.widget.items.length)this._widgetCache.delete(J)}_isMessageStreaming(J){if(J.type!=="message")return!1;let Q=J.message;if(Q.role!=="assistant")return!1;if(Q.state.type==="streaming")return!0;return Q.content.at(-1)?.type==="thinking"}_updateStreamingIndexes(){for(let J of this._streamingIndexes)if(J>=this.widget.items.length)this._streamingIndexes.delete(J);for(let J=0;J<this.widget.items.length;J++){let Q=this.widget.items[J];if(!Q)continue;let Z=this._isMessageStreaming(Q);if(Z&&!this._streamingIndexes.has(J))this._streamingIndexes.add(J);else if(!Z&&this._streamingIndexes.has(J))this._streamingIndexes.delete(J)}}_getViewportHeight(){let J=this.context.findRenderObject();if(J&&"size"in J){let Q=J.size;if(typeof Q.height==="number"&&Q.height>0)return this._viewportHeight=Q.height,Q.height}return this._viewportHeight}dispose(){if(this._isDisposed=!0,this._widgetCache.clear(),this._globalToggleListener)wQ.instance.removeListener(this._globalToggleListener);if(!this.widget.controller)this._controller?.dispose();this.widget.focusNode?.dispose(),super.dispose()}build(J){let Q=i6.of(J),Z=XB(J);if(this._lastCostDisplayState!==null&&this._lastCostDisplayState!==Z)this._widgetCache.clear();this._lastCostDisplayState=Z;let X=this._getTotalItemCount(J),Y=[];for(let H=0;H<X;H++)if(Y.push(this._buildItemAtIndex(J,H)),H<X-1)Y.push(new U0({height:1}));let K=new $Y({controller:this._controller,autofocus:this.widget.autofocus,position:"bottom",child:new i0({key:new a7("message-list-column"),crossAxisAlignment:"start",children:Y})}),q=[new x6({padding:V0.only({left:2,right:this.widget.showScrollbar?3:2,bottom:1}),child:K})];if(this.widget.showScrollbar&&this._controller){let H=new gR({controller:this._controller,getScrollInfo:()=>this._getScrollbarInfo(),thickness:1,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack});q.push(new wX({right:1,top:0,bottom:0,child:new U0({width:1,child:H})}))}let z=new TJ({children:q}),U=new $R({key:new a7("message-view-selection-area"),child:z,onCopy:this.widget.onCopy}),W=new Map([[HQ1,new S9(this.handleNavigateUserMessageUp)],[BQ1,new S9(this.handleNavigateUserMessageDown)],[Uu1,new S9(this.handleEscape)],[Wu1,new S9(this.handleScrollDown)],[Fu1,new S9(this.handleScrollUp)],[Hu1,new S9(this.handleEditMessage)],[Bu1,new S9(this.handleRestoreMessage)],[Du1,new S9(this.handleForkMessage)]]),F=new Map([[b6.key("Tab"),new HQ1],[b6.shift("Tab"),new BQ1],[b6.key("Escape"),new Uu1],[b6.key("j"),new Wu1],[b6.key("ArrowDown"),new BQ1],[b6.key("k"),new Fu1],[b6.key("ArrowUp"),new HQ1],[b6.key("e"),new Hu1],[b6.key("r"),new Bu1],[b6.key("f"),new Du1]]);if(this.widget.focusNode)return new q9({focusNode:this.widget.focusNode,child:new HZ({actions:W,child:new dq({shortcuts:F,focusNode:this.widget.focusNode,child:U})})});return U}_getTotalItemCount(J){return this.widget.items.length}_buildItemAtIndex(J,Q){let Z=this.widget.items[Q];if(!Z)return new y0;let X=Z.type==="message"&&this._isMessageStreaming(Z),Y=Z.type==="toolResult"&&(Z.toolResult.run.status==="queued"||Z.toolResult.run.status==="in-progress")&&!("result"in Z.toolResult.run)&&!("error"in Z.toolResult.run);if(!X&&!Y){let q=this._signatureFor(Z),z=this._widgetCache.get(Q);if(z&&z.sig===q)return z.widget;let U=this.buildThreadItemWidget(J,Z,Q);return this._widgetCache.set(Q,{sig:q,widget:U}),U}return this.buildThreadItemWidget(J,Z,Q)}onNewMessage(){if(this._isDisposed)return;this.widget.onNewMessage?.()}scrollToTop(){if(this._isDisposed||!this._controller)return;this._controller.scrollToTop()}scrollToMessage(J,{animated:Q=!1,offset:Z=0,edge:X="top",duration:Y}={}){if(this._isDisposed||!this._controller)return!1;let K=this._getMessageRelativeOffset(J,X);if(K===null)return!1;let G=K-Z;if(Q)this._controller.animateTo(G,Y);else this._controller.jumpTo(G);return!0}_getColumnElement(){let J=this.context.element;if(!J)return null;let Q=new a7("message-list-column"),Z=(X)=>{if(X.widget.key?.equals(Q))return X;for(let Y of X.children){let K=Z(Y);if(K)return K}return null};return Z(J)}_getMessageRelativeOffset(J,Q){let Z=this._getColumnElement();if(!Z)return null;let X=J*2,Y=Z.children[X];if(!Y?.renderObject)return null;let K=Y.renderObject,G=Z.renderObject;if(!G)return null;let q=K.localToGlobal({x:0,y:0}),z=G.localToGlobal({x:0,y:0}),U=0;if(Q==="bottom")U=K.size.height;return q.y+U-z.y}_getScrollbarInfo(){let J=this._controller?.maxScrollExtent??0,Q=this._getViewportHeight(),Z=this._controller?.offset??0,X=J+Q;return{totalContentHeight:Math.max(X,0),viewportHeight:Math.max(Q,1),scrollOffset:Math.max(Z,0)}}}G9();var WW6=[{type:"command",text:'amp -x "What package manager do we use here?"'},{type:"command",text:'amp -x "Run the linter and fix the errors"'},{type:"hint",text:"Use /queue to enqueue messages without interrupting the agent"},{type:"hint",text:"Use Ctrl+G to edit the prompt in your $EDITOR"},{type:"hint",text:"Generate an AGENTS.md file with the /generate-agent-file command"},{type:"hint",text:"Open your thread in the browser with /browser"},{type:"hint",text:"Create a new thread with /new"},{type:"hint",text:"Change the visiblity settings of your thread with /visibility"},{type:"hint",text:"Open the settings with the /settings slash command"},{type:"hint",text:"Draft a new thread based on the current thread with /handoff"},{type:"hint",text:"Use Tab/Shift+Tab to navigate to previous messages to edit or restore to a previous state"},{type:"prompt",text:'"Use the oracle to review the code we just wrote."'},{type:"prompt",text:'"Use subagents to update these components to use the new attribute we added."'},{type:"prompt",text:'"Do not write any code yet. Plan first."'},{type:"prompt",text:'"Think hard before you start implementing."'},{type:"prompt",text:`"Use 'psql' to change all blog_posts to have comments"`},{type:"prompt",text:'"Run <build command> and fix all the errors"'},{type:"quote",text:`"We are at the 'introduction of photography' period of programming. Painting by hand just doesn't have the same appeal anymore" - Orta Therox`},{type:"quote",text:'"Programming in the normal way feels like walking. You type out each expression, stepping incrementally toward your goal. When programming with AI, each move is bigger than a step. You lift off the ground." - Mary Rose Cook'},{type:"quote",text:'"Tomorrow all this may change, but right now after daily experience writing code with LLMs I strongly believe the maximum quality of work is reached using the human+LLM equation." - antirez'},{type:"quote",text:`"The magic that's coming now is the most powerful yet. And that means that we're beginning a profound period of exploration and creativity, trying to understand how to make that magic work and to derive new advantages from its power." - Tim O'Reilly`},{type:"quote",text:`"They're applying years of hard-won engineering wisdom to shape and constrain the AI's output. The AI is accelerating their implementation, but their expertise is what keeps the code maintainable." - Addy Osmani`}];class MQ1 extends I6{agentMode;constructor(J={}){super(J.key?{key:J.key}:{});this.agentMode=J.agentMode}build(J){let Z=e6.of(J).colorScheme,Y=i6.of(J).app,G=_8.of(J).capabilities.animationSupport,q=process.pid%WW6.length,z=WW6[q],U=z.type==="quote"?new $1({color:Z.foreground,dim:!0}):z.type==="hint"?new $1({color:Z.secondary}):new $1({color:z.type==="prompt"?Z.primary:Z.warning}),W=new $1({color:Y.keybind}),F=new $1({color:Y.command}),H=new $1({color:Z.secondary}),B=new $1({color:Z.foreground,dim:!0}),M=[];if(z.type==="hint"){let A=z.text.split(/(\s\/[\w-]+)/g);for(let w of A)if(w.match(/^\s\/[\w-]+$/)){let R=w.trim();M.push(new N1(w.slice(0,w.length-R.length),U)),M.push(new N1(R,F))}else M.push(new N1(w,U))}else M.push(new N1(z.text,U));let V=[new N1("Welcome to Amp",new $1({color:Z.foreground})),new N1(`
|
|
6527
|
+
(Command and output not shown to agent)`,new j1({color:X.foreground,dim:!0,italic:!0})));return new n1({text:new N1("",void 0,U)})}class DQ1 extends c0{items;subagentToolsByParentID;controller;autofocus;onNewMessage;showScrollbar;onCopy;onMessageEditSubmit;onMessageRestoreSubmit;onMessageForkSubmit;thread;focusNode;onDismissFocus;isInSelectionMode=!1;get userMessageIndices(){let J=[];for(let Q=0;Q<this.items.length;Q++){let Z=this.items[Q];if(Z?.type==="message"&&Z.message.role==="user")J.push(Q)}return J}constructor({key:J,items:Q,subagentToolsByParentID:Z={},controller:X,autofocus:Y=!1,onNewMessage:K,showScrollbar:G=!0,onCopy:q,onMessageEditSubmit:z,onMessageRestoreSubmit:U,onMessageForkSubmit:W,thread:F,focusNode:H,onDismissFocus:B,isInSelectionMode:M=!1}){super(J?{key:J}:{});this.items=Q,this.subagentToolsByParentID=Z,this.controller=X,this.autofocus=Y,this.onNewMessage=K,this.showScrollbar=G,this.onCopy=q,this.onMessageEditSubmit=z,this.onMessageRestoreSubmit=U,this.onMessageForkSubmit=W,this.thread=F,this.focusNode=H,this.onDismissFocus=B,this.isInSelectionMode=M}createState(){return new UW6}}class UW6 extends d0{_controller=null;_isDisposed=!1;_thinkingBlockStates=new Map;_globalToggleListener;_streamingIndexes=new Set;_viewportHeight=25;_widgetCache=new Map;_lastCostDisplayState=null;_selectedUserMessageOrdinal=null;_editingMessageOrdinal=null;_isShowingRestoreConfirmation=!1;get controller(){return this._controller}dismiss(){c9.instance.addPostFrameCallback(()=>{this.widget.focusNode?.unfocus()}),this.widget.onDismissFocus?.()}_navigateUp(J,Q){if(Q<=0)return null;if(J===null)return Q-1;if(J<=0)return 0;return J-1}_navigateDown(J,Q){if(Q<=0)return null;if(J===null)return null;if(J>=Q-1)return null;return J+1}_ordinalToIndex(J,Q){if(Q===null)return null;if(Q<0||Q>=J.length)return null;return J[Q]??null}_getUserCount(){return this.widget.userMessageIndices.length}_clearSelectedUserMessage(){let J=this._selectedUserMessageOrdinal,Q=J!==null?this.getUserMessageIndexFromOrdinal(J):null;this.setState(()=>{if(Q!=null)this._widgetCache.delete(Q);this._selectedUserMessageOrdinal=null})}_selectUserMessageByOrdinal(J){let Q=this._selectedUserMessageOrdinal,Z=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,Y=this.getUserMessageIndexFromOrdinal(Z);if(X!==null)this._widgetCache.delete(X);if(Y!==null)this._widgetCache.delete(Y);if(this.setState(()=>{this._selectedUserMessageOrdinal=Z}),Y!==null)c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(Y,{animated:!0,offset:0,edge:"top",duration:200})})}_selectEditingUserMessageByOrdinal(J){let Q=this._editingMessageOrdinal,Z=J,X=Q!==null?this.getUserMessageIndexFromOrdinal(Q):null,Y=Z!==null?this.getUserMessageIndexFromOrdinal(Z):null;if(X!==null)this._widgetCache.delete(X);if(Y!==null)this._widgetCache.delete(Y);this.setState(()=>{this._editingMessageOrdinal=Z})}getUserMessageIndexFromOrdinal(J){return this.widget.userMessageIndices[J]??null}getOrdinalFromUserMessageIndex(J){let Z=this.widget.userMessageIndices.indexOf(J);return Z>=0?Z:null}getLatestUserMessageOrdinal(){let J=this.widget.userMessageIndices;return J.length>0?J.length-1:null}navigateToUserMessage(J){let Q=this._getUserCount(),Z=J==="up"?this._navigateUp(this._selectedUserMessageOrdinal,Q):this._navigateDown(this._selectedUserMessageOrdinal,Q);if(Z===null&&J==="down"){this._controller?.animateToBottom(100),this._clearSelectedUserMessage(),this.dismiss();return}if(Z!==null)this._selectUserMessageByOrdinal(Z)}handleNavigateUserMessageUp=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("up"),"handled"};handleNavigateUserMessageDown=()=>{if(this._editingMessageOrdinal!==null)return"ignored";return this.navigateToUserMessage("down"),"handled"};handleEscape=()=>{if(this._editingMessageOrdinal!==null)return this.setState(()=>{let J=this._ordinalToIndex(this.widget.userMessageIndices,this._editingMessageOrdinal);if(J!=null)this._widgetCache.delete(J);this._editingMessageOrdinal=null}),"handled";else if(this._selectedUserMessageOrdinal!==null)return this._clearSelectedUserMessage(),this.setState(()=>{this._editingMessageOrdinal=null}),this.dismiss(),this._controller?.animateToBottom(100),"handled";return"ignored"};handleScrollDown=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollDown(1),"handled";return"ignored"};handleScrollUp=()=>{if(this._selectedUserMessageOrdinal!==null)return this._controller?.scrollUp(1),"handled";return"ignored"};handleEditMessage=()=>{if(this._selectedUserMessageOrdinal!==null)return this._selectEditingUserMessageByOrdinal(this._selectedUserMessageOrdinal),"handled";return"ignored"};handleRestoreMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user")this.setState(()=>{this._widgetCache.delete(J),this._isShowingRestoreConfirmation=!0}),c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}return"handled"}return"ignored"};handleRestoreConfirm=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){if(J===0)return"ignored";let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user")this.widget.onMessageRestoreSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{this._isShowingRestoreConfirmation=!1}),this.dismiss()}return"handled"}return"ignored"};handleRestoreCancel=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null)this.setState(()=>{this._widgetCache.delete(J),this._isShowingRestoreConfirmation=!1}),c9.instance.addPostFrameCallback(()=>{this.scrollToMessage(J)})}return"handled"};handleForkMessage=()=>{if(this._selectedUserMessageOrdinal!==null){let J=this._ordinalToIndex(this.widget.userMessageIndices,this._selectedUserMessageOrdinal);if(J!=null){let Q=this.widget.items[J];if(Q?.type==="message"&&Q.message.role==="user"){if(J===0)return"ignored";this.widget.onMessageForkSubmit?.(Q.message),this._clearSelectedUserMessage(),this.setState(()=>{}),this.dismiss()}}return"handled"}return"ignored"};_signatureFor(J){if(J.type==="message"){let Q=J.message;if(Q.role==="user"){let Z=o7(Q.content),X=Q.content.filter((Y)=>Y.type==="image").length;return`${J.id}|user|${Q.interrupted?1:0}|${X}|${Z}`}else if(Q.role==="assistant"){let Z=o7(Q.content),X=Q.state.type==="complete",Y=Q.content.filter((G)=>G.type==="thinking"),K=Q.content.filter((G)=>G.type==="tool_use");return`${J.id}|assistant|${X?1:0}|${Y.length}|${K.length}|${Z}`}else{let X=Q.content.map((Y)=>Y.type).join(",");return`${J.id}|info|${X}`}}else{let Z=J.toolResult.run.status;return`${J.id}|tool|${Z}|${J.toolUse.id}`}}getThinkingBlockExpanded(J,Q){let Z=`${J}-${Q}`;return this._thinkingBlockStates.get(Z)??wQ.instance.allExpanded}toggleThinkingBlock=(J,Q)=>{return(Z)=>{let X=`${J}-${Q}`;this.setState(()=>{this._thinkingBlockStates.set(X,Z),this._widgetCache.delete(J)})}};buildThinkingBlock(J,Q,Z,X){let Y=Z===X.content.length-1,K=X.state?.type==="streaming"&&Y;return new Zd({key:new a7(`thinking-${Q}-${Z}`),thinkingBlock:J,expanded:this.getThinkingBlockExpanded(Q,Z),onToggle:this.toggleThinkingBlock(Q,Z),isStreaming:K})}buildAssistantMessageWidget(J,Q,Z,X){let Y=Q.content.map((H,B)=>({block:H,index:B})).filter((H)=>H.block.type==="thinking"),K=Y.some(({block:H})=>tm1(H.thinking).length>0),G=Q.content.filter((H)=>H.type==="text"),q=[];if(q.push(...Y.map(({block:H,index:B})=>this.buildThinkingBlock(H,Z,B,Q))),K&&G.length>0)q.push(new U0({height:1}));let z=o7(G);if(z.trim())q.push(GF9(J,z,X));let U=XB(J),W=Q.usage!=null&&(Q.usage.inputTokens>0||Q.usage.outputTokens>0);if(U&&W){let B=i6.maybeOf(J)?.colors??e6.of(J).colorScheme,M=sG6(Q.usage);q.push(new x6({padding:V0.only({top:1}),child:new n1({text:new N1(M,new j1({color:B.foreground,dim:!0}))})}))}let F;if(q.length===0)F=new y0;else if(q.length===1)F=q[0];else F=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:q});return F}buildThreadItemWidget(J,Q,Z){let X=new a7(`thread-item-${Q.id}`);if(Q.type==="message"){let Y=Q.message;if(Y.role==="user"){if(!this.widget.isInSelectionMode)return new Xd({message:Y});let K=this.getOrdinalFromUserMessageIndex(Z);if(K===null)return new Xd({message:Y});if(this._editingMessageOrdinal===K)return new zu1({initialText:o7(Y.content),onSubmitted:(q)=>{if(q.trim()==="")return;this.widget.onMessageEditSubmit?.(Y,q),this._selectEditingUserMessageByOrdinal(null),this._clearSelectedUserMessage(),this.dismiss(),this.controller.animateToBottom(100)}});if(this._selectedUserMessageOrdinal===K)return new qu1({message:Y,isFirstMessage:Z>0,isShowingRestoreConfirmation:this._isShowingRestoreConfirmation,onRestoreConfirm:()=>{this.handleRestoreConfirm()},onRestoreCancel:()=>{this.handleRestoreCancel()}});else return new Xd({message:Y})}else if(Y.role==="assistant"){let K=this.buildAssistantMessageWidget(J,Y,Z,Q.id);return new y0({key:X,child:K})}else{let K=Y,G=[];for(let q of K.content)if(q.type==="manual_bash_invocation")G.push(zF9(J,q));else if(q.type==="summary"&&q.summary.type==="message")G.push(qF9(J,q));if(G.length===0)return new y0;if(G.length===1)return G[0];return new i0({crossAxisAlignment:"stretch",children:G})}}else{let Y=new mR({toolUse:Q.toolUse,toolRun:Q.toolResult.run,subagentTools:this.widget.subagentToolsByParentID[Q.toolUse.id],thread:this.widget.thread});return new y0({key:X,child:Y})}return new y0}initState(){if(super.initState(),this._controller=this.widget.controller||new jY,this._globalToggleListener=()=>{this.setState(()=>{this._thinkingBlockStates.clear(),this._widgetCache.clear()})},wQ.instance.addListener(this._globalToggleListener),this.widget.items.length>0)c9.instance.requestFrame()}didUpdateWidget(J){if(super.didUpdateWidget(J),!J.isInSelectionMode&&this.widget.isInSelectionMode){this.widget.focusNode?.requestFocus();let Z=this.getLatestUserMessageOrdinal();if(Z!==null)this._selectUserMessageByOrdinal(Z)}if(J.items===this.widget.items)return;let Q=Math.min(J.items.length,this.widget.items.length);for(let Z=0;Z<Q;Z++){let X=J.items[Z],Y=this.widget.items[Z];if(X&&Y){if(X.type!==Y.type){this._widgetCache.delete(Z);continue}if(X.type==="toolResult"&&Y.type==="toolResult"){let K=X.toolResult.run,G=Y.toolResult.run;if(K.status!==G.status||"result"in K!=="result"in G||"error"in K!=="error"in G)this._widgetCache.delete(Z)}}}if(this.widget.items.length<J.items.length)this._cleanupOrphanedCacheEntries();this._updateStreamingIndexes();for(let Z of this._streamingIndexes)if(Z>=this.widget.items.length)this._streamingIndexes.delete(Z)}_cleanupOrphanedCacheEntries(){for(let J of this._widgetCache.keys())if(J>=this.widget.items.length)this._widgetCache.delete(J)}_isMessageStreaming(J){if(J.type!=="message")return!1;let Q=J.message;if(Q.role!=="assistant")return!1;if(Q.state.type==="streaming")return!0;return Q.content.at(-1)?.type==="thinking"}_updateStreamingIndexes(){for(let J of this._streamingIndexes)if(J>=this.widget.items.length)this._streamingIndexes.delete(J);for(let J=0;J<this.widget.items.length;J++){let Q=this.widget.items[J];if(!Q)continue;let Z=this._isMessageStreaming(Q);if(Z&&!this._streamingIndexes.has(J))this._streamingIndexes.add(J);else if(!Z&&this._streamingIndexes.has(J))this._streamingIndexes.delete(J)}}_getViewportHeight(){let J=this.context.findRenderObject();if(J&&"size"in J){let Q=J.size;if(typeof Q.height==="number"&&Q.height>0)return this._viewportHeight=Q.height,Q.height}return this._viewportHeight}dispose(){if(this._isDisposed=!0,this._widgetCache.clear(),this._globalToggleListener)wQ.instance.removeListener(this._globalToggleListener);if(!this.widget.controller)this._controller?.dispose();this.widget.focusNode?.dispose(),super.dispose()}build(J){let Q=i6.of(J),Z=XB(J);if(this._lastCostDisplayState!==null&&this._lastCostDisplayState!==Z)this._widgetCache.clear();this._lastCostDisplayState=Z;let X=this._getTotalItemCount(J),Y=[];for(let H=0;H<X;H++)if(Y.push(this._buildItemAtIndex(J,H)),H<X-1)Y.push(new U0({height:1}));let K=new $Y({controller:this._controller,autofocus:this.widget.autofocus,position:"bottom",child:new i0({key:new a7("message-list-column"),crossAxisAlignment:"start",children:Y})}),q=[new x6({padding:V0.only({left:2,right:this.widget.showScrollbar?3:2,bottom:1}),child:K})];if(this.widget.showScrollbar&&this._controller){let H=new gR({controller:this._controller,getScrollInfo:()=>this._getScrollbarInfo(),thickness:1,thumbColor:Q.app.scrollbarThumb,trackColor:Q.app.scrollbarTrack});q.push(new wX({right:1,top:0,bottom:0,child:new U0({width:1,child:H})}))}let z=new TJ({children:q}),U=new $R({key:new a7("message-view-selection-area"),child:z,onCopy:this.widget.onCopy}),W=new Map([[HQ1,new S9(this.handleNavigateUserMessageUp)],[BQ1,new S9(this.handleNavigateUserMessageDown)],[Uu1,new S9(this.handleEscape)],[Wu1,new S9(this.handleScrollDown)],[Fu1,new S9(this.handleScrollUp)],[Hu1,new S9(this.handleEditMessage)],[Bu1,new S9(this.handleRestoreMessage)],[Du1,new S9(this.handleForkMessage)]]),F=new Map([[b6.key("Tab"),new HQ1],[b6.shift("Tab"),new BQ1],[b6.key("Escape"),new Uu1],[b6.key("j"),new Wu1],[b6.key("ArrowDown"),new BQ1],[b6.key("k"),new Fu1],[b6.key("ArrowUp"),new HQ1],[b6.key("e"),new Hu1],[b6.key("r"),new Bu1],[b6.key("f"),new Du1]]);if(this.widget.focusNode)return new q9({focusNode:this.widget.focusNode,child:new HZ({actions:W,child:new dq({shortcuts:F,focusNode:this.widget.focusNode,child:U})})});return U}_getTotalItemCount(J){return this.widget.items.length}_buildItemAtIndex(J,Q){let Z=this.widget.items[Q];if(!Z)return new y0;let X=Z.type==="message"&&this._isMessageStreaming(Z),Y=Z.type==="toolResult"&&(Z.toolResult.run.status==="queued"||Z.toolResult.run.status==="in-progress")&&!("result"in Z.toolResult.run)&&!("error"in Z.toolResult.run);if(!X&&!Y){let q=this._signatureFor(Z),z=this._widgetCache.get(Q);if(z&&z.sig===q)return z.widget;let U=this.buildThreadItemWidget(J,Z,Q);return this._widgetCache.set(Q,{sig:q,widget:U}),U}return this.buildThreadItemWidget(J,Z,Q)}onNewMessage(){if(this._isDisposed)return;this.widget.onNewMessage?.()}scrollToTop(){if(this._isDisposed||!this._controller)return;this._controller.scrollToTop()}scrollToMessage(J,{animated:Q=!1,offset:Z=0,edge:X="top",duration:Y}={}){if(this._isDisposed||!this._controller)return!1;let K=this._getMessageRelativeOffset(J,X);if(K===null)return!1;let G=K-Z;if(Q)this._controller.animateTo(G,Y);else this._controller.jumpTo(G);return!0}_getColumnElement(){let J=this.context.element;if(!J)return null;let Q=new a7("message-list-column"),Z=(X)=>{if(X.widget.key?.equals(Q))return X;for(let Y of X.children){let K=Z(Y);if(K)return K}return null};return Z(J)}_getMessageRelativeOffset(J,Q){let Z=this._getColumnElement();if(!Z)return null;let X=J*2,Y=Z.children[X];if(!Y?.renderObject)return null;let K=Y.renderObject,G=Z.renderObject;if(!G)return null;let q=K.localToGlobal({x:0,y:0}),z=G.localToGlobal({x:0,y:0}),U=0;if(Q==="bottom")U=K.size.height;return q.y+U-z.y}_getScrollbarInfo(){let J=this._controller?.maxScrollExtent??0,Q=this._getViewportHeight(),Z=this._controller?.offset??0,X=J+Q;return{totalContentHeight:Math.max(X,0),viewportHeight:Math.max(Q,1),scrollOffset:Math.max(Z,0)}}}G9();var WW6=[{type:"command",text:'amp -x "What package manager do we use here?"'},{type:"command",text:'amp -x "Run the linter and fix the errors"'},{type:"hint",text:"Use /queue to enqueue messages without interrupting the agent"},{type:"hint",text:"Use Ctrl+G to edit the prompt in your $EDITOR"},{type:"hint",text:"Generate an AGENTS.md file with the /generate-agent-file command"},{type:"hint",text:"Open your thread in the browser with /browser"},{type:"hint",text:"Create a new thread with /new"},{type:"hint",text:"Change the visiblity settings of your thread with /visibility"},{type:"hint",text:"Open the settings with the /settings command"},{type:"hint",text:"Draft a new thread based on the current thread with /handoff"},{type:"hint",text:"Use Tab/Shift+Tab to navigate to previous messages to edit or restore to a previous state"},{type:"prompt",text:'"Use the oracle to review the code we just wrote."'},{type:"prompt",text:'"Use subagents to update these components to use the new attribute we added."'},{type:"prompt",text:'"Do not write any code yet. Plan first."'},{type:"prompt",text:'"Think hard before you start implementing."'},{type:"prompt",text:`"Use 'psql' to change all blog_posts to have comments"`},{type:"prompt",text:'"Run <build command> and fix all the errors"'},{type:"quote",text:`"We are at the 'introduction of photography' period of programming. Painting by hand just doesn't have the same appeal anymore" - Orta Therox`},{type:"quote",text:'"Programming in the normal way feels like walking. You type out each expression, stepping incrementally toward your goal. When programming with AI, each move is bigger than a step. You lift off the ground." - Mary Rose Cook'},{type:"quote",text:'"Tomorrow all this may change, but right now after daily experience writing code with LLMs I strongly believe the maximum quality of work is reached using the human+LLM equation." - antirez'},{type:"quote",text:`"The magic that's coming now is the most powerful yet. And that means that we're beginning a profound period of exploration and creativity, trying to understand how to make that magic work and to derive new advantages from its power." - Tim O'Reilly`},{type:"quote",text:`"They're applying years of hard-won engineering wisdom to shape and constrain the AI's output. The AI is accelerating their implementation, but their expertise is what keeps the code maintainable." - Addy Osmani`}];class MQ1 extends I6{agentMode;constructor(J={}){super(J.key?{key:J.key}:{});this.agentMode=J.agentMode}build(J){let Z=e6.of(J).colorScheme,Y=i6.of(J).app,G=_8.of(J).capabilities.animationSupport,q=process.pid%WW6.length,z=WW6[q],U=z.type==="quote"?new j1({color:Z.foreground,dim:!0}):z.type==="hint"?new j1({color:Z.secondary}):new j1({color:z.type==="prompt"?Z.primary:Z.warning}),W=new j1({color:Y.keybind}),F=new j1({color:Y.command}),H=new j1({color:Z.secondary}),B=new j1({color:Z.foreground,dim:!0}),M=[];if(z.type==="hint"){let A=z.text.split(/(\s\/[\w-]+)/g);for(let w of A)if(w.match(/^\s\/[\w-]+$/)){let R=w.trim(),O=w.slice(0,w.length-R.length),j=R.slice(1);M.push(new N1(O,U)),M.push(new N1(j,F))}else M.push(new N1(w,U))}else M.push(new N1(z.text,U));let V=[new N1("Welcome to Amp",new j1({color:Z.foreground})),new N1(`
|
|
6528
6528
|
|
|
6529
6529
|
|
|
6530
|
-
`),new N1("
|
|
6530
|
+
`),new N1("Ctrl+O",W),new N1(` to open the command palette
|
|
6531
6531
|
`,B),new N1("Type ",B),new N1("@",H),new N1(` to mention files
|
|
6532
6532
|
`,B),new N1("Ctrl+C",W),new N1(` to exit
|
|
6533
6533
|
|
|
6534
6534
|
|
|
6535
|
-
`,B),new N1("
|
|
6535
|
+
`,B),new N1("Ctrl+O",W),new N1(" and ",B),new N1("help",new j1({color:Z.warning})),new N1(` for more
|
|
6536
6536
|
|
|
6537
6537
|
|
|
6538
|
-
`,B),...M],N=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new n1({text:new N1("",void 0,V)})]}),L="high";if(this.agentMode==="fast")L="fast";else if(this.agentMode==="free")L="free";return C9.child(new y0({constraints:new w6(40,120,0,1/0),child:new X8({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[new R8({flex:1,child:new Mg1({width:40,height:40,colorMode:L,fps:G==="fast"?60:G==="slow"?15:0,...G==="disabled"&&{seed:42,t:3}})}),new U0({width:1}),new R8({flex:2,child:N})]})}))}}l8();class Mu1 extends c0{props;constructor(J){super({key:J.key});this.props=J;this.props.enabled??=!0}createState(){return new FW6}}class FW6 extends d0{build(J){let Z=i6.of(J).colors,{todos:X,title:Y="TODOs",enabled:K=!0}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new U0({width:0,height:0});let G=K?Z.foreground:Z.mutedForeground,q=X.map((z)=>this.buildTodoItem(z,Z,K));return new y0({child:new x6({padding:V0.symmetric(1,0),child:new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new n1({text:new N1(Y,new
|
|
6538
|
+
`,B),...M],N=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new n1({text:new N1("",void 0,V)})]}),L="high";if(this.agentMode==="fast")L="fast";else if(this.agentMode==="free")L="free";return C9.child(new y0({constraints:new w6(40,120,0,1/0),child:new X8({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[new R8({flex:1,child:new Mg1({width:40,height:40,colorMode:L,fps:G==="fast"?60:G==="slow"?15:0,...G==="disabled"&&{seed:42,t:3}})}),new U0({width:1}),new R8({flex:2,child:N})]})}))}}l8();class Mu1 extends c0{props;constructor(J){super({key:J.key});this.props=J;this.props.enabled??=!0}createState(){return new FW6}}class FW6 extends d0{build(J){let Z=i6.of(J).colors,{todos:X,title:Y="TODOs",enabled:K=!0}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new U0({width:0,height:0});let G=K?Z.foreground:Z.mutedForeground,q=X.map((z)=>this.buildTodoItem(z,Z,K));return new y0({child:new x6({padding:V0.symmetric(1,0),child:new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new n1({text:new N1(Y,new j1({bold:!0,color:G}))}),...q]})})})}buildTodoItem(J,Q,Z){let X=this.getStatusIcon(J.status),Y=Z?Q.foreground:Q.mutedForeground,K=new j1({bold:J.status==="in-progress",color:Y}),G=new j1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Y});return new X8({crossAxisAlignment:"start",children:[new n1({text:new N1(X,K)}),new U0({width:1}),new R8({child:new n1({text:new N1(J.content,G)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class Vu1 extends I6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Z,onButtonClick:X}){super({key:J});this.ad=Q,this.onDismiss=Z,this.onButtonClick=X}build(J){return new y0({decoration:new i8(void 0,new x8(new w8(E1.blue,1,"rounded"),new w8(E1.blue,1,"rounded"),void 0,new w8(E1.blue,1,"rounded"))),child:new x6({padding:V0.horizontal(1),child:new i0({children:[new X8({crossAxisAlignment:"start",children:[new R8({child:new n1({text:new N1(this.ad.content)})}),new U0({width:4}),new NQ({uri:"https://ampcode.com/free",text:"Ad",style:new j1({dim:!0}),onError:(Q)=>{}})]}),new X8({crossAxisAlignment:"start",children:[new nh1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:V0.horizontal(1),color:E1.blue,reverse:!0}),new U0({width:2}),new n1({text:new N1(this.ad.destinationUrlHostname,new j1({dim:!0}))})]})]})})})}}G9();l8();class Nu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new HW6(this.props.autofocus??!0)}}class HW6 extends d0{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(q)=>{if(q.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(q.ctrlKey&&q.key==="c"||q.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Z=_8.sizeOf(J),X=Math.min(60,Z.width-4),Y=Z.height-4,K=[];if(this.widget.props.title)K.push(new n1({text:new N1(this.widget.props.title,new j1({bold:!0,color:E1.blue}))}),new U0({height:1}));if(this.widget.props.message)K.push(new n1({text:new N1(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)K.push(new U0({height:1}));let G=[];if(this.widget.props.showCopyOption)G.push(new n1({text:new N1("Enter to copy",new j1({dim:!0}))}));return G.push(new n1({text:new N1("Escape to close",new j1({dim:!0}))})),K.push(new X8({children:G.flatMap((q,z)=>z<G.length-1?[q,new U0({width:1}),new n1({text:new N1("•",new j1({dim:!0}))}),new U0({width:1})]:[q]),mainAxisSize:"min"})),new C9({child:new y0({constraints:new w6(X,X,0,Y),decoration:new i8(E1.default(),new x8(new w8(E1.blue,1,"rounded"),new w8(E1.blue,1,"rounded"),new w8(E1.blue,1,"rounded"),new w8(E1.blue,1,"rounded"))),padding:new V0(2,2,2,2),child:new q9({autofocus:this.autofocus,onKey:Q,child:new i0({children:K,mainAxisSize:"min"})})})})}}G0();z2();AW();pX();$z();KS();import{execSync as BW6}from"child_process";import{writeFile as UF9}from"fs/promises";import WF9 from"path";var UW=null;function FF9(J){return J.startsWith("custom-command-")}function HF9(J){return J.startsWith("agent-mode-")}function BF9(J){return J.replace(/^custom-command-/,"")}class Lu1{configService;registry;onExecute;onExecutionComplete;commands=new Map;latestCustom=[];telemetrySubmitter;constructor(J,Q,Z,X){this.configService=J;this.registry=Q;this.onExecute=Z;this.onExecutionComplete=X;this.registerCommands(),this.registry.commands.subscribe((Y)=>this.latestCustom=Y),this.telemetrySubmitter=new Kp(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService)}async execute(J,Q,Z=[]){this.telemetrySubmitter.submit(J).catch((W)=>{u.debug("Failed to submit command telemetry",W)});let X=new AbortController,Y=Date.now(),K=`command-${Y}-${Math.random().toString(36).substring(7)}`,G=this.commands.get(J);if(G){this.onExecute({id:K,name:G.id,startTime:Y,abortController:X});let W=await G.execute(Q,Z);return this.onExecutionComplete(),W}let q=BF9(J),z=this.latestCustom.find((W)=>W.name===q);if(!z)return;this.onExecute({id:K,name:z.name,startTime:Y,abortController:X});let U=await Qp(q,Z,this.registry,{signal:X.signal});if(this.onExecutionComplete(),U.success)if(z.kind==="markdown"){Q.editorDispatch({type:"set-input",input:U.output});return}else{Q.submitMessage(U.output);return}return Error(U.error??`Command '${J}' failed`)}getPriority(J,Q){if(HF9(J))return 20;if(FF9(J))return 4;if(Q.editorState.hasSelection)switch(J){case"copy-selection":return 50}if(this.hasPromptText(Q)&&Q.isProcessing)switch(J){case"queue-current-prompt":return 40;case"queue-argument":return 39;case"dequeue":return 38}if(Q.isProcessing)switch(J){case"queue-current-prompt":return 30;case"queue-argument":return 29;case"dequeue":return 28}if(this.hasPromptText(Q))switch(J){case"handoff-from-prompt":return 20;case"editor":return 19;case"clear":return 18}switch(J){case"help":return 10;case"continue":return 9;case"new":return 8;case"handoff":return 7;case"editor":return 6;case"browser":case"url":case"share-private":case"share-workspace":case"share-group":case"share-public":case"collapse-thinking-blocks":case"expand-thinking-blocks":case"queue-current-prompt":case"queue-argument":case"clear":case"copy-selection":case"dequeue":case"mode":case"generate-agent-file":case"agent-files":case"connect":case"disconnect":case"settings":case"permissions":case"permissions-enable":case"permissions-disable":case"ide":case"agent-mode":case"show-costs":case"refresh":case"handoff-from-prompt":case"debug-thread-json":return 1;case"quit":return 0}}getCommandFollows(J){switch(J){case"handoff":return["new","handoff-from-prompt"];case"queue-argument":return["queue-current-prompt"];case"share-private":return["share-workspace","share-group","share-public"];case"agent-mode":return MZ().map(({mode:Q})=>`agent-mode-${Q}`);default:return[]}}registerCommands(){this.register({id:"new",noun:"Thread",verb:"Start new thread",execute:async(J)=>{await J.startNewThread()},isVisible:(J)=>!this.isThreadEmpty(J)}),this.register({id:"continue",noun:"Thread",verb:"switch thread",aliases:["continue thread"],gatherArguments:async(J,Q)=>{return await Q.launchThreadPicker()},execute:async(J,Q)=>{await J.switchToThread(Q)},isVisible:()=>!0}),this.register({id:"handoff",noun:"Thread",verb:"Handoff to new thread",gatherArguments:async(J,Q)=>{return await Q.launchMultilinePrompt("handoff","Describe a prompt to hand off...")},execute:async(J,Q)=>{return J.handleHandoff(Q)},isVisible:(J)=>!this.isThreadEmpty(J),nonBlocking:!0}),this.register({id:"handoff-from-prompt",noun:"Thread",verb:"Handoff to new thread",execute:async(J)=>{return J.handleHandoff(J.editorState.text)},isVisible:(J)=>!this.isThreadEmpty(J)&&this.hasPromptText(J),getPromptText:(J)=>{if(this.hasPromptText(J))return this.truncatedPromptText(J)},nonBlocking:!0}),this.register({id:"browser",noun:"Thread",verb:"Open thread in Browser",execute:async({thread:J,ampURL:Q})=>{let Z=nW(new URL(Q),J.id).toString();try{await AY(Z)}catch(X){u.error("Failed to open browser",{error:X})}},isVisible:(J)=>!this.isThreadEmpty(J)}),this.register({id:"url",noun:"Thread",verb:"Copy URL to Clipboard",execute:async(J)=>{let Q=nW(new URL(J.ampURL),J.thread.id).toString();try{return await D2.instance.tuiInstance.clipboard.writeText(Q),new q2(`Thread URL: ${Q}
|
|
6539
6539
|
|
|
6540
6540
|
(Copied to clipboard)`)}catch(Z){return u.error("Failed to copy URL to clipboard",{error:Z}),Error(`Thread URL: ${Q}
|
|
6541
6541
|
|
|
@@ -6553,8 +6553,8 @@ ${Q.message}`)}},isVisible:()=>!UW}),this.register({id:"disconnect",noun:"Agent"
|
|
|
6553
6553
|
|
|
6554
6554
|
Client ID: ${Q}
|
|
6555
6555
|
|
|
6556
|
-
Server will clean up automatically within 60 seconds`)}catch(Q){return Error(`Failed to disconnect: ${Q.message}`)}},isVisible:()=>!!UW}),this.register({id:"settings",noun:"Settings",verb:"Open settings in EDITOR",execute:async(J)=>{let Q=await ZW();if(Q===null)return Error("No editor found, please set $EDITOR to edit settings");try{D2.instance.tuiInstance.suspend(),BW6(`${Q} "${J.settingsFilePath}"`,{stdio:"inherit"}),D2.instance.tuiInstance.resume()}catch(Z){return u.error("Failed to open settings in editor",Z),Error(`Failed to open ${Q}`)}},isVisible:()=>!0}),this.register({id:"permissions",noun:"Permissions",verb:"Open permissions in EDITOR",execute:async(J)=>{let Q=await ZW();if(Q===null)return Error("No editor found, please set $EDITOR to edit permissions");let Z="";try{let X={stdin:process.stdin,stdout:process.stdout,stderr:{write:(Y)=>{return Z=Y.toString(),!0}},exit:(Y)=>{if(Y!==0)throw u.error("editPermissions exited with status",Y),Error(Z)},settingsFile:J.settingsFilePath,resolveEditor:ZW};D2.instance.tuiInstance.suspend(),await OC(X),D2.instance.tuiInstance.resume()}catch(X){u.error("failed to open permissions editor:",X);let Y=X instanceof Error?`: ${X.message}`:"";return Error(`Failed to open ${Q}${Y}`)}},isVisible:()=>!0}),this.register({id:"permissions-enable",noun:"Permissions",verb:"Enable permissions for this session",execute:async()=>{try{return VZ("dangerouslyAllowAll",!1),new q2("Amp is now following permissions rules for this session")}catch(J){return u.error("Failed to set dangerously allow all setting",J),Error("Failed to enable permissions for this session")}},isVisible:()=>!0}),this.register({id:"permissions-disable",noun:"Permissions",verb:"Dangerously Allow All for this session",execute:async()=>{try{return VZ("dangerouslyAllowAll",!0),new q2("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(J){return u.error("Failed to set dangerously allow all setting",J),Error("Failed to disable permissions for this session")}},isVisible:()=>!0}),this.register({id:"ide",noun:"IDE",verb:"Connect to IDE",execute:async(J)=>{J.openIdePicker()},isVisible:(J)=>!!J.openIdePicker}),this.register({id:"agent-mode",noun:"Agent",verb:"Change agent mode",gatherArguments:async(J,Q)=>{let Z=await this.getCurrentAgentMode(J),X=await J.configService.getLatest(),Y=MZ(X.settings);return await Q.launchFuzzyPicker({items:Y.map((K)=>K.mode).filter((K)=>K!==Z),getLabel:(K)=>{let q=Y.find((U)=>U.mode===K)?.description||"",z=K===Z?" (current)":"";return`${K}${q?` - ${q}`:""}${z}`},title:"Select Agent Mode"})},execute:async(J,Q)=>{try{if(!Q)return;if(!this.isThreadEmpty(J))return Error("Cannot change agent mode after messages have been sent in this thread");let Z=await this.getCurrentAgentMode(J);if(Q==="free"&&Z!=="free"){J.toggleAgentMode();return}J.setInMemoryAgentModeOverride(Q);let X=await J.configService.getLatest(),Y=MZ(X.settings),K=CS(Q,Y);return new q2(`Mode set to: ${Q}${K?` - ${K}`:""} (session override)`)}catch(Z){return u.error("Failed to access agent mode setting",Z),Error("Failed to access agent mode setting")}},isVisible:(J)=>{if(this.threadHasMessages(J))return!1;return MZ().length>2}}),MZ().forEach((J)=>{this.register(this.createAgentModeCommand(J.mode))}),this.register({id:"show-costs",noun:"Screen",verb:"Show costs",shortcut:b6.alt("d"),execute:async(J)=>{let Q=await J.configService.getLatest();VZ("internal.showCost",!(Q.settings["internal.showCost"]??!0))},isVisible:()=>!0}),this.register({id:"refresh",noun:"Screen",verb:"Refresh screen",shortcut:b6.ctrl("l"),execute:async(J)=>{D2.instance.tuiInstance.getScreen().markForRefresh(),c9.instance.requestFrame()},isVisible:()=>!0}),this.register({id:"help",noun:null,verb:"Help",execute:async(J)=>{J.openHelp()},isVisible:()=>!0}),this.register({id:"quit",noun:null,verb:"Quit",aliases:["exit"],shortcut:new b6("c",{ctrl:!0}),execute:async(J)=>{J.exitApp()},isVisible:()=>!0}),this.register({id:"debug-thread-json",noun:"Dev",verb:"Open thread JSON in Editor (Debug)",execute:async(J)=>{try{let Q=process.env.EDITOR||process.env.VISUAL||"nano",Z=WF9.join("/tmp",`amp-thread-${J.thread.id}-${Date.now()}.json`),X=JSON.stringify(J.thread,null,2);await UF9(Z,X,"utf-8"),D2.instance.tuiInstance.suspend(),BW6(`${Q} "${Z}"`,{stdio:"inherit"}),D2.instance.tuiInstance.resume(),u.info("Thread JSON written and opened in editor",{file:Z});return}catch(Q){return u.error("Failed to write thread JSON or open editor",Q),Error("Failed to write thread JSON or open editor")}},isVisible:(J)=>!1})}async getCurrentAgentMode(J){let Q=await J.configService.getLatest(),Z=yZ(Q.settings);return J.getInMemoryAgentModeOverride()??Z}isThreadEmpty(J){return J.thread.messages.length===0}threadHasMessages(J){return!this.isThreadEmpty(J)}getQueuedMessages(J){return J.thread.queuedMessages??[]}hasPromptText(J){return J.editorState.text.trim().length>0}truncatedPromptText(J){let Q=J.editorState.text.trim().replace(/\n/g," ");return Q.length>20?`${Q.slice(0,20)}...`:Q}register(J){if(this.commands.has(J.id))throw Error(`Command with id ${J.id} already registered`);this.commands.set(J.id,J)}createAgentModeCommand(J){return{id:`agent-mode-${J}`,noun:"Agent",verb:`Use ${J} mode`,execute:async(Q)=>{try{if(this.threadHasMessages(Q))return Error("Cannot change agent mode after messages have been sent in this thread");Q.setInMemoryAgentModeOverride(J)}catch(Z){return u.error("Failed to access agent mode setting",Z),Error("Failed to access agent mode setting")}},isVisible:(Q)=>{if(this.threadHasMessages(Q))return!1;let Z=Q.getInMemoryAgentModeOverride();if(Z===null)return!0;return Z!==J}}}getAllCommands(){let J=this.latestCustom.filter((Z)=>Z.available).map((Z)=>({id:`custom-command-${Z.name}`,noun:"Custom Command",verb:Z.name,isVisible:()=>!0,gatherArguments:Z.kind==="executable"?async(X,Y)=>{return await Y.launchArgumentPrompt(Z.name)}:void 0,execute:(X,Y)=>this.execute(Z.name,X,Y??[])}));return[...Array.from(this.commands.values()).filter((Z)=>Z.noun!=="Dev"),...J]}}l8();l8();class DW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});initState(){this.focusNode.requestFocus()}dispose(){this.focusNode.dispose()}build(J){let Q=x8.all(new w8(E1.white,1,"solid")),Z=new cq({controller:this.controller,focusNode:this.focusNode,placeholder:"Enter command argument...",onSubmitted:(K)=>{this.widget.props.onSubmit(K.trim())},autofocus:!0,style:{textColor:E1.white,border:null},maxLines:1}),X=new X8({children:[new y0({decoration:{color:E1.default()},child:new n1({text:new N1(">",new $1({color:E1.white}))})}),new R8({child:Z})]}),Y=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("",void 0,[new N1("Command: ",new $1({color:E1.white})),new N1(this.widget.props.commandName,new $1({color:E1.yellow,bold:!0}))])})});return new y0({decoration:{border:Q,color:E1.default()},padding:V0.all(1),child:new i0({children:[Y,new U0({height:1}),X]})})}}class Au1 extends c0{props;constructor(J){super();this.props=J}createState(){return new DW6}}G9();l8();class MW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});initState(){this.focusNode.requestFocus()}dispose(){this.focusNode.dispose()}build(J){let Q=x8.all(new w8(E1.white,1,"solid")),X=_8.of(J).size.height,Y=Math.max(Math.floor(X*0.5),10),K=new cq({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder||"Enter your message...",onSubmitted:(U)=>{this.widget.props.onSubmit(U.trim())},submitKey:{character:"Enter"},autofocus:!0,style:{textColor:E1.white,border:null},wrap:!0,minLines:3,maxLines:null,expands:!1}),G=new y0({constraints:new w6({maxHeight:Y}),child:K}),q=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("",void 0,[new N1("Command: ",new $1({color:E1.white})),new N1(this.widget.props.commandName,new $1({color:E1.yellow,bold:!0}))])})}),z=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("Press Enter to submit, Esc to cancel",new $1({color:E1.white,dim:!0}))})});return new y0({decoration:{border:Q,color:E1.default()},padding:V0.all(1),child:new i0({children:[q,new U0({height:1}),new R8({child:G}),new U0({height:1}),z]})})}}class wu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new MW6}}l8();var DF9=/[\\/_ +.#"@[({&]/,MF9=/[\\/_ +.#"@[({&]/g,VF9=/[\s-]/,VW6=/[\s-]/g;function NQ1(J,Q,Z,X,Y,K,G){if(K===Q.length){if(Y===J.length)return 1;return 0.99}let q=`${Y},${K}`;if(G[q]!==void 0)return G[q];let z=X.charAt(K),U=Z.indexOf(z,Y),W=0,F,H,B,M;while(U>=0){if(F=NQ1(J,Q,Z,X,U+1,K+1,G),F>W){if(U===Y)F*=1;else if(VF9.test(J.charAt(U-1))){if(F*=0.9,M=J.slice(Y,U-1).match(VW6),M&&Y>0)F*=Math.pow(0.999,M.length)}else if(DF9.test(J.charAt(U-1))){if(F*=0.8,B=J.slice(Y,U-1).match(MF9),B&&Y>0)F*=Math.pow(0.999,B.length)}else if(F*=0.3,Y>0)F*=Math.pow(0.999,U-Y);if(J.charAt(U)!==Q.charAt(K))F*=0.9999}if(F<0.1&&(Z.charAt(U-1)===X.charAt(K+1)||X.charAt(K+1)===X.charAt(K)&&Z.charAt(U-1)!==X.charAt(K))){if(H=NQ1(J,Q,Z,X,U+1,K+2,G),H*0.1>F)F=H*0.1}if(F>W)W=F;U=Z.indexOf(z,U+1)}return G[q]=W,W}function VQ1(J){return J.toLowerCase().replace(VW6," ")}function NW6(J,Q){let Z=NQ1(J,Q,VQ1(J),VQ1(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let Y=0,K=0;for(let q of X){let z=NQ1(J,q,VQ1(J),VQ1(q),0,0,{});if(z===0)return Z;Y+=z,K+=q.length}let G=Y/X.length*0.95;return Math.max(Z,G)}return Z}class oC{}class tC{}class LQ1{}class AQ1{}class LW6 extends c0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new AW6}}class AW6 extends d0{build(J){return this.widget.onContext(J),this.widget.child}}function NF9(J,Q){if(J==="")return{matches:!0,score:1};let Z=NW6(Q,J);return{matches:Z>0.15,score:Z}}class uR extends c0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new wW6}}class wW6 extends d0{controller=new eK;focusNode;scrollController=new jY;selectedIndex=0;itemContexts=[];initState(){this.focusNode=new Q9({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})}didUpdateWidget(J){if(J.props.items!==this.widget.props.items)c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof oC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof tC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof LQ1){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Z=Q[this.selectedIndex];if(Z)this.widget.props.onAccept(Z)}return"handled"}if(J instanceof AQ1)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text;return this.widget.props.items.map((Z)=>({item:Z,...NF9(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,X)=>this.widget.props.sortItems(Z,X,J):(Z,X)=>X.score-Z.score).map((Z)=>Z.item)}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Z=0,X=Q.size.height;RJ1(J,{top:Z,bottom:X},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Z=this.getFilteredItems();if(J>=0&&J<Z.length){if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Z[this.selectedIndex]??null);else if(Q===2){let X=Z[J];if(X)this.widget.props.onAccept(X)}}};build(J){let Q=this.getFilteredItems(),Z=x8.all(new w8(E1.white,1,"solid")),X=this.widget.props.enabled??!0,Y=new cq({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:X,style:{textColor:E1.white,border:null},maxLines:1}),K=new dq({shortcuts:new Map([[new b6("ArrowDown"),new oC],[new b6("ArrowUp"),new tC],[new b6("Tab"),new oC],[new b6("Tab",{shift:!0}),new tC],[new b6("n",{ctrl:!0}),new oC],[new b6("p",{ctrl:!0}),new tC],[new b6("Enter"),new LQ1],[new b6("Escape"),new AQ1]]),focusNode:this.focusNode,child:Y}),G=new HZ({actions:new Map([[oC,new S9(this.invoke)],[tC,new S9(this.invoke)],[LQ1,new S9(this.invoke)],[AQ1,new S9(this.invoke)]]),child:K}),q=new X8({children:[new y0({decoration:{color:E1.default()},child:new n1({text:new N1(">",new $1({color:E1.white}))})}),new R8({child:G})]});this.itemContexts=[];let z=Q.map((H,B)=>{let M=B===this.selectedIndex,V;if(this.widget.props.renderItem)V=this.widget.props.renderItem(H,M);else{let N=M?E1.yellow:void 0,L=M?E1.black:E1.white;V=new y0({decoration:N?{color:N}:void 0,padding:V0.symmetric(2,0),child:new n1({text:new N1(this.widget.props.getLabel(H),new $1({color:L}))})})}return new LW6(new x9({onClick:(N)=>this.handleItemClick(B,N.clickCount),child:V}),(N)=>{this.itemContexts[B]=N})}),U=new i0({children:z,crossAxisAlignment:"start"}),W=new R8({child:new x9({onScroll:this.handleScroll,opaque:!1,child:new $Y({controller:this.scrollController,autofocus:!1,child:U})})}),F=[];if(this.widget.props.title){let H=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(this.widget.props.title,new $1({color:E1.yellow,bold:!0}))})});F.push(H)}return F.push(q,new U0({height:1}),W),new y0({decoration:{border:Z,color:E1.default()},padding:V0.all(1),child:new i0({children:F})})}}class Ru1 extends I6{props;debugLabel="CommandPalette";constructor(J){super();this.props=J}build(J){let{context:Q,enabled:Z,paletteController:X,commands:Y,onExecuteResult:K,onDismiss:G}=this.props,q=Y.getAllCommands().filter((W)=>W.isVisible?W.isVisible(Q):!0),z="";return new uR({items:q,enabled:Z??!0,getLabel:(W)=>{let F=W.noun?`${W.noun.toLowerCase()} ${W.verb.toLowerCase()}`:W.verb.toLowerCase(),H=W.getPromptText&&W.getPromptText(Q),B=W.aliases?W.aliases.join(" "):"",M=H?`${F} ${H}`:F;return B?`${M} ${B}`:M},sortItems:(W,F,H)=>{if(z=H,F.score!==W.score)return F.score-W.score;if(H!==""){let B=Y.getCommandFollows(W.item.id),M=Y.getCommandFollows(F.item.id);if(B.includes(F.item.id))return 1;if(M.includes(W.item.id))return-1}return Y.getPriority(F.item.id,Q)-Y.getPriority(W.item.id,Q)},onAccept:async(W)=>{let F=W.gatherArguments?await W.gatherArguments(Q,X):void 0;if(W.gatherArguments&&!F)return;if(W.nonBlocking)return Y.execute(W.id,Q,F),G();let H=await Y.execute(W.id,Q,F);if(H)K(H);else G()},onDismiss:G,title:"Command Palette",renderItem:(W,F)=>{let H=F?E1.yellow:void 0,B=F?E1.black:E1.white,M=[];if(W.noun)M.push(new N1(W.noun.toLowerCase(),new $1({color:B,dim:!0}))),M.push(new N1(" "));let V=W.verb.toLowerCase(),N=V.match(/^(\$_|md)\s+(.+)$/);if(N)M.push(new N1(N[1],new $1({color:E1.blue,bold:!0}))),M.push(new N1(" ")),M.push(new N1(N[2],new $1({color:B,bold:!0})));else M.push(new N1(V,new $1({color:B,bold:!0})));let L=W.getPromptText&&W.getPromptText(Q);if(L)M.push(new N1(' "',new $1({color:B}))),M.push(new N1(L,new $1({color:B}))),M.push(new N1('"',new $1({color:B})));if(z&&W.aliases){let R=z.toLowerCase(),O=W.aliases.find((j)=>j.toLowerCase().includes(R));if(O)M.push(new N1(" (alias: ",new $1({color:B}))),M.push(new N1(O,new $1({color:B}))),M.push(new N1(")",new $1({color:B})))}let A=[new n1({text:new N1("",void 0,M)})],w=[];if(W.shortcut){let O=W.shortcut.toString().split("+"),j=[];for(let $=0;$<O.length;$++){let E=O[$],T=E==="Ctrl"||E==="Shift"||E==="Alt"||E==="Meta"?E1.blue:E1.index(8);if(j.push(new N1(E,new $1({color:T,bold:!0}))),$<O.length-1)j.push(new N1(" ",new $1({color:E1.index(8)})))}w.push(new n1({text:new N1("",void 0,j)}))}return new y0({decoration:H?{color:H}:void 0,padding:V0.symmetric(2,0),child:new X8({children:[...A,new R8({child:new U0({height:1})}),...w]})})}})}}class Ou1 extends uR{debugLabel="ThreadContinuationPicker";constructor(J){let Q=J.threads,Z=(G)=>`${G.messageCount} msgs`,X=Math.max(0,...Q.map((G)=>Z(G).length)),Y=Math.max(0,...Q.map((G)=>G.timeAgo.length)),K=Math.max(0,...Q.map((G)=>G.shortThreadID.length));super({items:J.threads,getLabel:(G)=>G.title,onAccept:(G)=>J.onSelect?.(G.id),onDismiss:J.onDismiss,onSelectionChange:(G)=>J.onPreview?.(G?.id??null),title:"Switch Thread",renderItem:(G,q)=>{let z=q?E1.yellow:void 0,U=q?E1.black:E1.white,W=E1.index(8),F=(H,B)=>new U0({width:B,child:X8.end([new n1({text:new N1(H,new $1({color:W}))})])});return new y0({decoration:z?{color:z}:void 0,padding:V0.symmetric(2,0),child:new X8({children:[new R8({child:new n1({text:new N1(G.title,new $1({color:U})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),F(Z(G),X),new U0({width:1}),new n1({text:new N1("│",new $1({color:W}))}),new U0({width:1}),F(G.timeAgo,Y),new U0({width:1}),new n1({text:new N1("│",new $1({color:W}))}),new U0({width:1}),F(G.shortThreadID,K)]})})}})}}l8();class ju1 extends c0{props;constructor(J){super();this.props=J}createState(){return new RW6}}class RW6 extends d0{dispose(){super.dispose()}build(J){let Q=n51(this.widget.props.message),Z=Q.type==="error"?E1.red:E1.yellow,X=x8.all(new w8(E1.white,1,"solid")),Y=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(Q.title,new $1({color:Z,bold:!0}))})}),K=new R8({child:new $R({child:new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(Q.description,new $1({color:E1.white})),selectable:!0})})})}),G=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("Press any key to close",new $1({color:E1.white,dim:!0,italic:!0}))})});return new q9({onKey:()=>{return this.widget.props.onDismiss(),"handled"},autofocus:!0,child:new y0({decoration:{border:X,color:E1.default()},padding:V0.all(1),child:new i0({mainAxisAlignment:"center",children:[Y,new U0({height:1}),K,G]})})})}}class $u1 extends c0{props;constructor(J){super();this.props=J}createState(){return new OW6}}class OW6 extends d0{layers=[];initState(){this.layers=[]}pushLayerWithResult(J){return new Promise((Q)=>{let Z=!1,Y=J({resolve:(K)=>{if(Z)return;Z=!0,this.popLayer(),Q(K)},dismiss:()=>{if(Z)return;Z=!0,this.popLayer(),Q(null)}});this.setState(()=>{this.layers.push(Y)})})}paletteController={launchThreadPicker:async()=>await this.pushThreadPicker(),launchArgumentPrompt:async(J)=>await this.pushCommandArgumentPrompt(J),launchMultilinePrompt:async(J,Q)=>await this.pushCommandMultilinePrompt(J,Q),launchFuzzyPicker:async(J)=>await this.pushFuzzyPicker(J)};buildCommandPalette(){if(!this.widget.props.mainThread)return new U0;return new Ru1({commands:this.widget.props.commands,thread:this.widget.props.mainThread,context:this.widget.props.commandContext,onDismiss:()=>this.popLayer(),paletteController:this.paletteController,onExecuteResult:(J)=>this.showMessage(J),enabled:this.layers.length===0})}async pushCommandArgumentPrompt(J){return this.pushLayerWithResult(({resolve:Q,dismiss:Z})=>new Au1({commandName:J,onSubmit:Q,onDismiss:Z}))}async pushCommandMultilinePrompt(J,Q){return this.pushLayerWithResult(({resolve:Z,dismiss:X})=>new wu1({commandName:J,placeholder:Q,onSubmit:Z,onDismiss:X}))}async pushThreadPicker(){return this.pushLayerWithResult(({resolve:J,dismiss:Q})=>new Ou1({threads:this.widget.props.threads,onSelect:J,onDismiss:Q,onPreview:this.widget.props.onThreadPreview}))}async pushFuzzyPicker(J){return this.pushLayerWithResult(({resolve:Q,dismiss:Z})=>new uR({items:J.items,getLabel:J.getLabel,title:J.title,onAccept:Q,onDismiss:Z}))}showMessage(J){this.setState(()=>{this.layers.push(new ju1({message:J,onDismiss:()=>{this.popLayer(),this.widget.props.onDismiss()}}))})}popLayer(){if(this.layers.length>0)this.setState(()=>{this.layers.pop()});else this.widget.props.onDismiss()}build(J){let Q=[this.buildCommandPalette(),...this.layers];return new TJ({fit:"expand",children:Q})}}D3();z2();z8();v6();C0();var eC={EXACT:1000,PREFIX:900,SUFFIX:850,SUBSTRING:800,FUZZY:250,NO_MATCH:0};function jW6(J,Q,Z=!1){if(J.length===0)return{string:Q,score:0,matched:!0};let X=Z?J:J.toLowerCase(),Y=Z?Q:Q.toLowerCase();if(Y===X)return{string:Q,score:eC.EXACT,matched:!0};if(Y.startsWith(X))return{string:Q,score:eC.PREFIX,matched:!0};if(Y.endsWith(X))return{string:Q,score:eC.SUFFIX,matched:!0};if(Y.includes(X))return{string:Q,score:eC.SUBSTRING,matched:!0};if(LF9(X,Y))return{string:Q,score:eC.FUZZY,matched:!0};return{string:Q,score:eC.NO_MATCH,matched:!1}}function LF9(J,Q){let Z=0;for(let X=0;X<Q.length&&Z<J.length;X++)if(Q[X]===J[Z])Z++;return Z===J.length}function $W6(J,Q,Z){return{type:"command",name:J,description:Q,command:Z}}function EW6(J){if(J.kind!=="file"&&J.kind!=="folder")throw Error("Invalid completion item: missing path or kind");return{type:"file",path:J.path,kind:J.kind}}function Eu1(J,Q,Z){return{type:"thread",threadId:J,title:Q,description:Z}}function IW6(J,Q){return{type:"argument",value:J,description:Q}}function Iu1(J){switch(J.type){case"command":return J.name;case"file":return J.path;case"thread":return J.title;case"argument":return J.value;case"hint":return J.message}}function PW6(J){switch(J.type){case"command":return J.description;case"file":return;case"thread":return J.description||J.title;case"argument":return J.description;case"hint":return}}class Pu1{commands;fuzzyClient;threadFetcher;configService;threadIndexer;constructor(J,Q,Z,X,Y){this.commands=J;this.fuzzyClient=Q;this.threadFetcher=Z;this.configService=X;this.threadIndexer=Y}async buildOptions(J,Q,Z){if(J.trigger==="/"){let X=this.parseCommandArguments(J.query);if(X)return await this.buildCommandArgumentOptions(X);return this.buildCommandOptions(J.query,Q,Z)}else if(J.trigger==="@"){let[X,Y]=await Promise.all([this.buildFileOptions(J.query),this.buildThreadMentionOptions(J.query)]);return[...Y,...X]}return[]}buildCommandOptions(J,Q,Z){if(!Q)return[];let Y=this.commands.query(J,Q,Z).map((K)=>({command:K,score:jW6(J,K.name,!1)})).filter((K)=>K.score.matched).sort((K,G)=>G.score.score-K.score.score);if(Y.length===0&&J.startsWith("comp"))return[{type:"hint",message:"The /compact command has been removed. Use /handoff instead."}];return Y.map((K)=>$W6(K.command.name,K.command.description,K.command))}parseCommandArguments(J){let Q=J.split(" ");if(Q.length<2)return null;let Z=Q[0];if(!Z)return null;let X=Q.slice(1).join(" ");return{command:Z,argQuery:X}}async buildCommandArgumentOptions(J){let{command:Q,argQuery:Z}=J;switch(Q){case"continue":return await this.buildThreadOptions(Z);case"mode":return await this.buildModeOptions(Z);default:return[]}}async buildThreadOptions(J){let Q=await this.threadFetcher.fetchThreadSummaries(J,0,10);if(!Q.ok)return[];return Q.threads.map((Z)=>{let X=Z.description.title;if(X.length>35)X=X.slice(0,32)+"...";else X=X.padEnd(35);return Eu1(Z.id,X,`${`${Z.messageCount} msgs`.padEnd(8)} │ ${Z.description.timeAgo} │ ${Z.description.shortThreadID}`)})}async buildModeOptions(J){let Q=await this.configService.getLatest();return MZ(Q.settings).filter(({mode:X})=>X.toLowerCase().includes(J.toLowerCase())).map(({mode:X})=>IW6(X))}async buildFileOptions(J){try{let Q=await this.getOpenFiles();return(await this.fuzzyClient.queryCompletions(J,20,Q)).map((X)=>EW6(X))}catch(Q){return[]}}async buildThreadMentionOptions(J){if(!(await this.configService.getLatest()).settings["experimental.tools"]?.includes(qO))return[];return(await this.threadIndexer.search(J,5)).map(({id:Y,title:K})=>Eu1(Y,K,Y))}async getOpenFiles(){let J=await G6(S7.status);if(!J.connected||!J.visibleFiles?.length)return;return J.visibleFiles.map((Q)=>{return O0.parse(Q).fsPath})}}G9();class Tu1 extends I6{details;constructor({key:J,details:Q}){super(J?{key:J}:{});this.details=Q}build(J){let Z=e6.of(J).colorScheme,X=_8.of(J),Y=new $1({color:Z.primary,bold:!0}),K=new $1({color:Z.foreground}),G=new $1({color:Z.foreground}),q=new $1({color:Z.secondary,bold:!0}),z=X.size.width,U=X.size.height,W=z-4,F=Math.min(U-4,Math.floor(U*0.6)),H=Math.min(80,W),B=new $Y({autofocus:!0,child:new x6({padding:V0.only({left:2,right:2}),child:new i0({crossAxisAlignment:"start",children:[new C9({child:new n1({text:new N1(`Details
|
|
6557
|
-
`,Y)})}),new U0({height:1}),new n1({text:new N1(this.details,K)}),new U0({height:1})]})})}),M=new C9({child:new n1({text:new N1("",G,[new N1("Press ",G),new N1("Escape",q),new N1(" to close • Use ",G),new N1("↑↓",q),new N1(" or ",G),new N1("j/k",q),new N1(" to scroll",G)])})}),V=new i0({crossAxisAlignment:"stretch",children:[new R8({child:B}),M]});return new C9({child:new y0({constraints:new w6(H,H,0,F),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:V})})}}ij();Wk();WL();z8();l8();l8();class qB extends c0{options;onSelect;title;body;borderColor;backgroundColor;padding;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;constructor({key:J,options:Q,onSelect:Z,title:X,body:Y,borderColor:K=E1.index(8),backgroundColor:G,padding:q=new V0(1,0,1,0),selectedIndex:z=0,autofocus:U=!0,showDismissalMessage:W=!0,enableMouseInteraction:F=!0}){super({key:J});this.options=Q,this.onSelect=Z,this.title=X,this.body=Y,this.borderColor=K,this.backgroundColor=G,this.padding=q,this.selectedIndex=Math.max(0,Math.min(z,Q.length-1)),this.autofocus=U,this.showDismissalMessage=W,this.enableMouseInteraction=F}createState(){return new TW6}}class TW6 extends d0{selectedIndex=0;focusNode=new Q9({});initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;if(Q<0)Q=this.widget.options.length-1;else if(Q>=this.widget.options.length)Q=0;let Z=0;while(Z<this.widget.options.length){let X=this.widget.options[Q];if(X&&(X.enabled??!0))break;Q=(Q+J+this.widget.options.length)%this.widget.options.length,Z++}if(this.selectedIndex!==Q)this.setState(()=>{this.selectedIndex=Q})}build(J){if(this.widget.options.length===0)return new U0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new n1({text:new N1(this.widget.title,new
|
|
6556
|
+
Server will clean up automatically within 60 seconds`)}catch(Q){return Error(`Failed to disconnect: ${Q.message}`)}},isVisible:()=>!!UW}),this.register({id:"settings",noun:"Settings",verb:"Open settings in EDITOR",execute:async(J)=>{let Q=await ZW();if(Q===null)return Error("No editor found, please set $EDITOR to edit settings");try{D2.instance.tuiInstance.suspend(),BW6(`${Q} "${J.settingsFilePath}"`,{stdio:"inherit"}),D2.instance.tuiInstance.resume()}catch(Z){return u.error("Failed to open settings in editor",Z),Error(`Failed to open ${Q}`)}},isVisible:()=>!0}),this.register({id:"permissions",noun:"Permissions",verb:"Open permissions in EDITOR",execute:async(J)=>{let Q=await ZW();if(Q===null)return Error("No editor found, please set $EDITOR to edit permissions");let Z="";try{let X={stdin:process.stdin,stdout:process.stdout,stderr:{write:(Y)=>{return Z=Y.toString(),!0}},exit:(Y)=>{if(Y!==0)throw u.error("editPermissions exited with status",Y),Error(Z)},settingsFile:J.settingsFilePath,resolveEditor:ZW};D2.instance.tuiInstance.suspend(),await OC(X),D2.instance.tuiInstance.resume()}catch(X){u.error("failed to open permissions editor:",X);let Y=X instanceof Error?`: ${X.message}`:"";return Error(`Failed to open ${Q}${Y}`)}},isVisible:()=>!0}),this.register({id:"permissions-enable",noun:"Permissions",verb:"Enable permissions for this session",execute:async()=>{try{return VZ("dangerouslyAllowAll",!1),new q2("Amp is now following permissions rules for this session")}catch(J){return u.error("Failed to set dangerously allow all setting",J),Error("Failed to enable permissions for this session")}},isVisible:()=>!0}),this.register({id:"permissions-disable",noun:"Permissions",verb:"Dangerously Allow All for this session",execute:async()=>{try{return VZ("dangerouslyAllowAll",!0),new q2("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(J){return u.error("Failed to set dangerously allow all setting",J),Error("Failed to disable permissions for this session")}},isVisible:()=>!0}),this.register({id:"ide",noun:"IDE",verb:"Connect to IDE",execute:async(J)=>{J.openIdePicker()},isVisible:(J)=>!!J.openIdePicker}),this.register({id:"agent-mode",noun:"Agent",verb:"Change agent mode",gatherArguments:async(J,Q)=>{let Z=await this.getCurrentAgentMode(J),X=await J.configService.getLatest(),Y=MZ(X.settings);return await Q.launchFuzzyPicker({items:Y.map((K)=>K.mode).filter((K)=>K!==Z),getLabel:(K)=>{let q=Y.find((U)=>U.mode===K)?.description||"",z=K===Z?" (current)":"";return`${K}${q?` - ${q}`:""}${z}`},title:"Select Agent Mode"})},execute:async(J,Q)=>{try{if(!Q)return;if(!this.isThreadEmpty(J))return Error("Cannot change agent mode after messages have been sent in this thread");let Z=await this.getCurrentAgentMode(J);if(Q==="free"&&Z!=="free"){J.toggleAgentMode();return}J.setInMemoryAgentModeOverride(Q);let X=await J.configService.getLatest(),Y=MZ(X.settings),K=CS(Q,Y);return new q2(`Mode set to: ${Q}${K?` - ${K}`:""} (session override)`)}catch(Z){return u.error("Failed to access agent mode setting",Z),Error("Failed to access agent mode setting")}},isVisible:(J)=>{if(this.threadHasMessages(J))return!1;return MZ().length>2}}),MZ().forEach((J)=>{this.register(this.createAgentModeCommand(J.mode))}),this.register({id:"show-costs",noun:"Screen",verb:"Show costs",shortcut:b6.alt("d"),execute:async(J)=>{let Q=await J.configService.getLatest();VZ("internal.showCost",!(Q.settings["internal.showCost"]??!0))},isVisible:()=>!0}),this.register({id:"refresh",noun:"Screen",verb:"Refresh screen",shortcut:b6.ctrl("l"),execute:async(J)=>{D2.instance.tuiInstance.getScreen().markForRefresh(),c9.instance.requestFrame()},isVisible:()=>!0}),this.register({id:"help",noun:null,verb:"Help",execute:async(J)=>{J.openHelp()},isVisible:()=>!0}),this.register({id:"quit",noun:null,verb:"Quit",aliases:["exit"],shortcut:new b6("c",{ctrl:!0}),execute:async(J)=>{J.exitApp()},isVisible:()=>!0}),this.register({id:"debug-thread-json",noun:"Dev",verb:"Open thread JSON in Editor (Debug)",execute:async(J)=>{try{let Q=process.env.EDITOR||process.env.VISUAL||"nano",Z=WF9.join("/tmp",`amp-thread-${J.thread.id}-${Date.now()}.json`),X=JSON.stringify(J.thread,null,2);await UF9(Z,X,"utf-8"),D2.instance.tuiInstance.suspend(),BW6(`${Q} "${Z}"`,{stdio:"inherit"}),D2.instance.tuiInstance.resume(),u.info("Thread JSON written and opened in editor",{file:Z});return}catch(Q){return u.error("Failed to write thread JSON or open editor",Q),Error("Failed to write thread JSON or open editor")}},isVisible:(J)=>!1})}async getCurrentAgentMode(J){let Q=await J.configService.getLatest(),Z=yZ(Q.settings);return J.getInMemoryAgentModeOverride()??Z}isThreadEmpty(J){return J.thread.messages.length===0}threadHasMessages(J){return!this.isThreadEmpty(J)}getQueuedMessages(J){return J.thread.queuedMessages??[]}hasPromptText(J){return J.editorState.text.trim().length>0}truncatedPromptText(J){let Q=J.editorState.text.trim().replace(/\n/g," ");return Q.length>20?`${Q.slice(0,20)}...`:Q}register(J){if(this.commands.has(J.id))throw Error(`Command with id ${J.id} already registered`);this.commands.set(J.id,J)}createAgentModeCommand(J){return{id:`agent-mode-${J}`,noun:"Agent",verb:`Use ${J} mode`,execute:async(Q)=>{try{if(this.threadHasMessages(Q))return Error("Cannot change agent mode after messages have been sent in this thread");Q.setInMemoryAgentModeOverride(J)}catch(Z){return u.error("Failed to access agent mode setting",Z),Error("Failed to access agent mode setting")}},isVisible:(Q)=>{if(this.threadHasMessages(Q))return!1;let Z=Q.getInMemoryAgentModeOverride();if(Z===null)return!0;return Z!==J}}}getAllCommands(){let J=this.latestCustom.filter((Z)=>Z.available).map((Z)=>({id:`custom-command-${Z.name}`,noun:"Custom Command",verb:Z.name,isVisible:()=>!0,gatherArguments:Z.kind==="executable"?async(X,Y)=>{return await Y.launchArgumentPrompt(Z.name)}:void 0,execute:(X,Y)=>this.execute(Z.name,X,Y??[])}));return[...Array.from(this.commands.values()).filter((Z)=>Z.noun!=="Dev"),...J]}}l8();l8();class DW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});initState(){this.focusNode.requestFocus()}dispose(){this.focusNode.dispose()}build(J){let Q=x8.all(new w8(E1.white,1,"solid")),Z=new cq({controller:this.controller,focusNode:this.focusNode,placeholder:"Enter command argument...",onSubmitted:(K)=>{this.widget.props.onSubmit(K.trim())},autofocus:!0,style:{textColor:E1.white,border:null},maxLines:1}),X=new X8({children:[new y0({decoration:{color:E1.default()},child:new n1({text:new N1(">",new j1({color:E1.white}))})}),new R8({child:Z})]}),Y=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("",void 0,[new N1("Command: ",new j1({color:E1.white})),new N1(this.widget.props.commandName,new j1({color:E1.yellow,bold:!0}))])})});return new y0({decoration:{border:Q,color:E1.default()},padding:V0.all(1),child:new i0({children:[Y,new U0({height:1}),X]})})}}class Au1 extends c0{props;constructor(J){super();this.props=J}createState(){return new DW6}}G9();l8();class MW6 extends d0{controller=new eK;focusNode=new Q9({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});initState(){this.focusNode.requestFocus()}dispose(){this.focusNode.dispose()}build(J){let Q=x8.all(new w8(E1.white,1,"solid")),X=_8.of(J).size.height,Y=Math.max(Math.floor(X*0.5),10),K=new cq({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder||"Enter your message...",onSubmitted:(U)=>{this.widget.props.onSubmit(U.trim())},submitKey:{character:"Enter"},autofocus:!0,style:{textColor:E1.white,border:null},wrap:!0,minLines:3,maxLines:null,expands:!1}),G=new y0({constraints:new w6({maxHeight:Y}),child:K}),q=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("",void 0,[new N1("Command: ",new j1({color:E1.white})),new N1(this.widget.props.commandName,new j1({color:E1.yellow,bold:!0}))])})}),z=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("Press Enter to submit, Esc to cancel",new j1({color:E1.white,dim:!0}))})});return new y0({decoration:{border:Q,color:E1.default()},padding:V0.all(1),child:new i0({children:[q,new U0({height:1}),new R8({child:G}),new U0({height:1}),z]})})}}class wu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new MW6}}l8();var DF9=/[\\/_ +.#"@[({&]/,MF9=/[\\/_ +.#"@[({&]/g,VF9=/[\s-]/,VW6=/[\s-]/g;function NQ1(J,Q,Z,X,Y,K,G){if(K===Q.length){if(Y===J.length)return 1;return 0.99}let q=`${Y},${K}`;if(G[q]!==void 0)return G[q];let z=X.charAt(K),U=Z.indexOf(z,Y),W=0,F,H,B,M;while(U>=0){if(F=NQ1(J,Q,Z,X,U+1,K+1,G),F>W){if(U===Y)F*=1;else if(VF9.test(J.charAt(U-1))){if(F*=0.9,M=J.slice(Y,U-1).match(VW6),M&&Y>0)F*=Math.pow(0.999,M.length)}else if(DF9.test(J.charAt(U-1))){if(F*=0.8,B=J.slice(Y,U-1).match(MF9),B&&Y>0)F*=Math.pow(0.999,B.length)}else if(F*=0.3,Y>0)F*=Math.pow(0.999,U-Y);if(J.charAt(U)!==Q.charAt(K))F*=0.9999}if(F<0.1&&(Z.charAt(U-1)===X.charAt(K+1)||X.charAt(K+1)===X.charAt(K)&&Z.charAt(U-1)!==X.charAt(K))){if(H=NQ1(J,Q,Z,X,U+1,K+2,G),H*0.1>F)F=H*0.1}if(F>W)W=F;U=Z.indexOf(z,U+1)}return G[q]=W,W}function VQ1(J){return J.toLowerCase().replace(VW6," ")}function NW6(J,Q){let Z=NQ1(J,Q,VQ1(J),VQ1(Q),0,0,{}),X=Q.trim().split(/\s+/);if(X.length>1){let Y=0,K=0;for(let q of X){let z=NQ1(J,q,VQ1(J),VQ1(q),0,0,{});if(z===0)return Z;Y+=z,K+=q.length}let G=Y/X.length*0.95;return Math.max(Z,G)}return Z}class oC{}class tC{}class LQ1{}class AQ1{}class LW6 extends c0{child;onContext;constructor(J,Q){super();this.child=J;this.onContext=Q}createState(){return new AW6}}class AW6 extends d0{build(J){return this.widget.onContext(J),this.widget.child}}function NF9(J,Q){if(J==="")return{matches:!0,score:1};let Z=NW6(Q,J);return{matches:Z>0.15,score:Z}}class uR extends c0{props;debugLabel="FuzzyPicker";constructor(J){super();this.props=J}createState(){return new wW6}}class wW6 extends d0{controller=new eK;focusNode;scrollController=new jY;selectedIndex=0;itemContexts=[];initState(){this.focusNode=new Q9({debugLabel:this.widget.debugLabel}),this.controller.addListener(()=>{this.selectedIndex=0,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()});let Q=this.getFilteredItems();this.widget.props.onSelectionChange?.(Q[0]??null)});let J=this.getFilteredItems();this.widget.props.onSelectionChange?.(J[0]??null),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})}didUpdateWidget(J){if(J.props.items!==this.widget.props.items)c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()})}dispose(){this.widget.props.onSelectionChange?.(null),this.controller.dispose(),this.focusNode.dispose(),this.scrollController.dispose()}invoke=(J)=>{if(J instanceof oC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length-1)this.selectedIndex++,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof tC){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex>0)this.selectedIndex--,this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null);return"handled"}if(J instanceof LQ1){let Q=this.getFilteredItems();if(Q.length>0&&this.selectedIndex<Q.length){let Z=Q[this.selectedIndex];if(Z)this.widget.props.onAccept(Z)}return"handled"}if(J instanceof AQ1)return this.widget.props.onDismiss?.(),"handled";return"ignored"};getFilteredItems(){let J=this.controller.text;return this.widget.props.items.map((Z)=>({item:Z,...NF9(J,this.widget.props.getLabel(Z))})).filter((Z)=>Z.matches).sort(this.widget.props.sortItems?(Z,X)=>this.widget.props.sortItems(Z,X,J):(Z,X)=>X.score-Z.score).map((Z)=>Z.item)}ensureSelectedItemVisible(){let J=this.itemContexts[this.selectedIndex];if(!J)return;let Q=J.findRenderObject();if(!Q)return;let Z=0,X=Q.size.height;RJ1(J,{top:Z,bottom:X},{padding:1})}handleScroll=(J)=>{let Q=this.getFilteredItems();if(Q.length===0)return;if(J.direction==="down")if(this.selectedIndex<Q.length-1)this.selectedIndex++;else return;else if(this.selectedIndex>0)this.selectedIndex--;else return;this.setState(),c9.instance.addPostFrameCallback(()=>{this.ensureSelectedItemVisible()}),this.widget.props.onSelectionChange?.(Q[this.selectedIndex]??null)};handleItemClick=(J,Q)=>{let Z=this.getFilteredItems();if(J>=0&&J<Z.length){if(Q===1)this.selectedIndex=J,this.setState(),this.widget.props.onSelectionChange?.(Z[this.selectedIndex]??null);else if(Q===2){let X=Z[J];if(X)this.widget.props.onAccept(X)}}};build(J){let Q=this.getFilteredItems(),Z=x8.all(new w8(E1.white,1,"solid")),X=this.widget.props.enabled??!0,Y=new cq({controller:this.controller,focusNode:this.focusNode,autofocus:!0,enabled:X,style:{textColor:E1.white,border:null},maxLines:1}),K=new dq({shortcuts:new Map([[new b6("ArrowDown"),new oC],[new b6("ArrowUp"),new tC],[new b6("Tab"),new oC],[new b6("Tab",{shift:!0}),new tC],[new b6("n",{ctrl:!0}),new oC],[new b6("p",{ctrl:!0}),new tC],[new b6("Enter"),new LQ1],[new b6("Escape"),new AQ1]]),focusNode:this.focusNode,child:Y}),G=new HZ({actions:new Map([[oC,new S9(this.invoke)],[tC,new S9(this.invoke)],[LQ1,new S9(this.invoke)],[AQ1,new S9(this.invoke)]]),child:K}),q=new X8({children:[new y0({decoration:{color:E1.default()},child:new n1({text:new N1(">",new j1({color:E1.white}))})}),new R8({child:G})]});this.itemContexts=[];let z=Q.map((H,B)=>{let M=B===this.selectedIndex,V;if(this.widget.props.renderItem)V=this.widget.props.renderItem(H,M);else{let N=M?E1.yellow:void 0,L=M?E1.black:E1.white;V=new y0({decoration:N?{color:N}:void 0,padding:V0.symmetric(2,0),child:new n1({text:new N1(this.widget.props.getLabel(H),new j1({color:L}))})})}return new LW6(new x9({onClick:(N)=>this.handleItemClick(B,N.clickCount),child:V}),(N)=>{this.itemContexts[B]=N})}),U=new i0({children:z,crossAxisAlignment:"start"}),W=new R8({child:new x9({onScroll:this.handleScroll,opaque:!1,child:new $Y({controller:this.scrollController,autofocus:!1,child:U})})}),F=[];if(this.widget.props.title){let H=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(this.widget.props.title,new j1({color:E1.yellow,bold:!0}))})});F.push(H)}return F.push(q,new U0({height:1}),W),new y0({decoration:{border:Z,color:E1.default()},padding:V0.all(1),child:new i0({children:F})})}}class Ru1 extends I6{props;debugLabel="CommandPalette";constructor(J){super();this.props=J}build(J){let{context:Q,enabled:Z,paletteController:X,commands:Y,onExecuteResult:K,onDismiss:G}=this.props,q=Y.getAllCommands().filter((W)=>W.isVisible?W.isVisible(Q):!0),z="";return new uR({items:q,enabled:Z??!0,getLabel:(W)=>{let F=W.noun?`${W.noun.toLowerCase()} ${W.verb.toLowerCase()}`:W.verb.toLowerCase(),H=W.getPromptText&&W.getPromptText(Q),B=W.aliases?W.aliases.join(" "):"",M=H?`${F} ${H}`:F;return B?`${M} ${B}`:M},sortItems:(W,F,H)=>{if(z=H,F.score!==W.score)return F.score-W.score;if(H!==""){let B=Y.getCommandFollows(W.item.id),M=Y.getCommandFollows(F.item.id);if(B.includes(F.item.id))return 1;if(M.includes(W.item.id))return-1}return Y.getPriority(F.item.id,Q)-Y.getPriority(W.item.id,Q)},onAccept:async(W)=>{let F=W.gatherArguments?await W.gatherArguments(Q,X):void 0;if(W.gatherArguments&&!F)return;if(W.nonBlocking)return Y.execute(W.id,Q,F),G();let H=await Y.execute(W.id,Q,F);if(H)K(H);else G()},onDismiss:G,title:"Command Palette",renderItem:(W,F)=>{let H=F?E1.yellow:void 0,B=F?E1.black:E1.white,M=[];if(W.noun)M.push(new N1(W.noun.toLowerCase(),new j1({color:B,dim:!0}))),M.push(new N1(" "));let V=W.verb.toLowerCase(),N=V.match(/^(\$_|md)\s+(.+)$/);if(N)M.push(new N1(N[1],new j1({color:E1.blue,bold:!0}))),M.push(new N1(" ")),M.push(new N1(N[2],new j1({color:B,bold:!0})));else M.push(new N1(V,new j1({color:B,bold:!0})));let L=W.getPromptText&&W.getPromptText(Q);if(L)M.push(new N1(' "',new j1({color:B}))),M.push(new N1(L,new j1({color:B}))),M.push(new N1('"',new j1({color:B})));if(z&&W.aliases){let R=z.toLowerCase(),O=W.aliases.find((j)=>j.toLowerCase().includes(R));if(O)M.push(new N1(" (alias: ",new j1({color:B}))),M.push(new N1(O,new j1({color:B}))),M.push(new N1(")",new j1({color:B})))}let A=[new n1({text:new N1("",void 0,M)})],w=[];if(W.shortcut){let O=W.shortcut.toString().split("+"),j=[];for(let $=0;$<O.length;$++){let E=O[$],T=E==="Ctrl"||E==="Shift"||E==="Alt"||E==="Meta"?E1.blue:E1.index(8);if(j.push(new N1(E,new j1({color:T,bold:!0}))),$<O.length-1)j.push(new N1(" ",new j1({color:E1.index(8)})))}w.push(new n1({text:new N1("",void 0,j)}))}return new y0({decoration:H?{color:H}:void 0,padding:V0.symmetric(2,0),child:new X8({children:[...A,new R8({child:new U0({height:1})}),...w]})})}})}}class Ou1 extends uR{debugLabel="ThreadContinuationPicker";constructor(J){let Q=J.threads,Z=(G)=>`${G.messageCount} msgs`,X=Math.max(0,...Q.map((G)=>Z(G).length)),Y=Math.max(0,...Q.map((G)=>G.timeAgo.length)),K=Math.max(0,...Q.map((G)=>G.shortThreadID.length));super({items:J.threads,getLabel:(G)=>G.title,onAccept:(G)=>J.onSelect?.(G.id),onDismiss:J.onDismiss,onSelectionChange:(G)=>J.onPreview?.(G?.id??null),title:"Switch Thread",renderItem:(G,q)=>{let z=q?E1.yellow:void 0,U=q?E1.black:E1.white,W=E1.index(8),F=(H,B)=>new U0({width:B,child:X8.end([new n1({text:new N1(H,new j1({color:W}))})])});return new y0({decoration:z?{color:z}:void 0,padding:V0.symmetric(2,0),child:new X8({children:[new R8({child:new n1({text:new N1(G.title,new j1({color:U})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),F(Z(G),X),new U0({width:1}),new n1({text:new N1("│",new j1({color:W}))}),new U0({width:1}),F(G.timeAgo,Y),new U0({width:1}),new n1({text:new N1("│",new j1({color:W}))}),new U0({width:1}),F(G.shortThreadID,K)]})})}})}}l8();class ju1 extends c0{props;constructor(J){super();this.props=J}createState(){return new RW6}}class RW6 extends d0{dispose(){super.dispose()}build(J){let Q=n51(this.widget.props.message),Z=Q.type==="error"?E1.red:E1.yellow,X=x8.all(new w8(E1.white,1,"solid")),Y=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(Q.title,new j1({color:Z,bold:!0}))})}),K=new R8({child:new $R({child:new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1(Q.description,new j1({color:E1.white})),selectable:!0})})})}),G=new y0({padding:V0.symmetric(1,0),child:new n1({text:new N1("Press any key to close",new j1({color:E1.white,dim:!0,italic:!0}))})});return new q9({onKey:()=>{return this.widget.props.onDismiss(),"handled"},autofocus:!0,child:new y0({decoration:{border:X,color:E1.default()},padding:V0.all(1),child:new i0({mainAxisAlignment:"center",children:[Y,new U0({height:1}),K,G]})})})}}class $u1 extends c0{props;constructor(J){super();this.props=J}createState(){return new OW6}}class OW6 extends d0{layers=[];initState(){this.layers=[]}pushLayerWithResult(J){return new Promise((Q)=>{let Z=!1,Y=J({resolve:(K)=>{if(Z)return;Z=!0,this.popLayer(),Q(K)},dismiss:()=>{if(Z)return;Z=!0,this.popLayer(),Q(null)}});this.setState(()=>{this.layers.push(Y)})})}paletteController={launchThreadPicker:async()=>await this.pushThreadPicker(),launchArgumentPrompt:async(J)=>await this.pushCommandArgumentPrompt(J),launchMultilinePrompt:async(J,Q)=>await this.pushCommandMultilinePrompt(J,Q),launchFuzzyPicker:async(J)=>await this.pushFuzzyPicker(J)};buildCommandPalette(){if(!this.widget.props.mainThread)return new U0;return new Ru1({commands:this.widget.props.commands,thread:this.widget.props.mainThread,context:this.widget.props.commandContext,onDismiss:()=>this.popLayer(),paletteController:this.paletteController,onExecuteResult:(J)=>this.showMessage(J),enabled:this.layers.length===0})}async pushCommandArgumentPrompt(J){return this.pushLayerWithResult(({resolve:Q,dismiss:Z})=>new Au1({commandName:J,onSubmit:Q,onDismiss:Z}))}async pushCommandMultilinePrompt(J,Q){return this.pushLayerWithResult(({resolve:Z,dismiss:X})=>new wu1({commandName:J,placeholder:Q,onSubmit:Z,onDismiss:X}))}async pushThreadPicker(){return this.pushLayerWithResult(({resolve:J,dismiss:Q})=>new Ou1({threads:this.widget.props.threads,onSelect:J,onDismiss:Q,onPreview:this.widget.props.onThreadPreview}))}async pushFuzzyPicker(J){return this.pushLayerWithResult(({resolve:Q,dismiss:Z})=>new uR({items:J.items,getLabel:J.getLabel,title:J.title,onAccept:Q,onDismiss:Z}))}showMessage(J){this.setState(()=>{this.layers.push(new ju1({message:J,onDismiss:()=>{this.popLayer(),this.widget.props.onDismiss()}}))})}popLayer(){if(this.layers.length>0)this.setState(()=>{this.layers.pop()});else this.widget.props.onDismiss()}build(J){let Q=[this.buildCommandPalette(),...this.layers];return new TJ({fit:"expand",children:Q})}}D3();z2();z8();v6();C0();var eC={EXACT:1000,PREFIX:900,SUFFIX:850,SUBSTRING:800,FUZZY:250,NO_MATCH:0};function jW6(J,Q,Z=!1){if(J.length===0)return{string:Q,score:0,matched:!0};let X=Z?J:J.toLowerCase(),Y=Z?Q:Q.toLowerCase();if(Y===X)return{string:Q,score:eC.EXACT,matched:!0};if(Y.startsWith(X))return{string:Q,score:eC.PREFIX,matched:!0};if(Y.endsWith(X))return{string:Q,score:eC.SUFFIX,matched:!0};if(Y.includes(X))return{string:Q,score:eC.SUBSTRING,matched:!0};if(LF9(X,Y))return{string:Q,score:eC.FUZZY,matched:!0};return{string:Q,score:eC.NO_MATCH,matched:!1}}function LF9(J,Q){let Z=0;for(let X=0;X<Q.length&&Z<J.length;X++)if(Q[X]===J[Z])Z++;return Z===J.length}function $W6(J,Q,Z){return{type:"command",name:J,description:Q,command:Z}}function EW6(J){if(J.kind!=="file"&&J.kind!=="folder")throw Error("Invalid completion item: missing path or kind");return{type:"file",path:J.path,kind:J.kind}}function Eu1(J,Q,Z){return{type:"thread",threadId:J,title:Q,description:Z}}function IW6(J,Q){return{type:"argument",value:J,description:Q}}function Iu1(J){switch(J.type){case"command":return J.name;case"file":return J.path;case"thread":return J.title;case"argument":return J.value;case"hint":return J.message}}function PW6(J){switch(J.type){case"command":return J.description;case"file":return;case"thread":return J.description||J.title;case"argument":return J.description;case"hint":return}}class Pu1{commands;fuzzyClient;threadFetcher;configService;threadIndexer;constructor(J,Q,Z,X,Y){this.commands=J;this.fuzzyClient=Q;this.threadFetcher=Z;this.configService=X;this.threadIndexer=Y}async buildOptions(J,Q,Z){if(J.trigger==="/"){let X=this.parseCommandArguments(J.query);if(X)return await this.buildCommandArgumentOptions(X);return this.buildCommandOptions(J.query,Q,Z)}else if(J.trigger==="@"){let[X,Y]=await Promise.all([this.buildFileOptions(J.query),this.buildThreadMentionOptions(J.query)]);return[...Y,...X]}return[]}buildCommandOptions(J,Q,Z){if(!Q)return[];let Y=this.commands.query(J,Q,Z).map((K)=>({command:K,score:jW6(J,K.name,!1)})).filter((K)=>K.score.matched).sort((K,G)=>G.score.score-K.score.score);if(Y.length===0&&J.startsWith("comp"))return[{type:"hint",message:"The /compact command has been removed. Use /handoff instead."}];return Y.map((K)=>$W6(K.command.name,K.command.description,K.command))}parseCommandArguments(J){let Q=J.split(" ");if(Q.length<2)return null;let Z=Q[0];if(!Z)return null;let X=Q.slice(1).join(" ");return{command:Z,argQuery:X}}async buildCommandArgumentOptions(J){let{command:Q,argQuery:Z}=J;switch(Q){case"continue":return await this.buildThreadOptions(Z);case"mode":return await this.buildModeOptions(Z);default:return[]}}async buildThreadOptions(J){let Q=await this.threadFetcher.fetchThreadSummaries(J,0,10);if(!Q.ok)return[];return Q.threads.map((Z)=>{let X=Z.description.title;if(X.length>35)X=X.slice(0,32)+"...";else X=X.padEnd(35);return Eu1(Z.id,X,`${`${Z.messageCount} msgs`.padEnd(8)} │ ${Z.description.timeAgo} │ ${Z.description.shortThreadID}`)})}async buildModeOptions(J){let Q=await this.configService.getLatest();return MZ(Q.settings).filter(({mode:X})=>X.toLowerCase().includes(J.toLowerCase())).map(({mode:X})=>IW6(X))}async buildFileOptions(J){try{let Q=await this.getOpenFiles();return(await this.fuzzyClient.queryCompletions(J,20,Q)).map((X)=>EW6(X))}catch(Q){return[]}}async buildThreadMentionOptions(J){if(!(await this.configService.getLatest()).settings["experimental.tools"]?.includes(qO))return[];return(await this.threadIndexer.search(J,5)).map(({id:Y,title:K})=>Eu1(Y,K,Y))}async getOpenFiles(){let J=await G6(S7.status);if(!J.connected||!J.visibleFiles?.length)return;return J.visibleFiles.map((Q)=>{return O0.parse(Q).fsPath})}}G9();class Tu1 extends I6{details;constructor({key:J,details:Q}){super(J?{key:J}:{});this.details=Q}build(J){let Z=e6.of(J).colorScheme,X=_8.of(J),Y=new j1({color:Z.primary,bold:!0}),K=new j1({color:Z.foreground}),G=new j1({color:Z.foreground}),q=new j1({color:Z.secondary,bold:!0}),z=X.size.width,U=X.size.height,W=z-4,F=Math.min(U-4,Math.floor(U*0.6)),H=Math.min(80,W),B=new $Y({autofocus:!0,child:new x6({padding:V0.only({left:2,right:2}),child:new i0({crossAxisAlignment:"start",children:[new C9({child:new n1({text:new N1(`Details
|
|
6557
|
+
`,Y)})}),new U0({height:1}),new n1({text:new N1(this.details,K)}),new U0({height:1})]})})}),M=new C9({child:new n1({text:new N1("",G,[new N1("Press ",G),new N1("Escape",q),new N1(" to close • Use ",G),new N1("↑↓",q),new N1(" or ",G),new N1("j/k",q),new N1(" to scroll",G)])})}),V=new i0({crossAxisAlignment:"stretch",children:[new R8({child:B}),M]});return new C9({child:new y0({constraints:new w6(H,H,0,F),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:V})})}}ij();Wk();WL();z8();l8();l8();class qB extends c0{options;onSelect;title;body;borderColor;backgroundColor;padding;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;constructor({key:J,options:Q,onSelect:Z,title:X,body:Y,borderColor:K=E1.index(8),backgroundColor:G,padding:q=new V0(1,0,1,0),selectedIndex:z=0,autofocus:U=!0,showDismissalMessage:W=!0,enableMouseInteraction:F=!0}){super({key:J});this.options=Q,this.onSelect=Z,this.title=X,this.body=Y,this.borderColor=K,this.backgroundColor=G,this.padding=q,this.selectedIndex=Math.max(0,Math.min(z,Q.length-1)),this.autofocus=U,this.showDismissalMessage=W,this.enableMouseInteraction=F}createState(){return new TW6}}class TW6 extends d0{selectedIndex=0;focusNode=new Q9({});initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;if(Q<0)Q=this.widget.options.length-1;else if(Q>=this.widget.options.length)Q=0;let Z=0;while(Z<this.widget.options.length){let X=this.widget.options[Q];if(X&&(X.enabled??!0))break;Q=(Q+J+this.widget.options.length)%this.widget.options.length,Z++}if(this.selectedIndex!==Q)this.setState(()=>{this.selectedIndex=Q})}build(J){if(this.widget.options.length===0)return new U0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new n1({text:new N1(this.widget.title,new j1({bold:!0}))})),Q.push(new U0({height:1}));if(this.widget.body){if(typeof this.widget.body==="string")Q.push(new n1({text:new N1(this.widget.body)}));else Q.push(this.widget.body);Q.push(new U0({height:1}))}for(let Y=0;Y<this.widget.options.length;Y++){let K=this.widget.options[Y],G=Y===this.selectedIndex,q=K.enabled??!0,z=FQ1(K,G,q&&this.widget.enableMouseInteraction?()=>this.widget.onSelect(K.value):void 0);if(Q.push(z),K.description)Q.push(new U0({height:1}))}if(this.widget.showDismissalMessage)Q.push(new U0({height:1})),Q.push(new n1({text:new N1("Escape to close",new j1({color:E1.index(8)}))}));let Z=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:Q}),X=new y0({child:new x6({padding:this.widget.padding,child:Z}),decoration:new i8(this.widget.backgroundColor,x8.all(new w8(this.widget.borderColor,1,"rounded")))});return new q9({focusNode:this.focusNode,child:X,autofocus:this.widget.autofocus})}}class Cu1 extends c0{confirmationRequest;onResponse;onShowOverlay;constructor({key:J,confirmationRequest:Q,onResponse:Z,onShowOverlay:X}){super({key:J});this.confirmationRequest=Q,this.onResponse=Z,this.onShowOverlay=X}createState(){return new CW6}}class CW6 extends d0{initState(){super.initState()}dispose(){super.dispose()}handleKeyEvent(J){if(J.key==="?"&&!J.shiftKey&&!J.ctrlKey&&!J.altKey&&!J.metaKey){let Q=this.getOverlayContent();if(Q&&this.widget.onShowOverlay)return this.widget.onShowOverlay(Q),"handled"}return"ignored"}getOverlayContent(){if(this.widget.confirmationRequest.type==="tool-use"&&this.widget.confirmationRequest.tools.length===1){let J=this.widget.confirmationRequest.tools[0];if(!J?.useBlock)return null;if(J.useBlock.name===l4)return J.useBlock.input.cmd;if(J.useBlock.name===$Q){let Q=J.useBlock.input;return BF(Q.old_str,Q.new_str,Q.path)}if(J.useBlock.name===xJ){let Q=J.useBlock.input,Z=Q.content||"";return BF("",Z,Q.path)}}return null}build(J){let Z=e6.of(J).colorScheme,X=this.formatConfirmationTitle(this.widget.confirmationRequest),Y=this.createConfirmationOptions(this.widget.confirmationRequest);return new SW6({title:X,options:Y,onSelect:this.widget.onResponse,borderColor:Z.warning,autofocus:!0,showDismissalMessage:!1,enableMouseInteraction:!1,onShowCommand:()=>{let G=this.getOverlayContent();if(G&&this.widget.onShowOverlay)this.widget.onShowOverlay(G)}})}formatConfirmationTitle(J){switch(J.type){case"tool-use":{if(J.tools.length===1){let Q=J.tools[0];if(Q?.useBlock)return this.formatToolConfirmation(Q.useBlock,J.reason);return"Confirm tool call"}return`Confirm ${J.tools.length} tool calls`}case"out-of-credits":return"Insufficient usage balance. Retry?";case"agent-file-creation":return`Create ${_5} file for this codebase?`}}formatToolConfirmation(J,Q){if(J.name===l4){let Z=J.input,X=this.truncateCommand(Z.cmd),K=Z.cmd!==X?`
|
|
6558
6558
|
|
|
6559
6559
|
Press ? for full command`:"";return`${`Run this command?
|
|
6560
6560
|
|
|
@@ -6567,54 +6567,54 @@ Press ? to view full diff`;else if(J.name===xJ)return`${`Allow creating file ${J
|
|
|
6567
6567
|
Press ? to view full diff`;else if(J.name===Qz)return Q||"The Librarian needs your permission to proceed.";else return`Invoke tool ${J.name} with input ${JSON.stringify(J.input)}?`}truncateCommand(J){let Q=J.split(`
|
|
6568
6568
|
`),Z=3;if(Q.length<=3)return J;return Q.slice(0,3).join(`
|
|
6569
6569
|
`)+`
|
|
6570
|
-
...`}createConfirmationOptions(J){switch(J.type){case"tool-use":{if(J.tools.some((K)=>K.useBlock.name===Qz))return[{value:"connect-github",label:"Connect GitHub"},{value:"yes",label:"Retry"},{value:"no",label:"Cancel"},{value:"disable-librarian",label:"Disable the Librarian and cancel"}];let Z=J.tools.some((K)=>K.useBlock.name===$Q||K.useBlock.name===xJ),X=Boolean(J.reason&&OW1.some(({pattern:K})=>J.reason.includes(K.description))),Y=[{value:"yes",label:"Yes"}];if(X&&Z)Y.push({value:"always-guarded",label:"Allow File for Every Session"});return Y.push({value:"allow-all-session",label:"Allow All for This Session"}),Y.push({value:"allow-all-persistent",label:"Allow All for Every Session"}),Y.push({value:"no",label:"No"}),Y}case"out-of-credits":case"agent-file-creation":return[{value:"yes",label:"Yes"},{value:"no",label:"No"}]}}}class SW6 extends c0{options;onSelect;title;body;borderColor;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;onShowCommand;constructor({key:J,options:Q,onSelect:Z,title:X,body:Y,borderColor:K=E1.index(8),selectedIndex:G=0,autofocus:q=!0,showDismissalMessage:z=!0,enableMouseInteraction:U=!0,onShowCommand:W}){super({key:J});this.options=Q,this.onSelect=Z,this.title=X,this.body=Y,this.borderColor=K,this.selectedIndex=G,this.autofocus=q,this.showDismissalMessage=z,this.enableMouseInteraction=U,this.onShowCommand=W}createState(){return new vW6}}class vW6 extends d0{focusNode=new Q9({debugLabel:"ConfirmationSelect"});initState(){super.initState(),this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){if(J.key==="?"&&!J.shiftKey&&!J.ctrlKey&&!J.altKey&&!J.metaKey){if(this.widget.onShowCommand)return this.widget.onShowCommand(),"handled"}return"ignored"}build(J){let Q=new qB({title:this.widget.title,body:this.widget.body,options:this.widget.options,onSelect:this.widget.onSelect,borderColor:this.widget.borderColor,selectedIndex:this.widget.selectedIndex,autofocus:this.widget.autofocus,showDismissalMessage:this.widget.showDismissalMessage,enableMouseInteraction:this.widget.enableMouseInteraction});return new q9({focusNode:this.focusNode,child:Q,autofocus:this.widget.autofocus})}}G0();G9();l8();b2();class Su1 extends c0{constructor(){super()}createState(){return new kW6}}class kW6 extends d0{scrollOffset=0;maxScrollOffset=0;contentHeight=0;viewportHeight=0;logChangeListener=null;initState(){super.initState(),this.logChangeListener=()=>{this.setState(()=>{})},NY.getInstance().addListener(this.logChangeListener)}dispose(){if(this.logChangeListener)NY.getInstance().removeListener(this.logChangeListener),this.logChangeListener=null;super.dispose()}handleKeyEvent=(J)=>{switch(J.key){case"ArrowUp":case"k":return this.scroll(-3),"handled";case"ArrowDown":case"j":return this.scroll(3),"handled";case"Home":return this.scrollToTop(),"handled";case"End":return this.scrollToBottom(),"handled";case"PageUp":return this.scroll(-Math.floor(this.viewportHeight*0.8)),"handled";case"PageDown":return this.scroll(Math.floor(this.viewportHeight*0.8)),"handled";default:return"ignored"}};scroll(J){let Q=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset+J));if(Q!==this.scrollOffset)this.scrollOffset=Q,this.setState(()=>{})}scrollToTop(){if(this.scrollOffset!==0)this.scrollOffset=0,this.setState(()=>{})}scrollToBottom(){if(this.scrollOffset!==this.maxScrollOffset)this.scrollOffset=this.maxScrollOffset,this.setState(()=>{})}updateScrollBounds(J,Q){this.contentHeight=J,this.viewportHeight=Q,this.maxScrollOffset=Math.max(0,J-Q),this.scrollOffset=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset))}getScrollbarInfo=()=>{return{totalContentHeight:this.contentHeight,viewportHeight:this.viewportHeight,scrollOffset:this.scrollOffset}};formatTimestamp(J){let Q=J.getHours().toString().padStart(2,"0"),Z=J.getMinutes().toString().padStart(2,"0"),X=J.getSeconds().toString().padStart(2,"0"),Y=J.getMilliseconds().toString().padStart(3,"0");return`${Q}:${Z}:${X}.${Y}`}getLevelColor(J,Q){switch(J){case"error":return Q.error;case"warn":return"#FFA500";case"info":return Q.foreground;case"debug":return Q.accent;default:return Q.foreground}}formatLogEntry(J,Q){let Z=this.formatTimestamp(J.timestamp),X=this.getLevelColor(J.level,Q),Y=[new N1(`[${Z}] `,new
|
|
6570
|
+
...`}createConfirmationOptions(J){switch(J.type){case"tool-use":{if(J.tools.some((K)=>K.useBlock.name===Qz))return[{value:"connect-github",label:"Connect GitHub"},{value:"yes",label:"Retry"},{value:"no",label:"Cancel"},{value:"disable-librarian",label:"Disable the Librarian and cancel"}];let Z=J.tools.some((K)=>K.useBlock.name===$Q||K.useBlock.name===xJ),X=Boolean(J.reason&&OW1.some(({pattern:K})=>J.reason.includes(K.description))),Y=[{value:"yes",label:"Yes"}];if(X&&Z)Y.push({value:"always-guarded",label:"Allow File for Every Session"});return Y.push({value:"allow-all-session",label:"Allow All for This Session"}),Y.push({value:"allow-all-persistent",label:"Allow All for Every Session"}),Y.push({value:"no",label:"No"}),Y}case"out-of-credits":case"agent-file-creation":return[{value:"yes",label:"Yes"},{value:"no",label:"No"}]}}}class SW6 extends c0{options;onSelect;title;body;borderColor;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;onShowCommand;constructor({key:J,options:Q,onSelect:Z,title:X,body:Y,borderColor:K=E1.index(8),selectedIndex:G=0,autofocus:q=!0,showDismissalMessage:z=!0,enableMouseInteraction:U=!0,onShowCommand:W}){super({key:J});this.options=Q,this.onSelect=Z,this.title=X,this.body=Y,this.borderColor=K,this.selectedIndex=G,this.autofocus=q,this.showDismissalMessage=z,this.enableMouseInteraction=U,this.onShowCommand=W}createState(){return new vW6}}class vW6 extends d0{focusNode=new Q9({debugLabel:"ConfirmationSelect"});initState(){super.initState(),this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this))}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){if(J.key==="?"&&!J.shiftKey&&!J.ctrlKey&&!J.altKey&&!J.metaKey){if(this.widget.onShowCommand)return this.widget.onShowCommand(),"handled"}return"ignored"}build(J){let Q=new qB({title:this.widget.title,body:this.widget.body,options:this.widget.options,onSelect:this.widget.onSelect,borderColor:this.widget.borderColor,selectedIndex:this.widget.selectedIndex,autofocus:this.widget.autofocus,showDismissalMessage:this.widget.showDismissalMessage,enableMouseInteraction:this.widget.enableMouseInteraction});return new q9({focusNode:this.focusNode,child:Q,autofocus:this.widget.autofocus})}}G0();G9();l8();b2();class Su1 extends c0{constructor(){super()}createState(){return new kW6}}class kW6 extends d0{scrollOffset=0;maxScrollOffset=0;contentHeight=0;viewportHeight=0;logChangeListener=null;initState(){super.initState(),this.logChangeListener=()=>{this.setState(()=>{})},NY.getInstance().addListener(this.logChangeListener)}dispose(){if(this.logChangeListener)NY.getInstance().removeListener(this.logChangeListener),this.logChangeListener=null;super.dispose()}handleKeyEvent=(J)=>{switch(J.key){case"ArrowUp":case"k":return this.scroll(-3),"handled";case"ArrowDown":case"j":return this.scroll(3),"handled";case"Home":return this.scrollToTop(),"handled";case"End":return this.scrollToBottom(),"handled";case"PageUp":return this.scroll(-Math.floor(this.viewportHeight*0.8)),"handled";case"PageDown":return this.scroll(Math.floor(this.viewportHeight*0.8)),"handled";default:return"ignored"}};scroll(J){let Q=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset+J));if(Q!==this.scrollOffset)this.scrollOffset=Q,this.setState(()=>{})}scrollToTop(){if(this.scrollOffset!==0)this.scrollOffset=0,this.setState(()=>{})}scrollToBottom(){if(this.scrollOffset!==this.maxScrollOffset)this.scrollOffset=this.maxScrollOffset,this.setState(()=>{})}updateScrollBounds(J,Q){this.contentHeight=J,this.viewportHeight=Q,this.maxScrollOffset=Math.max(0,J-Q),this.scrollOffset=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset))}getScrollbarInfo=()=>{return{totalContentHeight:this.contentHeight,viewportHeight:this.viewportHeight,scrollOffset:this.scrollOffset}};formatTimestamp(J){let Q=J.getHours().toString().padStart(2,"0"),Z=J.getMinutes().toString().padStart(2,"0"),X=J.getSeconds().toString().padStart(2,"0"),Y=J.getMilliseconds().toString().padStart(3,"0");return`${Q}:${Z}:${X}.${Y}`}getLevelColor(J,Q){switch(J){case"error":return Q.error;case"warn":return"#FFA500";case"info":return Q.foreground;case"debug":return Q.accent;default:return Q.foreground}}formatLogEntry(J,Q){let Z=this.formatTimestamp(J.timestamp),X=this.getLevelColor(J.level,Q),Y=[new N1(`[${Z}] `,new j1({color:Q.accent})),new N1(`${J.level.toUpperCase()}: `,new j1({color:X})),new N1(J.message,new j1({color:Q.foreground}))];if(J.args.length>0){let K=J.args.map((G)=>typeof G==="string"?G:JSON.stringify(G,null,2)).join(" ");Y.push(new N1(` ${K}`,new j1({color:Q.foreground,dim:!0})))}return Y.push(new N1(`
|
|
6571
6571
|
`)),Y}build(J){u.debug("[ConsoleOverlay] Building console overlay");let Z=e6.of(J).colorScheme,Y=NY.getInstance().getLogs();u.debug(`[ConsoleOverlay] Found ${Y.length} log entries`);let K=`Console Log (${Y.length} entries)`,q=[new N1(K+`
|
|
6572
6572
|
|
|
6573
|
-
`,new
|
|
6574
|
-
`,new
|
|
6573
|
+
`,new j1({color:Z.foreground}))];if(Y.length===0)q.push(new N1(`No log entries captured yet.
|
|
6574
|
+
`,new j1({color:Z.accent})));else{let L=Y.slice().reverse();for(let A of L)q.push(...this.formatLogEntry(A,Z))}let z=J.mediaQuery,U=z?Math.floor(z.size.width*0.8):60,W=z?Math.floor(z.size.height*0.8):20,F=new q9({autofocus:!0,onKey:this.handleKeyEvent,child:new _W6({scrollOffset:this.scrollOffset,onMeasured:(L,A)=>{this.updateScrollBounds(L,A)},child:new n1({text:new N1("",void 0,q)})})}),H=i6.of(J),B=new gR({controller:null,getScrollInfo:this.getScrollbarInfo,thickness:1,thumbColor:H.app.scrollbarThumb,trackColor:H.app.scrollbarTrack}),M=new TJ({children:[new x6({padding:V0.only({left:0,right:1}),child:F}),new wX({right:0,top:0,bottom:0,child:new U0({width:1,child:B})})]}),V=new x6({padding:V0.only({top:1,left:1,right:1,bottom:1}),child:new n1({text:new N1("Alt+C: close • ↑↓/j k: scroll • Home/End: top/bottom • PgUp/PgDn: page scroll",new j1({color:Z.accent}))})}),N=new i0({children:[new R8({child:M}),V]});return new C9({child:new y0({constraints:new w6(U,U,0,W),decoration:new i8(Z.background,x8.all(new w8(Z.accent,1,"rounded"))),child:new x6({padding:V0.all(1),child:N})})})}}class _W6 extends R4{scrollOffset;onMeasured;constructor({child:J,scrollOffset:Q=0,onMeasured:Z,key:X}){super(X?{child:J,key:X}:{child:J});this.scrollOffset=Q,this.onMeasured=Z}createRenderObject(){return new xW6(this.scrollOffset,this.onMeasured)}updateRenderObject(J){J.updateProperties(this.scrollOffset,this.onMeasured)}}class xW6 extends Z8{_scrollOffset;_onMeasured;constructor(J,Q){super();this._scrollOffset=J,this._onMeasured=Q}updateProperties(J,Q){if(this._scrollOffset!==J)this._scrollOffset=J,this.markNeedsPaint();this._onMeasured=Q}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight),super.performLayout();return}let Q=this.children[0],Z=new w6(J.minWidth,J.maxWidth,0,Number.POSITIVE_INFINITY);Q.layout(Z);let X=-this._scrollOffset;if(Q.setOffset(0,X),this.setSize(J.maxWidth,J.maxHeight),this._onMeasured)this._onMeasured(Q.size.height,this.size.height);super.performLayout()}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X&&"paint"in X){let Y=X,K=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(K,Q,Z)}}}vy();G9();l8();b2();class vu1 extends c0{thread;constructor({thread:J}){super();this.thread=J}createState(){return new bW6}}class bW6 extends d0{scrollOffset=0;maxScrollOffset=0;contentHeight=0;viewportHeight=0;handleKeyEvent=(J)=>{switch(J.key){case"ArrowUp":case"k":return this.scroll(-3),"handled";case"ArrowDown":case"j":return this.scroll(3),"handled";case"Home":return this.scrollToTop(),"handled";case"End":return this.scrollToBottom(),"handled";case"PageUp":return this.scroll(-Math.floor(this.viewportHeight*0.8)),"handled";case"PageDown":return this.scroll(Math.floor(this.viewportHeight*0.8)),"handled";default:return"ignored"}};scroll(J){let Q=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset+J));if(Q!==this.scrollOffset)this.scrollOffset=Q,this.setState(()=>{})}scrollToTop(){if(this.scrollOffset!==0)this.scrollOffset=0,this.setState(()=>{})}scrollToBottom(){if(this.scrollOffset!==this.maxScrollOffset)this.scrollOffset=this.maxScrollOffset,this.setState(()=>{})}updateScrollBounds(J,Q){this.contentHeight=J,this.viewportHeight=Q,this.maxScrollOffset=Math.max(0,J-Q),this.scrollOffset=Math.max(0,Math.min(this.maxScrollOffset,this.scrollOffset))}getScrollbarInfo=()=>{return{totalContentHeight:this.contentHeight,viewportHeight:this.viewportHeight,scrollOffset:this.scrollOffset}};formatTokens(J,Q){let Z=(X)=>{if(X>=1e6)return`${(X/1e6).toFixed(1)}M`;if(X>=1000)return`${(X/1000).toFixed(1)}k`;return X.toString()};return`${Z(J)}/${Z(Q)}`}truncateModel(J,Q){if(J.length<=Q)return J;return J.slice(0,Q-1)+"…"}build(J){let Z=e6.of(J).colorScheme,X=i6.of(J),Y=U30(this.widget.thread),K=W30(Y),G=J.mediaQuery,q=G?Math.floor(G.size.width*0.8):70,z=G?Math.floor(G.size.height*0.8):20,U=K.models.length,W=ZB(K.grandTotal.credits),F=this.formatTokens(K.grandTotal.tokensIn,K.grandTotal.tokensOut),H=`Cost Breakdown • ${W} • ${F} tok • ${U} model${U!==1?"s":""}`,M=[new N1(H+`
|
|
6575
6575
|
|
|
6576
|
-
`,new
|
|
6577
|
-
`,new
|
|
6578
|
-
`,new
|
|
6579
|
-
`,new
|
|
6580
|
-
`,new
|
|
6581
|
-
`,new
|
|
6582
|
-
`,new
|
|
6576
|
+
`,new j1({color:Z.foreground}))];if(K.models.length===0)M.push(new N1(`No cost data available.
|
|
6577
|
+
`,new j1({color:Z.accent})));else{let $=["Model".padEnd(24),"Type".padEnd(16),"Cost".padEnd(10),"Tokens (in/out)"].join(" ");M.push(new N1($+`
|
|
6578
|
+
`,new j1({color:Z.accent,dim:!0})));let E="─".repeat(q-4);M.push(new N1(E+`
|
|
6579
|
+
`,new j1({color:Z.accent})));for(let I=0;I<K.models.length;I++){let T=K.models[I];if(!T)continue;let x=[this.truncateModel(T.model,24).padEnd(24),"Total".padEnd(16),ZB(T.totalCredits).padEnd(10),this.formatTokens(T.totalTokensIn,T.totalTokensOut)].join(" ");M.push(new N1(x+`
|
|
6580
|
+
`,new j1({color:Z.accent})));for(let h of T.rows){let v=[" ·".padEnd(24),h.operationType.padEnd(16),ZB(h.credits).padEnd(10),this.formatTokens(h.tokensIn,h.tokensOut)].join(" ");M.push(new N1(v+`
|
|
6581
|
+
`,new j1({color:Z.foreground,dim:!0})))}if(I<K.models.length-1)M.push(new N1(E+`
|
|
6582
|
+
`,new j1({color:Z.accent})))}}let V=new q9({autofocus:!0,onKey:this.handleKeyEvent,child:new yW6({scrollOffset:this.scrollOffset,onMeasured:(R,O)=>{this.updateScrollBounds(R,O)},child:new n1({text:new N1("",void 0,M)})})}),N=new gR({controller:null,getScrollInfo:this.getScrollbarInfo,thickness:1,thumbColor:X.app.scrollbarThumb,trackColor:X.app.scrollbarTrack}),L=new TJ({children:[new x6({padding:V0.only({left:0,right:1}),child:V}),new wX({right:0,top:0,bottom:0,child:new U0({width:1,child:N})})]}),A=new x6({padding:V0.only({top:1,left:1,right:1,bottom:1}),child:new n1({text:new N1("Esc: close • ↑↓/j k: scroll • Home/End: top/bottom • PgUp/PgDn: page",new j1({color:Z.accent}))})}),w=new i0({children:[new R8({child:L}),A]});return new C9({child:new y0({constraints:new w6(q,q,0,z),decoration:new i8(Z.background,x8.all(new w8(Z.accent,1,"rounded"))),child:new x6({padding:V0.all(1),child:w})})})}}class yW6 extends R4{scrollOffset;onMeasured;constructor({child:J,scrollOffset:Q=0,onMeasured:Z,key:X}){super(X?{child:J,key:X}:{child:J});this.scrollOffset=Q,this.onMeasured=Z}createRenderObject(){return new fW6(this.scrollOffset,this.onMeasured)}updateRenderObject(J){J.updateProperties(this.scrollOffset,this.onMeasured)}}class fW6 extends Z8{_scrollOffset;_onMeasured;constructor(J,Q){super();this._scrollOffset=J,this._onMeasured=Q}updateProperties(J,Q){if(this._scrollOffset!==J)this._scrollOffset=J,this.markNeedsPaint();this._onMeasured=Q}performLayout(){let J=this._lastConstraints;if(m6(!!J,"performLayout called without constraints"),this.children.length===0){this.setSize(J.minWidth,J.minHeight),super.performLayout();return}let Q=this.children[0],Z=new w6(J.minWidth,J.maxWidth,0,Number.POSITIVE_INFINITY);Q.layout(Z);let X=-this._scrollOffset;if(Q.setOffset(0,X),this.setSize(J.maxWidth,J.maxHeight),this._onMeasured)this._onMeasured(Q.size.height,this.size.height);super.performLayout()}paint(J,Q=0,Z=0){for(let X of this.children)if("offset"in X&&"paint"in X){let Y=X,K=new pq(J,Q,Z,this.size.width,this.size.height);X.paint(K,Q,Z)}}}class ku1 extends I6{error;ampURL;onResponse;constructor({key:J,error:Q,ampURL:Z,onResponse:X}){super({key:J});this.error=Q,this.ampURL=Z,this.onResponse=X}build(J){let Z=e6.of(J).colorScheme,X=A51(this.error,this.ampURL),Y=X.options.map((K)=>({value:K,label:uQ6(K)}));return new qB({title:X.title,body:X.description,options:Y,onSelect:(K)=>{this.onResponse(K??"dismiss")},borderColor:Z.destructive,autofocus:!0,showDismissalMessage:!1,enableMouseInteraction:!1})}}G9();l8();var AF9=[{description:"Move cursor up/down",methods:[{keys:["↑"]},{keys:["↓"]}]},{description:"Insert newline",methods:[{keys:["Shift","Enter"]}]},{description:"Clear input",methods:[{keys:["Escape"]}]},{description:"Edit prompt in $EDITOR",methods:[{input:"G",keys:["Ctrl"]}]},{description:"Navigate history (previous/next)",methods:[{input:"P",keys:["Ctrl"]},{input:"N",keys:["Ctrl"]}]},{description:"Jump to start of line",methods:[{keys:["Cmd","←"]},{input:"A",keys:["Ctrl"]}]},{description:"Jump to end of line",methods:[{keys:["Cmd","→"]},{input:"E",keys:["Ctrl"]}]},{description:"Jump to previous word",methods:[{keys:["Alt","←"]}]},{description:"Jump to next word",methods:[{keys:["Alt","→"]}]},{description:"Delete character backward",methods:[{keys:["Backspace"]}]},{description:"Delete word backward",methods:[{keys:["Alt","Backspace"]},{input:"W",keys:["Ctrl"]}]},{description:"Delete character forward",methods:[{keys:["Delete"]}]},{description:"Delete word forward",methods:[{input:"D",keys:["Ctrl"]}]},{description:"Delete to start of line",methods:[{keys:["Cmd","Backspace"]},{input:"U",keys:["Ctrl"]}]},{description:"Delete to end of line",methods:[{input:"K",keys:["Ctrl"]}]},{description:"Yank (paste deleted text)",methods:[{input:"Y",keys:["Ctrl"]}]},{description:"Switch agent mode",methods:[{input:"S",keys:["Ctrl"]}]},{description:"Open command palette",methods:[{input:"O",keys:["Ctrl"]}]}],wF9=[{description:"Page scroll",methods:[{keys:["Pg Up"]},{keys:["Pg Down"]}]},{description:"Mouse wheel scroll",methods:[{keys:["Mouse Wheel"]}]},{description:"Jump to first message",methods:[{keys:["Home"]}]},{description:"Jump to bottom of screen",methods:[{keys:["End"]}]},{description:"Navigate to previous messages",methods:[{keys:["Tab"]},{keys:["Shift","Tab"]}]}],RF9=[{description:"Show this help",methods:[{keys:["help"]}]},{description:"Start new thread",methods:[{keys:["new"]}]},{description:"Continue existing thread",methods:[{keys:["continue"]}]},{description:"Open thread in browser",methods:[{keys:["browser"]}]},{description:"Share thread",methods:[{keys:["share"]}]},{description:"Open editor",methods:[{keys:["editor"]}]},{description:"Set agent mode",methods:[{keys:["mode"]}]},{description:"Draft a new thread based on current thread",methods:[{keys:["handoff"]}]},{description:"Queue message",methods:[{keys:["queue"]}]},{description:"Dequeue messages",methods:[{keys:["dequeue"]}]},{description:"Edit permissions",methods:[{keys:["permissions"]}]},{description:"Open CLI settings file in $EDITOR",methods:[{keys:["settings"]}]},{description:"Generate an AGENTS.md file",methods:[{keys:["generate agent file"]}]},{description:"List AGENTS.md guidance files in use",methods:[{keys:["agent files"]}]},{description:"Connect to an IDE",methods:[{keys:["ide"]}]},{description:"Exit application",methods:[{keys:["quit"]}]}];class _u1 extends c0{constructor({key:J}={}){super(J?{key:J}:{})}createState(){return new hW6}}class hW6 extends d0{scrollController;initState(){this.scrollController=new jY,this.scrollController.disableFollowMode(),this.scrollController.jumpTo(0)}dispose(){}build(J){let Z=e6.of(J).colorScheme,Y=i6.of(J).app,K=_8.of(J),G=new j1({color:Z.primary,bold:!0}),q=new j1({color:Z.secondary,bold:!0}),z=new j1({color:Y.keybind}),U=new j1({color:Y.command}),W=new j1({color:Z.foreground}),F=new j1({color:Z.foreground}),H=new j1({color:Z.foreground}),B=K.size.width,M=K.size.height,V=B-4,N=M-4,L=Math.min(80,V),A=new $Y({autofocus:!0,controller:this.scrollController,child:new x6({padding:V0.only({left:2}),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new C9({child:new n1({text:new N1(`Amp CLI - Help & Keyboard Shortcuts
|
|
6583
6583
|
`,G)})}),new U0({height:1}),new n1({text:new N1(`Editor Shortcuts
|
|
6584
6584
|
`,q)}),...this.buildPrettyHelpSection(AF9,z,W,F),new U0({height:1}),new n1({text:new N1(`Scrolling & Navigation
|
|
6585
|
-
`,q)}),...this.buildPrettyHelpSection(wF9,z,W,F),new U0({height:1}),new n1({text:new N1(`
|
|
6585
|
+
`,q)}),...this.buildPrettyHelpSection(wF9,z,W,F),new U0({height:1}),new n1({text:new N1(`Command Palette Commands
|
|
6586
6586
|
`,q)}),...this.buildPrettyHelpSection(RF9,U,W,F),new U0({height:1})]})})}),w=new C9({child:new n1({text:new N1("",H,[new N1("Press ",H),new N1("Escape",z),new N1(" to close • Use ",H),new N1("↑↓",z),new N1(" or ",H),new N1("j/k",z),new N1(" to scroll",H)])})}),R=new i0({crossAxisAlignment:"stretch",children:[new R8({child:A}),w]});return new C9({child:new y0({constraints:new w6(L,L,0,N),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:R})})}buildPrettyHelpSection(J,Q,Z,X){let Y=[],K=30;for(let G of J){let q=[],z=[];for(let F of G.methods){let H=this.buildCleanKeyCombination(F);z.push(H)}let W=z.join(", ").padEnd(30," ");q.push(new N1(" ",Z)),q.push(new N1(W,Q)),q.push(new N1(" ",Z)),q.push(new N1(G.description,Z)),q.push(new N1(`
|
|
6587
|
-
`,Z)),Y.push(new n1({text:new N1("",Z,q)}))}return Y}buildCleanKeyCombination(J){let{keys:Q,input:Z}=J,X=[];if(X.push(...Q),Z)X.push(Z);return X.join("+")}}G0();D3();hv();import{homedir as OF9}from"os";import jF9 from"path";G9();l8();class Yd extends c0{options;onSelect;onChange;title;body;border;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;maxVisibleItems;scrollBuffer;constructor({key:J,options:Q,onSelect:Z,onChange:X,title:Y,body:K,border:G=x8.all(new w8(E1.index(8),1,"rounded")),selectedIndex:q=0,autofocus:z=!0,showDismissalMessage:U=!0,enableMouseInteraction:W=!0,maxVisibleItems:F=20,scrollBuffer:H=3}){super({key:J});this.options=Q,this.onSelect=Z,this.onChange=X,this.title=Y,this.body=K,this.border=G,this.selectedIndex=Math.max(0,Math.min(q,Q.length-1)),this.autofocus=z,this.showDismissalMessage=U,this.enableMouseInteraction=W,this.maxVisibleItems=F,this.scrollBuffer=H}createState(){return new gW6}}class gW6 extends d0{selectedIndex=0;focusNode=new Q9({});scrollOffset=0;initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this)),this.updateScrollPosition()}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}handleMouseScroll(J){if(J.direction==="down")this.moveSelection(1);else this.moveSelection(-1)}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;Q=Math.max(0,Math.min(Q,this.widget.options.length-1));let Z=Q,X=0;while(X<this.widget.options.length){let Y=this.widget.options[Q];if(Y&&(Y.enabled??!0))break;if(Q=Q+Math.sign(J),Q<0||Q>=this.widget.options.length){Q=Z;break}X++}if(this.selectedIndex!==Q)this.setState(()=>{if(this.selectedIndex=Q,this.updateScrollPosition(),this.widget.onChange){let Y=this.widget.options[Q];if(Y)this.widget.onChange(Q,Y)}})}updateScrollPosition(){let J=this.widget.maxVisibleItems,Q=this.widget.scrollBuffer,Z=this.selectedIndex,X=Z-this.scrollOffset,Y=this.scrollOffset;if(X>=J-Q)Y=Math.max(0,Z-(J-Q-1));if(X<Q)Y=Math.max(0,Z-Q);let K=Math.max(0,this.widget.options.length-J);if(Y=Math.min(Y,K),Y!==this.scrollOffset)this.scrollOffset=Y}build(J){if(this.widget.options.length===0)return new U0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new n1({text:new N1(this.widget.title,new $1({bold:!0}))})),Q.push(new U0({height:1}));if(this.widget.body){if(typeof this.widget.body==="string")Q.push(new n1({text:new N1(this.widget.body)}));else Q.push(this.widget.body);Q.push(new U0({height:1}))}let Z=this.scrollOffset,X=Math.min(this.widget.options.length,Z+this.widget.maxVisibleItems);for(let G=Z;G<X;G++){let q=this.widget.options[G],z=G===this.selectedIndex,U=q.enabled??!0,W=new WQ1({title:q.label,subtitle:q.description,selected:z,enabled:U,onTap:U&&this.widget.enableMouseInteraction?()=>this.widget.onSelect(q.value):void 0});Q.push(W)}if(this.widget.showDismissalMessage)Q.push(new U0({height:1})),Q.push(new n1({text:new N1("Escape to close",new $1({color:E1.index(8)}))}));let Y=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:Q}),K=new y0({child:new x6({padding:new V0(1,0,1,0),child:Y}),decoration:new i8(void 0,this.widget.border!=null?this.widget.border:void 0)});return new q9({focusNode:this.focusNode,autofocus:this.widget.autofocus,child:new x9({onScroll:this.handleMouseScroll.bind(this),opaque:!1,child:K})})}}class xu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new mW6}}class mW6 extends d0{options=[];error=null;initialSelectedIndex=0;initState(){try{this.error=null;let J=gB({includeAll:!0,jetbrainsOnly:this.widget.props.jetbrainsMode});this.options=J.map((Q,Z)=>{let X=Q.workspaceFolders[0]??"Unknown project",Y=X=="/"?"Any file":this.toHomeRelative(X),K=Q.pid===S7.getSelectedConfig()?.pid,G=K?`${Q.ideName} (connected)`:Q.ideName;if(K)this.initialSelectedIndex=Z;return{value:{config:Q},label:G,description:Y}})}catch(J){u.error("Failed to load IDE configurations:",J),this.error="Failed to load IDE configurations"}finally{this.setState()}}toHomeRelative(J){let Q=OF9();if(J===Q)return"~";if(J.startsWith(Q+jF9.sep))return"~"+J.slice(Q.length);return J}handleKeyEvent=(J)=>{if(J.key==="Escape"||J.key==="c"&&J.ctrlKey)return this.widget.props.onCancel(),"handled";return"ignored"};build(J){if(this.error)return this.buildErrorBox(this.error,J);return this.buildSelectionBox(J)}buildErrorBox(J,Q){let X=e6.of(Q).colorScheme,Y=_8.of(Q),K=new $1({color:X.primary,bold:!0}),G=new $1({color:X.foreground}),q=new $1({color:X.secondary}),z=new $1({color:E1.yellow}),U=Y.size.width,W=Y.size.height,F=U-4,H=W-4,B=Math.min(60,F),M=new q9({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new C9({child:new n1({text:new N1("No IDEs available",K)})}),new U0({height:1}),new n1({text:new N1(J,G)}),new U0({height:1}),new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new NQ({uri:"https://ampcode.com/manual#ide",text:"https://ampcode.com/manual#ide",style:q})]}),new U0({height:2}),new C9({child:new n1({text:new N1("",G,[new N1("Press ",G),new N1("Escape",z),new N1(" or ",G),new N1("Ctrl+C",z),new N1(" to close",G)])})})]})})});return new C9({child:new y0({constraints:new w6(B,B,0,H),decoration:new i8(X.background,x8.all(new w8(X.primary,1,"rounded"))),child:M})})}buildSelectionBox(J){let Z=e6.of(J).colorScheme,X=_8.of(J),Y=new $1({color:Z.primary,bold:!0}),K=new $1({color:Z.foreground}),G=new $1({color:E1.yellow}),q=new $1({color:Z.secondary}),z=X.size.width,U=X.size.height,W=z-4,F=U-4,H=Math.min(60,W),B=Math.min(F-4,U-8),M=Math.floor(Math.max(1,B/2)),V=this.options.length>0,N=[new C9({child:new n1({text:new N1(V?"Connect Amp CLI to an IDE":"No IDEs available",Y)})}),new U0({height:1})];if(V)N.push(new Yd({options:this.options,onSelect:(A)=>{if(A)this.widget.props.onSelect(A.config,"user-initiated");else this.widget.props.onCancel()},border:null,maxVisibleItems:M,autofocus:this.widget.props.autofocus??!0,showDismissalMessage:!1,selectedIndex:this.initialSelectedIndex}));else{let A=this.widget.props.jetbrainsMode?"No JetBrains IDE configurations found. Make sure you have a JetBrains IDE with the Amp plugin running.":"No IDE configurations found. Make sure you have an IDE with the Amp plugin running.";N.push(new n1({text:new N1(A,K)}),new U0({height:1}),new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new NQ({uri:"https://ampcode.com/manual#ide",text:"https://ampcode.com/manual#ide",style:q})]}))}N.push(new U0({height:2}),new C9({child:new n1({text:new N1("",K,[new N1("Press ",K),new N1("Escape",G),new N1(" or ",K),new N1("Ctrl+C",G),new N1(" to close",K)])})}));let L=new q9({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:N})})});return new C9({child:new y0({constraints:new w6(H,H,0,F),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:L})})}}DW();G0();import{createHash as QH9}from"node:crypto";import{createWriteStream as ZH9,existsSync as vQ1,readdirSync as XH9,readFileSync as YH9}from"node:fs";import{copyFile as KH9,mkdir as GH9,readFile as qH9,rename as zH9,unlink as UH9}from"node:fs/promises";import{homedir as eW6,platform as lu1}from"node:os";import $N from"node:path";import{Readable as WH9}from"node:stream";import{pipeline as FH9}from"node:stream/promises";import{createWriteStream as nF9,existsSync as aF9,mkdirSync as rF9,readdirSync as sF9,rmSync as oF9}from"node:fs";import{writeFile as tF9}from"node:fs/promises";import qd from"node:path";import{pipeline as eF9}from"node:stream/promises";var mu1=a1("fs"),xF9=a1("zlib"),bF9=iW6(),yF9=rW6(),PQ1=a1("util"),TQ1=a1("events").EventEmitter,sW6=a1("stream").Transform,pu1=a1("stream").PassThrough,fF9=a1("stream").Writable;var du1=hF9;function hF9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=IQ1;mu1.open(J,"r",function(X,Y){if(X)return Z(X);gF9(Y,Q,function(K,G){if(K)mu1.close(Y,IQ1);Z(K,G)})})}function gF9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=IQ1;mu1.fstat(J,function(X,Y){if(X)return Z(X);var K=bF9.createFromFd(J,{autoClose:!0});mF9(K,Y.size,Q,Z)})}function mF9(J,Q,Z,X){if(typeof Z==="function")X=Z,Z=null;if(Z==null)Z={};if(Z.autoClose==null)Z.autoClose=!0;if(Z.lazyEntries==null)Z.lazyEntries=!1;if(Z.decodeStrings==null)Z.decodeStrings=!0;var Y=!!Z.decodeStrings;if(Z.validateEntrySizes==null)Z.validateEntrySizes=!0;if(Z.strictFileNames==null)Z.strictFileNames=!1;if(X==null)X=IQ1;if(typeof Q!=="number")throw Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");J.ref();var K=22,G=20,q=65535,z=Math.min(G+K+q,Q),U=FB(z),W=Q-U.length;QS(J,U,0,z,W,function(F){if(F)return X(F);for(var H=z-K;H>=0;H-=1){if(U.readUInt32LE(H)!==101010256)continue;var B=U.subarray(H),M=B.readUInt16LE(4),V=B.readUInt16LE(10),N=B.readUInt32LE(16),L=B.readUInt16LE(20),A=B.length-K;if(L!==A)return X(Error("Invalid comment length. Expected: "+A+". Found: "+L+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var w=Y?EQ1(B.subarray(22),!1):B.subarray(22);if(H-G>=0&&U.readUInt32LE(H-G)===117853008){var R=U.subarray(H-G,H-G+G),O=JS(R,8),j=FB(56);return QS(J,j,0,j.length,O,function($){if($)return X($);if(j.readUInt32LE(0)!==101075792)return X(Error("invalid zip64 end of central directory record signature"));if(M=j.readUInt32LE(16),M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return V=JS(j,32),N=JS(j,48),X(null,new WB(J,N,Q,V,w,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))})}if(M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return X(null,new WB(J,N,Q,V,w,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))}X(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}PQ1.inherits(WB,TQ1);function WB(J,Q,Z,X,Y,K,G,q,z,U){var W=this;if(TQ1.call(W),W.reader=J,W.reader.on("error",function(F){oW6(W,F)}),W.reader.once("close",function(){W.emit("close")}),W.readEntryCursor=Q,W.fileSize=Z,W.entryCount=X,W.comment=Y,W.entriesRead=0,W.autoClose=!!K,W.lazyEntries=!!G,W.decodeStrings=!!q,W.validateEntrySizes=!!z,W.strictFileNames=!!U,W.isOpen=!0,W.emittedError=!1,!W.lazyEntries)W._readEntry()}WB.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function WW(J,Q){if(J.autoClose)J.close();oW6(J,Q)}function oW6(J,Q){if(J.emittedError)return;J.emittedError=!0,J.emit("error",Q)}WB.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};WB.prototype._readEntry=function(){var J=this;if(J.entryCount===J.entriesRead){setImmediate(function(){if(J.autoClose)J.close();if(J.emittedError)return;J.emit("end")});return}if(J.emittedError)return;var Q=FB(46);QS(J.reader,Q,0,Q.length,J.readEntryCursor,function(Z){if(Z)return WW(J,Z);if(J.emittedError)return;var X=new CQ1,Y=Q.readUInt32LE(0);if(Y!==33639248)return WW(J,Error("invalid central directory file header signature: 0x"+Y.toString(16)));if(X.versionMadeBy=Q.readUInt16LE(4),X.versionNeededToExtract=Q.readUInt16LE(6),X.generalPurposeBitFlag=Q.readUInt16LE(8),X.compressionMethod=Q.readUInt16LE(10),X.lastModFileTime=Q.readUInt16LE(12),X.lastModFileDate=Q.readUInt16LE(14),X.crc32=Q.readUInt32LE(16),X.compressedSize=Q.readUInt32LE(20),X.uncompressedSize=Q.readUInt32LE(24),X.fileNameLength=Q.readUInt16LE(28),X.extraFieldLength=Q.readUInt16LE(30),X.fileCommentLength=Q.readUInt16LE(32),X.internalFileAttributes=Q.readUInt16LE(36),X.externalFileAttributes=Q.readUInt32LE(38),X.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),X.generalPurposeBitFlag&64)return WW(J,Error("strong encryption is not supported"));J.readEntryCursor+=46,Q=FB(X.fileNameLength+X.extraFieldLength+X.fileCommentLength),QS(J.reader,Q,0,Q.length,J.readEntryCursor,function(K){if(K)return WW(J,K);if(J.emittedError)return;X.fileNameRaw=Q.subarray(0,X.fileNameLength);var G=X.fileNameLength+X.extraFieldLength;X.extraFieldRaw=Q.subarray(X.fileNameLength,G),X.fileCommentRaw=Q.subarray(G,G+X.fileCommentLength);try{X.extraFields=lF9(X.extraFieldRaw)}catch(V){return WW(J,V)}if(J.decodeStrings){var q=(X.generalPurposeBitFlag&2048)!==0;X.fileComment=EQ1(X.fileCommentRaw,q),X.fileName=dF9(X.generalPurposeBitFlag,X.fileNameRaw,X.extraFields,J.strictFileNames);var z=cF9(X.fileName);if(z!=null)return WW(J,Error(z))}else X.fileComment=X.fileCommentRaw,X.fileName=X.fileNameRaw;X.comment=X.fileComment,J.readEntryCursor+=Q.length,J.entriesRead+=1;for(var U=0;U<X.extraFields.length;U++){var W=X.extraFields[U];if(W.id!==1)continue;var F=W.data,H=0;if(X.uncompressedSize===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include uncompressed size"));X.uncompressedSize=JS(F,H),H+=8}if(X.compressedSize===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include compressed size"));X.compressedSize=JS(F,H),H+=8}if(X.relativeOffsetOfLocalHeader===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include relative header offset"));X.relativeOffsetOfLocalHeader=JS(F,H),H+=8}break}if(J.validateEntrySizes&&X.compressionMethod===0){var B=X.uncompressedSize;if(X.isEncrypted())B+=12;if(X.compressedSize!==B){var M="compressed/uncompressed size mismatch for stored file: "+X.compressedSize+" != "+X.uncompressedSize;return WW(J,Error(M))}}if(J.emit("entry",X),!J.lazyEntries)J._readEntry()})})};WB.prototype.openReadStream=function(J,Q,Z){var X=this,Y=0,K=J.compressedSize;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!J.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw Error("invalid options.decrypt value: "+Q.decrypt);if(J.isCompressed()){if(Q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!J.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(J.isCompressed()&&Q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(J.isEncrypted()&&Q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(Y=Q.start,Y<0)throw Error("options.start < 0");if(Y>J.compressedSize)throw Error("options.start > entry.compressedSize")}if(Q.end!=null){if(K=Q.end,K<0)throw Error("options.end < 0");if(K>J.compressedSize)throw Error("options.end > entry.compressedSize");if(K<Y)throw Error("options.end < options.start")}}if(!X.isOpen)return Z(Error("closed"));if(J.isEncrypted()){if(Q.decrypt!==!1)return Z(Error("entry is encrypted, and options.decrypt !== false"))}var G;if(J.compressionMethod===0)G=!1;else if(J.compressionMethod===8)G=Q.decompress!=null?Q.decompress:!0;else return Z(Error("unsupported compression method: "+J.compressionMethod));X.readLocalFileHeader(J,{minimal:!0},function(q,z){if(q)return Z(q);X.openReadStreamLowLevel(z.fileDataStart,J.compressedSize,Y,K,G,J.uncompressedSize,Z)})};WB.prototype.openReadStreamLowLevel=function(J,Q,Z,X,Y,K,G){var q=this,z=J+Q,U=q.reader.createReadStream({start:J+Z,end:J+X}),W=U;if(Y){var F=!1,H=xF9.createInflateRaw();if(U.on("error",function(B){setImmediate(function(){if(!F)H.emit("error",B)})}),U.pipe(H),q.validateEntrySizes)W=new Gd(K),H.on("error",function(B){setImmediate(function(){if(!F)W.emit("error",B)})}),H.pipe(W);else W=H;uu1(W,function(){if(F=!0,H!==W)H.unpipe(W);U.unpipe(H),U.destroy()})}G(null,W)};WB.prototype.readLocalFileHeader=function(J,Q,Z){var X=this;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};X.reader.ref();var Y=FB(30);QS(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader,function(K){try{if(K)return Z(K);var G=Y.readUInt32LE(0);if(G!==67324752)return Z(Error("invalid local file header signature: 0x"+G.toString(16)));var q=Y.readUInt16LE(26),z=Y.readUInt16LE(28),U=J.relativeOffsetOfLocalHeader+30+q+z;if(U+J.compressedSize>X.fileSize)return Z(Error("file data overflows file bounds: "+U+" + "+J.compressedSize+" > "+X.fileSize));if(Q.minimal)return Z(null,{fileDataStart:U});var W=new uF9;W.fileDataStart=U,W.versionNeededToExtract=Y.readUInt16LE(4),W.generalPurposeBitFlag=Y.readUInt16LE(6),W.compressionMethod=Y.readUInt16LE(8),W.lastModFileTime=Y.readUInt16LE(10),W.lastModFileDate=Y.readUInt16LE(12),W.crc32=Y.readUInt32LE(14),W.compressedSize=Y.readUInt32LE(18),W.uncompressedSize=Y.readUInt32LE(22),W.fileNameLength=q,W.extraFieldLength=z,Y=FB(q+z),X.reader.ref(),QS(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader+30,function(F){try{if(F)return Z(F);return W.fileName=Y.subarray(0,q),W.extraField=Y.subarray(q),Z(null,W)}finally{X.reader.unref()}})}finally{X.reader.unref()}})};function CQ1(){}CQ1.prototype.getLastModDate=function(J){if(J==null)J={};if(!J.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var Z=this.extraFields[Q];if(Z.id===21589){var X=Z.data;if(X.length<5)continue;var Y=X[0],K=1;if(!(Y&K))continue;var G=X.readInt32LE(1);return new Date(G*1000)}else if(Z.id===10){var X=Z.data,q=4;while(q<X.length+4){var z=X.readUInt16LE(q);q+=2;var U=X.readUInt16LE(q);if(q+=2,z!==1){q+=U;continue}if(U<8||q+U>X.length)break;var W=4294967296*X.readInt32LE(q+4)+X.readUInt32LE(q),F=W/1e4-11644473600000;return new Date(F)}}}return pF9(this.lastModFileDate,this.lastModFileTime,J.timezone)};CQ1.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};CQ1.prototype.isCompressed=function(){return this.compressionMethod===8};function uF9(){}function pF9(J,Q,Z){var X=J&31,Y=(J>>5&15)-1,K=(J>>9&127)+1980,G=0,q=(Q&31)*2,z=Q>>5&63,U=Q>>11&31;if(Z==null||Z==="local")return new Date(K,Y,X,U,z,q,G);else if(Z==="UTC")return new Date(Date.UTC(K,Y,X,U,z,q,G));else throw Error("unrecognized options.timezone: "+options.timezone)}function dF9(J,Q,Z,X){var Y=null;for(var K=0;K<Z.length;K++){var G=Z[K];if(G.id===28789){if(G.data.length<6)continue;if(G.data.readUInt8(0)!==1)continue;var q=G.data.readUInt32LE(1);if(yF9.unsigned(Q)!==q)continue;Y=EQ1(G.data.subarray(5),!0);break}}if(Y==null){var z=(J&2048)!==0;Y=EQ1(Q,z)}if(!X)Y=Y.replace(/\\/g,"/");return Y}function cF9(J){if(J.indexOf("\\")!==-1)return"invalid characters in fileName: "+J;if(/^[a-zA-Z]:/.test(J)||/^\//.test(J))return"absolute path: "+J;if(J.split("/").indexOf("..")!==-1)return"invalid relative path: "+J;return null}function lF9(J){var Q=[],Z=0;while(Z<J.length-3){var X=J.readUInt16LE(Z+0),Y=J.readUInt16LE(Z+2),K=Z+4,G=K+Y;if(G>J.length)throw Error("extra field length exceeds extra field buffer size");var q=J.subarray(K,G);Q.push({id:X,data:q}),Z=G}return Q}function QS(J,Q,Z,X,Y,K){if(X===0)return setImmediate(function(){K(null,FB(0))});J.read(Q,Z,X,Y,function(G,q){if(G)return K(G);if(q<X)return K(Error("unexpected EOF"));K()})}PQ1.inherits(Gd,sW6);function Gd(J){sW6.call(this),this.actualByteCount=0,this.expectedByteCount=J}Gd.prototype._transform=function(J,Q,Z){if(this.actualByteCount+=J.length,this.actualByteCount>this.expectedByteCount){var X="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return Z(Error(X))}Z(null,J)};Gd.prototype._flush=function(J){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return J(Error(Q))}J()};PQ1.inherits(pR,TQ1);function pR(){TQ1.call(this),this.refCount=0}pR.prototype.ref=function(){this.refCount+=1};pR.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");J.close(Q);function Q(Z){if(Z)return J.emit("error",Z);J.emit("close")}};pR.prototype.createReadStream=function(J){if(J==null)J={};var{start:Q,end:Z}=J;if(Q===Z){var X=new pu1;return setImmediate(function(){X.end()}),X}var Y=this._readStreamForRange(Q,Z),K=!1,G=new SQ1(this);Y.on("error",function(z){setImmediate(function(){if(!K)G.emit("error",z)})}),uu1(G,function(){Y.unpipe(G),G.unref(),Y.destroy()});var q=new Gd(Z-Q);return G.on("error",function(z){setImmediate(function(){if(!K)q.emit("error",z)})}),uu1(q,function(){K=!0,G.unpipe(q),G.destroy()}),Y.pipe(G).pipe(q)};pR.prototype._readStreamForRange=function(J,Q){throw Error("not implemented")};pR.prototype.read=function(J,Q,Z,X,Y){var K=this.createReadStream({start:X,end:X+Z}),G=new fF9,q=0;G._write=function(z,U,W){z.copy(J,Q+q,0,z.length),q+=z.length,W()},G.on("finish",Y),K.on("error",function(z){Y(z)}),K.pipe(G)};pR.prototype.close=function(J){setImmediate(J)};PQ1.inherits(SQ1,pu1);function SQ1(J){pu1.call(this),this.context=J,this.context.ref(),this.unreffedYet=!1}SQ1.prototype._flush=function(J){this.unref(),J()};SQ1.prototype.unref=function(J){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var iF9="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function EQ1(J,Q){if(Q)return J.toString("utf8");else{var Z="";for(var X=0;X<J.length;X++)Z+=iF9[J[X]];return Z}}function JS(J,Q){var Z=J.readUInt32LE(Q),X=J.readUInt32LE(Q+4);return X*4294967296+Z}var FB;if(typeof Buffer.allocUnsafe==="function")FB=function(J){return Buffer.allocUnsafe(J)};else FB=function(J){return new Buffer(J)};function uu1(J,Q){if(typeof J.destroy==="function")J._destroy=function(Z,X){if(Q(),X!=null)X(Z)};else J.destroy=Q}function IQ1(J){if(J)throw J}G0();async function tW6(J,Q,Z,X=JH9){u.debug("jetbrains-plugin-install",{pluginDirectory:J});let Y=qd.join(J,"lib");if(aF9(Y)){let G=sF9(Y,{withFileTypes:!0}).filter((q)=>q.name.endsWith(".jar"));u.info("jetbrains-plugin-install",{libDirectory:Y,removableJarFiles:G.map((q)=>q.name)}),G.forEach((q)=>{oF9(qd.join(q.parentPath,q.name))})}rF9(Y,{recursive:!0});let K=qd.join(J,"version.txt");return await tF9(K,Z,"utf8"),X(Q,Y)}function JH9(J,Q){return new Promise((Z,X)=>{du1(J,{lazyEntries:!0},(Y,K)=>{if(Y)return X(Y);if(!K)return X(Error("Failed to open ZIP file"));K.readEntry(),K.on("entry",(G)=>{if(G.fileName.startsWith("amp-jetbrains-plugin/lib/"))K.openReadStream(G,async(q,z)=>{if(q)return X(q);if(!z)return X(Error("Failed to open read stream"));let U=qd.basename(G.fileName),W=qd.join(Q,U);await eF9(z,nF9(W)),K.readEntry()});else K.readEntry()}),K.on("end",Z),K.on("error",X)})})}var ZF6="amp-jetbrains-plugin",JF6="https://storage.googleapis.com/amp-public-assets-prod-0/jetbrains/latest.json",zd=null;async function cu1(J,Q=3){for(let Z=1;Z<=Q;Z++)try{let X=await fetch(J);if(!X.ok)throw Error(`HTTP ${X.status}: ${X.statusText} for ${J}`);return X}catch(X){let Y=X instanceof Error?X.message:String(X);if(X instanceof Error&&X.message.match(/HTTP 4\d\d:/))throw X;if(Z===Q)throw X;let K=500*Math.pow(2,Z-1);u.warn("fetchWithRetry",{url:J,attempt:Z,maxRetries:Q,message:Y,retryingInMs:K}),await new Promise((G)=>setTimeout(G,K))}throw Error("Unexpected end of retry loop")}async function XF6(){if(zd)return u.debug("jetbrains-plugin-version",{message:"Using cached version info",cachedVersionInfo:zd}),zd;return u.debug("jetbrains-plugin-version",{message:"Fetching version info",url:JF6}),zd=await(await cu1(JF6)).json(),zd}async function iu1(){return(await XF6()).plugin_version}async function YF6(){let J=await iu1();return`${ZF6}-${J}.zip`}function HH9(){let J=lu1();return u.debug("jetbrains-plugin-discovery",{os:J}),["darwin","win32"].includes(J)}function BH9(J,Q){if(!J?.pluginVersion)return"unknown";return J?.pluginVersion===Q?"uptodate":"outdated"}function KF6(J,Q){if(u.debug("jetbrains-plugin-discovery",{ideStatus:J}),HH9()){let X=MH9();if(u.debug("jetbrains-plugin-discovery",{discoveryResult:X}),!X.success)return X;let Y=X.products.map((K)=>{let G=QF6(K.pluginDirectory,Q);return{...K,installType:G.installType,installedVersion:G.installedVersion}}).filter((K)=>QF6(K.pluginDirectory,Q).needsInstall);return u.debug("jetbrains-plugin-discovery",{installationTargets:Y}),{success:!0,products:Y}}let Z=BH9(J,Q);if(u.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Z}),Z==="outdated"&&J?.pluginDirectory&&J?.ideName)return{success:!0,products:[{name:J.ideName,version:"",pluginDirectory:J.pluginDirectory,installType:"upgrade",installedVersion:J.pluginVersion}]};if(Z==="uptodate")return{success:!0,products:[]};return{success:!0,requiresManualInstall:!0,products:[]}}async function GF6(J,Q,Z){u.debug("jetbrains-plugin-install",{message:"Starting plugin installation",targetCount:J.length,targets:J.map((Y)=>`${Y.name} ${Y.version}`),cacheDirectory:Q});let X=await _Q1(Q);for(let Y of J)try{u.debug("jetbrains-plugin-install:start",{product:Y}),await tW6(Y.pluginDirectory,X,Z),u.debug("jetbrains-plugin-install:complete",{product:Y})}catch(K){throw u.error("jetbrains-plugin-install",{product:Y,error:K}),Error(`Failed to install JetBrains plugin to ${Y.name} ${Y.version}: ${K}`)}u.info("jetbrains-plugin-install",{message:"All plugin installations completed successfully",installedCount:J.length})}function kQ1(J){let Q=lu1(),Z;switch(Q){case"darwin":Z=$N.join(eW6(),"Library","Application Support",J);break;case"win32":{let X=process.env.APPDATA||$N.join(eW6(),"AppData","Roaming");Z=$N.join(X,J);break}default:throw Error(`Unsupported operating system: ${Q}`)}return Z}function DH9(){let J=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[kQ1("JetBrains"),kQ1("Google")].flatMap((Q)=>{if(!vQ1(Q))return[];return XH9(Q,{withFileTypes:!0})}).filter((Q)=>{if(!Q.isDirectory())return!1;return!J.find((Z)=>Q.name.startsWith(Z))})}function MH9(){try{let J=DH9();if(J.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};u.debug("jetbrains-plugin-discovery",{productDirectories:J});let Q=[];for(let Z of J){let{productName:X,version:Y}=NH9(Z.name);if(["2020","2021","2022","2023","unknown"].find((K)=>Y.startsWith(K))){u.debug("jetbrains-plugin-discovery",{skipped:Z.name});continue}Q.push({name:X,version:Y,pluginDirectory:$N.join(Z.parentPath,Z.name,"plugins",ZF6)})}return{success:!0,products:Q.sort((Z,X)=>{return Z.name.localeCompare(X.name)||Z.version.localeCompare(X.version)})}}catch(J){u.error("jetbrains-plugin-discovery",{error:J});let Q=lu1(),X=`Failed to access JetBrains directory at: ${[kQ1("JetBrains"),kQ1("Google")].join(", ")}
|
|
6587
|
+
`,Z)),Y.push(new n1({text:new N1("",Z,q)}))}return Y}buildCleanKeyCombination(J){let{keys:Q,input:Z}=J,X=[];if(X.push(...Q),Z)X.push(Z);return X.join("+")}}G0();D3();hv();import{homedir as OF9}from"os";import jF9 from"path";G9();l8();class Yd extends c0{options;onSelect;onChange;title;body;border;selectedIndex;autofocus;showDismissalMessage;enableMouseInteraction;maxVisibleItems;scrollBuffer;constructor({key:J,options:Q,onSelect:Z,onChange:X,title:Y,body:K,border:G=x8.all(new w8(E1.index(8),1,"rounded")),selectedIndex:q=0,autofocus:z=!0,showDismissalMessage:U=!0,enableMouseInteraction:W=!0,maxVisibleItems:F=20,scrollBuffer:H=3}){super({key:J});this.options=Q,this.onSelect=Z,this.onChange=X,this.title=Y,this.body=K,this.border=G,this.selectedIndex=Math.max(0,Math.min(q,Q.length-1)),this.autofocus=z,this.showDismissalMessage=U,this.enableMouseInteraction=W,this.maxVisibleItems=F,this.scrollBuffer=H}createState(){return new gW6}}class gW6 extends d0{selectedIndex=0;focusNode=new Q9({});scrollOffset=0;initState(){super.initState(),this.selectedIndex=this.widget.selectedIndex,this.focusNode.addKeyHandler(this.handleKeyEvent.bind(this)),this.updateScrollPosition()}dispose(){this.focusNode.dispose(),super.dispose()}handleKeyEvent(J){let Q=(Z,X)=>{return J.key===Z&&J.shiftKey===(X?.shift??!1)&&J.ctrlKey===(X?.ctrl??!1)&&J.altKey===(X?.alt??!1)&&J.metaKey===(X?.meta??!1)};if(Q("ArrowDown")||Q("n",{ctrl:!0})||Q("Tab")||Q("j"))return this.moveSelection(1),"handled";if(Q("ArrowUp")||Q("p",{ctrl:!0})||Q("Tab",{shift:!0})||Q("k"))return this.moveSelection(-1),"handled";if(Q("Enter")){let Z=this.widget.options[this.selectedIndex];if(Z&&(Z.enabled??!0))this.widget.onSelect(Z.value);return"handled"}if(Q("Escape"))return this.widget.onSelect(null),"handled";return"ignored"}handleMouseScroll(J){if(J.direction==="down")this.moveSelection(1);else this.moveSelection(-1)}moveSelection(J){if(this.widget.options.length===0)return;let Q=this.selectedIndex+J;Q=Math.max(0,Math.min(Q,this.widget.options.length-1));let Z=Q,X=0;while(X<this.widget.options.length){let Y=this.widget.options[Q];if(Y&&(Y.enabled??!0))break;if(Q=Q+Math.sign(J),Q<0||Q>=this.widget.options.length){Q=Z;break}X++}if(this.selectedIndex!==Q)this.setState(()=>{if(this.selectedIndex=Q,this.updateScrollPosition(),this.widget.onChange){let Y=this.widget.options[Q];if(Y)this.widget.onChange(Q,Y)}})}updateScrollPosition(){let J=this.widget.maxVisibleItems,Q=this.widget.scrollBuffer,Z=this.selectedIndex,X=Z-this.scrollOffset,Y=this.scrollOffset;if(X>=J-Q)Y=Math.max(0,Z-(J-Q-1));if(X<Q)Y=Math.max(0,Z-Q);let K=Math.max(0,this.widget.options.length-J);if(Y=Math.min(Y,K),Y!==this.scrollOffset)this.scrollOffset=Y}build(J){if(this.widget.options.length===0)return new U0({width:0,height:0});let Q=[];if(this.widget.title)Q.push(new n1({text:new N1(this.widget.title,new j1({bold:!0}))})),Q.push(new U0({height:1}));if(this.widget.body){if(typeof this.widget.body==="string")Q.push(new n1({text:new N1(this.widget.body)}));else Q.push(this.widget.body);Q.push(new U0({height:1}))}let Z=this.scrollOffset,X=Math.min(this.widget.options.length,Z+this.widget.maxVisibleItems);for(let G=Z;G<X;G++){let q=this.widget.options[G],z=G===this.selectedIndex,U=q.enabled??!0,W=new WQ1({title:q.label,subtitle:q.description,selected:z,enabled:U,onTap:U&&this.widget.enableMouseInteraction?()=>this.widget.onSelect(q.value):void 0});Q.push(W)}if(this.widget.showDismissalMessage)Q.push(new U0({height:1})),Q.push(new n1({text:new N1("Escape to close",new j1({color:E1.index(8)}))}));let Y=new i0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:Q}),K=new y0({child:new x6({padding:new V0(1,0,1,0),child:Y}),decoration:new i8(void 0,this.widget.border!=null?this.widget.border:void 0)});return new q9({focusNode:this.focusNode,autofocus:this.widget.autofocus,child:new x9({onScroll:this.handleMouseScroll.bind(this),opaque:!1,child:K})})}}class xu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new mW6}}class mW6 extends d0{options=[];error=null;initialSelectedIndex=0;initState(){try{this.error=null;let J=gB({includeAll:!0,jetbrainsOnly:this.widget.props.jetbrainsMode});this.options=J.map((Q,Z)=>{let X=Q.workspaceFolders[0]??"Unknown project",Y=X=="/"?"Any file":this.toHomeRelative(X),K=Q.pid===S7.getSelectedConfig()?.pid,G=K?`${Q.ideName} (connected)`:Q.ideName;if(K)this.initialSelectedIndex=Z;return{value:{config:Q},label:G,description:Y}})}catch(J){u.error("Failed to load IDE configurations:",J),this.error="Failed to load IDE configurations"}finally{this.setState()}}toHomeRelative(J){let Q=OF9();if(J===Q)return"~";if(J.startsWith(Q+jF9.sep))return"~"+J.slice(Q.length);return J}handleKeyEvent=(J)=>{if(J.key==="Escape"||J.key==="c"&&J.ctrlKey)return this.widget.props.onCancel(),"handled";return"ignored"};build(J){if(this.error)return this.buildErrorBox(this.error,J);return this.buildSelectionBox(J)}buildErrorBox(J,Q){let X=e6.of(Q).colorScheme,Y=_8.of(Q),K=new j1({color:X.primary,bold:!0}),G=new j1({color:X.foreground}),q=new j1({color:X.secondary}),z=new j1({color:E1.yellow}),U=Y.size.width,W=Y.size.height,F=U-4,H=W-4,B=Math.min(60,F),M=new q9({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new C9({child:new n1({text:new N1("No IDEs available",K)})}),new U0({height:1}),new n1({text:new N1(J,G)}),new U0({height:1}),new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new NQ({uri:"https://ampcode.com/manual#ide",text:"https://ampcode.com/manual#ide",style:q})]}),new U0({height:2}),new C9({child:new n1({text:new N1("",G,[new N1("Press ",G),new N1("Escape",z),new N1(" or ",G),new N1("Ctrl+C",z),new N1(" to close",G)])})})]})})});return new C9({child:new y0({constraints:new w6(B,B,0,H),decoration:new i8(X.background,x8.all(new w8(X.primary,1,"rounded"))),child:M})})}buildSelectionBox(J){let Z=e6.of(J).colorScheme,X=_8.of(J),Y=new j1({color:Z.primary,bold:!0}),K=new j1({color:Z.foreground}),G=new j1({color:E1.yellow}),q=new j1({color:Z.secondary}),z=X.size.width,U=X.size.height,W=z-4,F=U-4,H=Math.min(60,W),B=Math.min(F-4,U-8),M=Math.floor(Math.max(1,B/2)),V=this.options.length>0,N=[new C9({child:new n1({text:new N1(V?"Connect Amp CLI to an IDE":"No IDEs available",Y)})}),new U0({height:1})];if(V)N.push(new Yd({options:this.options,onSelect:(A)=>{if(A)this.widget.props.onSelect(A.config,"user-initiated");else this.widget.props.onCancel()},border:null,maxVisibleItems:M,autofocus:this.widget.props.autofocus??!0,showDismissalMessage:!1,selectedIndex:this.initialSelectedIndex}));else{let A=this.widget.props.jetbrainsMode?"No JetBrains IDE configurations found. Make sure you have a JetBrains IDE with the Amp plugin running.":"No IDE configurations found. Make sure you have an IDE with the Amp plugin running.";N.push(new n1({text:new N1(A,K)}),new U0({height:1}),new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new NQ({uri:"https://ampcode.com/manual#ide",text:"https://ampcode.com/manual#ide",style:q})]}))}N.push(new U0({height:2}),new C9({child:new n1({text:new N1("",K,[new N1("Press ",K),new N1("Escape",G),new N1(" or ",K),new N1("Ctrl+C",G),new N1(" to close",K)])})}));let L=new q9({autofocus:this.widget.props.autofocus??!0,onKey:this.handleKeyEvent,child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:N})})});return new C9({child:new y0({constraints:new w6(H,H,0,F),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:L})})}}DW();G0();import{createHash as QH9}from"node:crypto";import{createWriteStream as ZH9,existsSync as vQ1,readdirSync as XH9,readFileSync as YH9}from"node:fs";import{copyFile as KH9,mkdir as GH9,readFile as qH9,rename as zH9,unlink as UH9}from"node:fs/promises";import{homedir as eW6,platform as lu1}from"node:os";import $N from"node:path";import{Readable as WH9}from"node:stream";import{pipeline as FH9}from"node:stream/promises";import{createWriteStream as nF9,existsSync as aF9,mkdirSync as rF9,readdirSync as sF9,rmSync as oF9}from"node:fs";import{writeFile as tF9}from"node:fs/promises";import qd from"node:path";import{pipeline as eF9}from"node:stream/promises";var mu1=a1("fs"),xF9=a1("zlib"),bF9=iW6(),yF9=rW6(),PQ1=a1("util"),TQ1=a1("events").EventEmitter,sW6=a1("stream").Transform,pu1=a1("stream").PassThrough,fF9=a1("stream").Writable;var du1=hF9;function hF9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!0;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=IQ1;mu1.open(J,"r",function(X,Y){if(X)return Z(X);gF9(Y,Q,function(K,G){if(K)mu1.close(Y,IQ1);Z(K,G)})})}function gF9(J,Q,Z){if(typeof Q==="function")Z=Q,Q=null;if(Q==null)Q={};if(Q.autoClose==null)Q.autoClose=!1;if(Q.lazyEntries==null)Q.lazyEntries=!1;if(Q.decodeStrings==null)Q.decodeStrings=!0;if(Q.validateEntrySizes==null)Q.validateEntrySizes=!0;if(Q.strictFileNames==null)Q.strictFileNames=!1;if(Z==null)Z=IQ1;mu1.fstat(J,function(X,Y){if(X)return Z(X);var K=bF9.createFromFd(J,{autoClose:!0});mF9(K,Y.size,Q,Z)})}function mF9(J,Q,Z,X){if(typeof Z==="function")X=Z,Z=null;if(Z==null)Z={};if(Z.autoClose==null)Z.autoClose=!0;if(Z.lazyEntries==null)Z.lazyEntries=!1;if(Z.decodeStrings==null)Z.decodeStrings=!0;var Y=!!Z.decodeStrings;if(Z.validateEntrySizes==null)Z.validateEntrySizes=!0;if(Z.strictFileNames==null)Z.strictFileNames=!1;if(X==null)X=IQ1;if(typeof Q!=="number")throw Error("expected totalSize parameter to be a number");if(Q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");J.ref();var K=22,G=20,q=65535,z=Math.min(G+K+q,Q),U=FB(z),W=Q-U.length;QS(J,U,0,z,W,function(F){if(F)return X(F);for(var H=z-K;H>=0;H-=1){if(U.readUInt32LE(H)!==101010256)continue;var B=U.subarray(H),M=B.readUInt16LE(4),V=B.readUInt16LE(10),N=B.readUInt32LE(16),L=B.readUInt16LE(20),A=B.length-K;if(L!==A)return X(Error("Invalid comment length. Expected: "+A+". Found: "+L+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var w=Y?EQ1(B.subarray(22),!1):B.subarray(22);if(H-G>=0&&U.readUInt32LE(H-G)===117853008){var R=U.subarray(H-G,H-G+G),O=JS(R,8),j=FB(56);return QS(J,j,0,j.length,O,function($){if($)return X($);if(j.readUInt32LE(0)!==101075792)return X(Error("invalid zip64 end of central directory record signature"));if(M=j.readUInt32LE(16),M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return V=JS(j,32),N=JS(j,48),X(null,new WB(J,N,Q,V,w,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))})}if(M!==0)return X(Error("multi-disk zip files are not supported: found disk number: "+M));return X(null,new WB(J,N,Q,V,w,Z.autoClose,Z.lazyEntries,Y,Z.validateEntrySizes,Z.strictFileNames))}X(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}PQ1.inherits(WB,TQ1);function WB(J,Q,Z,X,Y,K,G,q,z,U){var W=this;if(TQ1.call(W),W.reader=J,W.reader.on("error",function(F){oW6(W,F)}),W.reader.once("close",function(){W.emit("close")}),W.readEntryCursor=Q,W.fileSize=Z,W.entryCount=X,W.comment=Y,W.entriesRead=0,W.autoClose=!!K,W.lazyEntries=!!G,W.decodeStrings=!!q,W.validateEntrySizes=!!z,W.strictFileNames=!!U,W.isOpen=!0,W.emittedError=!1,!W.lazyEntries)W._readEntry()}WB.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function WW(J,Q){if(J.autoClose)J.close();oW6(J,Q)}function oW6(J,Q){if(J.emittedError)return;J.emittedError=!0,J.emit("error",Q)}WB.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};WB.prototype._readEntry=function(){var J=this;if(J.entryCount===J.entriesRead){setImmediate(function(){if(J.autoClose)J.close();if(J.emittedError)return;J.emit("end")});return}if(J.emittedError)return;var Q=FB(46);QS(J.reader,Q,0,Q.length,J.readEntryCursor,function(Z){if(Z)return WW(J,Z);if(J.emittedError)return;var X=new CQ1,Y=Q.readUInt32LE(0);if(Y!==33639248)return WW(J,Error("invalid central directory file header signature: 0x"+Y.toString(16)));if(X.versionMadeBy=Q.readUInt16LE(4),X.versionNeededToExtract=Q.readUInt16LE(6),X.generalPurposeBitFlag=Q.readUInt16LE(8),X.compressionMethod=Q.readUInt16LE(10),X.lastModFileTime=Q.readUInt16LE(12),X.lastModFileDate=Q.readUInt16LE(14),X.crc32=Q.readUInt32LE(16),X.compressedSize=Q.readUInt32LE(20),X.uncompressedSize=Q.readUInt32LE(24),X.fileNameLength=Q.readUInt16LE(28),X.extraFieldLength=Q.readUInt16LE(30),X.fileCommentLength=Q.readUInt16LE(32),X.internalFileAttributes=Q.readUInt16LE(36),X.externalFileAttributes=Q.readUInt32LE(38),X.relativeOffsetOfLocalHeader=Q.readUInt32LE(42),X.generalPurposeBitFlag&64)return WW(J,Error("strong encryption is not supported"));J.readEntryCursor+=46,Q=FB(X.fileNameLength+X.extraFieldLength+X.fileCommentLength),QS(J.reader,Q,0,Q.length,J.readEntryCursor,function(K){if(K)return WW(J,K);if(J.emittedError)return;X.fileNameRaw=Q.subarray(0,X.fileNameLength);var G=X.fileNameLength+X.extraFieldLength;X.extraFieldRaw=Q.subarray(X.fileNameLength,G),X.fileCommentRaw=Q.subarray(G,G+X.fileCommentLength);try{X.extraFields=lF9(X.extraFieldRaw)}catch(V){return WW(J,V)}if(J.decodeStrings){var q=(X.generalPurposeBitFlag&2048)!==0;X.fileComment=EQ1(X.fileCommentRaw,q),X.fileName=dF9(X.generalPurposeBitFlag,X.fileNameRaw,X.extraFields,J.strictFileNames);var z=cF9(X.fileName);if(z!=null)return WW(J,Error(z))}else X.fileComment=X.fileCommentRaw,X.fileName=X.fileNameRaw;X.comment=X.fileComment,J.readEntryCursor+=Q.length,J.entriesRead+=1;for(var U=0;U<X.extraFields.length;U++){var W=X.extraFields[U];if(W.id!==1)continue;var F=W.data,H=0;if(X.uncompressedSize===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include uncompressed size"));X.uncompressedSize=JS(F,H),H+=8}if(X.compressedSize===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include compressed size"));X.compressedSize=JS(F,H),H+=8}if(X.relativeOffsetOfLocalHeader===4294967295){if(H+8>F.length)return WW(J,Error("zip64 extended information extra field does not include relative header offset"));X.relativeOffsetOfLocalHeader=JS(F,H),H+=8}break}if(J.validateEntrySizes&&X.compressionMethod===0){var B=X.uncompressedSize;if(X.isEncrypted())B+=12;if(X.compressedSize!==B){var M="compressed/uncompressed size mismatch for stored file: "+X.compressedSize+" != "+X.uncompressedSize;return WW(J,Error(M))}}if(J.emit("entry",X),!J.lazyEntries)J._readEntry()})})};WB.prototype.openReadStream=function(J,Q,Z){var X=this,Y=0,K=J.compressedSize;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};else{if(Q.decrypt!=null){if(!J.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(Q.decrypt!==!1)throw Error("invalid options.decrypt value: "+Q.decrypt);if(J.isCompressed()){if(Q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(Q.decompress!=null){if(!J.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(Q.decompress===!1||Q.decompress===!0))throw Error("invalid options.decompress value: "+Q.decompress)}if(Q.start!=null||Q.end!=null){if(J.isCompressed()&&Q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(J.isEncrypted()&&Q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(Q.start!=null){if(Y=Q.start,Y<0)throw Error("options.start < 0");if(Y>J.compressedSize)throw Error("options.start > entry.compressedSize")}if(Q.end!=null){if(K=Q.end,K<0)throw Error("options.end < 0");if(K>J.compressedSize)throw Error("options.end > entry.compressedSize");if(K<Y)throw Error("options.end < options.start")}}if(!X.isOpen)return Z(Error("closed"));if(J.isEncrypted()){if(Q.decrypt!==!1)return Z(Error("entry is encrypted, and options.decrypt !== false"))}var G;if(J.compressionMethod===0)G=!1;else if(J.compressionMethod===8)G=Q.decompress!=null?Q.decompress:!0;else return Z(Error("unsupported compression method: "+J.compressionMethod));X.readLocalFileHeader(J,{minimal:!0},function(q,z){if(q)return Z(q);X.openReadStreamLowLevel(z.fileDataStart,J.compressedSize,Y,K,G,J.uncompressedSize,Z)})};WB.prototype.openReadStreamLowLevel=function(J,Q,Z,X,Y,K,G){var q=this,z=J+Q,U=q.reader.createReadStream({start:J+Z,end:J+X}),W=U;if(Y){var F=!1,H=xF9.createInflateRaw();if(U.on("error",function(B){setImmediate(function(){if(!F)H.emit("error",B)})}),U.pipe(H),q.validateEntrySizes)W=new Gd(K),H.on("error",function(B){setImmediate(function(){if(!F)W.emit("error",B)})}),H.pipe(W);else W=H;uu1(W,function(){if(F=!0,H!==W)H.unpipe(W);U.unpipe(H),U.destroy()})}G(null,W)};WB.prototype.readLocalFileHeader=function(J,Q,Z){var X=this;if(Z==null)Z=Q,Q=null;if(Q==null)Q={};X.reader.ref();var Y=FB(30);QS(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader,function(K){try{if(K)return Z(K);var G=Y.readUInt32LE(0);if(G!==67324752)return Z(Error("invalid local file header signature: 0x"+G.toString(16)));var q=Y.readUInt16LE(26),z=Y.readUInt16LE(28),U=J.relativeOffsetOfLocalHeader+30+q+z;if(U+J.compressedSize>X.fileSize)return Z(Error("file data overflows file bounds: "+U+" + "+J.compressedSize+" > "+X.fileSize));if(Q.minimal)return Z(null,{fileDataStart:U});var W=new uF9;W.fileDataStart=U,W.versionNeededToExtract=Y.readUInt16LE(4),W.generalPurposeBitFlag=Y.readUInt16LE(6),W.compressionMethod=Y.readUInt16LE(8),W.lastModFileTime=Y.readUInt16LE(10),W.lastModFileDate=Y.readUInt16LE(12),W.crc32=Y.readUInt32LE(14),W.compressedSize=Y.readUInt32LE(18),W.uncompressedSize=Y.readUInt32LE(22),W.fileNameLength=q,W.extraFieldLength=z,Y=FB(q+z),X.reader.ref(),QS(X.reader,Y,0,Y.length,J.relativeOffsetOfLocalHeader+30,function(F){try{if(F)return Z(F);return W.fileName=Y.subarray(0,q),W.extraField=Y.subarray(q),Z(null,W)}finally{X.reader.unref()}})}finally{X.reader.unref()}})};function CQ1(){}CQ1.prototype.getLastModDate=function(J){if(J==null)J={};if(!J.forceDosFormat)for(var Q=0;Q<this.extraFields.length;Q++){var Z=this.extraFields[Q];if(Z.id===21589){var X=Z.data;if(X.length<5)continue;var Y=X[0],K=1;if(!(Y&K))continue;var G=X.readInt32LE(1);return new Date(G*1000)}else if(Z.id===10){var X=Z.data,q=4;while(q<X.length+4){var z=X.readUInt16LE(q);q+=2;var U=X.readUInt16LE(q);if(q+=2,z!==1){q+=U;continue}if(U<8||q+U>X.length)break;var W=4294967296*X.readInt32LE(q+4)+X.readUInt32LE(q),F=W/1e4-11644473600000;return new Date(F)}}}return pF9(this.lastModFileDate,this.lastModFileTime,J.timezone)};CQ1.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};CQ1.prototype.isCompressed=function(){return this.compressionMethod===8};function uF9(){}function pF9(J,Q,Z){var X=J&31,Y=(J>>5&15)-1,K=(J>>9&127)+1980,G=0,q=(Q&31)*2,z=Q>>5&63,U=Q>>11&31;if(Z==null||Z==="local")return new Date(K,Y,X,U,z,q,G);else if(Z==="UTC")return new Date(Date.UTC(K,Y,X,U,z,q,G));else throw Error("unrecognized options.timezone: "+options.timezone)}function dF9(J,Q,Z,X){var Y=null;for(var K=0;K<Z.length;K++){var G=Z[K];if(G.id===28789){if(G.data.length<6)continue;if(G.data.readUInt8(0)!==1)continue;var q=G.data.readUInt32LE(1);if(yF9.unsigned(Q)!==q)continue;Y=EQ1(G.data.subarray(5),!0);break}}if(Y==null){var z=(J&2048)!==0;Y=EQ1(Q,z)}if(!X)Y=Y.replace(/\\/g,"/");return Y}function cF9(J){if(J.indexOf("\\")!==-1)return"invalid characters in fileName: "+J;if(/^[a-zA-Z]:/.test(J)||/^\//.test(J))return"absolute path: "+J;if(J.split("/").indexOf("..")!==-1)return"invalid relative path: "+J;return null}function lF9(J){var Q=[],Z=0;while(Z<J.length-3){var X=J.readUInt16LE(Z+0),Y=J.readUInt16LE(Z+2),K=Z+4,G=K+Y;if(G>J.length)throw Error("extra field length exceeds extra field buffer size");var q=J.subarray(K,G);Q.push({id:X,data:q}),Z=G}return Q}function QS(J,Q,Z,X,Y,K){if(X===0)return setImmediate(function(){K(null,FB(0))});J.read(Q,Z,X,Y,function(G,q){if(G)return K(G);if(q<X)return K(Error("unexpected EOF"));K()})}PQ1.inherits(Gd,sW6);function Gd(J){sW6.call(this),this.actualByteCount=0,this.expectedByteCount=J}Gd.prototype._transform=function(J,Q,Z){if(this.actualByteCount+=J.length,this.actualByteCount>this.expectedByteCount){var X="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return Z(Error(X))}Z(null,J)};Gd.prototype._flush=function(J){if(this.actualByteCount<this.expectedByteCount){var Q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return J(Error(Q))}J()};PQ1.inherits(pR,TQ1);function pR(){TQ1.call(this),this.refCount=0}pR.prototype.ref=function(){this.refCount+=1};pR.prototype.unref=function(){var J=this;if(J.refCount-=1,J.refCount>0)return;if(J.refCount<0)throw Error("invalid unref");J.close(Q);function Q(Z){if(Z)return J.emit("error",Z);J.emit("close")}};pR.prototype.createReadStream=function(J){if(J==null)J={};var{start:Q,end:Z}=J;if(Q===Z){var X=new pu1;return setImmediate(function(){X.end()}),X}var Y=this._readStreamForRange(Q,Z),K=!1,G=new SQ1(this);Y.on("error",function(z){setImmediate(function(){if(!K)G.emit("error",z)})}),uu1(G,function(){Y.unpipe(G),G.unref(),Y.destroy()});var q=new Gd(Z-Q);return G.on("error",function(z){setImmediate(function(){if(!K)q.emit("error",z)})}),uu1(q,function(){K=!0,G.unpipe(q),G.destroy()}),Y.pipe(G).pipe(q)};pR.prototype._readStreamForRange=function(J,Q){throw Error("not implemented")};pR.prototype.read=function(J,Q,Z,X,Y){var K=this.createReadStream({start:X,end:X+Z}),G=new fF9,q=0;G._write=function(z,U,W){z.copy(J,Q+q,0,z.length),q+=z.length,W()},G.on("finish",Y),K.on("error",function(z){Y(z)}),K.pipe(G)};pR.prototype.close=function(J){setImmediate(J)};PQ1.inherits(SQ1,pu1);function SQ1(J){pu1.call(this),this.context=J,this.context.ref(),this.unreffedYet=!1}SQ1.prototype._flush=function(J){this.unref(),J()};SQ1.prototype.unref=function(J){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var iF9="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function EQ1(J,Q){if(Q)return J.toString("utf8");else{var Z="";for(var X=0;X<J.length;X++)Z+=iF9[J[X]];return Z}}function JS(J,Q){var Z=J.readUInt32LE(Q),X=J.readUInt32LE(Q+4);return X*4294967296+Z}var FB;if(typeof Buffer.allocUnsafe==="function")FB=function(J){return Buffer.allocUnsafe(J)};else FB=function(J){return new Buffer(J)};function uu1(J,Q){if(typeof J.destroy==="function")J._destroy=function(Z,X){if(Q(),X!=null)X(Z)};else J.destroy=Q}function IQ1(J){if(J)throw J}G0();async function tW6(J,Q,Z,X=JH9){u.debug("jetbrains-plugin-install",{pluginDirectory:J});let Y=qd.join(J,"lib");if(aF9(Y)){let G=sF9(Y,{withFileTypes:!0}).filter((q)=>q.name.endsWith(".jar"));u.info("jetbrains-plugin-install",{libDirectory:Y,removableJarFiles:G.map((q)=>q.name)}),G.forEach((q)=>{oF9(qd.join(q.parentPath,q.name))})}rF9(Y,{recursive:!0});let K=qd.join(J,"version.txt");return await tF9(K,Z,"utf8"),X(Q,Y)}function JH9(J,Q){return new Promise((Z,X)=>{du1(J,{lazyEntries:!0},(Y,K)=>{if(Y)return X(Y);if(!K)return X(Error("Failed to open ZIP file"));K.readEntry(),K.on("entry",(G)=>{if(G.fileName.startsWith("amp-jetbrains-plugin/lib/"))K.openReadStream(G,async(q,z)=>{if(q)return X(q);if(!z)return X(Error("Failed to open read stream"));let U=qd.basename(G.fileName),W=qd.join(Q,U);await eF9(z,nF9(W)),K.readEntry()});else K.readEntry()}),K.on("end",Z),K.on("error",X)})})}var ZF6="amp-jetbrains-plugin",JF6="https://storage.googleapis.com/amp-public-assets-prod-0/jetbrains/latest.json",zd=null;async function cu1(J,Q=3){for(let Z=1;Z<=Q;Z++)try{let X=await fetch(J);if(!X.ok)throw Error(`HTTP ${X.status}: ${X.statusText} for ${J}`);return X}catch(X){let Y=X instanceof Error?X.message:String(X);if(X instanceof Error&&X.message.match(/HTTP 4\d\d:/))throw X;if(Z===Q)throw X;let K=500*Math.pow(2,Z-1);u.warn("fetchWithRetry",{url:J,attempt:Z,maxRetries:Q,message:Y,retryingInMs:K}),await new Promise((G)=>setTimeout(G,K))}throw Error("Unexpected end of retry loop")}async function XF6(){if(zd)return u.debug("jetbrains-plugin-version",{message:"Using cached version info",cachedVersionInfo:zd}),zd;return u.debug("jetbrains-plugin-version",{message:"Fetching version info",url:JF6}),zd=await(await cu1(JF6)).json(),zd}async function iu1(){return(await XF6()).plugin_version}async function YF6(){let J=await iu1();return`${ZF6}-${J}.zip`}function HH9(){let J=lu1();return u.debug("jetbrains-plugin-discovery",{os:J}),["darwin","win32"].includes(J)}function BH9(J,Q){if(!J?.pluginVersion)return"unknown";return J?.pluginVersion===Q?"uptodate":"outdated"}function KF6(J,Q){if(u.debug("jetbrains-plugin-discovery",{ideStatus:J}),HH9()){let X=MH9();if(u.debug("jetbrains-plugin-discovery",{discoveryResult:X}),!X.success)return X;let Y=X.products.map((K)=>{let G=QF6(K.pluginDirectory,Q);return{...K,installType:G.installType,installedVersion:G.installedVersion}}).filter((K)=>QF6(K.pluginDirectory,Q).needsInstall);return u.debug("jetbrains-plugin-discovery",{installationTargets:Y}),{success:!0,products:Y}}let Z=BH9(J,Q);if(u.debug("jetbrains-plugin-discovery",{connectedVersionStatus:Z}),Z==="outdated"&&J?.pluginDirectory&&J?.ideName)return{success:!0,products:[{name:J.ideName,version:"",pluginDirectory:J.pluginDirectory,installType:"upgrade",installedVersion:J.pluginVersion}]};if(Z==="uptodate")return{success:!0,products:[]};return{success:!0,requiresManualInstall:!0,products:[]}}async function GF6(J,Q,Z){u.debug("jetbrains-plugin-install",{message:"Starting plugin installation",targetCount:J.length,targets:J.map((Y)=>`${Y.name} ${Y.version}`),cacheDirectory:Q});let X=await _Q1(Q);for(let Y of J)try{u.debug("jetbrains-plugin-install:start",{product:Y}),await tW6(Y.pluginDirectory,X,Z),u.debug("jetbrains-plugin-install:complete",{product:Y})}catch(K){throw u.error("jetbrains-plugin-install",{product:Y,error:K}),Error(`Failed to install JetBrains plugin to ${Y.name} ${Y.version}: ${K}`)}u.info("jetbrains-plugin-install",{message:"All plugin installations completed successfully",installedCount:J.length})}function kQ1(J){let Q=lu1(),Z;switch(Q){case"darwin":Z=$N.join(eW6(),"Library","Application Support",J);break;case"win32":{let X=process.env.APPDATA||$N.join(eW6(),"AppData","Roaming");Z=$N.join(X,J);break}default:throw Error(`Unsupported operating system: ${Q}`)}return Z}function DH9(){let J=["bl","crl","consentOptions","PrivacyPolicy","Toolbox","Chrome","Google","RLZ"];return[kQ1("JetBrains"),kQ1("Google")].flatMap((Q)=>{if(!vQ1(Q))return[];return XH9(Q,{withFileTypes:!0})}).filter((Q)=>{if(!Q.isDirectory())return!1;return!J.find((Z)=>Q.name.startsWith(Z))})}function MH9(){try{let J=DH9();if(J.length===0)return{success:!1,products:[],helpMessage:"Directory does not exist. Please ensure you have JetBrains IDEs installed."};u.debug("jetbrains-plugin-discovery",{productDirectories:J});let Q=[];for(let Z of J){let{productName:X,version:Y}=NH9(Z.name);if(["2020","2021","2022","2023","unknown"].find((K)=>Y.startsWith(K))){u.debug("jetbrains-plugin-discovery",{skipped:Z.name});continue}Q.push({name:X,version:Y,pluginDirectory:$N.join(Z.parentPath,Z.name,"plugins",ZF6)})}return{success:!0,products:Q.sort((Z,X)=>{return Z.name.localeCompare(X.name)||Z.version.localeCompare(X.version)})}}catch(J){u.error("jetbrains-plugin-discovery",{error:J});let Q=lu1(),X=`Failed to access JetBrains directory at: ${[kQ1("JetBrains"),kQ1("Google")].join(", ")}
|
|
6588
6588
|
`;if(J instanceof Error&&"code"in J)switch(J.code){case"EACCES":X+="Permission denied. Please check directory permissions.";break;default:X+=`Error: ${J.message}`}else X+=`Error: ${String(J)}`;if(Q==="darwin")X+=`
|
|
6589
6589
|
On macOS, JetBrains IDEs are typically installed in ~/Library/Application Support/JetBrains/`;else if(Q==="win32")X+=`
|
|
6590
6590
|
On Windows, check %APPDATA%\\JetBrains\\`;return{success:!1,products:[],error:J instanceof Error?J.message:String(J),helpMessage:X}}}function VH9(J){return{IntelliJIdea:"IntelliJ IDEA",IdeaIC:"IntelliJ IDEA Community Edition",WebStorm:"WebStorm",WebIde:"PhpStorm/WebStorm",PhpStorm:"PhpStorm",PyCharm:"PyCharm",PyCharmCE:"PyCharm Community Edition",RubyMine:"RubyMine",CLion:"CLion",AppCode:"AppCode",DataGrip:"DataGrip",GoLand:"GoLand",Rider:"Rider",AndroidStudio:"Android Studio",AndroidStudioPreview:"Android Studio Preview",Fleet:"Fleet"}[J]||J}function NH9(J){let Q=J.match(/^(.+?)(\d{4}\.\d+(?:\.\d+)?)$/);if(!Q)return{productName:J,version:"unknown"};let Z=Q[1],X=Q[2];if(!Z||!X)return{productName:J,version:"unknown"};return{productName:VH9(Z),version:X}}function LH9(J){let Q=J.match(/^0\.(\d+)\./);if(!Q||!Q[1])return!1;return parseInt(Q[1],10)>=12}function QF6(J,Q){let Z=$N.join(J,"version.txt");if(u.debug("jetbrains-plugin-discovery",{ampPluginDir:J}),!vQ1(J))return u.debug("jetbrains-plugin-discovery",{message:"Plugin directory does not exist",ampPluginDir:J}),{needsInstall:!0,installType:"fresh"};try{if(vQ1(Z)){let X=YH9(Z,"utf8").trim(),Y=!LH9(X)&&X!==Q;return u.debug("jetbrains-plugin-discovery",{needsUpdate:Y,installedVersion:X,targetVersion:Q}),{needsInstall:Y,installType:"upgrade",installedVersion:X}}else return u.debug("jetbrains-plugin-discovery",{message:"No version file found, plugin needs to be installed"}),{needsInstall:!0,installType:"upgrade"}}catch(X){return u.error("jetbrains-plugin-discovery",{message:"Error reading version file",versionFilePath:Z,error:X}),{needsInstall:!0,installType:"upgrade"}}}async function AH9(J){if(u.debug("jetbrains-plugin-download",{message:"Starting download",pluginPath:J}),vQ1(J))return u.debug("jetbrains-plugin-download",{message:"Plugin already exists, skipping download",pluginPath:J}),J;return await wH9(J),u.info("jetbrains-plugin-install:downloadSuccess",{path:J}),J}async function _Q1(J){let Q=await YF6(),Z=$N.join(J,"jetbrains-plugins",Q);return u.debug("jetbrains-plugin-download",{message:"Ensuring plugin available",cacheDir:J,pluginFile:Q,pluginPath:Z}),await AH9(Z),u.debug("jetbrains-plugin-download",{message:"Plugin ensured and available",pluginPath:Z}),Z}async function qF6(J){let Q=await _Q1(J),Z=await YF6(),X=$N.join(process.cwd(),Z);return u.debug("jetbrains-plugin-copy",{message:"Copying plugin to current directory",from:Q,to:X}),await KH9(Q,X),u.info("jetbrains-plugin-copy",{message:"Plugin copied successfully",path:X}),X}async function wH9(J){u.debug("jetbrains-plugin-download",{message:"Starting download",destinationFile:J}),await GH9($N.dirname(J),{recursive:!0});let Q=await XF6(),{plugin_zip:Z,plugin_sha:X}=Q;u.debug("jetbrains-plugin-download",{message:"Download URLs determined",pluginUrl:Z,checksumUrl:X,pluginVersion:Q.plugin_version}),u.debug("jetbrains-plugin-download",{message:"Downloading checksum",checksumUrl:X});let K=(await(await cu1(X)).text()).trim().split(/\s+/)[0];u.debug("jetbrains-plugin-download",{message:"Checksum downloaded",expectedChecksum:K}),u.debug("jetbrains-plugin-download",{message:"Downloading plugin",pluginUrl:Z});let G=await cu1(Z);if(!G.body)throw Error("Plugin response body is empty");let q=`${J}.${process.pid}.${Date.now()}.tmp`;try{u.debug("jetbrains-plugin-download",{message:"Writing plugin to temp file",tmpFile:q});let z=ZH9(q),U=WH9.fromWeb(G.body);await FH9(U,z),u.debug("jetbrains-plugin-download",{message:"Plugin downloaded, verifying checksum"});let W=await OH9(q);if(W!==K)throw u.error("jetbrains-plugin-download",{message:"Checksum validation failed",expectedChecksum:K,actualChecksum:W}),Error(`JetBrains plugin checksum validation failed: expected ${K}, got ${W}`);u.debug("jetbrains-plugin-download",{message:"Checksum verified, moving to final location",from:q,to:J}),await RH9(q,J)}finally{await UH9(q).catch(()=>{})}u.debug("jetbrains-plugin-download",{message:"Download completed successfully",destinationFile:J})}async function RH9(J,Q){try{await zH9(J,Q)}catch(Z){if(Z instanceof Error&&"code"in Z&&Z.code==="EEXIST")return;throw Z}}async function OH9(J){let Q=QH9("sha256"),Z=await qH9(J);return Q.update(Z),Q.digest("hex")}class xQ1{step="discovery";requiresManualInstall=!1;products=[];error="";downloadPath="";getStep(){return this.step}getError(){return this.error}getProducts(){if(this.step==="discovery")throw Error("getProducts can only be called after discovery step is complete");return this.products}isRequiresManualInstall(){return this.requiresManualInstall}getDownloadPath(){if(["discovery","selection","downloading"].includes(this.step))throw Error("getDownloadPath can only be called after downloading step is complete");return this.downloadPath}transitionToError(J){return this.step="error",this.error=J,this}transitionToSelection(J,Q){if(this.step!=="discovery")return this;return this.requiresManualInstall=J,this.products=Q,this.step="selection",this}transitionToDownload(J){if(this.step!=="selection")return this;return this.requiresManualInstall=J,this.step="downloading",this}transitionToInstall(J){if(this.step!=="downloading")return this;if(this.requiresManualInstall)this.step="manual-installation";else this.step="installing";return this.downloadPath=J,this}transitionToSuccess(){if(this.step!=="installing")return this;return this.step="success",this}clone(){let J=new xQ1;return J.step=this.step,J.requiresManualInstall=this.requiresManualInstall,J.products=[...this.products],J.error=this.error,J.downloadPath=this.downloadPath,J}}var zF6=(J)=>{return(J??[]).some((Q)=>Q.installType==="fresh")};class nu1 extends c0{configService;ideClient;onExit;onContinue;constructor({key:J,configService:Q,ideClient:Z,onExit:X,onContinue:Y}){super({key:J});this.configService=Q,this.ideClient=Z,this.onExit=X,this.onContinue=Y}createState(){return new UF6}}class UF6 extends d0{stateNotifier=new IR(new xQ1);pluginVersionNotifier=new IR("");ideStateNotifier=new IR(null);ideStatusSubscription=null;ideStatusTimeoutId=null;initState(){super.initState(),this.stateNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.ideStateNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.pluginVersionNotifier.addListener(()=>{this.setState(()=>{}),this.nextStep()}),this.ideStatusSubscription=this.widget.ideClient.status.subscribe((J)=>{this.ideStateNotifier.value=J}),this.ideStatusTimeoutId=setTimeout(()=>{this.ideStateNotifier.value={connected:!1}},2000),iu1().then((J)=>{this.pluginVersionNotifier.value=J})}dispose(){if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideStatusTimeoutId)clearTimeout(this.ideStatusTimeoutId);this.stateNotifier.dispose(),this.ideStateNotifier.dispose(),this.pluginVersionNotifier.dispose(),super.dispose()}performDiscovery=async()=>{let J=KF6(this.ideStateNotifier.value,this.pluginVersionNotifier.value);if(!J.success){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`JetBrains IDE discovery failed: ${J.error}
|
|
6591
6591
|
|
|
6592
|
-
${J.helpMessage}`);return}if(!J.requiresManualInstall&&J.products.length===0){this.widget.onContinue();return}this.stateNotifier.value=this.stateNotifier.value.clone().transitionToSelection(J.requiresManualInstall??!1,J.products)};performDownload=async()=>{try{let J=this.stateNotifier.value.isRequiresManualInstall(),Q;if(J)Q=await qF6(NB);else Q=await _Q1(NB);this.stateNotifier.value=this.stateNotifier.value.clone().transitionToInstall(Q)}catch(J){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`Download failed: ${J}`)}};performInstallation=async()=>{let J=this.stateNotifier.value.getProducts();try{await GF6(J,NB,this.pluginVersionNotifier.value),this.stateNotifier.value=this.stateNotifier.value.clone().transitionToSuccess()}catch(Q){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`Installation failed: ${Q}`)}};nextStep(){let J=this.stateNotifier.value.getStep();if(J==="discovery"&&this.ideStateNotifier.value?.connected!==void 0&&this.pluginVersionNotifier.value)this.performDiscovery();else if(J==="downloading")this.performDownload();else if(J==="installing")this.performInstallation()}handleSelection=async(J)=>{switch(J){case null:case"skip":this.widget.onContinue();break;case"never":await this.widget.configService.updateSettings("jetbrains.skipInstall",!0),this.widget.onContinue();break;case"manual-install":case"install":this.stateNotifier.value=this.stateNotifier.value.clone().transitionToDownload(J==="manual-install");break}};getSelectOptions=()=>{let J=this.stateNotifier.value.getProducts(),Q=zF6(J),Z=[{value:"manual-install",label:"Download Only",description:"Download to the current directory for manual installation"},{value:"skip",label:"Skip",description:""},{value:"never",label:"Always Skip",description:'Skip and set "amp.jetbrains.skipInstall": true'}];if(!this.stateNotifier.value.isRequiresManualInstall()){let Y=jH9(J).map((K)=>`${K.name}${$H9(K.versions)}`).join(", ");Z.unshift({value:"install",label:Q?"Install":"Upgrade",description:`Download and ${Q?"install into":"upgrade for"} ${Y}`})}return Z};wrapWithConstraints(J,Q,Z,X){return new y0({constraints:new w6(Z,Z,0,X),child:J})}build(J){let Q=e6.of(J),Z=_8.of(J),X=this.stateNotifier.value.getStep(),Y=Z.size.width,K=Z.size.height,G=Y-4,q=K-4;if(X==="error"){let z=new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new n1({text:new N1("Error: "+this.stateNotifier.value.getError(),new
|
|
6593
|
-
${this.stateNotifier.value.getDownloadPath()}.`,new
|
|
6594
|
-
https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk`,new
|
|
6592
|
+
${J.helpMessage}`);return}if(!J.requiresManualInstall&&J.products.length===0){this.widget.onContinue();return}this.stateNotifier.value=this.stateNotifier.value.clone().transitionToSelection(J.requiresManualInstall??!1,J.products)};performDownload=async()=>{try{let J=this.stateNotifier.value.isRequiresManualInstall(),Q;if(J)Q=await qF6(NB);else Q=await _Q1(NB);this.stateNotifier.value=this.stateNotifier.value.clone().transitionToInstall(Q)}catch(J){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`Download failed: ${J}`)}};performInstallation=async()=>{let J=this.stateNotifier.value.getProducts();try{await GF6(J,NB,this.pluginVersionNotifier.value),this.stateNotifier.value=this.stateNotifier.value.clone().transitionToSuccess()}catch(Q){this.stateNotifier.value=this.stateNotifier.value.clone().transitionToError(`Installation failed: ${Q}`)}};nextStep(){let J=this.stateNotifier.value.getStep();if(J==="discovery"&&this.ideStateNotifier.value?.connected!==void 0&&this.pluginVersionNotifier.value)this.performDiscovery();else if(J==="downloading")this.performDownload();else if(J==="installing")this.performInstallation()}handleSelection=async(J)=>{switch(J){case null:case"skip":this.widget.onContinue();break;case"never":await this.widget.configService.updateSettings("jetbrains.skipInstall",!0),this.widget.onContinue();break;case"manual-install":case"install":this.stateNotifier.value=this.stateNotifier.value.clone().transitionToDownload(J==="manual-install");break}};getSelectOptions=()=>{let J=this.stateNotifier.value.getProducts(),Q=zF6(J),Z=[{value:"manual-install",label:"Download Only",description:"Download to the current directory for manual installation"},{value:"skip",label:"Skip",description:""},{value:"never",label:"Always Skip",description:'Skip and set "amp.jetbrains.skipInstall": true'}];if(!this.stateNotifier.value.isRequiresManualInstall()){let Y=jH9(J).map((K)=>`${K.name}${$H9(K.versions)}`).join(", ");Z.unshift({value:"install",label:Q?"Install":"Upgrade",description:`Download and ${Q?"install into":"upgrade for"} ${Y}`})}return Z};wrapWithConstraints(J,Q,Z,X){return new y0({constraints:new w6(Z,Z,0,X),child:J})}build(J){let Q=e6.of(J),Z=_8.of(J),X=this.stateNotifier.value.getStep(),Y=Z.size.width,K=Z.size.height,G=Y-4,q=K-4;if(X==="error"){let z=new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new n1({text:new N1("Error: "+this.stateNotifier.value.getError(),new j1({color:Q.colorScheme.destructive}))}),new U0({height:1}),new n1({text:new N1("Press any key to continue...",new j1({color:Q.colorScheme.foreground,dim:!0}))})]})}),U=this.wrapWithConstraints(z,Q,G,q);return new q9({autofocus:!0,onKey:(W)=>{return this.widget.onExit(),"handled"},child:U})}if(X==="selection"){let z=zF6(this.stateNotifier.value.getProducts()),U=new x6({padding:V0.all(1),child:new qB({options:this.getSelectOptions(),onSelect:this.handleSelection,title:`${z?"No":"Outdated"} Amp JetBrains plugin detected. Would you like to ${z?"install":"upgrade"}?`,showDismissalMessage:!1})});return this.wrapWithConstraints(U,Q,G,q)}if(X==="downloading")return new y0({decoration:new i8(Q.colorScheme.background),child:new x6({padding:V0.all(2),child:new n1({text:new N1("Downloading JetBrains plugin...",new j1({color:Q.colorScheme.foreground}))})})});if(this.stateNotifier.value.getStep()==="installing"){let z=[];for(let U of this.stateNotifier.value.getProducts()){let W=U.installType==="fresh"?"new install":`upgrade from ${U.installedVersion} to ${this.pluginVersionNotifier.value}`;z.push(new n1({text:new N1(`Installing to ${U.name} ${U.version} (${W})...`,new j1({color:Q.colorScheme.foreground}))}))}return new y0({decoration:new i8(Q.colorScheme.background),child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new n1({text:new N1("Downloading JetBrains plugin...",new j1({color:Q.colorScheme.foreground}))}),new n1({text:new N1("Installing...",new j1({color:Q.colorScheme.foreground}))}),new x6({padding:V0.only({left:2}),child:new i0({crossAxisAlignment:"start",children:z})})]})})})}if(this.stateNotifier.value.getStep()==="success"){let z=[];for(let W of this.stateNotifier.value.getProducts()){let F=W.installType==="fresh"?"new install":`upgrade from ${W.installedVersion} to ${this.pluginVersionNotifier.value}`;z.push(new n1({text:new N1(`${W.name} ${W.version} (${F})`,new j1({color:Q.colorScheme.success}))}))}let U=new y0({decoration:new i8(Q.colorScheme.background),child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new n1({text:new N1("Installation Complete!",new j1({color:Q.colorScheme.success}))}),new U0({height:1}),new n1({text:new N1("Installed to:",new j1({color:Q.colorScheme.foreground}))}),new x6({padding:V0.only({left:2}),child:new i0({crossAxisAlignment:"start",children:z})}),new U0({height:1}),new n1({text:new N1(`Restart your JetBrains IDE${this.stateNotifier.value.getProducts().length>1?"s":""}${!lK()?" and Amp":""} now.`,new j1({color:Q.colorScheme.foreground}))}),new U0({height:1}),new n1({text:new N1("Press any key to exit...",new j1({color:Q.colorScheme.foreground,dim:!0}))})]})})});return new q9({autofocus:!0,onKey:(W)=>{return this.widget.onExit(),"handled"},child:U})}if(this.stateNotifier.value.getStep()==="manual-installation"){let z=new y0({decoration:new i8(Q.colorScheme.background),child:new x6({padding:V0.all(2),child:new i0({crossAxisAlignment:"start",mainAxisSize:"min",children:[new n1({text:new N1(`The plugin has been downloaded to
|
|
6593
|
+
${this.stateNotifier.value.getDownloadPath()}.`,new j1({color:Q.colorScheme.foreground}))}),new U0({height:1}),new n1({text:new N1(`Go to Settings > Plugins > Cogwheel > Install Plugin from Disk or see
|
|
6594
|
+
https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk`,new j1({color:Q.colorScheme.foreground}))}),new U0({height:1}),new n1({text:new N1(`Finally restart your JetBrains IDE${!lK()&&" and Amp"}.`,new j1({color:Q.colorScheme.foreground}))}),new U0({height:1}),new n1({text:new N1("Press any key to exit...",new j1({color:Q.colorScheme.foreground,dim:!0}))})]})})});return new q9({autofocus:!0,onKey:(U)=>{return this.widget.onExit(),"handled"},child:z})}return new y0({decoration:new i8(Q.colorScheme.background),child:new x6({padding:V0.all(2),child:new n1({text:new N1("Discovering JetBrains IDEs...",new j1({color:Q.colorScheme.foreground}))})})})}}function jH9(J){let Q=J.reduce((Z,X)=>{return(Z[X.name]??=[]).push(X),Z},{});return Object.entries(Q).map(([Z,X])=>({name:Z,versions:X.map((Y)=>Y.version).sort()}))}function $H9(J){if(J.length<=1)return"";if(J.length>=3)return` (${J[0]}-${J.at(-1)})`;return` (${J.join(", ")})`}G9();l8();class au1 extends c0{color;trigger;trail;fps;speed;leftOffset;constructor({key:J,color:Q,trigger:Z,trail:X=5,fps:Y=60,speed:K=1,leftOffset:G=0}){super(J?{key:J}:{});this.color=Q,this.trigger=Z,this.trail=X,this.fps=Y,this.speed=K,this.leftOffset=G}createState(){return new WF6}}class WF6 extends d0{progress=0;timer=null;initState(){this.restart()}didUpdateWidget(J){if(J.trigger!==this.widget.trigger)this.restart()}dispose(){this.stop()}restart(){this.stop(),this.progress=-this.widget.trail,this.start()}start(){if(this.timer)return;let J=Math.max(16,Math.round(1000/Math.max(1,this.widget.fps)));this.timer=setInterval(()=>{this.setState(()=>{this.progress+=this.widget.speed})},J)}stop(){if(this.timer)clearInterval(this.timer),this.timer=null}build(J){return new FF6({color:this.widget.color,trail:this.widget.trail,head:this.progress,leftOffset:this.widget.leftOffset},this.widget.key)}}class FF6 extends QB{props;constructor(J,Q){super(Q?{key:Q}:{});this.props=J}createElement(){return new HN(this)}createRenderObject(){return new HF6(this.props.color,this.props.trail,this.props.head,this.props.leftOffset)}updateRenderObject(J){J.update(this.props.color,this.props.trail,this.props.head,this.props.leftOffset)}}class HF6 extends Z8{_color;_trail;_head;_leftOffset;constructor(J,Q,Z,X){super();this._color=J;this._trail=Q;this._head=Z;this._leftOffset=X}update(J,Q,Z,X){let Y=!1;if(Q!==this._trail)this._trail=Q,Y=!0;if(this._color=J,this._head=Z,this._leftOffset=X,Y)this.markNeedsLayout();this.markNeedsPaint()}performLayout(){let J=this._lastConstraints,Q=J.constrain(J.biggest.width,1);this.setSize(Q.width,Q.height),super.performLayout()}paint(J,Q=0,Z=0){let X=Math.floor(Q+this.offset.x),Y=Math.floor(Z+this.offset.y),K=Math.floor(this.size.width),G=[1,0.7,0.5,0.35,0.25,0.15];for(let q=0;q<=this._trail&&q<G.length;q++){let z=Math.floor(this._head)-q+this._leftOffset;if(z<this._leftOffset||z>=K)continue;let U=EH9(this._color,G[q]);J.setChar(X+z,Y,"━",{fg:U},1)}super.paint(J,Q,Z)}}function EH9(J,Q){if(J.type==="rgb")return E1.rgb(J.value.r,J.value.g,J.value.b,Q);if(J.type==="index")return E1.index(J.value,Q);return E1.default(Q)}class ru1 extends I6{message;onDismiss;constructor({key:J,message:Q,onDismiss:Z}){super({key:J});this.message=Q,this.onDismiss=Z}build(J){let Z=e6.of(J).colorScheme,X=n51(this.message),Y=[{value:"dismiss",label:"Dismiss"}],K=X.type==="error"?Z.destructive:Z.primary,G=new $R({child:new n1({text:new N1(X.description),selectable:!0})});return new qB({title:X.title,body:G,options:Y,onSelect:(q)=>{this.onDismiss()},borderColor:K,autofocus:!0,showDismissalMessage:!1,enableMouseInteraction:!0})}}G9();class su1 extends I6{url;qrCode;constructor({key:J,url:Q,qrCode:Z}){super(J?{key:J}:{});this.url=Q,this.qrCode=Z}build(J){let Z=e6.of(J).colorScheme,X=_8.of(J),Y=new j1({color:E1.rgb(0,0,0)}),K=new j1({color:Z.foreground}),G=new j1({color:Z.foreground}),q=new j1({color:Z.secondary,bold:!0}),z=X.size.width,U=X.size.height,W=z-4,F=Math.min(U-4,Math.floor(U*0.8)),H=Math.min(60,W),B=new $Y({autofocus:!0,child:new x6({padding:V0.only({left:2,right:2}),child:new i0({crossAxisAlignment:"center",children:[new C9({child:new y0({decoration:new i8(E1.rgb(255,255,255)),padding:V0.all(2),child:new n1({text:new N1(this.qrCode,Y),textAlign:"left"})})}),new U0({height:1}),new C9({child:new n1({text:new N1(`Continue at ${this.url}`,K)})}),new U0({height:1})]})})}),M=new C9({child:new n1({text:new N1("",G,[new N1("Press ",G),new N1("Escape",q),new N1(" to close",G)])})}),V=new i0({crossAxisAlignment:"stretch",children:[new R8({child:B}),M]});return new C9({child:new y0({constraints:new w6(H,H,0,F),decoration:new i8(Z.background,x8.all(new w8(Z.primary,1,"rounded"))),child:V})})}}l8();class ou1 extends c0{props;constructor(J){super({key:J.key});this.props=J}createState(){return new BF6}}class BF6 extends d0{build(J){let{queuedMessages:Q,title:Z="Queue"}=this.widget.props;if(!Array.isArray(Q)||Q.length===0)return new U0({width:0,height:0});let X=Q.map((Y)=>this.buildQueueItem(Y));return new y0({child:new x6({padding:V0.symmetric(1,0),child:new i0({crossAxisAlignment:"stretch",children:[new n1({text:new N1(Z,new j1({bold:!0}))}),...X]})})})}buildQueueItem(J){let Z=J.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join(" ").trim(),X=Z.split(`
|
|
6595
6595
|
`)[0],Y=Z.includes(`
|
|
6596
|
-
`)?`${X}...`:Z,K=new
|
|
6597
|
-
`))return null;return{start:X,end:Q,query:Y,trigger:"@"}}findWordStart(J,Q){let Z=Q;for(let X=Q-1;X>=0;X--){let Y=J[X];if(!Y||/[\s([{]/.test(Y)){Z=X+1;break}if(X===0)Z=0}return Z}}function VF6(J,Q){switch(J){case"update-available":return[new N1("A newer Amp is available. Run ",new $1({color:Q.foreground,dim:!0})),new N1("amp update",new $1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new N1("Update complete, run ",new $1({color:Q.foreground,dim:!0})),new N1("amp update",new $1({color:Q.warning})),new N1(" to see warnings",new $1({color:Q.foreground,dim:!0}))];case"update-error":return[new N1("Update failed, run ",new $1({color:Q.foreground,dim:!0})),new N1("amp update",new $1({color:Q.warning})),new N1(" to see warnings",new $1({color:Q.foreground,dim:!0}))];case"hidden":return null}}function kH9(J){return[{match:(Q)=>Q.startsWith("$$"),display:"$$",style:new $1({color:J.app.shellModeHidden}),spacing:1,concealPrefix:!0},{match:(Q)=>Q.startsWith("$")&&!Q.startsWith("$$"),display:"$",style:new $1({color:J.app.shellMode}),spacing:1,concealPrefix:!0}]}class wF6 extends c0{dependencies;constructor(J){super();this.dependencies=J}createState(){return new RF6}}class RF6 extends d0{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;randomAd=null;adSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isConfirmingClearInput=!1;copyMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;isShowingQRCodeOverlay=!1;confirmationOverlayContent="";qrCodeOverlayData=null;exitConfirmTimeout=null;clearInputConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;threadsForPicker=[];isLoadingThreads=!1;previewThread=null;previewCache=new Map;previewScrollController=new jY;showingSelectionCopiedHint=!1;isShowingThreadPicker=!1;agentModePulseSeq=0;messageViewFocusNode=new Q9({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new Q9({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;agentModeSubscription=null;currentAgentMode="smart";hasToggledAgentMode=!1;inMemoryAgentModeOverride=null;cachedVisibleModes=MZ();freeTierStatus=void 0;updateState="hidden";updateServiceSubscription=null;isMessageViewInSelectionMode=!1;getEffectiveAgentMode(){return this.inMemoryAgentModeOverride??this.currentAgentMode}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Z=J.items.filter((K)=>K.type==="toolResult").filter((K)=>K.toolResult.run.status==="in-progress"||K.toolResult.run.status==="queued"),X=J.subagentActiveTools.filter((K)=>K.toolRun.status==="in-progress"||K.toolRun.status==="queued");return[...Z,...X].length>0}parseShellModeInput(J){if(J.startsWith("$$")){let Q=J.slice(2).trim();return Q?{cmd:Q,hidden:!0}:null}if(J.startsWith("$")){let Q=J.slice(1).trim();return Q?{cmd:Q,hidden:!1}:null}return null}isSlashCommand(J){if(!J.startsWith("/"))return!1;if((J.split(" ")[0]?.slice(1)||"").includes("/"))return!1;return!0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new N1(this.submitDisabledHint,new $1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new N1("",void 0,[new N1("Ctrl+C",new $1({color:Q.keybind})),new N1(" again to exit",new $1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new N1("",void 0,[new N1("Esc",new $1({color:Q.keybind})),new N1(" again to clear input",new $1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new N1("",void 0,[new N1("Escape",new $1({color:Q.keybind})),new N1(" to close help",new $1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let X=this.getEffectiveAgentMode(),Y=Zp1(X);return new N1("",void 0,[new N1("Images aren't supported in ",new $1({color:J.warning,dim:!1})),new N1(X,new $1({color:Y})),new N1(" mode.",new $1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0)return new N1("",void 0,[new N1("Esc",new $1({color:Q.keybind})),new N1(" to cancel",new $1({color:J.foreground,dim:!0}))]);if(this.showingSelectionCopiedHint)return new N1("Selection copied to clipboard",new $1({color:J.foreground,dim:!0}));if(this.showingCannotToggleMessage)return new N1(this.showingCannotToggleMessage,new $1({color:J.warning,dim:!1}));let Z=VF6(this.updateState,J);if(Z)return new N1("",void 0,Z);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Z}=this.widget.dependencies;if(!Q.mainThread?.id)return;let Y=Q.mainThread?.messages.findIndex((K)=>K===J);if(Y===void 0||Y===-1)return;try{this.cancelBashInvocations(),await Z.cancel(),await Z.handle({type:"thread:truncate",fromIndex:Y}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(K){u.error("Failed to edit message:",K)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Z,threadSyncService:X,switchToThread:Y}=this.widget.dependencies,K=Q.mainThread?.id;if(!K)return;let G=Q.mainThread?.messages.findIndex((q)=>q===J);if(G===void 0||G<=0)return;try{let q=await HJ.getOrCreateForThread(Z,K),z=await Vs(q,X,G),U=await Y(z);sV(U),this.widget.dependencies.worker=U,this.widget.dependencies.threadID=U.thread.id;let W=U.thread.agentMode??null;this.setState(()=>{this.inMemoryAgentModeOverride=W})}catch(q){u.error("Failed to fork thread:",q),this.showErrorMessage(`Failed to fork thread: ${q}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Z,worker:X}=this.widget.dependencies,Y=Z.mainThread;if(!Y)return;let K=Y.messages.findIndex((G)=>G===J);if(K===-1)return;try{this.cancelBashInvocations(),await X.cancel(),this.widget.dependencies.history.add(Q);let G=[{type:"text",text:Q}];if(this.imageAttachments.length>0)G.push(...this.imageAttachments);let q={content:G,agentMode:Y.agentMode},z=K===0;if(Y.agentMode&&!z&&q.agentMode!==Y.agentMode){u.error(`Cannot edit message: This thread uses ${Y.agentMode} mode. To change mode, create a new thread.`);return}await X.handle({type:"user:message",message:q,index:K}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(G){u.error("Failed to edit message:",G)}};textController=new eK;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new jY);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let Y=this.searchElementTreeByKey(X,Q);if(Y)return Y}return null}clearActiveSelection(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller?.hasSelection)return Q.controller.clearSelection(),this.setState(()=>{}),!0}return!1}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{if(this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Z=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Z}`:"";process.stdout.write(Oh1(X))}}_handleTextCopy(J){if(J&&J.length>0){if(this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}textFieldKey=new a7("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;commands=null;paletteCommands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Q=J.startsWith("$$")?"hidden":J.startsWith("$")?"normal":void 0;if(Q!==this.currentShellModeStatus)this.currentShellModeStatus=Q,this.setState(()=>{})};getCommands(){if(!this.commands)this.commands=new Mh1(this.widget.dependencies.commandRegistry,this.widget.dependencies.configService);return this.commands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new Pu1(this.getCommands(),this.widget.dependencies.fuzzyServer,new Ud(this.widget.dependencies.configService),this.widget.dependencies.configService,this.widget.dependencies.threadFuzzyIndexer);return this.completionBuilder}navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.setState(()=>{this.isShowingIdePicker=!1});return}try{await this.connectToSelectedIde(J,Q)}catch(Z){let X=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.setState(()=>{this.isShowingIdePicker=!1})};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}showCommandPalette(){if(!this.isShowingPalette)this.loadThreadsForPicker();this.setState(()=>{this.isShowingPalette=!this.isShowingPalette})}getPaletteCommands(){if(!this.paletteCommands)this.paletteCommands=new Lu1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})});return this.paletteCommands}dismissPalette=()=>{this.isShowingPalette=!1,this.setState(()=>{this.previewThread=null})};handleThreadPreview=async(J)=>{if(J===null){this.setState(()=>{this.previewThread=null});return}if(this.previewCache.has(J)){this.setState(()=>{this.previewThread=this.previewCache.get(J)??null});return}let Q=await this.widget.dependencies.threadService.get(J);if(Q)this.previewCache.set(J,Q),this.setState(()=>{this.previewThread=Q})};getCommandPaletteContext=(J)=>{let{threadState:Q}=this.widget.dependencies;if(!Q.mainThread)return null;return{worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.onOpenInEditor,takeImageAttachments:()=>{let Z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),Z},editorDispatch:(Z)=>{if(Z.type==="set-input")this.textController.clear(),this.textController.insertText(Z.input);else if(Z.type==="clear")this.textController.clear()},submitMessage:(Z)=>{return this.proceedWithUserMessage(Z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},onShowQRCodeOverlay:this.showQRCodeOverlay,settingsFilePath:this.widget.dependencies.settingsStorage.getSettingsFilePath(),settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,startNewThread:async()=>{let Z=await this.widget.dependencies.startNewThread();sV(Z)},switchToThread:async(Z)=>{await this.switchToExistingThread(Z)},handleHandoff:async(Z)=>{let X=Z.trim();if(!X){this.setState(()=>{this.displayMessage=Error("Cannot handoff with empty prompt text")});return}try{let Y=this.widget.dependencies.threadState.mainThread?.id;if(!Y){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let K=new AbortController,G=setTimeout(()=>K.abort(),20000),q=await this.widget.dependencies.threadService.createHandoffThread(Y,X,this.widget.dependencies.configService,K.signal);clearTimeout(G),await this.switchToExistingThread(q)}catch(Y){u.error("Failed to create handoff thread",Y),this.setState(()=>{this.displayMessage=Error(`Failed to create handoff: ${Y instanceof Error?Y.message:String(Y)}`)})}},getGuidanceFiles:async()=>{if(!Q.mainThread)return[];return(await I_({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,J.signal)).map((X)=>({uri:X.uri,type:X.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(Z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=Z,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode}};getThreadsForPicker(){return this.threadsForPicker}async loadThreadsForPicker(){if(this.isLoadingThreads)return;this.isLoadingThreads=!0;try{let Q=await new Ud(this.widget.dependencies.configService).fetchThreadSummaries("",0,50);if(Q.ok){let Z=this.widget.dependencies.threadID;this.setState(()=>{this.threadsForPicker=Q.threads.filter((X)=>X.id!==Z).map((X)=>({id:X.id,title:X.title,messageCount:X.messageCount,timeAgo:X.description.timeAgo,shortThreadID:X.description.shortThreadID}))})}}finally{this.isLoadingThreads=!1}}removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{hidden:Q})=>{let Z=Date.now(),X=`bash-${Z}-${Math.random().toString(36).substring(7)}`,Y={cmd:J},K=new AbortController;this.widget.dependencies.worker.invokeBashTool(Y,K.signal,Q).subscribe({next:(G)=>{this.setState(()=>{if(this.bashInvocations.find((z)=>z.id===X))this.bashInvocations=this.bashInvocations.map((z)=>z.id===X?{...z,toolRun:G}:z);else{let z={id:X,args:Y,toolRun:G,startTime:Z,abortController:K,hidden:Q};this.bashInvocations=[...this.bashInvocations,z]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleAgentMode=()=>{if((dK()||this.widget.dependencies.worker).thread.messages.length>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.inMemoryAgentModeOverride??this.currentAgentMode,Y=qc(X,this.cachedVisibleModes);if(Y!==X)this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.inMemoryAgentModeOverride??this.currentAgentMode,Z=qc(Q,this.cachedVisibleModes);if(Z===Q)return;if(this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Z,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),Z==="free")this.checkAndShowFreeModeModal()};checkAndShowFreeModeModal=()=>{if(this.freeTierStatus?.canUseAmpFree)return;if(this.freeTierStatus){if(!this.freeTierStatus.eligible){this.setState(()=>{this.showingCannotToggleMessage="Amp Free is unavailable. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}else if(!this.freeTierStatus.workspaceAllowsAmpFree){this.setState(()=>{this.showingCannotToggleMessage="Your workspace does not allow Amp Free. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}}};isInRestrictedFreeMode(){if(this.getEffectiveAgentMode()!=="free")return!1;if(this.freeTierStatus?.canUseAmpFree)return!1;return!0}onOpenInEditor=async(J)=>{let{execSync:Q}=await import("node:child_process"),{mkdtemp:Z,readFile:X,unlink:Y,rmdir:K,writeFile:G}=await import("node:fs/promises"),{tmpdir:q}=await import("node:os"),z=await import("node:path"),U=process.env.EDITOR||process.env.VISUAL||"nano";try{D2.instance.tuiInstance.suspend();let W=await Z(z.join(q(),"amp-edit-")),F=z.join(W,"message.amp.md");await G(F,J,"utf-8"),Q(`${U} "${F}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let H=await X(F,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")u.error("Failed to read temporary file",H)}try{await Y(F),await K(W)}catch(H){u.warn("Failed to clean up temporary file",H)}D2.instance.tuiInstance.resume()}catch(W){try{D2.instance.tuiInstance.resume()}catch{}u.error("Error opening editor:",W)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=this.parseShellModeInput(J);if(Q){if(Q.cmd&&!this.isProcessing())this.invokeBashCommand(Q.cmd,{hidden:Q.hidden}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();else this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}let Z=mX6(J),{threadState:X}=this.widget.dependencies;if(this.isSlashCommand(Z)&&X.mainThread){let Y=Z.slice(1).split(" "),K=Y[0],G=Y.slice(1).filter((q)=>q.trim()!=="");if(K){let q=X.viewState,z=this.getCommands().query(K,X.mainThread,q).filter((U)=>U.name===K).pop();if(z){if((z.requiresArgs||z.requiresPicker)&&G.length===0){this.textController.clear(),this.textController.insertText(`/${K} `);return}this.textController.clear(),this.resetHistory(),await this.executeCommand(z,G)}else if(K==="compact")this.setState(()=>{this.displayMessage=Error("The /compact command has been removed. Use /handoff to draft a new thread with relevant context instead.")}),this.textController.clear();return}}this.textController.clear(),this.resetHistory(),await this.sendUserMessage(Z)};onOptionSelected=(J)=>{switch(J.type){case"hint":return;case"command":{let Q=`/${J.name} `;this.onTextSubmitted(Q);break}case"file":{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=Q.slice(0,Z).lastIndexOf("@");if(Y!==-1){let K=Q.slice(0,Y),G=Q.slice(Z),q=K+`@${J.path} `+G;this.textController.clear(),this.textController.insertText(q),this.textController.cursorPosition=Y+1+J.path.length+1}break}case"thread":{let Q=this.textController.text,Z=this.textController.cursorPosition,X=Q.split(" ");if(X.length>=1&&X[0]==="/continue"){let Y=`/continue ${J.threadId} `;this.onTextSubmitted(Y)}else{let K=Q.slice(0,Z).lastIndexOf("@");if(K!==-1){let G=Q.slice(0,K),q=Q.slice(Z),z=G+`@${J.threadId} `+q;this.textController.clear(),this.textController.insertText(z),this.textController.cursorPosition=K+1+J.threadId.length+1}}break}case"argument":{let Z=this.textController.text.split(" ");if(Z.length>=1&&Z[0]?.startsWith("/")){let Y=`${Z[0]} ${J.value} `;this.onTextSubmitted(Y)}break}}};executeCommand=async(J,Q)=>{let{threadState:Z}=this.widget.dependencies;if(!Z.mainThread||!J)return;let X=new AbortController,Y=Date.now(),G={id:`command-${Y}-${Math.random().toString(36).substring(7)}`,name:J.name,statusMessage:J.statusMessage,startTime:Y,abortController:X};this.setState(()=>{this.executingCommand=G});try{if(J.name==="new"){let z=await this.widget.dependencies.startNewThread();sV(z);return}if(J.name==="handoff"){let z=Q?.join(" ").trim()||"";if(!z){this.setState(()=>{this.displayMessage=Error("Usage: /handoff <describe your goal>")});return}try{let U=this.widget.dependencies.threadState.mainThread?.id;if(!U){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let W=new AbortController,F=setTimeout(()=>W.abort(),20000),H=await this.widget.dependencies.threadService.createHandoffThread(U,z,this.widget.dependencies.configService,W.signal);clearTimeout(F),await this.switchToExistingThread(H)}catch(U){u.error("Failed to create handoff thread",U),this.setState(()=>{this.displayMessage=Error(`Failed to create handoff: ${U instanceof Error?U.message:String(U)}`)})}return}if(J.launchesWindow)D2.instance.tuiInstance.suspend();let q=await this.getCommands().execute(J.name,{worker:this.widget.dependencies.worker,thread:Z.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,takeImageAttachments:()=>{let z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),z},editorDispatch:(z)=>{if(z.type==="set-input")this.textController.clear(),this.textController.insertText(z.input);else if(z.type==="clear")this.textController.clear()},submitMessage:(z)=>{return this.proceedWithUserMessage(z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},showCommandOverlay:(z)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=z})},onShowQRCodeOverlay:this.showQRCodeOverlay,settingsFilePath:this.widget.dependencies.settingsStorage.getSettingsFilePath(),settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,startNewThread:async()=>{await this.widget.dependencies.startNewThread()},pickAndContinueThread:this.widget.dependencies.pickAndContinueThread,switchToThread:async(z)=>{await this.switchToExistingThread(z)},openInEditor:this.onOpenInEditor,getGuidanceFiles:async()=>{if(!Z.mainThread)return[];return(await I_({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Z.mainThread,X.signal)).map((U)=>({uri:U.uri,type:U.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=z,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode},Q,X.signal);if(J.launchesWindow)D2.instance.tuiInstance.resume();if(q)this.setState(()=>{this.displayMessage=q})}catch(q){u.error("Error executing command:",q)}finally{this.setState(()=>{this.executingCommand=null})}};buildOptions=async(J)=>{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=new Wd().detect(Q,Z);if(Y){let{threadState:K}=this.widget.dependencies;return await this.getCompletionBuilder().buildOptions(Y,K.mainThread,K.viewState)}return[]};initState(){if(NY.getInstance().interceptConsole(),this.widget.dependencies.startWithPicker)this.isShowingThreadPicker=!0;D2.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),D2.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),D2.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Z)=>{c9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Z.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus;let J=uX6(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus);u.info(`[initState] Resolved agentMode: ${J}`),this.inMemoryAgentModeOverride=J,this.adSubscription=Df1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride==="free"||this.randomAd===null)&&Bf1(this.lastUserInteractionTime)}).subscribe({next:(Z)=>{if(Z){let X=SH9(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (yQ1(),bQ1)).then(({recordAdEvent:Y})=>{let K=this.widget.dependencies.worker.thread,G=K.messages[K.messages.length-1];Y("viewed",{adId:Z.id,advertiserId:Z.advertiserId,threadId:K.id,messageId:G?.messageId,impressionId:X,placement:"tui"})})}this.setState(()=>{this.randomAd=Z})}}),sV(this.widget.dependencies.worker),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Z)=>{this.setState(()=>{this.ideStatus=Z})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Z)=>{let X=dK();if(!X){u.warn("No active thread worker found to handle IDE message");return}await new Promise((Y)=>setTimeout(Y,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Z}]}}),u.debug("Message sent from IDE to agent",{message:Z.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Z)=>{this.textController.insertText(Z),u.debug("Appended text to CLI prompt from IDE",{text:Z.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Z)=>{this.setState(()=>{this.connectedClientsStatus=Z})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Z)=>{this.setState(()=>{this.updateState=Z})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((Z)=>{let X=MZ(Z.settings);this.setState(()=>{this.cachedVisibleModes=X})}),this.textController.addListener(this.textChangeListener),this.getCommands(),this.textController.onInsertText=(Z,X)=>{if(Z.length<=3)return!0;let Y=dX6(Z);if(!Y)return!0;let K=this.getEffectiveAgentMode();if(!Gc(K)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=E10)return!1;let G=cX6(Y);if(G)return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,G]}),!1;return this.setState(()=>{this.displayMessage=Error("Failed to attach image: file may be empty, too large, or unsupported")}),!1},this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Z)=>{let X=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;if(this.textController.removeListener(this.textChangeListener),this.commands)this.commands.cleanup().catch((J)=>{u.debug("Failed to cleanup commands during disposal",J)});for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(Oh1("")),this.shouldUseProgressBar())process.stdout.write(vG6())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,X=[...J.items.filter((q)=>q.type==="toolResult").map((q)=>({toolUse:q.toolUse,toolRun:q.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((q)=>q.toolRun.status==="blocked-on-user");if(X.length===0)return null;let Y=X[0],K=Y.toolRun.status==="blocked-on-user"?Y.toolRun.toAllow??[]:[],G=Y.toolRun.status==="blocked-on-user"?Y.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:Y.toolUse,toAllow:K}],subthreadID:Y.subthreadID,reason:G}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){u.error("No current tool confirmation found");return}let Z=Q.tools[0]?.useBlock;if(!Z){u.error("No tool use block found in confirmation");return}if(J==="allow-all-session")VZ("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0)}catch(Y){if(Y&&Y instanceof Error)this.setState(()=>{this.displayMessage=Y});else u.error("Failed to write dangerouslyAllowAll setting:",Y);return}if(J==="always-guarded"){let Y=Q.tools[0]?.toAllow??[],K=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],G=[...Y,...K];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",G)}if(J==="connect-github"){let Y=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();try{await AY(Y)}catch(K){u.error("Failed to open settings page:",K),await this.showErrorMessage(`Cannot open browser. Please go to ${Y} to connect to GitHub`)}return}if(J==="disable-librarian"){let Y=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!Y.includes(Qz))await this.widget.dependencies.settingsStorage.set("tools.disable",[...Y,Qz])}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let Y={type:"user:tool-input",toolUse:Z.id,value:{accepted:X}};if(Q.subthreadID)await(await HJ.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(Y);else await this.widget.dependencies.worker.handle(Y)}catch(Y){u.error("Failed to send tool confirmation:",Y)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};showQRCodeOverlay=(J)=>{this.setState(()=>{this.isShowingQRCodeOverlay=!0,this.qrCodeOverlayData=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Z=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Z)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Z=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Z.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null});let X=await this.widget.dependencies.startNewThread();sV(X);break}case"new-smart-thread":{this.setState(()=>{this.inMemoryAgentModeOverride="smart",this.dismissedEphemeralErrorKey=null}),Uf1({agentMode:"smart"});let X=await this.widget.dependencies.startNewThread();sV(X);break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};cancelStreamingMessage=async()=>{await HJ.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="user"&&!Z.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J)=>{try{u.info(`[switchToExistingThread] Switching to thread: ${J}`);let Q=await this.widget.dependencies.switchToThread(J),Z=Q.thread.agentMode??null;if(u.info(`[switchToExistingThread] Thread ${J} has agentMode: ${Z??"null"}`),this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,sV(Q),D51()?.switchWorker(this.widget.dependencies.worker),this.setState(()=>{u.info(`[switchToExistingThread] Setting inMemoryAgentModeOverride to: ${Z??"null"}`),this.inMemoryAgentModeOverride=Z}),Q.thread.draft)u.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),this.textController.insertText(Q.thread.draft)}catch(Q){throw u.error("Failed to switch to thread:",J,Q),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=dK()||this.widget.dependencies.worker,Z=Q.thread.messages.length===0,X=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Z&&X!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let Y=[{type:"text",text:J}];if(this.imageAttachments.length>0)Y.push(...this.imageAttachments);await Q.handle({type:"user:message",message:{content:Y,agentMode:this.getEffectiveAgentMode()}}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{let J=this.getEffectiveAgentMode();Uf1({agentMode:J}).catch((Q)=>{u.warn("Failed to save session state on exit:",Q)}).finally(()=>{D2.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=vH9();if(J===Q)return"~";if(J.startsWith(Q+Fd.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Fd.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Fd.sep),"…",Q.slice(-2).join(Fd.sep)].join(Fd.sep)}build(J){let Q=_8.of(J),Z=i6.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let q=(dK()||this.widget.dependencies.worker).thread.agentMode==="free"&&this.randomAd!==null,{threadState:z}=this.widget.dependencies;if(this.isShowingThreadPicker)return new DN({child:new tu1({onSelect:async(w1)=>{if(w1)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(w1);else process.exit(0)},pageSize:50,threadFetcher:new Ud(this.widget.dependencies.configService)})});this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),W=z.todosList,F=z.mainThread?.id,H=z.mainThread||void 0,B=this.isTranscriptEmpty(),M=(w1)=>new DQ1({key:new a7(`preview-message-view-${w1.id}`),items:pu(w1).items,controller:this.previewScrollController,autofocus:!1,thread:w1,focusNode:new Q9({debugLabel:"PreviewFocus"})}),V=this.previewThread?M(this.previewThread):B?new MQ1({agentMode:this.getEffectiveAgentMode()}):new DQ1({key:F?new a7(`message-view-${F}`):void 0,items:z.items,subagentToolsByParentID:z.subagentToolsByParentID,controller:F?this.getMessageScrollController(F):new jY,autofocus:!1,onCopy:this._handleTextCopy.bind(this),thread:H,onMessageEditSubmit:this.handleMessageEditSubmit,onMessageRestoreSubmit:this.handleMessageRestoreSubmit,onMessageForkSubmit:this.forkMessage,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),N=Math.max(Math.floor(Q.size.height*0.4),12),L=this.getCurrentEphemeralError(),A=this.buildBottomWidget(L,U,Y,Z,z,W,N,q?this.randomAd:null),w=Q.size.width<40,R=z.mainThread?Tn1(z.mainThread):void 0,O=new bJ1({threadViewState:z.viewState,threadTokenUsage:R,threadID:F??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:w,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),j=new xJ1({bashInvocations:this.bashInvocations}),$=[],E=this.getEffectiveAgentMode(),I=this.currentShellModeStatus,T=Zp1(E),S=!I?E.length+1:0,x=Q.capabilities.animationSupport,h=x==="disabled"?0:x==="slow"?30:60,v=1,_=h>0&&this.agentModePulseSeq>0?new TJ({children:[A,new wX({top:0,left:1,right:1,height:1,child:new au1({color:T,trigger:this.agentModePulseSeq,fps:h,speed:v,leftOffset:S})})]}):A;if($.push(new R8({child:V}),j),q)$.push(new Vu1({ad:this.randomAd,onButtonClick:async()=>{let w1=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (yQ1(),bQ1)).then(({recordAdEvent:D1})=>{let y1=this.widget.dependencies.worker.thread,l1=y1.messages[y1.messages.length-1];D1("clicked",{adId:w1.id,advertiserId:w1.advertiserId,threadId:y1.id,messageId:l1?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to"})});try{await AY(w1.shortDestinationUrl)}catch(D1){let l1=D2.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:l1,url:w1.shortDestinationUrl}})}}}));$.push(new y0({constraints:new w6(0,Q.size.width,0,N),child:_}),new U0({height:1,child:new x6({padding:V0.horizontal(1),child:O})}));let b=new i0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:$}),g=new S9(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingQRCodeOverlay)return this.setState(()=>{this.isShowingQRCodeOverlay=!1,this.qrCodeOverlayData=null}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return u.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.markLastUserMessageAsInterrupted().catch((D1)=>{u.error("Failed to mark message as interrupted:",D1)}),this.cancelStreamingMessage().catch((D1)=>{u.error("Failed to cancel streaming message:",D1)}),"handled";if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),k=new S9(()=>{return this.onExitPressed(),"handled"}),y=new S9(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),f=new S9(()=>{return wQ.instance.toggleAll(),"handled"}),m=new S9(()=>{return this.widget.dependencies.configService.getLatest().then((w1)=>{VZ("internal.showCost",!(w1.settings["internal.showCost"]??!0))}),"handled"}),n=new S9(()=>{return D2.instance.toggleFrameStatsOverlay(),"handled"}),p=new S9(()=>{return D2.instance.tuiInstance.getScreen().markForRefresh(),c9.instance.requestFrame(),"handled"}),e=new S9(()=>{return this.toggleAgentMode(),"handled"}),G1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1){let y1=Math.max(Math.floor(Q.size.height*0.4),10),l1=Q.size.height-y1;D1.animatePageUp(l1,100)}return"handled"}),U1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1){let y1=Math.max(Math.floor(Q.size.height*0.4),10),l1=Q.size.height-y1;D1.animatePageDown(l1,100)}return"handled"}),Z1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1)D1.animateTo(0,100);return"handled"}),F1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1)D1.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),l=new S9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:w1}=this.widget.dependencies;if(!w1.mainThread?.messages.some((y1)=>y1.role==="user"))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),d=new S9((w1)=>{if(w1.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),i=new Map([[b6.ctrl("c"),new kp],[b6.ctrl("l"),new fp],[b6.ctrl("o"),new AJ1],[b6.alt("s"),new gC],[b6.ctrl("s"),new gC],[b6.alt("p"),new yp],[b6.ctrl("r"),new xp],[b6.alt("d"),new bp],[b6.key("PageUp"),new MJ1],[b6.key("PageDown"),new VJ1],[b6.key("Home"),new NJ1],[b6.key("End"),new LJ1],[b6.key("Escape"),new vp],[b6.ctrl("p"),new mC("previous")],[b6.ctrl("n"),new mC("next")],[b6.key("Tab"),new hp],[b6.key("ArrowUp"),new hp]]);if(!1)i.set(b6.alt("c"),new _p);let o=new S9(()=>{return this.showCommandPalette(),"handled"}),Y1=new Map([[vp,g],[fp,p],[gC,e],[AJ1,o],[_p,y],[xp,f],[bp,m],[yp,n],[kp,k],[MJ1,G1],[VJ1,U1],[NJ1,Z1],[LJ1,F1],[hp,l],[mC,d]]),J1=[b];if(this.isShowingConsoleOverlay)J1.push(new Su1);if(this.isShowingHelp)J1.push(new _u1);if(this.adActionModal)J1.push(new Nu1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(w1)=>{let D1=this.adActionModal.url;if(w1==="copy")try{await D2.instance.tuiInstance.clipboard.writeText(D1),this.setState(()=>{this.displayMessage=new q2("Link copied to clipboard")})}catch(y1){u.error("Failed to copy to clipboard",{error:y1}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.isShowingFileChangesOverlay)J1.push(new Ig1);if(this.isShowingCostBreakdownOverlay&&z.mainThread)J1.push(new vu1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)J1.push(new Tu1({details:this.confirmationOverlayContent}));if(this.isShowingQRCodeOverlay&&this.qrCodeOverlayData)J1.push(new su1({url:this.qrCodeOverlayData.url,qrCode:this.qrCodeOverlayData.qrCode}));let H1=this.getCommandPaletteContext(new AbortController);if(H1&&this.isShowingPalette){let w1=this.getThreadsForPicker();J1.push(new C9({child:new y0({constraints:w6.loose(80,20),child:new $u1({commandContext:H1,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,threads:w1,onThreadPreview:this.handleThreadPreview})})}))}if(this.isShowingIdePicker)J1.push(new xu1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let z1=new TJ({children:J1});if(this.isShowingJetBrainsInstaller)return new DN({child:new HZ({actions:Y1,child:new dq({shortcuts:i,debugLabel:"jetbrains-installer-shortcuts",child:new nu1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let W1=new MN({onError:(w1)=>{this.showErrorMessage(w1.message)},child:z1});return new DN({child:new HZ({actions:Y1,child:new dq({shortcuts:i,debugLabel:"main-app-shortcuts",child:W1})})})}buildBottomWidget(J,Q,Z,X,Y,K,G,q){if(J)return new ku1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Cu1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new ru1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let z=X.app,U=kH9(X),W=this.isInRestrictedFreeMode(),F=new $J1({key:this.textFieldKey,controller:this.textController,triggers:[new Wd],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(S)=>Iu1(S),overlayBorderColor:Z.border,focusNode:this.autocompleteFocusNode,canStealFocus:!this.isMessageViewInSelectionMode,textFieldProps:{placeholder:W?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!1,enabled:this.isTextfieldAndAutocompleteFocused&&!W,onSubmitted:this.onTextSubmitted,onOpenInEditor:this.onOpenInEditor,submitKey:{character:"Enter"},prompts:U,style:{border:null},clipboard:D2.instance.tuiInstance.clipboard},optionViewBuilder:(S,x,h)=>{let v=h?Z.selection:void 0,_=x.type==="command"||x.type==="thread"?Z.warning:Z.secondary,b=Z.foreground,g=Z.foreground,k,y;switch(x.type){case"command":k="/",y=x.name;break;case"file":k="@",y=x.path;break;case"thread":k="@",y=x.title;break;case"hint":k="",y=x.message;break;default:k="",y=Iu1(x);break}let f=PW6(x),m=new N1(k,new $1({color:_})),n=new N1(y,new $1({color:b})),p=[m,n];if(f){let e=new N1(" - ",new $1({color:g,dim:!0})),G1=new N1(f,new $1({color:g,dim:!0}));p.push(e,G1)}return new y0({decoration:new i8(v),child:new n1({text:new N1("",void 0,p),maxLines:1,overflow:"ellipsis"})})}}),H=Y.mainThread?.queuedMessages??[],B=this.currentShellModeStatus,M=this.imageAttachments.length>0?new y0({padding:V0.only({bottom:1,left:1}),child:new n1({text:new N1("",void 0,[new N1("Images: ",new $1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((S,x)=>[new N1(`[image ${x+1}]`,new $1({color:Z.success})),...x<this.imageAttachments.length-1?[new N1(" ")]:[]])])})}):null,V=Array.isArray(K)&&K.length>0,N=Array.isArray(H)&&H.length>0,L=[];if(M)L.push(M);L.push(new R8({child:F}));let A=new i0({crossAxisAlignment:"start",children:L}),w=N?new ou1({queuedMessages:H}):void 0,R=V?new fh1(new Mu1({todos:K,enabled:this.isTextfieldAndAutocompleteFocused&&!W}),{clipBehavior:"antiAlias"}):void 0,O=[];if(B)O.push({text:new N1(B==="hidden"?"shell mode (incognito)":"shell mode",new $1({color:B==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:M?1:0});let j=this.getEffectiveAgentMode();if(!B&&this.cachedVisibleModes.length>1){let S=Zp1(j),h=qc(j,this.cachedVisibleModes)!==j,_=(dK()||this.widget.dependencies.worker).thread.messages.length===0,g=W||!this.hasToggledAgentMode&&h&&_?new N1("",void 0,[new N1(j,new $1({color:S})),new N1(" (click or ",new $1({color:Z.foreground,dim:!0})),new N1("Ctrl+S",new $1({color:z.keybind})),new N1(" to switch)",new $1({color:Z.foreground,dim:!0}))]):new N1(j,new $1({color:S}));O.push({text:g,position:"top-left",offsetY:0,onClick:_?this.toggleAgentMode:void 0})}let $=Y.mainThread?.metadata?.treeInfo?.uri,E;if($)E=O0.isUri($)?$.fsPath:$;else E=process.cwd();let I=this.toHomeRelative(E),T=this.shorten(I);return O.push({text:new N1(T,new $1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new Vg1({leftChild:A,rightChild1:w,rightChild2:R,maxHeight:G,overlayTexts:O,borderColor:W||!this.isTextfieldAndAutocompleteFocused?E1.index(8):void 0,hasBanner:q!==null})}}async function OF6(J){let X=new eH(!1,1000,J.inspectorPort),Y=new ky1({threadService:J.threadService,worker:J.worker,builder:(H,B)=>{let M=dK(),V=M?.thread.id||J.threadID,N={...J,worker:M||J.worker,threadID:V};return new wF6({...N,threadState:B})}}),K=new Og1({configService:J.configService,child:Y}),G=new Ag1({configService:J.configService,child:K}),q=new rh1(G),z=new i6({data:pC.fromBaseTheme(tK.default()),child:q});try{await bh1(z,{onRootElementMounted:void 0})}finally{}let W=dK()?.thread.id||J.threadID;if((await J.threadService.get(W))?.messages.length!==0){let H=`${J.ampURL.replace(/\/$/,"")}/threads/${W}`;J.stdout.write(`
|
|
6596
|
+
`)?`${X}...`:Z,K=new j1({color:E1.index(8)});return new x6({padding:V0.only({bottom:0}),child:new X8({crossAxisAlignment:"start",children:[new x6({padding:V0.only({right:1}),child:new n1({text:new N1("•",new j1({color:E1.index(8)}))})}),new R8({child:new n1({text:new N1(Y,K)})})]})})}}LW();var IH9=Q1.string(),DF6=Q1.object({id:IH9,title:Q1.string().optional(),messageCount:Q1.number(),updatedAt:Q1.string(),firstSyncAt:Q1.string(),created:Q1.number(),creatorUserID:Q1.string(),meta:Q1.object({visibility:Q1.enum(["private","public_unlisted","thread_workspace_shared"]),sharedGroupIDs:Q1.array(Q1.string())})});G0();pX();LW();var PH9=Q1.object({id:Q1.string()});function TH9(J){let Z=new Date().getTime()-J.getTime(),X=Math.floor(Z/3600000),Y=Math.floor(X/24),K=Math.floor(Y/7),G=Math.floor(Y/30);if(X<1)return"Just now";if(X<24)return`${X}h ago`;if(Y<7)return`${Y}d ago`;if(K<=4)return`${K}w ago`;return`${G}mo ago`}class Ud{configService;constructor(J){this.configService=J}async fetchThreadSummaries(J="",Q=0,Z=20){try{let X=await uJ("/api/user",void 0,this.configService);if(!X.ok)return{ok:!1,errorMsg:`Failed to get user info (${X.status})`};let Y;try{Y=PH9.parse(await X.json())}catch(W){return{ok:!1,errorMsg:"Invalid user data format from server"}}let K=new URLSearchParams({createdByUserID:Y.id,limit:String(Z),offset:String(Q*Z)}),G=await uJ(`/api/threads?${K}`,void 0,this.configService);if(!G.ok)return{ok:!1,errorMsg:`Failed to fetch threads (${G.status})`};let q;try{q=Q1.array(DF6).parse(await G.json())}catch(W){return u.error("failed to parse thread data from server",{error:W}),{ok:!1,errorMsg:"Invalid thread data format from server"}}return{ok:!0,threads:q.filter((W)=>W.messageCount>0).filter((W)=>{if(!J.trim())return!0;let F=W.title?.toLowerCase()||"untitled",H=W.id.toLowerCase(),B=J.toLowerCase();return F.includes(B)||H.includes(B)}).slice(0,Z).map((W)=>{let F=W.title||"Untitled",H=new Date(W.updatedAt),B=TH9(H),M=W.id.slice(-8);return{id:W.id,title:F,messageCount:W.messageCount,updatedAt:W.updatedAt,description:{timeAgo:B,title:F,shortThreadID:M}}})}}catch(X){return{ok:!1,errorMsg:X instanceof Error?X.message:"An unexpected error occurred"}}}}l8();class tu1 extends c0{props;constructor(J){super();this.props=J}createState(){return new MF6(this.props.pageSize,this.props.loadBuffer,this.props.autofocus??!0)}}class MF6 extends d0{pageSize;loadBuffer;autofocus;allThreads=[];isLoading=!1;currentPage=0;hasMoreToLoad=!0;error=null;constructor(J=20,Q=J*2,Z){super();this.pageSize=J;this.loadBuffer=Q;this.autofocus=Z}async initState(){await this.loadThreads()}async loadThreads(){if(this.isLoading||!this.hasMoreToLoad)return;this.isLoading=!0,this.error=null;try{let J=await this.widget.props.threadFetcher.fetchThreadSummaries("",this.currentPage,this.pageSize);if(!this.mounted)return;if(!J.ok){this.error=J.errorMsg,this.hasMoreToLoad=!1,this.setState();return}let Q=J.threads;if(Q.length===0)this.hasMoreToLoad=!1;else{let Z=new Set(this.allThreads.map((Y)=>Y.id)),X=Q.filter((Y)=>!Z.has(Y.id));this.allThreads=[...this.allThreads,...X],this.currentPage++}this.setState()}finally{this.isLoading=!1}}onChange=async(J)=>{if(this.allThreads.length-J<=this.loadBuffer&&this.hasMoreToLoad&&!this.isLoading)await this.loadThreads()};formatThreadDescription(J){let Z=`${String(J.messageCount)} msgs`.padEnd(8),X=J.description.timeAgo.padEnd(9);return`${Z} │ ${X}│ ${J.description.shortThreadID}`}build(J){let Q=(G)=>{if(G.ctrlKey&&G.key==="c"||G.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"};if(this.error)return new q9({autofocus:this.autofocus,onKey:Q,child:new n1({text:new N1(this.error)})});if(this.isLoading&&this.allThreads.length===0)return new q9({autofocus:this.autofocus,onKey:Q,child:new n1({text:new N1("Loading threads...")})});let Z=_8.sizeOf(J);if(this.allThreads.length===0&&!this.isLoading)return new q9({autofocus:this.autofocus,onKey:Q,child:new n1({text:new N1("No threads found.")})});let X=this.allThreads.map((G)=>({value:G.id,label:G.title,description:this.formatThreadDescription(G)})),Y=Math.max(5,Z.height);Y-=6;let K=Math.floor(Math.max(1,Y/2));return new q9({autofocus:this.autofocus,onKey:Q,child:new Yd({title:"Select a thread to continue:",options:X,onSelect:(G)=>{this.widget.props.onSelect(G)},onChange:this.onChange,maxVisibleItems:K,autofocus:this.autofocus})})}}M51();class Wd{detect(J,Q){if(!J||Q<1)return null;let Z=O2(J);if(Q>Z.length)return null;let X=this.findWordStart(Z,Q);if(X>=Z.length||Z[X]!=="@")return null;let Y=Z.slice(X+1,Q).join("");if(Y.includes(" ")||Y.includes("\t")||Y.includes(`
|
|
6597
|
+
`))return null;return{start:X,end:Q,query:Y,trigger:"@"}}findWordStart(J,Q){let Z=Q;for(let X=Q-1;X>=0;X--){let Y=J[X];if(!Y||/[\s([{]/.test(Y)){Z=X+1;break}if(X===0)Z=0}return Z}}function VF6(J,Q){switch(J){case"update-available":return[new N1("A newer Amp is available. Run ",new j1({color:Q.foreground,dim:!0})),new N1("amp update",new j1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new N1("Update complete, run ",new j1({color:Q.foreground,dim:!0})),new N1("amp update",new j1({color:Q.warning})),new N1(" to see warnings",new j1({color:Q.foreground,dim:!0}))];case"update-error":return[new N1("Update failed, run ",new j1({color:Q.foreground,dim:!0})),new N1("amp update",new j1({color:Q.warning})),new N1(" to see warnings",new j1({color:Q.foreground,dim:!0}))];case"hidden":return null}}function kH9(J){return[{match:(Q)=>Q.startsWith("$$"),display:"$$",style:new j1({color:J.app.shellModeHidden}),spacing:1,concealPrefix:!0},{match:(Q)=>Q.startsWith("$")&&!Q.startsWith("$$"),display:"$",style:new j1({color:J.app.shellMode}),spacing:1,concealPrefix:!0}]}class wF6 extends c0{dependencies;constructor(J){super();this.dependencies=J}createState(){return new RF6}}class RF6 extends d0{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;randomAd=null;adSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isConfirmingClearInput=!1;copyMessageTimer=null;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;isShowingQRCodeOverlay=!1;confirmationOverlayContent="";qrCodeOverlayData=null;exitConfirmTimeout=null;clearInputConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;threadsForPicker=[];isLoadingThreads=!1;previewThread=null;previewCache=new Map;previewScrollController=new jY;showingSelectionCopiedHint=!1;isShowingThreadPicker=!1;agentModePulseSeq=0;messageViewFocusNode=new Q9({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new Q9({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;agentModeSubscription=null;currentAgentMode="smart";hasToggledAgentMode=!1;inMemoryAgentModeOverride=null;cachedVisibleModes=MZ();freeTierStatus=void 0;updateState="hidden";updateServiceSubscription=null;isMessageViewInSelectionMode=!1;getEffectiveAgentMode(){return this.inMemoryAgentModeOverride??this.currentAgentMode}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Z=J.items.filter((K)=>K.type==="toolResult").filter((K)=>K.toolResult.run.status==="in-progress"||K.toolResult.run.status==="queued"),X=J.subagentActiveTools.filter((K)=>K.toolRun.status==="in-progress"||K.toolRun.status==="queued");return[...Z,...X].length>0}parseShellModeInput(J){if(J.startsWith("$$")){let Q=J.slice(2).trim();return Q?{cmd:Q,hidden:!0}:null}if(J.startsWith("$")){let Q=J.slice(1).trim();return Q?{cmd:Q,hidden:!1}:null}return null}isSlashCommand(J){if(!J.startsWith("/"))return!1;if((J.split(" ")[0]?.slice(1)||"").includes("/"))return!1;return!0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new N1(this.submitDisabledHint,new j1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new N1("",void 0,[new N1("Ctrl+C",new j1({color:Q.keybind})),new N1(" again to exit",new j1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new N1("",void 0,[new N1("Esc",new j1({color:Q.keybind})),new N1(" again to clear input",new j1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new N1("",void 0,[new N1("Escape",new j1({color:Q.keybind})),new N1(" to close help",new j1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let X=this.getEffectiveAgentMode(),Y=Zp1(X);return new N1("",void 0,[new N1("Images aren't supported in ",new j1({color:J.warning,dim:!1})),new N1(X,new j1({color:Y})),new N1(" mode.",new j1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0)return new N1("",void 0,[new N1("Esc",new j1({color:Q.keybind})),new N1(" to cancel",new j1({color:J.foreground,dim:!0}))]);if(this.showingSelectionCopiedHint)return new N1("Selection copied to clipboard",new j1({color:J.foreground,dim:!0}));if(this.showingCannotToggleMessage)return new N1(this.showingCannotToggleMessage,new j1({color:J.warning,dim:!1}));let Z=VF6(this.updateState,J);if(Z)return new N1("",void 0,Z);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Z}=this.widget.dependencies;if(!Q.mainThread?.id)return;let Y=Q.mainThread?.messages.findIndex((K)=>K===J);if(Y===void 0||Y===-1)return;try{this.cancelBashInvocations(),await Z.cancel(),await Z.handle({type:"thread:truncate",fromIndex:Y}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(K){u.error("Failed to edit message:",K)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Z,threadSyncService:X,switchToThread:Y}=this.widget.dependencies,K=Q.mainThread?.id;if(!K)return;let G=Q.mainThread?.messages.findIndex((q)=>q===J);if(G===void 0||G<=0)return;try{let q=await HJ.getOrCreateForThread(Z,K),z=await Vs(q,X,G),U=await Y(z);sV(U),this.widget.dependencies.worker=U,this.widget.dependencies.threadID=U.thread.id;let W=U.thread.agentMode??null;this.setState(()=>{this.inMemoryAgentModeOverride=W})}catch(q){u.error("Failed to fork thread:",q),this.showErrorMessage(`Failed to fork thread: ${q}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Z,worker:X}=this.widget.dependencies,Y=Z.mainThread;if(!Y)return;let K=Y.messages.findIndex((G)=>G===J);if(K===-1)return;try{this.cancelBashInvocations(),await X.cancel(),this.widget.dependencies.history.add(Q);let G=[{type:"text",text:Q}];if(this.imageAttachments.length>0)G.push(...this.imageAttachments);let q={content:G,agentMode:Y.agentMode},z=K===0;if(Y.agentMode&&!z&&q.agentMode!==Y.agentMode){u.error(`Cannot edit message: This thread uses ${Y.agentMode} mode. To change mode, create a new thread.`);return}await X.handle({type:"user:message",message:q,index:K}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(G){u.error("Failed to edit message:",G)}};textController=new eK;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new jY);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let Y=this.searchElementTreeByKey(X,Q);if(Y)return Y}return null}clearActiveSelection(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller?.hasSelection)return Q.controller.clearSelection(),this.setState(()=>{}),!0}return!1}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{if(this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Z=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Z}`:"";process.stdout.write(Oh1(X))}}_handleTextCopy(J){if(J&&J.length>0){if(this.setState(()=>{this.showingSelectionCopiedHint=!0}),this.copyMessageTimer)clearTimeout(this.copyMessageTimer);this.copyMessageTimer=setTimeout(()=>{this.setState(()=>{this.showingSelectionCopiedHint=!1}),this.copyMessageTimer=null},2000)}}textFieldKey=new a7("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;commands=null;paletteCommands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Q=J.startsWith("$$")?"hidden":J.startsWith("$")?"normal":void 0;if(Q!==this.currentShellModeStatus)this.currentShellModeStatus=Q,this.setState(()=>{})};getCommands(){if(!this.commands)this.commands=new Mh1(this.widget.dependencies.commandRegistry,this.widget.dependencies.configService);return this.commands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new Pu1(this.getCommands(),this.widget.dependencies.fuzzyServer,new Ud(this.widget.dependencies.configService),this.widget.dependencies.configService,this.widget.dependencies.threadFuzzyIndexer);return this.completionBuilder}navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.setState(()=>{this.isShowingIdePicker=!1});return}try{await this.connectToSelectedIde(J,Q)}catch(Z){let X=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.setState(()=>{this.isShowingIdePicker=!1})};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}showCommandPalette(){if(!this.isShowingPalette)this.loadThreadsForPicker();this.setState(()=>{this.isShowingPalette=!this.isShowingPalette})}getPaletteCommands(){if(!this.paletteCommands)this.paletteCommands=new Lu1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})});return this.paletteCommands}dismissPalette=()=>{this.isShowingPalette=!1,this.setState(()=>{this.previewThread=null})};handleThreadPreview=async(J)=>{if(J===null){this.setState(()=>{this.previewThread=null});return}if(this.previewCache.has(J)){this.setState(()=>{this.previewThread=this.previewCache.get(J)??null});return}let Q=await this.widget.dependencies.threadService.get(J);if(Q)this.previewCache.set(J,Q),this.setState(()=>{this.previewThread=Q})};getCommandPaletteContext=(J)=>{let{threadState:Q}=this.widget.dependencies;if(!Q.mainThread)return null;return{worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.onOpenInEditor,takeImageAttachments:()=>{let Z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),Z},editorDispatch:(Z)=>{if(Z.type==="set-input")this.textController.clear(),this.textController.insertText(Z.input);else if(Z.type==="clear")this.textController.clear()},submitMessage:(Z)=>{return this.proceedWithUserMessage(Z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},onShowQRCodeOverlay:this.showQRCodeOverlay,settingsFilePath:this.widget.dependencies.settingsStorage.getSettingsFilePath(),settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,startNewThread:async()=>{let Z=await this.widget.dependencies.startNewThread();sV(Z)},switchToThread:async(Z)=>{await this.switchToExistingThread(Z)},handleHandoff:async(Z)=>{let X=Z.trim();if(!X){this.setState(()=>{this.displayMessage=Error("Cannot handoff with empty prompt text")});return}try{let Y=this.widget.dependencies.threadState.mainThread?.id;if(!Y){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let K=new AbortController,G=setTimeout(()=>K.abort(),20000),q=await this.widget.dependencies.threadService.createHandoffThread(Y,X,this.widget.dependencies.configService,K.signal);clearTimeout(G),await this.switchToExistingThread(q)}catch(Y){u.error("Failed to create handoff thread",Y),this.setState(()=>{this.displayMessage=Error(`Failed to create handoff: ${Y instanceof Error?Y.message:String(Y)}`)})}},getGuidanceFiles:async()=>{if(!Q.mainThread)return[];return(await I_({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,J.signal)).map((X)=>({uri:X.uri,type:X.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(Z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=Z,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode}};getThreadsForPicker(){return this.threadsForPicker}async loadThreadsForPicker(){if(this.isLoadingThreads)return;this.isLoadingThreads=!0;try{let Q=await new Ud(this.widget.dependencies.configService).fetchThreadSummaries("",0,50);if(Q.ok){let Z=this.widget.dependencies.threadID;this.setState(()=>{this.threadsForPicker=Q.threads.filter((X)=>X.id!==Z).map((X)=>({id:X.id,title:X.title,messageCount:X.messageCount,timeAgo:X.description.timeAgo,shortThreadID:X.description.shortThreadID}))})}}finally{this.isLoadingThreads=!1}}removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{hidden:Q})=>{let Z=Date.now(),X=`bash-${Z}-${Math.random().toString(36).substring(7)}`,Y={cmd:J},K=new AbortController;this.widget.dependencies.worker.invokeBashTool(Y,K.signal,Q).subscribe({next:(G)=>{this.setState(()=>{if(this.bashInvocations.find((z)=>z.id===X))this.bashInvocations=this.bashInvocations.map((z)=>z.id===X?{...z,toolRun:G}:z);else{let z={id:X,args:Y,toolRun:G,startTime:Z,abortController:K,hidden:Q};this.bashInvocations=[...this.bashInvocations,z]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleAgentMode=()=>{if((dK()||this.widget.dependencies.worker).thread.messages.length>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.inMemoryAgentModeOverride??this.currentAgentMode,Y=qc(X,this.cachedVisibleModes);if(Y!==X)this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.inMemoryAgentModeOverride??this.currentAgentMode,Z=qc(Q,this.cachedVisibleModes);if(Z===Q)return;if(this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Z,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),Z==="free")this.checkAndShowFreeModeModal()};checkAndShowFreeModeModal=()=>{if(this.freeTierStatus?.canUseAmpFree)return;if(this.freeTierStatus){if(!this.freeTierStatus.eligible){this.setState(()=>{this.showingCannotToggleMessage="Amp Free is unavailable. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}else if(!this.freeTierStatus.workspaceAllowsAmpFree){this.setState(()=>{this.showingCannotToggleMessage="Your workspace does not allow Amp Free. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}}};isInRestrictedFreeMode(){if(this.getEffectiveAgentMode()!=="free")return!1;if(this.freeTierStatus?.canUseAmpFree)return!1;return!0}onOpenInEditor=async(J)=>{let{execSync:Q}=await import("node:child_process"),{mkdtemp:Z,readFile:X,unlink:Y,rmdir:K,writeFile:G}=await import("node:fs/promises"),{tmpdir:q}=await import("node:os"),z=await import("node:path"),U=process.env.EDITOR||process.env.VISUAL||"nano";try{D2.instance.tuiInstance.suspend();let W=await Z(z.join(q(),"amp-edit-")),F=z.join(W,"message.amp.md");await G(F,J,"utf-8"),Q(`${U} "${F}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let H=await X(F,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")u.error("Failed to read temporary file",H)}try{await Y(F),await K(W)}catch(H){u.warn("Failed to clean up temporary file",H)}D2.instance.tuiInstance.resume()}catch(W){try{D2.instance.tuiInstance.resume()}catch{}u.error("Error opening editor:",W)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=this.parseShellModeInput(J);if(Q){if(Q.cmd&&!this.isProcessing())this.invokeBashCommand(Q.cmd,{hidden:Q.hidden}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();else this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}let Z=mX6(J),{threadState:X}=this.widget.dependencies;if(this.isSlashCommand(Z)&&X.mainThread){let Y=Z.slice(1).split(" "),K=Y[0],G=Y.slice(1).filter((q)=>q.trim()!=="");if(K){let q=X.viewState,z=this.getCommands().query(K,X.mainThread,q).filter((U)=>U.name===K).pop();if(z){if((z.requiresArgs||z.requiresPicker)&&G.length===0){this.textController.clear(),this.textController.insertText(`/${K} `);return}this.textController.clear(),this.resetHistory(),await this.executeCommand(z,G)}else if(K==="compact")this.setState(()=>{this.displayMessage=Error("The /compact command has been removed. Use /handoff to draft a new thread with relevant context instead.")}),this.textController.clear();return}}this.textController.clear(),this.resetHistory(),await this.sendUserMessage(Z)};onOptionSelected=(J)=>{switch(J.type){case"hint":return;case"command":{let Q=`/${J.name} `;this.onTextSubmitted(Q);break}case"file":{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=Q.slice(0,Z).lastIndexOf("@");if(Y!==-1){let K=Q.slice(0,Y),G=Q.slice(Z),q=K+`@${J.path} `+G;this.textController.clear(),this.textController.insertText(q),this.textController.cursorPosition=Y+1+J.path.length+1}break}case"thread":{let Q=this.textController.text,Z=this.textController.cursorPosition,X=Q.split(" ");if(X.length>=1&&X[0]==="/continue"){let Y=`/continue ${J.threadId} `;this.onTextSubmitted(Y)}else{let K=Q.slice(0,Z).lastIndexOf("@");if(K!==-1){let G=Q.slice(0,K),q=Q.slice(Z),z=G+`@${J.threadId} `+q;this.textController.clear(),this.textController.insertText(z),this.textController.cursorPosition=K+1+J.threadId.length+1}}break}case"argument":{let Z=this.textController.text.split(" ");if(Z.length>=1&&Z[0]?.startsWith("/")){let Y=`${Z[0]} ${J.value} `;this.onTextSubmitted(Y)}break}}};executeCommand=async(J,Q)=>{let{threadState:Z}=this.widget.dependencies;if(!Z.mainThread||!J)return;let X=new AbortController,Y=Date.now(),G={id:`command-${Y}-${Math.random().toString(36).substring(7)}`,name:J.name,statusMessage:J.statusMessage,startTime:Y,abortController:X};this.setState(()=>{this.executingCommand=G});try{if(J.name==="new"){let z=await this.widget.dependencies.startNewThread();sV(z);return}if(J.name==="handoff"){let z=Q?.join(" ").trim()||"";if(!z){this.setState(()=>{this.displayMessage=Error("Usage: /handoff <describe your goal>")});return}try{let U=this.widget.dependencies.threadState.mainThread?.id;if(!U){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let W=new AbortController,F=setTimeout(()=>W.abort(),20000),H=await this.widget.dependencies.threadService.createHandoffThread(U,z,this.widget.dependencies.configService,W.signal);clearTimeout(F),await this.switchToExistingThread(H)}catch(U){u.error("Failed to create handoff thread",U),this.setState(()=>{this.displayMessage=Error(`Failed to create handoff: ${U instanceof Error?U.message:String(U)}`)})}return}if(J.launchesWindow)D2.instance.tuiInstance.suspend();let q=await this.getCommands().execute(J.name,{worker:this.widget.dependencies.worker,thread:Z.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,takeImageAttachments:()=>{let z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),z},editorDispatch:(z)=>{if(z.type==="set-input")this.textController.clear(),this.textController.insertText(z.input);else if(z.type==="clear")this.textController.clear()},submitMessage:(z)=>{return this.proceedWithUserMessage(z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},showCommandOverlay:(z)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=z})},onShowQRCodeOverlay:this.showQRCodeOverlay,settingsFilePath:this.widget.dependencies.settingsStorage.getSettingsFilePath(),settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,startNewThread:async()=>{await this.widget.dependencies.startNewThread()},pickAndContinueThread:this.widget.dependencies.pickAndContinueThread,switchToThread:async(z)=>{await this.switchToExistingThread(z)},openInEditor:this.onOpenInEditor,getGuidanceFiles:async()=>{if(!Z.mainThread)return[];return(await I_({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Z.mainThread,X.signal)).map((U)=>({uri:U.uri,type:U.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=z,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode},Q,X.signal);if(J.launchesWindow)D2.instance.tuiInstance.resume();if(q)this.setState(()=>{this.displayMessage=q})}catch(q){u.error("Error executing command:",q)}finally{this.setState(()=>{this.executingCommand=null})}};buildOptions=async(J)=>{let Q=this.textController.text,Z=this.textController.cursorPosition,Y=new Wd().detect(Q,Z);if(Y){let{threadState:K}=this.widget.dependencies;return await this.getCompletionBuilder().buildOptions(Y,K.mainThread,K.viewState)}return[]};initState(){if(NY.getInstance().interceptConsole(),this.widget.dependencies.startWithPicker)this.isShowingThreadPicker=!0;D2.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),D2.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),D2.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Z)=>{c9.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Z.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus;let J=uX6(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus);u.info(`[initState] Resolved agentMode: ${J}`),this.inMemoryAgentModeOverride=J,this.adSubscription=Df1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride==="free"||this.randomAd===null)&&Bf1(this.lastUserInteractionTime)}).subscribe({next:(Z)=>{if(Z){let X=SH9(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (yQ1(),bQ1)).then(({recordAdEvent:Y})=>{let K=this.widget.dependencies.worker.thread,G=K.messages[K.messages.length-1];Y("viewed",{adId:Z.id,advertiserId:Z.advertiserId,threadId:K.id,messageId:G?.messageId,impressionId:X,placement:"tui"})})}this.setState(()=>{this.randomAd=Z})}}),sV(this.widget.dependencies.worker),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Z)=>{this.setState(()=>{this.ideStatus=Z})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Z)=>{let X=dK();if(!X){u.warn("No active thread worker found to handle IDE message");return}await new Promise((Y)=>setTimeout(Y,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Z}]}}),u.debug("Message sent from IDE to agent",{message:Z.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Z)=>{this.textController.insertText(Z),u.debug("Appended text to CLI prompt from IDE",{text:Z.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Z)=>{this.setState(()=>{this.connectedClientsStatus=Z})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Z)=>{this.setState(()=>{this.updateState=Z})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((Z)=>{let X=MZ(Z.settings);this.setState(()=>{this.cachedVisibleModes=X})}),this.textController.addListener(this.textChangeListener),this.getCommands(),this.textController.onInsertText=(Z,X)=>{if(Z.length<=3)return!0;let Y=dX6(Z);if(!Y)return!0;let K=this.getEffectiveAgentMode();if(!Gc(K)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=E10)return!1;let G=cX6(Y);if(G)return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,G]}),!1;return this.setState(()=>{this.displayMessage=Error("Failed to attach image: file may be empty, too large, or unsupported")}),!1},this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Z)=>{let X=Z instanceof Error?Z.message:String(Z);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;if(this.textController.removeListener(this.textChangeListener),this.commands)this.commands.cleanup().catch((J)=>{u.debug("Failed to cleanup commands during disposal",J)});for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(Oh1("")),this.shouldUseProgressBar())process.stdout.write(vG6())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,X=[...J.items.filter((q)=>q.type==="toolResult").map((q)=>({toolUse:q.toolUse,toolRun:q.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((q)=>q.toolRun.status==="blocked-on-user");if(X.length===0)return null;let Y=X[0],K=Y.toolRun.status==="blocked-on-user"?Y.toolRun.toAllow??[]:[],G=Y.toolRun.status==="blocked-on-user"?Y.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:Y.toolUse,toAllow:K}],subthreadID:Y.subthreadID,reason:G}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){u.error("No current tool confirmation found");return}let Z=Q.tools[0]?.useBlock;if(!Z){u.error("No tool use block found in confirmation");return}if(J==="allow-all-session")VZ("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0)}catch(Y){if(Y&&Y instanceof Error)this.setState(()=>{this.displayMessage=Y});else u.error("Failed to write dangerouslyAllowAll setting:",Y);return}if(J==="always-guarded"){let Y=Q.tools[0]?.toAllow??[],K=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],G=[...Y,...K];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",G)}if(J==="connect-github"){let Y=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();try{await AY(Y)}catch(K){u.error("Failed to open settings page:",K),await this.showErrorMessage(`Cannot open browser. Please go to ${Y} to connect to GitHub`)}return}if(J==="disable-librarian"){let Y=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!Y.includes(Qz))await this.widget.dependencies.settingsStorage.set("tools.disable",[...Y,Qz])}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let Y={type:"user:tool-input",toolUse:Z.id,value:{accepted:X}};if(Q.subthreadID)await(await HJ.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(Y);else await this.widget.dependencies.worker.handle(Y)}catch(Y){u.error("Failed to send tool confirmation:",Y)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};showQRCodeOverlay=(J)=>{this.setState(()=>{this.isShowingQRCodeOverlay=!0,this.qrCodeOverlayData=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Z=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Z)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Z=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Z.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null});let X=await this.widget.dependencies.startNewThread();sV(X);break}case"new-smart-thread":{this.setState(()=>{this.inMemoryAgentModeOverride="smart",this.dismissedEphemeralErrorKey=null}),Uf1({agentMode:"smart"});let X=await this.widget.dependencies.startNewThread();sV(X);break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};cancelStreamingMessage=async()=>{await HJ.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Z=J.messages[Q];if(Z?.role==="user"&&!Z.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J)=>{try{u.info(`[switchToExistingThread] Switching to thread: ${J}`);let Q=await this.widget.dependencies.switchToThread(J),Z=Q.thread.agentMode??null;if(u.info(`[switchToExistingThread] Thread ${J} has agentMode: ${Z??"null"}`),this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,sV(Q),D51()?.switchWorker(this.widget.dependencies.worker),this.setState(()=>{u.info(`[switchToExistingThread] Setting inMemoryAgentModeOverride to: ${Z??"null"}`),this.inMemoryAgentModeOverride=Z}),Q.thread.draft)u.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),this.textController.insertText(Q.thread.draft)}catch(Q){throw u.error("Failed to switch to thread:",J,Q),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=dK()||this.widget.dependencies.worker,Z=Q.thread.messages.length===0,X=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Z&&X!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let Y=[{type:"text",text:J}];if(this.imageAttachments.length>0)Y.push(...this.imageAttachments);await Q.handle({type:"user:message",message:{content:Y,agentMode:this.getEffectiveAgentMode()}}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{let J=this.getEffectiveAgentMode();Uf1({agentMode:J}).catch((Q)=>{u.warn("Failed to save session state on exit:",Q)}).finally(()=>{D2.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=vH9();if(J===Q)return"~";if(J.startsWith(Q+Fd.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Fd.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Fd.sep),"…",Q.slice(-2).join(Fd.sep)].join(Fd.sep)}build(J){let Q=_8.of(J),Z=i6.of(J),X=Z.base;this.themeColors=X;let{colors:Y,app:K}=Z;this.themeApp=K;let q=(dK()||this.widget.dependencies.worker).thread.agentMode==="free"&&this.randomAd!==null,{threadState:z}=this.widget.dependencies;if(this.isShowingThreadPicker)return new DN({child:new tu1({onSelect:async(w1)=>{if(w1)this.isShowingThreadPicker=!1,this.setState(),await this.switchToExistingThread(w1);else process.exit(0)},pageSize:50,threadFetcher:new Ud(this.widget.dependencies.configService)})});this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),W=z.todosList,F=z.mainThread?.id,H=z.mainThread||void 0,B=this.isTranscriptEmpty(),M=(w1)=>new DQ1({key:new a7(`preview-message-view-${w1.id}`),items:pu(w1).items,controller:this.previewScrollController,autofocus:!1,thread:w1,focusNode:new Q9({debugLabel:"PreviewFocus"})}),V=this.previewThread?M(this.previewThread):B?new MQ1({agentMode:this.getEffectiveAgentMode()}):new DQ1({key:F?new a7(`message-view-${F}`):void 0,items:z.items,subagentToolsByParentID:z.subagentToolsByParentID,controller:F?this.getMessageScrollController(F):new jY,autofocus:!1,onCopy:this._handleTextCopy.bind(this),thread:H,onMessageEditSubmit:this.handleMessageEditSubmit,onMessageRestoreSubmit:this.handleMessageRestoreSubmit,onMessageForkSubmit:this.forkMessage,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),N=Math.max(Math.floor(Q.size.height*0.4),12),L=this.getCurrentEphemeralError(),A=this.buildBottomWidget(L,U,Y,Z,z,W,N,q?this.randomAd:null),w=Q.size.width<40,R=z.mainThread?Tn1(z.mainThread):void 0,O=new bJ1({threadViewState:z.viewState,threadTokenUsage:R,threadID:F??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:w,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),j=new xJ1({bashInvocations:this.bashInvocations}),$=[],E=this.getEffectiveAgentMode(),I=this.currentShellModeStatus,T=Zp1(E),S=!I?E.length+1:0,x=Q.capabilities.animationSupport,h=x==="disabled"?0:x==="slow"?30:60,v=1,_=h>0&&this.agentModePulseSeq>0?new TJ({children:[A,new wX({top:0,left:1,right:1,height:1,child:new au1({color:T,trigger:this.agentModePulseSeq,fps:h,speed:v,leftOffset:S})})]}):A;if($.push(new R8({child:V}),j),q)$.push(new Vu1({ad:this.randomAd,onButtonClick:async()=>{let w1=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (yQ1(),bQ1)).then(({recordAdEvent:D1})=>{let y1=this.widget.dependencies.worker.thread,l1=y1.messages[y1.messages.length-1];D1("clicked",{adId:w1.id,advertiserId:w1.advertiserId,threadId:y1.id,messageId:l1?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to"})});try{await AY(w1.shortDestinationUrl)}catch(D1){let l1=D2.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:l1,url:w1.shortDestinationUrl}})}}}));$.push(new y0({constraints:new w6(0,Q.size.width,0,N),child:_}),new U0({height:1,child:new x6({padding:V0.horizontal(1),child:O})}));let b=new i0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:$}),g=new S9(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingQRCodeOverlay)return this.setState(()=>{this.isShowingQRCodeOverlay=!1,this.qrCodeOverlayData=null}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.clearActiveSelection())return"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.bashInvocations.length>0)return this.cancelBashInvocations(),"handled";if(this.executingCommand)return u.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.isProcessing())return this.markLastUserMessageAsInterrupted().catch((D1)=>{u.error("Failed to mark message as interrupted:",D1)}),this.cancelStreamingMessage().catch((D1)=>{u.error("Failed to cancel streaming message:",D1)}),"handled";if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),k=new S9(()=>{return this.onExitPressed(),"handled"}),y=new S9(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),f=new S9(()=>{return wQ.instance.toggleAll(),"handled"}),m=new S9(()=>{return this.widget.dependencies.configService.getLatest().then((w1)=>{VZ("internal.showCost",!(w1.settings["internal.showCost"]??!0))}),"handled"}),n=new S9(()=>{return D2.instance.toggleFrameStatsOverlay(),"handled"}),p=new S9(()=>{return D2.instance.tuiInstance.getScreen().markForRefresh(),c9.instance.requestFrame(),"handled"}),e=new S9(()=>{return this.toggleAgentMode(),"handled"}),G1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1){let y1=Math.max(Math.floor(Q.size.height*0.4),10),l1=Q.size.height-y1;D1.animatePageUp(l1,100)}return"handled"}),U1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1){let y1=Math.max(Math.floor(Q.size.height*0.4),10),l1=Q.size.height-y1;D1.animatePageDown(l1,100)}return"handled"}),Z1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1)D1.animateTo(0,100);return"handled"}),F1=new S9(()=>{let D1=this.isShowingPalette&&this.previewThread?this.previewScrollController:(()=>{let{threadState:y1}=this.widget.dependencies,l1=y1.mainThread?.id;return l1?this.getMessageScrollController(l1):null})();if(D1)D1.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),l=new S9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:w1}=this.widget.dependencies;if(!w1.mainThread?.messages.some((y1)=>y1.role==="user"))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),d=new S9((w1)=>{if(w1.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),i=new Map([[b6.ctrl("c"),new kp],[b6.ctrl("l"),new fp],[b6.ctrl("o"),new AJ1],[b6.alt("s"),new gC],[b6.ctrl("s"),new gC],[b6.alt("p"),new yp],[b6.ctrl("r"),new xp],[b6.alt("d"),new bp],[b6.key("PageUp"),new MJ1],[b6.key("PageDown"),new VJ1],[b6.key("Home"),new NJ1],[b6.key("End"),new LJ1],[b6.key("Escape"),new vp],[b6.ctrl("p"),new mC("previous")],[b6.ctrl("n"),new mC("next")],[b6.key("Tab"),new hp],[b6.key("ArrowUp"),new hp]]);if(!1)i.set(b6.alt("c"),new _p);let o=new S9(()=>{return this.showCommandPalette(),"handled"}),Y1=new Map([[vp,g],[fp,p],[gC,e],[AJ1,o],[_p,y],[xp,f],[bp,m],[yp,n],[kp,k],[MJ1,G1],[VJ1,U1],[NJ1,Z1],[LJ1,F1],[hp,l],[mC,d]]),J1=[b];if(this.isShowingConsoleOverlay)J1.push(new Su1);if(this.isShowingHelp)J1.push(new _u1);if(this.adActionModal)J1.push(new Nu1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(w1)=>{let D1=this.adActionModal.url;if(w1==="copy")try{await D2.instance.tuiInstance.clipboard.writeText(D1),this.setState(()=>{this.displayMessage=new q2("Link copied to clipboard")})}catch(y1){u.error("Failed to copy to clipboard",{error:y1}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.isShowingFileChangesOverlay)J1.push(new Ig1);if(this.isShowingCostBreakdownOverlay&&z.mainThread)J1.push(new vu1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)J1.push(new Tu1({details:this.confirmationOverlayContent}));if(this.isShowingQRCodeOverlay&&this.qrCodeOverlayData)J1.push(new su1({url:this.qrCodeOverlayData.url,qrCode:this.qrCodeOverlayData.qrCode}));let H1=this.getCommandPaletteContext(new AbortController);if(H1&&this.isShowingPalette){let w1=this.getThreadsForPicker();J1.push(new C9({child:new y0({constraints:w6.loose(80,20),child:new $u1({commandContext:H1,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,threads:w1,onThreadPreview:this.handleThreadPreview})})}))}if(this.isShowingIdePicker)J1.push(new xu1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));let z1=new TJ({children:J1});if(this.isShowingJetBrainsInstaller)return new DN({child:new HZ({actions:Y1,child:new dq({shortcuts:i,debugLabel:"jetbrains-installer-shortcuts",child:new nu1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});let W1=new MN({onError:(w1)=>{this.showErrorMessage(w1.message)},child:z1});return new DN({child:new HZ({actions:Y1,child:new dq({shortcuts:i,debugLabel:"main-app-shortcuts",child:W1})})})}buildBottomWidget(J,Q,Z,X,Y,K,G,q){if(J)return new ku1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new Cu1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new ru1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let z=X.app,U=kH9(X),W=this.isInRestrictedFreeMode(),F=new $J1({key:this.textFieldKey,controller:this.textController,triggers:[new Wd],optionsBuilder:this.buildOptions,onSelected:this.onOptionSelected,displayStringForOption:(S)=>Iu1(S),overlayBorderColor:Z.border,focusNode:this.autocompleteFocusNode,canStealFocus:!this.isMessageViewInSelectionMode,textFieldProps:{placeholder:W?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,wrap:!0,minLines:3,maxLines:null,expands:!0,autofocus:!1,enabled:this.isTextfieldAndAutocompleteFocused&&!W,onSubmitted:this.onTextSubmitted,onOpenInEditor:this.onOpenInEditor,submitKey:{character:"Enter"},prompts:U,style:{border:null},clipboard:D2.instance.tuiInstance.clipboard},optionViewBuilder:(S,x,h)=>{let v=h?Z.selection:void 0,_=x.type==="command"||x.type==="thread"?Z.warning:Z.secondary,b=Z.foreground,g=Z.foreground,k,y;switch(x.type){case"command":k="/",y=x.name;break;case"file":k="@",y=x.path;break;case"thread":k="@",y=x.title;break;case"hint":k="",y=x.message;break;default:k="",y=Iu1(x);break}let f=PW6(x),m=new N1(k,new j1({color:_})),n=new N1(y,new j1({color:b})),p=[m,n];if(f){let e=new N1(" - ",new j1({color:g,dim:!0})),G1=new N1(f,new j1({color:g,dim:!0}));p.push(e,G1)}return new y0({decoration:new i8(v),child:new n1({text:new N1("",void 0,p),maxLines:1,overflow:"ellipsis"})})}}),H=Y.mainThread?.queuedMessages??[],B=this.currentShellModeStatus,M=this.imageAttachments.length>0?new y0({padding:V0.only({bottom:1,left:1}),child:new n1({text:new N1("",void 0,[new N1("Images: ",new j1({color:Z.foreground,dim:!0})),...this.imageAttachments.flatMap((S,x)=>[new N1(`[image ${x+1}]`,new j1({color:Z.success})),...x<this.imageAttachments.length-1?[new N1(" ")]:[]])])})}):null,V=Array.isArray(K)&&K.length>0,N=Array.isArray(H)&&H.length>0,L=[];if(M)L.push(M);L.push(new R8({child:F}));let A=new i0({crossAxisAlignment:"start",children:L}),w=N?new ou1({queuedMessages:H}):void 0,R=V?new fh1(new Mu1({todos:K,enabled:this.isTextfieldAndAutocompleteFocused&&!W}),{clipBehavior:"antiAlias"}):void 0,O=[];if(B)O.push({text:new N1(B==="hidden"?"shell mode (incognito)":"shell mode",new j1({color:B==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left",offsetY:M?1:0});let j=this.getEffectiveAgentMode();if(!B&&this.cachedVisibleModes.length>1){let S=Zp1(j),h=qc(j,this.cachedVisibleModes)!==j,_=(dK()||this.widget.dependencies.worker).thread.messages.length===0,g=W||!this.hasToggledAgentMode&&h&&_?new N1("",void 0,[new N1(j,new j1({color:S})),new N1(" (click or ",new j1({color:Z.foreground,dim:!0})),new N1("Ctrl+S",new j1({color:z.keybind})),new N1(" to switch)",new j1({color:Z.foreground,dim:!0}))]):new N1(j,new j1({color:S}));O.push({text:g,position:"top-left",offsetY:0,onClick:_?this.toggleAgentMode:void 0})}let $=Y.mainThread?.metadata?.treeInfo?.uri,E;if($)E=O0.isUri($)?$.fsPath:$;else E=process.cwd();let I=this.toHomeRelative(E),T=this.shorten(I);return O.push({text:new N1(T,new j1({color:Z.foreground,dim:!0})),position:"bottom-right"}),new Vg1({leftChild:A,rightChild1:w,rightChild2:R,maxHeight:G,overlayTexts:O,borderColor:W||!this.isTextfieldAndAutocompleteFocused?E1.index(8):void 0,hasBanner:q!==null})}}async function OF6(J){let X=new eH(!1,1000,J.inspectorPort),Y=new ky1({threadService:J.threadService,worker:J.worker,builder:(H,B)=>{let M=dK(),V=M?.thread.id||J.threadID,N={...J,worker:M||J.worker,threadID:V};return new wF6({...N,threadState:B})}}),K=new Og1({configService:J.configService,child:Y}),G=new Ag1({configService:J.configService,child:K}),q=new rh1(G),z=new i6({data:pC.fromBaseTheme(tK.default()),child:q});try{await bh1(z,{onRootElementMounted:void 0})}finally{}let W=dK()?.thread.id||J.threadID;if((await J.threadService.get(W))?.messages.length!==0){let H=`${J.ampURL.replace(/\/$/,"")}/threads/${W}`;J.stdout.write(`
|
|
6598
6598
|
`),J.stdout.write(`Thread: ${H}
|
|
6599
6599
|
`),J.stdout.write(`Continue this thread with: amp threads continue ${W}
|
|
6600
6600
|
`)}}function Zp1(J){return J==="smart"?E1.rgb(3,197,97):J==="free"?E1.rgb(0,184,255):_H9(J)}function _H9(J){let Q=0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);Q=(Q<<5)-Q+K,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Z.length;return E1.index(Z[X])}xh1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){QG.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
6601
|
-
`)}var Yp1=Xp1.join(kl1||Xp1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function hH9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),G=Z||"Warning",q=!1;J.warn(K,{name:G,code:X})}}function iq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")VZ("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new k9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${U8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")VZ("experimental.agentMode",Q.agentMode)}async function Gp1(J){try{await bH9(Xp1.dirname(Yp1),{recursive:!0}),await yH9(Yp1,J,"utf-8")}catch(Q){u.debug("Failed to save last thread ID",Q)}}async function gH9(){try{return(await IF6(Yp1,"utf-8")).trim()}catch(J){return null}}function mH9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return SS("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var jF6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??UZ,description:`Custom settings file path (overrides the default location ${UZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(u).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Iy1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:lK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:Kc}],$F6=(J)=>("deprecated"in J)&&J.deprecated===!0,uH9=(J)=>("hidden"in J)&&J.hidden===!0,pH9=(J)=>("default"in J),dH9=(J)=>("default"in J)?J.default:void 0;function cH9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((q)=>Z.includes(q)||q.includes(Z)),G="Run amp --help for a list of available commands.";if(K.length>0)G=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new k9(cK.unknownCommand(Z),1,G)}}var PF6=null;function C64(){return PF6}function hQ1(J){return{...J,getThreadEnvironment:F51,vfs:d40({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new h_(J.fileSystem),generateThreadTitle:Xz0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var qp1=O0.file(fH9.homedir()),TF6=process.env.XDG_CONFIG_HOME?O0.file(process.env.XDG_CONFIG_HOME):b0.joinPath(qp1,".config");async function nq(J,Q){mn1("0.0.
|
|
6601
|
+
`)}var Yp1=Xp1.join(kl1||Xp1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function hH9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),G=Z||"Warning",q=!1;J.warn(K,{name:G,code:X})}}function iq(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")VZ("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new k9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${U8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")VZ("experimental.agentMode",Q.agentMode)}async function Gp1(J){try{await bH9(Xp1.dirname(Yp1),{recursive:!0}),await yH9(Yp1,J,"utf-8")}catch(Q){u.debug("Failed to save last thread ID",Q)}}async function gH9(){try{return(await IF6(Yp1,"utf-8")).trim()}catch(J){return null}}function mH9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return SS("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var jF6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??UZ,description:`Custom settings file path (overrides the default location ${UZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(u).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Iy1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:lK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:Kc}],$F6=(J)=>("deprecated"in J)&&J.deprecated===!0,uH9=(J)=>("hidden"in J)&&J.hidden===!0,pH9=(J)=>("default"in J),dH9=(J)=>("default"in J)?J.default:void 0;function cH9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((q)=>Z.includes(q)||q.includes(Z)),G="Run amp --help for a list of available commands.";if(K.length>0)G=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new k9(cK.unknownCommand(Z),1,G)}}var PF6=null;function C64(){return PF6}function hQ1(J){return{...J,getThreadEnvironment:F51,vfs:d40({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new h_(J.fileSystem),generateThreadTitle:Xz0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var qp1=O0.file(fH9.homedir()),TF6=process.env.XDG_CONFIG_HOME?O0.file(process.env.XDG_CONFIG_HOME):b0.joinPath(qp1,".config");async function nq(J,Q){mn1("0.0.1761664990-gf5b267");let Z=iX1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:t1.of([O0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:qp1,userConfigDir:TF6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (yQ1(),bQ1));X(Z);let Y=await Z.getLatest();u.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=pa(TO({configService:Z})),G=A40({configService:Z,toolService:K}),q=PO0(K,j2,R11).catch((O)=>{u.warn("Toolbox registration failed, continuing anyway:",O)}),z=G.initialized.catch((O)=>{u.warn("MCP service initialization failed, continuing anyway:",O)});if(J.executeMode)await Promise.all([z,q]);if(Q.jetbrains)vO("JetBrains");else if(Q.ide&&yZ6())vO("VS Code");else if(Q.ide&&fZ6())vO("Neovim");if(J.executeMode)un1(!0);_26(K,{configService:Z});let U,W=S7.status.pipe(x0((O)=>Boolean(O.connected&&O.authenticated)),J8()).subscribe((O)=>{if(O){if(!U)U=K.registerTool(ds)}else U?.dispose(),U=void 0}),F;if(!J.executeMode)F=new I51(process.cwd(),{},!0);else F=new class extends I51{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(t2.write(`No API key found. Starting login flow...
|
|
6602
6602
|
`),!await lH9(J))await BR(),process.exit(1)}let H=await r40({isDevelopment:!1}),B=new uV1(H),M=new PB1(H,Z,{lazy:!0}),V=Q.notifications!==void 0?Q.notifications:!J.executeMode,N=b26({playNotificationSound:async(O)=>{if(V){x26(O);let j=kh1(),$=_h1();if((!j||$)&&Y.settings["notifications.system.enabled"]!==!1){if(O==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(O==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:B,configService:Z});u.info("Starting Amp background services");let L=Zz0({threadService:B,threadHistoryService:M,configService:Z,isExtensionDevelopment:!1}),A;S7.status.subscribe((O)=>{A=O});let R={codebaseContextService:new gZ1({workspaceRoots:[O0.file(process.cwd())],getCurrentFile:()=>{if(!A?.openFile)return;try{return O0.parse(A.openFile)}catch(O){u.warn("Failed to parse current file URI",{uri:A.openFile,error:O});return}},getOpenFiles:()=>{if(!A?.visibleFiles?.length)return[];let O=A.openFile;return A.visibleFiles.filter((j)=>j!==O).map((j)=>{try{return O0.parse(j)}catch($){return u.warn("Failed to parse visible file URI",{uri:j,error:$}),null}}).filter((j)=>j!==null)}}),configService:Z,toolService:K,mcpService:G,threadService:B,threadHistoryService:M,threadSyncService:L,threadStorage:H,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:F,notificationService:N,fileSystem:Q.jetbrains||Q.ide?m40:j2};return{...R,async asyncDispose(){await R.mcpService.dispose(),await R.threadService.asyncDispose(),R.configService.unsubscribe(),R.toolService.dispose(),R.fuzzyServer.dispose(),R.threadSyncService.dispose(),R.settingsStorage[Symbol.dispose](),W.unsubscribe(),U?.dispose()}}}async function lH9(J){if(!J.executeMode){if(!await zf1("Would you like to log in to Amp? [(y)es, (n)o]: "))return t2.write(`Login cancelled. Run the command again to retry.
|
|
6603
|
-
`),!1}return await CF6(J)}async function CF6(J){let Q=xH9(32).toString("hex"),Z=await qf1(J.ampURL,Q);
|
|
6603
|
+
`),!1}return await CF6(J)}async function CF6(J){let Q=xH9(32).toString("hex"),Z=await qf1(J.ampURL,Q),X=new AbortController;AY(Z,X.signal).catch((K)=>{u.error("Error opening browser",{err:K})});let Y=await qf1(J.ampURL,Q,!1);t2.write(`If your browser does not open automatically, visit:
|
|
6604
6604
|
|
|
6605
|
-
${U8.blue.bold(
|
|
6605
|
+
${U8.blue.bold(Y)}
|
|
6606
6606
|
|
|
6607
|
-
`);try{return await JX6(J.ampURL,Q,J.secrets),t2.write(`
|
|
6607
|
+
`);try{return await JX6(J.ampURL,Q,J.secrets,X),t2.write(`
|
|
6608
6608
|
Login successful! You can now use the Amp CLI.
|
|
6609
|
-
`),!0}catch(
|
|
6610
|
-
Login failed: ${
|
|
6611
|
-
`),!1}}function iH9(){let J=new Mu().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((U)=>{if(U.code==="commander.help"||U.code==="commander.version"||U.exitCode===0)MR(),process.exit(0);let W=U.originalError??U;fQ6(W)}),J.option("-V, --version","output the version number",()=>{t2.write(`0.0.
|
|
6609
|
+
`),!0}catch(K){return u.error("Login failed",{error:K}),QG.write(`
|
|
6610
|
+
Login failed: ${K instanceof Error?K.message:String(K)}
|
|
6611
|
+
`),!1}}function iH9(){let J=new Mu().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((U)=>{if(U.code==="commander.help"||U.code==="commander.version"||U.exitCode===0)MR(),process.exit(0);let W=U.originalError??U;fQ6(W)}),J.option("-V, --version","output the version number",()=>{t2.write(`0.0.1761664990-gf5b267 (released 2025-10-28T15:28:46.329Z)
|
|
6612
6612
|
`),process.exit(0)}),J.addHelpText("after",_Z6()),J.configureHelp({formatHelp:xZ6}),J.command("logout").description("Log out by removing stored API key").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);await sH9(H)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);await rH9(H,await ry1(F,H.settings))});let Q=async(U,W,F)=>{iX1({storage:W.settings,secretStorage:W.secrets,workspaceRoots:t1.of([O0.file(process.cwd())]),defaultAmpURL:W.ampURL,homeDir:qp1,userConfigDir:TF6});let H={...W,executeMode:!1};await Kp1(H,{...U,startWithPicker:!0},F)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);await EF6(F,H,W)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);await ZB9(F,H,W)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(U,W,F)=>{let H=F.optsWithGlobals(),B=await OX(H);if(W.pick)QG.write(`${U8.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
6613
6613
|
`);if(W.last||U||B.executeMode)await QB9(H,B,U,F);else await Q(H,B,F)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(U,W,F)=>{let H=F.optsWithGlobals(),B=await OX(H);await JB9(H,B,U,F)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);await EF6(F,H,W)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(U,W,F)=>{let H=F.optsWithGlobals(),B=await OX(H);await eH9(H,B,U,F,W.support)}),Z.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(U,W,F,H)=>{let B=H.optsWithGlobals(),M=await OX(B);await oH9(B,M,U,W,H)}),Z.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(U,W,F)=>{let H=F.optsWithGlobals(),B=await OX(H);await tH9(H,B,U,F)}),fX6(J,async(U,W)=>{let F=await OX(W);iq(U,W);let H=await nq(F,W);return{context:F,mcpService:H.mcpService,toolService:H.toolService,configService:H.configService,cleanupTerminal:MR,asyncDispose:H.asyncDispose.bind(H)}}),HX6(J),YX6(J,async(U)=>{let W=await OX(U);return{settings:W.settings,getThreadDeps:async(F)=>{iq(F,U);let H=await nq(W,U);return{mcpService:H.mcpService,asyncDispose:H.asyncDispose.bind(H)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(U,W)=>{let F=W.optsWithGlobals(),H=await OX(F);iq(W,F);let B=await nq(H,F);try{await by1(B,B.configService,{})}finally{await B.asyncDispose(),await MR()}});function X(U,W,F){let B=typeof U.description==="string"?U.description:F===void 0?U.description(!0):U.description(F),M=new pV(W,B),V=dH9(U);if(V)M.default(V);if(M.hidden=uH9(U)||$F6(U),"choices"in U)M.choices([...U.choices]);return M}for(let U of jF6)switch(U.type){case"flag":{J.addOption(X(U,`--${U.long}`)),J.addOption(X(U,`--no-${U.long}`,!1));break}case"switch":{J.addOption(X(U,`--${U.long}`,!0));break}default:{J.addOption(X(U,`--${U.long} <value>`));break}}let Y=new pV("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(Y);let K=new pV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(K);let G=new pV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(G);let q=new pV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(q);let z=new pV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(z),process.env.AMP_CONNECT==="1"){let U=new pV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(U)}return J.action(async(U,W)=>{let F=U,H=await OX(F);if(Object.keys(F).forEach((B)=>{let M=jF6.find((V)=>V.name===B);if(M&&$F6(M)&&!pH9(M))QG.write(U8.yellow(`Warning: '--${B}' flag is deprecated
|
|
6614
6614
|
`))}),W.args.length>0)cH9(H,W);await Kp1(H,F,W)}),tZ6(J),J}async function fQ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??qz(),K=hQ1(J);if(Z)await J.threadStorage.set(Y,Z);let G=await HJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,h51(X));let q=J.threadService.observe(Y).subscribe(async(z)=>{if(t7(z,"assistant"))await Gp1(Y),q.unsubscribe()});return await G.resume(),G}async function Kp1(J,Q,Z){let X=f51(Q);if(X instanceof Error)JG(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let O=(await Wf1()).trimEnd();if(O)K=O}else Y=(await Wf1()).trimEnd();if(Q.remote&&!J.executeMode)throw new k9("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new k9("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new k9("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new k9("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&Q.agentMode&&Q.agentMode!=="smart")throw new k9(`Execute mode is not permitted with --agent-mode '${Q.agentMode}'`,1);if(Q.stats&&!J.executeMode)throw new k9("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new k9("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&Y===""&&!Q.streamJsonInput)throw new k9("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
|
|
6615
6615
|
Or pipe via stdin: echo "your message" | amp --execute`);iq(Z,Q);let G=await nq(J,Q);PF6=G;let q=hQ1(G),z=async(O)=>{let j=await IF6(O,"utf-8"),$=JSON.parse(j);if(!HG($.id))throw new k9(cK.invalidThreadId);return fQ1(G,{visibility:X,thread:$})},U=async(O)=>{if(!HG(O))throw new k9(cK.invalidThreadId);let j=await G.threadService.get(O)??void 0;if(u.info(`[fetchAndStartThread] Loaded thread ${O}, agentMode: ${j?.agentMode??"undefined"}`),j?.agentMode)u.info(`[fetchAndStartThread] Setting runtime override for agentMode to: ${j.agentMode}`),VZ("experimental.agentMode",j.agentMode);else u.info("[fetchAndStartThread] No agentMode on thread, not setting override");return fQ1(G,{visibility:X,thread:j})},W=async()=>{try{if(Q.threadId)return U(Q.threadId);else return fQ1(G,{visibility:X})}catch(O){if(O instanceof k9)throw O;throw await L51(O,Q.threadId),Error("handleError should have called process.exit()")}},F=async()=>{return fQ1(G,{visibility:X})};if(Q.format==="jsonl")QG.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
6616
|
-
`),await BR(),process.exit(1);if(J.executeMode&&Q.remote)await BX6(Y,K,G.configService),await G.asyncDispose(),process.exit(0);let H=await W();if(J.executeMode)await sQ6(H,H.threadID,Y,K,G,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await G.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Zs1();let O=await gB({jetbrainsOnly:Q.jetbrains});if(O.length===0){if(Q.jetbrains)M=!await G.configService.get("jetbrains.skipInstall")}else if(O.length===1){let j=O[0];if(j)S7.selectConfig(j)}else B=!0}let V=Kf1("0.0.
|
|
6617
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await NZ6({...J,getHook:process.env.AMP_URL?(G,q)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let G=await KX6(J.mcpConfig);X=mH9(X,G)}let Y=await X.get("url","global");if(!Y)Y=NZ;if(!$B(Y))u.info("Targeting custom Amp server",{ampURL:Y});if(X=Yi1(X),await X.get("debug.httpLogging"))rl1();return{executeMode:Q,isTTY:Z,ampURL:Y,settings:X,secrets:DX6(await ry1(J,X))}}function nH9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(q,z)=>z.toUpperCase()),G=J[Z+1];if(G&&!G.startsWith("--"))Q[K]=G,Z++}}return Q}async function aH9(){let J=nH9(process.argv);if(AQ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),hH9(u),u.info("Starting Amp CLI.",{version:"0.0.
|
|
6616
|
+
`),await BR(),process.exit(1);if(J.executeMode&&Q.remote)await BX6(Y,K,G.configService),await G.asyncDispose(),process.exit(0);let H=await W();if(J.executeMode)await sQ6(H,H.threadID,Y,K,G,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await G.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Zs1();let O=await gB({jetbrainsOnly:Q.jetbrains});if(O.length===0){if(Q.jetbrains)M=!await G.configService.get("jetbrains.skipInstall")}else if(O.length===1){let j=O[0];if(j)S7.selectConfig(j)}else B=!0}let V=Kf1("0.0.1761664990-gf5b267",G.settingsStorage),N=new IB1(G.threadStorage),L=t1.of([O0.file(process.cwd())]),A=MS(void 0,L);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let w;try{w=await GJ.getUserFreeTierStatus({},{config:G.configService})}catch(O){w={ok:!1,error:O}}u.info("User free tier status:",w);let R=await NX6();u.info("Loaded session state:",R),await OF6({codebaseContextService:G.codebaseContextService,stdout:process.stdout,history:new my1,fuzzyServer:G.fuzzyServer,settingsStorage:G.settingsStorage,threadService:G.threadService,threadSyncService:G.threadSyncService,threadID:H.threadID,threadFuzzyIndexer:N,worker:H,workerDeps:q,configService:G.configService,internalAPIClient:GJ,ampURL:J.ampURL,startNewThread:F,pickAndContinueThread:async()=>{u.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:S7,connectedClientsService:new _c,commandRegistry:A,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:R,freeTierStatus:w.ok?w.result:void 0}),await G.asyncDispose(),process.exit(0)}async function OX(J){if(J.interactive)QG.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
6617
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await NZ6({...J,getHook:process.env.AMP_URL?(G,q)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let G=await KX6(J.mcpConfig);X=mH9(X,G)}let Y=await X.get("url","global");if(!Y)Y=NZ;if(!$B(Y))u.info("Targeting custom Amp server",{ampURL:Y});if(X=Yi1(X),await X.get("debug.httpLogging"))rl1();return{executeMode:Q,isTTY:Z,ampURL:Y,settings:X,secrets:DX6(await ry1(J,X))}}function nH9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(q,z)=>z.toUpperCase()),G=J[Z+1];if(G&&!G.startsWith("--"))Q[K]=G,Z++}}return Q}async function aH9(){let J=nH9(process.argv);if(AQ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),hH9(u),u.info("Starting Amp CLI.",{version:"0.0.1761664990-gf5b267",buildTimestamp:"2025-10-28T15:28:46.329Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new k9(cK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await iH9().parseAsync(process.argv)}aH9().catch(L51);async function rH9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),t2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
6618
6618
|
`);else if(!$B(J.ampURL))t2.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
6619
6619
|
`);let Z=process.env.AMP_API_KEY;if(Z)t2.write(`API key found in environment variable, storing...
|
|
6620
6620
|
`),await Q.set("apiKey",Z,J.ampURL),t2.write(`API key successfully stored.
|