lone-format 0.2.2 → 0.3.1

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.
@@ -1,8 +1,8 @@
1
- (function(D,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(D=typeof globalThis<"u"?globalThis:D||self,s(D.LoneFormat={},D.Vue))})(this,function(D,s){"use strict";class ie{add(e,t,o){if(typeof arguments[0]!="string")for(let n in arguments[0])this.add(n,arguments[0][n],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(n){this[n]=this[n]||[],t&&this[n][o?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(o){o.call(t&&t.context?t.context:t,t)})}}class ae{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class i{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+i.version}static addUnaryOp(e){return i.max_unop_len=Math.max(e.length,i.max_unop_len),i.unary_ops[e]=1,i}static addBinaryOp(e,t,o){return i.max_binop_len=Math.max(e.length,i.max_binop_len),i.binary_ops[e]=t,o?i.right_associative.add(e):i.right_associative.delete(e),i}static addIdentifierChar(e){return i.additional_identifier_chars.add(e),i}static addLiteral(e,t){return i.literals[e]=t,i}static removeUnaryOp(e){return delete i.unary_ops[e],e.length===i.max_unop_len&&(i.max_unop_len=i.getMaxKeyLen(i.unary_ops)),i}static removeAllUnaryOps(){return i.unary_ops={},i.max_unop_len=0,i}static removeIdentifierChar(e){return i.additional_identifier_chars.delete(e),i}static removeBinaryOp(e){return delete i.binary_ops[e],e.length===i.max_binop_len&&(i.max_binop_len=i.getMaxKeyLen(i.binary_ops)),i.right_associative.delete(e),i}static removeAllBinaryOps(){return i.binary_ops={},i.max_binop_len=0,i}static removeLiteral(e){return delete i.literals[e],i}static removeAllLiterals(){return i.literals={},i}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new i(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(t=>t.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return i.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!i.binary_ops[String.fromCharCode(e)]||i.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return i.isIdentifierStart(e)||i.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(i.hooks[e]){const o={context:this,node:t};return i.hooks.run(e,o),o.node}return t}searchHook(e){if(i.hooks[e]){const t={context:this};return i.hooks[e].find(function(o){return o.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===i.SPACE_CODE||e===i.TAB_CODE||e===i.LF_CODE||e===i.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=e.length===1?e[0]:{type:i.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],o,n;for(;this.index<this.expr.length;)if(o=this.code,o===i.SEMCOL_CODE||o===i.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(o===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,i.max_binop_len),t=e.length;for(;t>0;){if(i.binary_ops.hasOwnProperty(e)&&(!i.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,o,n,l,u,p,h,f;if(u=this.gobbleToken(),!u||(t=this.gobbleBinaryOp(),!t))return u;for(l={value:t,prec:i.binaryPrecedence(t),right_a:i.right_associative.has(t)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+t),n=[u,l,p];t=this.gobbleBinaryOp();){if(o=i.binaryPrecedence(t),o===0){this.index-=t.length;break}l={value:t,prec:o,right_a:i.right_associative.has(t)},f=t;const _=m=>l.right_a&&m.right_a?o>m.prec:o<=m.prec;for(;n.length>2&&_(n[n.length-2]);)p=n.pop(),t=n.pop().value,u=n.pop(),e={type:i.BINARY_EXP,operator:t,left:u,right:p},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+f),n.push(l,e)}for(h=n.length-1,e=n[h];h>1;)e={type:i.BINARY_EXP,operator:n[h-1].value,left:n[h-2],right:e},h-=2;return e}gobbleToken(){let e,t,o,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,i.isDecimalDigit(e)||e===i.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===i.SQUOTE_CODE||e===i.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===i.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,i.max_unop_len),o=t.length;o>0;){if(i.unary_ops.hasOwnProperty(t)&&(!i.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=o;const l=this.gobbleToken();return l||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:i.UNARY_EXP,operator:t,argument:l,prefix:!0})}t=t.substr(0,--o)}i.isIdentifierStart(e)?(n=this.gobbleIdentifier(),i.literals.hasOwnProperty(n.name)?n={type:i.LITERAL,value:i.literals[n.name],raw:n.name}:n.name===i.this_str&&(n={type:i.THIS_EXP})):e===i.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===i.PERIOD_CODE||t===i.OBRACK_CODE||t===i.OPAREN_CODE||t===i.QUMARK_CODE;){let o;if(t===i.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==i.PERIOD_CODE)break;o=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===i.OBRACK_CODE?(e={type:i.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==i.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===i.OPAREN_CODE?e={type:i.CALL_EXP,arguments:this.gobbleArguments(i.CPAREN_CODE),callee:e}:(t===i.PERIOD_CODE||o)&&(o&&this.index--,this.gobbleSpaces(),e={type:i.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),o&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,o;for(;i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===i.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(t=this.char,t==="e"||t==="E"){for(e+=this.expr.charAt(this.index++),t=this.char,(t==="+"||t==="-")&&(e+=this.expr.charAt(this.index++));i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return o=this.code,i.isIdentifierStart(o)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(o===i.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===i.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:i.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="";const t=this.index,o=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let l=this.expr.charAt(this.index++);if(l===o){n=!0;break}else if(l==="\\")switch(l=this.expr.charAt(this.index++),l){case"n":e+=`
2
- `;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:i.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(i.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,i.isIdentifierPart(e));)this.index++;return{type:i.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let o=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let l=this.code;if(l===e){o=!0,this.index++,e===i.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===i.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===i.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===i.CBRACK_CODE)for(let u=t.length;u<n;u++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const u=this.gobbleExpression();(!u||u.type===i.COMPOUND)&&this.throwError("Expected comma"),t.push(u)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(i.CPAREN_CODE);if(this.code===i.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:i.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:i.ARRAY_EXP,elements:this.gobbleArguments(i.CBRACK_CODE)}}}const le=new ie;Object.assign(i,{hooks:le,plugins:new ae(i),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),i.max_unop_len=i.getMaxKeyLen(i.unary_ops),i.max_binop_len=i.getMaxKeyLen(i.binary_ops);const T=r=>new i(r).parse(),ce=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(i).filter(r=>!ce.includes(r)&&T[r]===void 0).forEach(r=>{T[r]=i[r]}),T.Jsep=i;const ue="ConditionalExpression";var de={name:"ternary",init(r){r.hooks.add("after-expression",function(t){if(t.node&&this.code===r.QUMARK_CODE){this.index++;const o=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===r.COLON_CODE){this.index++;const l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:ue,test:o,consequent:n,alternate:l},o.operator&&r.binary_ops[o.operator]<=.9){let u=o;for(;u.right.operator&&r.binary_ops[u.right.operator]<=.9;)u=u.right;t.node.test=u.right,u.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};T.plugins.register(de);const re=47,he=92;var fe={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===re){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===re&&!n){const l=this.expr.slice(o,this.index);let u="";for(;++this.index<this.expr.length;){const h=this.code;if(h>=97&&h<=122||h>=65&&h<=90||h>=48&&h<=57)u+=this.char;else break}let p;try{p=new RegExp(l,u)}catch(h){this.throwError(h.message)}return t.node={type:r.LITERAL,value:p,raw:this.expr.slice(o-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===r.OBRACK_CODE?n=!0:n&&this.code===r.CBRACK_CODE&&(n=!1),this.index+=this.code===he?2:1}this.throwError("Unclosed Regex")}})}};const W=43,L={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[W,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];L.assignmentOperators.forEach(o=>r.addBinaryOp(o,L.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const l=this.code;L.updateOperators.some(u=>u===l&&u===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:l===W?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!e.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),r.hooks.add("after-token",function(n){if(n.node){const l=this.code;L.updateOperators.some(u=>u===l&&u===this.expr.charCodeAt(this.index+1))&&(e.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:l===W?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){L.assignmentOperators.has(o.operator)?(o.type="AssignmentExpression",t(o.left),t(o.right)):o.operator||Object.values(o).forEach(n=>{n&&typeof n=="object"&&t(n)})}}};T.plugins.register(fe,L),T.addUnaryOp("typeof"),T.addLiteral("null",null),T.addLiteral("undefined",void 0);const pe=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),w={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return w.evalBinaryExpression(r,e);case"Compound":return w.evalCompound(r,e);case"ConditionalExpression":return w.evalConditionalExpression(r,e);case"Identifier":return w.evalIdentifier(r,e);case"Literal":return w.evalLiteral(r,e);case"MemberExpression":return w.evalMemberExpression(r,e);case"UnaryExpression":return w.evalUnaryExpression(r,e);case"ArrayExpression":return w.evalArrayExpression(r,e);case"CallExpression":return w.evalCallExpression(r,e);case"AssignmentExpression":return w.evalAssignmentExpression(r,e);default:throw SyntaxError("Unexpected expression",r)}},evalBinaryExpression(r,e){return{"||":(o,n)=>o||n(),"&&":(o,n)=>o&&n(),"|":(o,n)=>o|n(),"^":(o,n)=>o^n(),"&":(o,n)=>o&n(),"==":(o,n)=>o==n(),"!=":(o,n)=>o!=n(),"===":(o,n)=>o===n(),"!==":(o,n)=>o!==n(),"<":(o,n)=>o<n(),">":(o,n)=>o>n(),"<=":(o,n)=>o<=n(),">=":(o,n)=>o>=n(),"<<":(o,n)=>o<<n(),">>":(o,n)=>o>>n(),">>>":(o,n)=>o>>>n(),"+":(o,n)=>o+n(),"-":(o,n)=>o-n(),"*":(o,n)=>o*n(),"/":(o,n)=>o/n(),"%":(o,n)=>o%n()}[r.operator](w.evalAst(r.left,e),()=>w.evalAst(r.right,e))},evalCompound(r,e){let t;for(let o=0;o<r.body.length;o++){r.body[o].type==="Identifier"&&["var","let","const"].includes(r.body[o].name)&&r.body[o+1]&&r.body[o+1].type==="AssignmentExpression"&&(o+=1);const n=r.body[o];t=w.evalAst(n,e)}return t},evalConditionalExpression(r,e){return w.evalAst(r.test,e)?w.evalAst(r.consequent,e):w.evalAst(r.alternate,e)},evalIdentifier(r,e){if(Object.hasOwn(e,r.name))return e[r.name];throw ReferenceError(`${r.name} is not defined`)},evalLiteral(r){return r.value},evalMemberExpression(r,e){const t=String(r.computed?w.evalAst(r.property):r.property.name),o=w.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&pe.has(t))throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);const n=o[t];return typeof n=="function"?n.bind(o):n},evalUnaryExpression(r,e){return{"-":o=>-w.evalAst(o,e),"!":o=>!w.evalAst(o,e),"~":o=>~w.evalAst(o,e),"+":o=>+w.evalAst(o,e),typeof:o=>typeof w.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>w.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>w.evalAst(n,e));return w.evalAst(r.callee,e)(...t)},evalAssignmentExpression(r,e){if(r.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=r.left.name,o=w.evalAst(r.right,e);return e[t]=o,e[t]}};class ye{constructor(e){this.code=e,this.ast=T(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return w.evalAst(this.ast,t)}}function j(r,e){return r=r.slice(),r.push(e),r}function Z(r,e){return e=e.slice(),e.unshift(r),e}class ge extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function O(r,e,t,o,n){if(!(this instanceof O))try{return new O(r,e,t,o,n)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const l=r&&typeof r=="object";if(r=r||{},this.json=r.json||t,this.path=r.path||e,this.resultType=r.resultType||"value",this.flatten=r.flatten||!1,this.wrap=Object.hasOwn(r,"wrap")?r.wrap:!0,this.sandbox=r.sandbox||{},this.eval=r.eval===void 0?"safe":r.eval,this.ignoreEvalErrors=typeof r.ignoreEvalErrors>"u"?!1:r.ignoreEvalErrors,this.parent=r.parent||null,this.parentProperty=r.parentProperty||null,this.callback=r.callback||o||null,this.otherTypeCallback=r.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},r.autostart!==!1){const u={path:l?r.path:e};l?"json"in r&&(u.json=r.json):u.json=t;const p=this.evaluate(u);if(!p||typeof p!="object")throw new ge(p);return p}}O.prototype.evaluate=function(r,e,t,o){let n=this.parent,l=this.parentProperty,{flatten:u,wrap:p}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=o||this.otherTypeCallback,e=e||this.json,r=r||this.path,r&&typeof r=="object"&&!Array.isArray(r)){if(!r.path&&r.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(r,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=r),u=Object.hasOwn(r,"flatten")?r.flatten:u,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,p=Object.hasOwn(r,"wrap")?r.wrap:p,this.currEval=Object.hasOwn(r,"eval")?r.eval:this.currEval,t=Object.hasOwn(r,"callback")?r.callback:t,this.currOtherTypeCallback=Object.hasOwn(r,"otherTypeCallback")?r.otherTypeCallback:this.currOtherTypeCallback,n=Object.hasOwn(r,"parent")?r.parent:n,l=Object.hasOwn(r,"parentProperty")?r.parentProperty:l,r=r.path}if(n=n||null,l=l||null,Array.isArray(r)&&(r=O.toPathString(r)),!r&&r!==""||!e)return;const h=O.toPathArray(r);h[0]==="$"&&h.length>1&&h.shift(),this._hasParentSelector=null;const f=this._trace(h,e,["$"],n,l,t).filter(function(_){return _&&!_.isParentSelector});return f.length?!p&&f.length===1&&!f[0].hasArrExpr?this._getPreferredOutput(f[0]):f.reduce((_,m)=>{const C=this._getPreferredOutput(m);return u&&Array.isArray(C)?_=_.concat(C):_.push(C),_},[]):p?[]:void 0},O.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:O.toPathArray(r.path);return r.pointer=O.toPointer(t),r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return O.toPathString(r[e]);case"pointer":return O.toPointer(r.path);default:throw new TypeError("Unknown result type")}},O.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),e(o,t,r)}},O.prototype._trace=function(r,e,t,o,n,l,u,p){let h;if(!r.length)return h={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:u},this._handleCallback(h,l,"value"),h;const f=r[0],_=r.slice(1),m=[];function C(E){Array.isArray(E)?E.forEach(v=>{m.push(v)}):m.push(E)}if((typeof f!="string"||p)&&e&&Object.hasOwn(e,f))C(this._trace(_,e[f],j(t,f),e,f,l,u));else if(f==="*")this._walk(e,E=>{C(this._trace(_,e[E],j(t,E),e,E,l,!0,!0))});else if(f==="..")C(this._trace(_,e,t,o,n,l,u)),this._walk(e,E=>{typeof e[E]=="object"&&C(this._trace(r.slice(),e[E],j(t,E),e,E,l,!0))});else{if(f==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:_,isParentSelector:!0};if(f==="~")return h={path:j(t,f),value:n,parent:o,parentProperty:null},this._handleCallback(h,l,"property"),h;if(f==="$")C(this._trace(_,e,t,null,null,l,u));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(f))C(this._slice(f,_,e,t,o,n,l));else if(f.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const E=f.replace(/^\?\((.*?)\)$/u,"$1"),v=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(E);v?this._walk(e,A=>{const I=[v[2]],P=v[1]?e[A][v[1]]:e[A];this._trace(I,P,t,o,n,l,!0).length>0&&C(this._trace(_,e[A],j(t,A),e,A,l,!0))}):this._walk(e,A=>{this._eval(E,e[A],A,t,o,n)&&C(this._trace(_,e[A],j(t,A),e,A,l,!0))})}else if(f[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");C(this._trace(Z(this._eval(f,e,t.at(-1),t.slice(0,-1),o,n),_),e,t,o,n,l,u))}else if(f[0]==="@"){let E=!1;const v=f.slice(1,-2);switch(v){case"scalar":(!e||!["object","function"].includes(typeof e))&&(E=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===v&&(E=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(E=!0);break;case"number":Number.isFinite(e)&&(E=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(E=!0);break;case"object":e&&typeof e===v&&(E=!0);break;case"array":Array.isArray(e)&&(E=!0);break;case"other":E=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(E=!0);break;default:throw new TypeError("Unknown value type "+v)}if(E)return h={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(h,l,"value"),h}else if(f[0]==="`"&&e&&Object.hasOwn(e,f.slice(1))){const E=f.slice(1);C(this._trace(_,e[E],j(t,E),e,E,l,u,!0))}else if(f.includes(",")){const E=f.split(",");for(const v of E)C(this._trace(Z(v,_),e,t,o,n,l,!0))}else!p&&e&&Object.hasOwn(e,f)&&C(this._trace(_,e[f],j(t,f),e,f,l,u,!0))}if(this._hasParentSelector)for(let E=0;E<m.length;E++){const v=m[E];if(v&&v.isParentSelector){const A=this._trace(v.expr,e,v.path,o,n,l,u);if(Array.isArray(A)){m[E]=A[0];const I=A.length;for(let P=1;P<I;P++)E++,m.splice(E,0,A[P])}else m[E]=A}}return m},O.prototype._walk=function(r,e){if(Array.isArray(r)){const t=r.length;for(let o=0;o<t;o++)e(o)}else r&&typeof r=="object"&&Object.keys(r).forEach(t=>{e(t)})},O.prototype._slice=function(r,e,t,o,n,l,u){if(!Array.isArray(t))return;const p=t.length,h=r.split(":"),f=h[2]&&Number.parseInt(h[2])||1;let _=h[0]&&Number.parseInt(h[0])||0,m=h[1]&&Number.parseInt(h[1])||p;_=_<0?Math.max(0,_+p):Math.min(p,_),m=m<0?Math.max(0,m+p):Math.min(p,m);const C=[];for(let E=_;E<m;E+=f)this._trace(Z(E,e),t,o,n,l,u,!0).forEach(A=>{C.push(A)});return C},O.prototype._eval=function(r,e,t,o,n,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const u=r.includes("@path");u&&(this.currSandbox._$_path=O.toPathString(o.concat([t])));const p=this.currEval+"Script:"+r;if(!O.cache[p]){let h=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(u&&(h=h.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)O.cache[p]=new this.safeVm.Script(h);else if(this.currEval==="native")O.cache[p]=new this.vm.Script(h);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const f=this.currEval;O.cache[p]=new f(h)}else if(typeof this.currEval=="function")O.cache[p]={runInNewContext:f=>this.currEval(h,f)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return O.cache[p].runInNewContext(this.currSandbox)}catch(h){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+h.message+": "+r)}},O.cache={},O.toPathString=function(r){const e=r,t=e.length;let o="$";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return o},O.toPointer=function(r){const e=r,t=e.length;let o="";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+="/"+e[n].toString().replaceAll("~","~0").replaceAll("/","~1"));return o},O.toPathArray=function(r){const{cache:e}=O;if(e[r])return e[r].concat();const t=[],n=r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(l,u){return"[#"+(t.push(u)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,u){return"['"+u.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,u){return";"+u.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const u=l.match(/#(\d+)/u);return!u||!u[1]?l:t[u[1]]});return e[r]=n,e[r].concat()},O.prototype.safeVm={Script:ye};const me=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const l=r[n];t(l)&&e.push(r.splice(n--,1)[0])}};class be{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];me(o,n,f=>typeof e[f]=="function");const l=o.map(f=>e[f]);t=n.reduce((f,_)=>{let m=e[_].toString();return/function/u.test(m)||(m="function "+m),"var "+_+"="+m+";"+f},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const p=t.lastIndexOf(";"),h=p!==-1?t.slice(0,p+1)+" return "+t.slice(p+1):" return "+t;return new Function(...o,h)(...l)}}O.prototype.vm={Script:be};const Ee={class:"json-node"},ke={key:0,class:"json-node__container"},_e={class:"json-node__line"},xe={key:2,class:"json-node__colon"},Oe=["title"],Ce={key:3,class:"json-node__collapsed"},we={key:4,class:"json-node__comma"},Ae={key:0,class:"json-node__children"},ve={class:"json-node__children-content"},Se={class:"json-node__line json-node__closing-bracket"},Ne={class:"json-node__bracket"},Be={key:0,class:"json-node__comma"},Pe={key:1,class:"json-node__primitive"},Te={key:2,class:"json-node__colon"},De=["title"],je={key:0,class:"json-node__comma"},Ie=s.defineComponent({name:"JsonNode",__name:"JsonNode",props:{value:{},keyName:{},level:{},path:{default:""},expanded:{},isLast:{type:Boolean,default:!1},theme:{}},emits:["update:value","toggle-expand","copy","update:key"],setup(r,{emit:e}){s.useCssVars(d=>({"41b58a02":d.level,"63accfe8":d.theme.colors.syntaxKey,"7a4b22f6":d.theme.colors.hoverBackground,"5865f1b1":d.theme.colors.syntaxBracket,"79c93d33":d.theme.colors.textSecondary,"59ced5e8":d.theme.colors.syntaxString,51525120:d.theme.colors.syntaxNumber,"5410b131":d.theme.colors.syntaxBoolean,"11eec51e":d.theme.colors.syntaxNull,ac53437c:d.theme.colors.background,"15cbe7d4":d.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),l=s.ref(!1),u=s.ref(""),p=s.ref(""),h=d=>{if(!/^-?\d+(\.\d+)?$/.test(d))return!1;const x=Number(d);return!Number.isSafeInteger(x)||d.length>15},f=s.computed(()=>t.value!==null&&typeof t.value=="object"),_=s.computed(()=>Array.isArray(t.value)),m=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),C=s.computed(()=>t.expanded.has(m.value)),E=s.computed(()=>t.keyName),v=s.computed(()=>_.value?"[":"{"),A=s.computed(()=>_.value?"]":"}"),I=s.computed(()=>{if(!t.value)return"";const x=Object.keys(t.value).length;return _.value?x>0?` ${x} items `:" ":x>0?` ${x} keys `:" "}),P=s.computed(()=>{const d=typeof t.value;return t.value===null?"json-node__value--null":d==="boolean"?"json-node__value--boolean":d==="number"?"json-node__value--number":d==="string"?h(t.value)?"json-node__value--number":"json-node__value--string":""}),K=s.computed(()=>l.value?p.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):typeof t.value=="string"?h(t.value)?t.value:`"${t.value}"`:String(t.value)),J=s.computed(()=>"Click to edit, double-click to copy"),Y=d=>t.level===0?d:m.value?`${m.value}.${d}`:d,$=d=>{const x=Object.keys(t.value);return x.indexOf(d)===x.length-1},H=()=>{o("toggle-expand",m.value)},X=()=>{t.level!==0&&(n.value=!0,u.value=t.keyName,s.nextTick(()=>{const d=document.querySelectorAll(".json-node__key-input"),x=d[d.length-1];x&&(x.focus(),x.select())}))},q=()=>{f.value||(l.value=!0,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value),s.nextTick(()=>{const d=document.querySelectorAll(".json-node__value-input"),x=d[d.length-1];x&&(x.focus(),x.select())}))},R=()=>{if(t.level===0||!n.value)return;const d=u.value.trim();if(!d){Q();return}if(d===t.keyName){n.value=!1;return}n.value=!1,o("update:key",m.value,d)},G=()=>{try{let d;const x=p.value.trim();if(x==="null")d=null;else if(x==="true"||x==="false")d=x==="true";else if(!isNaN(Number(x))&&x!==""){const M=Number(x);!Number.isSafeInteger(M)||x.length>15?d=x:d=M}else d=p.value;o("update:value",m.value,d),l.value=!1}catch(d){console.error("Failed to parse value:",d),l.value=!1}},Q=()=>{n.value=!1,u.value=t.keyName},U=()=>{l.value=!1,typeof t.value=="string"&&h(t.value)||typeof t.value=="string"?p.value=t.value:p.value=String(t.value)};return(d,x)=>{const M=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",Ee,[f.value?(s.openBlock(),s.createElementBlock("div",ke,[s.createElementVNode("div",_e,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:X,title:"Click to edit key"},' "'+s.toDisplayString(E.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":x[0]||(x[0]=a=>u.value=a),onKeyup:[s.withKeys(R,["enter"]),s.withKeys(Q,["escape"])],onBlur:R,class:"json-node__key-input"},null,544)),[[s.vModelText,u.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",xe,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:H,title:C.value?"Click to collapse":"Click to expand"},s.toDisplayString(v.value),9,Oe),C.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Ce,[s.createTextVNode(s.toDisplayString(I.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:H},s.toDisplayString(A.value),1)])),!C.value&&!d.isLast?(s.openBlock(),s.createElementBlock("span",we,",")):s.createCommentVNode("",!0)]),C.value?(s.openBlock(),s.createElementBlock("div",Ae,[s.createElementVNode("div",ve,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,(a,c)=>(s.openBlock(),s.createElementBlock("div",{key:c,class:"json-node__child"},[s.createVNode(M,{value:a,"key-name":_.value?"":String(c),level:d.level+1,path:Y(String(c)),expanded:d.expanded,theme:d.theme,"onUpdate:value":x[1]||(x[1]=(y,g)=>d.$emit("update:value",y,g)),onToggleExpand:x[2]||(x[2]=y=>d.$emit("toggle-expand",y)),onCopy:x[3]||(x[3]=y=>d.$emit("copy",y)),"onUpdate:key":x[4]||(x[4]=(y,g)=>d.$emit("update:key",y,g)),"is-last":$(String(c))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",Se,[s.createElementVNode("span",Ne,s.toDisplayString(A.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Be,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Pe,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:X,title:"Click to edit key"},' "'+s.toDisplayString(E.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":x[5]||(x[5]=a=>u.value=a),onKeyup:[s.withKeys(R,["enter"]),s.withKeys(Q,["escape"])],onBlur:R,class:"json-node__key-input"},null,544)),[[s.vModelText,u.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",Te,": ")):s.createCommentVNode("",!0),l.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",P.value]),onClick:q,onDblclick:x[6]||(x[6]=a=>d.$emit("copy",d.value)),title:J.value},[s.createTextVNode(s.toDisplayString(K.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",je,","))],42,De)),l.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":x[7]||(x[7]=a=>p.value=a),onKeyup:[s.withKeys(G,["enter"]),s.withKeys(U,["escape"])],onBlur:G,class:"json-node__value-input"},null,544)),[[s.vModelText,p.value]]):s.createCommentVNode("",!0)]))])}}}),ne=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},$e=ne(Ie,[["__scopeId","data-v-f3f3cbc9"]]),oe={name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#656d76",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#2da44e",buttonPrimaryHover:"#2c974b",success:"#1a7f37",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",syntaxString:"#0a3069",syntaxNumber:"#0969da",syntaxBoolean:"#8250df",syntaxNull:"#656d76",syntaxKey:"#0969da",syntaxBracket:"#24292f",scrollbarTrack:"#f6f8fa",scrollbarThumb:"#d0d7de",scrollbarThumbHover:"#afb8c1",hoverBackground:"#f6f8fa",indentLine:"#d0d7de"}},Re={"github-light":oe,"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#e6edf3",textSecondary:"#7d8590",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#e6edf3",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2419",error:"#f85149",errorBackground:"#381921",syntaxString:"#a5d6ff",syntaxNumber:"#79c0ff",syntaxBoolean:"#d2a8ff",syntaxNull:"#7d8590",syntaxKey:"#79c0ff",syntaxBracket:"#e6edf3",scrollbarTrack:"#161b22",scrollbarThumb:"#30363d",scrollbarThumbHover:"#6e7681",hoverBackground:"#161b22",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#333333",textSecondary:"#888888",buttonBackground:"#f8f8f8",buttonBackgroundHover:"#eeeeee",buttonBorder:"#e0e0e0",buttonText:"#333333",buttonPrimary:"#007acc",buttonPrimaryHover:"#005a9e",success:"#22c55e",successBackground:"#f0fdf4",error:"#ef4444",errorBackground:"#fef2f2",syntaxString:"#22c55e",syntaxNumber:"#3b82f6",syntaxBoolean:"#8b5cf6",syntaxNull:"#6b7280",syntaxKey:"#1f2937",syntaxBracket:"#374151",scrollbarTrack:"#f5f5f5",scrollbarThumb:"#d1d5db",scrollbarThumbHover:"#9ca3af",hoverBackground:"#f9f9f9",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fefbf6",surfaceBackground:"#faf6f0",border:"#e8d5b7",text:"#4a3b2a",textSecondary:"#8b7355",buttonBackground:"#f4ede4",buttonBackgroundHover:"#efe5d8",buttonBorder:"#e8d5b7",buttonText:"#4a3b2a",buttonPrimary:"#ff6b35",buttonPrimaryHover:"#e55a2b",success:"#ff9500",successBackground:"#fff8f0",error:"#d73502",errorBackground:"#ffeee8",syntaxString:"#d73502",syntaxNumber:"#ff6b35",syntaxBoolean:"#b7472a",syntaxNull:"#8b7355",syntaxKey:"#4a3b2a",syntaxBracket:"#6b5444",scrollbarTrack:"#f4ede4",scrollbarThumb:"#e8d5b7",scrollbarThumbHover:"#d4c4a8",hoverBackground:"#f8f2eb",indentLine:"#e8d5b7"}}};function Ve(r="github-light"){return Re[r]||oe}const Le={key:0,class:"json-format__toolbar"},Ue={class:"json-format__actions"},Me=["disabled"],Fe=["disabled"],Ke=["disabled"],He=["disabled"],Xe={class:"json-format__info"},Ge={key:0,class:"json-format__status json-format__status--success"},Qe={key:1,class:"json-format__status json-format__status--error"},Ye={class:"json-format__content"},qe={key:0,class:"json-format__error"},ze={key:1,class:"json-format__error"},We={key:2,class:"json-format__viewer"},se=ne(s.defineComponent({name:"JsonFormat",__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress"],setup(r,{expose:e,emit:t}){s.useCssVars(a=>({ef037492:m.value.colors.border,"33e06939":m.value.colors.background,60160510:m.value.colors.text,"5ef04350":m.value.colors.surfaceBackground,"2635d16e":m.value.colors.buttonBorder,"7e8021cb":m.value.colors.buttonBackground,ceb1e8ec:m.value.colors.buttonText,"3fff1e31":m.value.colors.buttonBackgroundHover,ce0e62f6:m.value.colors.buttonPrimary,a1115492:m.value.colors.buttonPrimaryHover,"61b839b4":m.value.colors.successBackground,"13fd9fd8":m.value.colors.success,f14057aa:m.value.colors.errorBackground,"2ddd231d":m.value.colors.error,c81a0d60:m.value.colors.scrollbarTrack,c8228c4a:m.value.colors.scrollbarThumb,"5985dfbe":m.value.colors.scrollbarThumbHover}));const o=r,n=t,l=s.ref(null),u=s.ref(""),p=s.ref(new Set),h=s.ref(null),f=s.ref(""),_=s.computed(()=>u.value===""),m=s.computed(()=>Ve(o.theme)),C=s.computed(()=>f.value?null:h.value!==null?h.value:l.value),E=a=>{if(!a.trim()){l.value=null,u.value="",h.value=null,f.value="";return}try{let c=a;const y=/:\s*\d{16,}/.test(c),g=/:\s*\d+\.\d*0+\s*[,}\]]/.test(c);if(!y&&!g)try{l.value=JSON.parse(c),u.value="",h.value=null,f.value="",s.nextTick(()=>{C.value!==null&&$()});return}catch{}const b=(k,S,B)=>{let N="",ee=!1,te=!1,V=0;for(;V<k.length;){const F=k[V];if(ee)te?te=!1:F==="\\"?te=!0:F==='"'&&(ee=!1),N+=F,V++;else if(F==='"')ee=!0,N+=F,V++;else{const z=k.slice(V).match(S);if(z&&z.index===0){const et=z[0].replace(S,B);N+=et,V+=z[0].length}else N+=F,V++}}return N};c=b(c,/:\s*(\d{16,})(\s*[,}\]\n\r])/,': "$1"$2'),c=b(c,/:\s*(\d+\.\d*?0+)(\s*[,}\]\n\r])/,': "$1"$2'),l.value=JSON.parse(c),u.value="",h.value=null,f.value="",s.nextTick(()=>{C.value!==null&&$()})}catch(c){u.value=c instanceof Error?c.message:"Unknown parsing error",l.value=null,h.value=null,f.value=""}},v=a=>{if(!a||!a.expression.trim()){A();return}if(!l.value){f.value="No valid JSON data to filter";return}try{let c;if(a.type==="jsonpath")c=O({path:a.expression,json:l.value}),c.length===1&&a.expression.includes("$[")===!1&&!a.expression.endsWith("[*]")?h.value=c[0]:h.value=c;else if(a.type==="js")c=new Function("data",`
1
+ (function(I,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(I=typeof globalThis<"u"?globalThis:I||self,s(I.LoneFormat={},I.Vue))})(this,function(I,s){"use strict";class oe{add(e,t,o){if(typeof arguments[0]!="string")for(let n in arguments[0])this.add(n,arguments[0][n],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(n){this[n]=this[n]||[],t&&this[n][o?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(o){o.call(t&&t.context?t.context:t,t)})}}class se{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class i{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+i.version}static addUnaryOp(e){return i.max_unop_len=Math.max(e.length,i.max_unop_len),i.unary_ops[e]=1,i}static addBinaryOp(e,t,o){return i.max_binop_len=Math.max(e.length,i.max_binop_len),i.binary_ops[e]=t,o?i.right_associative.add(e):i.right_associative.delete(e),i}static addIdentifierChar(e){return i.additional_identifier_chars.add(e),i}static addLiteral(e,t){return i.literals[e]=t,i}static removeUnaryOp(e){return delete i.unary_ops[e],e.length===i.max_unop_len&&(i.max_unop_len=i.getMaxKeyLen(i.unary_ops)),i}static removeAllUnaryOps(){return i.unary_ops={},i.max_unop_len=0,i}static removeIdentifierChar(e){return i.additional_identifier_chars.delete(e),i}static removeBinaryOp(e){return delete i.binary_ops[e],e.length===i.max_binop_len&&(i.max_binop_len=i.getMaxKeyLen(i.binary_ops)),i.right_associative.delete(e),i}static removeAllBinaryOps(){return i.binary_ops={},i.max_binop_len=0,i}static removeLiteral(e){return delete i.literals[e],i}static removeAllLiterals(){return i.literals={},i}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new i(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(t=>t.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return i.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!i.binary_ops[String.fromCharCode(e)]||i.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return i.isIdentifierStart(e)||i.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(i.hooks[e]){const o={context:this,node:t};return i.hooks.run(e,o),o.node}return t}searchHook(e){if(i.hooks[e]){const t={context:this};return i.hooks[e].find(function(o){return o.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===i.SPACE_CODE||e===i.TAB_CODE||e===i.LF_CODE||e===i.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=e.length===1?e[0]:{type:i.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],o,n;for(;this.index<this.expr.length;)if(o=this.code,o===i.SEMCOL_CODE||o===i.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(o===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,i.max_binop_len),t=e.length;for(;t>0;){if(i.binary_ops.hasOwnProperty(e)&&(!i.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,o,n,l,c,p,h,f;if(c=this.gobbleToken(),!c||(t=this.gobbleBinaryOp(),!t))return c;for(l={value:t,prec:i.binaryPrecedence(t),right_a:i.right_associative.has(t)},p=this.gobbleToken(),p||this.throwError("Expected expression after "+t),n=[c,l,p];t=this.gobbleBinaryOp();){if(o=i.binaryPrecedence(t),o===0){this.index-=t.length;break}l={value:t,prec:o,right_a:i.right_associative.has(t)},f=t;const _=g=>l.right_a&&g.right_a?o>g.prec:o<=g.prec;for(;n.length>2&&_(n[n.length-2]);)p=n.pop(),t=n.pop().value,c=n.pop(),e={type:i.BINARY_EXP,operator:t,left:c,right:p},n.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+f),n.push(l,e)}for(h=n.length-1,e=n[h];h>1;)e={type:i.BINARY_EXP,operator:n[h-1].value,left:n[h-2],right:e},h-=2;return e}gobbleToken(){let e,t,o,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(e=this.code,i.isDecimalDigit(e)||e===i.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===i.SQUOTE_CODE||e===i.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===i.OBRACK_CODE)n=this.gobbleArray();else{for(t=this.expr.substr(this.index,i.max_unop_len),o=t.length;o>0;){if(i.unary_ops.hasOwnProperty(t)&&(!i.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=o;const l=this.gobbleToken();return l||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:i.UNARY_EXP,operator:t,argument:l,prefix:!0})}t=t.substr(0,--o)}i.isIdentifierStart(e)?(n=this.gobbleIdentifier(),i.literals.hasOwnProperty(n.name)?n={type:i.LITERAL,value:i.literals[n.name],raw:n.name}:n.name===i.this_str&&(n={type:i.THIS_EXP})):e===i.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===i.PERIOD_CODE||t===i.OBRACK_CODE||t===i.OPAREN_CODE||t===i.QUMARK_CODE;){let o;if(t===i.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==i.PERIOD_CODE)break;o=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===i.OBRACK_CODE?(e={type:i.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},e.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==i.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===i.OPAREN_CODE?e={type:i.CALL_EXP,arguments:this.gobbleArguments(i.CPAREN_CODE),callee:e}:(t===i.PERIOD_CODE||o)&&(o&&this.index--,this.gobbleSpaces(),e={type:i.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),o&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,o;for(;i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===i.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(t=this.char,t==="e"||t==="E"){for(e+=this.expr.charAt(this.index++),t=this.char,(t==="+"||t==="-")&&(e+=this.expr.charAt(this.index++));i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return o=this.code,i.isIdentifierStart(o)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(o===i.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===i.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:i.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="";const t=this.index,o=this.expr.charAt(this.index++);let n=!1;for(;this.index<this.expr.length;){let l=this.expr.charAt(this.index++);if(l===o){n=!0;break}else if(l==="\\")switch(l=this.expr.charAt(this.index++),l){case"n":e+=`
2
+ `;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=l}else e+=l}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:i.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(i.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,i.isIdentifierPart(e));)this.index++;return{type:i.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let o=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let l=this.code;if(l===e){o=!0,this.index++,e===i.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(l===i.COMMA_CODE){if(this.index++,n++,n!==t.length){if(e===i.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===i.CBRACK_CODE)for(let c=t.length;c<n;c++)t.push(null)}}else if(t.length!==n&&n!==0)this.throwError("Expected comma");else{const c=this.gobbleExpression();(!c||c.type===i.COMPOUND)&&this.throwError("Expected comma"),t.push(c)}}return o||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(i.CPAREN_CODE);if(this.code===i.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:i.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:i.ARRAY_EXP,elements:this.gobbleArguments(i.CBRACK_CODE)}}}const ie=new oe;Object.assign(i,{hooks:ie,plugins:new se(i),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),i.max_unop_len=i.getMaxKeyLen(i.unary_ops),i.max_binop_len=i.getMaxKeyLen(i.binary_ops);const j=r=>new i(r).parse(),ae=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(i).filter(r=>!ae.includes(r)&&j[r]===void 0).forEach(r=>{j[r]=i[r]}),j.Jsep=i;const le="ConditionalExpression";var ce={name:"ternary",init(r){r.hooks.add("after-expression",function(t){if(t.node&&this.code===r.QUMARK_CODE){this.index++;const o=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===r.COLON_CODE){this.index++;const l=this.gobbleExpression();if(l||this.throwError("Expected expression"),t.node={type:le,test:o,consequent:n,alternate:l},o.operator&&r.binary_ops[o.operator]<=.9){let c=o;for(;c.right.operator&&r.binary_ops[c.right.operator]<=.9;)c=c.right;t.node.test=c.right,c.right=t.node,t.node=o}}else this.throwError("Expected :")}})}};j.plugins.register(ce);const J=47,ue=92;var de={name:"regex",init(r){r.hooks.add("gobble-token",function(t){if(this.code===J){const o=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===J&&!n){const l=this.expr.slice(o,this.index);let c="";for(;++this.index<this.expr.length;){const h=this.code;if(h>=97&&h<=122||h>=65&&h<=90||h>=48&&h<=57)c+=this.char;else break}let p;try{p=new RegExp(l,c)}catch(h){this.throwError(h.message)}return t.node={type:r.LITERAL,value:p,raw:this.expr.slice(o-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===r.OBRACK_CODE?n=!0:n&&this.code===r.CBRACK_CODE&&(n=!1),this.index+=this.code===ue?2:1}this.throwError("Unclosed Regex")}})}};const G=43,L={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[G,45],assignmentPrecedence:.9,init(r){const e=[r.IDENTIFIER,r.MEMBER_EXP];L.assignmentOperators.forEach(o=>r.addBinaryOp(o,L.assignmentPrecedence,!0)),r.hooks.add("gobble-token",function(n){const l=this.code;L.updateOperators.some(c=>c===l&&c===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:l===G?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!e.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),r.hooks.add("after-token",function(n){if(n.node){const l=this.code;L.updateOperators.some(c=>c===l&&c===this.expr.charCodeAt(this.index+1))&&(e.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:l===G?"++":"--",argument:n.node,prefix:!1})}}),r.hooks.add("after-expression",function(n){n.node&&t(n.node)});function t(o){L.assignmentOperators.has(o.operator)?(o.type="AssignmentExpression",t(o.left),t(o.right)):o.operator||Object.values(o).forEach(n=>{n&&typeof n=="object"&&t(n)})}}};j.plugins.register(de,L),j.addUnaryOp("typeof"),j.addLiteral("null",null),j.addLiteral("undefined",void 0);const he=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),A={evalAst(r,e){switch(r.type){case"BinaryExpression":case"LogicalExpression":return A.evalBinaryExpression(r,e);case"Compound":return A.evalCompound(r,e);case"ConditionalExpression":return A.evalConditionalExpression(r,e);case"Identifier":return A.evalIdentifier(r,e);case"Literal":return A.evalLiteral(r,e);case"MemberExpression":return A.evalMemberExpression(r,e);case"UnaryExpression":return A.evalUnaryExpression(r,e);case"ArrayExpression":return A.evalArrayExpression(r,e);case"CallExpression":return A.evalCallExpression(r,e);case"AssignmentExpression":return A.evalAssignmentExpression(r,e);default:throw SyntaxError("Unexpected expression",r)}},evalBinaryExpression(r,e){return{"||":(o,n)=>o||n(),"&&":(o,n)=>o&&n(),"|":(o,n)=>o|n(),"^":(o,n)=>o^n(),"&":(o,n)=>o&n(),"==":(o,n)=>o==n(),"!=":(o,n)=>o!=n(),"===":(o,n)=>o===n(),"!==":(o,n)=>o!==n(),"<":(o,n)=>o<n(),">":(o,n)=>o>n(),"<=":(o,n)=>o<=n(),">=":(o,n)=>o>=n(),"<<":(o,n)=>o<<n(),">>":(o,n)=>o>>n(),">>>":(o,n)=>o>>>n(),"+":(o,n)=>o+n(),"-":(o,n)=>o-n(),"*":(o,n)=>o*n(),"/":(o,n)=>o/n(),"%":(o,n)=>o%n()}[r.operator](A.evalAst(r.left,e),()=>A.evalAst(r.right,e))},evalCompound(r,e){let t;for(let o=0;o<r.body.length;o++){r.body[o].type==="Identifier"&&["var","let","const"].includes(r.body[o].name)&&r.body[o+1]&&r.body[o+1].type==="AssignmentExpression"&&(o+=1);const n=r.body[o];t=A.evalAst(n,e)}return t},evalConditionalExpression(r,e){return A.evalAst(r.test,e)?A.evalAst(r.consequent,e):A.evalAst(r.alternate,e)},evalIdentifier(r,e){if(Object.hasOwn(e,r.name))return e[r.name];throw ReferenceError(`${r.name} is not defined`)},evalLiteral(r){return r.value},evalMemberExpression(r,e){const t=String(r.computed?A.evalAst(r.property):r.property.name),o=A.evalAst(r.object,e);if(o==null)throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);if(!Object.hasOwn(o,t)&&he.has(t))throw TypeError(`Cannot read properties of ${o} (reading '${t}')`);const n=o[t];return typeof n=="function"?n.bind(o):n},evalUnaryExpression(r,e){return{"-":o=>-A.evalAst(o,e),"!":o=>!A.evalAst(o,e),"~":o=>~A.evalAst(o,e),"+":o=>+A.evalAst(o,e),typeof:o=>typeof A.evalAst(o,e)}[r.operator](r.argument)},evalArrayExpression(r,e){return r.elements.map(t=>A.evalAst(t,e))},evalCallExpression(r,e){const t=r.arguments.map(n=>A.evalAst(n,e));return A.evalAst(r.callee,e)(...t)},evalAssignmentExpression(r,e){if(r.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const t=r.left.name,o=A.evalAst(r.right,e);return e[t]=o,e[t]}};class fe{constructor(e){this.code=e,this.ast=j(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return A.evalAst(this.ast,t)}}function $(r,e){return r=r.slice(),r.push(e),r}function W(r,e){return e=e.slice(),e.unshift(r),e}class pe extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function O(r,e,t,o,n){if(!(this instanceof O))try{return new O(r,e,t,o,n)}catch(c){if(!c.avoidNew)throw c;return c.value}typeof r=="string"&&(n=o,o=t,t=e,e=r,r=null);const l=r&&typeof r=="object";if(r=r||{},this.json=r.json||t,this.path=r.path||e,this.resultType=r.resultType||"value",this.flatten=r.flatten||!1,this.wrap=Object.hasOwn(r,"wrap")?r.wrap:!0,this.sandbox=r.sandbox||{},this.eval=r.eval===void 0?"safe":r.eval,this.ignoreEvalErrors=typeof r.ignoreEvalErrors>"u"?!1:r.ignoreEvalErrors,this.parent=r.parent||null,this.parentProperty=r.parentProperty||null,this.callback=r.callback||o||null,this.otherTypeCallback=r.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},r.autostart!==!1){const c={path:l?r.path:e};l?"json"in r&&(c.json=r.json):c.json=t;const p=this.evaluate(c);if(!p||typeof p!="object")throw new pe(p);return p}}O.prototype.evaluate=function(r,e,t,o){let n=this.parent,l=this.parentProperty,{flatten:c,wrap:p}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,t=t||this.callback,this.currOtherTypeCallback=o||this.otherTypeCallback,e=e||this.json,r=r||this.path,r&&typeof r=="object"&&!Array.isArray(r)){if(!r.path&&r.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(r,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=r),c=Object.hasOwn(r,"flatten")?r.flatten:c,this.currResultType=Object.hasOwn(r,"resultType")?r.resultType:this.currResultType,this.currSandbox=Object.hasOwn(r,"sandbox")?r.sandbox:this.currSandbox,p=Object.hasOwn(r,"wrap")?r.wrap:p,this.currEval=Object.hasOwn(r,"eval")?r.eval:this.currEval,t=Object.hasOwn(r,"callback")?r.callback:t,this.currOtherTypeCallback=Object.hasOwn(r,"otherTypeCallback")?r.otherTypeCallback:this.currOtherTypeCallback,n=Object.hasOwn(r,"parent")?r.parent:n,l=Object.hasOwn(r,"parentProperty")?r.parentProperty:l,r=r.path}if(n=n||null,l=l||null,Array.isArray(r)&&(r=O.toPathString(r)),!r&&r!==""||!e)return;const h=O.toPathArray(r);h[0]==="$"&&h.length>1&&h.shift(),this._hasParentSelector=null;const f=this._trace(h,e,["$"],n,l,t).filter(function(_){return _&&!_.isParentSelector});return f.length?!p&&f.length===1&&!f[0].hasArrExpr?this._getPreferredOutput(f[0]):f.reduce((_,g)=>{const x=this._getPreferredOutput(g);return c&&Array.isArray(x)?_=_.concat(x):_.push(x),_},[]):p?[]:void 0},O.prototype._getPreferredOutput=function(r){const e=this.currResultType;switch(e){case"all":{const t=Array.isArray(r.path)?r.path:O.toPathArray(r.path);return r.pointer=O.toPointer(t),r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),r}case"value":case"parent":case"parentProperty":return r[e];case"path":return O.toPathString(r[e]);case"pointer":return O.toPointer(r.path);default:throw new TypeError("Unknown result type")}},O.prototype._handleCallback=function(r,e,t){if(e){const o=this._getPreferredOutput(r);r.path=typeof r.path=="string"?r.path:O.toPathString(r.path),e(o,t,r)}},O.prototype._trace=function(r,e,t,o,n,l,c,p){let h;if(!r.length)return h={path:t,value:e,parent:o,parentProperty:n,hasArrExpr:c},this._handleCallback(h,l,"value"),h;const f=r[0],_=r.slice(1),g=[];function x(m){Array.isArray(m)?m.forEach(w=>{g.push(w)}):g.push(m)}if((typeof f!="string"||p)&&e&&Object.hasOwn(e,f))x(this._trace(_,e[f],$(t,f),e,f,l,c));else if(f==="*")this._walk(e,m=>{x(this._trace(_,e[m],$(t,m),e,m,l,!0,!0))});else if(f==="..")x(this._trace(_,e,t,o,n,l,c)),this._walk(e,m=>{typeof e[m]=="object"&&x(this._trace(r.slice(),e[m],$(t,m),e,m,l,!0))});else{if(f==="^")return this._hasParentSelector=!0,{path:t.slice(0,-1),expr:_,isParentSelector:!0};if(f==="~")return h={path:$(t,f),value:n,parent:o,parentProperty:null},this._handleCallback(h,l,"property"),h;if(f==="$")x(this._trace(_,e,t,null,null,l,c));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(f))x(this._slice(f,_,e,t,o,n,l));else if(f.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const m=f.replace(/^\?\((.*?)\)$/u,"$1"),w=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(m);w?this._walk(e,v=>{const N=[w[2]],T=w[1]?e[v][w[1]]:e[v];this._trace(N,T,t,o,n,l,!0).length>0&&x(this._trace(_,e[v],$(t,v),e,v,l,!0))}):this._walk(e,v=>{this._eval(m,e[v],v,t,o,n)&&x(this._trace(_,e[v],$(t,v),e,v,l,!0))})}else if(f[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");x(this._trace(W(this._eval(f,e,t.at(-1),t.slice(0,-1),o,n),_),e,t,o,n,l,c))}else if(f[0]==="@"){let m=!1;const w=f.slice(1,-2);switch(w){case"scalar":(!e||!["object","function"].includes(typeof e))&&(m=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===w&&(m=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(m=!0);break;case"number":Number.isFinite(e)&&(m=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(m=!0);break;case"object":e&&typeof e===w&&(m=!0);break;case"array":Array.isArray(e)&&(m=!0);break;case"other":m=this.currOtherTypeCallback(e,t,o,n);break;case"null":e===null&&(m=!0);break;default:throw new TypeError("Unknown value type "+w)}if(m)return h={path:t,value:e,parent:o,parentProperty:n},this._handleCallback(h,l,"value"),h}else if(f[0]==="`"&&e&&Object.hasOwn(e,f.slice(1))){const m=f.slice(1);x(this._trace(_,e[m],$(t,m),e,m,l,c,!0))}else if(f.includes(",")){const m=f.split(",");for(const w of m)x(this._trace(W(w,_),e,t,o,n,l,!0))}else!p&&e&&Object.hasOwn(e,f)&&x(this._trace(_,e[f],$(t,f),e,f,l,c,!0))}if(this._hasParentSelector)for(let m=0;m<g.length;m++){const w=g[m];if(w&&w.isParentSelector){const v=this._trace(w.expr,e,w.path,o,n,l,c);if(Array.isArray(v)){g[m]=v[0];const N=v.length;for(let T=1;T<N;T++)m++,g.splice(m,0,v[T])}else g[m]=v}}return g},O.prototype._walk=function(r,e){if(Array.isArray(r)){const t=r.length;for(let o=0;o<t;o++)e(o)}else r&&typeof r=="object"&&Object.keys(r).forEach(t=>{e(t)})},O.prototype._slice=function(r,e,t,o,n,l,c){if(!Array.isArray(t))return;const p=t.length,h=r.split(":"),f=h[2]&&Number.parseInt(h[2])||1;let _=h[0]&&Number.parseInt(h[0])||0,g=h[1]&&Number.parseInt(h[1])||p;_=_<0?Math.max(0,_+p):Math.min(p,_),g=g<0?Math.max(0,g+p):Math.min(p,g);const x=[];for(let m=_;m<g;m+=f)this._trace(W(m,e),t,o,n,l,c,!0).forEach(v=>{x.push(v)});return x},O.prototype._eval=function(r,e,t,o,n,l){this.currSandbox._$_parentProperty=l,this.currSandbox._$_parent=n,this.currSandbox._$_property=t,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const c=r.includes("@path");c&&(this.currSandbox._$_path=O.toPathString(o.concat([t])));const p=this.currEval+"Script:"+r;if(!O.cache[p]){let h=r.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(c&&(h=h.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)O.cache[p]=new this.safeVm.Script(h);else if(this.currEval==="native")O.cache[p]=new this.vm.Script(h);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const f=this.currEval;O.cache[p]=new f(h)}else if(typeof this.currEval=="function")O.cache[p]={runInNewContext:f=>this.currEval(h,f)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return O.cache[p].runInNewContext(this.currSandbox)}catch(h){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+h.message+": "+r)}},O.cache={},O.toPathString=function(r){const e=r,t=e.length;let o="$";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return o},O.toPointer=function(r){const e=r,t=e.length;let o="";for(let n=1;n<t;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(o+="/"+e[n].toString().replaceAll("~","~0").replaceAll("/","~1"));return o},O.toPathArray=function(r){const{cache:e}=O;if(e[r])return e[r].concat();const t=[],n=r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(l,c){return"[#"+(t.push(c)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(l,c){return"['"+c.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(l,c){return";"+c.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(l){const c=l.match(/#(\d+)/u);return!c||!c[1]?l:t[c[1]]});return e[r]=n,e[r].concat()},O.prototype.safeVm={Script:fe};const ye=function(r,e,t){const o=r.length;for(let n=0;n<o;n++){const l=r[n];t(l)&&e.push(r.splice(n--,1)[0])}};class be{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const o=Object.keys(e),n=[];ye(o,n,f=>typeof e[f]=="function");const l=o.map(f=>e[f]);t=n.reduce((f,_)=>{let g=e[_].toString();return/function/u.test(g)||(g="function "+g),"var "+_+"="+g+";"+f},"")+t,!/(['"])use strict\1/u.test(t)&&!o.includes("arguments")&&(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const p=t.lastIndexOf(";"),h=p!==-1?t.slice(0,p+1)+" return "+t.slice(p+1):" return "+t;return new Function(...o,h)(...l)}}O.prototype.vm={Script:be};const me={class:"json-node"},ge={key:0,class:"json-node__container"},Ee={class:"json-node__line"},_e={key:2,class:"json-node__colon"},ke=["title"],xe={key:3,class:"json-node__collapsed"},Oe={key:4,class:"json-node__comma"},Ce={key:0,class:"json-node__children"},Ae={class:"json-node__children-content"},we={class:"json-node__line json-node__closing-bracket"},ve={class:"json-node__bracket"},Se={key:0,class:"json-node__comma"},Be={key:1,class:"json-node__primitive"},Ne={key:2,class:"json-node__colon"},Pe=["title"],Te={key:0,class:"json-node__comma"},De=s.defineComponent({name:"JsonNode",__name:"JsonNode",props:{value:{},keyName:{},level:{},path:{default:""},expanded:{},isLast:{type:Boolean,default:!1},theme:{}},emits:["update:value","toggle-expand","copy","update:key"],setup(r,{emit:e}){s.useCssVars(d=>({"7b112182":d.level,"1501a3a8":d.theme.colors.syntaxKey,"4c2226b6":d.theme.colors.hoverBackground,"30aa351e":d.theme.colors.syntaxBracket,"090e30f3":d.theme.colors.textSecondary,cf872bb0:d.theme.colors.syntaxString,e0803540:d.theme.colors.syntaxNumber,"3954b61e":d.theme.colors.syntaxBoolean,e9972d44:d.theme.colors.syntaxNull,"231c0282":d.theme.colors.background,e1dce7d8:d.theme.colors.indentLine}));const t=r,o=e,n=s.ref(!1),l=s.ref(!1),c=s.ref(""),p=s.ref(""),h=d=>d!==null&&typeof d=="object"&&!Array.isArray(d)&&"__protected_number__"in d&&Object.keys(d).length===1,f=d=>h(d)?d.__protected_number__:"",_=s.computed(()=>h(t.value)?!1:t.value!==null&&typeof t.value=="object"),g=s.computed(()=>Array.isArray(t.value)),x=s.computed(()=>t.path?t.path:t.keyName?t.keyName:"root"),m=s.computed(()=>t.expanded.has(x.value)),w=s.computed(()=>t.keyName),v=s.computed(()=>g.value?"[":"{"),N=s.computed(()=>g.value?"]":"}"),T=s.computed(()=>{if(!t.value)return"";const a=Object.keys(t.value).length;return g.value?a>0?` ${a} items `:" ":a>0?` ${a} keys `:" "}),X=s.computed(()=>{const d=typeof t.value;return t.value===null?"json-node__value--null":d==="boolean"?"json-node__value--boolean":d==="number"||h(t.value)?"json-node__value--number":d==="string"?"json-node__value--string":""}),Q=s.computed(()=>l.value?p.value:t.value===null?"null":typeof t.value=="boolean"||typeof t.value=="number"?String(t.value):h(t.value)?f(t.value):typeof t.value=="string"?`"${t.value}"`:String(t.value)),R=s.computed(()=>"Click to edit, double-click to copy"),Y=d=>t.level===0?d:x.value?`${x.value}.${d}`:d,q=d=>{const a=Object.keys(t.value);return a.indexOf(d)===a.length-1},F=()=>{o("toggle-expand",x.value)},H=()=>{t.level!==0&&(n.value=!0,c.value=t.keyName,s.nextTick(()=>{const d=document.querySelectorAll(".json-node__key-input"),a=d[d.length-1];a&&(a.focus(),a.select())}))},z=()=>{_.value||(l.value=!0,h(t.value)?p.value=f(t.value):typeof t.value=="string"?p.value=t.value:p.value=String(t.value),s.nextTick(()=>{const d=document.querySelectorAll(".json-node__value-input"),a=d[d.length-1];a&&(a.focus(),a.select())}))},U=()=>{if(t.level===0||!n.value)return;const d=c.value.trim();if(!d){M();return}if(d===t.keyName){n.value=!1;return}n.value=!1,o("update:key",x.value,d)},V=()=>{try{let d;const a=p.value.trim();if(a==="null")d=null;else if(a==="true"||a==="false")d=a==="true";else if(!isNaN(Number(a))&&a!==""){const u=Number(a);!Number.isSafeInteger(u)||a.length>15?d={__protected_number__:a}:d=u}else d=p.value;o("update:value",x.value,d),l.value=!1}catch(d){console.error("Failed to parse value:",d),l.value=!1}},M=()=>{n.value=!1,c.value=t.keyName},Z=()=>{l.value=!1,h(t.value)?p.value=f(t.value):typeof t.value=="string"?p.value=t.value:p.value=String(t.value)};return(d,a)=>{const u=s.resolveComponent("JsonNode",!0);return s.openBlock(),s.createElementBlock("div",me,[_.value?(s.openBlock(),s.createElementBlock("div",ge,[s.createElementVNode("div",Ee,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:H,title:"Click to edit key"},' "'+s.toDisplayString(w.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":a[0]||(a[0]=b=>c.value=b),onKeyup:[s.withKeys(U,["enter"]),s.withKeys(M,["escape"])],onBlur:U,class:"json-node__key-input"},null,544)),[[s.vModelText,c.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",_e,": ")):s.createCommentVNode("",!0),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F,title:m.value?"Click to collapse":"Click to expand"},s.toDisplayString(v.value),9,ke),m.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",xe,[s.createTextVNode(s.toDisplayString(T.value)+" ",1),s.createElementVNode("span",{class:"json-node__bracket json-node__bracket--clickable",onClick:F},s.toDisplayString(N.value),1)])),!m.value&&!d.isLast?(s.openBlock(),s.createElementBlock("span",Oe,",")):s.createCommentVNode("",!0)]),m.value?(s.openBlock(),s.createElementBlock("div",Ce,[s.createElementVNode("div",Ae,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,(b,y)=>(s.openBlock(),s.createElementBlock("div",{key:y,class:"json-node__child"},[s.createVNode(u,{value:b,"key-name":g.value?"":String(y),level:d.level+1,path:Y(String(y)),expanded:d.expanded,theme:d.theme,"onUpdate:value":a[1]||(a[1]=(E,k)=>d.$emit("update:value",E,k)),onToggleExpand:a[2]||(a[2]=E=>d.$emit("toggle-expand",E)),onCopy:a[3]||(a[3]=E=>d.$emit("copy",E)),"onUpdate:key":a[4]||(a[4]=(E,k)=>d.$emit("update:key",E,k)),"is-last":q(String(y))},null,8,["value","key-name","level","path","expanded","theme","is-last"])]))),128))]),s.createElementVNode("div",we,[s.createElementVNode("span",ve,s.toDisplayString(N.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Se,","))])])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Be,[d.keyName&&!n.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"json-node__key",onClick:H,title:"Click to edit key"},' "'+s.toDisplayString(w.value)+'" ',1)):s.createCommentVNode("",!0),d.keyName&&n.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,"onUpdate:modelValue":a[5]||(a[5]=b=>c.value=b),onKeyup:[s.withKeys(U,["enter"]),s.withKeys(M,["escape"])],onBlur:U,class:"json-node__key-input"},null,544)),[[s.vModelText,c.value]]):s.createCommentVNode("",!0),d.keyName?(s.openBlock(),s.createElementBlock("span",Ne,": ")):s.createCommentVNode("",!0),l.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",{key:3,class:s.normalizeClass(["json-node__value",X.value]),onClick:z,onDblclick:a[6]||(a[6]=b=>d.$emit("copy",d.value)),title:R.value},[s.createTextVNode(s.toDisplayString(Q.value),1),d.isLast?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("span",Te,","))],42,Pe)),l.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:4,"onUpdate:modelValue":a[7]||(a[7]=b=>p.value=b),onKeyup:[s.withKeys(V,["enter"]),s.withKeys(Z,["escape"])],onBlur:V,class:"json-node__value-input"},null,544)),[[s.vModelText,p.value]]):s.createCommentVNode("",!0)]))])}}}),ee=(r,e)=>{const t=r.__vccOpts||r;for(const[o,n]of e)t[o]=n;return t},je=ee(De,[["__scopeId","data-v-860beb35"]]),te={name:"github-light",colors:{background:"#ffffff",surfaceBackground:"#f6f8fa",border:"#d0d7de",text:"#24292f",textSecondary:"#656d76",buttonBackground:"#f6f8fa",buttonBackgroundHover:"#f3f4f6",buttonBorder:"#d0d7de",buttonText:"#24292f",buttonPrimary:"#2da44e",buttonPrimaryHover:"#2c974b",success:"#1a7f37",successBackground:"#dafbe1",error:"#cf222e",errorBackground:"#ffebe9",syntaxString:"#0a3069",syntaxNumber:"#0969da",syntaxBoolean:"#8250df",syntaxNull:"#656d76",syntaxKey:"#0969da",syntaxBracket:"#24292f",scrollbarTrack:"#f6f8fa",scrollbarThumb:"#d0d7de",scrollbarThumbHover:"#afb8c1",hoverBackground:"#f6f8fa",indentLine:"#d0d7de"}},Ie={"github-light":te,"github-dark":{name:"github-dark",colors:{background:"#0d1117",surfaceBackground:"#161b22",border:"#30363d",text:"#e6edf3",textSecondary:"#7d8590",buttonBackground:"#21262d",buttonBackgroundHover:"#30363d",buttonBorder:"#30363d",buttonText:"#e6edf3",buttonPrimary:"#238636",buttonPrimaryHover:"#2ea043",success:"#3fb950",successBackground:"#0f2419",error:"#f85149",errorBackground:"#381921",syntaxString:"#a5d6ff",syntaxNumber:"#79c0ff",syntaxBoolean:"#d2a8ff",syntaxNull:"#7d8590",syntaxKey:"#79c0ff",syntaxBracket:"#e6edf3",scrollbarTrack:"#161b22",scrollbarThumb:"#30363d",scrollbarThumbHover:"#6e7681",hoverBackground:"#161b22",indentLine:"#30363d"}},"min-light":{name:"min-light",colors:{background:"#ffffff",surfaceBackground:"#fafafa",border:"#e5e5e5",text:"#333333",textSecondary:"#888888",buttonBackground:"#f8f8f8",buttonBackgroundHover:"#eeeeee",buttonBorder:"#e0e0e0",buttonText:"#333333",buttonPrimary:"#007acc",buttonPrimaryHover:"#005a9e",success:"#22c55e",successBackground:"#f0fdf4",error:"#ef4444",errorBackground:"#fef2f2",syntaxString:"#22c55e",syntaxNumber:"#3b82f6",syntaxBoolean:"#8b5cf6",syntaxNull:"#6b7280",syntaxKey:"#1f2937",syntaxBracket:"#374151",scrollbarTrack:"#f5f5f5",scrollbarThumb:"#d1d5db",scrollbarThumbHover:"#9ca3af",hoverBackground:"#f9f9f9",indentLine:"#e5e7eb"}},"slack-ochin":{name:"slack-ochin",colors:{background:"#fefbf6",surfaceBackground:"#faf6f0",border:"#e8d5b7",text:"#4a3b2a",textSecondary:"#8b7355",buttonBackground:"#f4ede4",buttonBackgroundHover:"#efe5d8",buttonBorder:"#e8d5b7",buttonText:"#4a3b2a",buttonPrimary:"#ff6b35",buttonPrimaryHover:"#e55a2b",success:"#ff9500",successBackground:"#fff8f0",error:"#d73502",errorBackground:"#ffeee8",syntaxString:"#d73502",syntaxNumber:"#ff6b35",syntaxBoolean:"#b7472a",syntaxNull:"#8b7355",syntaxKey:"#4a3b2a",syntaxBracket:"#6b5444",scrollbarTrack:"#f4ede4",scrollbarThumb:"#e8d5b7",scrollbarThumbHover:"#d4c4a8",hoverBackground:"#f8f2eb",indentLine:"#e8d5b7"}}};function $e(r="github-light"){return Ie[r]||te}const Re={key:0,class:"json-format__toolbar"},Ve={class:"json-format__actions"},Le=["disabled"],Ue=["disabled"],Me=["disabled"],Ke=["disabled"],Fe={class:"json-format__info"},He={key:0,class:"json-format__status json-format__status--success"},Xe={key:1,class:"json-format__status json-format__status--error"},Qe={class:"json-format__content"},Ye={key:0,class:"json-format__error"},qe={key:1,class:"json-format__error"},ze={key:2,class:"json-format__viewer"},re=ee(s.defineComponent({name:"JsonFormat",__name:"index",props:{modelValue:{default:""},readonly:{type:Boolean,default:!1},maxDepth:{default:10},showToolbar:{type:Boolean,default:!0},theme:{default:"github-light"}},emits:["update:modelValue","copy-success","copy-error","expand-all","collapse-all","compress"],setup(r,{expose:e,emit:t}){s.useCssVars(a=>({"50e4672c":g.value.colors.border,"64d14328":g.value.colors.background,"668c94eb":g.value.colors.text,"8370c286":g.value.colors.surfaceBackground,"1698e888":g.value.colors.buttonBorder,"584924be":g.value.colors.buttonBackground,"325e00bd":g.value.colors.buttonText,"2430fb1e":g.value.colors.buttonBackgroundHover,ea0e2f1c:g.value.colors.buttonPrimary,"3b0b67ea":g.value.colors.buttonPrimaryHover,"2e7b3e93":g.value.colors.successBackground,b24220f6:g.value.colors.success,"0c7db250":g.value.colors.errorBackground,"6a387a0a":g.value.colors.error,"2c13c5fa":g.value.colors.scrollbarTrack,"2c1c44e4":g.value.colors.scrollbarThumb,"8ba97764":g.value.colors.scrollbarThumbHover}));const o=r,n=t,l=s.ref(null),c=s.ref(""),p=s.ref(new Set),h=s.ref(null),f=s.ref(""),_=s.computed(()=>c.value===""),g=s.computed(()=>$e(o.theme)),x=s.computed(()=>f.value?null:h.value!==null?h.value:l.value),m=a=>{if(!a.trim()){l.value=null,c.value="",h.value=null,f.value="";return}try{let u=a;const b=/(:\s*|,\s*|\[\s*)-?\d{16,}/.test(u),y=/(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(u);if(!b&&!y)try{l.value=JSON.parse(u),c.value="",h.value=null,f.value="",s.nextTick(()=>{x.value!==null&&R()});return}catch{}u=(k=>{let C="",S=!1,B=!1,D=0;for(;D<k.length;){const K=k[D];if(S)B?B=!1:K==="\\"?B=!0:K==='"'&&(S=!1),C+=K,D++;else if(K==='"')S=!0,C+=K,D++;else{const ne=k.slice(D);let P=ne.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);if(P){C+=P[1]+'{"__protected_number__":"'+P[2]+'"}'+P[3],D+=P[0].length;continue}if(P=ne.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/),P){C+=P[1]+'{"__protected_number__":"'+P[2]+'"}'+P[3],D+=P[0].length;continue}C+=K,D++}}return C})(u),l.value=JSON.parse(u),c.value="",h.value=null,f.value="",s.nextTick(()=>{x.value!==null&&R()})}catch(u){c.value=u instanceof Error?u.message:"Unknown parsing error",l.value=null,h.value=null,f.value=""}},w=a=>{if(!a||!a.expression.trim()){v();return}if(!l.value){f.value="No valid JSON data to filter";return}try{let u;if(a.type==="jsonpath")u=O({path:a.expression,json:l.value}),u.length===1&&a.expression.includes("$[")===!1&&!a.expression.endsWith("[*]")?h.value=u[0]:h.value=u;else if(a.type==="js")u=new Function("data",`
3
3
  try {
4
4
  return ${a.expression};
5
5
  } catch (error) {
6
6
  throw new Error('JavaScript expression error: ' + error.message);
7
7
  }
8
- `)(l.value),h.value=c;else throw new Error(`Unsupported filter type: ${a.type}`);f.value="",s.nextTick(()=>{$()})}catch(c){f.value=c instanceof Error?c.message:"Filter execution error",h.value=null}},A=()=>{h.value=null,f.value=""};s.watch(()=>o.modelValue,a=>{E(a)},{immediate:!0});const I=a=>{if(!/^-?\d+(\.\d+)?$/.test(a))return!1;const c=Number(a);return!Number.isSafeInteger(c)||a.length>15},P=(a,c,y)=>JSON.stringify(a,(g,b)=>{if(typeof b=="string"&&I(b))return`__BIG_NUMBER__${b}__BIG_NUMBER__`;if(typeof b=="string"&&/^-?\d+(\.\d+)?$/.test(b)){const k=Number(b);if(Number.isSafeInteger(k)&&k.toString()===b)return k;if(!Number.isNaN(k)&&isFinite(k)&&b.includes("."))return k.toString()===b?k:`__PRESERVE_STRING__${b}__PRESERVE_STRING__`;if(!Number.isNaN(k)&&isFinite(k))return k}return c&&typeof c=="function"?c(g,b):b},y).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g,"$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g,"$1"),K=(a,c)=>{if(!o.readonly)try{const y=J(l.value,a,c),g=P(y,null,2);n("update:modelValue",g)}catch(y){console.error("Failed to update JSON:",y)}},J=(a,c,y)=>{if(!c||c==="root")return y;const g=c.split("."),b=U(a,g.slice(0,-1));let k=b;for(let B=0;B<g.length-1;B++){const N=g[B];N!=="root"&&(Array.isArray(k)?k=k[parseInt(N)]:k=k[N])}const S=g[g.length-1];return S==="root"?y:(Array.isArray(k)?k[parseInt(S)]=y:k[S]=y,b)},Y=a=>{p.value.has(a)?p.value.delete(a):p.value.add(a)},$=()=>{const a=new Set,c=(y,g="")=>{y!==null&&typeof y=="object"&&(a.add(g||"root"),Array.isArray(y)?y.forEach((b,k)=>{const S=g?`${g}.${k}`:`${k}`;c(b,S)}):Object.keys(y).forEach(b=>{const k=g?`${g}.${b}`:b;c(y[b],k)}))};c(C.value),p.value=a,n("expand-all")},H=()=>{p.value=new Set(["root"]),n("collapse-all")},X=async()=>{if(_.value)try{const a=C.value,c=P(a,null,2);await navigator.clipboard.writeText(c),n("copy-success",c)}catch(a){console.error("Failed to copy JSON:",a),n("copy-error",a instanceof Error?a:new Error("Failed to copy JSON"))}},q=()=>{if(_.value)try{const a=C.value,c=P(a);n("update:modelValue",c),n("compress",c)}catch(a){console.error("Failed to compress JSON:",a)}},R=async a=>{try{let c;typeof a=="string"&&I(a)?c=a:typeof a=="string"?c=`"${a}"`:c=JSON.stringify(a),await navigator.clipboard.writeText(c)}catch(c){console.error("Failed to copy value:",c)}},G=(a,c)=>{if(!o.readonly)try{const y=Q(l.value,a,c),g=P(y,null,2);n("update:modelValue",g),M(a,c)}catch(y){console.error("Failed to rename key:",y)}},Q=(a,c,y)=>{if(!c||c==="root")return a;const g=c.split("."),b=U(a,g.slice(0,-1));if(g.length===1){const B=g[0];return b&&typeof b=="object"&&!Array.isArray(b)?d(b,B,y):b}let k=b;for(let B=0;B<g.length-1;B++){const N=g[B];Array.isArray(k)?k=k[parseInt(N)]:k=k[N]}const S=g[g.length-1];if(!Array.isArray(k)&&k&&typeof k=="object"){const B=d(k,S,y),N=g.slice(0,-1);N.length>0&&x(b,N,B)}return b},U=(a,c)=>{if(c.length===0)return a;if(Array.isArray(a)){const y=[...a],g=c[0],b=parseInt(g);return c.length===1||(y[b]=U(a[b],c.slice(1))),y}else if(a&&typeof a=="object"){const y={...a},g=c[0];return c.length===1||(y[g]=U(a[g],c.slice(1))),y}return a},d=(a,c,y)=>{if(!a||typeof a!="object"||Array.isArray(a))return a;const g=Object.keys(a),b={};for(const k of g)k===c?b[y]=a[k]:b[k]=a[k];return b},x=(a,c,y)=>{let g=a;for(let k=0;k<c.length-1;k++){const S=c[k];Array.isArray(g)?g=g[parseInt(S)]:g=g[S]}const b=c[c.length-1];Array.isArray(g)?g[parseInt(b)]=y:g[b]=y},M=(a,c)=>{const y=new Set;p.value.forEach(g=>{if(g===a){const b=a.split(".");b[b.length-1]=c,y.add(b.join("."))}else if(g.startsWith(a+".")){const b=a.split(".");b[b.length-1]=c;const k=b.join("."),S=g.substring(a.length);y.add(k+S)}else y.add(g)}),p.value=y};return e({copyJson:X,compressSource:q,expandAll:$,collapseAll:H,toggleExpand:Y,updateValue:K,updateKey:G,filter:v,clearFilter:A,isValidJson:()=>_.value,getParsedJson:()=>l.value,getFilteredJson:()=>h.value,getExpandedNodes:()=>p.value,getParseError:()=>u.value,getFilterError:()=>f.value,parseJson:a=>E(a),copyValue:a=>R(a)}),(a,c)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${m.value.name}`])},[a.showToolbar?(s.openBlock(),s.createElementBlock("div",Le,[s.createElementVNode("div",Ue,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:X,disabled:!_.value,title:"Copy JSON"}," 📋 Copy ",8,Me),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:$,disabled:!_.value,title:"Expand All"}," ⬇️ Expand All ",8,Fe),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:H,disabled:!_.value,title:"Collapse All"}," ➡️ Collapse All ",8,Ke),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:q,disabled:!_.value,title:"Compress JSON"}," 📦 Compress ",8,He)]),s.createElementVNode("div",Xe,[_.value?(s.openBlock(),s.createElementBlock("span",Ge," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",Qe," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",Ye,[_.value?f.value?(s.openBlock(),s.createElementBlock("div",ze,[c[1]||(c[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(f.value),1)])):(s.openBlock(),s.createElementBlock("div",We,[s.createVNode($e,{value:C.value,"key-name":"",level:0,expanded:p.value,"is-last":!0,theme:m.value,"onUpdate:value":K,onToggleExpand:Y,onCopy:R,"onUpdate:key":G},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",qe,[c[0]||(c[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(u.value),1)]))])],2))}}),[["__scopeId","data-v-ad4d00ac"]]),Ze=[se],Je={install:r=>{Ze.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";r.component(t,e)})}};D.JsonFormat=se,D.default=Je,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
8
+ `)(l.value),h.value=u;else throw new Error(`Unsupported filter type: ${a.type}`);f.value="",s.nextTick(()=>{R()})}catch(u){f.value=u instanceof Error?u.message:"Filter execution error",h.value=null}},v=()=>{h.value=null,f.value=""};s.watch(()=>o.modelValue,a=>{m(a)},{immediate:!0});const N=(a,u,b)=>{const y=C=>{if(C===null||typeof C!="object")return C;if(!Array.isArray(C)&&"__protected_number__"in C&&Object.keys(C).length===1)return`__PROTECTED_NUMBER_${C.__protected_number__}_PROTECTED_NUMBER__`;if(Array.isArray(C))return C.map(B=>y(B));const S={};for(const[B,D]of Object.entries(C))S[B]=y(D);return S},E=y(a);return JSON.stringify(E,u,b).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g,"$1")},T=(a,u)=>{if(!o.readonly)try{const b=X(l.value,a,u),y=N(b,null,2);n("update:modelValue",y)}catch(b){console.error("Failed to update JSON:",b)}},X=(a,u,b)=>{if(!u||u==="root")return b;const y=u.split("."),E=V(a,y.slice(0,-1));let k=E;for(let S=0;S<y.length-1;S++){const B=y[S];B!=="root"&&(Array.isArray(k)?k=k[parseInt(B)]:k=k[B])}const C=y[y.length-1];return C==="root"?b:(Array.isArray(k)?k[parseInt(C)]=b:k[C]=b,E)},Q=a=>{p.value.has(a)?p.value.delete(a):p.value.add(a)},R=()=>{const a=new Set,u=(b,y="")=>{b!==null&&typeof b=="object"&&(a.add(y||"root"),Array.isArray(b)?b.forEach((E,k)=>{const C=y?`${y}.${k}`:`${k}`;u(E,C)}):Object.keys(b).forEach(E=>{const k=y?`${y}.${E}`:E;u(b[E],k)}))};u(x.value),p.value=a,n("expand-all")},Y=()=>{p.value=new Set(["root"]),n("collapse-all")},q=async()=>{if(_.value)try{const a=x.value,u=N(a,null,2);await navigator.clipboard.writeText(u),n("copy-success",u)}catch(a){console.error("Failed to copy JSON:",a),n("copy-error",a instanceof Error?a:new Error("Failed to copy JSON"))}},F=()=>{if(_.value)try{const a=x.value,u=N(a);n("update:modelValue",u),n("compress",u)}catch(a){console.error("Failed to compress JSON:",a)}},H=async a=>{try{let u;typeof a=="object"&&a!==null&&!Array.isArray(a)&&"__protected_number__"in a&&Object.keys(a).length===1?u=a.__protected_number__:typeof a=="string"?u=`"${a}"`:u=JSON.stringify(a),await navigator.clipboard.writeText(u)}catch(u){console.error("Failed to copy value:",u)}},z=(a,u)=>{if(!o.readonly)try{const b=U(l.value,a,u),y=N(b,null,2);n("update:modelValue",y),d(a,u)}catch(b){console.error("Failed to rename key:",b)}},U=(a,u,b)=>{if(!u||u==="root")return a;const y=u.split("."),E=V(a,y.slice(0,-1));if(y.length===1){const S=y[0];return E&&typeof E=="object"&&!Array.isArray(E)?M(E,S,b):E}let k=E;for(let S=0;S<y.length-1;S++){const B=y[S];Array.isArray(k)?k=k[parseInt(B)]:k=k[B]}const C=y[y.length-1];if(!Array.isArray(k)&&k&&typeof k=="object"){const S=M(k,C,b),B=y.slice(0,-1);B.length>0&&Z(E,B,S)}return E},V=(a,u)=>{if(u.length===0)return a;if(Array.isArray(a)){const b=[...a],y=u[0],E=parseInt(y);return u.length===1||(b[E]=V(a[E],u.slice(1))),b}else if(a&&typeof a=="object"){const b={...a},y=u[0];return u.length===1||(b[y]=V(a[y],u.slice(1))),b}return a},M=(a,u,b)=>{if(!a||typeof a!="object"||Array.isArray(a))return a;const y=Object.keys(a),E={};for(const k of y)k===u?E[b]=a[k]:E[k]=a[k];return E},Z=(a,u,b)=>{let y=a;for(let k=0;k<u.length-1;k++){const C=u[k];Array.isArray(y)?y=y[parseInt(C)]:y=y[C]}const E=u[u.length-1];Array.isArray(y)?y[parseInt(E)]=b:y[E]=b},d=(a,u)=>{const b=new Set;p.value.forEach(y=>{if(y===a){const E=a.split(".");E[E.length-1]=u,b.add(E.join("."))}else if(y.startsWith(a+".")){const E=a.split(".");E[E.length-1]=u;const k=E.join("."),C=y.substring(a.length);b.add(k+C)}else b.add(y)}),p.value=b};return e({copyJson:q,compressSource:F,expandAll:R,collapseAll:Y,toggleExpand:Q,updateValue:T,updateKey:z,filter:w,clearFilter:v,isValidJson:()=>_.value,getParsedJson:()=>l.value,getFilteredJson:()=>h.value,getExpandedNodes:()=>p.value,getParseError:()=>c.value,getFilterError:()=>f.value,parseJson:a=>m(a),copyValue:a=>H(a)}),(a,u)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["json-format",`json-format--${g.value.name}`])},[a.showToolbar?(s.openBlock(),s.createElementBlock("div",Re,[s.createElementVNode("div",Ve,[s.createElementVNode("button",{class:"json-format__btn json-format__btn--primary",onClick:q,disabled:!_.value,title:"Copy JSON"}," 📋 Copy ",8,Le),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:R,disabled:!_.value,title:"Expand All"}," ⬇️ Expand All ",8,Ue),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:Y,disabled:!_.value,title:"Collapse All"}," ➡️ Collapse All ",8,Me),s.createElementVNode("button",{class:"json-format__btn json-format__btn--secondary",onClick:F,disabled:!_.value,title:"Compress JSON"}," 📦 Compress ",8,Ke)]),s.createElementVNode("div",Fe,[_.value?(s.openBlock(),s.createElementBlock("span",He," ✅ Valid JSON ")):(s.openBlock(),s.createElementBlock("span",Xe," ❌ Invalid JSON "))])])):s.createCommentVNode("",!0),s.createElementVNode("div",Qe,[_.value?f.value?(s.openBlock(),s.createElementBlock("div",qe,[u[1]||(u[1]=s.createElementVNode("h4",null,"Filter Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(f.value),1)])):(s.openBlock(),s.createElementBlock("div",ze,[s.createVNode(je,{value:x.value,"key-name":"",level:0,expanded:p.value,"is-last":!0,theme:g.value,"onUpdate:value":T,onToggleExpand:Q,onCopy:H,"onUpdate:key":z},null,8,["value","expanded","theme"])])):(s.openBlock(),s.createElementBlock("div",Ye,[u[0]||(u[0]=s.createElementVNode("h4",null,"JSON Parse Error:",-1)),s.createElementVNode("pre",null,s.toDisplayString(c.value),1)]))])],2))}}),[["__scopeId","data-v-7a477244"]]),Ge=[re],We={install:r=>{Ge.forEach(e=>{const t=e.name||e.__name||"UnknownComponent";r.component(t,e)})}};I.JsonFormat=re,I.default=We,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lone-format",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "A Vue 3 component library for formatting with tree-shaking support",
6
6
  "main": "./dist/lone-format.umd.cjs",