Files
netbox/netbox/project-static/dist/graphiql/index.umd.js
2026-01-12 14:34:17 -05:00

2 lines
44 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@graphiql/react"),require("graphql")):"function"==typeof define&&define.amd?define(["exports","react","@graphiql/react","graphql"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GraphiQLPluginExplorer={},e.React,e.GraphiQL.React,e.GraphiQL.GraphQL)}(this,(function(e,t,n,r){"use strict";function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const o=i(t),a=i(r);function l(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")&&1===Object.keys(e).length?e.default:e}var s={},p={};const u=l(o),c=l(a);var f,d;function m(){if(f)return p;f=1,Object.defineProperty(p,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(s){i=!0,o=s}finally{try{!r&&l.return&&l.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();p.defaultValue=w;var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(u),o=c;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function g(e){return e.charAt(0).toUpperCase()+e.slice(1)}var y={keyword:"#B11A04",def:"#D2054E",property:"#1F61A0",qualifier:"#1C92A9",attribute:"#8B2BB9",number:"#2882F9",string:"#D64292",builtin:"#D47509",string2:"#0B7FC7",variable:"#397D13",atom:"#CA9800"},v=i.createElement("svg",{width:"12",height:"9"},i.createElement("path",{fill:"#666",d:"M 0 2 L 9 2 L 4.5 7.5 z"})),h=i.createElement("svg",{width:"12",height:"9"},i.createElement("path",{fill:"#666",d:"M 0 0 L 0 9 L 5.5 4.5 z"})),b=i.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0ZM16 16H2V2H16V16ZM14.99 6L13.58 4.58L6.99 11.17L4.41 8.6L2.99 10.01L6.99 14L14.99 6Z",fill:"#666"})),k=i.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z",fill:"#CCC"}));function S(e){return e.checked?e.styleConfig.checkboxChecked:e.styleConfig.checkboxUnchecked}function E(e){var t=e.getFields();if(t.id){var n=["id"];return t.email?n.push("email"):t.name&&n.push("name"),n}if(t.edges)return["edges"];if(t.node)return["node"];if(t.nodes)return["nodes"];var r=[];return Object.keys(t).forEach((function(e){(0,o.isLeafType)(t[e].type)&&r.push(e)})),r.length?r.slice(0,2):["__typename"]}function C(e){return(0,o.isNonNullType)(e.type)&&void 0===e.defaultValue}function _(e){for(var t=e;(0,o.isWrappingType)(t);)t=t.ofType;return t}function A(e,t){if("string"!=typeof t&&"VariableDefinition"===t.kind)return t.variable;if((0,o.isScalarType)(e))try{switch(e.name){case"String":return{kind:"StringValue",value:String(e.parseValue(t))};case"Float":return{kind:"FloatValue",value:String(e.parseValue(parseFloat(t)))};case"Int":return{kind:"IntValue",value:String(e.parseValue(parseInt(t,10)))};case"Boolean":try{var n=JSON.parse(t);return"boolean"==typeof n?{kind:"BooleanValue",value:n}:{kind:"BooleanValue",value:!1}}catch(i){return{kind:"BooleanValue",value:!1}}default:return{kind:"StringValue",value:String(e.parseValue(t))}}}catch(i){return console.error("error coercing arg value",i,t),{kind:"StringValue",value:t}}else try{var r=e.parseValue(t);return r?{kind:"EnumValue",value:String(r)}:{kind:"EnumValue",value:e.getValues()[0].name}}catch(i){return{kind:"EnumValue",value:e.getValues()[0].name}}}var O=function(e){function t(){var e,r,i;s(this,t);for(var a=arguments.length,p=Array(a),u=0;u<a;u++)p[u]=arguments[u];return r=i=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(p))),i._getArgSelection=function(){return i.props.selection.fields.find((function(e){return e.name.value===i.props.arg.name}))},i._removeArg=function(){var e=i.props.selection,t=i._getArgSelection();i._previousArgSelection=t,i.props.modifyFields(e.fields.filter((function(e){return e!==t})),!0)},i._addArg=function(){var e=i.props,t=e.selection,n=e.arg,r=e.getDefaultScalarArgValue,a=e.parentField,s=e.makeDefaultArg,p=_(n.type),u=null;if(i._previousArgSelection)u=i._previousArgSelection;else if((0,o.isInputObjectType)(p)){var c=p.getFields();u={kind:"ObjectField",name:{kind:"Name",value:n.name},value:{kind:"ObjectValue",fields:j(r,s,a,Object.keys(c).map((function(e){return c[e]})))}}}else(0,o.isLeafType)(p)&&(u={kind:"ObjectField",name:{kind:"Name",value:n.name},value:r(a,n,p)});if(u)return i.props.modifyFields([].concat(l(t.fields||[]),[u]),!0);console.error("Unable to add arg for argType",p)},i._setArgValue=function(e,t){var r=!1,a=!1,l=!1;try{"VariableDefinition"===e.kind?a=!0:null==e?r=!0:"string"==typeof e.kind&&(l=!0)}catch(d){}var s=i.props.selection,p=i._getArgSelection();if(p){var u=_(i.props.arg.type);if((0,o.isLeafType)(u)||a||r||l){var c=void 0,f=void 0;return null==e?f=null:!e.target&&e.kind&&"VariableDefinition"===e.kind?f=(c=e).variable:"string"==typeof e.kind?f=e:e.target&&"string"==typeof e.target.value&&(c=e.target.value,f=A(u,c)),i.props.modifyFields((s.fields||[]).map((function(e){return e===p?n({},e,{value:f}):e})),t)}console.warn("Unable to handle non leaf types in InputArgView.setArgValue",e)}else console.error("missing arg selection when setting arg value")},i._modifyChildFields=function(e){return i.props.modifyFields(i.props.selection.fields.map((function(t){return t.name.value===i.props.arg.name?n({},t,{value:{kind:"ObjectValue",fields:e}}):t})),!0)},d(i,r)}return m(t,e),r(t,[{key:"render",value:function(){var e=this.props,t=e.arg,n=e.parentField,r=this._getArgSelection();return i.createElement(D,{argValue:r?r.value:null,arg:t,parentField:n,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._modifyChildFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig,onCommit:this.props.onCommit,definition:this.props.definition})}}]),t}(i.PureComponent);function w(e){if((0,o.isEnumType)(e))return{kind:"EnumValue",value:e.getValues()[0].name};switch(e.name){case"String":default:return{kind:"StringValue",value:""};case"Float":return{kind:"FloatValue",value:"1.5"};case"Int":return{kind:"IntValue",value:"10"};case"Boolean":return{kind:"BooleanValue",value:!1}}}function x(e,t,n){return w(n)}var F=function(e){function t(){var e,r,i;s(this,t);for(var a=arguments.length,p=Array(a),u=0;u<a;u++)p[u]=arguments[u];return r=i=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(p))),i._getArgSelection=function(){return(i.props.selection.arguments||[]).find((function(e){return e.name.value===i.props.arg.name}))},i._removeArg=function(e){var t=i.props.selection,n=i._getArgSelection();return i._previousArgSelection=n,i.props.modifyArguments((t.arguments||[]).filter((function(e){return e!==n})),e)},i._addArg=function(e){var t=i.props,n=t.selection,r=t.getDefaultScalarArgValue,a=t.makeDefaultArg,s=t.parentField,p=t.arg,u=_(p.type),c=null;if(i._previousArgSelection)c=i._previousArgSelection;else if((0,o.isInputObjectType)(u)){var f=u.getFields();c={kind:"Argument",name:{kind:"Name",value:p.name},value:{kind:"ObjectValue",fields:j(r,a,s,Object.keys(f).map((function(e){return f[e]})))}}}else(0,o.isLeafType)(u)&&(c={kind:"Argument",name:{kind:"Name",value:p.name},value:r(s,p,u)});return c?i.props.modifyArguments([].concat(l(n.arguments||[]),[c]),e):(console.error("Unable to add arg for argType",u),null)},i._setArgValue=function(e,t){var r=!1,a=!1,l=!1;try{"VariableDefinition"===e.kind?a=!0:null==e?r=!0:"string"==typeof e.kind&&(l=!0)}catch(d){}var s=i.props.selection,p=i._getArgSelection();if(p||a){var u=_(i.props.arg.type);if((0,o.isLeafType)(u)||a||r||l){var c=void 0,f=void 0;return null==e?f=null:e.target&&"string"==typeof e.target.value?(c=e.target.value,f=A(u,c)):e.target||"VariableDefinition"!==e.kind?"string"==typeof e.kind&&(f=e):f=(c=e).variable,i.props.modifyArguments((s.arguments||[]).map((function(e){return e===p?n({},e,{value:f}):e})),t)}console.warn("Unable to handle non leaf types in ArgView._setArgValue")}else console.error("missing arg selection when setting arg value")},i._setArgFields=function(e,t){var r=i.props.selection,o=i._getArgSelection();if(o)return i.props.modifyArguments((r.arguments||[]).map((function(t){return t===o?n({},t,{value:{kind:"ObjectValue",fields:e}}):t})),t);console.error("missing arg selection when setting arg value")},d(i,r)}return m(t,e),r(t,[{key:"render",value:function(){var e=this.props,t=e.arg,n=e.parentField,r=this._getArgSelection();return i.createElement(D,{argValue:r?r.value:null,arg:t,parentField:n,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._setArgFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig,onCommit:this.props.onCommit,definition:this.props.definition})}}]),t}(i.PureComponent);var V=function(e){function t(){var e,n,r;s(this,t);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r._handleChange=function(e){r.props.setArgValue(e,!0)},d(r,n)}return m(t,e),r(t,[{key:"componentDidMount",value:function(){var e=this._ref,t=document.activeElement;!e||!t||t instanceof HTMLTextAreaElement||(e.focus(),e.setSelectionRange(0,e.value.length))}},{key:"render",value:function(){var e=this,t=this.props,n=t.arg,r=t.argValue,o=t.styleConfig,a=_(n.type),l="string"==typeof r.value?r.value:"",s="StringValue"===this.props.argValue.kind?o.colors.string:o.colors.number;return i.createElement("span",{style:{color:s}},"String"===a.name?'"':"",i.createElement("input",{style:{border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(1,Math.min(15,l.length))+"ch",color:s},ref:function(t){e._ref=t},type:"text",onChange:this._handleChange,value:l}),"String"===a.name?'"':"")}}]),t}(i.PureComponent),D=function(e){function a(){var e,t,n;s(this,a);for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=n=d(this,(e=a.__proto__||Object.getPrototypeOf(a)).call.apply(e,[this].concat(i))),n.state={displayArgActions:!1},d(n,t)}return m(a,e),r(a,[{key:"render",value:function(){var e=this,r=this.props,a=r.argValue,s=r.arg,p=r.styleConfig,u=_(s.type),c=null;if(a)if("Variable"===a.kind)c=i.createElement("span",{style:{color:p.colors.variable}},"$",a.name.value);else if((0,o.isScalarType)(u))c="Boolean"===u.name?i.createElement("select",{style:{color:p.colors.builtin},onChange:this.props.setArgValue,value:"BooleanValue"===a.kind?a.value:void 0},i.createElement("option",{key:"true",value:"true"},"true"),i.createElement("option",{key:"false",value:"false"},"false")):i.createElement(V,{setArgValue:this.props.setArgValue,arg:s,argValue:a,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig});else if((0,o.isEnumType)(u))"EnumValue"===a.kind?c=i.createElement("select",{style:{backgroundColor:"white",color:p.colors.string2},onChange:this.props.setArgValue,value:a.value},u.getValues().map((function(e){return i.createElement("option",{key:e.name,value:e.name},e.name)}))):console.error("arg mismatch between arg and selection",u,a);else if((0,o.isInputObjectType)(u))if("ObjectValue"===a.kind){var f=u.getFields();c=i.createElement("div",{style:{marginLeft:16}},Object.keys(f).sort().map((function(t){return i.createElement(O,{key:t,arg:f[t],parentField:e.props.parentField,selection:a,modifyFields:e.props.setArgFields,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})})))}else console.error("arg mismatch between arg and selection",u,a);var d=function(){var r=s.name,i=(e.props.definition.variableDefinitions||[]).filter((function(e){return e.variable.name.value.startsWith(r)})).length,p=void 0;p=i>0?""+r+i:r;var u=s.type.toString(),c={kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:p}},type:(0,o.parseType)(u),directives:[]},f=void 0,d={};if(null!=a){var m=(0,o.visit)(a,{Variable:function(t){var n,r=t.name.value,i=(n=r,(e.props.definition.variableDefinitions||[]).find((function(e){return e.variable.name.value===n})));if(d[r]=d[r]+1||1,i)return i.defaultValue}}),g="NonNullType"===c.type.kind?n({},c,{type:c.type.type}):c;f=n({},g,{defaultValue:m})}else f=c;var y=Object.entries(d).filter((function(e){var n=t(e,2);return n[0],n[1]<2})).map((function(e){var n=t(e,2),r=n[0];return n[1],r}));if(f){var v=e.props.setArgValue(f,!1);if(v){var h=v.definitions.find((function(t){return!!(t.operation&&t.name&&t.name.value&&e.props.definition.name&&e.props.definition.name.value)&&t.name.value===e.props.definition.name.value})),b=[].concat(l(h.variableDefinitions||[]),[f]).filter((function(e){return-1===y.indexOf(e.variable.name.value)})),k=n({},h,{variableDefinitions:b}),S=v.definitions.map((function(e){return h===e?k:e})),E=n({},v,{definitions:S});e.props.onCommit(E)}}},m=a&&"Variable"===a.kind,g=this.state.displayArgActions?i.createElement("button",{type:"submit",className:"toolbar-button",title:m?"Remove the variable":"Extract the current value into a GraphQL variable",onClick:function(t){t.preventDefault(),t.stopPropagation(),m?function(){if(a&&a.name&&a.name.value){var t=a.name.value,r=(e.props.definition.variableDefinitions||[]).find((function(e){return e.variable.name.value===t}));if(r){var i=r.defaultValue,l=e.props.setArgValue(i,{commit:!1});if(l){var s=l.definitions.find((function(t){return t.name.value===e.props.definition.name.value}));if(!s)return;var p=0;(0,o.visit)(s,{Variable:function(e){e.name.value===t&&(p+=1)}});var u=s.variableDefinitions||[];p<2&&(u=u.filter((function(e){return e.variable.name.value!==t})));var c=n({},s,{variableDefinitions:u}),f=l.definitions.map((function(e){return s===e?c:e})),d=n({},l,{definitions:f});e.props.onCommit(d)}}}}():d()},style:p.styles.actionButtonStyle},i.createElement("span",{style:{color:p.colors.variable}},"$")):null;return i.createElement("div",{style:{cursor:"pointer",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-arg-name":s.name,"data-arg-type":u.name,className:"graphiql-explorer-"+s.name},i.createElement("span",{style:{cursor:"pointer"},onClick:function(t){var n=!a;n?e.props.addArg(!0):e.props.removeArg(!0),e.setState({displayArgActions:n})}},(0,o.isInputObjectType)(u)?i.createElement("span",null,a?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):i.createElement(S,{checked:!!a,styleConfig:this.props.styleConfig}),i.createElement("span",{style:{color:p.colors.attribute},title:s.description,onMouseEnter:function(){null!=a&&e.setState({displayArgActions:!0})},onMouseLeave:function(){return e.setState({displayArgActions:!1})}},s.name,C(s)?"*":"",": ",g," ")," "),c||i.createElement("span",null)," ")}}]),a}(i.PureComponent),T=function(e){function t(){var e,n,r;s(this,t);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r._addFragment=function(){r.props.modifySelections([].concat(l(r.props.selections),[r._previousSelection||{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:r.props.getDefaultFieldNames(r.props.implementingType).map((function(e){return{kind:"Field",name:{kind:"Name",value:e}}}))}}]))},r._removeFragment=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter((function(t){return t!==e})))},r._getSelection=function(){var e=r.props.selections.find((function(e){return"InlineFragment"===e.kind&&e.typeCondition&&r.props.implementingType.name===e.typeCondition.name.value}));return e?"InlineFragment"===e.kind?e:void 0:null},r._modifyChildSelections=function(e,t){var n=r._getSelection();return r.props.modifySelections(r.props.selections.map((function(t){return t===n?{directives:t.directives,kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:e}}:t})),t)},d(r,n)}return m(t,e),r(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.implementingType,r=t.schema,o=t.getDefaultFieldNames,a=t.styleConfig,l=this._getSelection(),s=n.getFields(),p=l&&l.selectionSet?l.selectionSet.selections:[];return i.createElement("div",{className:"graphiql-explorer-"+n.name},i.createElement("span",{style:{cursor:"pointer"},onClick:l?this._removeFragment:this._addFragment},i.createElement(S,{checked:!!l,styleConfig:this.props.styleConfig}),i.createElement("span",{style:{color:a.colors.atom}},this.props.implementingType.name)),l?i.createElement("div",{style:{marginLeft:16}},Object.keys(s).sort().map((function(t){return i.createElement(M,{key:t,field:s[t],selections:p,modifySelections:e._modifyChildSelections,schema:r,getDefaultFieldNames:o,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,onCommit:e.props.onCommit,styleConfig:e.props.styleConfig,definition:e.props.definition,availableFragments:e.props.availableFragments})}))):null)}}]),t}(i.PureComponent),N=function(e){function t(){var e,n,r;s(this,t);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r._addFragment=function(){r.props.modifySelections([].concat(l(r.props.selections),[r._previousSelection||{kind:"FragmentSpread",name:r.props.fragment.name}]))},r._removeFragment=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter((function(e){return!("FragmentSpread"===e.kind&&e.name.value===r.props.fragment.name.value)})))},r._getSelection=function(){return r.props.selections.find((function(e){return"FragmentSpread"===e.kind&&e.name.value===r.props.fragment.name.value}))},d(r,n)}return m(t,e),r(t,[{key:"render",value:function(){var e=this.props.styleConfig,t=this._getSelection();return i.createElement("div",{className:"graphiql-explorer-"+this.props.fragment.name.value},i.createElement("span",{style:{cursor:"pointer"},onClick:t?this._removeFragment:this._addFragment},i.createElement(S,{checked:!!t,styleConfig:this.props.styleConfig}),i.createElement("span",{style:{color:e.colors.def},className:"graphiql-explorer-"+this.props.fragment.name.value},this.props.fragment.name.value)))}}]),t}(i.PureComponent);function j(e,t,n,r){var i=[],a=!0,l=!1,s=void 0;try{for(var p,u=r[Symbol.iterator]();!(a=(p=u.next()).done);a=!0){var c=p.value;if((0,o.isRequiredInputField)(c)||t&&t(n,c)){var f=_(c.type);(0,o.isInputObjectType)(f)?function(){var r=f.getFields();i.push({kind:"ObjectField",name:{kind:"Name",value:c.name},value:{kind:"ObjectValue",fields:j(e,t,n,Object.keys(r).map((function(e){return r[e]})))}})}():(0,o.isLeafType)(f)&&i.push({kind:"ObjectField",name:{kind:"Name",value:c.name},value:e(n,c,f)})}}}catch(d){l=!0,s=d}finally{try{!a&&u.return&&u.return()}finally{if(l)throw s}}return i}function L(e,t,n){var r=[],i=!0,a=!1,l=void 0;try{for(var s,p=n.args[Symbol.iterator]();!(i=(s=p.next()).done);i=!0){var u=s.value;if(C(u)||t&&t(n,u)){var c=_(u.type);(0,o.isInputObjectType)(c)?function(){var i=c.getFields();r.push({kind:"Argument",name:{kind:"Name",value:u.name},value:{kind:"ObjectValue",fields:j(e,t,n,Object.keys(i).map((function(e){return i[e]})))}})}():(0,o.isLeafType)(c)&&r.push({kind:"Argument",name:{kind:"Name",value:u.name},value:e(n,u,c)})}}}catch(f){a=!0,l=f}finally{try{!i&&p.return&&p.return()}finally{if(a)throw l}}return r}var M=function(e){function t(){var e,n,r;s(this,t);for(var i=arguments.length,a=Array(i),p=0;p<i;p++)a[p]=arguments[p];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.state={displayFieldActions:!1},r._addAllFieldsToSelections=function(e){var t={kind:"SelectionSet",selections:e?Object.keys(e).map((function(e){return{kind:"Field",name:{kind:"Name",value:e},arguments:[]}})):[]},n=[].concat(l(r.props.selections.filter((function(e){return"InlineFragment"===e.kind||e.name.value!==r.props.field.name}))),[{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:L(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field),selectionSet:t}]);r.props.modifySelections(n)},r._addFieldToSelections=function(e){var t=[].concat(l(r.props.selections),[r._previousSelection||{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:L(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field)}]);r.props.modifySelections(t)},r._handleUpdateSelections=function(e){if(r._getSelection()&&!e.altKey)r._removeFieldFromSelections();else{var t=(0,o.getNamedType)(r.props.field.type),n=(0,o.isObjectType)(t)&&t.getFields();!!n&&e.altKey?r._addAllFieldsToSelections(n):r._addFieldToSelections(n)}},r._removeFieldFromSelections=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter((function(t){return t!==e})))},r._getSelection=function(){var e=r.props.selections.find((function(e){return"Field"===e.kind&&r.props.field.name===e.name.value}));return e?"Field"===e.kind?e:void 0:null},r._setArguments=function(e,t){var n=r._getSelection();if(n)return r.props.modifySelections(r.props.selections.map((function(t){return t===n?{alias:n.alias,arguments:e,directives:n.directives,kind:"Field",name:n.name,selectionSet:n.selectionSet}:t})),t);console.error("Missing selection when setting arguments",e)},r._modifyChildSelections=function(e,t){return r.props.modifySelections(r.props.selections.map((function(t){if("Field"===t.kind&&r.props.field.name===t.name.value){if("Field"!==t.kind)throw new Error("invalid selection");return{alias:t.alias,arguments:t.arguments,directives:t.directives,kind:"Field",name:t.name,selectionSet:{kind:"SelectionSet",selections:e}}}return t})),t)},d(r,n)}return m(t,e),r(t,[{key:"render",value:function(){var e=this,r=this.props,a=r.field,s=r.schema,p=r.getDefaultFieldNames,u=r.styleConfig,c=this._getSelection(),f=function(e){for(var t=e;(0,o.isWrappingType)(t);)t=t.ofType;return t}(a.type),d=a.args.sort((function(e,t){return e.name.localeCompare(t.name)})),m="graphiql-explorer-node graphiql-explorer-"+a.name;a.isDeprecated&&(m+=" graphiql-explorer-deprecated");var g=(0,o.isObjectType)(f)||(0,o.isInterfaceType)(f)||(0,o.isUnionType)(f)?this.props.availableFragments&&this.props.availableFragments[f.name]:null,y=i.createElement("div",{className:m},i.createElement("span",{title:a.description,style:{cursor:"pointer",display:"inline-flex",alignItems:"center",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-field-name":a.name,"data-field-type":f.name,onClick:this._handleUpdateSelections,onMouseEnter:function(){(0,o.isObjectType)(f)&&c&&c.selectionSet&&c.selectionSet.selections.filter((function(e){return"FragmentSpread"!==e.kind})).length>0&&e.setState({displayFieldActions:!0})},onMouseLeave:function(){return e.setState({displayFieldActions:!1})}},(0,o.isObjectType)(f)?i.createElement("span",null,c?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):null,(0,o.isObjectType)(f)?null:i.createElement(S,{checked:!!c,styleConfig:this.props.styleConfig}),i.createElement("span",{style:{color:u.colors.property},className:"graphiql-explorer-field-view"},a.name),this.state.displayFieldActions?i.createElement("button",{type:"submit",className:"toolbar-button",title:"Extract selections into a new reusable fragment",onClick:function(t){t.preventDefault(),t.stopPropagation();var r=f.name+"Fragment",i=(g||[]).filter((function(e){return e.name.value.startsWith(r)})).length;i>0&&(r=""+r+i);var o=c&&c.selectionSet?c.selectionSet.selections:[],a=[{kind:"FragmentSpread",name:{kind:"Name",value:r},directives:[]}],s={kind:"FragmentDefinition",name:{kind:"Name",value:r},typeCondition:{kind:"NamedType",name:{kind:"Name",value:f.name}},directives:[],selectionSet:{kind:"SelectionSet",selections:o}},p=e._modifyChildSelections(a,!1);if(p){var u=n({},p,{definitions:[].concat(l(p.definitions),[s])});e.props.onCommit(u)}else console.warn("Unable to complete extractFragment operation")},style:n({},u.styles.actionButtonStyle)},i.createElement("span",null,"…")):null),c&&d.length?i.createElement("div",{style:{marginLeft:16},className:"graphiql-explorer-graphql-arguments"},d.map((function(t){return i.createElement(F,{key:t.name,parentField:a,arg:t,selection:c,modifyArguments:e._setArguments,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})}))):null);if(c&&((0,o.isObjectType)(f)||(0,o.isInterfaceType)(f)||(0,o.isUnionType)(f))){var v=(0,o.isUnionType)(f)?{}:f.getFields(),h=c&&c.selectionSet?c.selectionSet.selections:[];return i.createElement("div",{className:"graphiql-explorer-"+a.name},y,i.createElement("div",{style:{marginLeft:16}},g?g.map((function(t){var n=s.getType(t.typeCondition.name.value),r=t.name.value;return n?i.createElement(N,{key:r,fragment:t,selections:h,modifySelections:e._modifyChildSelections,schema:s,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit}):null})):null,Object.keys(v).sort().map((function(n){return i.createElement(t,{key:n,field:v[n],selections:h,modifySelections:e._modifyChildSelections,schema:s,getDefaultFieldNames:p,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition,availableFragments:e.props.availableFragments})})),(0,o.isInterfaceType)(f)||(0,o.isUnionType)(f)?s.getPossibleTypes(f).map((function(t){return i.createElement(T,{key:t.name,implementingType:t,selections:h,modifySelections:e._modifyChildSelections,schema:s,getDefaultFieldNames:p,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})})):null))}return y}}]),t}(i.PureComponent);var P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",variableDefinitions:[],name:{kind:"Name",value:"MyQuery"},directives:[],selectionSet:{kind:"SelectionSet",selections:[]}}]},I=null;function R(e){if(I&&I[0]===e)return I[1];var t=function(e){try{return e.trim()?(0,o.parse)(e,{noLocation:!0}):null}catch(t){return new Error(t)}}(e);return t?t instanceof Error?I?I[1]:P:(I=[e,t],t):P}var q={buttonStyle:{fontSize:"1.2em",padding:"0px",backgroundColor:"white",border:"none",margin:"5px 0px",height:"40px",width:"100%",display:"block",maxWidth:"none"},actionButtonStyle:{padding:"0px",backgroundColor:"white",border:"none",margin:"0px",maxWidth:"none",height:"15px",width:"15px",display:"inline-block",fontSize:"smaller"},explorerActionsStyle:{margin:"4px -8px -8px",paddingLeft:"8px",bottom:"0px",width:"100%",textAlign:"center",background:"none",borderTop:"none",borderBottom:"none"}},B=function(e){function t(){var e,r,i;s(this,t);for(var o=arguments.length,a=Array(o),l=0;l<o;l++)a[l]=arguments[l];return r=i=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),i.state={newOperationType:"query",displayTitleActions:!1},i._modifySelections=function(e,t){var r=i.props.definition;0===r.selectionSet.selections.length&&i._previousOperationDef&&(r=i._previousOperationDef);var o=void 0;if("FragmentDefinition"===r.kind)o=n({},r,{selectionSet:n({},r.selectionSet,{selections:e})});else if("OperationDefinition"===r.kind){var a=e.filter((function(e){return!("Field"===e.kind&&"__typename"===e.name.value)}));0===a.length&&(a=[{kind:"Field",name:{kind:"Name",value:"__typename ## Placeholder value"}}]),o=n({},r,{selectionSet:n({},r.selectionSet,{selections:a})})}return i.props.onEdit(o,t)},i._onOperationRename=function(e){return i.props.onOperationRename(e.target.value)},i._handlePotentialRun=function(e){(function(e){return e.ctrlKey&&"Enter"===e.key})(e)&&"FragmentDefinition"!==i.props.definition.kind&&i.props.onRunOperation(i.props.name)},i._rootViewElId=function(){var e=i.props;return e.operationType+"-"+(e.name||"unknown")},d(i,r)}return m(t,e),r(t,[{key:"componentDidMount",value:function(){var e=this._rootViewElId();this.props.onMount(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.operationType,o=t.definition,a=t.schema,l=t.getDefaultFieldNames,s=t.styleConfig,p=this._rootViewElId(),u=this.props.fields||{},c=o.selectionSet.selections,f=this.props.name||g(r)+" Name";return i.createElement("div",{id:p,tabIndex:"0",onKeyDown:this._handlePotentialRun,style:{borderBottom:this.props.isLast?"none":"1px solid #d6d6d6",marginBottom:"0em",paddingBottom:"1em"}},i.createElement("div",{style:{color:s.colors.keyword,paddingBottom:4},className:"graphiql-operation-title-bar",onMouseEnter:function(){return e.setState({displayTitleActions:!0})},onMouseLeave:function(){return e.setState({displayTitleActions:!1})}},r," ",i.createElement("span",{style:{color:s.colors.def}},i.createElement("input",{style:{color:s.colors.def,border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(4,f.length)+"ch"},autoComplete:"false",placeholder:g(r)+" Name",value:this.props.name,onKeyDown:this._handlePotentialRun,onChange:this._onOperationRename})),this.props.onTypeName?i.createElement("span",null,i.createElement("br",null),"on "+this.props.onTypeName):"",this.state.displayTitleActions?i.createElement(i.Fragment,null,i.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return e.props.onOperationDestroy()},style:n({},s.styles.actionButtonStyle)},i.createElement("span",null,"✕")),i.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return e.props.onOperationClone()},style:n({},s.styles.actionButtonStyle)},i.createElement("span",null,"⎘"))):""),Object.keys(u).sort().map((function(t){return i.createElement(M,{key:t,field:u[t],selections:c,modifySelections:e._modifySelections,schema:a,getDefaultFieldNames:l,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition,availableFragments:e.props.availableFragments})})))}}]),t}(i.PureComponent);function H(){return i.createElement("div",{style:{fontFamily:"sans-serif",display:"flex",flexDirection:"column",alignItems:"center",margin:"1em",marginTop:0,flexGrow:1,justifyContent:"flex-end"}},i.createElement("div",{style:{borderTop:"1px solid #d6d6d6",paddingTop:"1em",width:"100%",textAlign:"center"}},"GraphiQL Explorer by ",i.createElement("a",{href:"https://www.onegraph.com"},"OneGraph")),i.createElement("div",null,"Contribute on"," ",i.createElement("a",{href:"https://github.com/OneGraph/graphiql-explorer"},"GitHub")))}var U=function(t){function p(){var e,t,n;s(this,p);for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=n=d(this,(e=p.__proto__||Object.getPrototypeOf(p)).call.apply(e,[this].concat(i))),n.state={newOperationType:"query",operation:null,operationToScrollTo:null},n._resetScroll=function(){var e=n._ref;e&&(e.scrollLeft=0)},n._onEdit=function(e){return n.props.onEdit(e)},n._setAddOperationType=function(e){n.setState({newOperationType:e})},n._handleRootViewMount=function(e){if(n.state.operationToScrollTo&&n.state.operationToScrollTo===e){var t=".graphiql-explorer-root #"+e,r=document.querySelector(t);r&&r.scrollIntoView()}},d(n,t)}return m(p,t),r(p,[{key:"componentDidMount",value:function(){this._resetScroll()}},{key:"render",value:function(){var t=this,r=this.props,s=r.schema,p=r.query,u=r.makeDefaultArg;if(!s)return i.createElement("div",{style:{fontFamily:"sans-serif"},className:"error-container"},"No Schema Available");var c={colors:this.props.colors||y,checkboxChecked:this.props.checkboxChecked||b,checkboxUnchecked:this.props.checkboxUnchecked||k,arrowClosed:this.props.arrowClosed||h,arrowOpen:this.props.arrowOpen||v,styles:this.props.styles?n({},q,this.props.styles):q},f=s.getQueryType(),d=s.getMutationType(),m=s.getSubscriptionType();if(!f&&!d&&!m)return i.createElement("div",null,"Missing query type");var S=f&&f.getFields(),C=d&&d.getFields(),_=m&&m.getFields(),A=R(p),O=this.props.getDefaultFieldNames||E,w=this.props.getDefaultScalarArgValue||x,F=A.definitions.map((function(e){return"FragmentDefinition"===e.kind||"OperationDefinition"===e.kind?e:null})).filter(Boolean),V=0===F.length?P.definitions:F,D=[S?i.createElement("option",{key:"query",className:"toolbar-button",style:c.styles.buttonStyle,type:"link",value:"query"},"Query"):null,C?i.createElement("option",{key:"mutation",className:"toolbar-button",style:c.styles.buttonStyle,type:"link",value:"mutation"},"Mutation"):null,_?i.createElement("option",{key:"subscription",className:"toolbar-button",style:c.styles.buttonStyle,type:"link",value:"subscription"},"Subscription"):null].filter(Boolean),T=0===D.length||this.props.hideActions?null:i.createElement("div",{style:{minHeight:"50px",maxHeight:"50px",overflow:"none"}},i.createElement("form",{className:"variable-editor-title graphiql-explorer-actions",style:n({},c.styles.explorerActionsStyle,{display:"flex",flexDirection:"row",alignItems:"center",borderTop:"1px solid rgb(214, 214, 214)"}),onSubmit:function(e){return e.preventDefault()}},i.createElement("span",{style:{display:"inline-block",flexGrow:"0",textAlign:"right"}},"Add new"," "),i.createElement("select",{onChange:function(e){return t._setAddOperationType(e.target.value)},value:this.state.newOperationType,style:{flexGrow:"2"}},D),i.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return t.state.newOperationType?(e=t.state.newOperationType,r=A.definitions,i=1===A.definitions.length&&A.definitions[0]===P.definitions[0],a=i?[]:r.filter((function(t){return"OperationDefinition"===t.kind&&t.operation===e})),s="My"+g(e)+(0===a.length?"":a.length+1),p={kind:"OperationDefinition",operation:e,name:{kind:"Name",value:s},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename # Placeholder value",loc:null},arguments:[],directives:[],selectionSet:null,loc:null}],loc:null},loc:null},u=i?[p]:[].concat(l(A.definitions),[p]),c=n({},A,{definitions:u}),t.setState({operationToScrollTo:e+"-"+s}),void t.props.onEdit((0,o.print)(c))):null;var e,r,i,a,s,p,u,c},style:n({},c.styles.buttonStyle,{height:"22px",width:"22px"})},i.createElement("span",null,"+")))),N=this.props.externalFragments&&this.props.externalFragments.reduce((function(e,t){if("FragmentDefinition"===t.kind){var r=t.typeCondition.name.value,i=e[r]||[],o=[].concat(l(i),[t]).sort((function(e,t){return e.name.value.localeCompare(t.name.value)}));return n({},e,a({},r,o))}return e}),{}),j=V.reduce((function(e,t){if("FragmentDefinition"===t.kind){var r=t.typeCondition.name.value,i=e[r]||[],o=[].concat(l(i),[t]).sort((function(e,t){return e.name.value.localeCompare(t.name.value)}));return n({},e,a({},r,o))}return e}),{}),L=n({},j,N),M=this.props.showAttribution?i.createElement(H,null):null;return i.createElement("div",{ref:function(e){t._ref=e},style:{fontSize:12,textOverflow:"ellipsis",whiteSpace:"nowrap",margin:0,padding:8,fontFamily:'Consolas, Inconsolata, "Droid Sans Mono", Monaco, monospace',display:"flex",flexDirection:"column",height:"100%"},className:"graphiql-explorer-root"},i.createElement("div",{style:{flexGrow:"1",overflow:"scroll"}},V.map((function(r,a){var p=r&&r.name&&r.name.value,f="FragmentDefinition"===r.kind?"fragment":r&&r.operation||"query",d="FragmentDefinition"===r.kind&&"NamedType"===r.typeCondition.kind&&s.getType(r.typeCondition.name.value),m=d instanceof o.GraphQLObjectType?d.getFields():null,g="query"===f?S:"mutation"===f?C:"subscription"===f?_:"FragmentDefinition"===r.kind?m:null,y="FragmentDefinition"===r.kind?r.typeCondition.name.value:null,v=function(e){var n=(0,o.print)(e);t.props.onEdit(n)};return i.createElement(B,{key:a,isLast:a===V.length-1,fields:g,operationType:f,name:p,definition:r,onOperationRename:function(e){var i,a,l,s,p=(l=n({},i=r,{name:null==(a=e)||""===a?null:{kind:"Name",value:a,loc:void 0}}),s=A.definitions.map((function(e){return i===e?l:e})),n({},A,{definitions:s}));t.props.onEdit((0,o.print)(p))},onOperationDestroy:function(){var e,i,a=(e=r,i=A.definitions.filter((function(t){return e!==t})),n({},A,{definitions:i}));t.props.onEdit((0,o.print)(a))},onOperationClone:function(){var e=function(e){var r=void 0;r="FragmentDefinition"===e.kind?"fragment":e.operation;var i=(e.name&&e.name.value||"")+"Copy",o=n({},e,{name:{kind:"Name",value:i,loc:void 0}}),a=A.definitions,s=[].concat(l(a),[o]);return t.setState({operationToScrollTo:r+"-"+i}),n({},A,{definitions:s})}(r);t.props.onEdit((0,o.print)(e))},onTypeName:y,onMount:t._handleRootViewMount,onCommit:v,onEdit:function(t,i){var o=void 0;if(o="object"!==(void 0===i?"undefined":e(i))||void 0===i.commit||i.commit,t){var a=n({},A,{definitions:A.definitions.map((function(e){return e===r?t:e}))});return o?(v(a),a):a}return A},schema:s,getDefaultFieldNames:O,getDefaultScalarArgValue:w,makeDefaultArg:u,onRunOperation:function(){t.props.onRunOperation&&t.props.onRunOperation(p)},styleConfig:c,availableFragments:L})})),M),T)}}]),p}(i.PureComponent);U.defaultProps={getDefaultFieldNames:E,getDefaultScalarArgValue:x};var G=function(e){function t(){var e,n,r;s(this,t);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r.state={hasError:!1,error:null,errorInfo:null},d(r,n)}return m(t,e),r(t,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0,error:e,errorInfo:t}),console.error("Error in component",e,t)}},{key:"render",value:function(){return this.state.hasError?i.createElement("div",{style:{padding:18,fontFamily:"sans-serif"}},i.createElement("div",null,"Something went wrong"),i.createElement("details",{style:{whiteSpace:"pre-wrap"}},this.state.error?this.state.error.toString():null,i.createElement("br",null),this.state.errorInfo?this.state.errorInfo.componentStack:null)):this.props.children}}]),t}(i.Component),W=function(e){function t(){return s(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return m(t,e),r(t,[{key:"render",value:function(){return i.createElement("div",{className:"docExplorerWrap",style:{height:"100%",width:this.props.width,minWidth:this.props.width,zIndex:7,display:this.props.explorerIsOpen?"flex":"none",flexDirection:"column",overflow:"hidden"}},i.createElement("div",{className:"doc-explorer-title-bar"},i.createElement("div",{className:"doc-explorer-title"},this.props.title),i.createElement("div",{className:"doc-explorer-rhs"},i.createElement("div",{className:"docExplorerHide",onClick:this.props.onToggleExplorer},"✕"))),i.createElement("div",{className:"doc-explorer-contents",style:{padding:"0px",overflowY:"unset"}},i.createElement(G,null,i.createElement(U,this.props))))}}]),t}(i.PureComponent);return W.defaultValue=w,W.defaultProps={width:320,title:"Explorer"},p.default=W,p}var g=function(){if(d)return s;d=1,Object.defineProperty(s,"__esModule",{value:!0}),s.Explorer=void 0;var e,t=m(),n=(e=t)&&e.__esModule?e:{default:e};return s.Explorer=n.default,s.default=n.default,s}();const y=({title:e,titleId:t,...n})=>o.createElement("svg",{width:5,height:8,viewBox:"0 0 5 8",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...n},e?o.createElement("title",{id:t},e):null,o.createElement("path",{d:"M0.910453 6.86965L3.88955 3.89061C4.09782 3.68233 4.09782 3.34465 3.88955 3.13637L0.910453 0.157278C0.574475 -0.178701 0 0.0592511 0 0.534408V6.49259C0 6.96768 0.574475 7.20565 0.910453 6.86965Z"})),v=({title:e,titleId:t,...n})=>o.createElement("svg",{height:"1em",strokeWidth:1.5,viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...n},e?o.createElement("title",{id:t},e):null,o.createElement("path",{d:"M18 6H20M22 6H20M20 6V4M20 6V8",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{d:"M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z"}),o.createElement("path",{d:"M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14",strokeLinecap:"round",strokeLinejoin:"round"})),h=({title:e,titleId:t,...n})=>o.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",fill:"none","aria-labelledby":t,...n},e?o.createElement("title",{id:t},e):null,o.createElement("circle",{cx:7.5,cy:7.5,r:6,strokeWidth:2})),b=({title:e,titleId:t,...n})=>o.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor","aria-labelledby":t,...n},e?o.createElement("title",{id:t},e):null,o.createElement("circle",{cx:7.5,cy:7.5,r:7.5}),o.createElement("path",{d:"M4.64641 7.00106L6.8801 9.23256L10.5017 5.61325",stroke:"white",strokeWidth:1.5})),k={keyword:"hsl(var(--color-primary))",def:"hsl(var(--color-tertiary))",property:"hsl(var(--color-info))",qualifier:"hsl(var(--color-secondary))",attribute:"hsl(var(--color-tertiary))",number:"hsl(var(--color-success))",string:"hsl(var(--color-warning))",builtin:"hsl(var(--color-success))",string2:"hsl(var(--color-secondary))",variable:"hsl(var(--color-secondary))",atom:"hsl(var(--color-tertiary))"},S=t.createElement(y,{style:{width:"var(--px-16)",transform:"rotate(90deg)"}}),E=t.createElement(y,{style:{width:"var(--px-16)"}}),C=t.createElement(h,{style:{marginRight:"var(--px-4)"}}),_=t.createElement(b,{style:{fill:"hsl(var(--color-info))",marginRight:"var(--px-4)"}}),A={buttonStyle:{cursor:"pointer",fontSize:"2em",lineHeight:0},explorerActionsStyle:{paddingTop:"var(--px-16)"},actionButtonStyle:{}},O=e=>{const{setOperationName:r}=n.useEditorContext({nonNull:!0}),{schema:i}=n.useSchemaStore(),{run:o}=n.useExecutionContext({nonNull:!0}),a=t.useCallback((e=>{e&&r(e),o()}),[o,r]),[l,s]=n.useOptimisticState(n.useOperationsEditorState());return t.createElement(g.Explorer,{schema:i,onRunOperation:a,explorerIsOpen:!0,colors:k,arrowOpen:S,arrowClosed:E,checkboxUnchecked:C,checkboxChecked:_,styles:A,query:l,onEdit:s,...e})};e.explorerPlugin=function(e){return{title:"GraphiQL Explorer",icon:v,content:()=>t.createElement(O,{...e})}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));