MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / Kh1

Function Kh1

package/cli.js:676–676  ·  view source on GitHub ↗
(q,K,_,z,Y,$)

Source from the content-addressed store, hash-verified

674`+E;else S.comment=E;V.comment=V.comment.substring(E.length+1)}}}if(!A&&!T&&!V.found){let E=v?q(_,v,V,Y):K(_,V.end,T,null,V,Y);if(j.items.push(E),J=E.range[2],qh1(v))Y(E.range,"BLOCK_IN_FLOW",eR1)}else{_.atKey=!0;let E=V.end,S=Z?q(_,Z,V,Y):K(_,E,G,null,V,Y);if(qh1(Z))Y(S.range,"BLOCK_IN_FLOW",eR1);_.atKey=!1;let R=P44.resolveProps(T??[],{flow:O,indicator:"map-value-ind",next:v,offset:S.range[2],onError:Y,parentIndent:z.indent,startOnNewline:!1});if(R.found){if(!A&&!V.found&&_.options.strict){if(T)for(let B of T){if(B===R.found)break;if(B.type==="newline"){Y(B,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(V.start<R.found.offset-1024)Y(R.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(v)if("source"in v&&v.source&&v.source[0]===":")Y(v,"MISSING_CHAR",`Missing space after : in ${O}`);else Y(R.start,"MISSING_CHAR",`Missing , or : between ${O} items`);let x=v?q(_,v,R,Y):R.found?K(_,R.end,T,null,R,Y):null;if(x){if(qh1(v))Y(x.range,"BLOCK_IN_FLOW",eR1)}else if(R.comment)if(S.comment)S.comment+=`
675`+R.comment;else S.comment=R.comment;let I=new IE_.Pair(S,x);if(_.options.keepSourceTokens)I.srcToken=f;if(A){let B=j;if(BE_.mapIncludes(_,B.items,S))Y(E,"DUPLICATE_KEY","Map keys must be unique");B.items.push(I)}else{let B=new X44.YAMLMap(_.schema);B.flow=!0,B.items.push(I);let p=(x??S).range;B.range=[S.range[0],p[1],p[2]],j.items.push(B)}J=x?x.range[2]:R.end}}let M=A?"}":"]",[X,...P]=z.end,W=J;if(X&&X.source===M)W=X.offset+X.source.length;else{let D=O[0].toUpperCase()+O.substring(1),f=H?`${D} must end with a ${M}`:`${D} in block collection must be sufficiently indented and end with a ${M}`;if(Y(J,H?"MISSING_CHAR":"BAD_INDENT",f),X&&X.source.length!==1)P.unshift(X)}if(P.length>0){let D=mE_.resolveEnd(P,W,_.options.strict,Y);if(D.comment)if(j.comment)j.comment+=`
676`+D.comment;else j.comment=D.comment;j.range=[z.offset,W,D.offset]}else j.range=[z.offset,W,W];return j}FE_.resolveFlowCollection=gE_});var D44=m((aE_)=>{var QE_=uY(),dE_=DX(),cE_=t16(),lE_=e16(),nE_=J44(),iE_=M44(),rE_=W44();function Kh1(q,K,_,z,Y,$){let A=_.type==="block-map"?nE_.resolveBlockMap(q,K,_,z,$):_.type==="block-seq"?iE_.resolveBlockSeq(q,K,_,z,$):rE_.resolveFlowCollection(q,K,_,z,$),O=A.constructor;if(Y==="!"||Y===O.tagName)return A.tag=O.tagName,A;if(Y)A.tag=Y;return A}function oE_(q,K,_,z,Y){let $=z.tag,A=!$?null:K.directives.tagName($.source,(M)=>Y($,"TAG_RESOLVE_FAILED",M));if(_.type==="block-seq"){let{anchor:M,newlineAfterProp:X}=z,P=M&&$?M.offset>$.offset?M:$:M??$;if(P&&(!X||X.offset<P.offset))Y(P,"MISSING_CHAR","Missing newline after block sequence props")}let O=_.type==="block-map"?"map":_.type==="block-seq"?"seq":_.start.source==="{"?"map":"seq";if(!$||!A||A==="!"||A===cE_.YAMLMap.tagName&&O==="map"||A===lE_.YAMLSeq.tagName&&O==="seq")return Kh1(q,K,_,Y,A);let w=K.schema.tags.find((M)=>M.tag===A&&M.collection===O);if(!w){let M=K.schema.knownTags[A];if(M&&M.collection===O)K.schema.tags.push(Object.assign({},M,{default:!1})),w=M;else{if(M)Y($,"BAD_COLLECTION_TYPE",`${M.tag} used for ${O} collection, but expects ${M.collection??"scalar"}`,!0);else Y($,"TAG_RESOLVE_FAILED",`Unresolved tag: ${A}`,!0);return Kh1(q,K,_,Y,A)}}let j=Kh1(q,K,_,Y,A,w),H=w.resolve?.(j,(M)=>Y($,"TAG_RESOLVE_FAILED",M),K.options)??j,J=QE_.isNode(H)?H:new dE_.Scalar(H);if(J.range=j.range,J.tag=A,w?.format)J.format=w.format;return J}aE_.composeCollection=oE_});var zh1=m((KL_)=>{var _h1=DX();function tE_(q,K,_){let z=K.offset,Y=eE_(K,q.options.strict,_);if(!Y)return{value:"",type:null,comment:"",range:[z,z,z]};let $=Y.mode===">"?_h1.Scalar.BLOCK_FOLDED:_h1.Scalar.BLOCK_LITERAL,A=K.source?qL_(K.source):[],O=A.length;for(let W=A.length-1;W>=0;--W){let D=A[W][1];if(D===""||D==="\r")O=W;else break}if(O===0){let W=Y.chomp==="+"&&A.length>0?`
677`.repeat(Math.max(1,A.length-1)):"",D=z+Y.length;if(K.source)D+=K.source.length;return{value:W,type:$,comment:Y.comment,range:[z,D,D]}}let w=K.indent+Y.indent,j=K.offset+Y.length,H=0;for(let W=0;W<O;++W){let[D,f]=A[W];if(f===""||f==="\r"){if(Y.indent===0&&D.length>w)w=D.length}else{if(D.length<w)_(j+D.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(Y.indent===0)w=D.length;if(H=W,w===0&&!q.atRoot)_(j,"BAD_INDENT","Block scalar values in collections must be indented");break}j+=D.length+f.length+1}for(let W=A.length-1;W>=O;--W)if(A[W][0].length>w)O=W+1;let J="",M="",X=!1;for(let W=0;W<H;++W)J+=A[W][0].slice(w)+`
678`;for(let W=H;W<O;++W){let[D,f]=A[W];j+=D.length+f.length+1;let G=f[f.length-1]==="\r";if(G)f=f.slice(0,-1);if(f&&D.length<w){let T=`Block scalar lines must not be less indented than their ${Y.indent?"explicit indentation indicator":"first line"}`;_(j-f.length-(G?2:1),"BAD_INDENT",T),D=""}if($===_h1.Scalar.BLOCK_LITERAL)J+=M+D.slice(w)+f,M=`
679`;else if(D.length>w||f[0]==="\t"){if(M===" ")M=`

Callers 1

oE_Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected