@alixex/ranui-cdn 0.0.0-stage → 1.0.0

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.
Files changed (45) hide show
  1. package/README.md +32 -2
  2. package/dist/IIFE-LICENSES.md +2415 -0
  3. package/dist/iife/attachments.iife.js +1 -0
  4. package/dist/iife/button.iife.js +111 -0
  5. package/dist/iife/card.iife.js +1 -0
  6. package/dist/iife/checkbox.iife.js +1 -0
  7. package/dist/iife/colorpicker.iife.js +111 -0
  8. package/dist/iife/content.iife.js +1 -0
  9. package/dist/iife/conversation.iife.js +1 -0
  10. package/dist/iife/disclosure-row.iife.js +1 -0
  11. package/dist/iife/dropdown.iife.js +1 -0
  12. package/dist/iife/fan-gallery.iife.js +1 -0
  13. package/dist/iife/glass.iife.js +290 -0
  14. package/dist/iife/icon.iife.js +111 -0
  15. package/dist/iife/image.iife.js +1 -0
  16. package/dist/iife/input.iife.js +111 -0
  17. package/dist/iife/link.iife.js +1 -0
  18. package/dist/iife/loading.iife.js +1 -0
  19. package/dist/iife/markdown.iife.js +4048 -0
  20. package/dist/iife/math.iife.js +206 -0
  21. package/dist/iife/menubar.iife.js +70 -0
  22. package/dist/iife/mermaid.iife.js +3700 -0
  23. package/dist/iife/message.iife.js +111 -0
  24. package/dist/iife/modal.iife.js +111 -0
  25. package/dist/iife/player.iife.js +175 -0
  26. package/dist/iife/popover.iife.js +1 -0
  27. package/dist/iife/progress.iife.js +1 -0
  28. package/dist/iife/radar.iife.js +1 -0
  29. package/dist/iife/reasoning.iife.js +3 -0
  30. package/dist/iife/route.iife.js +1 -0
  31. package/dist/iife/router.iife.js +1 -0
  32. package/dist/iife/scratch.iife.js +1 -0
  33. package/dist/iife/section.iife.js +1 -0
  34. package/dist/iife/select.iife.js +111 -0
  35. package/dist/iife/skeleton.iife.js +1 -0
  36. package/dist/iife/state-dot.iife.js +1 -0
  37. package/dist/iife/surface-switch.iife.js +111 -0
  38. package/dist/iife/tab.iife.js +111 -0
  39. package/dist/iife/tabpane.iife.js +1 -0
  40. package/dist/iife/theme-switch.iife.js +111 -0
  41. package/dist/iife/token-meter.iife.js +2 -0
  42. package/dist/iife/tool-card.iife.js +4 -0
  43. package/dist/iife/voice-button.iife.js +1 -0
  44. package/dist/index.iife.js +47 -0
  45. package/package.json +30 -3
