@pie-players/pie-section-player 1.0.0-beta.0 → 1.0.0-beta.2

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 (25) hide show
  1. package/README.md +16 -3
  2. package/dist/browser/assets/{evaluation-worker-0xRDVTJx.js → evaluation-worker-B336Lsun.js} +48398 -46681
  3. package/dist/browser/chunks/calculator-element-271c142f.js +4 -4
  4. package/dist/browser/chunks/dist-41b39e7f.js +1 -1
  5. package/dist/browser/chunks/dist-ca9b9622.js +1 -1
  6. package/dist/browser/chunks/math-rendering-ready-9a0fd90a.js +1 -1
  7. package/dist/browser/chunks/mathjax-BKrHE4xs-3ca05bf6.js +1 -1
  8. package/dist/browser/chunks/{runtime-YFqnU6ic-d5c0cb49.js → runtime-BCz9m_IT-7b48a036.js} +305 -292
  9. package/dist/browser/chunks/tool-annotation-toolbar-997438b4.js +5 -5
  10. package/dist/browser/chunks/tool-answer-eliminator-35483abd.js +5 -5
  11. package/dist/browser/chunks/tool-color-scheme-b7de5cdf.js +5 -5
  12. package/dist/browser/chunks/tool-dictionary-cecff3b4.js +3 -3
  13. package/dist/browser/chunks/tool-graph-cb0338e8.js +4 -4
  14. package/dist/browser/chunks/tool-line-reader-f8ef3c6a.js +3 -3
  15. package/dist/browser/chunks/tool-periodic-table-43b133b8.js +4 -4
  16. package/dist/browser/chunks/tool-picture-dictionary-33721e91.js +3 -3
  17. package/dist/browser/chunks/tool-protractor-23f77028.js +6 -6
  18. package/dist/browser/chunks/tool-ruler-1d9a03a6.js +6 -6
  19. package/dist/browser/chunks/tool-tts-inline-98c2ce7a.js +4 -4
  20. package/dist/browser/chunks/versioned-tag-54a76be9.js +1 -1
  21. package/dist/browser/pie-section-player.js +57 -44
  22. package/dist/components/shared/card-title.d.ts +18 -0
  23. package/dist/contracts/card-title-formatters.d.ts +8 -1
  24. package/dist/pie-section-player.js +10123 -9887
  25. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import{t as dt}from"./defineProperty-a20a667d.js";import{t as ha}from"./attribute-coercion-b93b482c.js";import{i as fa,n as da,r as va}from"./tool-host-contract-fae1c415.js";import{t as pa}from"./sanitize-svg-icon-b9082bba.js";import{i as ga}from"./provider-4c704118.js";import{a as ma,c as nn,d as ba,i as wa,l as Tr,n as ya,o as ka,r as ur,s as Sa,u as wt}from"./catalog-context-46d3e50e.js";var hr=" >>> ",xa=class{serialize(t,e){return{startContainer:this.getNodePath(t.startContainer,e),startOffset:t.startOffset,endContainer:this.getNodePath(t.endContainer,e),endOffset:t.endOffset,text:t.toString()}}deserialize(t,e){const n=this.findNodeByPath(t.startContainer,e),r=this.findNodeByPath(t.endContainer,e);if(!n||!r)return null;try{const o=new Range;return o.setStart(n,t.startOffset),o.setEnd(r,t.endOffset),o.toString()===t.text?o:null}catch(o){return console.warn("Failed to deserialize range:",o),null}}getNodePath(t,e){if(t===e)return"";if(t.nodeType===Node.TEXT_NODE){const n=t.parentNode;if(!n)throw new Error("Text node has no parent");const r=Array.from(n.childNodes).filter(o=>o.nodeType===Node.TEXT_NODE).indexOf(t);return`${wt(n)?this.getShadowRootPath(n,e):this.getElementPath(n,e)}::text[${r}]`}if(t.nodeType===Node.ELEMENT_NODE)return this.getElementPath(t,e);if(wt(t))return this.getShadowRootPath(t,e);throw new Error(`Unsupported node type: ${t.nodeType}`)}getElementPath(t,e){if(t===e)return"";const n=e.getRootNode?.(),r=[];let o=[],i=t;const a=l=>{r.unshift(o.join(" > ")),o=[],i=l.host};for(;i&&i!==e;){if(i.id){o.unshift(`#${i.id}`);const b=i.getRootNode?.();if(wt(b)&&b!==n){a(b);continue}break}const l=i.parentElement,h=i.parentNode,u=l??(wt(h)?h:null);if(!u)break;const f=i.tagName,d=Array.from(u.children).filter(b=>b.tagName===f),p=d.indexOf(i),g=d.length>1?`${f.toLowerCase()}:nth-of-type(${p+1})`:f.toLowerCase();o.unshift(g),l?i=l:a(u)}return r.unshift(o.join(" > ")),r.join(hr)}getShadowRootPath(t,e){return`${this.getElementPath(t.host,e)}${hr}`}resolveElementPath(t,e){let n=e;const r=t.split(hr);for(let o=0;o<r.length;o++){if(o>0){const l=wt(n)?null:n.shadowRoot;if(!l)return null;n=l}const i=r[o].trim();if(!i)continue;const a=n.querySelector(i);if(!a)return null;n=a}return n}findNodeByPath(t,e){if(t==="")return e;if(t.includes("::text[")){const n=t.lastIndexOf("::text["),r=t.slice(0,n),o=t.slice(n+7),i=Number.parseInt(o.replace("]",""),10);let a;try{a=this.resolveElementPath(r,e)}catch(l){return console.warn("Invalid selector path:",t,l),null}return a&&Array.from(a.childNodes).filter(l=>l.nodeType===Node.TEXT_NODE)[i]||null}try{return this.resolveElementPath(t,e)}catch(n){return console.warn("Invalid selector path:",t,n),null}}},_r;(function(t){t.TTS_WORD="tts-word",t.TTS_SENTENCE="tts-sentence",t.ANNOTATION="annotation"})(_r||(_r={}));var Ot;(function(t){t.YELLOW="yellow",t.GREEN="green",t.BLUE="blue",t.PINK="pink",t.ORANGE="orange",t.UNDERLINE="underline"})(Ot||(Ot={}));var Bo=`
1
+ import{t as dt}from"./defineProperty-a20a667d.js";import{t as fa}from"./attribute-coercion-b93b482c.js";import{i as da,n as va,r as pa}from"./tool-host-contract-fae1c415.js";import{t as ga}from"./sanitize-svg-icon-b9082bba.js";import{i as ma}from"./provider-4c704118.js";import{a as ba,c as on,d as ya,i as wa,l as Er,n as ka,o as Sa,r as fr,s as xa,u as yt}from"./catalog-context-46d3e50e.js";var dr=" >>> ",$a=class{serialize(t,e){return{startContainer:this.getNodePath(t.startContainer,e),startOffset:t.startOffset,endContainer:this.getNodePath(t.endContainer,e),endOffset:t.endOffset,text:t.toString()}}deserialize(t,e){const n=this.findNodeByPath(t.startContainer,e),r=this.findNodeByPath(t.endContainer,e);if(!n||!r)return null;try{const o=new Range;return o.setStart(n,t.startOffset),o.setEnd(r,t.endOffset),o.toString()===t.text?o:null}catch(o){return console.warn("Failed to deserialize range:",o),null}}getNodePath(t,e){if(t===e)return"";if(t.nodeType===Node.TEXT_NODE){const n=t.parentNode;if(!n)throw new Error("Text node has no parent");const r=Array.from(n.childNodes).filter(o=>o.nodeType===Node.TEXT_NODE).indexOf(t);return`${yt(n)?this.getShadowRootPath(n,e):this.getElementPath(n,e)}::text[${r}]`}if(t.nodeType===Node.ELEMENT_NODE)return this.getElementPath(t,e);if(yt(t))return this.getShadowRootPath(t,e);throw new Error(`Unsupported node type: ${t.nodeType}`)}getElementPath(t,e){if(t===e)return"";const n=e.getRootNode?.(),r=[];let o=[],i=t;const a=l=>{r.unshift(o.join(" > ")),o=[],i=l.host};for(;i&&i!==e;){if(i.id){o.unshift(`#${i.id}`);const b=i.getRootNode?.();if(yt(b)&&b!==n){a(b);continue}break}const l=i.parentElement,h=i.parentNode,u=l??(yt(h)?h:null);if(!u)break;const f=i.tagName,d=Array.from(u.children).filter(b=>b.tagName===f),p=d.indexOf(i),m=d.length>1?`${f.toLowerCase()}:nth-of-type(${p+1})`:f.toLowerCase();o.unshift(m),l?i=l:a(u)}return r.unshift(o.join(" > ")),r.join(dr)}getShadowRootPath(t,e){return`${this.getElementPath(t.host,e)}${dr}`}resolveElementPath(t,e){let n=e;const r=t.split(dr);for(let o=0;o<r.length;o++){if(o>0){const l=yt(n)?null:n.shadowRoot;if(!l)return null;n=l}const i=r[o].trim();if(!i)continue;const a=n.querySelector(i);if(!a)return null;n=a}return n}findNodeByPath(t,e){if(t==="")return e;if(t.includes("::text[")){const n=t.lastIndexOf("::text["),r=t.slice(0,n),o=t.slice(n+7),i=Number.parseInt(o.replace("]",""),10);let a;try{a=this.resolveElementPath(r,e)}catch(l){return console.warn("Invalid selector path:",t,l),null}return a&&Array.from(a.childNodes).filter(l=>l.nodeType===Node.TEXT_NODE)[i]||null}try{return this.resolveElementPath(t,e)}catch(n){return console.warn("Invalid selector path:",t,n),null}}},Ar;(function(t){t.TTS_WORD="tts-word",t.TTS_SENTENCE="tts-sentence",t.ANNOTATION="annotation"})(Ar||(Ar={}));var Ot;(function(t){t.YELLOW="yellow",t.GREEN="green",t.BLUE="blue",t.PINK="pink",t.ORANGE="orange",t.UNDERLINE="underline"})(Ot||(Ot={}));var zo=`
2
2
  /* TTS highlights - temporary */
3
3
  ::highlight(tts-word) {
4
4
  background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));
@@ -208,9 +208,9 @@ import{t as dt}from"./defineProperty-a20a667d.js";import{t as ha}from"./attribut
208
208
  text-shadow: none;
209
209
  }
210
210
  }
