PageSourceSearch

https://jsonprism.com/_next/static/chunks/4031.418ec75c18d011a1.js

js jsonprism.com collected 2026-10-07 21:01:10 UTC 8,588 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4031],{36412:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var r=n(95155),a=n(12115),s=n(96195),l=n(5917),i=n(75426),o=n(4998),c=n(93779),d=n(24033);let u={indentPx:18,fontSize:13,defaultExpandDepth:3,showChildCount:!0,stringTruncateLength:120};function m(e,t,n,r,a){if(!(n>=r)&&null!==e&&"object"==typeof e)for(let[s,l]of(a.add(t),Array.isArray(e)?e.map((e,t)=>[String(t),e]):Object.entries(e)))m(l,Array.isArray(e)?"".concat(t,"[").concat(s,"]"):"".concat(t,".").concat(s),n+1,r,a)}function p(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return e;let a=e.toLowerCase().indexOf(t.toLowerCase());return -1===a?e:(0,r.jsxs)(r.Fragment,{children:[e.slice(0,a),(0,r.jsx)("mark",{className:n?"bg-primary text-primary-foreground rounded px-0.5":"bg-primary/30 text-foreground rounded px-0.5",children:e.slice(a,a+t.length)}),e.slice(a+t.length)]})}function f(e){let{row:t,onToggle:n,onCopyValue:a,onCopyBranch:s,copiedPath:u,searchTerm:m,activeMatchPath:f,indentPx:x,fontSize:h,showChildCount:g,stringTruncateLength:y}=e,j=t.depth*x,N=u===t.id,b=!!f&&t.id===f;if(t.isClosingBracket)return(0,r.jsx)("div",{className:"flex items-center py-[2px] px-2 font-mono",style:{paddingLeft:j+8,fontSize:h},children:(0,r.jsx)("span",{className:"text-json-bracket font-medium",children:String(t.value)})});if(!t.isExpandable){let e,n=t.value;if(null===n)e=(0,r.jsx)("span",{className:"text-json-null italic font-medium",children:"null"});else if("boolean"==typeof n)e=(0,r.jsx)("span",{className:"text-json-boolean font-medium",children:String(n)});else if("number"==typeof n)e=(0,r.jsx)("span",{className:"text-json-number font-medium",children:n});else{let t=String(n),a=t.length>y?t.slice(0,y)+"…":t;e=(0,r.jsxs)("span",{className:"text-json-string",title:t,children:['"',m?p(a,m,b):a,'"']})}return(0,r.jsxs)("div",{className:"group flex items-center gap-1 py-[2px] rounded-md px-2 -mx-2 transition-colors font-mono ".concat(b?"bg-primary/10 ring-1 ring-primary/30":"hover:bg-secondary/40"),style:{marginLeft:j,fontSize:h},children:[void 0!==t.keyName&&(0,r.jsxs)("span",{className:"text-json-key shrink-0",children:['"',m?p(t.keyName,m,b):t.keyName,'"',(0,r.jsx)("span",{className:"text-json-bracket",children:": "})]}),e,(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(t.id,t.value)},className:"ml-1 shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 hover:bg-secondary/80 text-muted-foreground hover:text-foreground transition-opacity",title:"Copy value","aria-label":"Copy value",children:N?(0,r.jsx)(l.A,{className:"w-3 h-3 text-primary"}):(0,r.jsx)(i.A,{className:"w-3 h-3"})})]})}let v=t.isArray,k=v?["[","]"]:["{","}"],C=v?o.A:c.A;return(0,r.jsxs)("div",{className:"group flex items-center gap-0.5 w-fit ".concat(b?"rounded-md ring-1 ring-primary/30 bg-primary/10":""),style:{marginLeft:j},children:[(0,r.jsxs)("button",{onClick:()=>n(t.id),className:"flex items-center gap-1.5 py-[2px] hover:bg-secondary/40 rounded-md px-2 -mx-2 transition-all duration-100 text-left font-mono",style:{fontSize:h},children:[(0,r.jsx)("span",{className:"text-muted-foreground/70 transition-transform duration-150 shrink-0",style:{transform:t.isExpanded?"rotate(0deg)":"rotate(-90deg)"},children:(0,r.jsx)(d.A,{className:"w-3.5 h-3.5"})}),void 0!==t.keyName&&(0,r.jsxs)("span",{className:"text-json-key shrink-0",children:['"',m?p(t.keyName,m,b):t.keyName,'"',(0,r.jsx)("span",{className:"text-json-bracket",children:": "})]}),(0,r.jsx)("span",{className:"text-json-bracket font-medium",children:k[0]}),!t.isExpanded&&(0,r.jsxs)(r.Fragment,{children:[g&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground text-[11px] bg-secondary/60 px-1.5 py-0.5 rounded-md",children:[(0,r.jsx)(C,{className:"w-3 h-3"}),t.childCount]}),(0,r.jsx)("span",{className:"text-json-bracket font-medium",children:k[1]})]})]}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),s(t.id)},className:"shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 hover:bg-secondary/80 text-muted-foreground hover:text-foreground transition-opacity",title:"root"===t.id?"Copy entire JSON":"Copy this section","aria-label":"root"===t.id?"Copy entire JSON":"Copy this section",children:N?(0,r.jsx)(l.A,{className:"w-3 h-3 text-primary"}):(0,r.jsx)(i.A,{className:"w-3 h-3"})})]})}function x(e){let{data:t,expandAll:n,searchTerm:l,activeMatchPath:i,treeSettings:o}=e,d=(0,a.useRef)(null),p=null!=o?o:u,[x,h]=(0,a.useState)(()=>{let e=new Set;return null!=t&&m(t,"root",0,p.defaultExpandDepth,e),e});(0,a.useEffect)(()=>
1{if(void 0!==n)if(n){let e=new Set;m(t,"root",0,1/0,e),h(e)}else h(new Set)},[n,t]);let g=(0,a.useRef)(t);(0,a.useEffect)(()=>{if(g.current!==t){g.current=t;let e=new Set;null!=t&&m(t,"root",0,p.defaultExpandDepth,e),h(e)}},[t,p.defaultExpandDepth]),(0,a.useEffect)(()=>{if(!i)return;let e=function(e){let t;if("root"===e)return[];let n=["root"],r=e.slice(4),a=/\.([^.[]+)|\[(\d+)\]/g,s="root",l=[];for(;null!==(t=a.exec(r));)l.push(t[0]);for(let e=0;e<l.length-1;e++)n.push(s+=l[e]);return n}(i);e.length>0&&h(t=>{let n=new Set(t),r=!1;for(let t of e)n.has(t)||(n.add(t),r=!0);return r?n:t})},[i]);let y=(0,a.useMemo)(()=>null==t?[]:function e(t,n,r,a,s){if(null===t||"object"!=typeof t)return[{id:s,depth:r,keyName:a,value:t,isExpandable:!1,isExpanded:!1,isClosingBracket:!1}];let l=Array.isArray(t),i=l?t.map((e,t)=>[String(t),e]):Object.entries(t),o=n.has(s),c={id:s,depth:r,keyName:a,value:t,isExpandable:!0,isExpanded:o,isClosingBracket:!1,childCount:i.length,isArray:l};if(!o||0===i.length)return[c];let d=[c];for(let[t,a]of i){let i=l?"".concat(s,"[").concat(t,"]"):"".concat(s,".").concat(t);d.push(...e(a,n,r+1,l?void 0:t,i))}return d.push({id:"".concat(s,".__close"),depth:r,value:l?"]":"}",isExpandable:!1,isExpanded:!1,isClosingBracket:!0}),d}(t,x,0,void 0,"root"),[t,x]);(0,a.useEffect)(()=>{if(!i)return;let e=y.findIndex(e=>e.id===i);-1!==e&&j.scrollToIndex(e,{align:"center",behavior:"smooth"})},[i,y]);let j=(0,s.Te)({count:y.length,getScrollElement:()=>d.current,estimateSize:()=>26,overscan:20}),N=(0,a.useCallback)(e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[b,v]=(0,a.useState)(null),k=(0,a.useRef)(null),C=(0,a.useCallback)(e=>{var t,n;return"function"==typeof(null==(n=navigator)||null==(t=n.clipboard)?void 0:t.writeText)&&(navigator.clipboard.writeText(e).catch(()=>{}),!0)},[]),w=(0,a.useCallback)((e,t)=>{C("string"==typeof t?t:JSON.stringify(t))&&(v(e),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{v(null),k.current=null},1500))},[C]),S=(0,a.useCallback)(e=>{C(JSON.stringify(function(e,t){let n;if("root"===t)return e;let r=e,a=t.slice(4);if(!a)return r;let s=/\.([^.[]+)|\[(\d+)\]/g;for(;null!==(n=s.exec(a));){if(null==r)return;r=void 0!==n[1]?r[n[1]]:r[Number(n[2])]}return r}(t,e),null,2))&&(v(e),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{v(null),k.current=null},1500))},[t,C]);return((0,a.useEffect)(()=>()=>{k.current&&clearTimeout(k.current)},[]),null==t)?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground animate-fade-in",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-secondary flex items-center justify-center",children:(0,r.jsx)(c.A,{className:"w-6 h-6 text-muted-foreground/50"})}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"No JSON to display"}),(0,r.jsx)("p",{className:"text-xs mt-1 max-w-[16rem]",children:"Paste JSON, Import, From URL, or drop a .json file on the editor"})]})]}):(0,r.jsx)("div",{ref:d,className:"h-full overflow-auto",children:(0,r.jsx)("div",{style:{height:j.getTotalSize(),width:"100%",position:"relative"},className:"p-4",children:j.getVirtualItems().map(e=>{let t=y[e.index];return(0,r.jsx)("div",{"data-index":e.index,ref:j.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:"translateY(".concat(e.start,"px)"),paddingLeft:"1rem",paddingRight:"1rem"},children:(0,r.jsx)(f,{row:t,onToggle:N,onCopyValue:w,onCopyBranch:S,copiedPath:b,searchTerm:l,activeMatchPath:i,indentPx:p.indentPx,fontSize:p.fontSize,showChildCount:p.showChildCount,stringTruncateLength:p.stringTruncateLength})},t.id)})})})}},93779:(e,t,n)=>{n.d(t,{A:()=>r});let r=(0,n(71847).A)("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]])}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.