@@ -0,0 +1,4 @@
1
+ var ranui_tool_card=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=`:host{display:block;min-width:0;color:var(--ran-tool-card-color, var(--ran-color-text));font-size:var(--ran-tool-card-font-size, var(--ran-text-copy-2))}.ran-tool-card-body{display:flex;flex-direction:column;gap:var(--ran-tool-card-body-gap, var(--ran-space-2));padding:var(--ran-tool-card-body-padding, var(--ran-space-2) 0 var(--ran-space-2) var(--ran-disclosure-body-indent, var(--ran-space-6)))}.ran-tool-card-io{display:flex;flex-direction:column;border:1px solid var(--ran-tool-card-io-border-color, var(--ran-color-border));border-radius:var(--ran-tool-card-io-radius, var(--ran-radius-sm));background:var(--ran-tool-card-io-background, var(--ran-color-bg-subtle));min-width:0;font-size:var(--ran-text-label-2)}.ran-tool-card-io-section{display:grid;grid-template-columns:max-content 1fr;column-gap:var(--ran-tool-card-io-gutter-gap, var(--ran-space-3));align-items:baseline;padding:var(--ran-tool-card-io-padding, var(--ran-space-2) var(--ran-space-3));max-height:var(--ran-tool-card-io-max-height, 9.5rem);overflow:auto;overscroll-behavior:contain}.ran-tool-card-io-section+.ran-tool-card-io-section{border-top:1px solid var(--ran-tool-card-io-border-color, var(--ran-color-border))}.ran-tool-card-io-label{position:sticky;top:0;color:var(--ran-tool-card-io-label-color, var(--ran-color-text-secondary));font-size:var(--ran-tool-card-io-label-size, var(--ran-text-label-3));font-family:var(--ran-tool-card-output-font, var(--ran-font-mono));-webkit-user-select:none;user-select:none}.ran-tool-card-io-text{min-width:0;font-weight:var(--ran-tool-card-output-weight, var(--ran-text-mono-weight-regular));font-family:var(--ran-tool-card-output-font, var(--ran-font-mono));white-space:pre-wrap;overflow-wrap:anywhere}.ran-tool-card-io-text[data-error]{color:var(--ran-tool-card-io-error-color, var(--ran-color-danger))}.ran-tool-card-output{margin:0;max-height:var(--ran-tool-card-output-max-height, 18rem);overflow:auto;overscroll-behavior:contain;border:1px solid var(--ran-tool-card-io-border-color, var(--ran-color-border));border-radius:var(--ran-tool-card-output-radius, var(--ran-radius-sm));background:var(--ran-tool-card-output-background, var(--ran-color-bg-subtle));padding:var(--ran-tool-card-output-padding, var(--ran-space-2) var(--ran-space-3));font-size:var(--ran-text-label-2);font-weight:var(--ran-tool-card-output-weight, var(--ran-text-mono-weight-regular));font-family:var(--ran-tool-card-output-font, var(--ran-font-mono));white-space:pre}.ran-tool-card-output-wrap{white-space:pre-wrap;overflow-wrap:anywhere}.ran-tool-card-file+.ran-tool-card-file{margin-top:var(--ran-tool-card-file-gap, var(--ran-space-3))}.ran-tool-card-path{margin-bottom:var(--ran-tool-card-path-gap, var(--ran-space-1));color:var(--ran-tool-card-path-color, var(--ran-color-text-secondary));font-family:var(--ran-tool-card-output-font, var(--ran-font-mono))}.ran-tool-card-hunk{overflow-x:auto;border:1px solid var(--ran-tool-card-io-border-color, var(--ran-color-border));border-radius:var(--ran-tool-card-output-radius, var(--ran-radius-sm));background:var(--ran-tool-card-output-background, var(--ran-color-bg-subtle));padding-block:var(--ran-space-2);font-size:var(--ran-text-label-2);font-family:var(--ran-tool-card-output-font, var(--ran-font-mono));white-space:pre}.ran-tool-card-hunk+.ran-tool-card-hunk{margin-top:var(--ran-tool-card-hunk-gap, var(--ran-space-2))}.ran-tool-card-line{display:flex;gap:var(--ran-tool-card-line-gap, var(--ran-space-2));padding:0 var(--ran-tool-card-line-padding, var(--ran-space-3))}.ran-tool-card-line[data-kind=added]{background:var(--ran-tool-card-added-background, var(--ran-green-200))}.ran-tool-card-line[data-kind=removed]{background:var(--ran-tool-card-removed-background, var(--ran-red-200))}.ran-tool-card-gutter{flex:none;min-width:var(--ran-tool-card-gutter-width, var(--ran-size-4));color:var(--ran-tool-card-gutter-color, var(--ran-color-text-secondary));text-align:right;-webkit-user-select:none;user-select:none}.ran-tool-card-locations{display:flex;flex-wrap:wrap;gap:var(--ran-tool-card-locations-gap, var(--ran-space-2));margin-top:var(--ran-tool-card-locations-margin, var(--ran-space-3))}.ran-tool-card-location{border:none;background:none;padding:0;color:var(--ran-tool-card-location-color, var(--ran-color-link));font:inherit;font-family:var(--ran-tool-card-output-font, var(--ran-font-mono));cursor:pointer}`,n=typeof document>`u`,r=4e6;function i(e){if(e===``)return[];let t=e.split(`
2
+ `);return t.at(-1)===``&&t.pop(),t}function a(e,t){let n=e.length+1,r=t.length+1,i=new Uint32Array(n*r);for(let n=e.length-1;n>=0;--n)for(let a=t.length-1;a>=0;--a)i[n*r+a]=e[n]===t[a]?i[(n+1)*r+a+1]+1:Math.max(i[(n+1)*r+a],i[n*r+a+1]);let a=[],o=0,s=0;for(;o<e.length&&s<t.length;)e[o]===t[s]?(a.push({kind:`context`,text:e[o],oldLine:o+1,newLine:s+1}),o+=1,s+=1):i[(o+1)*r+s]>=i[o*r+s+1]?(a.push({kind:`removed`,text:e[o],oldLine:o+1,newLine:null}),o+=1):(a.push({kind:`added`,text:t[s],oldLine:null,newLine:s+1}),s+=1);for(;o<e.length;o+=1)a.push({kind:`removed`,text:e[o],oldLine:o+1,newLine:null});for(;s<t.length;s+=1)a.push({kind:`added`,text:t[s],oldLine:null,newLine:s+1});return a}function o(e,t){return[...e.map((e,t)=>({kind:`removed`,text:e,oldLine:t+1,newLine:null})),...t.map((e,t)=>({kind:`added`,text:e,oldLine:null,newLine:t+1}))]}function s(e,t){let n=e.map(e=>e.kind!==`context`);if(!n.includes(!0))return[];let r=Array.from({length:e.length},()=>!1);n.forEach((n,i)=>{if(n)for(let n=Math.max(0,i-t);n<=Math.min(e.length-1,i+t);n+=1)r[n]=!0});let i=[],a=[],o=()=>{if(a.length===0)return;let e=a.map(e=>e.oldLine).filter(e=>e!==null),t=a.map(e=>e.newLine).filter(e=>e!==null);i.push({oldStart:e[0]??0,oldLines:e.length,newStart:t[0]??0,newLines:t.length,lines:a}),a=[]};return r.forEach((t,n)=>{t?a.push(e[n]):o()}),o(),i}function c(e,t,n={}){let c=Math.max(0,n.context??3),l=i(e),u=i(t),d=0;for(;d<l.length&&d<u.length&&l[d]===u[d];)d+=1;let f=0;for(;f<l.length-d&&f<u.length-d&&l[l.length-1-f]===u[u.length-1-f];)f+=1;let p=l.slice(d,l.length-f),m=u.slice(d,u.length-f),ee=(p.length+1)*(m.length+1)>r?o(p,m):a(p,m);return s([...l.slice(0,d).map((e,t)=>({kind:`context`,text:e,oldLine:t+1,newLine:t+1})),...ee.map(e=>({...e,oldLine:e.oldLine===null?null:e.oldLine+d,newLine:e.newLine===null?null:e.newLine+d})),...l.slice(l.length-f).map((e,t)=>({kind:`context`,text:e,oldLine:l.length-f+t+1,newLine:u.length-f+t+1}))],c)}var l=/["'&<>]/;function u(e){let t=``+e,n=l.exec(t);if(!n)return t;let r,i=``,a=0,o=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=`&quot;`;break;case 38:r=`&amp;`;break;case 39:r=`&#39;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;break;default:continue}o!==a&&(i+=t.substring(o,a)),o=a+1,i+=r}return o===a?i:i+t.substring(o,a)}var d=class{ac=null;get signal(){return this.ac??=new AbortController,this.ac.signal}on(e,t,n,r){return e.addEventListener(t,n,{...r,signal:this.signal}),this}delegate(e,t,n,r,i){return e.addEventListener(n,n=>{let i=n.target?.closest(t);i&&e.contains(i)&&r(n,i)},{...i,signal:this.signal}),this}abort(){this.ac?.abort(),this.ac=null}},f=new Map,p=`data-adopted-style`,m=(e,t,n)=>{if(typeof CSSStyleSheet>`u`)return!1;try{if(!n.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),n.set(t,e)}let r=n.get(t);return e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]),!0}catch{return!1}},ee=(e,t,n=p)=>{if(t){if(typeof document>`u`){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t);return}if(!m(e,t,f)&&!e.querySelector(`style[${n}]`)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}}},h=0,g=1,_=2,v=null,y=null,te=0,b=new Set,x=!1;function ne(e,t){let n=t?.equals??Object.is,r={value:e,observers:new Set};return[()=>(oe(r),r.value),e=>{let t=typeof e==`function`?e(r.value):e;if(!n(r.value,t)){r.value=t;for(let e of r.observers)T(e,_);te===0&&se()}}]}function S(e){let t=ie(e,!0);return ae(t),le(t),()=>E(t)}function re(e){let t=v;v=null;try{return e()}finally{v=t}}function C(e){let t={owned:[],cleanups:[],owner:y},n=y,r=v;y=t,v=null;try{return e(()=>de(t))}finally{y=n,v=r}}function w(e){y&&y.cleanups.push(e)}function ie(e,t,n){return{fn:e,sources:new Set,isEffect:t,running:!1,disposed:!1,state:_,observers:new Set,value:void 0,equals:n??Object.is,owned:[],cleanups:[],owner:y}}function ae(e){y&&y.owned.push(e)}function oe(e){v&&(v.sources.add(e),e.observers.add(v))}function T(e,t){if(e.disposed||e.state>=t)return;let n=e.state===h;if(e.state=t,e.isEffect)b.add(e);else if(n)for(let t of e.observers)T(t,g)}function se(){if(!(te>0||x)){x=!0;try{for(;b.size>0;){let e=[...b];b.clear();for(let t of e)t.disposed||ce(t)}}finally{x=!1}}}function ce(e){if(!(e.disposed||e.state===h)){if(e.state===g)for(let t of e.sources)`fn`in t&&ce(t);e.state===_&&le(e),e.state=h}}function le(e){if(e.running)throw Error(`ranview reactivity: cyclic dependency detected (a computation triggered itself).`);ue(e);let t=v,n=y;v=e,y=e,e.running=!0,e.state=h;try{let t=e.fn();if(e.isEffect)typeof t==`function`&&e.cleanups.push(t);else{let n=e.value;if(e.value=t,e.observers.size>0&&!e.equals(n,t))for(let t of e.observers)T(t,_)}}finally{e.running=!1,v=t,y=n}}function ue(e){for(let t of e.owned)E(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0;for(let t of e.sources)t.observers.delete(e);e.sources.clear()}function E(e){e.disposed||(e.disposed=!0,ue(e),e.observers.clear())}function de(e){for(let t of e.owned)E(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0}function fe(e){return u(e)}var pe=e=>typeof e!=`string`&&`tagName`in e&&`childrenList`in e,me=`.#[`;function he(e){let t=[],n=0,r=/^[a-zA-Z][\w-]*/.exec(e);for(r!==null&&(t.push(r[0]),n=r[0].length);n<e.length;){let r=e[n];if(r===`[`){let r=e.indexOf(`]`,n+1);if(r===-1)return null;t.push(e.slice(n,r+1)),n=r+1;continue}if(r!==`.`&&r!==`#`)return null;let i=n+1;for(;i<e.length&&!me.includes(e[i]);)i+=1;if(i===n+1)return null;t.push(e.slice(n,i)),n=i}return t.length>0?t:null}var ge=(e,t)=>{let n=t;if(n.startsWith(`.`))return e.classList.contains(n.slice(1));if(n.startsWith(`#`))return e.getAttribute(`id`)===n.slice(1);if(n.startsWith(`[`)&&n.endsWith(`]`)){let[t,r]=n.slice(1,-1).trim().split(`=`),i=(t||``).trim();if(!i)return!1;if(r==null)return e.hasAttribute(i);let a=r.trim().replace(/^['"]|['"]$/g,``);return e.getAttribute(i)===a}return e.tagName===n.toLowerCase()},_e=(e,t)=>{let n=t.trim();if(!n)return!1;let r=he(n);return r!==null&&r.every(t=>ge(e,t))},D=(e,t,n)=>{for(let r of e)pe(r)&&(_e(r,t)&&n.push(r),D(r.childrenList,t,n))};function O(e,t,n){if(n==null)return e.push(t),t;let r=e.indexOf(n);return r===-1?e.push(t):e.splice(r,0,t),t}var k=class{childrenList=[];appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return O(this.childrenList,e,t)}serialize(){return this.childrenList.map(e=>typeof e==`string`?u(e):e.serialize()).join(``)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return D(this.childrenList,e,t),t}},ve=new Map,ye=class{tagName;attributes=new Map;_inlineStyles=null;get inlineStyles(){return this._inlineStyles??ve}childrenList=[];shadowRoot=null;_textContent=null;get textContent(){return this._textContent}set textContent(e){this._textContent=e}content;eventListeners=null;_style=null;_classList=null;get style(){return this._style??={setProperty:(e,t)=>{let n=e.startsWith(`--`)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase();(this._inlineStyles??=new Map).set(n,t)},removeProperty:e=>this._inlineStyles?.delete(e)??!1}}get classList(){return this._classList??={add:(...e)=>{let t=this.attributes.get(`class`)||``,n=new Set([...t.split(` `).filter(Boolean),...e]);this.attributes.set(`class`,Array.from(n).join(` `))},remove:(...e)=>{let t=(this.attributes.get(`class`)||``).split(` `).filter(t=>!e.includes(t));this.attributes.set(`class`,t.join(` `))},toggle:e=>{this.classList.contains(e)?this.classList.remove(e):this.classList.add(e)},contains:e=>(this.attributes.get(`class`)||``).split(` `).includes(e)}}_innerHTML=``;get innerHTML(){return this._textContent===null?this._innerHTML:u(this._textContent)}set innerHTML(e){this._innerHTML=e,this._textContent=null,this.tagName===`template`&&this.content&&(this.content.childrenList=[e])}constructor(e=`div`){this.tagName=e.toLowerCase(),this.tagName===`template`&&(this.content=new k)}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}setAttribute(e,t){this.attributes.set(e,t)}getAttribute(e){return this.attributes.get(e)||null}removeAttribute(e){this.attributes.delete(e)}hasAttribute(e){return this.attributes.has(e)}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return O(this.childrenList,e,t)}attachShadow(e){return this.shadowRoot=new be(this,e),this.shadowRoot}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return D(this.childrenList,e,t),t}addEventListener(e,t){let n=this.eventListeners??=new Map,r=n.get(e)||new Set;r.add(t),n.set(e,r)}removeEventListener(e,t){let n=this.eventListeners?.get(e);n&&(n.delete(t),n.size===0&&this.eventListeners?.delete(e))}dispatchEvent(e){let t=this.eventListeners?.get(e.type);if(!t||t.size===0)return!0;for(let n of t)typeof n==`function`?n.call(this,e):n.handleEvent(e);return!e.defaultPrevented}serialize(e){typeof this._preSerialize==`function`&&this._preSerialize();let t=e||this._ssrTag||this.tagName;this.shadowRoot&&!this.hasAttribute(`data-ran-dsd`)&&this.setAttribute(`data-ran-dsd`,``);let n=Array.from(this.attributes.entries()).map(([e,t])=>` ${e}="${fe(t)}"`).join(``),r=this._inlineStyles?Array.from(this._inlineStyles.entries()).map(([e,t])=>`${e}:${t}`).join(`;`):``,i=r?` style="${fe(r)}"`:``,a=``;return this.shadowRoot&&(a+=this.shadowRoot.serialize()),this.textContent===null?this._innerHTML?a+=this._innerHTML:a+=this.childrenList.map(e=>typeof e==`string`?u(e):(e instanceof k,e.serialize())).join(``):a+=u(this.textContent),[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(t)&&!a?`<${t}${n}${i} />`:`<${t}${n}${i}>${a}</${t}>`}},be=class{host;options;childrenList=[];adoptedStyleSheets=[];constructor(e,t){this.host=e,this.options=t}get children(){return this.childrenList.filter(e=>typeof e!=`string`&&!(e instanceof k))}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return O(this.childrenList,e,t)}replaceChildren(...e){this.childrenList=e.filter(e=>e!=null)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return D(this.childrenList,e,t),t}serialize(){return`<template shadowrootmode="${this.options.mode}"${this.options.delegatesFocus?` shadowrootdelegatesfocus`:``}>${this.adoptedStyleSheets.map(e=>`<style>${String(e).replace(/<\/style/gi,`<\\/style`)}</style>`).join(``)}${this.childrenList.map(e=>typeof e==`string`?u(e):(e instanceof k,e.serialize())).join(``)}</template>`}},A={bind(e,t){t(typeof e==`function`?e():e)},append(e,t){for(let r of t){if(r==null)continue;if(Array.isArray(r)){A.append(e,r);continue}if(typeof r==`function`){A.append(e,[r()]);continue}if(typeof r==`object`&&(`__ranFor`in r||`__ranIndex`in r))throw TypeError(`Import For and Index from the static entry when using static builders`);let t=r instanceof j?r.build():typeof r==`string`&&!n?document.createTextNode(r):r;e.appendChild(t)}}},xe=`http://www.w3.org/2000/svg`,Se=new Set(`svg.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComposite.feDropShadow.feFlood.feGaussianBlur.feMerge.feMergeNode.feOffset.filter.foreignObject.g.image.line.linearGradient.marker.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.switch.symbol.text.textPath.tspan.use`.split(`.`)),j=class{runtime;el;constructor(e,t,r=A){this.runtime=r;let i=t??(Se.has(e)?`http://www.w3.org/2000/svg`:void 0);this.el=n?new ye(e):i?document.createElementNS(i,e):document.createElement(e)}id(e){return this.el.setAttribute(`id`,e),this}bind(e,t){this.runtime.bind(e,t)}class(e){return this.bind(e,e=>{n?this.el.attributes.set(`class`,e):this.el.setAttribute(`class`,e)}),this}addClass(...e){return e.forEach(e=>this.el.classList.add(e)),this}removeClass(...e){return e.forEach(e=>this.el.classList.remove(e)),this}attr(e,t){return this.bind(t,t=>this.el.setAttribute(e,t)),this}attrs(e){return Object.entries(e).forEach(([e,t])=>{t!=null&&this.el.setAttribute(e,String(t))}),this}boolAttr(e,t,n=``){return this.bind(t,t=>{t?this.el.setAttribute(e,n):this.el.removeAttribute(e)}),this}part(e){return this.attr(`part`,e)}data(e,t){return this.attr(`data-${e}`,t)}style(e,t){return typeof e==`string`?this.bind(t??``,t=>this.el.style.setProperty(e,t)):Object.entries(e).forEach(([e,t])=>this.el.style.setProperty(e,t)),this}cssVar(e,t){let n=e.startsWith(`--`)?e:`--${e}`;return this.style(n,t)}aria(e,t){return this.attr(`aria-${e}`,t)}role(e){return this.attr(`role`,e)}tabIndex(e){return this.attr(`tabindex`,String(e))}label(e){return this.aria(`label`,e)}labelledBy(e){return this.aria(`labelledby`,e)}describedBy(e){return this.aria(`describedby`,e)}ariaHidden(e=!0){return this.aria(`hidden`,String(e))}on(e,t,n){return this.el.addEventListener(e,t,n),this}listen(e,t,n,r){return e.on(this.el,t,n,r),this}delegate(e,t,n,r,i){return e.delegate(this.el,t,n,r,i),this}children(...e){return this.runtime.append(this.el,e),this}replaceChildren(...e){if(n){let e=this.el;e.childrenList=[]}else this.el.replaceChildren();return this.children(...e)}text(e){return this.bind(e,e=>{this.el.textContent=e}),this}unsafeHtml(e){return this.bind(e,e=>{this.el.innerHTML=e}),this}ref(e){return e.current=this.el,this}shadow(e={mode:`closed`}){let t=this.el.attachShadow(e);return new Ce(this.el,t,e,this.runtime)}build(){return this.el}serialize(){if(n)return this.el.serialize();let e=document.createElement(`div`);return e.appendChild(this.el.cloneNode(!0)),e.innerHTML}},Ce=class{runtime;root;hostEl;constructor(e,t,n,r=A){this.runtime=r,this.hostEl=e,this.root=t}children(...e){return this.runtime.append(this.root,e),this}adoptSheet(...e){return this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,...e],this}css(e){if(n)return this.root.adoptedStyleSheets.push(e),this;if(typeof CSSStyleSheet<`u`)try{let t=new CSSStyleSheet;return t.replaceSync(e),this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,t],this}catch{}let t=document.createElement(`style`);return t.textContent=e,this.root.appendChild(t),this}done(){return{host:this.hostEl,shadow:this.root}}serialize(){return n?this.root.serialize():this.root.innerHTML}},M=()=>({current:null}),we=e=>e.reduce((e,t)=>Array.isArray(t)?e.concat(we(t)):e.concat(t),[]),N=e=>e==null?null:e instanceof j?e.build():typeof e==`string`?n?e:document.createTextNode(e):e,Te=(e,t)=>{if(n){P(e,[t()]);return}let r=document.createComment(``),i=document.createComment(``);e.appendChild(r),e.appendChild(i);let a=null,o=()=>{a?.(),a=null;let e=r.nextSibling;for(;e&&e!==i;){let t=e.nextSibling;e.parentNode?.removeChild(e),e=t}};S(()=>{let e=t();o();let n=document.createDocumentFragment();a=C(t=>(P(n,[e]),t)),i.parentNode?.insertBefore(n,i)}),w(()=>a?.())},Ee=`__ranFor`,De=e=>typeof e==`object`&&!!e&&e[Ee]===!0,Oe=(e,t,n)=>{let[r,i]=ne(t),a=null,o=C(t=>{let i=N(n(e,r));return a=typeof i==`string`?document.createTextNode(i):i,t});return{node:a,index:i,dispose:o}},ke=(e,t)=>{let n=e.parentNode;if(!n)return;let r=e;for(let e of t)r.nextSibling!==e&&n.insertBefore(e,r.nextSibling),r=e},Ae=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=N(t.render(n,()=>r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=new Map;w(()=>{for(let e of i.values())e.dispose();i.clear()}),S(()=>{let e=t.each()??[],n=new Map,a=[];e.forEach((e,r)=>{let o=t.key(e,r);if(n.has(o)){Ie()&&console.error(`[ranview For] duplicate key "${String(o)}" — keys must be unique; ignoring the duplicate item.`);return}let s=i.get(o);s?(i.delete(o),s.index(r)):s=Oe(e,r,t.render),n.set(o,s),s.node&&a.push(s.node)});for(let e of i.values())e.node?.parentNode?.removeChild(e.node),e.dispose();ke(r,a),i=n})},je=`__ranIndex`,Me=e=>typeof e==`object`&&!!e&&e[je]===!0,Ne=(e,t,n)=>{let[r,i]=ne(e),a=null,o=C(e=>{let i=N(n(r,t));return a=typeof i==`string`?document.createTextNode(i):i,e});return{node:a,setItem:i,dispose:o}},Pe=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=N(t.render(()=>n,r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=[];w(()=>{for(let e of i)e.dispose();i=[]}),S(()=>{let e=t.each()??[];for(let n=0;n<e.length;n++)n<i.length?i[n].setItem(e[n]):i.push(Ne(e[n],n,t.render));for(let t=i.length-1;t>=e.length;t--){let{node:e}=i[t];e?.parentNode?.removeChild(e),i[t].dispose(),i.pop()}ke(r,i.map(e=>e.node).filter(e=>e!=null))})},P=(e,t)=>{n?re(()=>Fe(e,t)):Fe(e,t)},Fe=(e,t)=>{we(t).forEach(t=>{if(De(t)){Ae(e,t);return}if(Me(t)){Pe(e,t);return}if(typeof t==`function`){Te(e,t);return}let n=N(t);n!=null&&e.appendChild(n)})},Ie=()=>!1,Le={bind(e,t){typeof e==`function`?n?re(()=>t(e())):S(()=>t(e())):t(e)},append:P},Re=class extends j{constructor(e,t){super(e,t,Le)}};function ze(e){let t=t=>new e(t);return{View:t,Div:()=>t(`div`),Svg:t=>new e(t,xe),Span:()=>t(`span`),Slot:()=>t(`slot`),ButtonBuilder:()=>t(`button`),InputBuilder:()=>t(`input`),Style:()=>t(`style`),Label:()=>t(`label`),Ul:()=>t(`ul`),Li:()=>t(`li`),Section:()=>t(`section`),Article:()=>t(`article`),Nav:()=>t(`nav`),Header:()=>t(`header`),Footer:()=>t(`footer`),Main:()=>t(`main`),DeclarativeShadow:(e=`open`,n=!1)=>{let r=t(`template`);return r.attr(`shadowrootmode`,e),n&&r.attr(`shadowrootdelegatesfocus`,``),r}}}var{View:F,Div:I,Svg:Be,Span:L,Slot:R,ButtonBuilder:Ve,InputBuilder:He,Style:Ue,Label:We,Ul:Ge,Li:Ke,Section:qe,Article:Je,Nav:Ye,Header:Xe,Footer:Ze,Main:Qe,DeclarativeShadow:$e}=ze(Re),et=new Map;function z(e,t){n?(et.set(e,t),t.prototype._ssrTag=e):customElements.get(e)||customElements.define(e,t)}var B=typeof document<`u`?HTMLElement:ye,tt=`data-ranui`,V=`data-ranui-sheet`,H=(e,t)=>{if(typeof document>`u`&&t){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t)}ee(e,t,tt)},U=new WeakMap,W=new Map,nt=e=>{if(typeof CSSStyleSheet>`u`)return;let t=W.get(e);if(!t)try{let n=new CSSStyleSheet;n.replaceSync(e),t={sheet:n,users:0},W.set(e,t)}catch{return}return t.users++,t.sheet},rt=e=>{let t=W.get(e);t&&--t.users===0&&W.delete(e)},it=(e,t)=>{if(typeof document>`u`)return;let n=U.get(e);if((n?.text??``)===t||(n?.sheet?(e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n.sheet),rt(n.text)):n&&e.querySelector(`style[${V}]`)?.remove(),U.delete(e),!t))return;let r=nt(t);if(r)try{e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]}catch{rt(t),r=void 0}if(!r){let n=document.createElement(`style`);n.setAttribute(V,``),n.textContent=t,e.appendChild(n)}U.set(e,{text:t,sheet:r})},at=new WeakMap,ot=new WeakMap,st=`@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}`,ct=`:host([hidden]){display:none}`,lt=new Map,ut=e=>{let t=lt.get(e);if(t!==void 0)return t;let n=`${ct}\n${st}`,r=e?`${e}\n${n}`:n;return lt.set(e,r),r},dt=e=>{let t=ot.get(e);if(t)return t;try{let t=e.attachInternals;if(typeof t!=`function`)return;let n=t.call(e);return ot.set(e,n),n}catch{return}},G=(e,t=``,n={mode:`closed`},r)=>{let i=r??dt(e),a=e.shadowRoot||at.get(e)||i?.shadowRoot||e.attachShadow(n);return at.set(e,a),H(a,ut(t)),a},K=(e,t,...n)=>{e.replaceChildren(...n),H(e,ut(t))},q=(e,t)=>{if(e.current===null)throw Error(`ranui: ${t} is missing its .ref() on the builder`);return e.current},J=(e,t,n=``)=>e.getAttribute(t)??n,Y=(e,t,n,r={})=>{r.removeEmpty&&!n?e.removeAttribute(t):e.setAttribute(t,n??``)},X=(e,t,n,r,i)=>{n===`sheet`&&r!==i&&it(t,e.getAttribute(`sheet`)||``)},ft=`:host{display:block;min-width:0;color:var(--ran-disclosure-color, var(--ran-color-text));font-size:var(--ran-disclosure-font-size, var(--ran-text-copy-2));--ran-disclosure-body-indent: calc(var(--ran-disclosure-leading-size, 16px) + var(--ran-disclosure-gap, var(--ran-space-2)))}.ran-disclosure{display:flex;flex-direction:column;min-width:0}.ran-disclosure-row{position:relative;overflow:hidden;display:flex;align-items:center;gap:var(--ran-disclosure-gap, var(--ran-space-2));border-radius:var(--ran-disclosure-radius, var(--ran-radius-sm));min-width:0;height:var(--ran-disclosure-row-height, 24px)}@media(pointer:coarse){.ran-disclosure-row{height:var(--ran-disclosure-row-height, var(--ran-size-7, 32px))}}:host([expandable]) .ran-disclosure-row{cursor:pointer}:host([expandable]) .ran-disclosure-row:hover{box-shadow:calc(-1 * var(--ran-space-2)) 0 0 0 var(--ran-disclosure-hover-background, var(--ran-color-bg-hover)),var(--ran-space-2) 0 0 0 var(--ran-disclosure-hover-background, var(--ran-color-bg-hover));background:var(--ran-disclosure-hover-background, var(--ran-color-bg-hover))}.ran-disclosure-row:focus-visible{outline:2px solid var(--ran-color-focus);outline-offset:2px}.ran-disclosure-leading{display:inline-grid;flex:none;place-items:center;width:var(--ran-disclosure-leading-size, 16px);height:var(--ran-disclosure-leading-size, 16px);color:var(--ran-disclosure-leading-color, var(--ran-color-text-secondary))}.ran-disclosure-icon,.ran-disclosure-chevron{grid-area:1 / 1;transition:opacity var(--ran-disclosure-transition, var(--ran-motion-duration-fast)) var(--ran-motion-ease-standard)}.ran-disclosure-icon{display:inline-flex;align-items:center;justify-content:center}.ran-disclosure-chevron{width:var(--ran-disclosure-chevron-size, 12px);height:var(--ran-disclosure-chevron-size, 12px);transform:rotate(-90deg);transition:opacity var(--ran-disclosure-transition, var(--ran-motion-duration-fast)) var(--ran-motion-ease-standard),transform var(--ran-disclosure-toggle-duration, var(--ran-motion-duration-base)) var(--ran-motion-ease-standard)}:host([open]) .ran-disclosure-chevron{transform:rotate(0)}:host(:not([expandable])) .ran-disclosure-chevron{display:none}.ran-disclosure.has-leading .ran-disclosure-chevron{opacity:0}:host([expandable]) .has-leading .ran-disclosure-row:hover .ran-disclosure-icon,:host([expandable]) .has-leading .ran-disclosure-row:focus-visible .ran-disclosure-icon,:host([expandable][open]) .has-leading .ran-disclosure-icon{opacity:0}:host([expandable]) .has-leading .ran-disclosure-row:hover .ran-disclosure-chevron,:host([expandable]) .has-leading .ran-disclosure-row:focus-visible .ran-disclosure-chevron,:host([expandable][open]) .has-leading .ran-disclosure-chevron{opacity:1}.ran-disclosure-title{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;font-weight:var(--ran-disclosure-title-weight, 400);min-width:0;white-space:nowrap}.ran-disclosure-sep{flex:none;border-radius:50%;background:var(--ran-disclosure-sep-color, var(--ran-color-text-disabled));width:2px;height:2px}.ran-disclosure-summary{flex:1 1 0;min-width:0;overflow:hidden;color:var(--ran-disclosure-summary-color, var(--ran-color-text-secondary));text-overflow:ellipsis;white-space:nowrap}.has-summary .ran-disclosure-summary{min-width:min(50%,16ch)}:host([tone="error"]) .ran-disclosure-summary{color:var(--ran-disclosure-error-color, var(--ran-color-danger))}:host([busy]) .ran-disclosure-row:after{content:"";position:absolute;top:0;bottom:0;left:0;background:linear-gradient(90deg,transparent 0%,var(--ran-disclosure-sweep-color, color-mix(in srgb, var(--ran-color-bg) 65%, transparent)) 55%,transparent 100%);width:var(--ran-disclosure-sweep-width, 12rem);animation:ran-disclosure-sweep var(--ran-disclosure-sweep-duration, 2.6s) ease-out infinite;pointer-events:none}@keyframes ran-disclosure-sweep{0%{left:-12rem}90%,to{left:100%}}@media(prefers-reduced-motion:reduce){:host([busy]) .ran-disclosure-row:after{display:none}}.ran-disclosure-body{display:grid;grid-template-rows:0fr;min-width:0;transition:grid-template-rows var(--ran-disclosure-toggle-duration, var(--ran-motion-duration-base)) var(--ran-motion-ease-standard)}:host([open]) .ran-disclosure-body{grid-template-rows:1fr}.ran-disclosure-body-inner{min-width:0;overflow:hidden;content-visibility:hidden;transition:content-visibility var(--ran-disclosure-toggle-duration, var(--ran-motion-duration-base)) allow-discrete}:host([open]) .ran-disclosure-body-inner{content-visibility:visible}@media(prefers-reduced-motion:reduce){.ran-disclosure-icon,.ran-disclosure-chevron,.ran-disclosure-body,.ran-disclosure-body-inner{transition:none}}`;function pt(e){return e.key===`Enter`||e.key===` `||e.key===`Spacebar`}var mt=`disclosuretoggle`,ht=0,Z=new Map;function Q(e){return typeof e?.assignedNodes==`function`&&e.assignedNodes().some(e=>e.nodeType===Node.ELEMENT_NODE||(e.textContent??``).trim()!==``)}z(`r-disclosure-row`,class extends B{_events=new d;_shadowDom;_root;_row;_title;_summary;_sep;_leadingSlot;_headingSlot;_summarySlot;_titleText;_summaryText;_body;_bodyInner;_bodyId=`ran-disclosure-body-${ht+=1}`;static get observedAttributes(){return[`open`,`expandable`,`heading`,`summary`,`tone`,`busy`,`name`,`sheet`]}constructor(){super(),this._shadowDom=G(this,ft);let e=M(),t=M(),n=M(),r=M(),i=M(),a=M(),o=M(),s=M(),c=M(),l=M(),u=M(),d=I().class(`ran-disclosure`).attr(`part`,`disclosure`).children(I().class(`ran-disclosure-row`).ref(e).attr(`part`,`row`).children(L().class(`ran-disclosure-leading`).attr(`part`,`leading`).children(L().class(`ran-disclosure-icon`).children(R().ref(i).attr(`name`,`leading`).build()).build(),F(`svg`).class(`ran-disclosure-chevron`).attr(`viewBox`,`0 0 24 24`).attr(`fill`,`none`).attr(`stroke`,`currentColor`).attr(`stroke-width`,`1.75`).attr(`stroke-linecap`,`round`).attr(`stroke-linejoin`,`round`).attr(`aria-hidden`,`true`).children(F(`path`).attr(`d`,`M6 9l6 6 6-6`).build()).build()).build(),L().class(`ran-disclosure-title`).ref(t).attr(`part`,`title`).children(R().ref(a).attr(`name`,`heading`).children(L().class(`ran-disclosure-title-text`).ref(s).build()).build()).build(),L().class(`ran-disclosure-sep`).ref(r).attr(`part`,`separator`).attr(`aria-hidden`,`true`).build(),L().class(`ran-disclosure-summary`).ref(n).attr(`part`,`summary`).children(R().ref(o).attr(`name`,`summary`).children(L().class(`ran-disclosure-summary-text`).ref(c).build()).build()).build()).build(),I().class(`ran-disclosure-body`).attr(`part`,`body`).id(this._bodyId).ref(l).children(I().class(`ran-disclosure-body-inner`).ref(u).children(R().build()).build()).build()).build();K(this._shadowDom,ft,d),this._root=d,this._leadingSlot=i.current,this._headingSlot=a.current,this._summarySlot=o.current,this._titleText=s.current,this._summaryText=c.current,this._body=l.current,this._bodyInner=u.current,this._row=q(e,`row`),this._title=q(t,`title`),this._summary=q(n,`summary`),this._sep=q(r,`separator`)}get open(){return this.hasAttribute(`open`)}set open(e){e!==this.open&&(e?this.setAttribute(`open`,``):this.removeAttribute(`open`))}get expandable(){return this.hasAttribute(`expandable`)}set expandable(e){e?this.setAttribute(`expandable`,``):this.removeAttribute(`expandable`)}get heading(){return J(this,`heading`)}set heading(e){Y(this,`heading`,e)}get summary(){return J(this,`summary`)}set summary(e){Y(this,`summary`,e)}get busy(){return this.hasAttribute(`busy`)}set busy(e){e?this.setAttribute(`busy`,``):this.removeAttribute(`busy`)}get tone(){return J(this,`tone`)}set tone(e){Y(this,`tone`,e)}get name(){return J(this,`name`)}set name(e){Y(this,`name`,e)}get sheet(){return J(this,`sheet`)}set sheet(e){Y(this,`sheet`,e)}connectedCallback(){this.handlerExternalCss(),this._events.on(this._row,`click`,this._toggle),this._events.on(this._row,`keydown`,this._keydown),this._events.on(this._leadingSlot,`slotchange`,this._syncLeading),this._events.on(this._headingSlot,`slotchange`,this._syncFromSlot),this._events.on(this._summarySlot,`slotchange`,this._syncFromSlot),this._join(),this._syncLeading(),this._sync(),this.open&&this._closeGroupPeers()}disconnectedCallback(){this._events.abort(),this._leave()}attributeChangedCallback(e,t,n){t!==n&&(e===`sheet`?this.handlerExternalCss():(e===`name`&&(this._leave(t??``),this._join()),e===`open`&&n!==null&&this._closeGroupPeers(),this._sync()))}handlerExternalCss=()=>{X(this,this._shadowDom,`sheet`,null,this.sheet)};_toggle=()=>{if(!this.expandable)return;let e=!this.open;this.dispatchEvent(new CustomEvent(`disclosurebeforetoggle`,{detail:{open:e},bubbles:!0,composed:!0,cancelable:!0}))&&(this.open=e,this.dispatchEvent(new CustomEvent(mt,{detail:{open:this.open},bubbles:!0,composed:!0})))};_keydown=e=>{this.expandable&&pt(e)&&(e.preventDefault(),this._toggle())};_join(){let{name:e}=this;if(!e)return;let t=Z.get(e)??new Set;t.add(this),Z.set(e,t)}_leave(e=this.name){let t=Z.get(e);t&&(t.delete(this),t.size===0&&Z.delete(e))}_closeGroupPeers(){let e=this.name?Z.get(this.name):void 0;e&&e.forEach(e=>{e!==this&&(e.open=!1)})}_syncLeading=()=>{this._root.classList.toggle(`has-leading`,Q(this._leadingSlot))};_syncFromSlot=()=>{this._sync()};_sync(){let{heading:e,summary:t,expandable:n,open:r}=this;this._titleText.textContent=e,this._summaryText.textContent=t;let i=e!==``||Q(this._headingSlot),a=t!==``||Q(this._summarySlot);this._root.classList.toggle(`has-summary`,a),this._sep.hidden=!i||!a,n?(this._row.setAttribute(`role`,`button`),this._row.tabIndex=0,this._row.setAttribute(`aria-expanded`,String(r)),this._row.setAttribute(`aria-controls`,this._bodyId)):(this._row.removeAttribute(`role`),this._row.removeAttribute(`tabindex`),this._row.removeAttribute(`aria-expanded`),this._row.removeAttribute(`aria-controls`)),this.busy?this._row.setAttribute(`aria-busy`,`true`):this._row.removeAttribute(`aria-busy`);let o=!(n&&r);o&&this._bodyInner.matches(`:focus-within`)&&this._row.focus({preventScroll:!0}),this._bodyInner.inert=o}});var gt=`:host{display:inline-block;flex:none;width:var(--ran-state-dot-size, 8px);height:var(--ran-state-dot-size, 8px)}.ran-state-dot{position:relative;width:100%;height:100%;color:var(--ran-state-dot-color, var(--ran-color-text-disabled))}.ran-state-dot:before,.ran-state-dot:after{content:"";position:absolute;border-radius:50%;background:currentColor}.ran-state-dot:before{inset:0;opacity:var(--ran-state-dot-halo-opacity, .16)}.ran-state-dot:after{inset:20%}:host([state="running"]) .ran-state-dot{color:var(--ran-state-dot-running-color, var(--ran-color-primary))}:host([state="success"]) .ran-state-dot{color:var(--ran-state-dot-success-color, var(--ran-color-success))}:host([state="warning"]) .ran-state-dot{color:var(--ran-state-dot-warning-color, var(--ran-color-warning))}:host([state="error"]) .ran-state-dot{color:var(--ran-state-dot-error-color, var(--ran-color-danger))}:host([state="running"]) .ran-state-dot:after{animation:ran-state-dot-pulse 1.4s ease-in-out infinite}@keyframes ran-state-dot-pulse{0%,to{inset:20%;opacity:1}50%{inset:32%;opacity:.6}}@media(prefers-reduced-motion:reduce){:host([state="running"]) .ran-state-dot:after{animation:none}}`,_t=class extends B{_shadowDom;static get observedAttributes(){return[`state`,`label`,`sheet`]}constructor(){super(),this._shadowDom=G(this,gt),K(this._shadowDom,gt,I().class(`ran-state-dot`).attr(`part`,`dot`).build())}get state(){let e=J(this,`state`,`idle`);return vt.has(e)?e:`idle`}set state(e){Y(this,`state`,e)}get label(){return J(this,`label`)}set label(e){Y(this,`label`,e)}get sheet(){return J(this,`sheet`)}set sheet(e){Y(this,`sheet`,e)}connectedCallback(){this.handlerExternalCss(),this._syncRole()}attributeChangedCallback(e,t,n){t!==n&&(e===`sheet`&&this.handlerExternalCss(),e===`label`&&this._syncRole())}handlerExternalCss=()=>{X(this,this._shadowDom,`sheet`,null,this.sheet)};_syncRole(){let e=this.label;e===``?(this.setAttribute(`aria-hidden`,`true`),this.removeAttribute(`role`),this.removeAttribute(`aria-label`)):(this.removeAttribute(`aria-hidden`),this.setAttribute(`role`,`img`),this.setAttribute(`aria-label`,e))}},vt=new Set([`idle`,`running`,`success`,`warning`,`error`]);z(`r-state-dot`,_t);var yt=new Set([`generic`,`terminal`,`diff`]);function bt(e){let t=e?.card;return typeof t==`string`&&yt.has(t)?t:`generic`}function xt(e){if(e===null)return``;if(typeof e.summary==`string`)return e.summary;if(e.card===`terminal`)return e.description??e.cwd??``;if(e.card===`diff`)return Array.isArray(e.diffs)?e.diffs.map(e=>e.path).join(` · `):``;let t=e.card===`generic`?e.input:void 0,n=typeof t==`object`&&t?Object.values(t)[0]:void 0;return typeof n==`string`?n:``}function St(e){if(e===null)return``;let t=e.card===`generic`?e.content:e.card===`terminal`?e.output:void 0,n=typeof t==`string`?(t.split(`
3
+ `).find(e=>e.trim()!==``)??``).trim():``;return n===``?e.card===`terminal`&&e.exitCode!==void 0&&e.exitCode!==0?`exit ${e.exitCode}`:``:n}var Ct={running:`running`,success:`success`,error:`error`},$=class extends B{_events=new d;_shadowDom;_row;_dot;_body;_call=null;_result=null;static get observedAttributes(){return[`status`,`open`,`sheet`]}constructor(){super(),this._shadowDom=G(this,t);let e=M(),n=M(),r=F(`r-disclosure-row`).attr(`part`,`row`).children(F(`r-state-dot`).ref(e).attr(`slot`,`leading`).build(),I().class(`ran-tool-card-body`).ref(n).attr(`part`,`body`).build()).build();K(this._shadowDom,t,r),this._row=r,this._dot=q(e,`state dot`),this._body=q(n,`body`)}get call(){return this._call}set call(e){this._call=e,this._render()}get result(){return this._result}set result(e){this._result=e,this._render()}get status(){let e=J(this,`status`,`running`);return e===`success`||e===`error`?e:`running`}set status(e){Y(this,`status`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get sheet(){return J(this,`sheet`)}set sheet(e){Y(this,`sheet`,e)}connectedCallback(){this.handlerExternalCss(),this._events.on(this._row,mt,e=>{this.open=e.detail.open}),this._render()}disconnectedCallback(){this._events.abort()}attributeChangedCallback(e,t,n){t!==n&&(e===`sheet`?this.handlerExternalCss():this._render())}handlerExternalCss=()=>{X(this,this._shadowDom,`sheet`,null,this.sheet)};_render(){let e=this._call,t=this.status;this._row.heading=e!==null&&`title`in e?e.title:``;let n=t===`error`?St(this._result):``;this._row.summary=n===``?xt(e):n,this._row.open=this.open,this._row.tone=t===`error`?`error`:``,this._row.busy=t===`running`,this._dot.state=Ct[t],this._body.replaceChildren();let r=bt(this._result??e);r===`terminal`?this._renderTerminal():r===`diff`?this._renderDiff():this._renderGeneric();let i=e!==null&&`locations`in e?e.locations:void 0;Array.isArray(i)&&i.length>0&&this._body.appendChild(this._renderLocations(i)),this._row.expandable=this._body.childNodes.length>0}_ioCard(e,t,n){if(e===null&&t===null)return null;let r=I().class(`ran-tool-card-io`).attr(`part`,`io`).build(),i=(e,t,n)=>{let r=I().class(`ran-tool-card-io-section`).build(),i=L().class(`ran-tool-card-io-text`).attr(`part`,`io-text`).text(t).build();return n&&(i.dataset.error=``),r.append(L().class(`ran-tool-card-io-label`).attr(`aria-hidden`,`true`).text(e).build(),i),r};return e!==null&&r.appendChild(i(`IN`,e,!1)),t!==null&&r.appendChild(i(`OUT`,t,n)),r}_renderGeneric(){let e=this._call,t=this._result,n=e!==null&&e.card===`generic`&&e.input!==void 0?Object.entries(e.input).map(([e,t])=>`${e}: ${t}`).join(`
4
+ `):null,r=t!==null&&t.card===`generic`&&t.content!==void 0?t.content:null,i=this._ioCard(n,r===``?null:r,this.status===`error`);i!==null&&this._body.appendChild(i)}_renderTerminal(){let e=this._call,t=this._result,n=e!==null&&e.card===`terminal`?e.cwd===void 0?null:`cwd: ${e.cwd}`:null;if(t===null||t.card!==`terminal`){let e=this._ioCard(n,null,!1);e!==null&&this._body.appendChild(e);return}let r=this._ioCard(n,null,!1);r!==null&&this._body.appendChild(r),this._body.appendChild(this._pre(t.output,`preserve`)),t.exitCode!==void 0&&t.exitCode!==0&&this._body.appendChild(I().class(`ran-tool-card-description`).attr(`part`,`exit`).text(`exit ${t.exitCode}`).build())}_renderDiff(){let e=this._result??this._call,t=e!==null&&e.card===`diff`?e.diffs:void 0;if(Array.isArray(t))for(let e of t)this._body.appendChild(this._renderFile(e))}_renderFile(e){let t=I().class(`ran-tool-card-file`).attr(`part`,`file`).build();t.appendChild(I().class(`ran-tool-card-path`).attr(`part`,`path`).text(e.path).build());for(let n of c(e.oldText??``,e.newText))t.appendChild(this._renderHunk(n));return t}_renderHunk(e){let t=I().class(`ran-tool-card-hunk`).attr(`part`,`hunk`).build();for(let n of e.lines){let e=I().class(`ran-tool-card-line`).attr(`part`,`line`).build();e.dataset.kind=n.kind,e.append(L().class(`ran-tool-card-gutter`).text(n.oldLine===null?``:String(n.oldLine)).build(),L().class(`ran-tool-card-gutter`).text(n.newLine===null?``:String(n.newLine)).build(),L().text(`${n.kind===`added`?`+`:n.kind===`removed`?`-`:` `}${n.text}`).build()),t.appendChild(e)}return t}_renderLocations(e){let t=I().class(`ran-tool-card-locations`).attr(`part`,`locations`).build();for(let n of e){let e=n.line===void 0?n.path:`${n.path}:${n.line}`,r=Ve().class(`ran-tool-card-location`).attr(`part`,`location`).attr(`type`,`button`).text(e).build();this._events.on(r,`click`,()=>{this.dispatchEvent(new CustomEvent(`locationclick`,{detail:{location:n},bubbles:!0,composed:!0}))}),t.appendChild(r)}return t}_pre(e,t){let n=document.createElement(`pre`);return n.className=t===`wrap`?`ran-tool-card-output ran-tool-card-output-wrap`:`ran-tool-card-output`,n.setAttribute(`part`,`output`),n.textContent=e,n}};return z(`r-tool-card`,$),e.ToolCard=$,e.default=$,e})({});
@@ -0,0 +1 @@
1
+ var ranui_voice_button=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=`:host{display:inline-flex}.ran-voice{display:inline-flex;touch-action:none;align-items:center;justify-content:center;border:1px solid var(--ran-voice-border-color, var(--ran-color-border));border-radius:var(--ran-voice-border-radius, var(--ran-radius-sm));background:var(--ran-voice-background, var(--ran-color-bg-elevated));box-shadow:var(--ran-skin-raised-shadow, var(--ran-shadow-elevated));padding:0;width:var(--ran-voice-size, var(--ran-size-7));height:var(--ran-voice-size, var(--ran-size-7));color:var(--ran-voice-color, var(--ran-color-text-secondary));cursor:pointer}@media(hover:hover){.ran-voice:hover:not(:disabled){border-color:var(--ran-voice-hover-border-color, var(--ran-color-border-hover));color:var(--ran-voice-hover-color, var(--ran-color-text))}}.ran-voice:focus-visible{outline:2px solid var(--ran-voice-focus-color, var(--ran-color-focus));outline-offset:2px}.ran-voice:disabled{color:var(--ran-voice-disabled-color, var(--ran-color-text-disabled));cursor:not-allowed}:host([listening]) .ran-voice{border-color:var(--ran-voice-active-border-color, var(--ran-color-danger));background:var(--ran-voice-active-background, var(--ran-red-200));color:var(--ran-voice-active-color, var(--ran-color-danger))}:host([listening]) .ran-voice:after{position:absolute;border:2px solid var(--ran-voice-active-border-color, var(--ran-color-danger));border-radius:var(--ran-voice-border-radius, var(--ran-radius-sm));width:var(--ran-voice-size, var(--ran-size-7));height:var(--ran-voice-size, var(--ran-size-7));content:"";animation:ran-voice-pulse 1.6s ease-out infinite}.ran-voice{position:relative}@keyframes ran-voice-pulse{0%{opacity:.7;transform:scale(1)}to{opacity:0;transform:scale(1.6)}}@media(prefers-reduced-motion:reduce){:host([listening]) .ran-voice:after{animation:none;opacity:0}}.ran-voice-hint{position:absolute;bottom:calc(100% + var(--ran-voice-hint-gap, var(--ran-space-2)));left:50%;z-index:1;transform:translate(-50%);border-radius:var(--ran-voice-hint-radius, var(--ran-radius-md));background:var(--ran-voice-hint-background, var(--ran-color-bg-elevated));box-shadow:var(--ran-voice-hint-shadow, var(--ran-shadow-menu));padding:var(--ran-voice-hint-padding, var(--ran-space-2) var(--ran-space-3));min-width:max-content;color:var(--ran-voice-hint-color, var(--ran-color-text-secondary));font-size:var(--ran-voice-hint-font-size, var(--ran-text-label-3));text-align:center;pointer-events:none}:host(:not([holding])) .ran-voice-hint{display:none}:host([cancelling]) .ran-voice-hint{color:var(--ran-voice-hint-cancel-color, var(--ran-color-danger))}:host([cancelling]) .ran-voice{border-color:var(--ran-voice-active-border-color, var(--ran-color-danger));background:var(--ran-voice-cancel-background, var(--ran-color-bg-subtle))}`,n=typeof document>`u`,r=()=>{if(typeof window>`u`)return;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition},i=e=>e===`not-allowed`||e===`service-not-allowed`?`denied`:e===`no-speech`?`noSpeech`:e===`aborted`?`aborted`:`failed`,a=(e={})=>{let{lang:t,continuous:n=!0,interimResults:a=!0,onResult:o,onError:s,onStart:c,onEnd:l}=e,u=null,ee=()=>{u=null,l?.()},d={get supported(){return r()!==void 0},get active(){return u!==null},start(){let e=r();if(e&&!u)try{let r=new e;r.lang=typeof t==`function`?t():t??``,r.continuous=n,r.interimResults=a,r.maxAlternatives=1;let l=``,d=0;r.onresult=e=>{let t=e.results,n=Math.min(e.resultIndex??0,t.length);for(n<d&&(d=0,l=``);d<n;d++)l+=t[d]?.[0]?.transcript??``;let r=``,i=!0;for(let e=d;e<t.length;e++){let n=t[e];r+=n?.[0]?.transcript??``,n?.isFinal===!1&&(i=!1)}o?.(l+r,i)},r.onerror=e=>s?.({kind:i(e.error),detail:e.error}),r.onstart=()=>c?.(),r.onend=ee,u=r,r.start()}catch(e){u=null,s?.({kind:`failed`,detail:e instanceof Error?e.message:String(e)}),l?.()}},stop(){u?.stop()},abort(){u?.abort()},toggle(){u?d.stop():d.start()}};return d},o=/["'&<>]/;function s(e){let t=``+e,n=o.exec(t);if(!n)return t;let r,i=``,a=0,s=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=`&quot;`;break;case 38:r=`&amp;`;break;case 39:r=`&#39;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;break;default:continue}s!==a&&(i+=t.substring(s,a)),s=a+1,i+=r}return s===a?i:i+t.substring(s,a)}var c=class{ac=null;get signal(){return this.ac??=new AbortController,this.ac.signal}on(e,t,n,r){return e.addEventListener(t,n,{...r,signal:this.signal}),this}delegate(e,t,n,r,i){return e.addEventListener(n,n=>{let i=n.target?.closest(t);i&&e.contains(i)&&r(n,i)},{...i,signal:this.signal}),this}abort(){this.ac?.abort(),this.ac=null}},l=new Map,u=`data-adopted-style`,ee=(e,t,n)=>{if(typeof CSSStyleSheet>`u`)return!1;try{if(!n.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),n.set(t,e)}let r=n.get(t);return e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]),!0}catch{return!1}},d=(e,t,n=u)=>{if(t){if(typeof document>`u`){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t);return}if(!ee(e,t,l)&&!e.querySelector(`style[${n}]`)){let r=document.createElement(`style`);r.setAttribute(n,``),r.textContent=t,e.appendChild(r)}}};Object.freeze({});var te=null;function ne(){return te}var f=0,p=1,m=2,h=null,g=null,_=0,v=new Set,y=!1;function re(e,t){let n=t?.equals??Object.is,r={value:e,observers:new Set};return[()=>(se(r),r.value),e=>{let t=typeof e==`function`?e(r.value):e;if(!n(r.value,t)){r.value=t;for(let e of r.observers)C(e,m);_===0&&ce()}}]}function b(e){let t=ae(e,!0);return oe(t),T(t),()=>D(t)}function ie(e){let t=h;h=null;try{return e()}finally{h=t}}function x(e){let t={owned:[],cleanups:[],owner:g},n=g,r=h;g=t,h=null;try{return e(()=>le(t))}finally{g=n,h=r}}function S(e){g&&g.cleanups.push(e)}function ae(e,t,n){return{fn:e,sources:new Set,isEffect:t,running:!1,disposed:!1,state:m,observers:new Set,value:void 0,equals:n??Object.is,owned:[],cleanups:[],owner:g}}function oe(e){g&&g.owned.push(e)}function se(e){h&&(h.sources.add(e),e.observers.add(h))}function C(e,t){if(e.disposed||e.state>=t)return;let n=e.state===f;if(e.state=t,e.isEffect)v.add(e);else if(n)for(let t of e.observers)C(t,p)}function ce(){if(!(_>0||y)){y=!0;try{for(;v.size>0;){let e=[...v];v.clear();for(let t of e)t.disposed||w(t)}}finally{y=!1}}}function w(e){if(!(e.disposed||e.state===f)){if(e.state===p)for(let t of e.sources)`fn`in t&&w(t);e.state===m&&T(e),e.state=f}}function T(e){if(e.running)throw Error(`ranview reactivity: cyclic dependency detected (a computation triggered itself).`);E(e);let t=h,n=g;h=e,g=e,e.running=!0,e.state=f;try{let t=e.fn();if(e.isEffect)typeof t==`function`&&e.cleanups.push(t);else{let n=e.value;if(e.value=t,e.observers.size>0&&!e.equals(n,t))for(let t of e.observers)C(t,m)}}finally{e.running=!1,h=t,g=n}}function E(e){for(let t of e.owned)D(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0;for(let t of e.sources)t.observers.delete(e);e.sources.clear()}function D(e){e.disposed||(e.disposed=!0,E(e),e.observers.clear())}function le(e){for(let t of e.owned)D(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0}function ue(e){return s(e)}var de=e=>typeof e!=`string`&&`tagName`in e&&`childrenList`in e,fe=`.#[`;function pe(e){let t=[],n=0,r=/^[a-zA-Z][\w-]*/.exec(e);for(r!==null&&(t.push(r[0]),n=r[0].length);n<e.length;){let r=e[n];if(r===`[`){let r=e.indexOf(`]`,n+1);if(r===-1)return null;t.push(e.slice(n,r+1)),n=r+1;continue}if(r!==`.`&&r!==`#`)return null;let i=n+1;for(;i<e.length&&!fe.includes(e[i]);)i+=1;if(i===n+1)return null;t.push(e.slice(n,i)),n=i}return t.length>0?t:null}var me=(e,t)=>{let n=t;if(n.startsWith(`.`))return e.classList.contains(n.slice(1));if(n.startsWith(`#`))return e.getAttribute(`id`)===n.slice(1);if(n.startsWith(`[`)&&n.endsWith(`]`)){let[t,r]=n.slice(1,-1).trim().split(`=`),i=(t||``).trim();if(!i)return!1;if(r==null)return e.hasAttribute(i);let a=r.trim().replace(/^['"]|['"]$/g,``);return e.getAttribute(i)===a}return e.tagName===n.toLowerCase()},he=(e,t)=>{let n=t.trim();if(!n)return!1;let r=pe(n);return r!==null&&r.every(t=>me(e,t))},O=(e,t,n)=>{for(let r of e)de(r)&&(he(r,t)&&n.push(r),O(r.childrenList,t,n))};function k(e,t,n){if(n==null)return e.push(t),t;let r=e.indexOf(n);return r===-1?e.push(t):e.splice(r,0,t),t}var A=class{childrenList=[];appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return k(this.childrenList,e,t)}serialize(){return this.childrenList.map(e=>typeof e==`string`?s(e):e.serialize()).join(``)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return O(this.childrenList,e,t),t}},ge=new Map,_e=class{tagName;attributes=new Map;_inlineStyles=null;get inlineStyles(){return this._inlineStyles??ge}childrenList=[];shadowRoot=null;_textContent=null;get textContent(){return this._textContent}set textContent(e){this._textContent=e}content;eventListeners=null;_style=null;_classList=null;get style(){return this._style??={setProperty:(e,t)=>{let n=e.startsWith(`--`)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase();(this._inlineStyles??=new Map).set(n,t)},removeProperty:e=>this._inlineStyles?.delete(e)??!1}}get classList(){return this._classList??={add:(...e)=>{let t=this.attributes.get(`class`)||``,n=new Set([...t.split(` `).filter(Boolean),...e]);this.attributes.set(`class`,Array.from(n).join(` `))},remove:(...e)=>{let t=(this.attributes.get(`class`)||``).split(` `).filter(t=>!e.includes(t));this.attributes.set(`class`,t.join(` `))},toggle:e=>{this.classList.contains(e)?this.classList.remove(e):this.classList.add(e)},contains:e=>(this.attributes.get(`class`)||``).split(` `).includes(e)}}_innerHTML=``;get innerHTML(){return this._textContent===null?this._innerHTML:s(this._textContent)}set innerHTML(e){this._innerHTML=e,this._textContent=null,this.tagName===`template`&&this.content&&(this.content.childrenList=[e])}constructor(e=`div`){this.tagName=e.toLowerCase(),this.tagName===`template`&&(this.content=new A)}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}setAttribute(e,t){this.attributes.set(e,t)}getAttribute(e){return this.attributes.get(e)||null}removeAttribute(e){this.attributes.delete(e)}hasAttribute(e){return this.attributes.has(e)}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return k(this.childrenList,e,t)}attachShadow(e){return this.shadowRoot=new ve(this,e),this.shadowRoot}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return O(this.childrenList,e,t),t}addEventListener(e,t){let n=this.eventListeners??=new Map,r=n.get(e)||new Set;r.add(t),n.set(e,r)}removeEventListener(e,t){let n=this.eventListeners?.get(e);n&&(n.delete(t),n.size===0&&this.eventListeners?.delete(e))}dispatchEvent(e){let t=this.eventListeners?.get(e.type);if(!t||t.size===0)return!0;for(let n of t)typeof n==`function`?n.call(this,e):n.handleEvent(e);return!e.defaultPrevented}serialize(e){typeof this._preSerialize==`function`&&this._preSerialize();let t=e||this._ssrTag||this.tagName;this.shadowRoot&&!this.hasAttribute(`data-ran-dsd`)&&this.setAttribute(`data-ran-dsd`,``);let n=Array.from(this.attributes.entries()).map(([e,t])=>` ${e}="${ue(t)}"`).join(``),r=this._inlineStyles?Array.from(this._inlineStyles.entries()).map(([e,t])=>`${e}:${t}`).join(`;`):``,i=r?` style="${ue(r)}"`:``,a=``;return this.shadowRoot&&(a+=this.shadowRoot.serialize()),this.textContent===null?this._innerHTML?a+=this._innerHTML:a+=this.childrenList.map(e=>typeof e==`string`?s(e):(e instanceof A,e.serialize())).join(``):a+=s(this.textContent),[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(t)&&!a?`<${t}${n}${i} />`:`<${t}${n}${i}>${a}</${t}>`}},ve=class{host;options;childrenList=[];adoptedStyleSheets=[];constructor(e,t){this.host=e,this.options=t}get children(){return this.childrenList.filter(e=>typeof e!=`string`&&!(e instanceof A))}appendChild(e){return this.childrenList.push(e),e}insertBefore(e,t){return k(this.childrenList,e,t)}replaceChildren(...e){this.childrenList=e.filter(e=>e!=null)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return O(this.childrenList,e,t),t}serialize(){return`<template shadowrootmode="${this.options.mode}"${this.options.delegatesFocus?` shadowrootdelegatesfocus`:``}>${this.adoptedStyleSheets.map(e=>`<style>${String(e).replace(/<\/style/gi,`<\\/style`)}</style>`).join(``)}${this.childrenList.map(e=>typeof e==`string`?s(e):(e instanceof A,e.serialize())).join(``)}</template>`}},j={bind(e,t){t(typeof e==`function`?e():e)},append(e,t){for(let r of t){if(r==null)continue;if(Array.isArray(r)){j.append(e,r);continue}if(typeof r==`function`){j.append(e,[r()]);continue}if(typeof r==`object`&&(`__ranFor`in r||`__ranIndex`in r))throw TypeError(`Import For and Index from the static entry when using static builders`);let t=r instanceof M?r.build():typeof r==`string`&&!n?document.createTextNode(r):r;e.appendChild(t)}}},ye=`http://www.w3.org/2000/svg`,be=new Set(`svg.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComposite.feDropShadow.feFlood.feGaussianBlur.feMerge.feMergeNode.feOffset.filter.foreignObject.g.image.line.linearGradient.marker.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.switch.symbol.text.textPath.tspan.use`.split(`.`)),M=class{runtime;el;constructor(e,t,r=j){this.runtime=r;let i=t??(be.has(e)?`http://www.w3.org/2000/svg`:void 0);this.el=n?new _e(e):i?document.createElementNS(i,e):document.createElement(e)}id(e){return this.el.setAttribute(`id`,e),this}bind(e,t){this.runtime.bind(e,t)}class(e){return this.bind(e,e=>{n?this.el.attributes.set(`class`,e):this.el.setAttribute(`class`,e)}),this}addClass(...e){return e.forEach(e=>this.el.classList.add(e)),this}removeClass(...e){return e.forEach(e=>this.el.classList.remove(e)),this}attr(e,t){return this.bind(t,t=>this.el.setAttribute(e,t)),this}attrs(e){return Object.entries(e).forEach(([e,t])=>{t!=null&&this.el.setAttribute(e,String(t))}),this}boolAttr(e,t,n=``){return this.bind(t,t=>{t?this.el.setAttribute(e,n):this.el.removeAttribute(e)}),this}part(e){return this.attr(`part`,e)}data(e,t){return this.attr(`data-${e}`,t)}style(e,t){return typeof e==`string`?this.bind(t??``,t=>this.el.style.setProperty(e,t)):Object.entries(e).forEach(([e,t])=>this.el.style.setProperty(e,t)),this}cssVar(e,t){let n=e.startsWith(`--`)?e:`--${e}`;return this.style(n,t)}aria(e,t){return this.attr(`aria-${e}`,t)}role(e){return this.attr(`role`,e)}tabIndex(e){return this.attr(`tabindex`,String(e))}label(e){return this.aria(`label`,e)}labelledBy(e){return this.aria(`labelledby`,e)}describedBy(e){return this.aria(`describedby`,e)}ariaHidden(e=!0){return this.aria(`hidden`,String(e))}on(e,t,n){return this.el.addEventListener(e,t,n),this}listen(e,t,n,r){return e.on(this.el,t,n,r),this}delegate(e,t,n,r,i){return e.delegate(this.el,t,n,r,i),this}children(...e){return this.runtime.append(this.el,e),this}replaceChildren(...e){if(n){let e=this.el;e.childrenList=[]}else this.el.replaceChildren();return this.children(...e)}text(e){return this.bind(e,e=>{this.el.textContent=e}),this}unsafeHtml(e){return this.bind(e,e=>{this.el.innerHTML=e}),this}ref(e){return e.current=this.el,this}shadow(e={mode:`closed`}){let t=this.el.attachShadow(e);return new xe(this.el,t,e,this.runtime)}build(){return this.el}serialize(){if(n)return this.el.serialize();let e=document.createElement(`div`);return e.appendChild(this.el.cloneNode(!0)),e.innerHTML}},xe=class{runtime;root;hostEl;constructor(e,t,n,r=j){this.runtime=r,this.hostEl=e,this.root=t}children(...e){return this.runtime.append(this.root,e),this}adoptSheet(...e){return this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,...e],this}css(e){if(n)return this.root.adoptedStyleSheets.push(e),this;if(typeof CSSStyleSheet<`u`)try{let t=new CSSStyleSheet;return t.replaceSync(e),this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,t],this}catch{}let t=document.createElement(`style`);return t.textContent=e,this.root.appendChild(t),this}done(){return{host:this.hostEl,shadow:this.root}}serialize(){return n?this.root.serialize():this.root.innerHTML}},N=()=>({current:null}),P=e=>e.reduce((e,t)=>Array.isArray(t)?e.concat(P(t)):e.concat(t),[]),F=e=>e==null?null:e instanceof M?e.build():typeof e==`string`?n?e:document.createTextNode(e):e,Se=(e,t)=>{if(n){L(e,[t()]);return}let r=document.createComment(``),i=document.createComment(``);e.appendChild(r),e.appendChild(i);let a=null,o=()=>{a?.(),a=null;let e=r.nextSibling;for(;e&&e!==i;){let t=e.nextSibling;e.parentNode?.removeChild(e),e=t}};b(()=>{let e=t();o();let n=document.createDocumentFragment();a=x(t=>(L(n,[e]),t)),i.parentNode?.insertBefore(n,i)}),S(()=>a?.())},Ce=`__ranFor`,we=e=>typeof e==`object`&&!!e&&e[Ce]===!0,Te=(e,t,n)=>{let[r,i]=re(t),a=null,o=x(t=>{let i=F(n(e,r));return a=typeof i==`string`?document.createTextNode(i):i,t});return{node:a,index:i,dispose:o}},I=(e,t)=>{let n=e.parentNode;if(!n)return;let r=e;for(let e of t)r.nextSibling!==e&&n.insertBefore(e,r.nextSibling),r=e},Ee=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=F(t.render(n,()=>r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=new Map;S(()=>{for(let e of i.values())e.dispose();i.clear()}),b(()=>{let e=t.each()??[],n=new Map,a=[];e.forEach((e,r)=>{let o=t.key(e,r);if(n.has(o)){je()&&console.error(`[ranview For] duplicate key "${String(o)}" — keys must be unique; ignoring the duplicate item.`);return}let s=i.get(o);s?(i.delete(o),s.index(r)):s=Te(e,r,t.render),n.set(o,s),s.node&&a.push(s.node)});for(let e of i.values())e.node?.parentNode?.removeChild(e.node),e.dispose();I(r,a),i=n})},De=`__ranIndex`,Oe=e=>typeof e==`object`&&!!e&&e[De]===!0,ke=(e,t,n)=>{let[r,i]=re(e),a=null,o=x(e=>{let i=F(n(r,t));return a=typeof i==`string`?document.createTextNode(i):i,e});return{node:a,setItem:i,dispose:o}},Ae=(e,t)=>{if(n){(t.each()??[]).forEach((n,r)=>{let i=F(t.render(()=>n,r));i!=null&&e.appendChild(i)});return}let r=document.createComment(``);e.appendChild(r);let i=[];S(()=>{for(let e of i)e.dispose();i=[]}),b(()=>{let e=t.each()??[];for(let n=0;n<e.length;n++)n<i.length?i[n].setItem(e[n]):i.push(ke(e[n],n,t.render));for(let t=i.length-1;t>=e.length;t--){let{node:e}=i[t];e?.parentNode?.removeChild(e),i[t].dispose(),i.pop()}I(r,i.map(e=>e.node).filter(e=>e!=null))})},L=(e,t)=>{n?ie(()=>R(e,t)):R(e,t)},R=(e,t)=>{P(t).forEach(t=>{if(we(t)){Ee(e,t);return}if(Oe(t)){Ae(e,t);return}if(typeof t==`function`){Se(e,t);return}let n=F(t);n!=null&&e.appendChild(n)})},je=()=>!1,Me={bind(e,t){typeof e==`function`?n?ie(()=>t(e())):b(()=>t(e())):t(e)},append:L},Ne=class extends M{constructor(e,t){super(e,t,Me)}};function Pe(e){let t=t=>new e(t);return{View:t,Div:()=>t(`div`),Svg:t=>new e(t,ye),Span:()=>t(`span`),Slot:()=>t(`slot`),ButtonBuilder:()=>t(`button`),InputBuilder:()=>t(`input`),Style:()=>t(`style`),Label:()=>t(`label`),Ul:()=>t(`ul`),Li:()=>t(`li`),Section:()=>t(`section`),Article:()=>t(`article`),Nav:()=>t(`nav`),Header:()=>t(`header`),Footer:()=>t(`footer`),Main:()=>t(`main`),DeclarativeShadow:(e=`open`,n=!1)=>{let r=t(`template`);return r.attr(`shadowrootmode`,e),n&&r.attr(`shadowrootdelegatesfocus`,``),r}}}var{View:z,Div:Fe,Svg:Ie,Span:Le,Slot:Re,ButtonBuilder:ze,InputBuilder:Be,Style:Ve,Label:He,Ul:Ue,Li:We,Section:Ge,Article:Ke,Nav:qe,Header:Je,Footer:Ye,Main:Xe,DeclarativeShadow:Ze}=Pe(Ne),Qe=new Map;function $e(e,t){n?(Qe.set(e,t),t.prototype._ssrTag=e):customElements.get(e)||customElements.define(e,t)}var et=typeof document<`u`?HTMLElement:_e,tt=`data-ranui`,B=`data-ranui-sheet`,V=(e,t)=>{if(typeof document>`u`&&t){let n=e.adoptedStyleSheets;Array.isArray(n)&&!n.includes(t)&&n.push(t)}d(e,t,tt)},H=new WeakMap,U=new Map,nt=e=>{if(typeof CSSStyleSheet>`u`)return;let t=U.get(e);if(!t)try{let n=new CSSStyleSheet;n.replaceSync(e),t={sheet:n,users:0},U.set(e,t)}catch{return}return t.users++,t.sheet},W=e=>{let t=U.get(e);t&&--t.users===0&&U.delete(e)},rt=(e,t)=>{if(typeof document>`u`)return;let n=H.get(e);if((n?.text??``)===t||(n?.sheet?(e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n.sheet),W(n.text)):n&&e.querySelector(`style[${B}]`)?.remove(),H.delete(e),!t))return;let r=nt(t);if(r)try{e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]}catch{W(t),r=void 0}if(!r){let n=document.createElement(`style`);n.setAttribute(B,``),n.textContent=t,e.appendChild(n)}H.set(e,{text:t,sheet:r})},G=new WeakMap,K=new WeakMap,it=`@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}`,at=`:host([hidden]){display:none}`,q=new Map,J=e=>{let t=q.get(e);if(t!==void 0)return t;let n=`${at}\n${it}`,r=e?`${e}\n${n}`:n;return q.set(e,r),r},ot=e=>{let t=K.get(e);if(t)return t;try{let t=e.attachInternals;if(typeof t!=`function`)return;let n=t.call(e);return K.set(e,n),n}catch{return}},st=(e,t=``,n={mode:`closed`},r)=>{let i=r??ot(e),a=e.shadowRoot||G.get(e)||i?.shadowRoot||e.attachShadow(n);return G.set(e,a),V(a,J(t)),a},ct=(e,t,...n)=>{e.replaceChildren(...n),V(e,J(t))},lt=(e,t)=>{if(e.current===null)throw Error(`ranui: ${t} is missing its .ref() on the builder`);return e.current},Y=(e,t,n=``)=>e.getAttribute(t)??n,X=(e,t,n,r={})=>{r.removeEmpty&&!n?e.removeAttribute(t):e.setAttribute(t,n??``)},ut=(e,t,n,r,i)=>{n===`sheet`&&r!==i&&rt(t,e.getAttribute(`sheet`)||``)},dt=e=>e,ft=e=>{let t=e;for(;t;){let e=t.closest?.(`[lang]`)?.getAttribute(`lang`);if(e)return e;t=t.getRootNode?.()?.host}return``},pt=e=>{let t=(ne()?.getLocale()||ft(e)||(typeof document<`u`?document.documentElement.lang:``)||`en`).toLowerCase();return/^zh[-_](hant|tw|hk|mo)\b/.test(t)?`en`:t.split(/[-_]/)[0]},mt=(e,t)=>t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e,Z=(e,t,n,r)=>{let i=ne(),a=`ranui.${t}`;if(i){let e=i.getMessages(i.getLocale())[a];if(e!==void 0)return mt(e,r)}return mt(e[pt(n)]?.[t]??e.en[t],r)},Q=dt({en:{"voiceButton.cancelHint":`Release to cancel`,"voiceButton.holdHint":`Release to keep · slide up to cancel`,"voiceButton.start":`Start voice input`,"voiceButton.stop":`Stop voice input`},zh:{"voiceButton.cancelHint":`松开取消`,"voiceButton.holdHint":`松开保留 · 上滑取消`,"voiceButton.start":`开始语音输入`,"voiceButton.stop":`停止语音输入`},ja:{"voiceButton.cancelHint":`指を離すとキャンセル`,"voiceButton.holdHint":`指を離すと確定 · 上にスライドでキャンセル`,"voiceButton.start":`音声入力を開始`,"voiceButton.stop":`音声入力を停止`},ko:{"voiceButton.cancelHint":`손을 떼면 취소`,"voiceButton.holdHint":`손을 떼면 유지 · 위로 밀어서 취소`,"voiceButton.start":`음성 입력 시작`,"voiceButton.stop":`음성 입력 중지`},es:{"voiceButton.cancelHint":`Suelta para cancelar`,"voiceButton.holdHint":`Suelta para conservar · desliza hacia arriba para cancelar`,"voiceButton.start":`Iniciar entrada de voz`,"voiceButton.stop":`Detener entrada de voz`},pt:{"voiceButton.cancelHint":`Solte para cancelar`,"voiceButton.holdHint":`Solte para manter · deslize para cima para cancelar`,"voiceButton.start":`Iniciar entrada de voz`,"voiceButton.stop":`Parar entrada de voz`},de:{"voiceButton.cancelHint":`Zum Abbrechen loslassen`,"voiceButton.holdHint":`Zum Behalten loslassen · zum Abbrechen nach oben wischen`,"voiceButton.start":`Spracheingabe starten`,"voiceButton.stop":`Spracheingabe beenden`},fa:{"voiceButton.cancelHint":`برای لغو رها کنید`,"voiceButton.holdHint":`برای نگه‌داشتن رها کنید · برای لغو به بالا بکشید`,"voiceButton.start":`شروع ورودی صوتی`,"voiceButton.stop":`توقف ورودی صوتی`}}),$=class e extends et{_events=new c;_shadowDom;_button;_icon;_hint;_recognizer=null;_holdPointer=null;_holdOrigin=0;static get observedAttributes(){return[`disabled`,`label`,`active-label`,`hold-hint`,`cancel-hint`,`listening`,`holding`,`cancelling`,`sheet`]}constructor(){super(),this._shadowDom=st(this,t);let e=N(),n=N(),r=ze().class(`ran-voice`).attr(`part`,`button`).attr(`type`,`button`).attr(`aria-pressed`,`false`).children(z(`r-icon`).ref(e).attr(`name`,`mic`).attr(`part`,`icon`).build(),z(`span`).class(`ran-voice-hint`).ref(n).attr(`part`,`hint`).build()).build();ct(this._shadowDom,t,r),this._button=r,this._icon=lt(e,`r icon`),this._hint=lt(n,`hint`)}get listening(){return this.hasAttribute(`listening`)}get supported(){return this._ensureRecognizer().supported}get lang(){return Y(this,`lang`)||document.documentElement.lang||navigator.language}set lang(e){X(this,`lang`,e)}get continuous(){return Y(this,`continuous`,`true`)!==`false`}set continuous(e){X(this,`continuous`,e?`true`:`false`)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get label(){return Y(this,`label`,Z(Q,`voiceButton.start`,this))}set label(e){X(this,`label`,e)}get activeLabel(){return Y(this,`active-label`,Z(Q,`voiceButton.stop`,this))}set activeLabel(e){X(this,`active-label`,e)}get holdHint(){return Y(this,`hold-hint`,Z(Q,`voiceButton.holdHint`,this))}set holdHint(e){X(this,`hold-hint`,e)}get cancelHint(){return Y(this,`cancel-hint`,Z(Q,`voiceButton.cancelHint`,this))}set cancelHint(e){X(this,`cancel-hint`,e)}get sheet(){return Y(this,`sheet`)}set sheet(e){X(this,`sheet`,e)}start(){this.disabled||(this._ensureRecognizer().start(),this._syncButton())}stop(){this._recognizer?.stop()}abort(){this._recognizer?.abort()}toggle(){let e=this._ensureRecognizer();e.active?e.stop():this.start()}connectedCallback(){this.handlerExternalCss(),this._events.on(this._button,`click`,this._onClick),this._events.on(this._button,`pointerdown`,this._onPointerDown),this._events.on(this._button,`pointermove`,this._onPointerMove),this._events.on(this._button,`pointerup`,this._onPointerUp),this._events.on(this._button,`pointercancel`,this._onPointerCancel),this._events.on(this.ownerDocument,`keydown`,this._onKeydown),this._syncButton(),this.supported||(this.hidden=!0)}disconnectedCallback(){this._events.abort(),this._endHold(),this._recognizer?.abort()}attributeChangedCallback(e,t,n){t!==n&&(e===`sheet`?this.handlerExternalCss():this._syncButton())}handlerExternalCss=()=>{ut(this,this._shadowDom,`sheet`,null,this.sheet)};static CANCEL_DISTANCE=48;_onClick=()=>{this._holdPointer===null&&this.toggle()};_onPointerDown=e=>{e.pointerType!==`touch`||this.disabled||this.listening||(e.preventDefault(),this._holdPointer=e.pointerId,this._holdOrigin=e.clientY,this.setAttribute(`holding`,``),this._button.setPointerCapture?.(e.pointerId),this._syncButton(),this.start())};_onPointerMove=t=>{if(t.pointerId!==this._holdPointer)return;let n=this._holdOrigin-t.clientY>e.CANCEL_DISTANCE;n!==this.hasAttribute(`cancelling`)&&(n?this.setAttribute(`cancelling`,``):this.removeAttribute(`cancelling`),this._syncButton())};_onPointerUp=e=>{if(e.pointerId!==this._holdPointer)return;let t=this.hasAttribute(`cancelling`);this._endHold(),t?this.abort():this.stop()};_onPointerCancel=e=>{e.pointerId===this._holdPointer&&(this._endHold(),this.abort())};_endHold(){this._holdPointer!==null&&this._button.releasePointerCapture?.(this._holdPointer),this._holdPointer=null,this.removeAttribute(`holding`),this.removeAttribute(`cancelling`),this._syncButton()}_onKeydown=e=>{e.key!==`Escape`||e.isComposing||e.defaultPrevented||!this._recognizer?.active||(e.stopPropagation(),this.abort())};_emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_ensureRecognizer(){return this._recognizer??=a({lang:()=>this.lang,continuous:this.continuous,onStart:()=>{this.setAttribute(`listening`,``),this._syncButton(),this._emit(`voicestart`)},onResult:(e,t)=>{this._emit(`voiceresult`,{transcript:e,isFinal:t})},onError:e=>{this._emit(`voiceerror`,e)},onEnd:()=>{this.removeAttribute(`listening`),this._syncButton(),this._emit(`voiceend`)}}),this._recognizer}_syncButton(){let e=this._recognizer?.active??!1;this._button.setAttribute(`aria-busy`,String(e&&!this.listening)),this._button.disabled=this.disabled,this._button.setAttribute(`aria-pressed`,e?`true`:`false`),this._button.setAttribute(`aria-label`,e?this.activeLabel:this.label),this._icon.setAttribute(`name`,e?`mic-off`:`mic`),this._hint.textContent=this.hasAttribute(`cancelling`)?this.cancelHint:this.holdHint}};return $e(`r-voice-button`,$),e.VoiceButton=$,e.default=$,e})({});