import { __commonJS, __toESM } from './chunk-XP5HYGXS.mjs'; import * as React__default from 'react'; import React__default__default, { Fragment, isValidElement } from 'react'; var require_dist=__commonJS({"../../node_modules/@base2/pretty-print-object/dist/index.js"(exports){var __assign=exports&&exports.__assign||function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;icomponent.$$typeof===Symbol.for("react.memo"),isForwardRef=component=>component.$$typeof===Symbol.for("react.forward_ref");function isObject(o){return Object.prototype.toString.call(o)==="[object Object]"}function isPlainObject(o){var ctor,prot;return isObject(o)===!1?!1:(ctor=o.constructor,ctor===void 0?!0:(prot=ctor.prototype,!(isObject(prot)===!1||prot.hasOwnProperty("isPrototypeOf")===!1)))}var import_pretty_print_object=__toESM(require_dist()),import_react_is=__toESM(require_react_is());var spacer=function(times,tabStop){return times===0?"":new Array(times*tabStop).fill(" ").join("")};function _typeof(obj){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(obj2){return typeof obj2}:function(obj2){return obj2&&typeof Symbol=="function"&&obj2.constructor===Symbol&&obj2!==Symbol.prototype?"symbol":typeof obj2},_typeof(obj)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if(typeof Symbol<"u"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i0?previousNodes.length-1:0),previousNode=previousNodes[previousNodes.length-1];return previousNode&&(currentNode.type==="string"||currentNode.type==="number")&&(previousNode.type==="string"||previousNode.type==="number")?nodes.push(createStringTreeNode(String(previousNode.value)+String(currentNode.value))):(previousNode&&nodes.push(previousNode),nodes.push(currentNode)),nodes},isKeyOrRefProps=function(propName){return ["key","ref"].includes(propName)},sortPropsByNames=function(shouldSortUserProps){return function(props){var haveKeyProp=props.includes("key"),haveRefProp=props.includes("ref"),userPropsOnly=props.filter(function(oneProp){return !isKeyOrRefProps(oneProp)}),sortedProps=_toConsumableArray(shouldSortUserProps?userPropsOnly.sort():userPropsOnly);return haveRefProp&&sortedProps.unshift("ref"),haveKeyProp&&sortedProps.unshift("key"),sortedProps}};function createPropFilter(props,filter){return Array.isArray(filter)?function(key){return filter.indexOf(key)===-1}:function(key){return filter(props[key],key)}}var compensateMultilineStringElementIndentation=function(element,formattedElement,inline,lvl,options){var tabStop=options.tabStop;return element.type==="string"?formattedElement.split(` `).map(function(line,offset){return offset===0?line:"".concat(spacer(lvl,tabStop)).concat(line)}).join(` `):formattedElement},formatOneChildren=function(inline,lvl,options){return function(element){return compensateMultilineStringElementIndentation(element,formatTreeNode(element,inline,lvl,options),inline,lvl,options)}},onlyPropsWithOriginalValue=function(defaultProps,props){return function(propName){var haveDefaultValue=Object.keys(defaultProps).includes(propName);return !haveDefaultValue||haveDefaultValue&&defaultProps[propName]!==props[propName]}},isInlineAttributeTooLong=function(attributes,inlineAttributeString,lvl,tabStop,maxInlineAttributesLineLength){return maxInlineAttributesLineLength?spacer(lvl,tabStop).length+inlineAttributeString.length>maxInlineAttributesLineLength:attributes.length>1},shouldRenderMultilineAttr=function(attributes,inlineAttributeString,containsMultilineAttr,inline,lvl,tabStop,maxInlineAttributesLineLength){return (isInlineAttributeTooLong(attributes,inlineAttributeString,lvl,tabStop,maxInlineAttributesLineLength)||containsMultilineAttr)&&!inline},formatReactElementNode=function(node,inline,lvl,options){var type=node.type,_node$displayName=node.displayName,displayName=_node$displayName===void 0?"":_node$displayName,childrens=node.childrens,_node$props=node.props,props=_node$props===void 0?{}:_node$props,_node$defaultProps=node.defaultProps,defaultProps=_node$defaultProps===void 0?{}:_node$defaultProps;if(type!=="ReactElement")throw new Error('The "formatReactElementNode" function could only format node of type "ReactElement". Given: '.concat(type));var filterProps3=options.filterProps,maxInlineAttributesLineLength=options.maxInlineAttributesLineLength,showDefaultProps=options.showDefaultProps,sortProps=options.sortProps,tabStop=options.tabStop,out="<".concat(displayName),outInlineAttr=out,outMultilineAttr=out,containsMultilineAttr=!1,visibleAttributeNames=[],propFilter=createPropFilter(props,filterProps3);Object.keys(props).filter(propFilter).filter(onlyPropsWithOriginalValue(defaultProps,props)).forEach(function(propName){return visibleAttributeNames.push(propName)}),Object.keys(defaultProps).filter(propFilter).filter(function(){return showDefaultProps}).filter(function(defaultPropName){return !visibleAttributeNames.includes(defaultPropName)}).forEach(function(defaultPropName){return visibleAttributeNames.push(defaultPropName)});var attributes=sortPropsByNames(sortProps)(visibleAttributeNames);if(attributes.forEach(function(attributeName){var _formatProp=formatProp(attributeName,Object.keys(props).includes(attributeName),props[attributeName],Object.keys(defaultProps).includes(attributeName),defaultProps[attributeName],inline,lvl,options),attributeFormattedInline=_formatProp.attributeFormattedInline,attributeFormattedMultiline=_formatProp.attributeFormattedMultiline,isMultilineAttribute=_formatProp.isMultilineAttribute;isMultilineAttribute&&(containsMultilineAttr=!0),outInlineAttr+=attributeFormattedInline,outMultilineAttr+=attributeFormattedMultiline;}),outMultilineAttr+=` `.concat(spacer(lvl,tabStop)),shouldRenderMultilineAttr(attributes,outInlineAttr,containsMultilineAttr,inline,lvl,tabStop,maxInlineAttributesLineLength)?out=outMultilineAttr:out=outInlineAttr,childrens&&childrens.length>0){var newLvl=lvl+1;out+=">",inline||(out+=` `,out+=spacer(newLvl,tabStop)),out+=childrens.reduce(mergeSiblingPlainStringChildrenReducer,[]).map(formatOneChildren(inline,newLvl,options)).join(inline?"":` `.concat(spacer(newLvl,tabStop))),inline||(out+=` `,out+=spacer(newLvl-1,tabStop)),out+="");}else isInlineAttributeTooLong(attributes,outInlineAttr,lvl,tabStop,maxInlineAttributesLineLength)||(out+=" "),out+="/>";return out},REACT_FRAGMENT_TAG_NAME_SHORT_SYNTAX="",REACT_FRAGMENT_TAG_NAME_EXPLICIT_SYNTAX="React.Fragment",toReactElementTreeNode=function(displayName,key,childrens){var props={};return key&&(props={key}),{type:"ReactElement",displayName,props,defaultProps:{},childrens}},isKeyedFragment=function(_ref){var key=_ref.key;return !!key},hasNoChildren=function(_ref2){var childrens=_ref2.childrens;return childrens.length===0},formatReactFragmentNode=function(node,inline,lvl,options){var type=node.type,key=node.key,childrens=node.childrens;if(type!=="ReactFragment")throw new Error('The "formatReactFragmentNode" function could only format node of type "ReactFragment". Given: '.concat(type));var useFragmentShortSyntax=options.useFragmentShortSyntax,displayName;return useFragmentShortSyntax?hasNoChildren(node)||isKeyedFragment(node)?displayName=REACT_FRAGMENT_TAG_NAME_EXPLICIT_SYNTAX:displayName=REACT_FRAGMENT_TAG_NAME_SHORT_SYNTAX:displayName=REACT_FRAGMENT_TAG_NAME_EXPLICIT_SYNTAX,formatReactElementNode(toReactElementTreeNode(displayName,key,childrens),inline,lvl,options)},jsxStopChars=["<",">","{","}"],shouldBeEscaped=function(s){return jsxStopChars.some(function(jsxStopChar){return s.includes(jsxStopChar)})},escape2=function(s){return shouldBeEscaped(s)?"{`".concat(s,"`}"):s},preserveTrailingSpace=function(s){var result=s;return result.endsWith(" ")&&(result=result.replace(/^(.*?)(\s+)$/,"$1{'$2'}")),result.startsWith(" ")&&(result=result.replace(/^(\s+)(.*)$/,"{'$1'}$2")),result},formatTreeNode=function(node,inline,lvl,options){if(node.type==="number")return String(node.value);if(node.type==="string")return node.value?"".concat(preserveTrailingSpace(escape2(String(node.value)))):"";if(node.type==="ReactElement")return formatReactElementNode(node,inline,lvl,options);if(node.type==="ReactFragment")return formatReactFragmentNode(node,inline,lvl,options);throw new TypeError('Unknow format type "'.concat(node.type,'"'))},formatTree=function(node,options){return formatTreeNode(node,!1,0,options)},reactElementToJsxString=function(element){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref$filterProps=_ref.filterProps,filterProps3=_ref$filterProps===void 0?[]:_ref$filterProps,_ref$showDefaultProps=_ref.showDefaultProps,showDefaultProps=_ref$showDefaultProps===void 0?!0:_ref$showDefaultProps,_ref$showFunctions=_ref.showFunctions,showFunctions=_ref$showFunctions===void 0?!1:_ref$showFunctions,functionValue=_ref.functionValue,_ref$tabStop=_ref.tabStop,tabStop=_ref$tabStop===void 0?2:_ref$tabStop,_ref$useBooleanShorth=_ref.useBooleanShorthandSyntax,useBooleanShorthandSyntax=_ref$useBooleanShorth===void 0?!0:_ref$useBooleanShorth,_ref$useFragmentShort=_ref.useFragmentShortSyntax,useFragmentShortSyntax=_ref$useFragmentShort===void 0?!0:_ref$useFragmentShort,_ref$sortProps=_ref.sortProps,sortProps=_ref$sortProps===void 0?!0:_ref$sortProps,maxInlineAttributesLineLength=_ref.maxInlineAttributesLineLength,displayName=_ref.displayName;if(!element)throw new Error("react-element-to-jsx-string: Expected a ReactElement");var options={filterProps:filterProps3,showDefaultProps,showFunctions,functionValue,tabStop,useBooleanShorthandSyntax,useFragmentShortSyntax,sortProps,maxInlineAttributesLineLength,displayName};return formatTree(parseReactElement(element,options),options)}; export { isForwardRef, isMemo, reactElementToJsxString };