211
- `,vo=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet"),po=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet-adopted"),go=t=>!!t&&typeof t.replaceSync=="function",$a=()=>{const t=globalThis,e=t[vo];if(go(e))return e;const n=globalThis.CSSStyleSheet;if(typeof n!="function")return null;try{const r=new n;return go(r)?(r.replaceSync(Bo),t[vo]=r,r):null}catch{return null}},je=t=>{const e=t?.getRootNode?.();if(!wt(e))return;const n=e,r=n.adoptedStyleSheets;if(!r||typeof r!="object")return;const o=Array.from(r),i=n[po];if(i&&o.includes(i))return;const a=$a();if(a)try{n.adoptedStyleSheets=[...o,a],n[po]=a}catch{}},fr="tts-word",dr="tts-sentence",xe=t=>`annotation-${t}`,ie=t=>{const e=CSS.highlights.get(t);if(e)return e;const n=new Highlight;return CSS.highlights.set(t,n),n},Be=(t,e)=>{const n=CSS.highlights.get(t);if(n)for(const r of e)n.delete(r)},mo=t=>{const e=t[0]?.startContainer;return e?e.nodeType===Node.ELEMENT_NODE?e:Tr(e):null},Vt={source:null,override:null},zo=class Er{constructor(){if(dt(this,"ttsWordRanges",new Set),dt(this,"ttsSentenceRanges",new Set),dt(this,"ttsWordElementHighlights",new Set),dt(this,"ttsSentenceElementHighlights",new Set),dt(this,"annotations",new Map),dt(this,"ttsStyleSource",null),dt(this,"nextAnnotationId",1),dt(this,"supported",!1),dt(this,"rangeSerializer",void 0),dt(this,"themeObserver",null),this.rangeSerializer=new xa,typeof CSS>"u"||!("highlights"in CSS)){console.warn("CSS Custom Highlight API not supported (SSR or unsupported browser)");return}this.supported=!0,this.initializeHighlights(),this.registerStyles(),this.applyAdaptiveTTSStyle(),this.setupThemeObservation()}setupThemeObservation(){if(typeof document>"u"||typeof MutationObserver>"u")return;const e=document.getElementsByTagName("pie-theme"),n=new WeakSet,r=()=>{let i=!1;for(const a of e)n.has(a)||(n.add(a),o.observe(a,{attributes:!0,attributeFilter:["theme","scheme","provider","variables","style","data-theme","data-color-scheme"]}),i=!0);return i},o=new MutationObserver(i=>{(r()||i.some(a=>a.type==="attributes"))&&this.applyAdaptiveTTSStyle()});this.themeObserver=o,o.observe(document.documentElement,{attributes:!0,attributeFilter:["style","data-theme","data-color-scheme","class"]}),o.observe(document,{childList:!0,subtree:!0}),r()}parseColor(e){if(!e)return null;const n=e.trim();if(!n)return null;const r=/^#([a-f\d]{3}|[a-f\d]{6})$/i.exec(n);if(r){const i=r[1];return i.length===3?[parseInt(i[0]+i[0],16),parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16)]:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}const o=/^rgba?\((.+)\)$/i.exec(n);if(o){const i=o[1].replace(/\//g,",").split(/[,\s]+/).map(u=>u.trim()).filter(Boolean),a=Number(i[0]),l=Number(i[1]),h=Number(i[2]);if(Number.isFinite(a)&&Number.isFinite(l)&&Number.isFinite(h))return[a,l,h]}if(typeof document<"u"){const i=document.createElement("span");if(i.style.color=n,typeof i.style.color=="string"&&i.style.color){document.body?.appendChild(i);const a=typeof getComputedStyle=="function"?getComputedStyle(i).color:"";i.remove();const l=a.trim();if(l&&l!==n)return this.parseColor(a)}}return null}relativeLuminance([e,n,r]){const o=h=>{const u=h/255;return u<=.03928?u/12.92:((u+.055)/1.055)**2.4},i=o(e),a=o(n),l=o(r);return .2126*i+.7152*a+.0722*l}contrastRatio(e,n){const r=this.relativeLuminance(e),o=this.relativeLuminance(n),i=Math.max(r,o),a=Math.min(r,o);return(i+.05)/(a+.05)}blend(e,n,r){return[Math.round(e[0]*r+n[0]*(1-r)),Math.round(e[1]*r+n[1]*(1-r)),Math.round(e[2]*r+n[2]*(1-r))]}resolveAdaptiveTTSStyle(e){const n=[255,235,59],r=[17,24,39],o=[255,255,255],i=e||(typeof document<"u"?document.documentElement:null),a=i&&typeof getComputedStyle=="function"?getComputedStyle(i):null,l=this.parseColor(a?.getPropertyValue("--pie-background")||a?.backgroundColor)||o,h=this.parseColor(a?.getPropertyValue("--pie-text"))||r,u=Vt.override,f=u?this.parseColor(u.color)||n:this.parseColor(a?.getPropertyValue("--pie-missing"))||n,d=u?[Math.max(.3,Math.min(.95,u.opacity))]:[.8,.72,.68,.62,.56,.5];let p=d[d.length-1],g=-1/0;for(const H of d){const D=this.blend(f,l,H),K=this.contrastRatio(D,l),G=this.contrastRatio(D,h),J=K*1.2+G*.8;if(K>=1.25&&G>=2.4){p=H;break}J>g&&(g=J,p=H)}const b=Math.max(.24,Math.min(.85,p*.55)),$=Math.max(.55,Math.min(.95,p+.2)),m=Math.max(.22,Math.min(.6,p*.45)),y=h,P=this.blend(y,l,$),k=this.contrastRatio(P,l),T=this.relativeLuminance(l)>.45?[0,0,0]:[255,255,255],I=k>=1.35?y:T;return{wordHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${p})`,sentenceHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${b})`,wordUnderline:`rgba(${I[0]}, ${I[1]}, ${I[2]}, ${$})`,wordShadow:`rgba(${I[0]}, ${I[1]}, ${I[2]}, ${m})`}}applyAdaptiveTTSStyle(e){if(typeof document>"u")return;e&&(this.ttsStyleSource=e,Vt.source=e);const n=e??(Vt.source?.isConnected?Vt.source:null),r=this.resolveAdaptiveTTSStyle(n),o=document.documentElement.style,i=[["--pie-tts-word-highlight",r.wordHighlight],["--pie-tts-sentence-highlight",r.sentenceHighlight],["--pie-tts-line-highlight",r.sentenceHighlight],["--pie-tts-word-underline",r.wordUnderline],["--pie-tts-word-shadow",r.wordShadow]];for(const[a,l]of i)o.getPropertyValue?.(a)!==l&&o.setProperty(a,l)}initializeHighlights(){if(this.supported){ie(fr),ie(dr);for(const e of Object.values(Ot))ie(xe(e))}}registerStyles(){if(!this.supported||typeof document>"u"||document.getElementById("pie-highlight-styles"))return;const e=document.createElement("style");e.id="pie-highlight-styles",e.textContent=Bo,document.head.appendChild(e)}highlightTTSWord(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(mo(e)),this.clearTTSWord();const n=ie(fr);for(const r of e)je(r.startContainer),n.add(r),this.ttsWordRanges.add(r);this.highlightTTSWordElementFallbacks(e.filter(r=>r.startContainer!==r.endContainer||r.startContainer.nodeType!==Node.TEXT_NODE))}highlightTTSWordElement(e){this.supported&&(this.applyAdaptiveTTSStyle(e),je(e),this.clearTTSWord(),e.setAttribute("data-pie-tts-word-element","true"),this.ttsWordElementHighlights.add(e))}highlightTTSSentence(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(mo(e)),this.clearTTSSentence();const n=ie(dr);for(const r of e)je(r.startContainer),n.add(r),this.ttsSentenceRanges.add(r);this.highlightTTSElementFallbacks(e)}highlightTTSSentenceElements(e){if(this.supported){this.applyAdaptiveTTSStyle(e[0]||null),this.clearTTSSentence();for(const n of e)je(n),n.setAttribute("data-pie-tts-sentence-element","true"),this.ttsSentenceElementHighlights.add(n)}}highlightTTSElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-sentence-element",this.ttsSentenceElementHighlights,Er.SENTENCE_FALLBACK_SELECTOR)}highlightTTSWordElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-word-element",this.ttsWordElementHighlights,Er.WORD_FALLBACK_SELECTOR)}highlightElementFallbacks(e,n,r,o){const i=a=>a.nodeType===Node.ELEMENT_NODE?a:Tr(a);for(const a of e){const l=a.commonAncestorContainer,h=wt(l)?l:i(l);if(!h)continue;const u=[],f=i(a.startContainer),d=i(a.endContainer);for(const p of[f,d]){let g=p;for(;g;)g.matches?.(o)&&u.push(g),g=Tr(g)}!wt(h)&&h.matches?.(o)&&u.push(h),u.push(...Array.from(h.querySelectorAll(o)));for(const p of new Set(u)){try{if(!a.intersectsNode(p)&&!nn(p,f)&&!nn(p,d))continue}catch{continue}p.setAttribute(n,"true"),r.add(p)}}}clearTTSWord(){if(this.supported){Be(fr,this.ttsWordRanges),this.ttsWordRanges.clear();for(const e of this.ttsWordElementHighlights)e.removeAttribute("data-pie-tts-word-element");this.ttsWordElementHighlights.clear()}}clearTTSSentence(){if(this.supported){Be(dr,this.ttsSentenceRanges),this.ttsSentenceRanges.clear();for(const e of this.ttsSentenceElementHighlights)e.removeAttribute("data-pie-tts-sentence-element");this.ttsSentenceElementHighlights.clear()}}clearTTS(){this.clearTTSWord(),this.clearTTSSentence(),Vt.source===this.ttsStyleSource&&(Vt.source=null),this.ttsStyleSource=null}addAnnotation(e,n=Ot.YELLOW){const r=`annotation-${this.nextAnnotationId++}`,o=e.cloneRange();je(o.startContainer);const i={id:r,range:o,type:_r.ANNOTATION,color:n,timestamp:Date.now()};return this.annotations.set(r,i),this.supported&&ie(xe(n)).add(o),r}removeAnnotation(e){const n=this.annotations.get(e);if(!n){console.warn(`[HighlightCoordinator] Annotation ${e} not found`);return}this.supported&&Be(xe(n.color),[n.range]),this.annotations.delete(e)}clearAnnotations(){if(this.supported)for(const e of this.annotations.values())Be(xe(e.color),[e.range]);this.annotations.clear()}getAnnotations(){return Array.from(this.annotations.values())}getAnnotation(e){return this.annotations.get(e)??null}changeAnnotationColor(e,n){const r=this.annotations.get(e);if(!r)return;const o=r.color;o!==n&&(r.color=n,this.supported&&(Be(xe(o),[r.range]),ie(xe(n)).add(r.range)))}exportAnnotations(e=document.body){return this.getAnnotations().map(n=>({...this.rangeSerializer.serialize(n.range,e),id:n.id,color:n.color,timestamp:n.timestamp}))}importAnnotations(e,n=document.body){let r=0;for(const o of e){const i=this.rangeSerializer.deserialize(o,n);i&&(this.addAnnotation(i,o.color),r++)}return r}clearAll(){this.supported&&(this.clearTTS(),this.clearAnnotations())}updateTTSHighlightStyle(e,n){if(!this.supported||typeof document>"u"||!document.getElementById("pie-highlight-styles"))return;const o=(i=>{const a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null})(e);o&&(Vt.override={color:`rgb(${o.r}, ${o.g}, ${o.b})`,opacity:Math.max(.2,Math.min(.95,n)),owner:this},this.applyAdaptiveTTSStyle())}destroy(){this.supported&&(this.clearTTS(),this.clearAnnotations(),Vt.override?.owner===this&&(Vt.override=null),this.themeObserver?.disconnect(),this.themeObserver=null)}};dt(zo,"SENTENCE_FALLBACK_SELECTOR","math, mjx-container, svg, img, canvas, [role='img']");dt(zo,"WORD_FALLBACK_SELECTOR","svg, img, canvas, [role='img']");if(typeof window<"u"){var bo,wo;((bo=(wo=window).__svelte??(wo.__svelte={})).v??(bo.v=new Set)).add("5")}var be={},z=Symbol("uninitialized"),Ta="http://www.w3.org/2000/svg",_a="http://www.w3.org/1998/Math/MathML",Uo=Array.isArray,Ea=Array.prototype.indexOf,Ar=Array.prototype.includes,Xn=Array.from,In=Object.keys,rn=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,Aa=Object.getOwnPropertyDescriptors,Ca=Object.prototype,Na=Array.prototype,Ko=Object.getPrototypeOf,yo=Object.isExtensible,Ma=()=>{};function Ra(t){for(var e=0;e<t.length;e++)t[e]()}function Go(){var t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function on(t){"@babel/helpers - typeof";return on=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},on(t)}function Oa(t,e){if(on(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(on(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function La(t){var e=Oa(t,"string");return on(e)=="symbol"?e:e+""}function W(t,e,n){return(e=La(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pt=1024,Tt=2048,ye=4096,zr=8192,Wa=16384,Ur=32768,ko=1<<25,Kr=65536,Pe=1<<19,Pa=1<<20,Ye=1<<25,So=1<<21,Ia=1<<22,Hn=1<<23,Qe=Symbol("$state"),Jo=Symbol("component"),Xo=Symbol("legacy props"),Ha=Symbol(""),Cr=Symbol("attributes"),Nr=Symbol("class"),Mr=Symbol("style"),On=Symbol("text"),un=new class extends Error{constructor(...t){super(...t),W(this,"name","StaleReactionError"),W(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},qa=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Da(){console.warn("https://svelte.dev/e/derived_inert")}function hn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function Fa(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var C=!1;function zt(t){C=t}var M;function Y(t){if(t===null)throw hn(),be;return M=t}function Me(){return Y(_t(M))}function Ge(t){if(C){if(_t(M)!==null)throw hn(),be;M=t}}function Va(t=1){if(C){for(var e=t,n=M;e--;)n=_t(n);M=n}}function qn(t=!0){for(var e=0,n=M;;){if(n.nodeType===8){var r=n.data;if(r==="]"){if(e===0)return n;e-=1}else(r==="["||r==="[!"||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(e+=1)}var o=_t(n);t&&n.remove(),n=o}}function Zo(t){if(!t||t.nodeType!==8)throw hn(),be;return t.data}function Yo(t){return t===this.v}function ja(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Qo(t){return!ja(t,this.v)}function Ba(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function za(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ua(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ka(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ga(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Ja(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Xa(){throw new Error("https://svelte.dev/e/hydration_failed")}function Za(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ya(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Qa(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ts(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function es(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var fn=!1,Zn=!1,V=null;function Re(t){V=t}function ti(t,e=!1,n){V={p:V,i:!1,c:null,e:null,s:t,x:null,r:E,l:Zn&&!e?{s:null,u:null,$:[]}:null}}function ei(t){var e=V,n=e.e;if(n!==null){e.e=null;for(var r of n)Si(r)}return t!==void 0&&(e.x=t),e.i=!0,V=e.p,Gr(t)}function Gr(t={}){return rn(t,Jo,{value:!0}),t}function dn(){return!Zn||V!==null&&V.l===null}var he=[];function ni(){var t=he;he=[],Ra(t)}function re(t){if(he.length===0&&!tn){var e=he;queueMicrotask(()=>{e===he&&ni()})}he.push(t)}function ns(){for(;he.length>0;)ni()}var rs=~(Tt|ye|pt);function j(t,e){t.f=t.f&rs|e}function Jr(t){(t.f&512)!==0||t.deps===null?j(t,pt):j(t,ye)}function ri(t,e,n){(t.f&2048)!==0?e.add(t):t.f&4096&&n.add(t),j(t,pt)}function Yn(t){var e=N,n=E;mt(null),Ht(null);try{return t()}finally{mt(e),Ht(n)}}function os(t,e,n,r){const o=dn()?an:Xr;var i=t.filter(g=>!g.settled),a=e.map(o);if(n.length===0&&i.length===0){r(a);return}var l=E,h=is(),u=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(g=>g.promise)):null;function f(g){if((l.f&16384)===0){h();try{r([...a,...g])}catch(b){It(b,l)}Dn()}}var d=oi();if(n.length===0){u.then(()=>f([])).finally(d);return}function p(){Promise.all(n.map(g=>as(g))).then(f).catch(g=>It(g,l)).finally(d)}u?u.then(()=>{h(),p(),Dn()}):p()}function is(){var t=E,e=N,n=V,r=A;return function(o=!0){Ht(t),mt(e),Re(n),o&&!(t.f&16384)&&(r?.activate(),r?.apply())}}function Dn(t=!0){Ht(null),mt(null),Re(null),t&&A?.deactivate()}function oi(){var t=E,e=t.b,n=A,r=!!e?.is_rendered();return e?.update_pending_count(1,n),n.increment(r,t),()=>{e?.update_pending_count(-1,n),n.decrement(r,t)}}function an(t){var e=2|Tt;return E!==null&&(E.f|=Pe),{ctx:V,deps:null,effects:null,equals:Yo,f:e,fn:t,reactions:null,rv:0,v:z,wv:0,parent:E,ac:null}}var Je=Symbol("obsolete");function as(t,e,n){let r=E;r===null&&Ba();var o=void 0,i=we(z),a=!N,l=new Set;return Ss(()=>{var h=E,u=Go();o=u.promise;try{Promise.resolve(t()).then(u.resolve,g=>{g!==un&&u.reject(g)}).finally(Dn)}catch(g){u.reject(g),Dn()}var f=A;if(a){if((h.f&32768)!==0)var d=oi();if(r.b?.is_rendered())f.async_deriveds.get(h)?.reject(Je);else for(const g of l.values())g.reject(Je);l.add(u),f.async_deriveds.set(h,u)}const p=(g,b=void 0)=>{d?.(),l.delete(u),b!==Je&&(f.activate(),b?(i.f|=Hn,Le(i,b)):(i.f&8388608&&(i.f^=Hn),Le(i,g)),f.deactivate())};u.promise.then(p,g=>p(null,g||"unknown"))}),ws(()=>{for(const h of l)h.reject(Je)}),new Promise(h=>{function u(f){function d(){f===o?h(i):u(o)}f.then(d,d)}u(o)})}function ht(t){const e=an(t);return Ci(e),e}function Xr(t){const e=an(t);return e.equals=Qo,e}function ss(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)nt(e[n])}}function Zr(t){var e,n=E,r=t.parent;if(!Gt&&r!==null&&t.v!==z&&(r.f&24576)!==0)return Da(),t.v;Ht(r);try{ss(t),e=Oi(t)}finally{Ht(n)}return e}function ii(t){var e=Zr(t);if(!t.equals(e)&&(t.wv=Mi(),(!A?.is_fork||t.deps===null)&&(A!==null?(A.capture(t,e,!0),Or?.capture(t,e,!0)):t.v=e,t.deps===null))){j(t,pt);return}Gt||(et!==null?(Qr()||A?.is_fork)&&et.set(t,e):Jr(t))}function ls(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&Yn(()=>{e.ac.abort(un),e.ac=null}),e.fn!==null&&(e.teardown=Ma),ln(e,0),no(e))}function ai(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&We(e)}function si(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Yr(t,e){si(t,e),e.add(t)}function x(t,e,n){si(t,e),e.set(t,n)}function _(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function S(t,e,n){return t.set(_(t,e),n),n}function c(t,e){return t.get(_(t,e))}var li,Rr=null,$e=null,A=null,Or=null,et=null,Lr=null,tn=!1,vr=!1,sn=null,Fn=null,ci=0,cs=1,Wr=new WeakMap,pe=new WeakMap,Ae=new WeakMap,Vn=new WeakMap,$n=new WeakMap,Te=new WeakMap,ce=new WeakMap,Xe=new WeakMap,Lt=new WeakMap,xo=new WeakMap,Oe=new WeakMap,Ut=new WeakMap,ee=new WeakMap,pr=new WeakMap,Tn=new WeakMap,B=new WeakSet,ke=class ui{constructor(){Yr(this,B),W(this,"id",cs++),x(this,Wr,!1),W(this,"linked",!0),x(this,pe,null),x(this,Ae,null),W(this,"async_deriveds",new Map),W(this,"current",new Map),W(this,"previous",new Map),x(this,Vn,new Set),x(this,$n,new Set),x(this,Te,0),x(this,ce,new Map),x(this,Xe,null),x(this,Lt,[]),x(this,xo,[]),x(this,Oe,new Set),x(this,Ut,new Set),x(this,ee,new Map),x(this,pr,new Set),W(this,"is_fork",!1),x(this,Tn,!1),$e===null?Rr=$e=this:(S(Ae,$e,this),S(pe,this,$e)),$e=this}skip_effect(e){c(ee,this).has(e)||c(ee,this).set(e,{d:[],m:[]}),c(pr,this).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=c(ee,this).get(e);if(r){c(ee,this).delete(e);for(var o of r.d)j(o,Tt),n(o);for(o of r.m)j(o,ye),n(o)}c(pr,this).add(e)}capture(e,n,r=!1){e.v!==z&&!this.previous.has(e)&&this.previous.set(e,e.v),!(e.f&8388608)&&(this.current.set(e,[n,r]),et?.set(e,n)),this.is_fork||(e.v=n)}activate(){A=this}deactivate(){A=null,et=null}flush(){try{vr=!0,A=this,_(B,this,jn).call(this)}finally{ci=0,Lr=null,sn=null,Fn=null,vr=!1,A=null,et=null,Pt.clear()}}discard(){for(const e of c($n,this))e(this);c($n,this).clear();for(const e of this.async_deriveds.values())e.reject(Je);_(B,this,Bn).call(this),c(Xe,this)?.resolve()}register_created_effect(e){c(xo,this).push(e)}increment(e,n){if(S(Te,this,c(Te,this)+1),e){let r=c(ce,this).get(n)??0;c(ce,this).set(n,r+1)}}decrement(e,n){if(S(Te,this,c(Te,this)-1),e){let r=c(ce,this).get(n)??0;r===1?c(ce,this).delete(n):c(ce,this).set(n,r-1)}c(Tn,this)||(S(Tn,this,!0),re(()=>{S(Tn,this,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)c(Oe,this).add(r);for(const r of n)c(Ut,this).add(r);e.clear(),n.clear()}oncommit(e){c(Vn,this).add(e)}ondiscard(e){c($n,this).add(e)}settled(){return(c(Xe,this)??S(Xe,this,Go())).promise}static ensure(){if(A===null){const e=A=new ui;!vr&&!tn&&re(()=>{c(Wr,e)||e.flush()})}return A}apply(){if(!fn||!this.is_fork&&c(pe,this)===null&&c(Ae,this)===null){et=null;return}et=new Map;for(const[n,[r]]of this.current)et.set(n,r);for(let n=Rr;n!==null;n=c(Ae,n))if(!(n===this||n.is_fork)){var e=!1;if(n.id<this.id){for(const[r,[,o]]of n.current)if(!o&&this.current.has(r)){e=!0;break}}if(!e)for(const[r,o]of n.previous)et.has(r)||et.set(r,o)}}schedule(e){if(Lr=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}c(Lt,this).push(e)}};li=ke;function $o(){if(this.is_fork)return!0;for(const n of c(ce,this).keys()){for(var t=n,e=!1;t.parent!==null;){if(c(ee,this).has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}function us(){var t=[];for(const o of c(Lt,this))if(!((o.f&16384)!==0||(o.f&6144)===0)){for(var e=o,n=!1;e.parent!==null;){e=e.parent;var r=e.f;if((r&96)!==0){if((r&1024)===0){n=!0;break}e.f^=pt}}n||t.push(e)}return S(Lt,this,[]),t}function jn(){S(Wr,this,!0);for(const a of c(Oe,this))c(Ut,this).delete(a),j(a,Tt),this.schedule(a);for(const a of c(Ut,this))j(a,ye),this.schedule(a);this.apply();for(var t=sn=[],e=[],n=Fn=[];c(Lt,this).length>0;){ci++>1e3&&(_(B,this,Bn).call(this),vs());for(const a of _(B,this,us).call(this))try{_(B,this,hs).call(this,a,t,e)}catch(l){throw di(a),_(B,this,$o).call(this)||this.discard(),l}}if(A=null,n.length>0){var r=li.ensure();for(const a of n)r.schedule(a)}if(sn=null,Fn=null,_(B,this,$o).call(this)){_(B,this,_n).call(this,e),_(B,this,_n).call(this,t);for(const[a,l]of c(ee,this))fi(a,l);n.length>0&&_(B,A,jn).call(A);return}const o=_(B,this,fs).call(this);if(o){_(B,this,_n).call(this,e),_(B,this,_n).call(this,t),_(B,o,ds).call(o,this);return}c(Oe,this).clear(),c(Ut,this).clear();for(const a of c(Vn,this))a(this);c(Vn,this).clear(),Or=this,To(e),To(t),Or=null,c(Xe,this)?.resolve();var i=A;if(c(Te,this)===0&&(c(Lt,this).length===0||i!==null)&&_(B,this,Bn).call(this),c(Lt,this).length>0)if(i!==null){for(const a of c(Lt,this))c(Lt,i).push(a);S(Lt,this,[])}else i=this;i!==null&&(Pt.clear(),_(B,i,jn).call(i))}function hs(t,e,n){t.f^=pt;for(var r=t.first;r!==null;){var o=r.f,i=(o&96)!==0;if(!(i&&(o&1024)!==0||(o&8192)!==0||c(ee,this).has(r))&&r.fn!==null){i?r.f^=pt:(o&4)!==0?e.push(r):fn&&(o&16777224)!==0?n.push(r):vn(r)&&(o&16&&c(Ut,this).add(r),We(r));var a=r.first;if(a!==null){r=a;continue}}for(;r!==null;){var l=r.next;if(l!==null){r=l;break}r=r.parent}}}function fs(){for(var t=c(pe,this);t!==null;){if(!t.is_fork){for(const[e,[,n]]of this.current)if(t.current.has(e)&&!n)return t}t=c(pe,t)}return null}function ds(t){for(const[n,r]of t.current)!this.previous.has(n)&&t.previous.has(n)&&this.previous.set(n,t.previous.get(n)),this.current.set(n,r);for(const[n,r]of t.async_deriveds){const o=this.async_deriveds.get(n);o&&r.promise.then(o.resolve).catch(o.reject)}t.async_deriveds.clear(),this.transfer_effects(c(Oe,t),c(Ut,t));const e=n=>{var r=n.reactions;if(r!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(const a of r){var o=a.f;if((o&2)!==0)e(a);else{var i=a;o&4194320&&!this.async_deriveds.has(i)&&(c(Ut,this).delete(i),j(i,Tt),this.schedule(i))}}};for(const n of this.current.keys())e(n);this.oncommit(()=>t.discard()),_(B,t,Bn).call(t),A=this,_(B,this,jn).call(this)}function _n(t){for(var e=0;e<t.length;e+=1)ri(t[e],c(Oe,this),c(Ut,this))}function Bn(){if(this.linked){var t=c(pe,this),e=c(Ae,this);t===null?Rr=e:S(Ae,t,e),e===null?$e=t:S(pe,e,t),this.linked=!1}}function zn(t){var e=tn;tn=!0;try{var n;for(t&&(A!==null&&!A.is_fork&&A.flush(),n=t());;){if(ns(),A===null)return n;A.flush()}}finally{tn=e}}function vs(){try{Ja()}catch(t){It(t,Lr)}}var Rt=null;function To(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&24576)===0&&vn(r)&&(Rt=new Set,We(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&_i(r),Rt?.size>0)){Pt.clear();for(const o of Rt){if((o.f&24576)!==0)continue;const i=[o];let a=o.parent;for(;a!==null;)Rt.has(a)&&(Rt.delete(a),i.push(a)),a=a.parent;for(let l=i.length-1;l>=0;l--){const h=i[l];!(h.f&24576)&&We(h)}}Rt.clear()}}Rt=null}}function hi(t){A.schedule(t)}function fi(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):t.f&4096&&e.m.push(t),j(t,pt);for(var n=t.first;n!==null;)fi(n,e),n=n.next}}function di(t){j(t,pt);for(var e=t.first;e!==null;)di(e),e=e.next}var Un=new Set,Pt=new Map,vi=!1;function we(t,e){return{f:0,v:t,reactions:null,equals:Yo,rv:0,wv:0}}function F(t,e){const n=we(t,e);return Ci(n),n}function pi(t,e=!1,n=!0){const r=we(t);if(e||(r.equals=Qo),Zn&&n&&V!==null&&V.l!==null){var o;((o=V.l).s??(o.s=[])).push(r)}return r}function O(t,e,n=!1){return N!==null&&(!yt||N.f&131072)&&dn()&&N.f&4325394&&(St===null||!St.has(t))&&ts(),Le(t,n?fe(e):e,Fn)}var ue=null,Pr=0;function Le(t,e,n=null){if(!t.equals(e)){Gt?Pt.set(t,e):Pt.has(t)||Pt.set(t,t.v);var r=ke.ensure();if(r.capture(t,e),(t.f&2)!==0){const o=t;t.f&2048&&Zr(o),et===null&&Jr(o)}t.wv=Mi(),ue=null,Pr=0,gi(t,Tt,n),ue=null,dn()&&E!==null&&E.f&1024&&!(E.f&96)&&(vt===null?Ts([t]):vt.push(t)),!r.is_fork&&Un.size>0&&!vi&&ps()}return e}function ps(){vi=!1;for(const t of Un){t.f&1024&&j(t,ye);let e;try{e=vn(t)}catch{e=!0}e&&We(t)}Un.clear()}function en(t){O(t,t.v+1)}function gi(t,e,n){var r=t.reactions;if(r!==null){var o=dn(),i=r.length;if(Pr+=i,Pr>1e5&&ue===null&&(ue=new Set),ue!==null){if(ue.has(t))return;ue.add(t)}for(var a=0;a<i;a++){var l=r[a],h=l.f;if(!(!o&&l===E)){var u=(h&Tt)===0;if(u&&j(l,e),(h&131072)!==0)Un.add(l);else if((h&2)!==0){var f=l;et?.delete(f),gi(f,ye,n)}else if(u){var d=l;h&16&&Rt!==null&&Rt.add(d),n!==null?n.push(d):hi(d)}}}}}function fe(t){if(typeof t!="object"||t===null||Qe in t||Jo in t)return t;const e=Ko(t);if(e!==Ca&&e!==Na)return t;var n=new Map,r=Uo(t),o=F(0),i=null,a=ge,l=h=>{if(ge===a)return h();var u=N,f=ge;mt(null),Ao(a);var d=h();return mt(u),Ao(f),d};return r&&n.set("length",F(t.length,i)),new Proxy(t,{defineProperty(h,u,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ya();var d=n.get(u);return d===void 0?l(()=>{var p=F(f.value,i);return n.set(u,p),p}):O(d,f.value,!0),!0},deleteProperty(h,u){var f=n.get(u);if(f===void 0){if(u in h){const d=l(()=>F(z,i));n.set(u,d),en(o)}}else O(f,z),en(o);return!0},get(h,u,f){if(u===Qe)return t;var d=n.get(u),p=u in h;if(d===void 0&&(!p||ve(h,u)?.writable)&&(d=l(()=>F(fe(p?h[u]:z),i)),n.set(u,d)),d!==void 0){var g=s(d);return g===z?void 0:g}return Reflect.get(h,u,f)},getOwnPropertyDescriptor(h,u){this.has?.(h,u);var f=Reflect.getOwnPropertyDescriptor(h,u),d=n.get(u);if(d!==void 0){var p=s(d);if(p===z)return;if(f&&"value"in f)f.value=p;else return{enumerable:!0,configurable:!0,value:p,writable:!0}}return f},has(h,u){if(u===Qe)return!0;var f=n.get(u),d=f!==void 0&&f.v!==z||Reflect.has(h,u);return(f!==void 0||E!==null&&(!d||ve(h,u)?.writable))&&(f===void 0&&(f=l(()=>F(d?fe(h[u]):z,i)),n.set(u,f)),s(f)===z)?!1:d},set(h,u,f,d){var p=n.get(u),g=u in h;if(r&&u==="length")for(var b=f;b<p.v;b+=1){var $=n.get(b+"");$!==void 0?O($,z):b in h&&($=l(()=>F(z,i)),n.set(b+"",$))}if(p===void 0)(!g||ve(h,u)?.writable)&&(p=l(()=>F(void 0,i)),O(p,fe(f)),n.set(u,p));else{g=p.v!==z;var m=l(()=>fe(f));O(p,m)}var y=Reflect.getOwnPropertyDescriptor(h,u);if(y?.set&&y.set.call(d,f),!g){if(r&&typeof u=="string"){var P=n.get("length"),k=Number(u);Number.isInteger(k)&&k>=P.v&&O(P,k+1)}en(o)}return!0},ownKeys(h){s(o);var u=Reflect.ownKeys(h).filter(p=>{var g=n.get(p);return g===void 0||g.v!==z});for(var[f,d]of n)d.v!==z&&!(f in h)&&u.push(f);return u},setPrototypeOf(){Qa()}})}var _o,mi,bi,wi;function Ir(){if(_o===void 0){_o=window,mi=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;bi=ve(e,"firstChild").get,wi=ve(e,"nextSibling").get,yo(t)&&(t[Nr]=void 0,t[Cr]=null,t[Mr]=void 0,t.__e=void 0),yo(n)&&(n[On]=void 0)}}function lt(t=""){return document.createTextNode(t)}function at(t){return bi.call(t)}function _t(t){return wi.call(t)}function Ln(t,e){if(!C)return at(t);var n=at(M);if(n===null)n=M.appendChild(lt());else if(e&&n.nodeType!==3){var r=lt();return n?.before(r),Y(r),r}return e&&tr(n),Y(n),n}function En(t,e=!1){if(!C){var n=at(t);return n instanceof Comment&&n.data===""?_t(n):n}if(e){if(M?.nodeType!==3){var r=lt();return M?.before(r),Y(r),r}tr(M)}return M}function gr(t,e=!1){if(!C)return at(t);var n=Ln(t,e);return Ge(t),n}function Nt(t,e=1,n=!1){let r=C?M:t;for(var o;e--;)o=r,r=_t(r);if(!C)return r;if(n){if(r?.nodeType!==3){var i=lt();return r===null?o?.after(i):r.before(i),Y(i),i}tr(r)}return Y(r),r}function yi(t){t.textContent=""}function ki(){return!fn||Rt!==null?!1:(E.f&Ur)!==0}function Qn(t,e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?n?document.createElement(t,{is:n}):document.createElement(t):n?document.createElementNS(e,t,{is:n}):document.createElementNS(e,t)}function tr(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===3;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function gs(t){var e=E;if(e===null)return N.f|=Hn,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;It(t,e)}function It(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}function ms(t){E===null&&(N===null&&Ga(t),Ka()),Gt&&Ua(t)}function bs(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function qt(t,e){var n=E;n!==null&&n.f&8192&&(t|=zr);var r={ctx:V,deps:null,nodes:null,f:t|Tt|512,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};A?.register_created_effect(r);var o=r;if((t&4)!==0)sn!==null?sn.push(r):ke.ensure().schedule(r);else if(e!==null){try{We(r)}catch(a){throw nt(r),a}o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&!(o.f&524288)&&(o=o.first,t&16&&t&65536&&o!==null&&(o.f|=Kr))}if(o!==null&&(o.parent=n,n!==null&&bs(o,n),N!==null&&(N.f&2)!==0&&(t&64)===0)){var i=N;(i.effects??(i.effects=[])).push(o)}return r}function Qr(){return N!==null&&!yt}function ws(t){const e=qt(8,null);return j(e,pt),e.teardown=t,e}function ze(t){ms("$effect");var e=E.f;if(!N&&(e&32)!==0&&V!==null&&!V.i){var n=V;(n.e??(n.e=[])).push(t)}else return Si(t)}function Si(t){return qt(4|Pa,t)}function ys(t){ke.ensure();const e=qt(64|Pe,t);return()=>{nt(e)}}function ks(t){ke.ensure();const e=qt(64|Pe,t);return(n={})=>new Promise(r=>{n.outro?Se(e,()=>{nt(e),r(void 0)}):(nt(e),r(void 0))})}function xi(t){return qt(4,t)}function Ss(t){return qt(Ia|Pe,t)}function to(t,e=0){return qt(8|e,t)}function Bt(t,e=[],n=[],r=[]){os(r,e,n,o=>{qt(8,()=>{t(...o.map(s))})})}function eo(t,e=0){return qt(16|e,t)}function gt(t){return qt(32|Pe,t)}function $i(t){var e=t.teardown;if(e!==null){const n=Gt,r=N;Eo(!0),mt(null);try{e.call(null)}catch(o){It(o,t.parent)}finally{Eo(n),mt(r)}}}function no(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const o=n.ac;o!==null&&Yn(()=>{o.abort(un)});var r=n.next;(n.f&64)!==0?n.parent=null:nt(n,e),n=r}}function xs(t){for(var e=t.first;e!==null;){var n=e.next;!(e.f&32)&&nt(e),e=n}}function nt(t,e=!0){var n=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(Ti(t.nodes.start,t.nodes.end),n=!0),t.f|=ko,no(t,e&&!n),ln(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const i of r)i.stop();$i(t),t.f^=ko,t.f|=Wa;var o=t.parent;o!==null&&o.first!==null&&_i(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function Ti(t,e){for(;t!==null;){var n=t===e?null:_t(t);t.remove(),t=n}}function _i(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Se(t,e,n=!0){var r=[];t.f|=256,Ei(t,r,!0);var o=()=>{n&&nt(t),e&&e()},i=r.length;if(i>0){var a=()=>--i||o();for(var l of r)l.out(a)}else o()}function Ei(t,e,n){if((t.f&8192)===0){t.f^=zr;var r=t.nodes&&t.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&e.push(l);for(var o=t.first;o!==null;){var i=o.next;if((o.f&64)===0){var a=(o.f&65536)!==0||(o.f&32)!==0&&(t.f&16)!==0;Ei(o,e,a?n:!1)}o=i}}}function Kn(t){t.f&=-257,Ai(t,!0)}function Ai(t,e){if((t.f&256)===0&&(t.f&8192)!==0){t.f^=zr,!(t.f&1024)&&(j(t,Tt),ke.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,o=(n.f&65536)!==0||(n.f&32)!==0;Ai(n,o?e:!1),n=r}var i=t.nodes&&t.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&a.in()}}function ro(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var o=n===r?null:_t(n);e.append(n),n=o}}var $s=null,Wn=!1,Gt=!1;function Eo(t){Gt=t}var N=null,yt=!1;function mt(t){N=t}var E=null;function Ht(t){E=t}var St=null;function Ci(t){N!==null&&(N.f&2097152||N.f&2)&&(St??(St=new Set)).add(t)}var rt=null,it=0,vt=null;function Ts(t){vt=t}var Ni=1,de=0,ge=de;function Ao(t){ge=t}function Mi(){return++Ni}function vn(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var n=t.deps,r=n.length,o=0;o<r;o++){var i=n[o];if(vn(i)&&ii(i),i.wv>t.wv)return!0}e&512&&et===null&&j(t,pt)}return!1}function Ri(t,e,n=!0){var r=t.reactions;if(r!==null&&!(!fn&&St!==null&&St.has(t)))for(var o=0;o<r.length;o++){var i=r[o];(i.f&2)!==0?Ri(i,e,!1):e===i&&(n?j(i,Tt):i.f&1024&&j(i,ye),hi(i))}}function Oi(t){var e=rt,n=it,r=vt,o=N,i=St,a=V,l=yt,h=ge,u=t.f;rt=null,it=0,vt=null,N=(u&96)===0?t:null,St=null,Re(t.ctx),yt=!1,ge=++de,t.ac!==null&&(Yn(()=>{t.ac.abort(un)}),t.ac=null);try{t.f|=So;var f=t.fn,d=f();t.f|=Ur;var p=Co(t);if(dn()&&vt!==null&&!yt&&p!==null&&(t.f&6146)===0)for(var g=0;g<vt.length;g++)Ri(vt[g],t);if(o!==null&&o!==t){if(de++,o.deps!==null)for(let b=0;b<n;b+=1)o.deps[b].rv=de;if(e!==null)for(const b of e)b.rv=de;vt!==null&&(r===null?r=vt:r.push(...vt))}return t.f&8388608&&(t.f^=Hn),d}catch(b){return Co(t),gs(b)}finally{t.f^=So,rt=e,it=n,vt=r,N=o,St=i,Re(a),yt=l,ge=h}}function Co(t){var e=t.deps,n=A?.is_fork;if(rt!==null){var r;if(n||ln(t,it),e!==null&&it>0)for(e.length=it+rt.length,r=0;r<rt.length;r++)e[it+r]=rt[r];else t.deps=e=rt;if(Qr()&&(t.f&512)!==0)for(r=it;r<e.length;r++){var o;((o=e[r]).reactions??(o.reactions=[])).push(t)}}else!n&&e!==null&&it<e.length&&(ln(t,it),e.length=it);return e}function _s(t,e){let n=e.reactions;if(n!==null){var r=Ea.call(n,t);if(r!==-1){var o=n.length-1;o===0?n=e.reactions=null:(n[r]=n[o],n.pop())}}if(n===null&&(e.f&2)!==0&&(rt===null||!Ar.call(rt,e))){var i=e;i.f&512&&(i.f^=512),i.v!==z&&Jr(i),i.ac!==null&&Yn(()=>{i.ac.abort(un),i.ac=null,j(i,Tt)}),ls(i),ln(i,0)}}function ln(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)_s(t,n[r])}function We(t){var e=t.f;if((e&16384)===0){j(t,pt);var n=E,r=Wn;E=t,Wn=(e&96)===0;try{(e&16777232)!==0?xs(t):no(t),$i(t);var o=Oi(t);t.teardown=typeof o=="function"?o:null,t.wv=Ni}finally{Wn=r,E=n}}}async function Es(){if(fn)return new Promise(t=>{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),zn()}function s(t){var e=(t.f&2)!==0;if($s?.add(t),N!==null&&!yt&&!(E!==null&&(E.f&16384)!==0)&&(St===null||!St.has(t))){var n=N.deps;if((N.f&2097152)!==0)t.rv<de&&(t.rv=de,rt===null&&n!==null&&n[it]===t?it++:rt===null?rt=[t]:rt.push(t));else{var r;(r=N).deps??(r.deps=[]),Ar.call(N.deps,t)||N.deps.push(t);var o=t.reactions;o===null?t.reactions=[N]:Ar.call(o,N)||o.push(N)}}if(Gt&&Pt.has(t))return Pt.get(t);if(e){var i=t;if(Gt){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Wi(i))&&(a=Zr(i)),Pt.set(i,a),a}var l=(i.f&512)===0&&!yt&&N!==null&&(Wn||(N.f&512)!==0),h=(i.f&Ur)===0;vn(i)&&(l&&(i.f|=512),ii(i)),l&&!h&&(ai(i),Li(i))}if(et?.has(t))return et.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function Li(t){if(t.f|=512,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),e.f&2&&!(e.f&512)&&(ai(e),Li(e))}function Wi(t){if(t.v===z)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Pt.has(e)||(e.f&2)!==0&&Wi(e))return!0;return!1}function Ne(t){var e=yt;try{return yt=!0,t()}finally{yt=e}}var Ce=Symbol("events"),Pi=new Set,Hr=new Set;function Yt(t,e,n){(e[Ce]??(e[Ce]={}))[t]=n}function As(t){for(var e=0;e<t.length;e++)Pi.add(t[e]);for(var n of Hr)n(t)}var mr=null,br=!1;function No(t){var e=this,n=e.ownerDocument,r=t.type,o=t.composedPath?.()||[],i=o[0]||t.target;mr=t,br||(br=!0,setTimeout(()=>{br=!1,mr=null}));var a=0,l=mr===t&&t[Ce];if(l){var h=o.indexOf(l);if(h!==-1&&(e===document||e===window)){t[Ce]=e;return}var u=o.indexOf(e);if(u===-1)return;h<=u&&(a=h)}if(i=o[a]||t.target,i!==e){rn(t,"currentTarget",{configurable:!0,get(){return i||n}});var f=N,d=E;mt(null),Ht(null);try{for(var p,g=[];i!==null&&i!==e;){try{var b=i[Ce]?.[r];b!=null&&(!i.disabled||t.target===i)&&b.call(i,t)}catch($){p?g.push($):p=$}if(t.cancelBubble)break;a++,i=a<o.length?o[a]:null}if(p){for(let $ of g)queueMicrotask(()=>{throw $});throw p}}finally{t[Ce]=e,delete t.currentTarget,mt(f),Ht(d)}}}var Cs=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Ns(t){return Cs?.createHTML(t)??t}function Ms(t){var e=Qn("template");return e.innerHTML=Ns(t.replaceAll("<!>","<!---->")),e.content}function Kt(t,e){var n=E;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function Dt(t,e){var n=(e&1)!==0,r=(e&2)!==0,o,i=!t.startsWith("<!>");return()=>{if(C)return Kt(M,null),M;o===void 0&&(o=Ms(i?t:"<!>"+t),n||(o=at(o)));var a=r||mi?document.importNode(o,!0):o.cloneNode(!0);if(n){var l=at(a),h=a.lastChild;Kt(l,h)}else Kt(a,a);return a}}function Rs(t=""){if(!C){var e=lt(t+"");return Kt(e,e),e}var n=M;return n.nodeType!==3?(n.before(n=lt()),Y(n)):tr(n),Kt(n,n),n}function ft(t,e){if(C){var n=E;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=M),Me();return}t!==null&&t.before(e)}var Os=["touchstart","touchmove"];function Ls(t){return Os.includes(t)}function Ws(t){let e=0,n=we(0),r;return()=>{Qr()&&(s(n),to(()=>(e===0&&(r=Ne(()=>t(()=>en(n)))),e+=1,()=>{re(()=>{e-=1,e===0&&(r?.(),r=void 0,en(n))})})))}}var Ps=Kr|Pe;function Is(t,e,n,r){new Hs(t,e,n,r)}var xt=new WeakMap,qr=new WeakMap,Wt=new WeakMap,cn=new WeakMap,st=new WeakMap,$t=new WeakMap,ct=new WeakMap,kt=new WeakMap,ne=new WeakMap,_e=new WeakMap,me=new WeakMap,An=new WeakMap,Dr=new WeakMap,Fr=new WeakMap,ae=new WeakMap,Mo=new WeakMap,U=new WeakSet,Hs=class{constructor(t,e,n,r){Yr(this,U),W(this,"parent",void 0),W(this,"is_pending",!1),W(this,"transform_error",void 0),x(this,xt,void 0),x(this,qr,C?M:null),x(this,Wt,void 0),x(this,cn,void 0),x(this,st,void 0),x(this,$t,null),x(this,ct,null),x(this,kt,null),x(this,ne,null),x(this,_e,0),x(this,me,0),x(this,An,!1),x(this,Dr,new Set),x(this,Fr,new Set),x(this,ae,null),x(this,Mo,Ws(()=>(S(ae,this,we(c(_e,this))),()=>{S(ae,this,null)}))),S(xt,this,t),S(Wt,this,e),S(cn,this,o=>{var i=E;i.b=this,i.f|=128,n(o)}),this.parent=E.b,this.transform_error=r??this.parent?.transform_error??(o=>o),S(st,this,eo(()=>{if(C){const o=c(qr,this);Me();const i=o.data==="[!";if(o.data.startsWith("[?")){const a=JSON.parse(o.data.slice(2));_(U,this,Ds).call(this,a)}else i?_(U,this,Fs).call(this):_(U,this,qs).call(this)}else _(U,this,Hi).call(this)},Ps)),C&&S(xt,this,M)}defer_effect(t){ri(t,c(Dr,this),c(Fr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(Wt,this).pending}update_pending_count(t,e){_(U,this,qi).call(this,t,e),S(_e,this,c(_e,this)+t),c(ae,this)&&!c(An,this)&&(S(An,this,!0),re(()=>{S(An,this,!1),c(ae,this)&&Le(c(ae,this),c(_e,this))}))}get_effect_pending(){return c(Mo,this).call(this),s(c(ae,this))}error(t){if(!c(Wt,this).onerror&&!c(Wt,this).failed)throw t;A?.is_fork?(c($t,this)&&A.skip_effect(c($t,this)),c(ct,this)&&A.skip_effect(c(ct,this)),c(kt,this)&&A.skip_effect(c(kt,this)),A.oncommit(()=>{_(U,this,Ro).call(this,t)})):_(U,this,Ro).call(this,t)}};function qs(){try{S($t,this,gt(()=>c(cn,this).call(this,c(xt,this))))}catch(t){this.error(t)}}function Ds(t){const e=c(Wt,this).failed,{reset:n,invoke_onerror:r}=_(U,this,Ii).call(this,t);re(r),e&&S(kt,this,gt(()=>{e(c(xt,this),()=>t,()=>n)}))}function Ii(t){var e=!1,n=!1;const r=()=>{if(e){Fa();return}e=!0,n&&es(),c(kt,this)!==null&&Se(c(kt,this),()=>{S(kt,this,null)}),_(U,this,oo).call(this,()=>{_(U,this,Hi).call(this)})};return{reset:r,invoke_onerror:()=>{try{n=!0,c(Wt,this).onerror?.(t,r),n=!1}catch(o){It(o,c(st,this)&&c(st,this).parent)}}}}function Fs(){const t=c(Wt,this).pending;t&&(this.is_pending=!0,S(ct,this,gt(()=>t(c(xt,this)))),re(()=>{var e=S(ne,this,document.createDocumentFragment()),n=lt(),r=!1;if(e.append(n),S($t,this,_(U,this,oo).call(this,()=>{try{return gt(()=>c(cn,this).call(this,n))}catch(o){try{this.error(o),r=!0}catch(i){It(i,c(st,this).parent)}return null}})),c($t,this)===null){S(ne,this,null),r&&_(U,this,Gn).call(this,A);return}c(me,this)===0&&(c(xt,this).before(e),S(ne,this,null),Se(c(ct,this),()=>{S(ct,this,null)}),_(U,this,Gn).call(this,A))}))}function Hi(){try{if(this.is_pending=this.has_pending_snippet(),S(me,this,0),S(_e,this,0),S($t,this,gt(()=>{c(cn,this).call(this,c(xt,this))})),c(me,this)>0){var t=S(ne,this,document.createDocumentFragment());ro(c($t,this),t);const e=c(Wt,this).pending;S(ct,this,gt(()=>e(c(xt,this))))}else _(U,this,Gn).call(this,A)}catch(e){this.error(e)}}function Gn(t){this.is_pending=!1,t.transfer_effects(c(Dr,this),c(Fr,this))}function oo(t){var e=E,n=N,r=V;Ht(c(st,this)),mt(c(st,this)),Re(c(st,this).ctx);try{return ke.ensure(),t()}finally{Ht(e),mt(n),Re(r)}}function qi(t,e){if(!this.has_pending_snippet()){if(this.parent){var n;_(U,n=this.parent,qi).call(n,t,e)}return}S(me,this,c(me,this)+t),c(me,this)===0&&(_(U,this,Gn).call(this,e),c(ct,this)&&Se(c(ct,this),()=>{S(ct,this,null)}),c(ne,this)&&(c(xt,this).before(c(ne,this)),S(ne,this,null)))}function Ro(t){c($t,this)&&(nt(c($t,this)),S($t,this,null)),c(ct,this)&&(nt(c(ct,this)),S(ct,this,null)),c(kt,this)&&(nt(c(kt,this)),S(kt,this,null)),C&&(Y(c(qr,this)),Va(),Y(qn()));let e=c(Wt,this).failed;const n=r=>{const{reset:o,invoke_onerror:i}=_(U,this,Ii).call(this,r);i(),e&&S(kt,this,_(U,this,oo).call(this,()=>{try{return gt(()=>{var a=E;a.b=this,a.f|=128,e(c(xt,this),()=>r,()=>o)})}catch(a){return It(a,c(st,this).parent),null}}))};re(()=>{var r;try{r=this.transform_error(t)}catch(o){It(o,c(st,this)&&c(st,this).parent);return}r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(n,o=>It(o,c(st,this)&&c(st,this).parent)):n(r)})}function Cn(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[On]??(t[On]=t.nodeValue))&&(t[On]=n,t.nodeValue=`${n}`)}function Di(t,e){return Fi(t,e)}function Vs(t,e){Ir(),e.intro=e.intro??!1;const n=e.target,r=C,o=M;try{for(var i=at(n);i&&(i.nodeType!==8||i.data!=="[");)i=_t(i);if(!i)throw be;zt(!0),Y(i);const a=Fi(t,{...e,anchor:i});return zt(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
212
- `).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==be&&console.warn("Failed to hydrate: ",a),e.recover===!1&&Xa(),Ir(),yi(n),zt(!1),Di(t,e)}finally{zt(r),Y(o)}}var Nn=new Map;function Fi(t,{target:e,anchor:n,props:r={},events:o,context:i,intro:a=!0,transformError:l}){Ir();var h=void 0,u=ks(()=>{var f=n??e.appendChild(lt());Is(f,{pending:()=>{}},g=>{ti({});var b=V;if(i&&(b.c=i),o&&(r.$$events=o),C&&Kt(g,null),h=t(g,r)||Gr(),C&&(E.nodes.end=M,M===null||M.nodeType!==8||M.data!=="]"))throw hn(),be;ei()},l);var d=new Set,p=g=>{for(var b=0;b<g.length;b++){var $=g[b];if(!d.has($)){d.add($);var m=Ls($);for(const k of[e,document]){var y=Nn.get(k);y===void 0&&(y=new Map,Nn.set(k,y));var P=y.get($);P===void 0?(k.addEventListener($,No,{passive:m}),y.set($,1)):y.set($,P+1)}}}};return p(Xn(Pi)),Hr.add(p),()=>{for(var g of d)for(const m of[e,document]){var b=Nn.get(m),$=b.get(g);--$==0?(m.removeEventListener(g,No),b.delete(g),b.size===0&&Nn.delete(m)):b.set(g,$)}Hr.delete(p),f!==n&&f.parentNode?.removeChild(f)}});return Vr.set(h,u),h}var Vr=new WeakMap;function js(t,e){const n=Vr.get(t);return n?(Vr.delete(t),n(e)):Promise.resolve()}var jt=new WeakMap,Qt=new WeakMap,bt=new WeakMap,Ue=new WeakMap,wr=new WeakMap,yr=new WeakMap,Oo=new WeakMap,Bs=class{constructor(t,e=!0){W(this,"anchor",void 0),x(this,jt,new Map),x(this,Qt,new Map),x(this,bt,new Map),x(this,Ue,new Set),x(this,wr,!0),x(this,yr,n=>{if(c(jt,this).has(n)){var r=c(jt,this).get(n),o=c(Qt,this).get(r);if(o)Kn(o),c(Ue,this).delete(r);else{var i=c(bt,this).get(r);i&&(Kn(i.effect),c(Qt,this).set(r,i.effect),c(bt,this).delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),o=i.effect)}for(const[a,l]of c(jt,this)){if(c(jt,this).delete(a),a===n)break;const h=c(bt,this).get(l);h&&(nt(h.effect),c(bt,this).delete(l))}for(const[a,l]of c(Qt,this)){if(a===r||c(Ue,this).has(a))continue;const h=()=>{if(Array.from(c(jt,this).values()).includes(a)){var u=document.createDocumentFragment();ro(l,u),u.append(lt()),c(bt,this).set(a,{effect:l,fragment:u})}else nt(l);c(Ue,this).delete(a),c(Qt,this).delete(a)};c(wr,this)||!o?(c(Ue,this).add(a),Se(l,h,!1)):h()}}}),x(this,Oo,n=>{c(jt,this).delete(n);const r=Array.from(c(jt,this).values());for(const[o,i]of c(bt,this))r.includes(o)||(nt(i.effect),c(bt,this).delete(o))}),this.anchor=t,S(wr,this,e)}ensure(t,e){var n=A,r=ki();if(e&&!c(Qt,this).has(t)&&!c(bt,this).has(t))if(r){var o=document.createDocumentFragment(),i=lt();o.append(i),c(bt,this).set(t,{effect:gt(()=>e(i)),fragment:o})}else c(Qt,this).set(t,gt(()=>e(this.anchor)));if(c(jt,this).set(n,t),r){for(const[a,l]of c(Qt,this))a===t?n.unskip_effect(l):n.skip_effect(l);for(const[a,l]of c(bt,this))a===t?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(c(yr,this)),n.ondiscard(c(Oo,this))}else C&&(this.anchor=M),c(yr,this).call(this,n)}};function se(t,e,n=!1){var r;C&&(r=M,Me());var o=new Bs(t),i=n?Kr:0;function a(l,h){if(C){var u=Zo(r);if(l!==parseInt(u.substring(1))){var f=qn();Y(f),o.anchor=f,zt(!1),o.ensure(l,h),zt(!0);return}}o.ensure(l,h)}eo(()=>{var l=!1;e((h,u=0)=>{l=!0,a(u,h)}),l||a(-1,null)},i)}function zs(t,e){return e}function Us(t,e,n){for(var r=[],o=e.length,i,a=e.length,l=0;l<o;l++){let d=e[l];Se(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var p=t.outrogroups;jr(t,Xn(i.done)),p.delete(i),p.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var h=r.length===0&&n!==null&&t.pending.size===0;if(h){var u=n,f=u.parentNode;yi(f),f.append(u),t.items.clear()}jr(t,e,!h)}else i={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(i)}function jr(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const a of t.pending.values())for(const l of a)r.add(t.items.get(l).e)}for(var o=0;o<e.length;o++){var i=e[o];r?.has(i)?(i.f|=Ye,ro(i,document.createDocumentFragment())):nt(e[o],n)}}var Mn;function Lo(t,e,n,r,o,i=null){var a=t,l=new Map;if((e&4)!==0){var h=t;a=C?Y(at(h)):h.appendChild(lt())}C&&Me();var u=null,f=Xr(()=>{var y=n();return Uo(y)?y:y==null?[]:Xn(y)}),d,p=new Map,g=!0;function b(y){!(m.effect.f&16384)&&(m.pending.delete(y),m.fallback=u,Ks(m,d,a,e,r),u!==null&&(d.length===0?(u.f&33554432)===0?Kn(u):(u.f^=Ye,Ze(u,null,a)):Se(u,()=>{u=null})))}function $(y){m.pending.delete(y)}var m={effect:eo(()=>{d=s(f);var y=d.length;let P=!1;C&&Zo(a)==="[!"!=(y===0)&&(a=qn(),Y(a),zt(!1),P=!0);for(var k=new Set,T=A,I=ki(),H=0;H<y;H+=1){C&&M.nodeType===8&&M.data==="]"&&(a=M,P=!0,zt(!1));var D=d[H],K=r(D,H),G=g?null:l.get(K);G?(G.v&&Le(G.v,D),G.i&&Le(G.i,H),I&&T.unskip_effect(G.e)):(G=Gs(l,g?a:Mn??(Mn=lt()),D,K,H,o,e,n),g||(G.e.f|=Ye),l.set(K,G)),k.add(K)}if(y===0&&i&&!u&&(g?u=gt(()=>i(a)):(u=gt(()=>i(Mn??(Mn=lt()))),u.f|=Ye)),y>k.size&&za("","",""),C&&y>0&&Y(qn()),!g)if(p.set(T,k),I){for(const[J,Jt]of l)k.has(J)||T.skip_effect(Jt.e);T.oncommit(b),T.ondiscard($)}else b(T);P&&zt(!0),s(f)}),flags:e,items:l,pending:p,outrogroups:null,fallback:u};g=!1,C&&(a=M)}function Ke(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function Ks(t,e,n,r,o){var i=(r&8)!==0,a=e.length,l=t.items,h=Ke(t.effect.first),u,f=null,d,p=[],g=[],b,$,m,y;if(i)for(y=0;y<a;y+=1)b=e[y],$=o(b,y),m=l.get($).e,!(m.f&33554432)&&(m.nodes?.a?.measure(),(d??(d=new Set)).add(m));for(y=0;y<a;y+=1){if(b=e[y],$=o(b,y),m=l.get($).e,t.outrogroups!==null)for(const J of t.outrogroups)J.pending.delete(m),J.done.delete(m);if(m.f&8192&&(Kn(m),i&&(m.nodes?.a?.unfix(),(d??(d=new Set)).delete(m))),(m.f&33554432)!==0)if(m.f^=Ye,m===h)Ze(m,null,n);else{var P=f?f.next:h;m===t.effect.last&&(t.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),te(t,f,m),te(t,m,P),Ze(m,P,n),f=m,p=[],g=[],h=Ke(f.next);continue}if(m!==h){if(u!==void 0&&u.has(m)){if(p.length<g.length){var k=g[0],T;f=k.prev;var I=p[0],H=p[p.length-1];for(T=0;T<p.length;T+=1)Ze(p[T],k,n);for(T=0;T<g.length;T+=1)u.delete(g[T]);te(t,I.prev,H.next),te(t,f,I),te(t,H,k),h=k,f=H,y-=1,p=[],g=[]}else u.delete(m),Ze(m,h,n),te(t,m.prev,m.next),te(t,m,f===null?t.effect.first:f.next),te(t,f,m),f=m;continue}for(p=[],g=[];h!==null&&h!==m;)(u??(u=new Set)).add(h),g.push(h),h=Ke(h.next);if(h===null)continue}!(m.f&33554432)&&p.push(m),f=m,h=Ke(m.next)}if(t.outrogroups!==null){for(const J of t.outrogroups)J.pending.size===0&&(jr(t,Xn(J.done)),t.outrogroups?.delete(J));t.outrogroups.size===0&&(t.outrogroups=null)}if(h!==null||u!==void 0){var D=[];if(u!==void 0)for(m of u)!(m.f&8192)&&D.push(m);for(;h!==null;)!(h.f&8192)&&h!==t.fallback&&D.push(h),h=Ke(h.next);var K=D.length;if(K>0){var G=(r&4)!==0&&a===0?n:null;if(i){for(y=0;y<K;y+=1)D[y].nodes?.a?.measure();for(y=0;y<K;y+=1)D[y].nodes?.a?.fix()}Us(t,D,G)}}i&&re(()=>{if(d!==void 0)for(m of d)m.nodes?.a?.apply()})}function Gs(t,e,n,r,o,i,a,l){var h=(a&1)!==0?(a&16)===0?pi(n,!1,!1):we(n):null,u=(a&2)!==0?we(o):null;return{v:h,i:u,e:gt(()=>(i(e,h??n,u??o,l),()=>{t.delete(r)}))}}function Ze(t,e,n){if(t.nodes)for(var r=t.nodes.start,o=t.nodes.end,i=e&&(e.f&33554432)===0?e.nodes.start:n;r!==null;){var a=_t(r);if(i.before(r),r===o)return;r=a}}function te(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function Js(t,e,n=!1,r=!1,o=!1,i=!1){var a=t,l="";if(n){var h=t;C&&(a=Y(at(h)))}Bt(()=>{var u=E;if(l===(l=e()??"")){C&&Me();return}if(n&&!C){u.nodes=null,h.innerHTML=l,l!==""&&Kt(at(h),h.lastChild);return}if(u.nodes!==null&&(Ti(u.nodes.start,u.nodes.end),u.nodes=null),l!==""){if(C){for(var f=M.data,d=Me(),p=d;d!==null&&(d.nodeType!==8||d.data!=="");)p=d,d=_t(d);if(d===null)throw hn(),be;Kt(M,p),a=Y(d);return}var g=Qn(r?"svg":o?"math":"template",r?Ta:o?_a:void 0);g.innerHTML=l;var b=r||o?g:g.content;if(Kt(at(b),b.lastChild),r||o)for(;at(b);)a.before(at(b));else a.before(b)}})}function Xs(t,e){xi(()=>{t=E?.parent?.nodes?.start??t;var n=t.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const o=Qn("style");o.id=e.hash,o.textContent=e.code,r.appendChild(o)}})}var Wo=[...`
213
- \r\f \v\uFEFF`];function Zs(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var o of Object.keys(n))if(n[o])r=r?r+" "+o:o;else if(r.length)for(var i=o.length,a=0;(a=r.indexOf(o,a))>=0;){var l=a+i;(a===0||Wo.includes(r[a-1]))&&(l===r.length||Wo.includes(r[l]))?r=(a===0?"":r.substring(0,a))+r.substring(l+1):a=l}}return r===""?null:r}function Po(t,e=!1){var n=e?" !important;":";",r="";for(var o of Object.keys(t)){var i=t[o];i!=null&&i!==""&&(r+=" "+o+": "+i+n)}return r}function kr(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Ys(t,e){if(e){var n="",r,o;if(Array.isArray(e)?(r=e[0],o=e[1]):r=e,t){t=String(t).replaceAll(/\/\*.*?\*\//g,"").trim();var i=!1,a=0,l=!1,h=[];r&&h.push(...Object.keys(r).map(kr)),o&&h.push(...Object.keys(o).map(kr));var u=0,f=-1;const $=t.length;for(var d=0;d<$;d++){var p=t[d];if(l?p==="/"&&t[d-1]==="*"&&(l=!1):i?i===p&&(i=!1):p==="/"&&t[d+1]==="*"?l=!0:p==='"'||p==="'"?i=p:p==="("?a++:p===")"&&a--,!l&&i===!1&&a===0){if(p===":"&&f===-1)f=d;else if(p===";"||d===$-1){if(f!==-1){var g=kr(t.substring(u,f).trim());if(!h.includes(g)){p!==";"&&d++;var b=t.substring(u,d).trim();n+=" "+b+";"}}u=d+1,f=-1}}}}return r&&(n+=Po(r)),o&&(n+=Po(o,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Qs(t,e,n,r,o,i){var a=t[Nr];if(C||a!==n||a===void 0){var l=Zs(n,r,i);(!C||l!==t.getAttribute("class"))&&(l==null?t.removeAttribute("class"):e?t.className=l:t.setAttribute("class",l)),t[Nr]=n}else if(i&&o!==i)for(var h in i){var u=!!i[h];(o==null||u!==!!o[h])&&t.classList.toggle(h,u)}return i}function Sr(t,e={},n,r){for(var o in n){var i=n[o];e[o]!==i&&(n[o]==null?t.style.removeProperty(o):t.style.setProperty(o,i,r))}}function Io(t,e,n,r){var o=t[Mr];if(C||o!==e){var i=Ys(e,r);(!C||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t[Mr]=e}else r&&(Array.isArray(r)?(Sr(t,n?.[0],r[0]),Sr(t,n?.[1],r[1],"important")):Sr(t,n,r));return r}var tl=Symbol("is custom element"),el=Symbol("is html"),nl=qa?"link":"LINK";function X(t,e,n,r){var o=rl(t);C&&(o[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===nl)||o[e]!==(o[e]=n)&&(e==="loading"&&(t[Ha]=n),n==null?t.removeAttribute(e):typeof n!="string"&&ol(t).has(e)?t[e]=n:t.setAttribute(e,n))}function rl(t){return t[Cr]??(t[Cr]={[tl]:t.nodeName.includes("-"),[el]:t.namespaceURI==="http://www.w3.org/1999/xhtml"})}var Ho=new Map;function ol(t){var e=t.getAttribute("is")||t.nodeName,n=Ho.get(e);if(n)return n;Ho.set(e,n=new Set);for(var r,o=t,i=Element.prototype;i!==o;){r=Aa(o);for(var a in r)r[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&n.add(a);o=Ko(o)}return n}var Vi,Ee=new WeakMap,Jn=new WeakMap,xr=new WeakMap,qo=new WeakSet,ji=class{constructor(t){Yr(this,qo),x(this,Ee,new WeakMap),x(this,Jn,void 0),x(this,xr,void 0),S(xr,this,t)}observe(t,e){var n=c(Ee,this).get(t)||new Set;return n.add(e),c(Ee,this).set(t,n),_(qo,this,il).call(this).observe(t,c(xr,this)),()=>{var r=c(Ee,this).get(t);r.delete(e),r.size===0&&(c(Ee,this).delete(t),c(Jn,this).unobserve(t))}}};Vi=ji;function il(){return c(Jn,this)??S(Jn,this,new ResizeObserver(t=>{for(var e of t){Vi.entries.set(e.target,e);for(var n of c(Ee,this).get(e.target)||[])n(e)}}))}W(ji,"entries",new WeakMap);function $r(t,e){return t===e||t?.[Qe]===e}function Do(t=Gr(),e,n,r){var o=V.r,i=E;return xi(()=>{var a,l;return to(()=>{a=l,l=r?.()||[],Ne(()=>{$r(n(...l),t)||(e(t,...l),a&&$r(n(...a),t)&&e(null,...a))})}),()=>{let h=i;for(;h!==o&&h.parent!==null&&h.parent.f&33554432;)h=h.parent;const u=()=>{l&&$r(n(...l),t)&&e(null,...l)},f=h.teardown;h.teardown=()=>{u(),f?.()}}}),t}var Rn=!1;function al(t){var e=Rn;try{return Rn=!1,[t(),Rn]}finally{Rn=e}}function Fo(t,e,n,r){var o=!Zn||(n&2)!==0,i=(n&8)!==0,a=(n&16)!==0,l=r,h=!0,u=void 0,f=()=>a&&o?(u??(u=an(r)),s(u)):(h&&(h=!1,l=a?Ne(r):r),l);let d;if(i){var p=Qe in t||Xo in t;d=ve(t,e)?.set??(p&&e in t?T=>t[e]=T:void 0)}var g,b=!1;i?[g,b]=al(()=>t[e]):g=t[e],g===void 0&&r!==void 0&&(g=f(),d&&(o&&Za(e),d(g)));var $;if(o?$=()=>{var T=t[e];return T===void 0?f():(h=!0,T)}:$=()=>{var T=t[e];return T!==void 0&&(l=void 0),T===void 0?l:T},o&&(n&4)===0)return $;if(d){var m=t.$$legacy;return(function(T,I){return arguments.length>0?((!o||!I||m||b)&&d(I?$():T),T):$()})}var y=!1,P=((n&1)!==0?an:Xr)(()=>(y=!1,$()));i&&s(P);var k=E;return(function(T,I){if(arguments.length>0){const H=I?s(P):o&&i?fe(T):T;return O(P,H),y=!0,l!==void 0&&(l=H),T}return Gt&&y||(k.f&16384)!==0?P.v:s(P)})}function sl(t){return new ll(t)}var le=new WeakMap,Mt=new WeakMap,ll=class{constructor(t){x(this,le,void 0),x(this,Mt,void 0);var e=new Map,n=(o,i)=>{var a=pi(i,!1,!1);return e.set(o,a),a};const r=new Proxy({...t.props||{},$$events:{}},{get(o,i){return s(e.get(i)??n(i,Reflect.get(o,i)))},has(o,i){return i===Xo?!0:(s(e.get(i)??n(i,Reflect.get(o,i))),Reflect.has(o,i))},set(o,i,a){return O(e.get(i)??n(i,a),a),Reflect.set(o,i,a)}});S(Mt,this,(t.hydrate?Vs:Di)(t.component,{target:t.target,anchor:t.anchor,props:r,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!t?.props?.$$host||t.sync===!1)&&zn(),S(le,this,r.$$events);for(const o of Object.keys(c(Mt,this)))o==="$set"||o==="$destroy"||o==="$on"||rn(this,o,{get(){return c(Mt,this)[o]},set(i){c(Mt,this)[o]=i},enumerable:!0});c(Mt,this).$set=o=>{Object.assign(r,o)},c(Mt,this).$destroy=()=>{js(c(Mt,this))}}$set(t){c(Mt,this).$set(t)}$on(t,e){c(le,this)[t]=c(le,this)[t]||[];const n=(...r)=>e.call(this,...r);return c(le,this)[t].push(n),()=>{c(le,this)[t]=c(le,this)[t].filter(r=>r!==n)}}$destroy(){c(Mt,this).$destroy()}},Bi;typeof HTMLElement=="function"&&(Bi=class extends HTMLElement{constructor(t,e,n){super(),W(this,"$$ctor",void 0),W(this,"$$s",void 0),W(this,"$$c",void 0),W(this,"$$cn",!1),W(this,"$$d",{}),W(this,"$$r",!1),W(this,"$$p_d",{}),W(this,"$$l",{}),W(this,"$$l_u",new Map),W(this,"$$me",void 0),W(this,"$$shadowRoot",null),this.$$ctor=t,this.$$s=e,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return o=>{const i=Qn("slot");r!=="default"&&(i.name=r),ft(o,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=cl(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=t(r),e.default=!0):e[r]=t(r));for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=Pn(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=sl({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=ys(()=>{to(()=>{this.$$r=!0;for(const r of In(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const o=Pn(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1})});for(const r in this.$$l)for(const o of this.$$l[r]){const i=this.$$c.$on(r,o);this.$$l_u.set(o,i)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Pn(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return In(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Pn(t,e,n,r){const o=n[t]?.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function cl(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function ul(t,e,n,r,o,i){let a=class extends Bi{constructor(){super(t,n,o),this.$$p_d=e}static get observedAttributes(){return In(e).map(l=>(e[l].attribute||l).toLowerCase())}};return In(e).forEach(l=>{rn(a.prototype,l,{get(){return this.$$c&&l in this.$$c?this.$$c[l]:this.$$d[l]},set(h){h=Pn(l,h,e),this.$$d[l]=h;var u=this.$$c;u&&(ve(u,l)?.get?u[l]=h:u.$set({[l]:h}))}})}),r.forEach(l=>{rn(a.prototype,l,{get(){return this.$$c?.[l]}})}),i&&(a=i(a)),t.element=a,a}function hl(t){return t.key==="ContextMenu"?!0:t.key==="F10"&&t.shiftKey===!0}function fl({key:t,activeIndex:e,count:n,direction:r}){if(n<=0)return null;const o=Br(e,n);return t===(r==="rtl"?"ArrowLeft":"ArrowRight")?(o+1)%n:t===(r==="rtl"?"ArrowRight":"ArrowLeft")?(o-1+n)%n:t==="Home"?0:t==="End"?n-1:null}function Br(t,e){return e<=0||!Number.isFinite(t)||t<0?0:Math.min(Math.trunc(t),e-1)}function dl(t,e){return t.bottom<0||t.top>e.height||t.right<0||t.left>e.width}var vl=2e3;function pl(t,e,n=vl){if(t===null)return!1;const r=e-t;return r<0?!0:r<n}function gl(t,e,n={width:0,height:0},r=8){const o=t.left+(t.right-t.left)/2-n.width/2,i=t.top-r-n.height,a=i<4&&t.bottom+r+n.height<=e.height,l=a?t.bottom+r:i;return{x:Vo(o,n.width,e.width,4),y:Vo(l,n.height,e.height,4),below:a}}function Vo(t,e,n,r){const o=n-e-r;return o<=r?r:Math.min(Math.max(t,r),o)}function ml(t){if(!t||typeof t!="object")return!1;const e=t;return!(typeof e.id!="string"||e.id.trim().length===0||typeof e.label!="string"||e.label.trim().length===0||e.label.length>40||typeof e.run!="function"||e.iconSvg!==void 0&&typeof e.iconSvg!="string"||e.tooltip!==void 0&&typeof e.tooltip!="string"||e.isAvailable!==void 0&&typeof e.isAvailable!="function")}function bl(t){if(typeof t.isAvailable!="function")return!0;try{return t.isAvailable()!==!1}catch(e){return console.warn(`[AnnotationToolbar] Selection action "${t.id}" failed its availability check:`,e),!1}}function wl(t){if(!Array.isArray(t))return[];const e=new Set,n=[];return t.forEach((r,o)=>{if(!ml(r)){console.warn(`[AnnotationToolbar] Ignoring invalid selection action at index ${o}. Expected { id, label, run } with valid types.`);return}if(e.has(r.id)){console.warn(`[AnnotationToolbar] Ignoring duplicate selection action id "${r.id}".`);return}bl(r)&&(e.add(r.id),n.push(r))}),n}function yl(t,e){if(!t)return!1;const n=e?.canRequestTool;if(typeof n!="function")return!1;try{return n.call(e,"textToSpeech")===!0}catch(r){return console.warn("[AnnotationToolbar] Read-aloud failed its availability check:",r),!1}}var kl=t=>{const e=[];for(const n of t){let r=n?.getRootNode?.();for(;wt(r);)e.includes(r)||e.push(r),r=r.host.getRootNode?.()}return e},Sl=(t,e)=>{const n=t.getComposedRanges;if(typeof n!="function"||e.length===0)return null;try{return n.call(t,{shadowRoots:e})[0]??null}catch{try{return n.call(t,...e)[0]??null}catch{return null}}},xl=t=>{const{startContainer:e,startOffset:n,endContainer:r,endOffset:o}=t,i=e.ownerDocument;if(!i)return null;try{const a=i.createRange();a.setStart(e,n);const l=e.getRootNode();if(r.getRootNode()===l)return a.setEnd(r,o),a;const h=ba(r,l);if(h)a.setEndBefore(h);else if(wt(l))a.setEnd(l,l.childNodes.length);else return null;return a}catch{return null}},$l=t=>{if(t.rangeCount===0)return null;const e=t.getRangeAt(0),n=Sl(t,kl([t.anchorNode,t.focusNode,e.startContainer,e.endContainer])),r=n?xl(n):null;return!n||!r?{range:e,text:t.toString()}:{range:r,text:n.startContainer.getRootNode()===n.endContainer.getRootNode()?t.toString():r.toString()}},jo=t=>{const e=t.startContainer,n=ma(e);if(!n)return null;const r=ka(n,e);return!nn(r,e)||!nn(r,t.endContainer)?null:r},Tl=Dt('<button class="pie-tool-annotation-toolbar__highlight-swatch svelte-1qnnvrt"><span class="pie-sr-only svelte-1qnnvrt"> </span></button>'),_l=Dt('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z"></path></svg></button>',1),El=Dt('<span class="pie-tool-annotation-toolbar__action-icon svelte-1qnnvrt" aria-hidden="true"></span>'),Al=Dt("<button><!></button>"),Cl=Dt('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!>',1),Nl=Dt('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--warning svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"></path></svg></button>'),Ml=Dt('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--danger svelte-1qnnvrt"> </button>'),Rl=Dt('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!> <!>',1),Ol=Dt('<div class="pie-tool-annotation-toolbar notranslate svelte-1qnnvrt" role="toolbar" translate="no" tabindex="-1"><!> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z"></path></svg></button> <!> <!> <!></div>'),Ll=Dt('<div style="display: none;" aria-hidden="true"></div> <!> <div role="status" aria-live="polite" aria-atomic="true" class="pie-sr-only svelte-1qnnvrt"> </div>',1),Wl={hash:"svelte-1qnnvrt",code:`.pie-tool-annotation-toolbar.svelte-1qnnvrt {position:fixed;z-index:4200;display:flex;gap:0.25rem;padding:0.5rem;border-radius:0.5rem;background:var(--pie-background, #fff);color:var(--pie-text, #111827);
211
+ `,go=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet"),mo=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet-adopted"),bo=t=>!!t&&typeof t.replaceSync=="function",Ta=()=>{const t=globalThis,e=t[go];if(bo(e))return e;const n=globalThis.CSSStyleSheet;if(typeof n!="function")return null;try{const r=new n;return bo(r)?(r.replaceSync(zo),t[go]=r,r):null}catch{return null}},ze=t=>{const e=t?.getRootNode?.();if(!yt(e))return;const n=e,r=n.adoptedStyleSheets;if(!r||typeof r!="object")return;const o=Array.from(r),i=n[mo];if(i&&o.includes(i))return;const a=Ta();if(a)try{n.adoptedStyleSheets=[...o,a],n[mo]=a}catch{}},vr="tts-word",pr="tts-sentence",$e=t=>`annotation-${t}`,ae=t=>{const e=CSS.highlights.get(t);if(e)return e;const n=new Highlight;return CSS.highlights.set(t,n),n},Ue=(t,e)=>{const n=CSS.highlights.get(t);if(n)for(const r of e)n.delete(r)},yo=t=>{const e=t[0]?.startContainer;return e?e.nodeType===Node.ELEMENT_NODE?e:Er(e):null},Ft={source:null,override:null},Uo=class Nr{constructor(){if(dt(this,"ttsWordRanges",new Set),dt(this,"ttsSentenceRanges",new Set),dt(this,"ttsWordElementHighlights",new Set),dt(this,"ttsSentenceElementHighlights",new Set),dt(this,"annotations",new Map),dt(this,"ttsStyleSource",null),dt(this,"nextAnnotationId",1),dt(this,"supported",!1),dt(this,"rangeSerializer",void 0),dt(this,"themeObserver",null),this.rangeSerializer=new $a,typeof CSS>"u"||!("highlights"in CSS)){console.warn("CSS Custom Highlight API not supported (SSR or unsupported browser)");return}this.supported=!0,this.initializeHighlights(),this.registerStyles(),this.applyAdaptiveTTSStyle(),this.setupThemeObservation()}setupThemeObservation(){if(typeof document>"u"||typeof MutationObserver>"u")return;const e=document.getElementsByTagName("pie-theme"),n=new WeakSet,r=()=>{let i=!1;for(const a of e)n.has(a)||(n.add(a),o.observe(a,{attributes:!0,attributeFilter:["theme","scheme","provider","variables","style","data-theme","data-color-scheme"]}),i=!0);return i},o=new MutationObserver(i=>{(r()||i.some(a=>a.type==="attributes"))&&this.applyAdaptiveTTSStyle()});this.themeObserver=o,o.observe(document.documentElement,{attributes:!0,attributeFilter:["style","data-theme","data-color-scheme","class"]}),o.observe(document,{childList:!0,subtree:!0}),r()}parseColor(e){if(!e)return null;const n=e.trim();if(!n)return null;const r=/^#([a-f\d]{3}|[a-f\d]{6})$/i.exec(n);if(r){const i=r[1];return i.length===3?[parseInt(i[0]+i[0],16),parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16)]:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}const o=/^rgba?\((.+)\)$/i.exec(n);if(o){const i=o[1].replace(/\//g,",").split(/[,\s]+/).map(u=>u.trim()).filter(Boolean),a=Number(i[0]),l=Number(i[1]),h=Number(i[2]);if(Number.isFinite(a)&&Number.isFinite(l)&&Number.isFinite(h))return[a,l,h]}if(typeof document<"u"){const i=document.createElement("span");if(i.style.color=n,typeof i.style.color=="string"&&i.style.color){document.body?.appendChild(i);const a=typeof getComputedStyle=="function"?getComputedStyle(i).color:"";i.remove();const l=a.trim();if(l&&l!==n)return this.parseColor(a)}}return null}relativeLuminance([e,n,r]){const o=h=>{const u=h/255;return u<=.03928?u/12.92:((u+.055)/1.055)**2.4},i=o(e),a=o(n),l=o(r);return .2126*i+.7152*a+.0722*l}contrastRatio(e,n){const r=this.relativeLuminance(e),o=this.relativeLuminance(n),i=Math.max(r,o),a=Math.min(r,o);return(i+.05)/(a+.05)}blend(e,n,r){return[Math.round(e[0]*r+n[0]*(1-r)),Math.round(e[1]*r+n[1]*(1-r)),Math.round(e[2]*r+n[2]*(1-r))]}resolveAdaptiveTTSStyle(e){const n=[255,235,59],r=[17,24,39],o=[255,255,255],i=e||(typeof document<"u"?document.documentElement:null),a=i&&typeof getComputedStyle=="function"?getComputedStyle(i):null,l=this.parseColor(a?.getPropertyValue("--pie-background")||a?.backgroundColor)||o,h=this.parseColor(a?.getPropertyValue("--pie-text"))||r,u=Ft.override,f=u?this.parseColor(u.color)||n:this.parseColor(a?.getPropertyValue("--pie-missing"))||n,d=u?[Math.max(.3,Math.min(.95,u.opacity))]:[.8,.72,.68,.62,.56,.5];let p=d[d.length-1],m=-1/0;for(const D of d){const j=this.blend(f,l,D),K=this.contrastRatio(j,l),G=this.contrastRatio(j,h),X=K*1.2+G*.8;if(K>=1.25&&G>=2.4){p=D;break}X>m&&(m=X,p=D)}const b=Math.max(.24,Math.min(.85,p*.55)),x=Math.max(.55,Math.min(.95,p+.2)),g=Math.max(.22,Math.min(.6,p*.45)),k=h,I=this.blend(k,l,x),w=this.contrastRatio(I,l),_=this.relativeLuminance(l)>.45?[0,0,0]:[255,255,255],q=w>=1.35?k:_;return{wordHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${p})`,sentenceHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${b})`,wordUnderline:`rgba(${q[0]}, ${q[1]}, ${q[2]}, ${x})`,wordShadow:`rgba(${q[0]}, ${q[1]}, ${q[2]}, ${g})`}}applyAdaptiveTTSStyle(e){if(typeof document>"u")return;e&&(this.ttsStyleSource=e,Ft.source=e);const n=e??(Ft.source?.isConnected?Ft.source:null),r=this.resolveAdaptiveTTSStyle(n),o=document.documentElement.style,i=[["--pie-tts-word-highlight",r.wordHighlight],["--pie-tts-sentence-highlight",r.sentenceHighlight],["--pie-tts-line-highlight",r.sentenceHighlight],["--pie-tts-word-underline",r.wordUnderline],["--pie-tts-word-shadow",r.wordShadow]];for(const[a,l]of i)o.getPropertyValue?.(a)!==l&&o.setProperty(a,l)}initializeHighlights(){if(this.supported){ae(vr),ae(pr);for(const e of Object.values(Ot))ae($e(e))}}registerStyles(){if(!this.supported||typeof document>"u"||document.getElementById("pie-highlight-styles"))return;const e=document.createElement("style");e.id="pie-highlight-styles",e.textContent=zo,document.head.appendChild(e)}highlightTTSWord(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(yo(e)),this.clearTTSWord();const n=ae(vr);for(const r of e)ze(r.startContainer),n.add(r),this.ttsWordRanges.add(r);this.highlightTTSWordElementFallbacks(e.filter(r=>r.startContainer!==r.endContainer||r.startContainer.nodeType!==Node.TEXT_NODE))}highlightTTSWordElement(e){this.supported&&(this.applyAdaptiveTTSStyle(e),ze(e),this.clearTTSWord(),e.setAttribute("data-pie-tts-word-element","true"),this.ttsWordElementHighlights.add(e))}highlightTTSSentence(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(yo(e)),this.clearTTSSentence();const n=ae(pr);for(const r of e)ze(r.startContainer),n.add(r),this.ttsSentenceRanges.add(r);this.highlightTTSElementFallbacks(e)}highlightTTSSentenceElements(e){if(this.supported){this.applyAdaptiveTTSStyle(e[0]||null),this.clearTTSSentence();for(const n of e)ze(n),n.setAttribute("data-pie-tts-sentence-element","true"),this.ttsSentenceElementHighlights.add(n)}}highlightTTSElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-sentence-element",this.ttsSentenceElementHighlights,Nr.SENTENCE_FALLBACK_SELECTOR)}highlightTTSWordElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-word-element",this.ttsWordElementHighlights,Nr.WORD_FALLBACK_SELECTOR)}highlightElementFallbacks(e,n,r,o){const i=a=>a.nodeType===Node.ELEMENT_NODE?a:Er(a);for(const a of e){const l=a.commonAncestorContainer,h=yt(l)?l:i(l);if(!h)continue;const u=[],f=i(a.startContainer),d=i(a.endContainer);for(const p of[f,d]){let m=p;for(;m;)m.matches?.(o)&&u.push(m),m=Er(m)}!yt(h)&&h.matches?.(o)&&u.push(h),u.push(...Array.from(h.querySelectorAll(o)));for(const p of new Set(u)){try{if(!a.intersectsNode(p)&&!on(p,f)&&!on(p,d))continue}catch{continue}p.setAttribute(n,"true"),r.add(p)}}}clearTTSWord(){if(this.supported){Ue(vr,this.ttsWordRanges),this.ttsWordRanges.clear();for(const e of this.ttsWordElementHighlights)e.removeAttribute("data-pie-tts-word-element");this.ttsWordElementHighlights.clear()}}clearTTSSentence(){if(this.supported){Ue(pr,this.ttsSentenceRanges),this.ttsSentenceRanges.clear();for(const e of this.ttsSentenceElementHighlights)e.removeAttribute("data-pie-tts-sentence-element");this.ttsSentenceElementHighlights.clear()}}clearTTS(){this.clearTTSWord(),this.clearTTSSentence(),Ft.source===this.ttsStyleSource&&(Ft.source=null),this.ttsStyleSource=null}addAnnotation(e,n=Ot.YELLOW){const r=`annotation-${this.nextAnnotationId++}`,o=e.cloneRange();ze(o.startContainer);const i={id:r,range:o,type:Ar.ANNOTATION,color:n,timestamp:Date.now()};return this.annotations.set(r,i),this.supported&&ae($e(n)).add(o),r}removeAnnotation(e){const n=this.annotations.get(e);if(!n){console.warn(`[HighlightCoordinator] Annotation ${e} not found`);return}this.supported&&Ue($e(n.color),[n.range]),this.annotations.delete(e)}clearAnnotations(){if(this.supported)for(const e of this.annotations.values())Ue($e(e.color),[e.range]);this.annotations.clear()}getAnnotations(){return Array.from(this.annotations.values())}getAnnotation(e){return this.annotations.get(e)??null}changeAnnotationColor(e,n){const r=this.annotations.get(e);if(!r)return;const o=r.color;o!==n&&(r.color=n,this.supported&&(Ue($e(o),[r.range]),ae($e(n)).add(r.range)))}exportAnnotations(e=document.body){return this.getAnnotations().map(n=>({...this.rangeSerializer.serialize(n.range,e),id:n.id,color:n.color,timestamp:n.timestamp}))}importAnnotations(e,n=document.body){let r=0;for(const o of e){const i=this.rangeSerializer.deserialize(o,n);i&&(this.addAnnotation(i,o.color),r++)}return r}clearAll(){this.supported&&(this.clearTTS(),this.clearAnnotations())}updateTTSHighlightStyle(e,n){if(!this.supported||typeof document>"u"||!document.getElementById("pie-highlight-styles"))return;const o=(i=>{const a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null})(e);o&&(Ft.override={color:`rgb(${o.r}, ${o.g}, ${o.b})`,opacity:Math.max(.2,Math.min(.95,n)),owner:this},this.applyAdaptiveTTSStyle())}destroy(){this.supported&&(this.clearTTS(),this.clearAnnotations(),Ft.override?.owner===this&&(Ft.override=null),this.themeObserver?.disconnect(),this.themeObserver=null)}};dt(Uo,"SENTENCE_FALLBACK_SELECTOR","math, mjx-container, svg, img, canvas, [role='img']");dt(Uo,"WORD_FALLBACK_SELECTOR","svg, img, canvas, [role='img']");if(typeof window<"u"){var wo,ko;((wo=(ko=window).__svelte??(ko.__svelte={})).v??(wo.v=new Set)).add("5")}var Gt={},U=Symbol("uninitialized"),_a="http://www.w3.org/2000/svg",Ea="http://www.w3.org/1998/Math/MathML",Ko=Array.isArray,Aa=Array.prototype.indexOf,Dn=Array.prototype.includes,Yn=Array.from,Hn=Object.keys,an=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,Na=Object.getOwnPropertyDescriptors,Ca=Object.prototype,Ma=Array.prototype,Go=Object.getPrototypeOf,So=Object.isExtensible,Ra=()=>{};function Oa(t){for(var e=0;e<t.length;e++)t[e]()}function Xo(){var t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function sn(t){"@babel/helpers - typeof";return sn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sn(t)}function La(t,e){if(sn(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(sn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wa(t){var e=La(t,"string");return sn(e)=="symbol"?e:e+""}function P(t,e,n){return(e=Wa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pt=1024,Tt=2048,ke=4096,Ur=8192,Jo=16384,Kr=32768,Cr=1<<25,Gr=65536,qe=1<<19,Pa=1<<20,tn=1<<25,xo=1<<21,Ia=1<<22,jn=1<<23,en=Symbol("$state"),Zo=Symbol("component"),Yo=Symbol("legacy props"),qa=Symbol(""),Mr=Symbol("attributes"),Rr=Symbol("class"),Or=Symbol("style"),Pn=Symbol("text"),dn=new class extends Error{constructor(...t){super(...t),P(this,"name","StaleReactionError"),P(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},Da=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Ha(){console.warn("https://svelte.dev/e/derived_inert")}function vn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function ja(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var A=!1;function zt(t){A=t}var M;function Y(t){if(t===null)throw vn(),Gt;return M=t}function Oe(){return Y(_t(M))}function Je(t){if(A){if(_t(M)!==null)throw vn(),Gt;M=t}}function Fa(t=1){if(A){for(var e=t,n=M;e--;)n=_t(n);M=n}}function Fn(t=!0){for(var e=0,n=M;;){if(n.nodeType===8){var r=n.data;if(r==="]"){if(e===0)return n;e-=1}else(r==="["||r==="[!"||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(e+=1)}var o=_t(n);t&&n.remove(),n=o}}function Xr(t){if(!t||t.nodeType!==8)throw vn(),Gt;return t.data}function Qo(t){return t===this.v}function Va(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function ti(t){return!Va(t,this.v)}function Ba(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function za(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ua(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ka(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ga(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Xa(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ja(){throw new Error("https://svelte.dev/e/hydration_failed")}function Za(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ya(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Qa(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ts(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function es(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var pn=!1,Qn=!1,V=null;function Le(t){V=t}function ei(t,e=!1,n){V={p:V,i:!1,c:null,e:null,s:t,x:null,r:E,l:Qn&&!e?{s:null,u:null,$:[]}:null}}function ni(t){var e=V,n=e.e;if(n!==null){e.e=null;for(var r of n)xi(r)}return t!==void 0&&(e.x=t),e.i=!0,V=e.p,Jr(t)}function Jr(t={}){return an(t,Zo,{value:!0}),t}function gn(){return!Qn||V!==null&&V.l===null}var fe=[];function ri(){var t=fe;fe=[],Oa(t)}function oe(t){if(fe.length===0&&!nn){var e=fe;queueMicrotask(()=>{e===fe&&ri()})}fe.push(t)}function ns(){for(;fe.length>0;)ri()}var rs=~(Tt|ke|pt);function B(t,e){t.f=t.f&rs|e}function Zr(t){(t.f&512)!==0||t.deps===null?B(t,pt):B(t,ke)}function oi(t,e,n){(t.f&2048)!==0?e.add(t):t.f&4096&&n.add(t),B(t,pt)}function tr(t){var e=N,n=E;mt(null),qt(null);try{return t()}finally{mt(e),qt(n)}}function os(t,e,n,r){const o=gn()?ln:Yr;var i=t.filter(m=>!m.settled),a=e.map(o);if(n.length===0&&i.length===0){r(a);return}var l=E,h=is(),u=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(m=>m.promise)):null;function f(m){if((l.f&16384)===0){h();try{r([...a,...m])}catch(b){It(b,l)}Vn()}}var d=ii();if(n.length===0){u.then(()=>f([])).finally(d);return}function p(){Promise.all(n.map(m=>as(m))).then(f).catch(m=>It(m,l)).finally(d)}u?u.then(()=>{if((l.f&16384)!==0){d();return}h(),p(),Vn()}):p()}function is(){var t=E,e=N,n=V,r=C;return function(o=!0){qt(t),mt(e),Le(n),o&&!(t.f&16384)&&(r?.activate(),r?.apply())}}function Vn(t=!0){qt(null),mt(null),Le(null),t&&C?.deactivate()}function ii(){var t=E,e=t.b,n=C,r=!!e?.is_rendered();return e?.update_pending_count(1,n),n.increment(r,t),()=>{e?.update_pending_count(-1,n),n.decrement(r,t)}}function ln(t){var e=2|Tt;return E!==null&&(E.f|=qe),{ctx:V,deps:null,effects:null,equals:Qo,f:e,fn:t,reactions:null,rv:0,v:U,wv:0,parent:E,ac:null}}var Ze=Symbol("obsolete");function as(t,e,n){let r=E;r===null&&Ba();var o=void 0,i=we(U),a=!N,l=new Set;return Ss(()=>{var h=E,u=Xo();o=u.promise;try{Promise.resolve(t()).then(u.resolve,m=>{m!==dn&&u.reject(m)}).finally(Vn)}catch(m){u.reject(m),Vn()}var f=C;if(a){if((h.f&32768)!==0)var d=ii();if(r.b?.is_rendered())f.async_deriveds.get(h)?.reject(Ze);else for(const m of l.values())m.reject(Ze);l.add(u),f.async_deriveds.set(h,u)}const p=(m,b=void 0)=>{d?.(),l.delete(u),b!==Ze&&(f.activate(),b?(i.f|=jn,Pe(i,b)):(i.f&8388608&&(i.f^=jn),Pe(i,m)),f.deactivate())};u.promise.then(p,m=>p(null,m||"unknown"))}),ys(()=>{for(const h of l)h.reject(Ze)}),new Promise(h=>{function u(f){function d(){f===o?h(i):u(o)}f.then(d,d)}u(o)})}function ht(t){const e=ln(t);return Ci(e),e}function Yr(t){const e=ln(t);return e.equals=ti,e}function ss(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)nt(e[n])}}function Qr(t){var e,n=E,r=t.parent;if(!Xt&&r!==null&&t.v!==U&&(r.f&24576)!==0)return Ha(),t.v;qt(r);try{ss(t),e=Li(t)}finally{qt(n)}return e}function ai(t){var e=Qr(t);if(!t.equals(e)&&(t.wv=Ri(),(!C?.is_fork||t.deps===null)&&(C!==null?(C.capture(t,e,!0),Me?.capture(t,e,!0)):t.v=e,t.deps===null))){B(t,pt);return}Xt||(et!==null?(eo()||C?.is_fork)&&et.set(t,e):Zr(t))}function ls(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&tr(()=>{e.ac.abort(dn),e.ac=null}),e.fn!==null&&(e.teardown=Ra),hn(e,0),oo(e))}function si(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&Ie(e)}function li(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function to(t,e){li(t,e),e.add(t)}function T(t,e,n){li(t,e),e.set(t,n)}function $(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function S(t,e,n){return t.set($(t,e),n),n}function c(t,e){return t.get($(t,e))}var ci,Lr=null,Te=null,C=null,Me=null,et=null,Wr=null,nn=!1,gr=!1,cn=null,Bn=null,ui=0,cs=1,Pr=new WeakMap,ge=new WeakMap,Ne=new WeakMap,zn=new WeakMap,En=new WeakMap,_e=new WeakMap,ue=new WeakMap,Ye=new WeakMap,Lt=new WeakMap,$o=new WeakMap,We=new WeakMap,Ut=new WeakMap,ne=new WeakMap,mr=new WeakMap,An=new WeakMap,z=new WeakSet,Se=class hi{constructor(){to(this,z),P(this,"id",cs++),T(this,Pr,!1),P(this,"linked",!0),T(this,ge,null),T(this,Ne,null),P(this,"async_deriveds",new Map),P(this,"current",new Map),P(this,"previous",new Map),T(this,zn,new Set),T(this,En,new Set),T(this,_e,0),T(this,ue,new Map),T(this,Ye,null),T(this,Lt,[]),T(this,$o,[]),T(this,We,new Set),T(this,Ut,new Set),T(this,ne,new Map),T(this,mr,new Set),P(this,"is_fork",!1),T(this,An,!1),Te===null?Lr=Te=this:(S(Ne,Te,this),S(ge,this,Te)),Te=this}skip_effect(e){c(ne,this).has(e)||c(ne,this).set(e,{d:[],m:[]}),c(mr,this).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=c(ne,this).get(e);if(r){c(ne,this).delete(e);for(var o of r.d)B(o,Tt),n(o);for(o of r.m)B(o,ke),n(o)}c(mr,this).add(e)}capture(e,n,r=!1){e.v!==U&&!this.previous.has(e)&&this.previous.set(e,e.v),!(e.f&8388608)&&(this.current.set(e,[n,r]),et?.set(e,n)),this.is_fork||(e.v=n)}activate(){C=this}deactivate(){C=null,et=null}flush(){try{gr=!0,C=this,$(z,this,Un).call(this)}finally{ui=0,Wr=null,cn=null,Bn=null,gr=!1,C=null,et=null,Pt.clear()}}discard(){for(const e of c(En,this))e(this);c(En,this).clear();for(const e of this.async_deriveds.values())e.reject(Ze);$(z,this,Kn).call(this),c(Ye,this)?.resolve()}register_created_effect(e){c($o,this).push(e)}increment(e,n){if(S(_e,this,c(_e,this)+1),e){let r=c(ue,this).get(n)??0;c(ue,this).set(n,r+1)}}decrement(e,n){if(S(_e,this,c(_e,this)-1),e){let r=c(ue,this).get(n)??0;r===1?c(ue,this).delete(n):c(ue,this).set(n,r-1)}c(An,this)||(S(An,this,!0),oe(()=>{S(An,this,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)c(We,this).add(r);for(const r of n)c(Ut,this).add(r);e.clear(),n.clear()}oncommit(e){c(zn,this).add(e)}ondiscard(e){c(En,this).add(e)}settled(){return(c(Ye,this)??S(Ye,this,Xo())).promise}static ensure(){if(C===null){const e=C=new hi;!gr&&!nn&&oe(()=>{c(Pr,e)||e.flush()})}return C}apply(){if(!pn||!this.is_fork&&c(ge,this)===null&&c(Ne,this)===null){et=null;return}et=new Map;for(const[n,[r]]of this.current)et.set(n,r);for(let n=Lr;n!==null;n=c(Ne,n))if(!(n===this||n.is_fork)){var e=!1;if(n.id<this.id){for(const[r,[,o]]of n.current)if(!o&&this.current.has(r)){e=!0;break}}if(!e)for(const[r,o]of n.previous)et.has(r)||et.set(r,o)}}schedule(e){if(Wr=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}c(Lt,this).push(e)}};ci=Se;function To(){if(this.is_fork)return!0;for(const n of c(ue,this).keys()){for(var t=n,e=!1;t.parent!==null;){if(c(ne,this).has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}function us(){var t=[];for(const o of c(Lt,this))if(!((o.f&16384)!==0||(o.f&6144)===0)){for(var e=o,n=!1;e.parent!==null;){e=e.parent;var r=e.f;if((r&96)!==0){if((r&1024)===0){n=!0;break}e.f^=pt}}n||t.push(e)}return S(Lt,this,[]),t}function Un(){S(Pr,this,!0);for(const a of c(We,this))c(Ut,this).delete(a),B(a,Tt),this.schedule(a);for(const a of c(Ut,this))B(a,ke),this.schedule(a);this.apply();for(var t=cn=[],e=[],n=Bn=[];c(Lt,this).length>0;){ui++>1e3&&($(z,this,Kn).call(this),vs());for(const a of $(z,this,us).call(this))try{$(z,this,hs).call(this,a,t,e)}catch(l){throw vi(a),$(z,this,To).call(this)||this.discard(),l}}if(C=null,n.length>0){var r=ci.ensure();for(const a of n)r.schedule(a)}if(cn=null,Bn=null,$(z,this,To).call(this)){$(z,this,Nn).call(this,e),$(z,this,Nn).call(this,t);for(const[a,l]of c(ne,this))di(a,l);n.length>0&&$(z,C,Un).call(C);return}const o=$(z,this,fs).call(this);if(o){$(z,this,Nn).call(this,e),$(z,this,Nn).call(this,t),$(z,o,ds).call(o,this);return}c(We,this).clear(),c(Ut,this).clear();for(const a of c(zn,this))a(this);c(zn,this).clear(),Me=this,_o(e),_o(t),Me=null,c(Ye,this)?.resolve();var i=C;if(c(_e,this)===0&&(c(Lt,this).length===0||i!==null)&&$(z,this,Kn).call(this),c(Lt,this).length>0)if(i!==null){for(const a of c(Lt,this))c(Lt,i).push(a);S(Lt,this,[])}else i=this;i!==null&&(Pt.clear(),$(z,i,Un).call(i))}function hs(t,e,n){t.f^=pt;for(var r=t.first;r!==null;){var o=r.f,i=(o&96)!==0;if(!(i&&(o&1024)!==0||(o&8192)!==0||c(ne,this).has(r))&&r.fn!==null){i?r.f^=pt:(o&4)!==0?e.push(r):pn&&(o&16777224)!==0?n.push(r):mn(r)&&(o&16&&c(Ut,this).add(r),Ie(r));var a=r.first;if(a!==null){r=a;continue}}for(;r!==null;){var l=r.next;if(l!==null){r=l;break}r=r.parent}}}function fs(){for(var t=c(ge,this);t!==null;){if(!t.is_fork){for(const[e,[,n]]of this.current)if(t.current.has(e)&&!n)return t}t=c(ge,t)}return null}function ds(t){for(const[n,r]of t.current)!this.previous.has(n)&&t.previous.has(n)&&this.previous.set(n,t.previous.get(n)),this.current.set(n,r);for(const[n,r]of t.async_deriveds){const o=this.async_deriveds.get(n);o&&r.promise.then(o.resolve).catch(o.reject)}t.async_deriveds.clear(),this.transfer_effects(c(We,t),c(Ut,t));const e=n=>{var r=n.reactions;if(r!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(const a of r){var o=a.f;if((o&2)!==0)e(a);else{var i=a;o&4194320&&!this.async_deriveds.has(i)&&(c(Ut,this).delete(i),B(i,Tt),this.schedule(i))}}};for(const n of this.current.keys())e(n);this.oncommit(()=>t.discard()),$(z,t,Kn).call(t),C=this,$(z,this,Un).call(this)}function Nn(t){for(var e=0;e<t.length;e+=1)oi(t[e],c(We,this),c(Ut,this))}function Kn(){if(this.linked){var t=c(ge,this),e=c(Ne,this);t===null?Lr=e:S(Ne,t,e),e===null?Te=t:S(ge,e,t),this.linked=!1}}function un(t){var e=nn,n=Me;Me=null,nn=!0;try{var r;for(t&&(un(),r=t());;){if(ns(),C===null)return r;C.flush()}}finally{nn=e,Me=n}}function vs(){try{Xa()}catch(t){It(t,Wr)}}var Rt=null;function _o(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&24576)===0&&mn(r)&&(Rt=new Set,Ie(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Ei(r),Rt?.size>0)){Pt.clear();for(const o of Rt){if((o.f&24576)!==0)continue;const i=[o];let a=o.parent;for(;a!==null;)Rt.has(a)&&(Rt.delete(a),i.push(a)),a=a.parent;for(let l=i.length-1;l>=0;l--){const h=i[l];!(h.f&24576)&&Ie(h)}}Rt.clear()}}Rt=null}}function fi(t){C.schedule(t)}function di(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):t.f&4096&&e.m.push(t),B(t,pt);for(var n=t.first;n!==null;)di(n,e),n=n.next}}function vi(t){B(t,pt);for(var e=t.first;e!==null;)vi(e),e=e.next}var Gn=new Set,Pt=new Map,pi=!1;function we(t,e){return{f:0,v:t,reactions:null,equals:Qo,rv:0,wv:0}}function F(t,e){const n=we(t,e);return Ci(n),n}function gi(t,e=!1,n=!0){const r=we(t);if(e||(r.equals=ti),Qn&&n&&V!==null&&V.l!==null){var o;((o=V.l).s??(o.s=[])).push(r)}return r}function O(t,e,n=!1){return N!==null&&(!wt||N.f&131072)&&gn()&&N.f&4325394&&(St===null||!St.has(t))&&ts(),Pe(t,n?de(e):e,Bn)}var he=null,Ir=0;function Pe(t,e,n=null){if(!t.equals(e)){Xt?Pt.set(t,e):Pt.has(t)||Pt.set(t,t.v);var r=Se.ensure();if(r.capture(t,e),(t.f&2)!==0){const o=t;t.f&2048&&Qr(o),et===null&&Zr(o)}t.wv=Ri(),he=null,Ir=0,mi(t,Tt,n),he=null,gn()&&E!==null&&E.f&1024&&!(E.f&96)&&(vt===null?Ts([t]):vt.push(t)),!r.is_fork&&Gn.size>0&&!pi&&ps()}return e}function ps(){pi=!1;for(const t of Gn){t.f&1024&&B(t,ke);let e;try{e=mn(t)}catch{e=!0}e&&Ie(t)}Gn.clear()}function rn(t){O(t,t.v+1)}function mi(t,e,n){var r=t.reactions;if(r!==null){var o=gn(),i=r.length;if(Ir+=i,Ir>1e5&&he===null&&(he=new Set),he!==null){if(he.has(t))return;he.add(t)}for(var a=0;a<i;a++){var l=r[a],h=l.f;if(!(!o&&l===E)){var u=(h&Tt)===0;if(u&&B(l,e),(h&131072)!==0)Gn.add(l);else if((h&2)!==0){var f=l;et?.delete(f),mi(f,ke,n)}else if(u){var d=l;h&16&&Rt!==null&&Rt.add(d),n!==null?n.push(d):fi(d)}}}}}function de(t){if(typeof t!="object"||t===null||en in t||Zo in t)return t;const e=Go(t);if(e!==Ca&&e!==Ma)return t;var n=new Map,r=Ko(t),o=F(0),i=null,a=me,l=h=>{if(me===a)return h();var u=N,f=me;mt(null),No(a);var d=h();return mt(u),No(f),d};return r&&n.set("length",F(t.length,i)),new Proxy(t,{defineProperty(h,u,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ya();var d=n.get(u);return d===void 0?l(()=>{var p=F(f.value,i);return n.set(u,p),p}):O(d,f.value,!0),!0},deleteProperty(h,u){var f=n.get(u);if(f===void 0){if(u in h){const d=l(()=>F(U,i));n.set(u,d),rn(o)}}else O(f,U),rn(o);return!0},get(h,u,f){if(u===en)return t;var d=n.get(u),p=u in h;if(d===void 0&&(!p||pe(h,u)?.writable)&&(d=l(()=>F(de(p?h[u]:U),i)),n.set(u,d)),d!==void 0){var m=s(d);return m===U?void 0:m}return Reflect.get(h,u,f)},getOwnPropertyDescriptor(h,u){this.has?.(h,u);var f=Reflect.getOwnPropertyDescriptor(h,u),d=n.get(u);if(d!==void 0){var p=s(d);if(p===U)return;if(f&&"value"in f)f.value=p;else return{enumerable:!0,configurable:!0,value:p,writable:!0}}return f},has(h,u){if(u===en)return!0;var f=n.get(u),d=f!==void 0&&f.v!==U||Reflect.has(h,u);return(f!==void 0||E!==null&&(!d||pe(h,u)?.writable))&&(f===void 0&&(f=l(()=>F(d?de(h[u]):U,i)),n.set(u,f)),s(f)===U)?!1:d},set(h,u,f,d){var p=n.get(u),m=u in h;if(r&&u==="length")for(var b=f;b<p.v;b+=1){var x=n.get(b+"");x!==void 0?O(x,U):b in h&&(x=l(()=>F(U,i)),n.set(b+"",x))}if(p===void 0)(!m||pe(h,u)?.writable)&&(p=l(()=>F(void 0,i)),O(p,de(f)),n.set(u,p));else{m=p.v!==U;var g=l(()=>de(f));O(p,g)}var k=Reflect.getOwnPropertyDescriptor(h,u);if(k?.set&&k.set.call(d,f),!m){if(r&&typeof u=="string"){var I=n.get("length"),w=Number(u);Number.isInteger(w)&&w>=I.v&&O(I,w+1)}rn(o)}return!0},ownKeys(h){s(o);var u=Reflect.ownKeys(h).filter(p=>{var m=n.get(p);return m===void 0||m.v!==U});for(var[f,d]of n)d.v!==U&&!(f in h)&&u.push(f);return u},setPrototypeOf(){Qa()}})}var Eo,bi,yi,wi;function qr(){if(Eo===void 0){Eo=window,bi=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;yi=pe(e,"firstChild").get,wi=pe(e,"nextSibling").get,So(t)&&(t[Rr]=void 0,t[Mr]=null,t[Or]=void 0,t.__e=void 0),So(n)&&(n[Pn]=void 0)}}function lt(t=""){return document.createTextNode(t)}function st(t){return yi.call(t)}function _t(t){return wi.call(t)}function In(t,e){if(!A)return st(t);var n=st(M);if(n===null)n=M.appendChild(lt());else if(e&&n.nodeType!==3){var r=lt();return n?.before(r),Y(r),r}return e&&nr(n),Y(n),n}function Cn(t,e=!1){if(!A){var n=st(t);return n instanceof Comment&&n.data===""?_t(n):n}if(e){if(M?.nodeType!==3){var r=lt();return M?.before(r),Y(r),r}nr(M)}return M}function br(t,e=!1){if(!A)return st(t);var n=In(t,e);return Je(t),n}function Ct(t,e=1,n=!1){let r=A?M:t;for(var o;e--;)o=r,r=_t(r);if(!A)return r;if(n){if(r?.nodeType!==3){var i=lt();return r===null?o?.after(i):r.before(i),Y(i),i}nr(r)}return Y(r),r}function ki(t){t.textContent=""}function Si(){return!pn||Rt!==null?!1:(E.f&Kr)!==0}function er(t,e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?n?document.createElement(t,{is:n}):document.createElement(t):n?document.createElementNS(e,t,{is:n}):document.createElementNS(e,t)}function nr(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===3;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function gs(t){var e=E;if(e===null)return N.f|=jn,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;It(t,e)}function It(t,e){if(t===Gt)throw t;if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}function ms(t){E===null&&(N===null&&Ga(t),Ka()),Xt&&Ua(t)}function bs(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Dt(t,e){var n=E;n!==null&&n.f&8192&&(t|=Ur);var r={ctx:V,deps:null,nodes:null,f:t|Tt|512,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};C?.register_created_effect(r);var o=r;if((t&4)!==0)cn!==null?cn.push(r):Se.ensure().schedule(r);else if(e!==null){try{Ie(r)}catch(a){throw nt(r),a}o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&!(o.f&524288)&&(o=o.first,t&16&&t&65536&&o!==null&&(o.f|=Gr))}if(o!==null&&(o.parent=n,n!==null&&bs(o,n),N!==null&&(N.f&2)!==0&&(t&64)===0)){var i=N;(i.effects??(i.effects=[])).push(o)}return r}function eo(){return N!==null&&!wt}function ys(t){const e=Dt(8,null);return B(e,pt),e.teardown=t,e}function Ke(t){ms("$effect");var e=E.f;if(!N&&(e&32)!==0&&V!==null&&!V.i){var n=V;(n.e??(n.e=[])).push(t)}else return xi(t)}function xi(t){return Dt(4|Pa,t)}function ws(t){Se.ensure();const e=Dt(64|qe,t);return()=>{nt(e)}}function ks(t){Se.ensure();const e=Dt(64|qe,t);return(n={})=>new Promise(r=>{n.outro?xe(e,()=>{nt(e),r(void 0)}):(nt(e),r(void 0))})}function $i(t){return Dt(4,t)}function Ss(t){return Dt(Ia|qe,t)}function no(t,e=0){return Dt(8|e,t)}function Bt(t,e=[],n=[],r=[]){os(r,e,n,o=>{Dt(8,()=>{t(...o.map(s))})})}function ro(t,e=0){return Dt(16|e,t)}function gt(t){return Dt(32|qe,t)}function Ti(t){var e=t.teardown;if(e!==null){const n=Xt,r=N;Ao(!0),mt(null);try{e.call(null)}catch(o){It(o,t.parent)}finally{Ao(n),mt(r)}}}function oo(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const o=n.ac;o!==null&&tr(()=>{o.abort(dn)});var r=n.next;(n.f&64)!==0?n.parent=null:nt(n,e),n=r}}function xs(t){for(var e=t.first;e!==null;){var n=e.next;!(e.f&32)&&nt(e),e=n}}function nt(t,e=!0){var n=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(_i(t.nodes.start,t.nodes.end),n=!0),t.f|=Cr,oo(t,e&&!n),hn(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const i of r)i.stop();Ti(t),t.f^=Cr,t.f|=Jo;var o=t.parent;o!==null&&o.first!==null&&Ei(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function _i(t,e){for(;t!==null;){var n=t===e?null:_t(t);t.remove(),t=n}}function Ei(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function xe(t,e,n=!0){var r=[];t.f|=256,Ai(t,r,!0);var o=()=>{n&&nt(t),e&&e()},i=r.length;if(i>0){var a=()=>--i||o();for(var l of r)l.out(a)}else o()}function Ai(t,e,n){if((t.f&8192)===0){t.f^=Ur;var r=t.nodes&&t.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&e.push(l);for(var o=t.first;o!==null;){var i=o.next;if((o.f&64)===0){var a=(o.f&65536)!==0||(o.f&32)!==0&&(t.f&16)!==0;Ai(o,e,a?n:!1)}o=i}}}function Xn(t){t.f&=-257,Ni(t,!0)}function Ni(t,e){if((t.f&256)===0&&(t.f&8192)!==0){t.f^=Ur,!(t.f&1024)&&(B(t,Tt),Se.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,o=(n.f&65536)!==0||(n.f&32)!==0;Ni(n,o?e:!1),n=r}var i=t.nodes&&t.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&a.in()}}function io(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var o=n===r?null:_t(n);e.append(n),n=o}}var $s=null,Xt=!1;function Ao(t){Xt=t}var N=null,wt=!1;function mt(t){N=t}var E=null;function qt(t){E=t}var St=null;function Ci(t){N!==null&&(N.f&2097152||N.f&2)&&(St??(St=new Set)).add(t)}var rt=null,at=0,vt=null;function Ts(t){vt=t}var Mi=1,ve=0,me=ve;function No(t){me=t}function Ri(){return++Mi}function mn(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var n=t.deps,r=n.length,o=0;o<r;o++){var i=n[o];if(mn(i)&&ai(i),i.wv>t.wv)return!0}e&512&&et===null&&B(t,pt)}return!1}function Oi(t,e,n=!0){var r=t.reactions;if(r!==null&&!(!pn&&St!==null&&St.has(t)))for(var o=0;o<r.length;o++){var i=r[o];(i.f&2)!==0?Oi(i,e,!1):e===i&&(n?B(i,Tt):i.f&1024&&B(i,ke),fi(i))}}function Li(t){var e=rt,n=at,r=vt,o=N,i=St,a=V,l=wt,h=me,u=t.f;rt=null,at=0,vt=null,N=(u&96)===0?t:null,St=null,Le(t.ctx),wt=!1,me=++ve,t.ac!==null&&(tr(()=>{t.ac.abort(dn)}),t.ac=null);try{t.f|=xo;var f=t.fn,d=f();t.f|=Kr;var p=Co(t);if(gn()&&vt!==null&&!wt&&p!==null&&(t.f&6146)===0)for(var m=0;m<vt.length;m++)Oi(vt[m],t);if(o!==null&&o!==t){if(ve++,o.deps!==null)for(let b=0;b<n;b+=1)o.deps[b].rv=ve;if(e!==null)for(const b of e)b.rv=ve;vt!==null&&(r===null?r=vt:r.push(...vt))}return t.f&8388608&&(t.f^=jn),d}catch(b){return Co(t),gs(b)}finally{t.f^=xo,rt=e,at=n,vt=r,N=o,St=i,Le(a),wt=l,me=h}}function Co(t){var e=t.deps,n=C?.is_fork;if(rt!==null){var r;if(n||hn(t,at),e!==null&&at>0)for(e.length=at+rt.length,r=0;r<rt.length;r++)e[at+r]=rt[r];else t.deps=e=rt;if(eo()&&(t.f&512)!==0)for(r=at;r<e.length;r++){var o;((o=e[r]).reactions??(o.reactions=[])).push(t)}}else!n&&e!==null&&at<e.length&&(hn(t,at),e.length=at);return e}function _s(t,e){let n=e.reactions;if(n!==null){var r=Aa.call(n,t);if(r!==-1){var o=n.length-1;o===0?n=e.reactions=null:(n[r]=n[o],n.pop())}}if(n===null&&(e.f&2)!==0&&(rt===null||!Dn.call(rt,e))){var i=e;i.f&512&&(i.f^=512),i.v!==U&&Zr(i),i.ac!==null&&tr(()=>{i.ac.abort(dn),i.ac=null,B(i,Tt)}),ls(i),hn(i,0)}}function hn(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)_s(t,n[r])}function Ie(t){var e=t.f;if((e&16384)===0){B(t,pt);var n=E;E=t;try{(e&16777232)!==0?xs(t):oo(t),Ti(t);var r=Li(t);t.teardown=typeof r=="function"?r:null,t.wv=Mi}finally{E=n}}}async function Es(){if(pn)return new Promise(t=>{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),un()}function s(t){var e=(t.f&2)!==0;if($s?.add(t),N!==null&&!wt&&!(E!==null&&(E.f&16384)!==0)&&(St===null||!St.has(t))){var n=N.deps;if((N.f&2097152)!==0)t.rv<ve&&(t.rv=ve,rt===null&&n!==null&&n[at]===t?at++:rt===null?rt=[t]:rt.push(t));else{var r;(r=N).deps??(r.deps=[]),Dn.call(N.deps,t)||N.deps.push(t);var o=t.reactions;o===null?t.reactions=[N]:Dn.call(o,N)||o.push(N)}}if(Xt&&Pt.has(t))return Pt.get(t);if(e){var i=t;if(Xt){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Pi(i))&&(a=Qr(i)),Pt.set(i,a),a}var l=(i.f&512)===0&&!wt&&N!==null&&(N.f&512)!==0,h=(i.f&Kr)===0;mn(i)&&(l&&(i.f|=512),ai(i)),l&&!h&&(si(i),Wi(i))}if(et?.has(t))return et.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function Wi(t){if(t.f|=512,t.deps!==null)for(const n of t.deps){var e=n.reactions;e===null?n.reactions=[t]:Dn.call(e,t)||e.push(t),n.f&2&&!(n.f&512)&&(si(n),Wi(n))}}function Pi(t){if(t.v===U)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Pt.has(e)||(e.f&2)!==0&&Pi(e))return!0;return!1}function Re(t){var e=wt;try{return wt=!0,t()}finally{wt=e}}var Ce=Symbol("events"),Ii=new Set,Dr=new Set;function Qt(t,e,n){(e[Ce]??(e[Ce]={}))[t]=n}function As(t){for(var e=0;e<t.length;e++)Ii.add(t[e]);for(var n of Dr)n(t)}var yr=null,wr=!1;function Mo(t){var e=this,n=e.ownerDocument,r=t.type,o=t.composedPath?.()||[],i=o[0]||t.target;yr=t,wr||(wr=!0,setTimeout(()=>{wr=!1,yr=null}));var a=0,l=yr===t&&t[Ce];if(l){var h=o.indexOf(l);if(h!==-1&&(e===document||e===window)){t[Ce]=e;return}var u=o.indexOf(e);if(u===-1)return;h<=u&&(a=h)}if(i=o[a]||t.target,i!==e){an(t,"currentTarget",{configurable:!0,get(){return i||n}});var f=N,d=E;mt(null),qt(null);try{for(var p,m=[];i!==null&&i!==e;){try{var b=i[Ce]?.[r];b!=null&&(!i.disabled||t.target===i)&&b.call(i,t)}catch(x){p?m.push(x):p=x}if(t.cancelBubble)break;a++,i=a<o.length?o[a]:null}if(p){for(let x of m)queueMicrotask(()=>{throw x});throw p}}finally{t[Ce]=e,delete t.currentTarget,mt(f),qt(d)}}}var Ns=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Cs(t){return Ns?.createHTML(t)??t}function Ms(t){var e=er("template");return e.innerHTML=Cs(t.replaceAll("<!>","<!---->")),e.content}function Kt(t,e){var n=E;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function Ht(t,e){var n=(e&1)!==0,r=(e&2)!==0,o,i=!t.startsWith("<!>");return()=>{if(A)return Kt(M,null),M;o===void 0&&(o=Ms(i?t:"<!>"+t),n||(o=st(o)));var a=r||bi?document.importNode(o,!0):o.cloneNode(!0);if(n){var l=st(a),h=a.lastChild;Kt(l,h)}else Kt(a,a);return a}}function Rs(t=""){if(!A){var e=lt(t+"");return Kt(e,e),e}var n=M;return n.nodeType!==3?(n.before(n=lt()),Y(n)):nr(n),Kt(n,n),n}function ft(t,e){if(A){var n=E;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=M),Oe();return}t!==null&&t.before(e)}var Os=["touchstart","touchmove"];function Ls(t){return Os.includes(t)}function Ws(t){let e=0,n=we(0),r;return()=>{eo()&&(s(n),no(()=>(e===0&&(r=Re(()=>t(()=>rn(n)))),e+=1,()=>{oe(()=>{e-=1,e===0&&(r?.(),r=void 0,rn(n))})})))}}var Ps=Gr|qe;function Is(t,e,n,r){new qs(t,e,n,r)}var xt=new WeakMap,Hr=new WeakMap,Wt=new WeakMap,fn=new WeakMap,ot=new WeakMap,$t=new WeakMap,ct=new WeakMap,kt=new WeakMap,re=new WeakMap,Ee=new WeakMap,be=new WeakMap,Mn=new WeakMap,jr=new WeakMap,Fr=new WeakMap,se=new WeakMap,Ro=new WeakMap,L=new WeakSet,qs=class{constructor(t,e,n,r){to(this,L),P(this,"parent",void 0),P(this,"is_pending",!1),P(this,"transform_error",void 0),T(this,xt,void 0),T(this,Hr,A?M:null),T(this,Wt,void 0),T(this,fn,void 0),T(this,ot,void 0),T(this,$t,null),T(this,ct,null),T(this,kt,null),T(this,re,null),T(this,Ee,0),T(this,be,0),T(this,Mn,!1),T(this,jr,new Set),T(this,Fr,new Set),T(this,se,null),T(this,Ro,Ws(()=>(S(se,this,we(c(Ee,this))),()=>{S(se,this,null)}))),S(xt,this,t),S(Wt,this,e),S(fn,this,o=>{var i=E;i.b=this,i.f|=128,n(o)}),this.parent=E.b,this.transform_error=r??this.parent?.transform_error??(o=>o),S(ot,this,ro(()=>{if(A){const o=Xr(c(Hr,this));Oe();const i=o==="[!";if(o.startsWith("[?")){const a=JSON.parse(o.slice(2));$(L,this,Hs).call(this,a)}else i?$(L,this,js).call(this):$(L,this,Ds).call(this)}else $(L,this,Di).call(this)},Ps)),A&&S(xt,this,M)}defer_effect(t){oi(t,c(jr,this),c(Fr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(Wt,this).pending}update_pending_count(t,e){$(L,this,Hi).call(this,t,e),S(Ee,this,c(Ee,this)+t),c(se,this)&&!c(Mn,this)&&(S(Mn,this,!0),oe(()=>{S(Mn,this,!1),c(se,this)&&Pe(c(se,this),c(Ee,this))}))}get_effect_pending(){return c(Ro,this).call(this),s(c(se,this))}error(t){if(t===Gt||!c(Wt,this).onerror&&!c(Wt,this).failed)throw t;C?.is_fork?(c($t,this)&&C.skip_effect(c($t,this)),c(ct,this)&&C.skip_effect(c(ct,this)),c(kt,this)&&C.skip_effect(c(kt,this)),C.oncommit(()=>{$(L,this,ye).call(this)||$(L,this,Oo).call(this,t)})):$(L,this,Oo).call(this,t)}};function Ds(){try{S($t,this,gt(()=>c(fn,this).call(this,c(xt,this))))}catch(t){this.error(t)}}function Hs(t){const e=c(Wt,this).failed,{reset:n,invoke_onerror:r}=$(L,this,qi).call(this,t);oe(r),e&&S(kt,this,gt(()=>{e(c(xt,this),()=>t,()=>n)}))}function qi(t){var e=!1,n=!1;const r=()=>{if(!$(L,this,ye).call(this)){if(e){ja();return}e=!0,n&&es(),c(kt,this)!==null&&xe(c(kt,this),()=>{S(kt,this,null)}),$(L,this,ao).call(this,()=>{$(L,this,Di).call(this)})}};return{reset:r,invoke_onerror:()=>{if(!$(L,this,ye).call(this))try{n=!0,c(Wt,this).onerror?.(t,r),n=!1}catch(o){It(o,c(ot,this)&&c(ot,this).parent)}}}}function ye(){return(c(ot,this).f&(Jo|Cr))!==0}function js(){const t=c(Wt,this).pending;t&&(this.is_pending=!0,S(ct,this,gt(()=>t(c(xt,this)))),oe(()=>{if(!$(L,this,ye).call(this)){var e=S(re,this,document.createDocumentFragment()),n=lt(),r=!1;if(e.append(n),S($t,this,$(L,this,ao).call(this,()=>{try{return gt(()=>c(fn,this).call(this,n))}catch(o){try{this.error(o),r=!0}catch(i){It(i,c(ot,this).parent)}return null}})),c($t,this)===null){S(re,this,null),r&&$(L,this,Jn).call(this,C);return}c(be,this)===0&&(c(xt,this).before(e),S(re,this,null),xe(c(ct,this),()=>{S(ct,this,null)}),$(L,this,Jn).call(this,C))}}))}function Di(){try{if(this.is_pending=this.has_pending_snippet(),S(be,this,0),S(Ee,this,0),S($t,this,gt(()=>{c(fn,this).call(this,c(xt,this))})),c(be,this)>0){var t=S(re,this,document.createDocumentFragment());io(c($t,this),t);const e=c(Wt,this).pending;S(ct,this,gt(()=>e(c(xt,this))))}else $(L,this,Jn).call(this,C)}catch(e){this.error(e)}}function Jn(t){this.is_pending=!1,t.transfer_effects(c(jr,this),c(Fr,this))}function ao(t){var e=E,n=N,r=V;qt(c(ot,this)),mt(c(ot,this)),Le(c(ot,this).ctx);try{return Se.ensure(),t()}finally{qt(e),mt(n),Le(r)}}function Hi(t,e){if(!this.has_pending_snippet()){if(this.parent){var n;$(L,n=this.parent,Hi).call(n,t,e)}return}S(be,this,c(be,this)+t),c(be,this)===0&&($(L,this,Jn).call(this,e),c(ct,this)&&xe(c(ct,this),()=>{S(ct,this,null)}),c(re,this)&&(c(xt,this).before(c(re,this)),S(re,this,null)))}function Oo(t){c($t,this)&&(nt(c($t,this)),S($t,this,null)),c(ct,this)&&(nt(c(ct,this)),S(ct,this,null)),c(kt,this)&&(nt(c(kt,this)),S(kt,this,null)),A&&(Y(c(Hr,this)),Fa(),Y(Fn()));let e=c(Wt,this).failed;const n=r=>{if($(L,this,ye).call(this))return;const{reset:o,invoke_onerror:i}=$(L,this,qi).call(this,r);i(),e&&!$(L,this,ye).call(this)&&S(kt,this,$(L,this,ao).call(this,()=>{try{return gt(()=>{var a=E;a.b=this,a.f|=128,e(c(xt,this),()=>r,()=>o)})}catch(a){return It(a,c(ot,this).parent),null}}))};oe(()=>{if(!$(L,this,ye).call(this)){var r;try{r=this.transform_error(t)}catch(o){It(o,c(ot,this)&&c(ot,this).parent);return}r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(n,o=>It(o,c(ot,this)&&c(ot,this).parent)):n(r)}})}function Rn(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[Pn]??(t[Pn]=t.nodeValue))&&(t[Pn]=n,t.nodeValue=`${n}`)}function ji(t,e){return Fi(t,e)}function Fs(t,e){qr(),e.intro=e.intro??!1;const n=e.target,r=A,o=M;try{for(var i=st(n);i&&(i.nodeType!==8||i.data!=="[");)i=_t(i);if(!i)throw Gt;zt(!0),Y(i);const a=Fi(t,{...e,anchor:i});return zt(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
212
+ `).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==Gt&&console.warn("Failed to hydrate: ",a),e.recover===!1&&Ja(),qr(),ki(n),zt(!1),ji(t,e)}finally{zt(r),Y(o)}}var On=new Map;function Fi(t,{target:e,anchor:n,props:r={},events:o,context:i,intro:a=!0,transformError:l}){qr();var h=void 0,u=ks(()=>{var f=n??e.appendChild(lt());Is(f,{pending:()=>{}},m=>{ei({});var b=V;if(i&&(b.c=i),o&&(r.$$events=o),A&&Kt(m,null),h=t(m,r)||Jr(),A&&(E.nodes.end=M,M===null||M.nodeType!==8||M.data!=="]"))throw vn(),Gt;ni()},l);var d=new Set,p=m=>{for(var b=0;b<m.length;b++){var x=m[b];if(!d.has(x)){d.add(x);var g=Ls(x);for(const w of[e,document]){var k=On.get(w);k===void 0&&(k=new Map,On.set(w,k));var I=k.get(x);I===void 0?(w.addEventListener(x,Mo,{passive:g}),k.set(x,1)):k.set(x,I+1)}}}};return p(Yn(Ii)),Dr.add(p),()=>{for(var m of d)for(const g of[e,document]){var b=On.get(g),x=b.get(m);--x==0?(g.removeEventListener(m,Mo),b.delete(m),b.size===0&&On.delete(g)):b.set(m,x)}Dr.delete(p),f!==n&&f.parentNode?.removeChild(f)}});return Vr.set(h,u),h}var Vr=new WeakMap;function Vs(t,e){const n=Vr.get(t);return n?(Vr.delete(t),n(e)):Promise.resolve()}var Vt=new WeakMap,te=new WeakMap,bt=new WeakMap,Ge=new WeakMap,kr=new WeakMap,Sr=new WeakMap,Lo=new WeakMap,Bs=class{constructor(t,e=!0){P(this,"anchor",void 0),T(this,Vt,new Map),T(this,te,new Map),T(this,bt,new Map),T(this,Ge,new Set),T(this,kr,!0),T(this,Sr,n=>{if(c(Vt,this).has(n)){var r=c(Vt,this).get(n),o=c(te,this).get(r);if(o)Xn(o),c(Ge,this).delete(r);else{var i=c(bt,this).get(r);i&&(Xn(i.effect),c(te,this).set(r,i.effect),c(bt,this).delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),o=i.effect)}for(const[a,l]of c(Vt,this)){if(c(Vt,this).delete(a),a===n)break;const h=c(bt,this).get(l);h&&(nt(h.effect),c(bt,this).delete(l))}for(const[a,l]of c(te,this)){if(a===r||c(Ge,this).has(a))continue;const h=()=>{if(Array.from(c(Vt,this).values()).includes(a)){var u=document.createDocumentFragment();io(l,u),u.append(lt()),c(bt,this).set(a,{effect:l,fragment:u})}else nt(l);c(Ge,this).delete(a),c(te,this).delete(a)};c(kr,this)||!o?(c(Ge,this).add(a),xe(l,h,!1)):h()}}}),T(this,Lo,n=>{c(Vt,this).delete(n);const r=Array.from(c(Vt,this).values());for(const[o,i]of c(bt,this))r.includes(o)||(nt(i.effect),c(bt,this).delete(o))}),this.anchor=t,S(kr,this,e)}ensure(t,e){var n=C,r=Si();if(e&&!c(te,this).has(t)&&!c(bt,this).has(t))if(r){var o=document.createDocumentFragment(),i=lt();o.append(i),c(bt,this).set(t,{effect:gt(()=>e(i)),fragment:o})}else c(te,this).set(t,gt(()=>e(this.anchor)));if(c(Vt,this).set(n,t),r){for(const[a,l]of c(te,this))a===t?n.unskip_effect(l):n.skip_effect(l);for(const[a,l]of c(bt,this))a===t?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(c(Sr,this)),n.ondiscard(c(Lo,this))}else A&&(this.anchor=M),c(Sr,this).call(this,n)}};function le(t,e,n=!1){var r;A&&(r=M,Oe());var o=new Bs(t),i=n?Gr:0;function a(l,h){if(A){var u=Xr(r);if(l!==parseInt(u.substring(1))){var f=Fn();Y(f),o.anchor=f,zt(!1),o.ensure(l,h),zt(!0);return}}o.ensure(l,h)}ro(()=>{var l=!1;e((h,u=0)=>{l=!0,a(u,h)}),l||a(-1,null)},i)}function zs(t,e){return e}function Us(t,e,n){for(var r=[],o=e.length,i,a=e.length,l=0;l<o;l++){let d=e[l];xe(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var p=t.outrogroups;Br(t,Yn(i.done)),p.delete(i),p.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var h=r.length===0&&n!==null&&t.pending.size===0;if(h){var u=n,f=u.parentNode;ki(f),f.append(u),t.items.clear()}Br(t,e,!h)}else i={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(i)}function Br(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const a of t.pending.values())for(const l of a)r.add(t.items.get(l).e)}for(var o=0;o<e.length;o++){var i=e[o];r?.has(i)?(i.f|=tn,io(i,document.createDocumentFragment())):nt(e[o],n)}}var Ln;function Wo(t,e,n,r,o,i=null){var a=t,l=new Map;if((e&4)!==0){var h=t;a=A?Y(st(h)):h.appendChild(lt())}A&&Oe();var u=null,f=Yr(()=>{var g=n();return Ko(g)?g:g==null?[]:Yn(g)}),d=new Map,p=!0;function m(g){if((x.effect.f&16384)===0){x.pending.delete(g);var k=s(f);x.fallback=u,Ks(x,k,a,e,r),u!==null&&(k.length===0?(u.f&33554432)===0?Xn(u):(u.f^=tn,Qe(u,null,a)):xe(u,()=>{u=null}))}}function b(g){x.pending.delete(g)}var x={effect:ro(()=>{var g=s(f),k=g.length;let I=!1;A&&Xr(a)==="[!"!=(k===0)&&(a=Fn(),Y(a),zt(!1),I=!0);for(var w=new Set,_=C,q=Si(),D=0;D<k;D+=1){A&&M.nodeType===8&&M.data==="]"&&(a=M,I=!0,zt(!1));var j=g[D],K=r(j,D),G=p?null:l.get(K);G?(G.v&&Pe(G.v,j),G.i&&Pe(G.i,D),q&&_.unskip_effect(G.e)):(G=Gs(l,p?a:Ln??(Ln=lt()),j,K,D,o,e,n),p||(G.e.f|=tn),l.set(K,G)),w.add(K)}if(k===0&&i&&!u&&(p?u=gt(()=>i(a)):(u=gt(()=>i(Ln??(Ln=lt()))),u.f|=tn)),k>w.size&&za("","",""),A&&k>0&&Y(Fn()),!p)if(d.set(_,w),q){for(const[X,Jt]of l)w.has(X)||_.skip_effect(Jt.e);_.oncommit(m),_.ondiscard(b)}else m(_);I&&zt(!0),s(f)}),flags:e,items:l,pending:d,outrogroups:null,fallback:u};p=!1,A&&(a=M)}function Xe(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function Ks(t,e,n,r,o){var i=(r&8)!==0,a=e.length,l=t.items,h=Xe(t.effect.first),u,f=null,d,p=[],m=[],b,x,g,k;if(i)for(k=0;k<a;k+=1)b=e[k],x=o(b,k),g=l.get(x).e,!(g.f&33554432)&&(g.nodes?.a?.measure(),(d??(d=new Set)).add(g));for(k=0;k<a;k+=1){if(b=e[k],x=o(b,k),g=l.get(x).e,t.outrogroups!==null)for(const X of t.outrogroups)X.pending.delete(g),X.done.delete(g);if(g.f&8192&&(Xn(g),i&&(g.nodes?.a?.unfix(),(d??(d=new Set)).delete(g))),(g.f&33554432)!==0)if(g.f^=tn,g===h)Qe(g,null,n);else{var I=f?f.next:h;g===t.effect.last&&(t.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),ee(t,f,g),ee(t,g,I),Qe(g,I,n),f=g,p=[],m=[],h=Xe(f.next);continue}if(g!==h){if(u!==void 0&&u.has(g)){if(p.length<m.length){var w=m[0],_;f=w.prev;var q=p[0],D=p[p.length-1];for(_=0;_<p.length;_+=1)Qe(p[_],w,n);for(_=0;_<m.length;_+=1)u.delete(m[_]);ee(t,q.prev,D.next),ee(t,f,q),ee(t,D,w),h=w,f=D,k-=1,p=[],m=[]}else u.delete(g),Qe(g,h,n),ee(t,g.prev,g.next),ee(t,g,f===null?t.effect.first:f.next),ee(t,f,g),f=g;continue}for(p=[],m=[];h!==null&&h!==g;)(u??(u=new Set)).add(h),m.push(h),h=Xe(h.next);if(h===null)continue}!(g.f&33554432)&&p.push(g),f=g,h=Xe(g.next)}if(t.outrogroups!==null){for(const X of t.outrogroups)X.pending.size===0&&(Br(t,Yn(X.done)),t.outrogroups?.delete(X));t.outrogroups.size===0&&(t.outrogroups=null)}if(h!==null||u!==void 0){var j=[];if(u!==void 0)for(g of u)!(g.f&8192)&&j.push(g);for(;h!==null;)!(h.f&8192)&&h!==t.fallback&&j.push(h),h=Xe(h.next);var K=j.length;if(K>0){var G=(r&4)!==0&&a===0?n:null;if(i){for(k=0;k<K;k+=1)j[k].nodes?.a?.measure();for(k=0;k<K;k+=1)j[k].nodes?.a?.fix()}Us(t,j,G)}}i&&oe(()=>{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function Gs(t,e,n,r,o,i,a,l){var h=(a&1)!==0?(a&16)===0?gi(n,!1,!1):we(n):null,u=(a&2)!==0?we(o):null;return{v:h,i:u,e:gt(()=>(i(e,h??n,u??o,l),()=>{t.delete(r)}))}}function Qe(t,e,n){if(t.nodes)for(var r=t.nodes.start,o=t.nodes.end,i=e&&(e.f&33554432)===0?e.nodes.start:n;r!==null;){var a=_t(r);if(i.before(r),r===o)return;r=a}}function ee(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function Xs(t,e,n=!1,r=!1,o=!1,i=!1){var a=t,l="";if(n){var h=t;A&&(a=Y(st(h)))}Bt(()=>{var u=E;if(l===(l=e()??"")){A&&Oe();return}if(n&&!A){u.nodes=null,h.innerHTML=l,l!==""&&Kt(st(h),h.lastChild);return}if(u.nodes!==null&&(_i(u.nodes.start,u.nodes.end),u.nodes=null),l!==""){if(A){for(var f=M.data,d=Oe(),p=d;d!==null&&(d.nodeType!==8||d.data!=="");)p=d,d=_t(d);if(d===null)throw vn(),Gt;Kt(M,p),a=Y(d);return}var m=er(r?"svg":o?"math":"template",r?_a:o?Ea:void 0);m.innerHTML=l;var b=r||o?m:m.content;if(Kt(st(b),b.lastChild),r||o)for(;st(b);)a.before(st(b));else a.before(b)}})}function Js(t,e){$i(()=>{t=E?.parent?.nodes?.start??t;var n=t.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const o=er("style");o.id=e.hash,o.textContent=e.code,r.appendChild(o)}})}var Po=[...`
213
+ \r\f \v\uFEFF`];function Zs(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var o of Object.keys(n))if(n[o])r=r?r+" "+o:o;else if(r.length)for(var i=o.length,a=0;(a=r.indexOf(o,a))>=0;){var l=a+i;(a===0||Po.includes(r[a-1]))&&(l===r.length||Po.includes(r[l]))?r=(a===0?"":r.substring(0,a))+r.substring(l+1):a=l}}return r===""?null:r}function Io(t,e=!1){var n=e?" !important;":";",r="";for(var o of Object.keys(t)){var i=t[o];i!=null&&i!==""&&(r+=" "+o+": "+i+n)}return r}function xr(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Ys(t,e){if(e){var n="",r,o;if(Array.isArray(e)?(r=e[0],o=e[1]):r=e,t){t=String(t).replaceAll(/\/\*.*?\*\//g,"").trim();var i=!1,a=0,l=!1,h=[];r&&h.push(...Object.keys(r).map(xr)),o&&h.push(...Object.keys(o).map(xr));var u=0,f=-1;const x=t.length;for(var d=0;d<x;d++){var p=t[d];if(l?p==="/"&&t[d-1]==="*"&&(l=!1):i?i===p&&(i=!1):p==="/"&&t[d+1]==="*"?l=!0:p==='"'||p==="'"?i=p:p==="("?a++:p===")"&&a--,!l&&i===!1&&a===0){if(p===":"&&f===-1)f=d;else if(p===";"||d===x-1){if(f!==-1){var m=xr(t.substring(u,f).trim());if(!h.includes(m)){p!==";"&&d++;var b=t.substring(u,d).trim();n+=" "+b+";"}}u=d+1,f=-1}}}}return r&&(n+=Io(r)),o&&(n+=Io(o,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Qs(t,e,n,r,o,i){var a=t[Rr];if(A||a!==n||a===void 0){var l=Zs(n,r,i);(!A||l!==t.getAttribute("class"))&&(l==null?t.removeAttribute("class"):e?t.className=l:t.setAttribute("class",l)),t[Rr]=n}else if(i&&o!==i)for(var h in i){var u=!!i[h];(o==null||u!==!!o[h])&&t.classList.toggle(h,u)}return i}function $r(t,e={},n,r){for(var o in n){var i=n[o];e[o]!==i&&(n[o]==null?t.style.removeProperty(o):t.style.setProperty(o,i,r))}}function qo(t,e,n,r){var o=t[Or];if(A||o!==e){var i=Ys(e,r);(!A||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t[Or]=e}else r&&(Array.isArray(r)?($r(t,n?.[0],r[0]),$r(t,n?.[1],r[1],"important")):$r(t,n,r));return r}var tl=Symbol("is custom element"),el=Symbol("is html"),nl=Da?"link":"LINK";function J(t,e,n,r){var o=rl(t);A&&(o[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===nl)||o[e]!==(o[e]=n)&&(e==="loading"&&(t[qa]=n),n==null?t.removeAttribute(e):typeof n!="string"&&ol(t).has(e)?t[e]=n:t.setAttribute(e,n))}function rl(t){return t[Mr]??(t[Mr]={[tl]:t.nodeName.includes("-"),[el]:t.namespaceURI==="http://www.w3.org/1999/xhtml"})}var Do=new Map;function ol(t){var e=t.getAttribute("is")||t.nodeName,n=Do.get(e);if(n)return n;Do.set(e,n=new Set);for(var r,o=t,i=Element.prototype;i!==o;){r=Na(o);for(var a in r)r[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&n.add(a);o=Go(o)}return n}var Vi,Ae=new WeakMap,Zn=new WeakMap,Tr=new WeakMap,Ho=new WeakSet,Bi=class{constructor(t){to(this,Ho),T(this,Ae,new WeakMap),T(this,Zn,void 0),T(this,Tr,void 0),S(Tr,this,t)}observe(t,e){var n=c(Ae,this).get(t)||new Set;return n.add(e),c(Ae,this).set(t,n),$(Ho,this,il).call(this).observe(t,c(Tr,this)),()=>{var r=c(Ae,this).get(t);r.delete(e),r.size===0&&(c(Ae,this).delete(t),c(Zn,this).unobserve(t))}}};Vi=Bi;function il(){return c(Zn,this)??S(Zn,this,new ResizeObserver(t=>{for(var e of t){Vi.entries.set(e.target,e);for(var n of c(Ae,this).get(e.target)||[])n(e)}}))}P(Bi,"entries",new WeakMap);function _r(t,e){return t===e||t?.[en]===e}function jo(t=Jr(),e,n,r){var o=V.r,i=E;return $i(()=>{var a,l;return no(()=>{a=l,l=r?.()||[],Re(()=>{_r(n(...l),t)||(e(t,...l),a&&_r(n(...a),t)&&e(null,...a))})}),()=>{let h=i;for(;h!==o&&h.parent!==null&&h.parent.f&33554432;)h=h.parent;const u=()=>{l&&_r(n(...l),t)&&e(null,...l)},f=h.teardown;h.teardown=()=>{u(),f?.()}}}),t}var Wn=!1;function al(t){var e=Wn;try{return Wn=!1,[t(),Wn]}finally{Wn=e}}function Fo(t,e,n,r){var o=!Qn||(n&2)!==0,i=(n&8)!==0,a=(n&16)!==0,l=r,h=!0,u=void 0,f=()=>a&&o?(u??(u=ln(r)),s(u)):(h&&(h=!1,l=a?Re(r):r),l);let d;if(i){var p=en in t||Yo in t;d=pe(t,e)?.set??(p&&e in t?_=>t[e]=_:void 0)}var m,b=!1;i?[m,b]=al(()=>t[e]):m=t[e],m===void 0&&r!==void 0&&(m=f(),d&&(o&&Za(e),d(m)));var x;if(o?x=()=>{var _=t[e];return _===void 0?f():(h=!0,_)}:x=()=>{var _=t[e];return _!==void 0&&(l=void 0),_===void 0?l:_},o&&(n&4)===0)return x;if(d){var g=t.$$legacy;return(function(_,q){return arguments.length>0?((!o||!q||g||b)&&d(q?x():_),_):x()})}var k=!1,I=((n&1)!==0?ln:Yr)(()=>(k=!1,x()));i&&s(I);var w=E;return(function(_,q){if(arguments.length>0){const D=q?s(I):o&&i?de(_):_;return O(I,D),k=!0,l!==void 0&&(l=D),_}return Xt&&k||(w.f&16384)!==0?I.v:s(I)})}function sl(t){return new ll(t)}var ce=new WeakMap,Mt=new WeakMap,ll=class{constructor(t){T(this,ce,void 0),T(this,Mt,void 0);var e=new Map,n=(o,i)=>{var a=gi(i,!1,!1);return e.set(o,a),a};const r=new Proxy({...t.props||{},$$events:{}},{get(o,i){return s(e.get(i)??n(i,Reflect.get(o,i)))},has(o,i){return i===Yo?!0:(s(e.get(i)??n(i,Reflect.get(o,i))),Reflect.has(o,i))},set(o,i,a){return O(e.get(i)??n(i,a),a),Reflect.set(o,i,a)}});S(Mt,this,(t.hydrate?Fs:ji)(t.component,{target:t.target,anchor:t.anchor,props:r,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!t?.props?.$$host||t.sync===!1)&&un(),S(ce,this,r.$$events);for(const o of Object.keys(c(Mt,this)))o==="$set"||o==="$destroy"||o==="$on"||an(this,o,{get(){return c(Mt,this)[o]},set(i){c(Mt,this)[o]=i},enumerable:!0});c(Mt,this).$set=o=>{Object.assign(r,o)},c(Mt,this).$destroy=()=>{Vs(c(Mt,this))}}$set(t){c(Mt,this).$set(t)}$on(t,e){c(ce,this)[t]=c(ce,this)[t]||[];const n=(...r)=>e.call(this,...r);return c(ce,this)[t].push(n),()=>{c(ce,this)[t]=c(ce,this)[t].filter(r=>r!==n)}}$destroy(){c(Mt,this).$destroy()}},zi;typeof HTMLElement=="function"&&(zi=class extends HTMLElement{constructor(t,e,n){super(),P(this,"$$ctor",void 0),P(this,"$$s",void 0),P(this,"$$c",void 0),P(this,"$$cn",!1),P(this,"$$d",{}),P(this,"$$r",!1),P(this,"$$p_d",{}),P(this,"$$l",{}),P(this,"$$l_u",new Map),P(this,"$$me",void 0),P(this,"$$shadowRoot",null),this.$$ctor=t,this.$$s=e,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return o=>{const i=er("slot");r!=="default"&&(i.name=r),ft(o,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=cl(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=t(r),e.default=!0):e[r]=t(r));for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=qn(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=sl({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=ws(()=>{no(()=>{this.$$r=!0;for(const r of Hn(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const o=qn(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1})});for(const r in this.$$l)for(const o of this.$$l[r]){const i=this.$$c.$on(r,o);this.$$l_u.set(o,i)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=qn(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Hn(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function qn(t,e,n,r){const o=n[t]?.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function cl(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function ul(t,e,n,r,o,i){let a=class extends zi{constructor(){super(t,n,o),this.$$p_d=e}static get observedAttributes(){return Hn(e).map(l=>(e[l].attribute||l).toLowerCase())}};return Hn(e).forEach(l=>{an(a.prototype,l,{get(){return this.$$c&&l in this.$$c?this.$$c[l]:this.$$d[l]},set(h){h=qn(l,h,e),this.$$d[l]=h;var u=this.$$c;u&&(pe(u,l)?.get?u[l]=h:u.$set({[l]:h}))}})}),r.forEach(l=>{an(a.prototype,l,{get(){return this.$$c?.[l]}})}),i&&(a=i(a)),t.element=a,a}function hl(t){return t.key==="ContextMenu"?!0:t.key==="F10"&&t.shiftKey===!0}function fl({key:t,activeIndex:e,count:n,direction:r}){if(n<=0)return null;const o=zr(e,n);return t===(r==="rtl"?"ArrowLeft":"ArrowRight")?(o+1)%n:t===(r==="rtl"?"ArrowRight":"ArrowLeft")?(o-1+n)%n:t==="Home"?0:t==="End"?n-1:null}function zr(t,e){return e<=0||!Number.isFinite(t)||t<0?0:Math.min(Math.trunc(t),e-1)}function dl(t,e){return t.bottom<0||t.top>e.height||t.right<0||t.left>e.width}var vl=2e3;function pl(t,e,n=vl){if(t===null)return!1;const r=e-t;return r<0?!0:r<n}function gl(t,e,n={width:0,height:0},r=8){const o=t.left+(t.right-t.left)/2-n.width/2,i=t.top-r-n.height,a=i<4&&t.bottom+r+n.height<=e.height,l=a?t.bottom+r:i;return{x:Vo(o,n.width,e.width,4),y:Vo(l,n.height,e.height,4),below:a}}function Vo(t,e,n,r){const o=n-e-r;return o<=r?r:Math.min(Math.max(t,r),o)}function ml(t){if(!t||typeof t!="object")return!1;const e=t;return!(typeof e.id!="string"||e.id.trim().length===0||typeof e.label!="string"||e.label.trim().length===0||e.label.length>40||typeof e.run!="function"||e.iconSvg!==void 0&&typeof e.iconSvg!="string"||e.tooltip!==void 0&&typeof e.tooltip!="string"||e.isAvailable!==void 0&&typeof e.isAvailable!="function")}function bl(t){if(typeof t.isAvailable!="function")return!0;try{return t.isAvailable()!==!1}catch(e){return console.warn(`[AnnotationToolbar] Selection action "${t.id}" failed its availability check:`,e),!1}}function yl(t){if(!Array.isArray(t))return[];const e=new Set,n=[];return t.forEach((r,o)=>{if(!ml(r)){console.warn(`[AnnotationToolbar] Ignoring invalid selection action at index ${o}. Expected { id, label, run } with valid types.`);return}if(e.has(r.id)){console.warn(`[AnnotationToolbar] Ignoring duplicate selection action id "${r.id}".`);return}bl(r)&&(e.add(r.id),n.push(r))}),n}function wl(t,e){if(!t)return!1;const n=e?.canRequestTool;if(typeof n!="function")return!1;try{return n.call(e,"textToSpeech")===!0}catch(r){return console.warn("[AnnotationToolbar] Read-aloud failed its availability check:",r),!1}}var kl=t=>{const e=[];for(const n of t){let r=n?.getRootNode?.();for(;yt(r);)e.includes(r)||e.push(r),r=r.host.getRootNode?.()}return e},Sl=(t,e)=>{const n=t.getComposedRanges;if(typeof n!="function"||e.length===0)return null;try{return n.call(t,{shadowRoots:e})[0]??null}catch{try{return n.call(t,...e)[0]??null}catch{return null}}},xl=t=>{const{startContainer:e,startOffset:n,endContainer:r,endOffset:o}=t,i=e.ownerDocument;if(!i)return null;try{const a=i.createRange();a.setStart(e,n);const l=e.getRootNode();if(r.getRootNode()===l)return a.setEnd(r,o),a;const h=ya(r,l);if(h)a.setEndBefore(h);else if(yt(l))a.setEnd(l,l.childNodes.length);else return null;return a}catch{return null}},$l=t=>{if(t.rangeCount===0)return null;const e=t.getRangeAt(0),n=Sl(t,kl([t.anchorNode,t.focusNode,e.startContainer,e.endContainer])),r=n?xl(n):null;return!n||!r?{range:e,text:t.toString()}:{range:r,text:n.startContainer.getRootNode()===n.endContainer.getRootNode()?t.toString():r.toString()}},Bo=t=>{const e=t.startContainer,n=ba(e);if(!n)return null;const r=Sa(n,e);return!on(r,e)||!on(r,t.endContainer)?null:r},Tl=Ht('<button class="pie-tool-annotation-toolbar__highlight-swatch svelte-1qnnvrt"><span class="pie-sr-only svelte-1qnnvrt"> </span></button>'),_l=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z"></path></svg></button>',1),El=Ht('<span class="pie-tool-annotation-toolbar__action-icon svelte-1qnnvrt" aria-hidden="true"></span>'),Al=Ht("<button><!></button>"),Nl=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!>',1),Cl=Ht('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--warning svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"></path></svg></button>'),Ml=Ht('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--danger svelte-1qnnvrt"> </button>'),Rl=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!> <!>',1),Ol=Ht('<div class="pie-tool-annotation-toolbar notranslate svelte-1qnnvrt" role="toolbar" translate="no" tabindex="-1"><!> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z"></path></svg></button> <!> <!> <!></div>'),Ll=Ht('<div style="display: none;" aria-hidden="true"></div> <!> <div role="status" aria-live="polite" aria-atomic="true" class="pie-sr-only svelte-1qnnvrt"> </div>',1),Wl={hash:"svelte-1qnnvrt",code:`.pie-tool-annotation-toolbar.svelte-1qnnvrt {position:fixed;z-index:4200;display:flex;gap:0.25rem;padding:0.5rem;border-radius:0.5rem;background:var(--pie-background, #fff);color:var(--pie-text, #111827);
214
214
  /* WCAG 2.2 SC 1.4.11: this stroke is the only boundary between a floating
215
215
  toolbar and the content behind it, so it has to clear 3:1 against both.
216
216
  It cannot come from --pie-border, because the DaisyUI bridge maps that
@@ -246,4 +246,4 @@ import{t as dt}from"./defineProperty-a20a667d.js";import{t as ha}from"./attribut
246
246
 
247
247
  /* Composer-supplied icons carry their own viewBox but rarely their own size, so
248
248
  the box is set here to keep an action button the same height as the built-in
249
- ones — a strip of mismatched buttons reads as broken. */.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt {display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;}.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt svg {width:100%;height:100%;}`};function Pl(t,e){ti(e,!0),Xs(t,Wl);let n=Fo(e,"enabled",7,!0),r=Fo(e,"selectionActions",7,null);const o=typeof window<"u",i="annotationToolbar",a=2e3,l=["button","input","select","textarea",'[contenteditable="true"]',".pie-tool-annotation-toolbar",".pie-tool-toolbar",'[role="button"]','[role="textbox"]'],h=30;let u=F(null),f=F(null);const d=ht(()=>ga(s(f))),p=ht(()=>s(f)?.highlightCoordinator??null),g=ht(()=>s(f)?.ttsService??null),b=ht(()=>s(f)?.elementToolStateStore??null),$=ht(()=>[{name:Ot.YELLOW,hex:"#fde995",label:s(d).t("tools.annotationToolbar.highlightYellowA11y")},{name:Ot.PINK,hex:"#ff9fae",label:s(d).t("tools.annotationToolbar.highlightPinkA11y")},{name:Ot.BLUE,hex:"#a7e0f6",label:s(d).t("tools.annotationToolbar.highlightBlueA11y")},{name:Ot.GREEN,hex:"#a6e1c5",label:s(d).t("tools.annotationToolbar.highlightGreenA11y")}]);let m=F(null),y=F(null),P=F(null),k=F(fe({isVisible:!1,selectedText:"",selectedRange:null,toolbarPosition:{x:0,y:0,below:!1}})),T=F(!1),I=F(!1),H=F(""),D=F(0),K=F(null),G=null,J=null,Jt=null,er=null,Ie=null,Et=F(0),He=null;function qe(v,w){Jt!==null&&clearTimeout(Jt),O(H,v,!0),Jt=setTimeout(()=>{O(H,""),Jt=null},w)}function nr(v){return v.length>h?v.substring(0,h)+"...":v}let pn=ht(()=>(s(k).isVisible,wl(r()))),rr=ht(()=>(s(k).isVisible,yl(s(g),s(f)?.toolkitCoordinator))),gn=ht(()=>s(D)>0),mn=ht(()=>s(K)!==null),bn=ht(()=>s(P)?.scopeElement||s(y)?.scopeElement||null);function or(){const v=s(u)?.ownerDocument;return s(bn)||v?.documentElement||document.documentElement}let ir=ht(()=>{const v=s(f)?.assessmentId,w=s(f)?.sectionId;return!s(b)||!v||!w?null:s(b).getGlobalElementId({assessmentId:v,sectionId:w,attemptId:s(f)?.attemptId??"",itemId:s(y)?.canonicalItemId||s(y)?.itemId||"",elementId:""})});function zi(v){if(!s(p))return null;const w=s(p).getAnnotations();for(const R of w){if(v.startContainer.getRootNode()!==R.range.startContainer.getRootNode())continue;const L=v.compareBoundaryPoints(Range.START_TO_START,R.range),ot=v.compareBoundaryPoints(Range.END_TO_END,R.range),De=v.compareBoundaryPoints(Range.START_TO_END,R.range),xn=v.compareBoundaryPoints(Range.END_TO_START,R.range);if(L>=0&&ot<=0||L<=0&&ot>=0||De>0&&xn<0)return R.id}return null}function Ui(v){const w=wt(v)?v.host:v;return w.nodeType!==Node.ELEMENT_NODE&&w.nodeType!==Node.TEXT_NODE?!1:!l.some(R=>{try{return Sa(w,R)!==null}catch{return!1}})}function Ki(v){return s(bn)?nn(s(bn),v.commonAncestorContainer):!0}function ar(){if(!(!s(p)||!s(b)||!s(ir)))try{const v=s(p).exportAnnotations(or());s(b).setState(s(ir),i,v)}catch(v){ur(s(f)?.toolkitCoordinator,"annotationToolbar","tool-state-save",v)}}function Gi(v){if(!(!s(p)||!s(b)))try{const w=s(b).getState(v,i);s(p).clearAnnotations(),Array.isArray(w)&&s(p).importAnnotations(w,or()),O(D,s(p).getAnnotations().length,!0)}catch(w){ur(s(f)?.toolkitCoordinator,"annotationToolbar","tool-state-load",w)}}function sr(){!o||J!==null||(J=(typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,16))(()=>{J=null,io()}))}function io(v={}){if(!n()||!o||pl(G,Date.now()))return;const w=window.getSelection(),R=w?$l(w):null;if(!R)return oe();const{range:L}=R,ot=R.text.trim();if(!ot||!Ki(L)||!jo(L)||!Ui(L.commonAncestorContainer))return oe();if(Ie!==null&&(v.force||Ie!==ot)&&(Ie=null),Ie===ot)return;O(K,zi(L),!0);const De=s(k).isVisible;s(k).isVisible=!0,s(k).selectedText=ot,s(k).selectedRange=L.cloneRange(),lr(L),er!==ot&&(er=ot,qe(`Annotation toolbar available for "${nr(ot)}". Press Shift+F10 for annotation tools.`,4e3)),De||(O(I,!0),setTimeout(()=>{O(I,!1)},100))}function lr(v=s(k).selectedRange){if(!v)return;const w=v.getBoundingClientRect(),R={width:window.innerWidth||0,height:window.innerHeight||0};if(dl(w,R)){s(k).isVisible=!1;return}s(k).isVisible=!0,s(k).toolbarPosition=gl(w,R,Ji())}function Ji(){return s(m)?{width:s(m).offsetWidth,height:s(m).offsetHeight}:{width:0,height:0}}function wn(){!s(k).isVisible&&!s(k).selectedRange||lr()}function ao(){G=Date.now()}function yn(){G=null,sr()}function kn(){Ie=s(k).selectedText||null,oe()}function oe(){s(T)&&s(g)&&(s(g).stop(),O(T,!1)),Xi(),s(k).isVisible=!1,s(k).selectedText="",s(k).selectedRange=null,er=null,O(Et,0)}function Xi(){const v=He;He=null,v&&so()&&typeof v.focus=="function"&&v.isConnected&&v.focus({preventScroll:!0})}function so(){if(!s(m)||!o)return!1;const v=s(m).getRootNode().activeElement;return!!v&&s(m).contains(v)}function cr(){return s(m)?Array.from(s(m).querySelectorAll("button:not([disabled])")):[]}function Zi(){const v=cr();if(v.length){if(!so()&&o){const w=s(m)?.getRootNode()?.activeElement;He=w instanceof HTMLElement?w:null}O(Et,Br(s(Et),v.length),!0),v[s(Et)]?.focus()}}function lo(v){if(!s(k).selectedRange||!s(p))return;const w=s(k).selectedText;s(p).addAnnotation(s(k).selectedRange,v),O(D,s(p).getAnnotations().length,!0),ar();const R=v===Ot.UNDERLINE?"underlined":`highlighted in ${v}`;qe(`"${nr(w)}" ${R}`,3e3),kn()}function Yi(){if(!s(K)||!s(p)){console.warn("[AnnotationToolbar] No overlapping annotation to remove");return}const v=s(p).getAnnotation(s(K));if(!v){console.warn("[AnnotationToolbar] Annotation not found:",s(K));return}const w=v.range.toString();s(p).removeAnnotation(s(K)),O(D,s(p).getAnnotations().length,!0),ar(),qe(`Removed annotation from "${nr(w)}"`,3e3),kn()}function Qi(){const v=s(D);s(p)?.clearAnnotations(),O(D,0),ar(),qe(`${v} annotation${v===1?"":"s"} cleared`,3e3),kn()}function ta(v){return v.iconSvg?pa(v.iconSvg):""}function ea(v){const w=s(k).selectedText,R=s(k).selectedRange;try{v.run({text:w,range:R})}catch(L){console.error(`[AnnotationToolbar] Selection action "${v.id}" threw:`,L)}kn()}async function na(){if(!(s(T)||!s(k).selectedRange||!s(g)||!s(rr))){O(T,!0);try{const v=s(k).selectedRange;await s(g).speak(v,{contentRoot:jo(v)??or(),language:s(f)?.contentLanguage,catalogContext:ya(v.startContainer,s(f))})}catch(v){wa(v)?qe(s(d).t("tools.textToSpeech.initFailed"),5e3):ur(s(f)?.toolkitCoordinator,"textToSpeech","tool-playback",v)}finally{O(T,!1)}}}function co(v){if(v.key==="Escape"&&s(k).isVisible){v.preventDefault(),oe();return}hl(v)&&(s(k).isVisible||io({force:!0}),s(k).isVisible&&(v.preventDefault(),Es().then(()=>Zi())))}function ra(v){if(v.key==="Escape"){v.preventDefault(),oe();return}const w=cr(),R=fl({key:v.key,activeIndex:s(Et),count:w.length,direction:o&&s(m)&&getComputedStyle(s(m)).direction==="rtl"?"rtl":"ltr"});R!==null&&(v.preventDefault(),O(Et,R,!0),w[R]?.focus())}function oa(v){const w=v.relatedTarget;w instanceof Node&&s(m)?.contains(w)||(He=null,oe())}function Sn(v){if(!s(k).isVisible||s(I)||!s(m))return;const w=(typeof v.composedPath=="function"?v.composedPath():[]).filter(R=>!!R);w.includes(s(m))||w.length===0&&s(m).contains(v.target)||(He=null,oe())}ze(()=>{if(!o)return;const v=s(ir);if(!v||!s(p))return;const w=setTimeout(()=>Ne(()=>Gi(v)),a);return()=>clearTimeout(w)}),ze(()=>{if(!o)return;const v=s(bn)||document;return v.addEventListener("click",Sn),v.addEventListener("touchstart",Sn),document.addEventListener("selectionchange",sr),v.addEventListener("pointerdown",ao),document.addEventListener("pointerup",yn),document.addEventListener("pointercancel",yn),document.addEventListener("keydown",co),window.addEventListener("scroll",wn,!0),window.addEventListener("resize",wn),()=>{Jt!==null&&clearTimeout(Jt),J!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(J),J=null),v.removeEventListener("click",Sn),v.removeEventListener("touchstart",Sn),document.removeEventListener("selectionchange",sr),v.removeEventListener("pointerdown",ao),document.removeEventListener("pointerup",yn),document.removeEventListener("pointercancel",yn),document.removeEventListener("keydown",co),window.removeEventListener("scroll",wn,!0),window.removeEventListener("resize",wn)}}),ze(()=>{s(k).isVisible,s(m),s(pn),s(mn),s(gn),s(rr),Ne(()=>{!s(k).isVisible||!s(m)||lr()})}),ze(()=>{s(k).isVisible,s(Et),s(mn),s(gn),s(T),s(pn),Ne(()=>{const v=cr();if(v.length===0)return;const w=Br(s(Et),v.length);w!==s(Et)&&O(Et,w,!0),v.forEach((R,L)=>{R.tabIndex=L===w?0:-1})})}),ze(()=>{if(!s(u))return;const v=fa(s(u),L=>{O(y,L,!0)}),w=da(s(u),L=>{O(P,L,!0)}),R=va(s(u),L=>{O(f,L,!0)});return()=>{R(),w(),v()}});var ia={get enabled(){return n()},set enabled(v=!0){n(v),zn()},get selectionActions(){return r()},set selectionActions(v=null){r(v),zn()}},uo=Ll(),ho=En(uo);Do(ho,v=>O(u,v),()=>s(u));var fo=Nt(ho,2),aa=v=>{var w=Ol(),R=Ln(w);Lo(R,17,()=>s($),zs,(Z,Q)=>{var q=Tl(),tt=gr(Ln(q),!0);Ge(q),Bt(()=>{Io(q,`background-color: ${s(Q).hex??""};`),X(q,"aria-label",s(Q).label),X(q,"title",s(Q).label),Cn(tt,s(Q).label)}),Yt("click",q,()=>lo(s(Q).name)),ft(Z,q)});var L=Nt(R,2),ot=Nt(L,2),De=Z=>{var Q=_l(),q=Nt(En(Q),2);Bt((tt,Ft)=>{X(q,"aria-disabled",s(T)),X(q,"aria-label",tt),X(q,"title",Ft)},[()=>s(d).t("tools.annotationToolbar.readAloudA11y"),()=>s(d).t("tools.annotationToolbar.readAloud")]),Yt("click",q,na),ft(Z,Q)};se(ot,Z=>{s(rr)&&Z(De)});var xn=Nt(ot,2),la=Z=>{var Q=Cl();Lo(Nt(En(Q),2),17,()=>s(pn),q=>q.id,(q,tt)=>{const Ft=ht(()=>ta(s(tt)));var At=Al();let Ct;var ut=Ln(At),Fe=Xt=>{var Zt=El();Js(Zt,()=>s(Ft),!0),Ge(Zt),ft(Xt,Zt)},Ve=Xt=>{var Zt=Rs();Bt(()=>Cn(Zt,s(tt).label)),ft(Xt,Zt)};se(ut,Xt=>{s(Ft)?Xt(Fe):Xt(Ve,-1)}),Ge(At),Bt(()=>{Ct=Qs(At,1,"pie-tool-annotation-toolbar__button svelte-1qnnvrt",null,Ct,{"pie-tool-annotation-toolbar__button--icon":!!s(Ft)}),X(At,"data-pie-selection-action",s(tt).id),X(At,"aria-label",s(tt).label),X(At,"title",s(tt).tooltip||s(tt).label)}),Yt("click",At,()=>ea(s(tt))),ft(q,At)}),ft(Z,Q)};se(xn,Z=>{s(pn).length>0&&Z(la)});var ca=Nt(xn,2),ua=Z=>{var Q=Rl(),q=Nt(En(Q),2),tt=Ct=>{var ut=Nl();Bt((Fe,Ve)=>{X(ut,"aria-label",Fe),X(ut,"title",Ve)},[()=>s(d).t("tools.annotationToolbar.removeA11y"),()=>s(d).t("tools.annotationToolbar.remove")]),Yt("click",ut,Yi),ft(Ct,ut)};se(q,Ct=>{s(mn)&&Ct(tt)});var Ft=Nt(q,2),At=Ct=>{var ut=Ml(),Fe=gr(ut,!0);Bt((Ve,Xt,Zt)=>{X(ut,"aria-label",Ve),X(ut,"title",Xt),Cn(Fe,Zt)},[()=>s(d).t("tools.annotationToolbar.clearAllA11y"),()=>s(d).t("tools.annotationToolbar.clearAll"),()=>s(d).t("tools.annotationToolbar.clearAll")]),Yt("click",ut,Qi),ft(Ct,ut)};se(Ft,Ct=>{s(gn)&&Ct(At)}),ft(Z,Q)};se(ca,Z=>{(s(mn)||s(gn))&&Z(ua)}),Ge(w),Do(w,Z=>O(m,Z),()=>s(m)),Bt((Z,Q,q,tt,Ft)=>{X(w,"data-pie-placement",s(k).toolbarPosition.below?"below":"above"),Io(w,`left:${s(k).toolbarPosition.x}px; top:${s(k).toolbarPosition.y}px;`),X(w,"lang",Z),X(w,"dir",Q),X(w,"aria-label",q),X(L,"aria-label",tt),X(L,"title",Ft),w.dir=w.dir},[()=>s(d).getLocale(),()=>s(d).getDirection?.()??"ltr",()=>s(d).t("tools.annotationToolbar.toolbarA11y"),()=>s(d).t("tools.annotationToolbar.underlineA11y"),()=>s(d).t("tools.annotationToolbar.underline")]),Yt("keydown",w,ra),Yt("focusout",w,oa),Yt("click",L,()=>lo(Ot.UNDERLINE)),ft(v,w)};se(fo,v=>{s(k).isVisible&&v(aa)});var sa=gr(Nt(fo,2),!0);return Bt(()=>Cn(sa,s(H))),ft(t,uo),ei(ia)}As(["keydown","focusout","click"]);Il("pie-tool-annotation-toolbar",ul(Pl,{enabled:{attribute:"enabled",type:"Boolean"},selectionActions:{type:"Object"}},[],[],{mode:"open"},ha));function Il(t,e){customElements.get(t)||customElements.define(t,e)}export{Pl as default};
249
+ ones — a strip of mismatched buttons reads as broken. */.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt {display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;}.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt svg {width:100%;height:100%;}`};function Pl(t,e){ei(e,!0),Js(t,Wl);let n=Fo(e,"enabled",7,!0),r=Fo(e,"selectionActions",7,null);const o=typeof window<"u",i="annotationToolbar",a=2e3,l=["button","input","select","textarea",'[contenteditable="true"]',".pie-tool-annotation-toolbar",".pie-tool-toolbar",'[role="button"]','[role="textbox"]'],h=30;let u=F(null),f=F(null);const d=ht(()=>ma(s(f))),p=ht(()=>s(f)?.highlightCoordinator??null),m=ht(()=>s(f)?.ttsService??null),b=ht(()=>s(f)?.elementToolStateStore??null),x=ht(()=>[{name:Ot.YELLOW,hex:"#fde995",label:s(d).t("tools.annotationToolbar.highlightYellowA11y")},{name:Ot.PINK,hex:"#ff9fae",label:s(d).t("tools.annotationToolbar.highlightPinkA11y")},{name:Ot.BLUE,hex:"#a7e0f6",label:s(d).t("tools.annotationToolbar.highlightBlueA11y")},{name:Ot.GREEN,hex:"#a6e1c5",label:s(d).t("tools.annotationToolbar.highlightGreenA11y")}]);let g=F(null),k=F(null),I=F(null),w=F(de({isVisible:!1,selectedText:"",selectedRange:null,toolbarPosition:{x:0,y:0,below:!1}})),_=F(!1),q=F(!1),D=F(""),j=F(0),K=F(null),G=null,X=null,Jt=null,rr=null,De=null,Et=F(0),He=null;function je(v,y){Jt!==null&&clearTimeout(Jt),O(D,v,!0),Jt=setTimeout(()=>{O(D,""),Jt=null},y)}function or(v){return v.length>h?v.substring(0,h)+"...":v}let bn=ht(()=>(s(w).isVisible,yl(r()))),ir=ht(()=>(s(w).isVisible,wl(s(m),s(f)?.toolkitCoordinator))),yn=ht(()=>s(j)>0),wn=ht(()=>s(K)!==null),kn=ht(()=>s(I)?.scopeElement||s(k)?.scopeElement||null);function ar(){const v=s(u)?.ownerDocument;return s(kn)||v?.documentElement||document.documentElement}let sr=ht(()=>{const v=s(f)?.assessmentId,y=s(f)?.sectionId;return!s(b)||!v||!y?null:s(b).getGlobalElementId({assessmentId:v,sectionId:y,attemptId:s(f)?.attemptId??"",itemId:s(k)?.canonicalItemId||s(k)?.itemId||"",elementId:""})});function Ui(v){if(!s(p))return null;const y=s(p).getAnnotations();for(const R of y){if(v.startContainer.getRootNode()!==R.range.startContainer.getRootNode())continue;const W=v.compareBoundaryPoints(Range.START_TO_START,R.range),it=v.compareBoundaryPoints(Range.END_TO_END,R.range),Fe=v.compareBoundaryPoints(Range.START_TO_END,R.range),_n=v.compareBoundaryPoints(Range.END_TO_START,R.range);if(W>=0&&it<=0||W<=0&&it>=0||Fe>0&&_n<0)return R.id}return null}function Ki(v){const y=yt(v)?v.host:v;return y.nodeType!==Node.ELEMENT_NODE&&y.nodeType!==Node.TEXT_NODE?!1:!l.some(R=>{try{return xa(y,R)!==null}catch{return!1}})}function Gi(v){return s(kn)?on(s(kn),v.commonAncestorContainer):!0}function lr(){if(!(!s(p)||!s(b)||!s(sr)))try{const v=s(p).exportAnnotations(ar());s(b).setState(s(sr),i,v)}catch(v){fr(s(f)?.toolkitCoordinator,"annotationToolbar","tool-state-save",v)}}function Xi(v){if(!(!s(p)||!s(b)))try{const y=s(b).getState(v,i);s(p).clearAnnotations(),Array.isArray(y)&&s(p).importAnnotations(y,ar()),O(j,s(p).getAnnotations().length,!0)}catch(y){fr(s(f)?.toolkitCoordinator,"annotationToolbar","tool-state-load",y)}}function cr(){!o||X!==null||(X=(typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,16))(()=>{X=null,so()}))}function so(v={}){if(!n()||!o||pl(G,Date.now()))return;const y=window.getSelection(),R=y?$l(y):null;if(!R)return ie();const{range:W}=R,it=R.text.trim();if(!it||!Gi(W)||!Bo(W)||!Ki(W.commonAncestorContainer))return ie();if(De!==null&&(v.force||De!==it)&&(De=null),De===it)return;O(K,Ui(W),!0);const Fe=s(w).isVisible;s(w).isVisible=!0,s(w).selectedText=it,s(w).selectedRange=W.cloneRange(),ur(W),rr!==it&&(rr=it,je(`Annotation toolbar available for "${or(it)}". Press Shift+F10 for annotation tools.`,4e3)),Fe||(O(q,!0),setTimeout(()=>{O(q,!1)},100))}function ur(v=s(w).selectedRange){if(!v)return;const y=v.getBoundingClientRect(),R={width:window.innerWidth||0,height:window.innerHeight||0};if(dl(y,R)){s(w).isVisible=!1;return}s(w).isVisible=!0,s(w).toolbarPosition=gl(y,R,Ji())}function Ji(){return s(g)?{width:s(g).offsetWidth,height:s(g).offsetHeight}:{width:0,height:0}}function Sn(){!s(w).isVisible&&!s(w).selectedRange||ur()}function lo(){G=Date.now()}function xn(){G=null,cr()}function $n(){De=s(w).selectedText||null,ie()}function ie(){s(_)&&s(m)&&(s(m).stop(),O(_,!1)),Zi(),s(w).isVisible=!1,s(w).selectedText="",s(w).selectedRange=null,rr=null,O(Et,0)}function Zi(){const v=He;He=null,v&&co()&&typeof v.focus=="function"&&v.isConnected&&v.focus({preventScroll:!0})}function co(){if(!s(g)||!o)return!1;const v=s(g).getRootNode().activeElement;return!!v&&s(g).contains(v)}function hr(){return s(g)?Array.from(s(g).querySelectorAll("button:not([disabled])")):[]}function Yi(){const v=hr();if(v.length){if(!co()&&o){const y=s(g)?.getRootNode()?.activeElement;He=y instanceof HTMLElement?y:null}O(Et,zr(s(Et),v.length),!0),v[s(Et)]?.focus()}}function uo(v){if(!s(w).selectedRange||!s(p))return;const y=s(w).selectedText;s(p).addAnnotation(s(w).selectedRange,v),O(j,s(p).getAnnotations().length,!0),lr();const R=v===Ot.UNDERLINE?"underlined":`highlighted in ${v}`;je(`"${or(y)}" ${R}`,3e3),$n()}function Qi(){if(!s(K)||!s(p)){console.warn("[AnnotationToolbar] No overlapping annotation to remove");return}const v=s(p).getAnnotation(s(K));if(!v){console.warn("[AnnotationToolbar] Annotation not found:",s(K));return}const y=v.range.toString();s(p).removeAnnotation(s(K)),O(j,s(p).getAnnotations().length,!0),lr(),je(`Removed annotation from "${or(y)}"`,3e3),$n()}function ta(){const v=s(j);s(p)?.clearAnnotations(),O(j,0),lr(),je(`${v} annotation${v===1?"":"s"} cleared`,3e3),$n()}function ea(v){return v.iconSvg?ga(v.iconSvg):""}function na(v){const y=s(w).selectedText,R=s(w).selectedRange;try{v.run({text:y,range:R})}catch(W){console.error(`[AnnotationToolbar] Selection action "${v.id}" threw:`,W)}$n()}async function ra(){if(!(s(_)||!s(w).selectedRange||!s(m)||!s(ir))){O(_,!0);try{const v=s(w).selectedRange;await s(m).speak(v,{contentRoot:Bo(v)??ar(),language:s(f)?.contentLanguage,catalogContext:ka(v.startContainer,s(f))})}catch(v){wa(v)?je(s(d).t("tools.textToSpeech.initFailed"),5e3):fr(s(f)?.toolkitCoordinator,"textToSpeech","tool-playback",v)}finally{O(_,!1)}}}function ho(v){if(v.key==="Escape"&&s(w).isVisible){v.preventDefault(),ie();return}hl(v)&&(s(w).isVisible||so({force:!0}),s(w).isVisible&&(v.preventDefault(),Es().then(()=>Yi())))}function oa(v){if(v.key==="Escape"){v.preventDefault(),ie();return}const y=hr(),R=fl({key:v.key,activeIndex:s(Et),count:y.length,direction:o&&s(g)&&getComputedStyle(s(g)).direction==="rtl"?"rtl":"ltr"});R!==null&&(v.preventDefault(),O(Et,R,!0),y[R]?.focus())}function ia(v){const y=v.relatedTarget;y instanceof Node&&s(g)?.contains(y)||(He=null,ie())}function Tn(v){if(!s(w).isVisible||s(q)||!s(g))return;const y=(typeof v.composedPath=="function"?v.composedPath():[]).filter(R=>!!R);y.includes(s(g))||y.length===0&&s(g).contains(v.target)||(He=null,ie())}Ke(()=>{if(!o)return;const v=s(sr);if(!v||!s(p))return;const y=setTimeout(()=>Re(()=>Xi(v)),a);return()=>clearTimeout(y)}),Ke(()=>{if(!o)return;const v=s(kn)||document;return v.addEventListener("click",Tn),v.addEventListener("touchstart",Tn),document.addEventListener("selectionchange",cr),v.addEventListener("pointerdown",lo),document.addEventListener("pointerup",xn),document.addEventListener("pointercancel",xn),document.addEventListener("keydown",ho),window.addEventListener("scroll",Sn,!0),window.addEventListener("resize",Sn),()=>{Jt!==null&&clearTimeout(Jt),X!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(X),X=null),v.removeEventListener("click",Tn),v.removeEventListener("touchstart",Tn),document.removeEventListener("selectionchange",cr),v.removeEventListener("pointerdown",lo),document.removeEventListener("pointerup",xn),document.removeEventListener("pointercancel",xn),document.removeEventListener("keydown",ho),window.removeEventListener("scroll",Sn,!0),window.removeEventListener("resize",Sn)}}),Ke(()=>{s(w).isVisible,s(g),s(bn),s(wn),s(yn),s(ir),Re(()=>{!s(w).isVisible||!s(g)||ur()})}),Ke(()=>{s(w).isVisible,s(Et),s(wn),s(yn),s(_),s(bn),Re(()=>{const v=hr();if(v.length===0)return;const y=zr(s(Et),v.length);y!==s(Et)&&O(Et,y,!0),v.forEach((R,W)=>{R.tabIndex=W===y?0:-1})})}),Ke(()=>{if(!s(u))return;const v=da(s(u),W=>{O(k,W,!0)}),y=va(s(u),W=>{O(I,W,!0)}),R=pa(s(u),W=>{O(f,W,!0)});return()=>{R(),y(),v()}});var aa={get enabled(){return n()},set enabled(v=!0){n(v),un()},get selectionActions(){return r()},set selectionActions(v=null){r(v),un()}},fo=Ll(),vo=Cn(fo);jo(vo,v=>O(u,v),()=>s(u));var po=Ct(vo,2),sa=v=>{var y=Ol(),R=In(y);Wo(R,17,()=>s(x),zs,(Z,Q)=>{var H=Tl(),tt=br(In(H),!0);Je(H),Bt(()=>{qo(H,`background-color: ${s(Q).hex??""};`),J(H,"aria-label",s(Q).label),J(H,"title",s(Q).label),Rn(tt,s(Q).label)}),Qt("click",H,()=>uo(s(Q).name)),ft(Z,H)});var W=Ct(R,2),it=Ct(W,2),Fe=Z=>{var Q=_l(),H=Ct(Cn(Q),2);Bt((tt,jt)=>{J(H,"aria-disabled",s(_)),J(H,"aria-label",tt),J(H,"title",jt)},[()=>s(d).t("tools.annotationToolbar.readAloudA11y"),()=>s(d).t("tools.annotationToolbar.readAloud")]),Qt("click",H,ra),ft(Z,Q)};le(it,Z=>{s(ir)&&Z(Fe)});var _n=Ct(it,2),ca=Z=>{var Q=Nl();Wo(Ct(Cn(Q),2),17,()=>s(bn),H=>H.id,(H,tt)=>{const jt=ht(()=>ea(s(tt)));var At=Al();let Nt;var ut=In(At),Ve=Zt=>{var Yt=El();Xs(Yt,()=>s(jt),!0),Je(Yt),ft(Zt,Yt)},Be=Zt=>{var Yt=Rs();Bt(()=>Rn(Yt,s(tt).label)),ft(Zt,Yt)};le(ut,Zt=>{s(jt)?Zt(Ve):Zt(Be,-1)}),Je(At),Bt(()=>{Nt=Qs(At,1,"pie-tool-annotation-toolbar__button svelte-1qnnvrt",null,Nt,{"pie-tool-annotation-toolbar__button--icon":!!s(jt)}),J(At,"data-pie-selection-action",s(tt).id),J(At,"aria-label",s(tt).label),J(At,"title",s(tt).tooltip||s(tt).label)}),Qt("click",At,()=>na(s(tt))),ft(H,At)}),ft(Z,Q)};le(_n,Z=>{s(bn).length>0&&Z(ca)});var ua=Ct(_n,2),ha=Z=>{var Q=Rl(),H=Ct(Cn(Q),2),tt=Nt=>{var ut=Cl();Bt((Ve,Be)=>{J(ut,"aria-label",Ve),J(ut,"title",Be)},[()=>s(d).t("tools.annotationToolbar.removeA11y"),()=>s(d).t("tools.annotationToolbar.remove")]),Qt("click",ut,Qi),ft(Nt,ut)};le(H,Nt=>{s(wn)&&Nt(tt)});var jt=Ct(H,2),At=Nt=>{var ut=Ml(),Ve=br(ut,!0);Bt((Be,Zt,Yt)=>{J(ut,"aria-label",Be),J(ut,"title",Zt),Rn(Ve,Yt)},[()=>s(d).t("tools.annotationToolbar.clearAllA11y"),()=>s(d).t("tools.annotationToolbar.clearAll"),()=>s(d).t("tools.annotationToolbar.clearAll")]),Qt("click",ut,ta),ft(Nt,ut)};le(jt,Nt=>{s(yn)&&Nt(At)}),ft(Z,Q)};le(ua,Z=>{(s(wn)||s(yn))&&Z(ha)}),Je(y),jo(y,Z=>O(g,Z),()=>s(g)),Bt((Z,Q,H,tt,jt)=>{J(y,"data-pie-placement",s(w).toolbarPosition.below?"below":"above"),qo(y,`left:${s(w).toolbarPosition.x}px; top:${s(w).toolbarPosition.y}px;`),J(y,"lang",Z),J(y,"dir",Q),J(y,"aria-label",H),J(W,"aria-label",tt),J(W,"title",jt),y.dir=y.dir},[()=>s(d).getLocale(),()=>s(d).getDirection?.()??"ltr",()=>s(d).t("tools.annotationToolbar.toolbarA11y"),()=>s(d).t("tools.annotationToolbar.underlineA11y"),()=>s(d).t("tools.annotationToolbar.underline")]),Qt("keydown",y,oa),Qt("focusout",y,ia),Qt("click",W,()=>uo(Ot.UNDERLINE)),ft(v,y)};le(po,v=>{s(w).isVisible&&v(sa)});var la=br(Ct(po,2),!0);return Bt(()=>Rn(la,s(D))),ft(t,fo),ni(aa)}As(["keydown","focusout","click"]);Il("pie-tool-annotation-toolbar",ul(Pl,{enabled:{attribute:"enabled",type:"Boolean"},selectionActions:{type:"Object"}},[],[],{mode:"open"},fa));function Il(t,e){customElements.get(t)||customElements.define(t,e)}export{Pl as default};