1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hashStyleCopy-9BQjpJfE.js","assets/ctFullscreenAd-wL9Ec5Hb.js","assets/app-Dsk0FNLH.js","assets/ctResultAccessAd-k2-xEPO1.js","assets/FileSaver.min-BR20wtAe.js","assets/_commonjsHelpers-BosuxZz1.js"])))=>i.map(i=>d[i]); 2import{e as tt,T as nt,_ as de}from"./app-Dsk0FNLH.js";import{p as Ce,f as Ve,a as ot}from"./formatHubNormalize-DPWLAwPE.js";import{w as it}from"./fileDropzone-CA_uaFcV.js";import{c as ct}from"./toolAceEditor-CvHlXaJj.js";import{r as rt}from"./runWithButtonBusy-CmZJQ5-c.js";import"./papaparse.min-DtqB8VRF.js";import"./_commonjsHelpers-BosuxZz1.js";import"./xlsx-D_0l8YDs.js";import"./js-yaml-CwjAzRNl.js";import"./csvSqlCore-Bx1yKKfj.js";import"./FileSaver.min-BR20wtAe.js";import"./sqlInsertToCsv-Sl-LRUog.js";import"./vcfDemoTabular-CQFX71rE.js";import"./formatHubIcsVcf-BssvIWBl.js";import"./transientNotice-Ds_di7lD.js";import"./ace-CIBRknMz.js";import"./mode-text-BvfgWieX.js";import"./theme-chrome-CmMsWY54.js";import"./ext-language_tools-wD3CM2Gn.js";import"./buttonBusy-DoyqFlQ8.js";const me=24,lt=new XMLSerializer,Re=new Ve.XMLBuilder({format:!0,ignoreAttributes:!1,attributeNamePrefix:"@_"}),st=new Ve.XMLBuilder({format:!1,ignoreAttributes:!1,attributeNamePrefix:"@_"});function d(a,m=!0){const f=document.getElementById("ctXmlToastBody"),c=document.getElementById("ctXmlToast");if(f&&c&&typeof tt<"u"){f.textContent=a,c.classList.remove("text-bg-danger","text-bg-success"),c.classList.add(m?"text-bg-danger":"text-bg-success"),nt.getOrCreateInstance(c).show();return}const g=document.getElementById("ct-xml-tool-root");if(!g)return;const o=g.querySelector("#ctXmlInlineAlert");o&&o.remove();const b=document.createElement("div");b.id="ctXmlInlineAlert",b.className=`alert ${m?"alert-danger":"alert-success"} mt-2`,b.setAttribute("role","alert"),b.textContent=a,g.prepend(b)}function ne(a,m,f=1200){if(!a)return;const c=a.textContent;a.textContent=m,a.disabled=!0,window.setTimeout(()=>{a.textContent=c,a.disabled=!1},f)}function Xe(a,m=!0){var f,c;a&&(a.classList.toggle("ct-hash-copy-btn--success",m),(f=a.querySelector(".ct-hash-copy-ic--default"))==null||f.classList.toggle("d-none",m),(c=a.querySelector(".ct-hash-copy-ic--done"))==null||c.classList.toggle("d-none",!m))}function at(a,m){var b;const f=a.querySelector("parsererror");if(!f)return m;const c=(f.textContent||m).trim(),g=c.match(/\bline\s+(\d+)\b/i),o=c.match(/\bcolumn\s+(\d+)\b/i);if(g){const I=g[1],oe=o==null?void 0:o[1],p=((b=c.split(` 3`)[0])==null?void 0:b.trim())||c;return oe?`Invalid XML: ${p} at line ${I}, column ${oe}`:`Invalid XML: ${p} at line ${I}`}return`Invalid XML: ${c}`}function _e(a){const f=new DOMParser().parseFromString(a,"application/xml");return f.querySelector("parsererror")?{ok:!1,error:at(f,"Invalid XML")}:{ok:!0,doc:f}}function kt(){var He;const a=document.getElementById("ct-xml-tool-root");if(!a)return;const m=a.dataset.ctMode==="viewer"?"viewer":"beautifier",f=m==="beautifier"?document.getElementById("ctXmlIn"):null;let c=null;const g=document.getElementById("ctXmlOut"),o=document.getElementById("ctXmlTree"),b=document.getElementById("ctXmlTreeEmpty"),I=document.getElementById("ctXmlValidationError"),oe=document.getElementById("ctXmlViewerPanel"),p=document.getElementById("ctXmlFile"),Te=document.getElementById("ctXmlFileZone"),ze=document.getElementById("ctXmlFileDropCaption"),F=document.getElementById("ctXmlRun"),ue=document.getElementById("ctXmlValidate"),fe=document.getElementById("ctXmlBeautify"),pe=document.getElementById("ctXmlMinify"),q=document.getElementById("ctXmlMainCopy"),j=document.getElementById("ctXmlMainDownload"),E=document.getElementById("ctXmlOutCopy"),M=document.getElementById("ctXmlOutDownload"),$=document.getElementById("ctXmlOutDownloadName"),ye=document.getElementById("ctXmlEx"),Ee=document.getElementById("ctXmlClr"),W=document.getElementById("ctXmlExpandAll"),Z=document.getElementById("ctXmlCollapseAll"),y=document.getElementById("ctXmlSearch"),K=document.getElementById("ctXmlSearchClear"),D=document.getElementById("ctXmlSearchMeta"),N=document.getElementById("ctXmlExpandLevel"),k=document.getElementById("ctXmlCopyPath"),B=document.getElementById("ctXmlCopyNode"),O=document.getElementById("ctXmlCopy"),Q=document.getElementById("ctXmlDownload"),ie=document.getElementById("ctXmlDownloadName"),Ne=document.getElementById("ctXmlMeta"),Me=document.getElementById("ctXmlPath");let S="",ce=0,v="",H=null,G=!1;const J=new Map,U=new Map;if(m==="viewer"){const e=document.getElementById("ctXmlAceEditor");e&&(c=ct({host:e,statusPosEl:document.getElementById("ctXmlAceStatusPos"),statusSelEl:document.getElementById("ctXmlAceStatusSel"),mode:"xml"}),(He=document.getElementById("ctXmlPaneText"))==null||He.addEventListener("shown.bs.tab",()=>c==null?void 0:c.resize()),window.addEventListener("resize",()=>c==null?void 0:c.resize()),requestAnimationFrame(()=>c==null?void 0:c.resize()))}function Fe(){return c?c.getValue():String((f==null?void 0:f.value)||"")}function Y(e){c?c.setValue(e):f&&(f.value=e)}function je(){var t;const e=document.getElementById("ctXmlPaneFile");return e!=null&&e.classList.contains("active")&&((t=p==null?void 0:p.files)!=null&&t[0])?null:Fe()}async function re(){var t;let e=je();if(e===null&&((t=p==null?void 0:p.files)!=null&&t[0]))try{e=await p.files[0].text()}catch{return d("Could not read file."),null}return String(e||"").trim()}function X(e){if(I){if(!e){I.textContent="",I.classList.add("d-none");return}I.textContent=e,I.classList.remove("d-none"),c==null||c.gotoErrorInMessage(e)}}function xe(e){O&&(O.disabled=!e),Q&&(Q.disabled=!e),ie&&(ie.disabled=!e),q&&(q.disabled=!e),j&&(j.disabled=!e)}function le(e){W&&(W.disabled=!e),Z&&(Z.disabled=!e),y&&(y.disabled=!e),ve(),N&&(N.disabled=!e),k&&(k.disabled=!e||!v),B&&(B.disabled=!e||!v),xe(e)}function ke(e){const t=U.get(e);if(!t)return"";if(t.kind==="text")return"text";const n=t.children??0;return n>0?`element · ${n} child${n===1?"":"ren"}`:"element · text content"}
3function ee(e,t=null){if(v=e||"",H&&H.classList.remove("ct-xml-node--selected"),H=t,H&&H.classList.add("ct-xml-node--selected"),Me){const i=v?ke(v):"";Me.textContent=v?`XPath: ${v}${i?` (${i})`:""}`:"XPath: -"}const n=!!(v&&G);k&&(k.disabled=!n),B&&(B.disabled=!n||!J.has(v))}function Be(e){if(!(e instanceof HTMLElement))return null;const t=e.closest(".ct-xml-node-container__head, .ct-xml-node-container__foot, .ct-xml-type-badge");if(t){const r=t.closest("details.ct-xml-node-container"),w=(r==null?void 0:r.getAttribute("data-xpath"))||"";if(w&&r)return{path:w,holder:r}}const n=e.closest("[data-xpath]");if(!n)return null;const i=n.getAttribute("data-xpath")||"";if(!i)return null;const l=n.classList.contains("ct-xml-node-container")?n:n.closest("details.ct-xml-node-container");return(l==null?void 0:l.getAttribute("data-xpath"))===i?{path:i,holder:l}:{path:i,holder:n}}function Se(e){var t;return e instanceof HTMLDetailsElement&&e.classList.contains("ct-xml-node-container")?e:((t=e==null?void 0:e.closest)==null?void 0:t.call(e,"details.ct-xml-node-container"))??null}function We(e){return J.get(e)}async function Ae(e){if(!e)return!1;try{const{copyText:t}=await de(async()=>{const{copyText:n}=await import("./hashStyleCopy-9BQjpJfE.js");return{copyText:n}},__vite__mapDeps([0,1,2]));return await t(e)?(d("Copied XPath to clipboard.",!1),!0):(d("Could not copy XPath."),!1)}catch{return d("Could not copy XPath."),!1}}async function Ie(e){const t=We(e);if(!t)return d("Could not resolve the selected node."),!1;try{const{copyText:n}=await de(async()=>{const{copyText:i}=await import("./hashStyleCopy-9BQjpJfE.js");return{copyText:i}},__vite__mapDeps([0,1,2]));return await n(t)?(d("Copied node to clipboard.",!1),!0):(d("Could not copy node."),!1)}catch{return d("Could not copy node."),!1}}function Ze(e){e instanceof HTMLDetailsElement&&(e.open=!0,e.querySelectorAll("details").forEach(t=>{t.open=!0}),A())}function Ke(e){e instanceof HTMLDetailsElement&&(e.querySelectorAll("details").forEach(t=>{t.open=!1}),A())}function A(){!o||m!=="viewer"||(o.classList.remove("ct-xml-viewer__tree--scrollable"),G&&requestAnimationFrame(()=>{const e=o.scrollHeight>o.clientHeight+1;o.classList.toggle("ct-xml-viewer__tree--scrollable",e)}))}function he(){G=!1,b&&b.classList.remove("d-none"),o&&o.classList.remove("ct-xml-viewer__tree--filled","ct-xml-viewer__tree--scrollable")}function Qe(){G=!0,b&&b.classList.add("d-none"),o&&o.classList.add("ct-xml-viewer__tree--filled")}function ge(){o&&(o.querySelectorAll(":scope > :not(#ctXmlTreeEmpty)").forEach(e=>e.remove()),J.clear(),U.clear(),he())}function Ge(e){const t=document.createElement("span");t.className="ct-xml-type-badge";const n=e===1?"child":"children";return t.textContent=e>0?`Element · ${e} ${n}`:"Element · text",t}function Pe(e,t="",n=""){const i=document.createElement("div");i.className="text-body ct-xml-line";const l=document.createElement("span");if(l.className="ct-xml-line-text ct-xml-token-tag",l.textContent=e,i.appendChild(l),n){const r=document.createElement("span");r.className="ct-xml-line-text ct-xml-token-text",r.textContent=n,i.appendChild(r)}if(t){const r=document.createElement("span");r.className="ct-xml-line-text ct-xml-token-tag",r.textContent=t,i.appendChild(r)}return i}function $e(e,t=0,n=""){if(e.nodeType===Node.TEXT_NODE){const u=(e.textContent||"").trim();if(!u)return null;J.set(n,u),U.set(n,{kind:"text"});const T=document.createElement("div");T.className="text-body ct-xml-line ct-xml-line--text",T.style.marginLeft=`${t*me}px`,T.dataset.xpath=n;const z=document.createElement("span");return z.className="ct-xml-line-text ct-xml-token-text",z.textContent=u,T.appendChild(z),T}if(e.nodeType!==Node.ELEMENT_NODE)return null;ce+=1;const i=Array.from(e.children),l=i.length>0,r=l?"":(e.textContent||"").trim(),w=Array.from(e.attributes||[]).map(u=>`${u.name}="${u.value}"`).join(" "),_=`<${e.nodeName}${w?` ${w}`:""}>`,V=`</${e.nodeName}>`,te=lt.serializeToString(e);if(J.set(n,te),U.set(n,{kind:"element",name:e.nodeName,children:i.length}),!l){const u=Pe(_,V,r);return u.classList.add("ct-xml-line--leaf"),u.style.marginLeft=`${t*me}px`,u.dataset.xpath=n,u}const x=document.createElement("details");x.className="mb-1 ct-xml-details ct-xml-node-container",x.dataset.depth=String(t),x.dataset.xpath=n,x.dataset.nodeKind="element",x.open=t<2,x.style.marginLeft=`${t*me}px`;const P=document.createElement("summary");
3P.className="ct-xml-summary ct-xml-node-container__head",P.dataset.xpath=n,P.title="Select this element to copy the whole node";const L=document.createElement("span");L.className="ct-xml-line-text ct-xml-token-tag",L.textContent=_,P.appendChild(L),P.appendChild(Ge(i.length)),x.appendChild(P);const C={};Array.from(e.childNodes).forEach(u=>{if(u.nodeType!==Node.ELEMENT_NODE&&u.nodeType!==Node.TEXT_NODE)return;let T=n;if(u.nodeType===Node.ELEMENT_NODE){const ae=u.nodeName;C[ae]=(C[ae]||0)+1,T=`${n}/${ae}[${C[ae]}]`}const z=$e(u,t+1,T);z&&x.appendChild(z)});const h=Pe(V);return h.classList.add("ct-xml-line","ct-xml-close-line","ct-xml-node-container__foot"),h.style.marginLeft=`${me}px`,h.dataset.xpath=n,h.title="Select this element to copy the whole node",x.appendChild(h),x}function De(){const e=Number((N==null?void 0:N.value)||"999");o==null||o.querySelectorAll(".ct-xml-details").forEach(t=>{const n=Number(t.dataset.depth||"0");t.open=e===999?!0:n<e}),A()}function Je(){o==null||o.querySelectorAll(".ct-xml-match").forEach(e=>e.classList.remove("ct-xml-match","bg-warning-subtle"))}function ve(){!K||!y||(K.hidden=y.disabled||!y.value)}function qe(e,t){if(!D)return;const n=(t||"").trim();if(D.classList.remove("text-danger","text-success","fw-semibold"),!n){D.textContent="";return}if(e===0){D.textContent="No matches",D.classList.add("text-danger","fw-semibold");return}D.textContent=e===1?"1 match":`${e} matches`,D.classList.add("text-success")}function se(){Je();const e=((y==null?void 0:y.value)||"").trim(),t=e.toLowerCase();if(!t||!o){qe(0,""),ve();return}let n=0;o.querySelectorAll(".ct-xml-summary, .ct-xml-line-text").forEach(i=>{var l,r;if((i.textContent||"").toLowerCase().includes(t)){n+=1,i.classList.add("ct-xml-match","bg-warning-subtle");const w=i.closest("details");let _=(l=w==null?void 0:w.parentElement)==null?void 0:l.closest("details");for(w&&(w.open=!0);_;)_.open=!0,_=(r=_.parentElement)==null?void 0:r.closest("details")}}),qe(n,e),ve()}function we(){Ne&&(Ne.textContent=`Nodes: ${ce}`)}function Ue(e){if(!o)return;const t=_e(e);if(!t.ok)throw new Error(t.error);ge(),ce=0,ee("");const n=document.createElement("div");n.className="text-secondary mb-1 ct-xml-line",n.textContent='<?xml version="1.0"?>',o.appendChild(n);const i=t.doc.documentElement,l=$e(i,0,`/${i.nodeName}[1]`);l?(o.appendChild(l),Qe()):he(),De(),se(),we(),A()}async function Le(e){if(S)try{const{copyText:t}=await de(async()=>{const{copyText:n}=await import("./hashStyleCopy-9BQjpJfE.js");return{copyText:n}},__vite__mapDeps([0,1,2]));if(!await t(S)){d("Could not copy XML.");return}e===E?(Xe(E,!0),window.setTimeout(()=>Xe(E,!1),1200)):ne(e,"Copied!")}catch{d("Could not copy XML.")}}function be(e,t){if(!S)return;const n=((e==null?void 0:e.value)||t).trim().replace(/[^\w.-]+/g,"_")||t,i=new Blob([S],{type:"application/xml"});de(()=>import("./ctResultAccessAd-k2-xEPO1.js"),__vite__mapDeps([3,4,5,1,2])).then(l=>l.saveResultFile(i,`${n}.xml`))}async function Oe(e,{render:t=!1}={}){var r;const n=_e(e);if(!n.ok)throw new Error(n.error);const i=Ce(e),l=Re.build(i);return S=l,t&&o&&(Ue(l),le(!0),(r=oe||o)==null||r.scrollIntoView({behavior:"smooth",block:"start"})),l}let s=null;function R(){s&&(s.hidden=!0,s.replaceChildren())}function Ye(e,t,n){if(!s||m!=="viewer")return;const{path:i,holder:l}=n,r=U.get(i),_=(r==null?void 0:r.kind)==="element"&&(r.children??0)>0?Se(l):null;ee(i,l),s.replaceChildren(),s.hidden=!1;const V=document.createElement("div");V.className="ct-json-tree-menu__header",V.textContent=i,s.appendChild(V);const te=document.createElement("div");te.className="ct-json-tree-menu__kind",te.textContent=ke(i),s.appendChild(te);const x=(L,C)=>{const h=document.createElement("button");h.type="button",h.className="ct-json-tree-menu__item",h.setAttribute("role","menuitem"),h.dataset.action=C,h.textContent=L,s.appendChild(h)},P=()=>{const L=document.createElement("div");L.className="ct-json-tree-menu__sep",L.setAttribute("role","separator"),s.appendChild(L)};x((r==null?void 0:r.kind)==="element"?"Copy element":"Copy text","copy-node"),x("Copy XPath","copy-path"),_&&(P(),x(_.open?"Collapse":"Expand",_.open?"collapse":"expand"),x("Expand all children","expand-children"),x("Collapse all children","collapse-children")),s.style.left=`${e}px`,s.style.top=`${t}px`,requestAnimationFrame(()=>{var T;if(!s||s.hidden)return;const L=s.getBoundingClientRect(),C=8;let h=e,u=t;h+L.width>window.innerWidth-C&&(h=window.innerWidth-L.width-C),u+L.height>window.innerHeight-C&&(u=window.innerHeight-L.height-C),s.style.left=`${Math.max(C,h)}px`,s.style.top=`${Math.max(C,u)}px`,(T=s.querySelector(".ct-json-tree-menu__item"))==null||T.focus()})}function et(){s=document.createElement("div"),s.id="ctXmlTreeMenu",s.className="
3ct-json-tree-menu",s.setAttribute("role","menu"),s.setAttribute("aria-label","XML node actions"),s.hidden=!0,document.body.appendChild(s),s.addEventListener("click",async e=>{const t=e.target instanceof HTMLElement?e.target.closest("[data-action]"):null;if(!t||!s.contains(t))return;e.preventDefault();const n=t.getAttribute("data-action")||"",i=v,r=Se(H);R(),n==="copy-node"?await Ie(i)&&ne(B,"Copied!"):n==="copy-path"?await Ae(i)&&ne(k,"Copied!"):n==="expand"&&r?(r.open=!0,A()):n==="collapse"&&r?(r.open=!1,A()):n==="expand-children"&&r?Ze(r):n==="collapse-children"&&r&&Ke(r)}),document.addEventListener("click",e=>{!s||s.hidden||e.target instanceof Node&&s.contains(e.target)||R()},!0),document.addEventListener("keydown",e=>{e.key==="Escape"&&R()}),window.addEventListener("resize",R),o==null||o.addEventListener("scroll",R,!0)}ye==null||ye.addEventListener("click",()=>{Y(ot.xml),X(""),c==null||c.focus()}),Ee==null||Ee.addEventListener("click",()=>{Y(""),p&&(p.value=""),g&&(g.value=""),y&&(y.value=""),se(),S="",ce=0,ee(""),ge(),X(""),E&&(E.disabled=!0),M&&(M.disabled=!0),$&&($.disabled=!0),we(),le(!1)}),p==null||p.addEventListener("change",async()=>{var t;const e=(t=p.files)==null?void 0:t[0];if(e)try{Y(await e.text()),X(""),c==null||c.focus()}catch{d("Could not read file.")}}),p&&Te&&it({input:p,drop:Te,captionEl:ze}),F==null||F.addEventListener("click",async()=>{var n;(n=window.getSelection())==null||n.removeAllRanges();const e=await re();if(e===null)return;if(!e){d("Paste XML or choose a file.");return}const t=async()=>{try{if(X(""),m==="beautifier"){const i=await Oe(e);g&&g.value!==i&&(g.value=i),E&&(E.disabled=!1),M&&(M.disabled=!1),$&&($.disabled=!1);const l=a.querySelector(".ct-codec-workspace__pane--out .ct-codec-workspace__hint");l instanceof HTMLElement&&(l.textContent="Ready to copy")}else await Oe(e,{render:!0})}catch(i){S="",E&&(E.disabled=!0,Xe(E,!1)),ge(),le(!1);const l=i instanceof Error?i.message:"Invalid XML";X(l),d(l)}};if(m==="beautifier"&&F instanceof HTMLButtonElement){const i=a.querySelector(".ct-codec-workspace__pane--out .ct-codec-workspace__hint");rt(F,"Beautifyingâ¦",t,{minMs:260,hintEl:i instanceof HTMLElement?i:null,busyHint:"Beautifyingâ¦",getDoneHint:()=>g!=null&&g.value?"Ready to copy":"Ready when you run"});return}await t()}),ue==null||ue.addEventListener("click",async()=>{const e=await re();if(e===null)return;if(!e){d("Paste XML or choose a file.");return}const t=_e(e);if(!t.ok){X(t.error),d(t.error);return}X(""),d("Valid XML.",!1)}),fe==null||fe.addEventListener("click",async()=>{const e=await re();if(e!==null){if(!e){d("Paste XML or choose a file.");return}try{const t=Ce(e),n=Re.build(t);S=n,Y(n),X(""),xe(!0),c==null||c.focus(),d("XML beautified in the editor.",!1)}catch(t){const n=t instanceof Error?t.message:"Invalid XML";X(n),d(n)}}}),pe==null||pe.addEventListener("click",async()=>{const e=await re();if(e!==null){if(!e){d("Paste XML or choose a file.");return}try{const t=Ce(e),n=st.build(t);S=n,Y(n),X(""),xe(!0),c==null||c.focus(),d("XML minified in the editor.",!1)}catch(t){const n=t instanceof Error?t.message:"Invalid XML";X(n),d(n)}}}),E==null||E.addEventListener("click",()=>Le(E)),M==null||M.addEventListener("click",()=>be($,"beautified")),W==null||W.addEventListener("click",()=>{o==null||o.querySelectorAll("details").forEach(e=>{e.open=!0}),A()}),Z==null||Z.addEventListener("click",()=>{o==null||o.querySelectorAll("details").forEach(e=>{e.open=!1}),A()}),y==null||y.addEventListener("input",se),K==null||K.addEventListener("click",()=>{!y||y.disabled||(y.value="",y.focus(),se())}),O==null||O.addEventListener("click",()=>Le(O)),q==null||q.addEventListener("click",()=>Le(q)),Q==null||Q.addEventListener("click",()=>be(ie,"viewed")),j==null||j.addEventListener("click",()=>be(ie,"viewed")),k==null||k.addEventListener("click",async()=>{v&&await Ae(v)&&ne(k,"Copied!")}),B==null||B.addEventListener("click",async()=>{v&&await Ie(v)&&ne(B,"Copied!")}),o==null||o.addEventListener("click",e=>{R();const t=Be(e.target);t&&ee(t.path,t.holder)}),o==null||o.addEventListener("contextmenu",e=>{if(m!=="viewer"||!G)return;const t=Be(e.target);t&&(e.preventDefault(),Ye(e.clientX,e.clientY,t))}),le(!1),we(),ee(""),m==="viewer"&&(he(),et(),o&&typeof ResizeObserver<"u"&&new ResizeObserver(()=>A()).observe(o)),E&&(E.disabled=!0),M&&(M.disabled=!0),$&&($.disabled=!0),N&&(N.value="999"),N==null||N.addEventListener("change",De)}export{kt as initXmlToolPage};
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.