import{a as e}from"./chunk-D9Tnb9aB.js";import{t}from"./codemirror-DtW92bSi.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"./SchemaReference-DSzhn1RO.js";var c=e(t());c.default.defineOption(`jump`,!1,(e,t,n)=>{if(n&&n!==c.default.Init){let t=e.state.jump.onMouseOver;c.default.off(e.getWrapperElement(),`mouseover`,t);let n=e.state.jump.onMouseOut;c.default.off(e.getWrapperElement(),`mouseout`,n),c.default.off(document,`keydown`,e.state.jump.onKeyDown),delete e.state.jump}if(t){let n=e.state.jump={options:t,onMouseOver:l.bind(null,e),onMouseOut:u.bind(null,e),onKeyDown:d.bind(null,e)};c.default.on(e.getWrapperElement(),`mouseover`,n.onMouseOver),c.default.on(e.getWrapperElement(),`mouseout`,n.onMouseOut),c.default.on(document,`keydown`,n.onKeyDown)}});function l(e,t){let n=t.target||t.srcElement;if(!(n instanceof HTMLElement)||n?.nodeName!==`SPAN`)return;let r=n.getBoundingClientRect(),i={left:(r.left+r.right)/2,top:(r.top+r.bottom)/2};e.state.jump.cursor=i,e.state.jump.isHoldingModifier&&m(e)}function u(e){if(!e.state.jump.isHoldingModifier&&e.state.jump.cursor){e.state.jump.cursor=null;return}e.state.jump.isHoldingModifier&&e.state.jump.marker&&h(e)}function d(e,t){if(e.state.jump.isHoldingModifier||!p(t.key))return;e.state.jump.isHoldingModifier=!0,e.state.jump.cursor&&m(e);let n=a=>{a.code===t.code&&(e.state.jump.isHoldingModifier=!1,e.state.jump.marker&&h(e),c.default.off(document,`keyup`,n),c.default.off(document,`click`,r),e.off(`mousedown`,i))},r=t=>{let{destination:n,options:r}=e.state.jump;n&&r.onClick(n,t)},i=(t,n)=>{e.state.jump.destination&&(n.codemirrorIgnore=!0)};c.default.on(document,`keyup`,n),c.default.on(document,`click`,r),e.on(`mousedown`,i)}var f=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`);function p(e){return e===(f?`Meta`:`Control`)}function m(e){if(e.state.jump.marker)return;let{cursor:t,options:n}=e.state.jump,r=e.coordsChar(t),i=e.getTokenAt(r,!0),a=n.getDestination||e.getHelper(r,`jump`);if(a){let t=a(i,n,e);if(t){let n=e.markText({line:r.line,ch:i.start},{line:r.line,ch:i.end},{className:`CodeMirror-jump-token`});e.state.jump.marker=n,e.state.jump.destination=t}}}function h(e){let{marker:t}=e.state.jump;e.state.jump.marker=null,e.state.jump.destination=null,t.clear()}c.default.registerHelper(`jump`,`graphql`,(e,t)=>{if(!t.schema||!t.onClick||!e.state)return;let{state:c}=e,{kind:l,step:u}=c,d=a(t.schema,c);if(l===`Field`&&u===0&&d.fieldDef||l===`AliasedField`&&u===2&&d.fieldDef)return r(d);if(l===`Directive`&&u===1&&d.directiveDef)return i(d);if(l===`Argument`&&u===0&&d.argDef)return s(d);if(l===`EnumValue`&&d.enumValue)return o(d);if(l===`NamedType`&&d.type)return n(d)});
//# sourceMappingURL=jump-Dx0GFmO4.js.map