@semiont/browser 0.5.28 → 0.5.29

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 (71) hide show
  1. package/dist/assets/{CookiePreferences-UVUl27XP.js → CookiePreferences-CinujnVd.js} +2 -2
  2. package/dist/assets/{CookiePreferences-UVUl27XP.js.map → CookiePreferences-CinujnVd.js.map} +1 -1
  3. package/dist/assets/{KeyboardShortcutsContext-D8VjaYfK.js → KeyboardShortcutsContext-BwQ1iude.js} +2 -2
  4. package/dist/assets/{KeyboardShortcutsContext-D8VjaYfK.js.map → KeyboardShortcutsContext-BwQ1iude.js.map} +1 -1
  5. package/dist/assets/{PdfAnnotationCanvas.client-LSH3PZPY-B8dnEIps.js → PdfAnnotationCanvas.client-LSH3PZPY-CcbBYgYn.js} +2 -2
  6. package/dist/assets/{PdfAnnotationCanvas.client-LSH3PZPY-B8dnEIps.js.map → PdfAnnotationCanvas.client-LSH3PZPY-CcbBYgYn.js.map} +1 -1
  7. package/dist/assets/{ToolbarPanels-Bf3f6THq.js → ToolbarPanels-D4AQa4cH.js} +2 -2
  8. package/dist/assets/{ToolbarPanels-Bf3f6THq.js.map → ToolbarPanels-D4AQa4cH.js.map} +1 -1
  9. package/dist/assets/{client-B2rbsRTh.js → client--3y6Y86L.js} +2 -2
  10. package/dist/assets/{client-B2rbsRTh.js.map → client--3y6Y86L.js.map} +1 -1
  11. package/dist/assets/{client-kvvQzQsd.js → client-DQkvuP6s.js} +2 -2
  12. package/dist/assets/{client-kvvQzQsd.js.map → client-DQkvuP6s.js.map} +1 -1
  13. package/dist/assets/{en-R5XA26NF-Cuox0uQn.js → en-R5XA26NF-BqWytpwo.js} +1 -1
  14. package/dist/assets/{index-BkTRe71w.js → index-vecxWX4w.js} +5 -5
  15. package/dist/assets/{index-BkTRe71w.js.map → index-vecxWX4w.js.map} +1 -1
  16. package/dist/assets/{layout-ChREg3PD.js → layout-9e1YcaDw.js} +2 -2
  17. package/dist/assets/{layout-ChREg3PD.js.map → layout-9e1YcaDw.js.map} +1 -1
  18. package/dist/assets/{layout-DmBlX8Wv.js → layout-CO_NB7xj.js} +2 -2
  19. package/dist/assets/{layout-DmBlX8Wv.js.map → layout-CO_NB7xj.js.map} +1 -1
  20. package/dist/assets/{layout-5m7ZN_sv.js → layout-GLK_QIQs.js} +2 -2
  21. package/dist/assets/{layout-5m7ZN_sv.js.map → layout-GLK_QIQs.js.map} +1 -1
  22. package/dist/assets/layout-ITFI0_HA.js +2 -0
  23. package/dist/assets/layout-ITFI0_HA.js.map +1 -0
  24. package/dist/assets/{not-found-BOkh1PJR.js → not-found-CSMLdCX4.js} +2 -2
  25. package/dist/assets/{not-found-BOkh1PJR.js.map → not-found-CSMLdCX4.js.map} +1 -1
  26. package/dist/assets/{page-DXZrFCmr.js → page-BS3gQcjY.js} +2 -2
  27. package/dist/assets/{page-DXZrFCmr.js.map → page-BS3gQcjY.js.map} +1 -1
  28. package/dist/assets/{page-Bfk44QuW.js → page-C5nD_mRH.js} +2 -2
  29. package/dist/assets/{page-Bfk44QuW.js.map → page-C5nD_mRH.js.map} +1 -1
  30. package/dist/assets/{page-_daGpD2K.js → page-CBZ9-Qv0.js} +2 -2
  31. package/dist/assets/{page-_daGpD2K.js.map → page-CBZ9-Qv0.js.map} +1 -1
  32. package/dist/assets/{page-CrXiz4-J.js → page-CEOfOFJn.js} +2 -2
  33. package/dist/assets/{page-CrXiz4-J.js.map → page-CEOfOFJn.js.map} +1 -1
  34. package/dist/assets/{page-C45jnN3u.js → page-Cc3JDJuA.js} +2 -2
  35. package/dist/assets/{page-C45jnN3u.js.map → page-Cc3JDJuA.js.map} +1 -1
  36. package/dist/assets/{page-BOgSgEl-.js → page-CcV8oPXf.js} +2 -2
  37. package/dist/assets/{page-BOgSgEl-.js.map → page-CcV8oPXf.js.map} +1 -1
  38. package/dist/assets/{page-BiEYKai0.js → page-Cykwm5Xf.js} +2 -2
  39. package/dist/assets/{page-BiEYKai0.js.map → page-Cykwm5Xf.js.map} +1 -1
  40. package/dist/assets/{page-DL5wQ3pG.js → page-D1Ih1hX6.js} +2 -2
  41. package/dist/assets/{page-DL5wQ3pG.js.map → page-D1Ih1hX6.js.map} +1 -1
  42. package/dist/assets/{page-B2tTEfKp.js → page-D3YhksUZ.js} +2 -2
  43. package/dist/assets/{page-B2tTEfKp.js.map → page-D3YhksUZ.js.map} +1 -1
  44. package/dist/assets/{page-C7fj48Yd.js → page-DLvE0SQg.js} +2 -2
  45. package/dist/assets/{page-C7fj48Yd.js.map → page-DLvE0SQg.js.map} +1 -1
  46. package/dist/assets/{page-ZPLCKgGQ.js → page-Dc5_AoKR.js} +2 -2
  47. package/dist/assets/{page-ZPLCKgGQ.js.map → page-Dc5_AoKR.js.map} +1 -1
  48. package/dist/assets/{page-KrH4sIjg.js → page-Dgd7xLD8.js} +2 -2
  49. package/dist/assets/{page-KrH4sIjg.js.map → page-Dgd7xLD8.js.map} +1 -1
  50. package/dist/assets/{page-CgiAumZ6.js → page-Dyw4kLBQ.js} +2 -2
  51. package/dist/assets/{page-CgiAumZ6.js.map → page-Dyw4kLBQ.js.map} +1 -1
  52. package/dist/assets/{page-C76A3Tvm.js → page-Ek9VUv2q.js} +2 -2
  53. package/dist/assets/{page-C76A3Tvm.js.map → page-Ek9VUv2q.js.map} +1 -1
  54. package/dist/assets/{page-De2leEHb.js → page-Kb_PxACs.js} +2 -2
  55. package/dist/assets/{page-De2leEHb.js.map → page-Kb_PxACs.js.map} +1 -1
  56. package/dist/assets/{page-DGXyF1RD.js → page-OcQ2uaAq.js} +2 -2
  57. package/dist/assets/{page-DGXyF1RD.js.map → page-OcQ2uaAq.js.map} +1 -1
  58. package/dist/assets/{page-zpMXForS.js → page-ZW2LvDvY.js} +2 -2
  59. package/dist/assets/{page-zpMXForS.js.map → page-ZW2LvDvY.js.map} +1 -1
  60. package/dist/assets/{page-CQJx-JXR.js → page-zWVJIy5v.js} +2 -2
  61. package/dist/assets/{page-CQJx-JXR.js.map → page-zWVJIy5v.js.map} +1 -1
  62. package/dist/assets/{routing-CygMogfF.js → routing-DDD7UWam.js} +2 -2
  63. package/dist/assets/{routing-CygMogfF.js.map → routing-DDD7UWam.js.map} +1 -1
  64. package/dist/assets/{routing-BJiyORAR.js → routing-HOPiOt_q.js} +2 -2
  65. package/dist/assets/{routing-BJiyORAR.js.map → routing-HOPiOt_q.js.map} +1 -1
  66. package/dist/assets/{web-D6kqUluK.js → web-D1HVvdzi.js} +2 -2
  67. package/dist/assets/{web-D6kqUluK.js.map → web-D1HVvdzi.js.map} +1 -1
  68. package/dist/index.html +1 -1
  69. package/package.json +1 -1
  70. package/dist/assets/layout-xM3HYPpK.js +0 -2
  71. package/dist/assets/layout-xM3HYPpK.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-Dicw8YoH.js","assets/vendor-BVP6ONpk.js","assets/rolldown-runtime-hePW80VL.js","assets/i18n-zIDJOEfo.js","assets/PdfAnnotationCanvas.client-LSH3PZPY-B8dnEIps.js","assets/layout-ChREg3PD.js","assets/KeyboardShortcutsContext-D8VjaYfK.js","assets/routing-BJiyORAR.js","assets/page-C76A3Tvm.js","assets/page-BiEYKai0.js","assets/CookiePreferences-UVUl27XP.js","assets/XMarkIcon-CVrfCz2h.js","assets/routing-CygMogfF.js","assets/page-DL5wQ3pG.js","assets/page-ZPLCKgGQ.js","assets/page-BOgSgEl-.js","assets/page-CQJx-JXR.js","assets/page-CgiAumZ6.js","assets/page-CrXiz4-J.js","assets/layout-xM3HYPpK.js","assets/ToolbarPanels-Bf3f6THq.js","assets/ChevronLeftIcon-BcDi-sgg.js","assets/page-_daGpD2K.js","assets/page-DGXyF1RD.js","assets/page-B2tTEfKp.js","assets/page-C45jnN3u.js","assets/not-found-BOkh1PJR.js","assets/layout-5m7ZN_sv.js","assets/CommandLineIcon-O8NfVSEq.js","assets/page-De2leEHb.js","assets/client-kvvQzQsd.js","assets/client-B2rbsRTh.js","assets/page-zpMXForS.js","assets/layout-DmBlX8Wv.js","assets/page-DXZrFCmr.js","assets/page-C7fj48Yd.js","assets/page-Bfk44QuW.js","assets/page-KrH4sIjg.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-Dicw8YoH.js","assets/vendor-BVP6ONpk.js","assets/rolldown-runtime-hePW80VL.js","assets/i18n-zIDJOEfo.js","assets/PdfAnnotationCanvas.client-LSH3PZPY-CcbBYgYn.js","assets/layout-9e1YcaDw.js","assets/KeyboardShortcutsContext-BwQ1iude.js","assets/routing-HOPiOt_q.js","assets/page-Ek9VUv2q.js","assets/page-Cykwm5Xf.js","assets/CookiePreferences-CinujnVd.js","assets/XMarkIcon-CVrfCz2h.js","assets/routing-DDD7UWam.js","assets/page-D1Ih1hX6.js","assets/page-Dc5_AoKR.js","assets/page-CcV8oPXf.js","assets/page-zWVJIy5v.js","assets/page-Dyw4kLBQ.js","assets/page-CEOfOFJn.js","assets/layout-ITFI0_HA.js","assets/ToolbarPanels-D4AQa4cH.js","assets/ChevronLeftIcon-BcDi-sgg.js","assets/page-CBZ9-Qv0.js","assets/page-OcQ2uaAq.js","assets/page-D3YhksUZ.js","assets/page-Cc3JDJuA.js","assets/not-found-CSMLdCX4.js","assets/layout-GLK_QIQs.js","assets/CommandLineIcon-O8NfVSEq.js","assets/page-Kb_PxACs.js","assets/client-DQkvuP6s.js","assets/client--3y6Y86L.js","assets/page-ZW2LvDvY.js","assets/layout-CO_NB7xj.js","assets/page-BS3gQcjY.js","assets/page-DLvE0SQg.js","assets/page-C5nD_mRH.js","assets/page-Dgd7xLD8.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{i as r,n as i,r as a,t as o}from"./i18n-zIDJOEfo.js";import{a as s,c,d as l,f as u,l as d,m as f,n as p,o as m,p as h,s as g,t as _,u as v}from"./vendor-BVP6ONpk.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var y=t(r(),1),b=t(h()),x=[];x.forEach,x.slice;var S=[`__proto__`,`constructor`,`prototype`];function C(e){return!(typeof e!=`string`||e.length===0||e.length>128||S.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function w(e){return!(!C(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function T(e){return C(e)}var E={lng:w,ns:T};function D(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function O(e){if(typeof e!=`string`||e.length===0)return e;try{let t=new URL(e);return t.username||t.password?(t.username=``,t.password=``,t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,`$1`)}}function k(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function A(e){return!!e&&typeof e.then==`function`}function j(e){return A(e)?e:Promise.resolve(e)}var ee=/\{\{(.+?)\}\}/g;function M(e,t){let n=!1,r=e.replace(ee,(e,r)=>{let i=r.trim();if(S.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=E[i]||w,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var N=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,te;typeof fetch==`function`?te=fetch:N&&typeof N.fetch==`function`&&(te=N.fetch);var ne=k()&&N?N.XMLHttpRequest:void 0,re=typeof ActiveXObject==`function`&&N?N.ActiveXObject:void 0,ie=[`__proto__`,`constructor`,`prototype`],ae=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))ie.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},oe=(e,t,n,r)=>{let i=e=>{if(!e.ok)return n(e.statusText||`Error`,{status:e.status});e.text().then(t=>{n(null,{status:e.status,data:t})}).catch(n)};if(r){let a=r(e,t);if(a instanceof Promise){a.then(i).catch(n);return}}typeof fetch==`function`?fetch(e,t).then(i).catch(n):te(e,t).then(i).catch(n)},se=(e,t,n,r)=>{e.queryStringParams&&(t=ae(t,e.queryStringParams));let i={...typeof e.customHeaders==`function`?e.customHeaders():e.customHeaders};typeof window>`u`&&typeof global<`u`&&global.process!==void 0&&global.process.versions&&global.process.versions.node&&(i[`User-Agent`]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(i[`Content-Type`]=`application/json`);let a=typeof e.requestOptions==`function`?e.requestOptions(n):e.requestOptions,o={method:n?`POST`:`GET`,body:n?e.stringify(n):void 0,headers:i,...e._omitFetchOptions?{}:a},s=typeof e.alternateFetch==`function`&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{oe(t,o,r,s)}catch(n){if(!a||Object.keys(a).length===0||!n.message||n.message.indexOf(`not implemented`)<0)return r(n);try{Object.keys(a).forEach(e=>{delete o[e]}),oe(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},ce=(e,t,n,r)=>{n&&typeof n==`object`&&(n=ae(``,n).slice(1)),e.queryStringParams&&(t=ae(t,e.queryStringParams));try{let i=ne?new ne:new re(`MSXML2.XMLHTTP.3.0`);i.open(n?`POST`:`GET`,t,1),e.crossDomain||i.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),i.overrideMimeType&&i.overrideMimeType(`application/json`);let a=e.customHeaders;if(a=typeof a==`function`?a():a,a)for(let e of Object.keys(a))ie.indexOf(e)>-1||i.setRequestHeader(e,a[e]);i.onreadystatechange=()=>{i.readyState>3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(e){console&&console.log(e)}},le=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),te&&t.indexOf(`file:`)!==0)return se(e,t,n,r);if(k()||typeof ActiveXObject==`function`)return ce(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},P=()=>({loadPath:`/locales/{{lng}}/{{ns}}.json`,addPath:`/locales/add/{{lng}}/{{ns}}`,parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||``}),parseLoadPayload:(e,t)=>void 0,request:le,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),F=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type=`backend`,this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...P(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){let e=setInterval(()=>this.reload(),this.options.reloadInterval);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,i){let a=this.options.loadPath;typeof this.options.loadPath==`function`&&(a=this.options.loadPath(e,n)),a=j(a),a.then(a=>{if(!a)return i(null,{});let o=M(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(D).join(`, `),r=n.map(D).join(`, `);return i(Error(`i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[`+t+`] namespaces=[`+r+`]`),!1)}this.loadUrl(o,i,t,r)})}loadUrl(e,t,n,r){let i=typeof n==`string`?[n]:n,a=typeof r==`string`?[r]:r,o=this.options.parseLoadPayload(i,a),s=D(O(e));this.options.request(this.options,e,o,(e,i)=>{if(i&&(i.status>=500&&i.status<600||!i.status))return t(`failed loading `+s+`; status code: `+i.status,!0);if(i&&i.status>=400&&i.status<500)return t(`failed loading `+s+`; status code: `+i.status,!1);if(!i&&e&&e.message){let n=e.message.toLowerCase();if([`failed`,`fetch`,`network`,`load`].find(e=>n.indexOf(e)>-1))return t(`failed loading `+s+`: `+D(e.message),!0)}if(e)return t(e,!1);let a,o;try{a=typeof i.data==`string`?this.options.parse(i.data,n,r):i.data}catch{o=`failed parsing `+s+` to json`}if(o)return t(o,!1);t(null,a)})}create(e,t,n,r,i){if(!this.options.addPath)return;typeof e==`string`&&(e=[e]);let a=this.options.parsePayload(t,n,r),o=0,s=[],c=[];e.forEach(n=>{let r=this.options.addPath;typeof this.options.addPath==`function`&&(r=this.options.addPath(n,t));let l=M(r,{lng:n,ns:t});if(l==null){o+=1,i&&o===e.length&&i(s,c);return}this.options.request(this.options,l,a,(t,n)=>{o+=1,s.push(t),c.push(n),o===e.length&&typeof i==`function`&&i(s,c)})})}reload(){let{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()===`cimode`)return;let i=[],a=e=>{t.toResolveHierarchy(e).forEach(e=>{i.indexOf(e)<0&&i.push(e)})};a(r),this.allOptions.preload&&this.allOptions.preload.forEach(e=>a(e)),i.forEach(t=>{this.allOptions.ns.forEach(r=>{e.read(t,r,`read`,null,null,(i,a)=>{i&&n.warn(`loading namespace ${r} for language ${t} failed`,i),!i&&a&&n.log(`loaded namespace ${r} for language ${t}`,a),e.loaded(`${t}|${r}`,i,a)})})})}};F.type=`backend`;var ue=`ar.bn.cs.da.de.el.en.es.fa.fi.fr.he.hi.id.it.ja.ko.ms.nl.no.pl.pt.ro.sv.th.tr.uk.vi.zh`.split(`.`);function de(e){return ue.includes(e)}a.use(F).use(i).init({ns:[`translation`],defaultNS:`translation`,fallbackLng:`en`,supportedLngs:[...ue],backend:{loadPath:`/messages/{{lng}}.json`},interpolation:{escapeValue:!1},initAsync:!1});var I=_(),fe;function pe(e){fe=e}var me;async function he(){return me||=s(()=>import(`./pdf-Dicw8YoH.js`).then(e=>(fe&&(e.GlobalWorkerOptions.workerSrc=fe),e)),__vite__mapDeps([0,1,2,3])),me}async function ge(e){return(await he()).getDocument({url:e}).promise}async function _e(e,t=1){let n=e.getViewport({scale:t}),r=document.createElement(`canvas`);return r.width=n.width,r.height=n.height,await e.render({canvas:r,viewport:n}).promise,{dataUrl:r.toDataURL(`image/png`),width:n.width,height:n.height}}function ve(e,t,n,r,i){let a=e.left+t,o=e.top+n;return{x:a,y:o,width:r,height:i,top:o,right:a+r,bottom:o+i,left:a}}var ye=Object.create,be=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Se=Object.getOwnPropertyNames,Ce=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty,Te=e=>t=>{var n=e[t];if(n)return n();throw Error(`Module not found in bundle: `+t)},L=(e,t)=>function(){try{return t||(0,e[Se(e)[0]])((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},Ee=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Se(t))!we.call(e,i)&&i!==n&&be(e,i,{get:()=>t[i],enumerable:!(r=xe(t,i))||r.enumerable});return e},De=(e,t,n)=>(n=e==null?{}:ye(Ce(e)),Ee(t||!e||!e.__esModule?be(n,`default`,{value:e,enumerable:!0}):n,e)),Oe=function(e,t){return Oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Oe(e,t)};function ke(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Oe(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Ae(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function je(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Me(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Ne(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Pe(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Fe(e){return this instanceof Fe?(this.v=e,this):new Fe(e)}function Ie(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Fe?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Le(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Me==`function`?Me(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Re(e){return typeof e==`function`}function ze(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Be=ze(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
3
3
  `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(`
4
4
  `):``,this.name=`UnsubscriptionError`,this.errors=t}});function Ve(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var He=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a){if(this._parentage=null,Array.isArray(a))try{for(var o=Me(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this)}var c=this.initialTeardown;if(Re(c))try{c()}catch(e){i=e instanceof Be?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=Me(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{Ge(f)}catch(e){i??=[],e instanceof Be?i=Pe(Pe([],Ne(i)),Ne(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new Be(i)}},e.prototype.add=function(t){if(t&&t!==this){if(this.closed)Ge(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ve(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Ve(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),Ue=He.EMPTY;function We(e){return e instanceof He||e&&`closed`in e&&Re(e.remove)&&Re(e.add)&&Re(e.unsubscribe)}function Ge(e){Re(e)?e():e.unsubscribe()}var Ke={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qe={setTimeout:function(e,t){var n=[...arguments].slice(2),r=qe.delegate;return r?.setTimeout?r.setTimeout.apply(r,Pe([e,t],Ne(n))):setTimeout.apply(void 0,Pe([e,t],Ne(n)))},clearTimeout:function(e){return(qe.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Je(e){qe.setTimeout(function(){var t=Ke.onUnhandledError;if(t)t(e);else throw e})}function Ye(){}var Xe=(function(){return $e(`C`,void 0,void 0)})();function Ze(e){return $e(`E`,void 0,e)}function Qe(e){return $e(`N`,e,void 0)}function $e(e,t,n){return{kind:e,value:t,error:n}}var et=null;function tt(e){if(Ke.useDeprecatedSynchronousErrorHandling){var t=!et;if(t&&(et={errorThrown:!1,error:null}),e(),t){var n=et,r=n.errorThrown,i=n.error;if(et=null,r)throw i}}else e()}function nt(e){Ke.useDeprecatedSynchronousErrorHandling&&et&&(et.errorThrown=!0,et.error=e)}var rt=function(e){ke(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,We(t)&&t.add(n)):n.destination=dt,n}return t.create=function(e,t,n){return new st(e,t,n)},t.prototype.next=function(e){this.isStopped?ut(Qe(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?ut(Ze(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?ut(Xe,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(He),it=Function.prototype.bind;function at(e,t){return it.call(e,t)}var ot=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ct(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ct(e)}else ct(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ct(e)}},e}(),st=function(e){ke(t,e);function t(t,n,r){var i=e.call(this)||this,a;if(Re(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&Ke.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&at(t.next,o),error:t.error&&at(t.error,o),complete:t.complete&&at(t.complete,o)}):a=t}return i.destination=new ot(a),i}return t}(rt);function ct(e){Ke.useDeprecatedSynchronousErrorHandling?nt(e):Je(e)}function lt(e){throw e}function ut(e,t){var n=Ke.onStoppedNotification;n&&qe.setTimeout(function(){return n(e,t)})}var dt={closed:!0,next:Ye,error:lt,complete:Ye},ft=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function pt(e){return e}function mt(e){return e.length===0?pt:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var ht=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=vt(e)?e:new st(e,t,n);return tt(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=gt(t),new t(function(t,r){var i=new st({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[ft]=function(){return this},e.prototype.pipe=function(){return mt([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=gt(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function gt(e){return e??Ke.Promise??Promise}function _t(e){return e&&Re(e.next)&&Re(e.error)&&Re(e.complete)}function vt(e){return e&&e instanceof rt||_t(e)&&We(e)}function yt(e){return Re(e?.lift)}function bt(e){return function(t){if(yt(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function xt(e,t,n,r,i){return new St(e,t,n,r,i)}var St=function(e){ke(t,e);function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},t}(rt),Ct=ze(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),wt=function(e){ke(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new Tt(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ct},t.prototype.next=function(e){var t=this;tt(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=Me(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;tt(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;tt(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?Ue:(this.currentObservers=null,a.push(e),new He(function(){t.currentObservers=null,Ve(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new ht;return e.source=this,e},t.create=function(e,t){return new Tt(e,t)},t}(ht),Tt=function(e){ke(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??Ue},t}(wt),Et=function(e){ke(t,e);function t(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(wt),Dt={now:function(){return(Dt.delegate||Date).now()},delegate:void 0},Ot=function(e){ke(t,e);function t(t,n){return e.call(this)||this}return t.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},t}(He),kt={setInterval:function(e,t){var n=[...arguments].slice(2),r=kt.delegate;return r?.setInterval?r.setInterval.apply(r,Pe([e,t],Ne(n))):setInterval.apply(void 0,Pe([e,t],Ne(n)))},clearInterval:function(e){return(kt.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},At=function(e){ke(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),kt.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&kt.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ve(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Ot),jt=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Dt.now,e}(),Mt=new(function(e){ke(t,e);function t(t,n){n===void 0&&(n=jt.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},t}(jt))(At),Nt=new ht(function(e){return e.complete()});function Pt(e){return e&&Re(e.schedule)}function Ft(e){return e[e.length-1]}function It(e){return Pt(Ft(e))?e.pop():void 0}function Lt(e,t){return typeof Ft(e)==`number`?e.pop():t}var Rt=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function zt(e){return Re(e?.then)}function Bt(e){return Re(e[ft])}function Vt(e){return Symbol.asyncIterator&&Re(e?.[Symbol.asyncIterator])}function Ht(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Ut(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var Wt=Ut();function Gt(e){return Re(e?.[Wt])}function Kt(e){return Ie(this,arguments,function(){var t,n,r,i;return je(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Fe(t.read())];case 3:return n=a.sent(),r=n.value,i=n.done,i?[4,Fe(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Fe(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function qt(e){return Re(e?.getReader)}function Jt(e){if(e instanceof ht)return e;if(e!=null){if(Bt(e))return Yt(e);if(Rt(e))return Xt(e);if(zt(e))return Zt(e);if(Vt(e))return $t(e);if(Gt(e))return Qt(e);if(qt(e))return en(e)}throw Ht(e)}function Yt(e){return new ht(function(t){var n=e[ft]();if(Re(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function Xt(e){return new ht(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function Zt(e){return new ht(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,Je)})}function Qt(e){return new ht(function(t){var n,r;try{for(var i=Me(e),a=i.next();!a.done;a=i.next()){var o=a.value;if(t.next(o),t.closed)return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function $t(e){return new ht(function(t){tn(e,t).catch(function(e){return t.error(e)})})}function en(e){return $t(Kt(e))}function tn(e,t){var n,r,i,a;return Ae(this,void 0,void 0,function(){var o,s;return je(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Le(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),r.done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),i={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function nn(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function rn(e,t){return t===void 0&&(t=0),bt(function(n,r){n.subscribe(xt(r,function(n){return nn(r,e,function(){return r.next(n)},t)},function(){return nn(r,e,function(){return r.complete()},t)},function(n){return nn(r,e,function(){return r.error(n)},t)}))})}function an(e,t){return t===void 0&&(t=0),bt(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function on(e,t){return Jt(e).pipe(an(t),rn(t))}function sn(e,t){return Jt(e).pipe(an(t),rn(t))}function cn(e,t){return new ht(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function ln(e,t){return new ht(function(n){var r;return nn(n,t,function(){r=e[Wt](),nn(n,t,function(){var e,t,i;try{e=r.next(),t=e.value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return Re(r?.return)&&r.return()}})}function un(e,t){if(!e)throw Error(`Iterable cannot be null`);return new ht(function(n){nn(n,t,function(){var r=e[Symbol.asyncIterator]();nn(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function dn(e,t){return un(Kt(e),t)}function fn(e,t){if(e!=null){if(Bt(e))return on(e,t);if(Rt(e))return cn(e,t);if(zt(e))return sn(e,t);if(Vt(e))return un(e,t);if(Gt(e))return ln(e,t);if(qt(e))return dn(e,t)}throw Ht(e)}function pn(e,t){return t?fn(e,t):Jt(e)}function mn(){var e=[...arguments];return pn(e,It(e))}function hn(e,t){var n=Re(e)?e:function(){return e},r=function(e){return e.error(n())};return new ht(t?function(e){return t.schedule(r,0,e)}:r)}var gn=ze(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}});function _n(e,t){var n=typeof t==`object`;return new Promise(function(r,i){var a=!1,o;e.subscribe({next:function(e){o=e,a=!0},error:i,complete:function(){a?r(o):n?r(t.defaultValue):i(new gn)}})})}function vn(e,t){var n=typeof t==`object`;return new Promise(function(r,i){var a=new st({next:function(e){r(e),a.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new gn)}});e.subscribe(a)})}function yn(e){return e instanceof Date&&!isNaN(e)}var bn=ze(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function xn(e,t){var n=yn(e)?{first:e}:typeof e==`number`?{each:e}:e,r=n.first,i=n.each,a=n.with,o=a===void 0?Sn:a,s=n.scheduler,c=s===void 0?t??Mt:s,l=n.meta,u=l===void 0?null:l;if(r==null&&i==null)throw TypeError(`No timeout provided.`);return bt(function(e,t){var n,a,s=null,l=0,d=function(e){a=nn(t,c,function(){try{n.unsubscribe(),Jt(o({meta:u,lastValue:s,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe(xt(t,function(e){a?.unsubscribe(),l++,t.next(s=e),i>0&&d(i)},void 0,void 0,function(){a?.closed||a?.unsubscribe(),s=null})),!l&&d(r==null?i:typeof r==`number`?r:+r-c.now())})}function Sn(e){throw new bn(e)}function Cn(e,t){return bt(function(n,r){var i=0;n.subscribe(xt(r,function(n){r.next(e.call(t,n,i++))}))})}function wn(e,t,n,r,i,a,o,s){var c=[],l=0,u=0,d=!1,f=function(){d&&!c.length&&!l&&t.complete()},p=function(e){return l<r?m(e):c.push(e)},m=function(e){a&&t.next(e),l++;var s=!1;Jt(n(e,u++)).subscribe(xt(t,function(e){i?.(e),a?p(e):t.next(e)},function(){s=!0},void 0,function(){if(s)try{l--;for(var e=function(){var e=c.shift();o?nn(t,o,function(){return m(e)}):m(e)};c.length&&l<r;)e();f()}catch(e){t.error(e)}}))};return e.subscribe(xt(t,p,function(){d=!0,f()})),function(){s?.()}}function Tn(e,t,n){return n===void 0&&(n=1/0),Re(t)?Tn(function(n,r){return Cn(function(e,i){return t(n,e,r,i)})(Jt(e(n,r)))},n):(typeof t==`number`&&(n=t),bt(function(t,r){return wn(t,r,e,n)}))}function En(e){return e===void 0&&(e=1/0),Tn(pt,e)}function Dn(){return En(1)}function On(){var e=[...arguments];return Dn()(pn(e,It(e)))}function kn(){var e=[...arguments],t=It(e),n=Lt(e,1/0),r=e;return r.length?r.length===1?Jt(r[0]):En(n)(pn(r,t)):Nt}function An(e,t){return bt(function(n,r){var i=0;n.subscribe(xt(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function jn(e){return bt(function(t,n){var r=null,i=!1,a;r=t.subscribe(xt(n,void 0,void 0,function(o){a=Jt(e(o,jn(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function Mn(e,t){return t===void 0&&(t=Mt),bt(function(n,r){var i=null,a=null,o=null,s=function(){if(i){i.unsubscribe(),i=null;var e=a;a=null,r.next(e)}};function c(){var n=o+e,a=t.now();if(a<n){i=this.schedule(void 0,n-a),r.add(i);return}s()}n.subscribe(xt(r,function(n){a=n,o=t.now(),i||(i=t.schedule(c,e),r.add(i))},function(){s(),r.complete()},void 0,function(){a=i=null}))})}function Nn(e){return bt(function(t,n){var r=!1;t.subscribe(xt(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Pn(e){return e<=0?function(){return Nt}:bt(function(t,n){var r=0;t.subscribe(xt(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function Fn(e,t){return t===void 0&&(t=pt),e??=In,bt(function(n,r){var i,a=!0;n.subscribe(xt(r,function(n){var o=t(n);(a||!e(i,o))&&(a=!1,i=o,r.next(n))}))})}function In(e,t){return e===t}function Ln(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new wt}:t,r=e.resetOnError,i=r===void 0||r,a=e.resetOnComplete,o=a===void 0||a,s=e.resetOnRefCountZero,c=s===void 0||s;return function(e){var t,r,a,s=0,l=!1,u=!1,d=function(){r?.unsubscribe(),r=void 0},f=function(){d(),t=a=void 0,l=u=!1},p=function(){var e=t;f(),e?.unsubscribe()};return bt(function(e,m){s++,!u&&!l&&d();var h=a??=n();m.add(function(){s--,s===0&&!u&&!l&&(r=Rn(p,c))}),h.subscribe(m),!t&&s>0&&(t=new st({next:function(e){return h.next(e)},error:function(e){u=!0,d(),r=Rn(f,i,e),h.error(e)},complete:function(){l=!0,d(),r=Rn(f,o),h.complete()}}),Jt(e).subscribe(t))})(e)}}function Rn(e,t){var n=[...arguments].slice(2);if(t===!0){e();return}if(t!==!1){var r=new st({next:function(){r.unsubscribe(),e()}});return Jt(t.apply(void 0,Pe([],Ne(n)))).subscribe(r)}}function zn(e){return An(function(t,n){return e<=n})}function Bn(){var e=[...arguments],t=It(e);return bt(function(n,r){(t?On(e,n,t):On(e,n)).subscribe(r)})}function Vn(e,t){return bt(function(n,r){var i=null,a=0,o=!1,s=function(){return o&&!i&&r.complete()};n.subscribe(xt(r,function(n){i?.unsubscribe();var o=0,c=a++;Jt(e(n,c)).subscribe(i=xt(r,function(e){return r.next(t?t(n,e,c,o++):e)},function(){i=null,s()}))},function(){o=!0,s()}))})}function Hn(e){return bt(function(t,n){Jt(e).subscribe(xt(n,function(){return n.complete()},Ye)),!n.closed&&t.subscribe(n)})}function Un(e){return e}function Wn(e){return e}function Gn(e){return e}function Kn(e){return e}function qn(e){return e}function Jn(e){return e}function Yn(e){return e}var Xn={"bind:update-body":{result:`bind:body-updated`,failure:`bind:body-update-failed`},"browse:resource-requested":{result:`browse:resource-result`,failure:`browse:resource-failed`},"browse:anchored-text-requested":{result:`browse:anchored-text-result`,failure:`browse:anchored-text-failed`},"browse:anchored-text-by-checksum-requested":{result:`browse:anchored-text-by-checksum-result`,failure:`browse:anchored-text-by-checksum-failed`},"browse:resources-requested":{result:`browse:resources-result`,failure:`browse:resources-failed`},"browse:annotation-requested":{result:`browse:annotation-result`,failure:`browse:annotation-failed`},"browse:annotations-requested":{result:`browse:annotations-result`,failure:`browse:annotations-failed`},"browse:annotation-history-requested":{result:`browse:annotation-history-result`,failure:`browse:annotation-history-failed`},"browse:events-requested":{result:`browse:events-result`,failure:`browse:events-failed`},"browse:referenced-by-requested":{result:`browse:referenced-by-result`,failure:`browse:referenced-by-failed`},"browse:entity-types-requested":{result:`browse:entity-types-result`,failure:`browse:entity-types-failed`},"browse:tag-schemas-requested":{result:`browse:tag-schemas-result`,failure:`browse:tag-schemas-failed`},"browse:agents-requested":{result:`browse:agents-result`,failure:`browse:agents-failed`},"browse:directory-requested":{result:`browse:directory-result`,failure:`browse:directory-failed`},"browse:annotation-context-requested":{result:`browse:annotation-context-result`,failure:`browse:annotation-context-failed`},"frame:add-entity-type":{result:`frame:entity-type-add-ok`,failure:`frame:entity-type-add-failed`},"frame:add-tag-schema":{result:`frame:tag-schema-add-ok`,failure:`frame:tag-schema-add-failed`},"gather:requested":{result:`gather:complete`,failure:`gather:failed`,progress:`gather:annotation-progress`},"gather:resource-requested":{result:`gather:resource-complete`,failure:`gather:resource-failed`},"gather:summary-requested":{result:`gather:summary-result`,failure:`gather:summary-failed`},"job:create":{result:`job:created`,failure:`job:create-failed`},"job:status-requested":{result:`job:status-result`,failure:`job:status-failed`},"job:cancel-requested":{result:`job:cancel-ok`,failure:`job:cancel-failed`},"job:claim":{result:`job:claimed`,failure:`job:claim-failed`},"mark:create-request":{result:`mark:create-ok`,failure:`mark:create-failed`},"mark:delete":{result:`mark:delete-ok`,failure:`mark:delete-failed`},"mark:archive":{result:`mark:archive-ok`,failure:`mark:archive-failed`},"mark:unarchive":{result:`mark:unarchive-ok`,failure:`mark:unarchive-failed`},"mark:update-entity-types":{result:`mark:update-entity-types-ok`,failure:`mark:update-entity-types-failed`},"match:search-requested":{result:`match:search-results`,failure:`match:search-failed`},"weave:rebuild":{result:`weave:rebuild-ok`,failure:`weave:rebuild-failed`},"smelt:rebuild-anchors":{result:`smelt:rebuild-anchors-ok`,failure:`smelt:rebuild-anchors-failed`},"yield:create":{result:`yield:create-ok`,failure:`yield:create-failed`},"yield:clone-persist":{result:`yield:clone-persist-ok`,failure:`yield:clone-persist-failed`},"yield:update":{result:`yield:update-ok`,failure:`yield:update-failed`},"yield:clone-create":{result:`yield:clone-created`,failure:`yield:clone-create-failed`},"yield:clone-resource-requested":{result:`yield:clone-resource-result`,failure:`yield:clone-resource-failed`},"yield:clone-token-requested":{result:`yield:clone-token-generated`,failure:`yield:clone-token-failed`}},Zn=[`job:report-progress`,`job:complete`,`job:fail`,`frame:entity-type-added`,`frame:tag-schema-added`,`beckon:focus`,`beckon:sparkle`,`bus:resume-gap`,`browse:resource-open`,`browse:resource-viewed`,`session:joined`,`session:left`,`browse:click`],Qn=[...Object.keys(Xn).flatMap(e=>{let t=Xn[e];return`progress`in t?[t.result,t.failure,t.progress]:[t.result,t.failure]}),...Zn],$n=typeof process<`u`&&!!{}.SEMIONT_BUS_LOG,er=typeof process<`u`&&!!process.versions?.node;function tr(){return globalThis.__SEMIONT_BUS_LOG__?!0:$n}var nr;function rr(e){nr=e}function ir(e,t,n,r){if(!tr())return;let i=n?.correlationId,a=typeof i==`string`?i.slice(0,8):void 0,o;if(nr)try{o=nr()}catch{}let s=`[bus ${e}] ${t}`+(r?` scope=${r}`:``)+(a?` cid=${a}`:``)+(o?` trace=${o.slice(0,8)}`:``);console.debug(s,n)}function ar(){return er}var or=new Set;function sr(e,t,n){if(n>0)return;let r=t?.correlationId;typeof r==`string`&&r.length!==0&&(Qn.includes(e)||or.has(e)||(or.add(e),console.warn(`[bus DROP] ${e} cid=${r.slice(0,8)} emitted with 0 subscribers and not in BRIDGED_CHANNELS \u2014 a correlation reply with no forwarder is dropped, so the awaiting client times out (no error). Bridge it by declaring its operation in BUS_OPERATIONS (packages/core/src/bus-operations.ts) \u2014 or, if it is a non-reply broadcast, add it to BRIDGED_BROADCASTS (packages/core/src/bridged-channels.ts) \u2014 so transports subscribe to it.`)))}var cr=class{subjects;isDestroyed;constructor(){this.subjects=new Map,this.isDestroyed=!1}get(e){if(this.isDestroyed)throw Error(`Cannot access event '${String(e)}' on destroyed bus`);if(!this.subjects.has(e)){let t=new wt,n=tr(),r=ar();if(n||r){let i=t,a=t.next.bind(t);t.next=t=>{n&&ir(`EMIT`,String(e),t),r&&sr(String(e),t,i.observers.length),a(t)}}this.subjects.set(e,t)}return this.subjects.get(e)}getDomainEvent(e){return this.get(e)}observedChannels(){let e=[];for(let[t,n]of this.subjects)n.observed&&e.push(String(t));return e}destroy(){if(!this.isDestroyed){for(let e of this.subjects.values())e.complete();this.subjects.clear(),this.isDestroyed=!0}}get destroyed(){return this.isDestroyed}scope(e){return new lr(this,e)}},lr=class e{constructor(e,t){this.parent=e,this.scopePrefix=t}parent;scopePrefix;get(e){let t=`${this.scopePrefix}:${e}`,n=this.parent.subjects;return n.has(t)||n.set(t,new wt),n.get(t)}getDomainEvent(e){return this.get(e)}scope(t){return new e(this.parent,`${this.scopePrefix}:${t}`)}};function ur(e){if(e.includes(`/`))throw TypeError(`Expected ResourceId, got URI: ${e}`);return e}function dr(e){if(e.includes(`/`))throw TypeError(`Expected AnnotationId, got URI: ${e}`);return e}var fr=[`yield:created`,`yield:cloned`,`yield:updated`,`yield:moved`,`yield:representation-added`,`yield:representation-removed`,`mark:added`,`mark:removed`,`mark:body-updated`,`mark:archived`,`mark:unarchived`,`mark:entity-tag-added`,`mark:entity-tag-removed`,`frame:entity-type-added`,`frame:tag-schema-added`,`job:started`,`job:completed`,`job:failed`],pr=[];function mr(e){let t=e.payload;if(e.type===`mark:added`)return t?.annotation?.id||null;if((e.type===`mark:removed`||e.type===`mark:body-updated`)&&t?.annotationId&&e.resourceId)try{let n=e.resourceId;return`${n.substring(0,n.lastIndexOf(`/resources/`))}/annotations/${t.annotationId}`}catch{return null}return null}function hr(){let e=crypto.getRandomValues(new Uint8Array(16));return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function gr(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function _r(){let e=gr(hr());return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function vr(e){if(!e)return null;let t=(Array.isArray(e)?e:[e]).find(e=>e.type===`TextPositionSelector`);return t&&t.type===`TextPositionSelector`?t:null}function yr(e){if(!e)return null;let t=(Array.isArray(e)?e:[e]).find(e=>e.type===`SvgSelector`);return t&&t.type===`SvgSelector`?t:null}function br(e){if(!e)return null;let t=(Array.isArray(e)?e:[e]).find(e=>e.type===`FragmentSelector`);return t&&t.type===`FragmentSelector`?t:null}function xr(e){if(Array.isArray(e)){for(let t of e)if(typeof t==`object`&&t&&`type`in t&&`source`in t){let e=t.type,n=t.source;if(e===`SpecificResource`&&typeof n==`string`)return n}return null}if(typeof e==`object`&&e&&`type`in e&&`source`in e){let t=e.type,n=e.source;if(t===`SpecificResource`&&typeof n==`string`)return n}return null}function Sr(e){return xr(e)!==null}function Cr(e){if(typeof e!=`string`)return e.selector}function wr(e){return e.motivation===`highlighting`}function Tr(e){return e.motivation===`linking`}function Er(e){return e.motivation===`assessing`}function Dr(e){return e.motivation===`commenting`}function Or(e){return e.motivation===`tagging`}function kr(e){if(!Dr(e))return;let t=Array.isArray(e.body)?e.body[0]:e.body;if(t&&`value`in t)return t.value}function Ar(e){return Tr(e)&&Sr(e.body)}function jr(e){if(!e)return``;let t=(Array.isArray(e)?e:[e]).find(e=>e.type===`TextQuoteSelector`);return t?t.exact:``}function Mr(e){return jr(Cr(e.target))}function Nr(e){let t=(Array.isArray(e)?e:[e]).find(e=>e.type===`TextQuoteSelector`);return t&&t.type===`TextQuoteSelector`?t:null}function Pr(e){return`page=${e.page}&viewrect=${e.x},${e.y},${e.width},${e.height}`}function Fr(e){let t=e.match(/page=(\d+)/);if(!t)return null;let n=e.match(/viewrect=(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)/);return n?{page:parseInt(t[1],10),x:parseFloat(n[1]),y:parseFloat(n[2]),width:parseFloat(n[3]),height:parseFloat(n[4])}:null}function Ir(e){return typeof e==`object`&&!!e&&`str`in e}function Lr(e,t){let n=[],r=``;for(let i of e)if(i.str.trim()){let e=r.length;r+=i.str;let a=r.length,[,,,,o,s]=i.transform;n.push({start:e,end:a,page:t,x:o,y:s,width:i.width,height:i.height}),r+=i.hasEOL?`
@@ -6,7 +6,7 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{i as r,n
6
6
  `);return{text:r,items:n}}function Rr(e,t){let n=e.items.filter(e=>e.page===t.page&&Vr(e,t)).sort((e,t)=>e.start-t.start);if(n.length===0)return``;let r=zr(e,n[0]);for(let t=1;t<n.length;t++){let i=e.text.slice(n[t-1].end,n[t].start);r+=(i.trim()===``?i:` `)+zr(e,n[t])}return r.trim()}var zr=(e,t)=>e.text.slice(t.start,t.end),Br=.5;function Vr(e,t){let n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),r=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);return n<=0||r<=0?!1:n*r>=Br*e.width*e.height}function Hr(e){if(e)return e[`@id`]||void 0}function Ur(e){if(e?.representations)return(Array.isArray(e.representations)?e.representations:[e.representations])[0]}function Wr(e){return Ur(e)?.mediaType}function Gr(e){return Ur(e)?.language}function Kr(e){return Ur(e)?.storageUri}var qr=class extends Error{constructor(e,t,n){super(e),this.code=t,this.details=n,this.name=`SemiontError`,Error.captureStackTrace(this,this.constructor)}code;details},Jr=class extends qr{constructor(e,t,n){super(e,t,n),this.name=`BusRequestError`}};async function Yr(e,t,n,r=3e4){let i=_r(),a={...n,correlationId:i},{result:o,failure:s}=Xn[t],c=vn(kn(e.stream(o).pipe(An(e=>e.correlationId===i),Cn(e=>({ok:!0,response:e.response}))),e.stream(s).pipe(An(e=>e.correlationId===i),Cn(e=>({ok:!1,error:new Jr(e.message??`Bus request rejected`,`bus.rejected`,{channel:s,correlationId:i,payload:e})})))).pipe(Pn(1),xn(r),jn(e=>e instanceof bn?hn(()=>new Jr(`Bus request timed out after ${r}ms on ${o}`,`bus.timeout`,{channel:t,resultChannel:o,correlationId:i,timeoutMs:r})):hn(()=>e)),Nn({ok:!1,error:new Jr(`Bus closed before a reply on ${o}`,`bus.closed`,{channel:t,resultChannel:o,correlationId:i})}))),l=()=>(c.catch(()=>{}),new Jr(`Bus closed before emit on ${t}`,`bus.closed`,{channel:t,correlationId:i})),u;if(e.state$.subscribe(e=>{u=e}).unsubscribe(),u===`closed`)throw l();let d=u===`open`;if(!d){let t=vn(e.state$.pipe(An(e=>e===`open`||e===`closed`),Pn(1),Nn(`closed`))),n=await Promise.race([t,c.then(()=>`settled`,()=>`settled`)]);if(n===`closed`)throw l();d=n===`open`}let f;if(d){f=e.trackReply?.(i);try{await e.emit(t,a)}catch(e){throw f?.(),f=void 0,c.catch(()=>{}),e}}try{let e=await c;if(!e.ok)throw e.error;return e.response}finally{f?.()}}var Xr=1024;function Zr(e,t){let{position:n,quote:r}=t;if(!r||!r.exact)return!n||n.start<0||n.end>e.length||n.start>=n.end?null:{start:n.start,end:n.end,strategy:`position-fallback`,confidence:`low`};let{exact:i,prefix:a,suffix:o}=r;if(n){let t=n.start+i.length;if(n.start>=0&&t<=e.length&&e.substring(n.start,t)===i)return{start:n.start,end:t,strategy:`fast-path`,confidence:`high`}}let s=Qr(e,i);if(s.length===1){let e=s[0];return{start:e,end:e+i.length,strategy:`unique-occurrence`,confidence:`high`}}return s.length>1?ti(e,s,i,a,o,n?.start):n&&n.start>=0&&n.end<=e.length&&n.start<n.end?{start:n.start,end:n.end,strategy:`position-fallback`,confidence:`low`}:null}function Qr(e,t){let n=[],r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function $r(e,t,n,r,i){let a=0,o=!0,s=!0;if(r){let n=e.substring(Math.max(0,t-r.length),t);n.endsWith(r)?(a+=10,o=!0):(n.includes(r.trim())&&r.trim().length>0&&(a+=5),o=!1)}if(i){let r=e.substring(t+n.length,Math.min(e.length,t+n.length+i.length));r.startsWith(i)?(a+=10,s=!0):(r.includes(i.trim())&&i.trim().length>0&&(a+=5),s=!1)}return{score:a,full:(r===void 0||o)&&(i===void 0||s)&&(r!==void 0||i!==void 0)}}function ei(e,t){if(t===void 0)return 0;let n=Math.abs(e-t);return n>=1024?0:5*(1-n/Xr)}function ti(e,t,n,r,i,a){let o=t[0],s=-1,c=!1,l=!1,u=!1;for(let d of t){let t=$r(e,d,n,r,i),f=ei(d,a),p=t.score+f;p>s&&(s=p,o=d,c=t.full,l=t.score>0,u=f>0)}let d,f;return c?(d=`context-disambiguated`,f=`high`):l&&!u?(d=`context-disambiguated`,f=`medium`):l&&u||u?(d=`position-tiebreaker`,f=`medium`):(d=`position-tiebreaker`,f=`low`),{start:o,end:o+n.length,strategy:d,confidence:f}}var ni=[{code:`ar`,nativeName:`العربية`,englishName:`Arabic`},{code:`bn`,nativeName:`বাংলা`,englishName:`Bengali`},{code:`cs`,nativeName:`Čeština`,englishName:`Czech`},{code:`da`,nativeName:`Dansk`,englishName:`Danish`},{code:`de`,nativeName:`Deutsch`,englishName:`German`},{code:`el`,nativeName:`Ελληνικά`,englishName:`Greek`},{code:`en`,nativeName:`English`,englishName:`English`},{code:`es`,nativeName:`Español`,englishName:`Spanish`},{code:`fa`,nativeName:`فارسی`,englishName:`Persian`},{code:`fi`,nativeName:`Suomi`,englishName:`Finnish`},{code:`fr`,nativeName:`Français`,englishName:`French`},{code:`he`,nativeName:`עברית`,englishName:`Hebrew`},{code:`hi`,nativeName:`हिन्दी`,englishName:`Hindi`},{code:`id`,nativeName:`Bahasa Indonesia`,englishName:`Indonesian`},{code:`it`,nativeName:`Italiano`,englishName:`Italian`},{code:`ja`,nativeName:`日本語`,englishName:`Japanese`},{code:`ko`,nativeName:`한국어`,englishName:`Korean`},{code:`ms`,nativeName:`Bahasa Melayu`,englishName:`Malay`},{code:`nl`,nativeName:`Nederlands`,englishName:`Dutch`},{code:`no`,nativeName:`Norsk`,englishName:`Norwegian`},{code:`pl`,nativeName:`Polski`,englishName:`Polish`},{code:`pt`,nativeName:`Português`,englishName:`Portuguese`},{code:`ro`,nativeName:`Română`,englishName:`Romanian`},{code:`sv`,nativeName:`Svenska`,englishName:`Swedish`},{code:`th`,nativeName:`ไทย`,englishName:`Thai`},{code:`tr`,nativeName:`Türkçe`,englishName:`Turkish`},{code:`uk`,nativeName:`Українська`,englishName:`Ukrainian`},{code:`vi`,nativeName:`Tiếng Việt`,englishName:`Vietnamese`},{code:`zh`,nativeName:`中文`,englishName:`Chinese`}],ri=new Map(ni.map(e=>[e.code.toLowerCase(),e]));function ii(e){if(e)return ri.get(e.toLowerCase())}function ai(e){if(!e)return;let t=ii(e);return t?`${t.nativeName} (${e.toLowerCase()})`:e}function oi(e,t){return`<svg xmlns="http://www.w3.org/2000/svg"><rect x="${Math.min(e.x,t.x)}" y="${Math.min(e.y,t.y)}" width="${Math.abs(t.x-e.x)}" height="${Math.abs(t.y-e.y)}"/></svg>`}function si(e){if(e.length<3)throw Error(`Polygon requires at least 3 points`);return`<svg xmlns="http://www.w3.org/2000/svg"><polygon points="${e.map(e=>`${e.x},${e.y}`).join(` `)}"/></svg>`}function ci(e,t){if(t<=0)throw Error(`Circle radius must be positive`);return`<svg xmlns="http://www.w3.org/2000/svg"><circle cx="${e.x}" cy="${e.y}" r="${t}"/></svg>`}function li(e){let t=e.match(/<rect\s+([^>]+)\/>/);if(t&&t[1]){let e=t[1];return{type:`rect`,data:{x:parseFloat(e.match(/x="([^"]+)"/)?.[1]||`0`),y:parseFloat(e.match(/y="([^"]+)"/)?.[1]||`0`),width:parseFloat(e.match(/width="([^"]+)"/)?.[1]||`0`),height:parseFloat(e.match(/height="([^"]+)"/)?.[1]||`0`)}}}let n=e.match(/<polygon\s+points="([^"]+)"/);if(n&&n[1])return{type:`polygon`,data:{points:n[1].split(/\s+/).map(e=>{let[t,n]=e.split(`,`).map(parseFloat);return{x:t,y:n}})}};let r=e.match(/<circle\s+([^>]+)\/>/);if(r&&r[1]){let e=r[1];return{type:`circle`,data:{cx:parseFloat(e.match(/cx="([^"]+)"/)?.[1]||`0`),cy:parseFloat(e.match(/cy="([^"]+)"/)?.[1]||`0`),r:parseFloat(e.match(/r="([^"]+)"/)?.[1]||`0`)}}}return null}function ui(e,t,n,r,i){let a=li(e);if(!a)return e;let o=r/t,s=i/n;switch(a.type){case`rect`:{let{x:e,y:t,width:n,height:r}=a.data;return oi({x:e*o,y:t*s},{x:(e+n)*o,y:(t+r)*s})}case`circle`:{let{cx:e,cy:t,r:n}=a.data;return ci({x:e*o,y:t*s},n*Math.min(o,s))}case`polygon`:return si(a.data.points.map(e=>({x:e.x*o,y:e.y*s})))}return e}var di=64,fi=32;function pi(e,t,n){let r={};if(t>0){let n=Math.max(0,t-di),i=0;for(;n>0&&i<fi;){let t=e[n-1];if(!t||/[\s.,;:!?'"()\[\]{}<>\/\\]/.test(t))break;n--,i++}r.prefix=e.substring(n,t)}if(n<e.length){let t=Math.min(e.length,n+di),i=0;for(;t<e.length&&i<fi;){let n=e[t];if(!n||/[\s.,;:!?'"()\[\]{}<>\/\\]/.test(n))break;t++,i++}r.suffix=e.substring(n,t)}return r}function mi(e){return(e.match(/charset=([^\s;]+)/i)?.[1]||`utf-8`).toLowerCase()}function hi(e,t){let n=mi(t);return new TextDecoder(n).decode(e)}var gi=(e,t)=>({extension:e,label:t,render:`none`,anchoring:`none`,extractText:`none`,authorable:!1,uploadable:!0,generatable:!1}),_i=(e,t)=>({...gi(e,t),extractText:`decode`}),vi={"text/markdown":{extension:`.md`,label:`Markdown`,render:`text`,anchoring:`text-selector`,extractText:`decode`,authorable:!0,uploadable:!0,generatable:!0},"text/plain":{extension:`.txt`,label:`Plain Text`,render:`text`,anchoring:`text-selector`,extractText:`decode`,authorable:!0,uploadable:!0,generatable:!0},"text/html":{extension:`.html`,label:`HTML`,render:`text`,anchoring:`text-selector`,extractText:`decode`,authorable:!0,uploadable:!0,generatable:!1},"application/json":{extension:`.json`,label:`JSON`,render:`text`,anchoring:`text-selector`,extractText:`decode`,authorable:!1,uploadable:!0,generatable:!1},"image/png":{extension:`.png`,label:`PNG image`,render:`image`,anchoring:`spatial`,extractText:`none`,authorable:!1,uploadable:!0,generatable:!1},"image/jpeg":{extension:`.jpg`,label:`JPEG image`,render:`image`,anchoring:`spatial`,extractText:`none`,authorable:!1,uploadable:!0,generatable:!1},"application/pdf":{extension:`.pdf`,label:`PDF`,render:`pdf`,anchoring:`spatial`,extractText:`pdf-text-layer`,authorable:!1,uploadable:!0,generatable:!0},"text/css":_i(`.css`,`CSS`),"text/csv":_i(`.csv`,`CSV`),"text/xml":_i(`.xml`,`XML`),"application/xml":_i(`.xml`,`XML`),"application/yaml":_i(`.yaml`,`YAML`),"application/x-yaml":_i(`.yaml`,`YAML`),"text/javascript":_i(`.js`,`JavaScript`),"application/javascript":_i(`.js`,`JavaScript`),"text/x-typescript":_i(`.ts`,`TypeScript`),"application/typescript":_i(`.ts`,`TypeScript`),"text/x-python":_i(`.py`,`Python source`),"text/x-java":_i(`.java`,`Java source`),"text/x-c":_i(`.c`,`C source`),"text/x-c++":_i(`.cpp`,`C++ source`),"text/x-csharp":_i(`.cs`,`C# source`),"text/x-go":_i(`.go`,`Go source`),"text/x-rust":_i(`.rs`,`Rust source`),"text/x-ruby":_i(`.rb`,`Ruby source`),"text/x-php":_i(`.php`,`PHP source`),"text/x-swift":_i(`.swift`,`Swift source`),"text/x-kotlin":_i(`.kt`,`Kotlin source`),"text/x-shell":_i(`.sh`,`Shell script`),"application/msword":gi(`.doc`,`Word document (legacy)`),"application/vnd.openxmlformats-officedocument.wordprocessingml.document":gi(`.docx`,`Word document`),"application/vnd.ms-excel":gi(`.xls`,`Excel spreadsheet (legacy)`),"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":gi(`.xlsx`,`Excel spreadsheet`),"application/vnd.ms-powerpoint":gi(`.ppt`,`PowerPoint presentation (legacy)`),"application/vnd.openxmlformats-officedocument.presentationml.presentation":gi(`.pptx`,`PowerPoint presentation`),"application/zip":gi(`.zip`,`ZIP archive`),"application/gzip":gi(`.gz`,`Gzip archive`),"application/x-tar":gi(`.tar`,`TAR archive`),"application/x-7z-compressed":gi(`.7z`,`7z archive`),"application/octet-stream":gi(`.bin`,`Binary`),"application/wasm":gi(`.wasm`,`WebAssembly module`),"image/gif":gi(`.gif`,`GIF image`),"image/webp":gi(`.webp`,`WebP image`),"image/svg+xml":gi(`.svg`,`SVG image`),"image/bmp":gi(`.bmp`,`BMP image`),"image/tiff":gi(`.tiff`,`TIFF image`),"image/x-icon":gi(`.ico`,`Icon`),"video/mp4":gi(`.mp4`,`MP4 video`),"video/mpeg":gi(`.mpeg`,`MPEG video`),"video/webm":gi(`.webm`,`WebM video`),"video/ogg":gi(`.ogv`,`Ogg video`),"video/quicktime":gi(`.mov`,`QuickTime video`),"video/x-msvideo":gi(`.avi`,`AVI video`),"audio/mpeg":gi(`.mp3`,`MP3 audio`),"audio/wav":gi(`.wav`,`WAV audio`),"audio/ogg":gi(`.ogg`,`Ogg audio`),"audio/webm":gi(`.webm`,`WebM audio`),"audio/aac":gi(`.aac`,`AAC audio`),"audio/flac":gi(`.flac`,`FLAC audio`),"font/woff":gi(`.woff`,`WOFF font`),"font/woff2":gi(`.woff2`,`WOFF2 font`),"font/ttf":gi(`.ttf`,`TrueType font`),"font/otf":gi(`.otf`,`OpenType font`)},yi=vi;function bi(e){return e.split(`;`)[0].trim().toLowerCase()}function xi(e){return Object.hasOwn(vi,e)}function Si(e){return yi[bi(e)]}function Ci(e){let t=bi(e??`text/plain`);return xi(t)&&Si(t)?.authorable?t:`text/plain`}function wi(e){return Si(e)?.extension??`.dat`}var Ti=(()=>{let e=new Map;for(let t of Object.keys(vi)){let n=vi[t].extension;e.has(n)||e.set(n,t)}return e})(),Ei={".markdown":`.md`,".htm":`.html`,".jpeg":`.jpg`,".yml":`.yaml`};function Di(e){let t=e.trim().toLowerCase(),n=t.startsWith(`.`)?t:`.${t}`;return Ti.get(Ei[n]??n)}function Oi(e){let t=Si(e);return t?t.extractText:bi(e).startsWith(`text/`)?`decode`:`none`}var ki=Object.keys(vi),Ai=ki.filter(e=>vi[e].authorable);ki.filter(e=>vi[e].extractText!==`none`);var ji=ki.filter(e=>vi[e].generatable);function Mi(e,t){return`${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}${vi[t].extension}`}function Ni(e,t){return`file://${Mi(e,t)}`}function Pi(e){let t=(e??``).replace(/^file:\/\//,``),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n)}function Fi(e,t,n){let r=Mi(t,n);return r===vi[n].extension?``:e?`${e}/${r}`:r}function Ii(e){return typeof e==`string`}function Li(e){return typeof e==`number`&&!isNaN(e)}function Ri(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zi(e){return Array.isArray(e)}function Bi(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)t.type===`annotation-of`&&i.set(t.source,t.target);let a=[],o=[],s=new Set;for(let n of e.edges){let e=n.type===`cites`&&n.target===t?i.get(n.source):void 0;if(e!==void 0){if(s.has(e))continue;s.add(e);let t=r.get(e);o.push({resourceId:e,resourceName:t?.label??e})}else if(n.source===t){let e=r.get(n.target);a.push({resourceId:n.target,resourceName:e?.label??n.target,entityTypes:e?.entityTypes??[],bidirectional:n.bidirectional??!1})}}let c=new Set;for(let r of e.nodes)if(r.type===`annotation`&&r.id!==n&&i.get(r.id)===t)for(let e of r.entityTypes??[])c.add(e);return{connections:a,citedBy:o,citedByCount:o.length,siblingEntityTypes:Array.from(c)}}var Vi=`/discovery/kbs.json`,Hi=class extends Error{name=`KyError`;get isKyError(){return!0}},Ui=class extends Hi{name=`HTTPError`;response;request;options;data;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=n}},Wi=class extends Hi{name=`NetworkError`;request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}},Gi=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},Ki=class extends Hi{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new Gi(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},qi=class extends Error{name=`SchemaValidationError`;issues;constructor(e){super(`Response schema validation failed`),this.issues=e}},Ji=class extends Hi{name=`TimeoutError`;request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}},Yi=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),Xi=typeof globalThis.AbortController==`function`,Zi=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,Qi=typeof globalThis.ReadableStream==`function`,$i=typeof globalThis.FormData==`function`,ea=[`get`,`post`,`put`,`patch`,`head`,`delete`],ta={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},na=2147483647,ra=Symbol(`stop`),ia=class{options;constructor(e){this.options=e}},aa=e=>new ia(e),oa={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},sa={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},ca=new TextEncoder,la=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=40,t+=ca.encode(`Content-Disposition: form-data; name="${n}"`).byteLength,t+=typeof r==`string`?ca.encode(r).byteLength:r.size;return t}return e instanceof Blob?e.size:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof e==`string`?ca.encode(e).byteLength:e instanceof URLSearchParams?ca.encode(e.toString()).byteLength:0},ua=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},da=(e,t)=>{if(!e.body)return e;let n={status:e.status,statusText:e.statusText,headers:e.headers};if(e.status===204)return new Response(null,n);let r=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(ua(e.body,r,t),n)},fa=(e,t,n)=>{if(!e.body)return e;let r=la(n??e.body);return new Request(e,{duplex:`half`,body:ua(e.body,r,t)})},pa=e=>typeof e==`object`&&!!e,ma=Symbol(`replaceOption`),ha=e=>pa(e)&&e[ma]===!0?{isReplace:!0,value:e.value}:{isReplace:!1,value:e},ga=(...e)=>{for(let t of e)if((!pa(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return Ea({},...e)},_a=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n},va=e=>{if(!pa(e)||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ya=e=>{if(e instanceof URLSearchParams){let t=new URLSearchParams(e),n=e[wa];return n&&(t[wa]=new Set(n)),t}return e instanceof globalThis.Headers?new globalThis.Headers(e):Array.isArray(e)?[...e]:va(e)?{...e}:e},ba=e=>Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0)),xa=(e,t)=>va(e)&&va(t)?ba({...e,...t}):_a(e,t);function Sa(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:Ea(e[n]??[],t[n]??[])}var Ca=(e={},t={})=>({init:Sa(e,t,`init`),beforeRequest:Sa(e,t,`beforeRequest`),beforeRetry:Sa(e,t,`beforeRetry`),beforeError:Sa(e,t,`beforeError`),afterResponse:Sa(e,t,`afterResponse`)}),wa=Symbol(`deletedParameters`),Ta=(e,t)=>{let n=new URLSearchParams,r=new Set;for(let i of[e,t])if(i!==void 0){if(i instanceof URLSearchParams){for(let[e,t]of i.entries())n.append(e,t),r.delete(e);let e=i[wa];if(e)for(let t of e)n.delete(t),r.add(t)}else if(Array.isArray(i))for(let e of i){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1])),r.delete(String(e[0]))}else if(pa(i))for(let[e,t]of Object.entries(i))t===void 0?(n.delete(e),r.add(e)):(n.append(e,String(t)),r.delete(e));else{let e=new URLSearchParams(i);for(let[t,i]of e.entries())n.append(t,i),r.delete(t)}}return r.size>0&&(n[wa]=r),n},Ea=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(pa(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}let r=ha(n),{isReplace:o}=r;if(n=r.value,e===`context`){if(n!=null&&(!pa(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:o?{...n}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:o||i===void 0?n:Ta(i,n);continue}pa(n)&&!o&&e in t&&(n=Ea(t[e],n)),t={...t,[e]:n}}if(pa(o.hooks)){let{value:e,isReplace:n}=ha(o.hooks);r=Ca(n?{}:r,e),t.hooks=r}if(pa(o.headers)){let{value:e,isReplace:r}=ha(o.headers);n=r?ya(e):xa(n,e),t.headers=n}}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:Zi?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},Da=e=>ea.includes(e)?e.toUpperCase():e,Oa={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},ka=(e={})=>{if(typeof e==`number`)return{...Oa,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries({...e,methods:e.methods?.map(e=>e.toLowerCase())}).filter(([,e])=>e!==void 0));return{...Oa,...t}};async function Aa(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new Ji(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function ja(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}var Ma=e=>{let t={};for(let n in e)Object.hasOwn(e,n)&&!(n in sa)&&!(n in oa)&&(t[n]=e[n]);return t},Na=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0||!!e[wa]?.size:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e,Pa=Object.prototype.toString,Fa=e=>Pa.call(e)===`[object Error]`,Ia=new Set([`network error`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`,`fetch failed`,`terminated`,` A network error occurred.`,`Network connection lost`]);function La(e){if(!(e&&Fa(e)&&e.name===`TypeError`&&typeof e.message==`string`))return!1;let{message:t,stack:n}=e;return t===`Load failed`?n===void 0||`__sentry_captured__`in e:t.startsWith(`error sending request for url`)||t===`Failed to fetch`||t.startsWith(`Failed to fetch (`)&&t.endsWith(`)`)?!0:Ia.has(t)}var Ra=(e,t)=>e instanceof t||e?.name===t.name;function za(e){return Ra(e,Ui)}function Ba(e){return Ra(e,Wi)}function Va(e){return Ra(e,Ji)}var Ha=10485760,Ua="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",Wa=Symbol(`timedOutResponseData`),Ga=e=>{let t=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(e),n=t?.[1]??t?.[2];if(n)try{return new TextDecoder(n)}catch{}return new TextDecoder},Ka="The `schema` argument must follow the Standard Schema specification",qa=e=>typeof e==`object`?{...e,...e.methods&&{methods:[...e.methods]},...e.statusCodes&&{statusCodes:[...e.statusCodes]},...e.afterStatusCodes&&{afterStatusCodes:[...e.afterStatusCodes]}}:e,Ja=Object.prototype.toString,Ya=e=>e instanceof globalThis.Request||Ja.call(e)===`[object Request]`,Xa=e=>e instanceof globalThis.Response||Ja.call(e)===`[object Response]`,Za=e=>Array.isArray(e)?e.map(e=>[...e]):ya(e);function Qa(e){let t={...e,json:ya(e.json),context:ya(e.context),headers:ya(e.headers),searchParams:Za(e.searchParams)};return e.retry!==void 0&&(t.retry=qa(e.retry)),t}var $a=async(e,t)=>{if(typeof t!=`object`&&typeof t!=`function`||t===null)throw TypeError(Ka);let n=t[`~standard`];if(typeof n!=`object`||!n||typeof n.validate!=`function`)throw TypeError(Ka);let r=await n.validate(e);if(r.issues)throw new qi(r.issues);return r.value},eo=class e{static create(t,n){let r=n.hooks?.init??[],i=r.length>0?Qa(n):n;for(let e of r)e(i);let a=new e(t,i),o=async()=>{if(typeof a.#i.timeout==`number`&&a.#i.timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${na}`);if(typeof a.#i.totalTimeout==`number`&&a.#i.totalTimeout>2147483647)throw RangeError(`The \`totalTimeout\` option cannot be greater than ${na}`);await Promise.resolve();let e=await a.#w(),t=e??await a.#E(async()=>a.#k()),n=e!==void 0||a.#O();for(;;){if(t===void 0)return t;if(Xa(t))try{t=await a.#T(t)}catch(e){if(!(e instanceof Ki))throw e;let r=await a.#D(e,async()=>a.#k());if(r===void 0)return r;t=r,n=a.#O();continue}let e=t;if(!e.ok&&e.type!==`opaque`&&(typeof a.#i.throwHttpErrors==`function`?a.#i.throwHttpErrors(e.status):a.#i.throwHttpErrors)){let r=new Ui(e,a.#P(e),a.#M()),i=r;if(r.data=await a.#h(e),n)throw i;let o=await a.#D(r,async()=>a.#k());if(o===void 0)return o;t=o,n=a.#O();continue}break}if(!Xa(t))return t;if(a.#m(t),a.#i.onDownloadProgress){if(typeof a.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!Qi)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let e=t.clone();return a.#x(t),da(e,a.#i.onDownloadProgress)}return t},s=(async()=>{try{return await o()}catch(e){if(!(e instanceof Error)||a.#s.has(e))throw e;let t=e;for(let e of a.#i.hooks.beforeError){let n=await e({request:a.request,options:a.#M(),error:t,retryCount:a.#n});n instanceof Error&&(t=n)}throw t}finally{let e=a.#a;a.#b(e?.body??void 0),a.request!==e&&a.#b(a.request.body??void 0)}})();for(let[e,t]of Object.entries(ta))(e!==`bytes`||typeof globalThis.Response?.prototype?.bytes==`function`)&&(s[e]=async n=>{a.request.headers.set(`accept`,a.request.headers.get(`accept`)||t);let r=await s;if(e!==`json`)return r[e]();let o=await r.text();if(o===``)return n===void 0?JSON.parse(o):$a(void 0,n);let c=i.parseJson?await i.parseJson(o,{request:a.#P(r),response:r}):JSON.parse(o);return n===void 0?c:$a(c,n)});return s}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s=new WeakSet;#c;#l;#u=!1;#d=new WeakMap;constructor(t,n={}){if(this.#r=t,Object.hasOwn(n,`prefixUrl`))throw Error(Ua);if(this.#i={...n,headers:_a(this.#r.headers,n.headers),hooks:Ca({},n.hooks),method:Da(n.method??this.#r.method??`GET`),prefix:String(n.prefix||``),retry:ka(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,totalTimeout:n.totalTimeout??!1,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(typeof this.#r==`string`){if(this.#i.prefix){let e=this.#i.prefix.replace(/\/+$/,``),t=this.#r.replace(/^\/+/,``);this.#r=`${e}/${t}`}if(this.#i.baseUrl){let e;try{e=new URL(this.#r)}catch{}e||(this.#r=new URL(this.#r,new Request(this.#i.baseUrl).url))}}Xi&&Zi&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#S()),Yi&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&($i&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),Na(this.#i.searchParams)){let t=new URL(this.request.url),n=this.#i.searchParams?.[wa];if(n)for(let e of n)t.searchParams.delete(e);if(typeof this.#i.searchParams==`string`){let e=this.#i.searchParams.replace(/^\?/,``);e!==``&&(t.search=t.search?`${t.search}&${e}`:`?${e}`)}else{let n=new URLSearchParams(e.#e(this.#i.searchParams));for(let[e,r]of n.entries())t.searchParams.append(e,r)}if(this.#i.searchParams&&typeof this.#i.searchParams==`object`&&!Array.isArray(this.#i.searchParams)&&!(this.#i.searchParams instanceof URLSearchParams))for(let[e,n]of Object.entries(this.#i.searchParams))n===void 0&&t.searchParams.delete(e);this.request=new globalThis.Request(t,this.#i)}if(this.#i.onUploadProgress&&typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");this.#l=typeof this.#i.totalTimeout==`number`?this.#j():void 0}#f(){let e=this.#i.retry.delay(this.#n+1),t=e;return this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#i.retry.backoffLimit,t)}async#p(e){if(this.#n>=this.#i.retry.limit)throw e;let t=e instanceof Error?e:new Gi(e);if(t instanceof Ki)return t.customDelay??this.#f();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n+1});if(n===!1)throw e;if(n===!0)return this.#f()}if(Va(e)){if(!this.#i.retry.retryOnTimeout)throw e;return this.#f()}if(za(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;return Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now()),Number.isFinite(e)?(e=Math.max(0,e),Math.min(this.#i.retry.maxRetryAfter,e)):Math.min(this.#i.retry.maxRetryAfter,this.#f())}if(e.response.status===413)throw e;return this.#f()}if(!Ba(e))throw e;return this.#f()}#m(e){let t=this.#P(e);return this.#i.parseJson&&(e.json=async()=>{let n=await e.text();return n===``?JSON.parse(n):this.#i.parseJson(n,{request:t,response:e})}),e}async#h(e){let t=await this.#v(e,this.#g());if(t===Wa){this.#C();return}if(!t)return;if(!this.#_(e.headers.get(`content-type`)??``))return t;let n=await this.#y(t,e,this.#g(),this.#P(e));if(n===Wa){this.#C();return}return n}#g(){let e=this.#i.timeout===!1?1e4:this.#i.timeout,t=this.#A();if(t===void 0)return e;if(t<=0)throw new Ji(this.request);return Math.min(e,t)}#_(e){let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#v(e,t){let{body:n}=e;if(!n)try{return await e.text()}catch{return}let r;try{r=n.getReader()}catch{return}let i=Ga(e.headers.get(`content-type`)??``),a=[],o=0,s=(async()=>{try{for(;;){let{done:e,value:t}=await r.read();if(e)break;if(o+=t.byteLength,o>Ha){r.cancel().catch(()=>void 0);return}a.push(i.decode(t,{stream:!0}))}}catch{return}return a.push(i.decode()),a.join(``)})(),c=new Promise(e=>{let n=setTimeout(()=>{e(Wa)},t);s.finally(()=>{clearTimeout(n)})}),l=await Promise.race([s,c]);return l===Wa&&r.cancel().catch(()=>void 0),l}async#y(e,t,n,r){let i;try{return await Promise.race([Promise.resolve().then(()=>this.#i.parseJson?this.#i.parseJson(e,{request:r,response:t}):JSON.parse(e)),new Promise(e=>{i=setTimeout(()=>{e(Wa)},n)})])}catch{return}finally{clearTimeout(i)}}#b(e){e&&e.cancel().catch(()=>void 0)}#x(e){this.#b(e.body??void 0)}#S(){return this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal}#C(){let e=this.#A();if(e!==void 0&&e<=0)throw new Ji(this.request)}async#w(){for(let e of this.#i.hooks.beforeRequest){let t=await e({request:this.request,options:this.#M(),retryCount:0});if(Ya(t))this.#N(t);else if(Xa(t))return t}}async#T(e){let t=this.#P(e);for(let n of this.#i.hooks.afterResponse){let r=this.#F(e.clone(),t);this.#m(r);let i;try{i=await n({request:this.request,options:this.#M(),response:r,retryCount:this.#n})}catch(t){throw r!==e&&this.#x(r),this.#x(e),t}if(i instanceof ia)throw r!==e&&this.#x(r),this.#x(e),new Ki(i.options);let a=Xa(i)?this.#F(i,t):e;r!==e&&r!==a&&r.body!==a.body&&this.#x(r),e!==a&&e.body!==a.body&&this.#x(e),e=a}return e}async#E(e){try{return await e()}catch(t){return this.#D(t,e)}}async#D(e,t){this.#u=!1;let n=Math.min(await this.#p(e),na),r={signal:this.#o},i=this.#A();if(i!==void 0){if(i<=0)throw new Ji(this.request);if(n>=i)throw await ja(i,r),new Ji(this.request)}if(await ja(n,r),this.#C(),e instanceof Ki&&e.customRequest){let t=new globalThis.Request(e.customRequest,this.#i.signal?{signal:this.#i.signal}:void 0);this.#N(t)}for(let t of this.#i.hooks.beforeRetry){let n;try{n=await t({request:this.request,options:this.#M(),error:e,retryCount:this.#n+1})}catch(t){throw t instanceof Error&&t!==e&&this.#s.add(t),t}if(Ya(n)){this.#N(n);break}if(Xa(n))return this.#u=!0,this.#n++,n;if(n===ra)return}return this.#C(),this.#n++,this.#E(t)}#O(){let e=this.#u;return this.#u=!1,e}async#k(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#S(),this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));let e=Ma(this.#i),t=this.#i.retry.limit>0?this.request.clone():void 0,n=this.#I(this.request,this.#i.body??void 0);this.#a=n,t&&(this.request=t);try{let t=this.#A();if(t!==void 0&&t<=0)throw new Ji(this.request);let r=this.#i.timeout===!1?t:t===void 0?this.#i.timeout:Math.min(this.#i.timeout,t),i=r===void 0?await this.#i.fetch(n,e):await Aa(n,e,this.#t,{timeout:r,fetch:this.#i.fetch});return this.#F(i,n)}catch(e){throw La(e)?new Wi(this.request,{cause:e}):e}}#A(){if(this.#l===void 0)return;let e=this.#j()-this.#l;return Math.max(0,this.#i.totalTimeout-e)}#j(){return globalThis.performance?.now()??Date.now()}#M(){if(!this.#c){let{hooks:e,json:t,parseJson:n,stringifyJson:r,searchParams:i,timeout:a,totalTimeout:o,throwHttpErrors:s,fetch:c,...l}=this.#i;this.#c=Object.freeze(l)}return this.#c}#N(e){this.#c=void 0,this.request=e}#P(e){return this.#d.get(e)??this.request}#F(e,t){return this.#d.set(e,t),e}#I(e,t){return!this.#i.onUploadProgress||!e.body||!Yi?e:fa(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}},to=e=>{let t=(t,n)=>eo.create(t,ga(e,n));for(let n of ea)t[n]=(t,r)=>eo.create(t,ga(e,r,{method:n}));return t.create=e=>to(ga(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),to(ga(e,t))),t.stop=ra,t.retry=aa,t},no=to(),ro=`1.9.1`,io=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function ao(e){let t=new Set([e]),n=new Set,r=e.match(io);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(io);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var oo=ao(ro),so=ro.split(`.`)[0],co=Symbol.for(`opentelemetry.js.api.${so}`),lo=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function uo(e,t,n,r=!1){let i=lo[co]=lo[co]??{version:ro};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${ro}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${ro}.`),!0}function fo(e){let t=lo[co]?.version;if(!(!t||!oo(t)))return lo[co]?.[e]}function po(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${ro}.`);let n=lo[co];n&&delete n[e]}var mo=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return ho(`debug`,this._namespace,e)}error(...e){return ho(`error`,this._namespace,e)}info(...e){return ho(`info`,this._namespace,e)}warn(...e){return ho(`warn`,this._namespace,e)}verbose(...e){return ho(`verbose`,this._namespace,e)}};function ho(e,t,n){let r=fo(`diag`);if(r)return r[e](t,...n)}var go;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(go||={});function _o(e,t){e<go.NONE?e=go.NONE:e>go.ALL&&(e=go.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,go.ERROR),warn:n(`warn`,go.WARN),info:n(`info`,go.INFO),debug:n(`debug`,go.DEBUG),verbose:n(`verbose`,go.VERBOSE)}}var vo=`diag`,yo=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=fo(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:go.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=fo(`diag`),i=_o(n.logLevel??go.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return uo(`diag`,i,t,!0)},t.disable=()=>{po(vo,t)},t.createComponentLogger=e=>new mo(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},bo=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}},xo=Symbol(`BaggageEntryMetadata`),So=yo.instance();function Co(e={}){return new bo(new Map(Object.entries(e)))}function wo(e){return typeof e!=`string`&&(So.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:xo,toString(){return e}}}function To(e){return Symbol.for(e)}var Eo=new class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Do=class{constructor(){}createGauge(e,t){return zo}createHistogram(e,t){return Bo}createCounter(e,t){return Ro}createUpDownCounter(e,t){return Vo}createObservableGauge(e,t){return Uo}createObservableCounter(e,t){return Ho}createObservableUpDownCounter(e,t){return Wo}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},Oo=class{},ko=class extends Oo{add(e,t){}},Ao=class extends Oo{add(e,t){}},jo=class extends Oo{record(e,t){}},Mo=class extends Oo{record(e,t){}},No=class{addCallback(e){}removeCallback(e){}},Po=class extends No{},Fo=class extends No{},Io=class extends No{},Lo=new Do,Ro=new ko,zo=new jo,Bo=new Mo,Vo=new Ao,Ho=new Po,Uo=new Fo,Wo=new Io;function Go(){return Lo}var Ko={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},qo={set(e,t,n){e!=null&&(e[t]=n)}},Jo=class{active(){return Eo}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},Yo=`context`,Xo=new Jo,Zo=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return uo(Yo,e,yo.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return fo(Yo)||Xo}disable(){this._getContextManager().disable(),po(Yo,yo.instance())}},Qo;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Qo||={});var $o={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:Qo.NONE},es=class{constructor(e=$o){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},ts=To(`OpenTelemetry Context Key SPAN`);function ns(e){return e.getValue(ts)||void 0}function rs(){return ns(Zo.getInstance().active())}function is(e,t){return e.setValue(ts,t)}function as(e){return e.deleteValue(ts)}function os(e,t){return is(e,new es(t))}function ss(e){return ns(e)?.spanContext()}var cs=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function ls(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(cs[e.charCodeAt(t)]|0)+(cs[e.charCodeAt(t+1)]|0)+(cs[e.charCodeAt(t+2)]|0)+(cs[e.charCodeAt(t+3)]|0);return n===t}function us(e){return ls(e,32)&&e!==`00000000000000000000000000000000`}function ds(e){return ls(e,16)&&e!==`0000000000000000`}function fs(e){return us(e.traceId)&&ds(e.spanId)}function ps(e){return new es(e)}var ms=Zo.getInstance(),hs=class{startSpan(e,t,n=ms.active()){if(t?.root)return new es;let r=n&&ss(n);return gs(r)&&fs(r)?new es(r):new es}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??ms.active(),c=this.startSpan(e,i,s),l=is(s,c);return ms.with(l,o,void 0,c)}};function gs(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var _s=new hs,vs=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):_s}},ys=new class{getTracer(e,t,n){return new hs}},bs=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new vs(this,e,t,n)}getDelegate(){return this._delegate??ys}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}},xs;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(xs||={});var Ss;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Ss||={});var Cs=Zo.getInstance(),ws=new class{getMeter(e,t,n){return Lo}},Ts=`metrics`,Es=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return uo(Ts,e,yo.instance())}getMeterProvider(){return fo(Ts)||ws}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){po(Ts,yo.instance())}}.getInstance(),Ds=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},Os=To(`OpenTelemetry Baggage Key`);function ks(e){return e.getValue(Os)||void 0}function As(){return ks(Zo.getInstance().active())}function js(e,t){return e.setValue(Os,t)}function Ms(e){return e.deleteValue(Os)}var Ns=`propagation`,Ps=new Ds,Fs=class e{constructor(){this.createBaggage=Co,this.getBaggage=ks,this.getActiveBaggage=As,this.setBaggage=js,this.deleteBaggage=Ms}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return uo(Ns,e,yo.instance())}inject(e,t,n=qo){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ko){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){po(Ns,yo.instance())}_getGlobalPropagator(){return fo(Ns)||Ps}}.getInstance(),Is=`trace`,Ls=class e{constructor(){this._proxyTracerProvider=new bs,this.wrapSpanContext=ps,this.isSpanContextValid=fs,this.deleteSpan=as,this.getSpan=ns,this.getActiveSpan=rs,this.getSpanContext=ss,this.setSpan=is,this.setSpanContext=os}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=uo(Is,this._proxyTracerProvider,yo.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return fo(Is)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){po(Is,yo.instance()),this._proxyTracerProvider=new bs}}.getInstance();rr(()=>{let e=Ls.getActiveSpan();if(!e)return;let t=e.spanContext();if(fs(t))return t.traceId});var Rs=`semiont`,zs=()=>Ls.getTracer(Rs);async function Bs(e,t,n){let r=zs().startSpan(e,{kind:n?.kind??xs.INTERNAL,...n?.attrs?{attributes:n.attrs}:{}});try{return await Cs.with(Ls.setSpan(Cs.active(),r),()=>t(r))}catch(e){throw r.recordException(e),r.setStatus({code:Ss.ERROR,message:e instanceof Error?e.message:String(e)}),e}finally{r.end()}}var Vs=`_trace`;function Hs(){let e={};Fs.inject(Cs.active(),e);let t=e.traceparent;if(t)return e.tracestate?{traceparent:t,tracestate:e.tracestate}:{traceparent:t}}function Us(e){let t=e[Vs];if(t!==void 0&&delete e[Vs],!(!t||typeof t.traceparent!=`string`))return t}function Ws(e,t){if(!e)return t();let n={traceparent:e.traceparent};e.tracestate&&(n.tracestate=e.tracestate);let r=Fs.extract(Cs.active(),n);return Cs.with(r,t)}var Gs=`semiont`,Ks=()=>Es.getMeter(Gs),qs;function Js(){return qs||=Ks().createCounter(`semiont.bus.emit`,{description:`Bus emits by channel and scope`}),qs}function Ys(e,t){Js().add(1,{"bus.channel":e,...t?{"bus.scope":t}:{}})}var Xs=3e3,Zs=1e3,Qs={initial:[`connecting`,`closed`],connecting:[`open`,`reconnecting`,`closed`],open:[`reconnecting`,`closed`],reconnecting:[`connecting`,`degraded`,`closed`],degraded:[`connecting`,`reconnecting`,`closed`],closed:[]};function $s(e){let{baseUrl:t,token:n,channels:r,reconnectMs:i=5e3,lazyRemoveMs:a=5e3}=e,o=typeof n==`function`?n:()=>n,s=new Set(r),c=new Map,l=new Map(Object.entries(e.loadLastEventIds?.()??{})),u=new Set,d=new wt,f=new Et(`initial`),p=`initial`,m=null,h=e=>{if(p===e)return;if(!Qs[p].includes(e)){console.warn(`[actor] ignoring invalid connection state transition: ${p} \u2192 ${e}`);return}let t=p;p=e,e===`reconnecting`&&t!==`reconnecting`&&(m&&clearTimeout(m),m=setTimeout(()=>{p===`reconnecting`&&h(`degraded`)},Xs)),t===`reconnecting`&&e!==`reconnecting`&&(m&&=(clearTimeout(m),null)),f.next(e)},g=!1,_=new Set,v=null,y=new WeakSet,b=new Set,x=new Set,S=e=>{if(x.add(e),x.size>512){let e=x.values().next().value;e!==void 0&&x.delete(e)}},C=e=>{x.delete(e)},w=d.pipe(Ln()),T=()=>{for(let e of _)try{e.abort()}catch{}_.clear(),v&&=(clearTimeout(v),null);for(let e of b)clearTimeout(e);b.clear()},E=async(n=!1)=>{h(`connecting`);let r=[..._];if(!n){for(let e of r)try{e.abort()}catch{}_.clear()}let a=JSON.stringify({global:[...s],scoped:[...c.entries()].map(([e,t])=>{let n=l.get(e);return{scope:e,channels:[...t],...n===void 0?{}:{lastEventId:n}}}),...u.size>0?{pendingReplies:[...u]}:{}}),f=`${t}/bus/subscribe`,p=new AbortController;_.add(p);try{let t={Authorization:`Bearer ${o()}`,"Content-Type":`application/json`},i=await fetch(f,{method:`POST`,headers:t,body:a,signal:p.signal});if(!i.ok||!i.body)throw Error(`SSE connect failed: ${i.status}`);if(!g)return;if(n){for(let e of r)y.add(e);let e=setTimeout(()=>{b.delete(e);for(let e of r){try{e.abort()}catch{}_.delete(e)}},Zs);b.add(e)}h(`open`);let s=i.body.getReader(),c=new TextDecoder,u=``,m=``,v=``,w;for(;g&&_.has(p);){let{done:t,value:n}=await s.read();if(t)break;u+=c.decode(n,{stream:!0});let r=u.split(`
7
7
  `);u=r.pop()??``;for(let t of r)if(t.startsWith(`event: `))m=t.slice(7);else if(t.startsWith(`data: `))v=t.slice(6);else if(t.startsWith(`id: `))w=t.slice(4);else if(t===``){let t=w!==void 0&&x.has(w);if(m===`bus-event`&&v&&!t){let t=JSON.parse(v);ir(`RECV`,t.channel,t.payload,t.scope),tr()&&y.has(p)&&console.debug(`[bus LINGER] ${t.channel} delivered on superseded connection`);let n=Us(t.payload);w!==void 0&&S(w);try{await Ws(n,()=>Bs(`bus.recv:${t.channel}`,()=>{d.next(t)},{kind:xs.CONSUMER,attrs:{"bus.channel":t.channel,...t.scope?{"bus.scope":t.scope}:{}}}))}catch(e){throw w!==void 0&&C(w),e}w!==void 0&&w.startsWith(`p-`)&&t.scope&&(l.set(t.scope,w),e.saveLastEventId?.(t.scope,w))}m=``,v=``,w=void 0}}}catch(e){if(e.name===`AbortError`)return}finally{_.delete(p)}g&&!y.has(p)&&(h(`reconnecting`),v=setTimeout(()=>{g&&E()},i))},D=()=>{g&&((p===`open`||p===`connecting`||p===`degraded`)&&h(`reconnecting`),v&&=(clearTimeout(v),null),E(!0))},O=null,k=null,A=()=>{k&&=(clearTimeout(k),null),O&&clearTimeout(O),O=setTimeout(()=>{O=null,D()},100)},j=()=>{O||k||(k=setTimeout(()=>{k=null,D()},a))};return{on$(e){return w.pipe(An(t=>t.channel===e),Cn(e=>e.payload))},emit:async(e,n,r)=>{let i={channel:e,payload:n};r&&(i.scope=r);let a={"Content-Type":`application/json`,Authorization:`Bearer ${o()}`},s=Hs();s&&(a.traceparent=s.traceparent,s.tracestate&&(a.tracestate=s.tracestate));let c=await fetch(`${t}/bus/emit`,{method:`POST`,headers:a,body:JSON.stringify(i)});if(!c.ok){let e=``;try{e=(await c.text()).slice(0,500)}catch{}throw Error(`/bus/emit ${c.status}${e?`: ${e}`:``}`)}try{let e=await c.json();return typeof e.subscribers==`number`?e.subscribers:-1}catch{return-1}},state$:f.asObservable(),addChannels:(e,t)=>{let n=!1;if(t!==void 0){let r=c.get(t);r||(r=new Set,c.set(t,r));for(let t of e)r.has(t)||(r.add(t),n=!0)}else for(let t of e)s.has(t)||(s.add(t),n=!0);n&&A()},removeChannels:(e,t)=>{let n=!1;if(t!==void 0){let r=c.get(t);if(r){for(let t of e)r.delete(t)&&(n=!0);r.size===0&&c.delete(t)}}else for(let t of e)s.delete(t)&&(n=!0);n&&j()},trackReply:e=>{u.add(e);let t=!1;return()=>{t||(t=!0,u.delete(e))}},start:()=>{g||(g=!0,E())},stop:()=>{g=!1,p!==`closed`&&h(`closed`),O&&=(clearTimeout(O),null),k&&=(clearTimeout(k),null),m&&=(clearTimeout(m),null),T()},dispose:()=>{g=!1,p!==`closed`&&h(`closed`),O&&=(clearTimeout(O),null),k&&=(clearTimeout(k),null),m&&=(clearTimeout(m),null),T(),d.complete(),f.complete()}}}var ec=[...fr.filter(e=>!Qn.includes(e)),...pr];function tc(e){return e===400?`bad-request`:e===401?`unauthorized`:e===403?`forbidden`:e===404?`not-found`:e===409?`conflict`:e>=500?`unavailable`:`error`}var nc=class extends qr{status;statusText;constructor(e,t,n,r){super(e,tc(t),{status:t,statusText:n,body:r}),this.name=`APIError`,this.status=t,this.statusText=n}},rc=class{baseUrl;http;token$;logger;errorsSubject=new wt;errors$=this.errorsSubject.asObservable();_actor=null;_actorStarted=!1;disposed=!1;scopeRefCounts=new Map;bridges=[];config;constructor(e){let{baseUrl:t,timeout:n=3e4,retry:r=2,logger:i,tokenRefresher:a}=e;this.config=e,this.baseUrl=t.endsWith(`/`)?t.slice(0,-1):t,this.token$=e.token$??new Et(null),this.logger=i;let o=a?{limit:1,methods:[`get`,`post`,`put`,`patch`,`delete`,`head`,`options`],statusCodes:[401,408,413,429,500,502,503,504]}:r;this.http=no.create({timeout:n,retry:o,hooks:{beforeRequest:[({request:e})=>{this.logger&&this.logger.debug(`HTTP Request`,{type:`http_request`,url:e.url,method:e.method,timestamp:Date.now(),hasAuth:e.headers.has(`Authorization`)})}],beforeRetry:a?[async({request:e,error:t})=>{if(!(!(t instanceof Ui)||t.response.status!==401))try{let t=await a();if(!t)return no.stop;e.headers.set(`Authorization`,`Bearer ${t}`);return}catch{return no.stop}}]:[],afterResponse:[({request:e,response:t})=>(this.logger&&this.logger.debug(`HTTP Response`,{type:`http_response`,url:e.url,method:e.method,status:t.status,statusText:t.statusText}),t)],beforeError:[async({request:e,error:t})=>{let n=t instanceof Ui?t.response:void 0;if(n){let t=await n.json().catch(()=>({}));this.logger&&this.logger.error(`HTTP Request Failed`,{type:`http_error`,url:e.url,method:e.method,status:n.status,statusText:n.statusText,error:t.message||`HTTP ${n.status}: ${n.statusText}`});let r=new nc(t.message||`HTTP ${n.status}: ${n.statusText}`,n.status,n.statusText,t);throw this.errorsSubject.next(r),r}return t}]}}),this.token$.subscribe(e=>{e&&!this._actorStarted&&!this.disposed&&(this._actorStarted=!0,this.actor.start())})}get actor(){if(!this._actor){this._actor=$s({baseUrl:this.baseUrl,token:()=>this.token$.getValue()??``,channels:[...Qn],...this.config.loadLastEventIds?{loadLastEventIds:this.config.loadLastEventIds}:{},...this.config.saveLastEventId?{saveLastEventId:this.config.saveLastEventId}:{}});for(let e of[...Qn,...ec])this._actor.on$(e).subscribe(t=>{for(let n of this.bridges)n.get(e).next(t)})}return this._actor}async emit(e,t,n){return ir(`EMIT`,e,t,n),Ys(e,n),Bs(`bus.emit:${e}`,async()=>n===void 0?this.actor.emit(e,t):this.actor.emit(e,t,n),{kind:xs.PRODUCER,attrs:{"bus.channel":e,...n?{"bus.scope":n}:{}}})}on(e,t){let n=this.actor.on$(e).subscribe(t);return()=>n.unsubscribe()}stream(e){return this.actor.on$(e)}bridgeInto(e){this.bridges.push(e)}subscribeToResource(e){let t=e,n=this.scopeRefCounts.get(t)??0;this.scopeRefCounts.set(t,n+1),n===0&&this.actor.addChannels([...ec],t);let r=!1;return()=>{if(r)return;r=!0;let e=(this.scopeRefCounts.get(t)??0)-1;if(e>0){this.scopeRefCounts.set(t,e);return}this.scopeRefCounts.delete(t),this.actor.removeChannels([...ec],t)}}get state$(){return this.actor.state$}trackReply(e){return this.actor.trackReply(e)}dispose(){this.disposed||(this.disposed=!0,this.scopeRefCounts.clear(),this._actor&&=(this._actor.dispose(),null),this.errorsSubject.complete())}pushError(e){this.disposed||this.errorsSubject.next(e)}authHeaders(){let e=this.token$.getValue()??void 0;return e?{Authorization:`Bearer ${e}`}:{}}async authenticatePassword(e,t){return this.http.post(`${this.baseUrl}/api/tokens/password`,{json:{email:e,password:t},headers:this.authHeaders()}).json()}async authenticateGoogle(e){return this.http.post(`${this.baseUrl}/api/tokens/google`,{json:{credential:e},headers:this.authHeaders()}).json()}async refreshAccessToken(e){return this.http.post(`${this.baseUrl}/api/tokens/refresh`,{json:{refreshToken:e},headers:this.authHeaders()}).json()}async logout(){await this.http.post(`${this.baseUrl}/api/users/logout`,{headers:this.authHeaders()}).json()}async acceptTerms(){await this.http.post(`${this.baseUrl}/api/users/accept-terms`,{headers:this.authHeaders()}).json()}async getCurrentUser(){return this.http.get(`${this.baseUrl}/api/users/me`,{headers:this.authHeaders()}).json()}async getMediaToken(e){return this.http.post(`${this.baseUrl}/api/tokens/media`,{json:{resourceId:e},headers:this.authHeaders()}).json()}async listUsers(){return this.http.get(`${this.baseUrl}/api/admin/users`,{headers:this.authHeaders()}).json()}async getUserStats(){return this.http.get(`${this.baseUrl}/api/admin/users/stats`,{headers:this.authHeaders()}).json()}async updateUser(e,t){return this.http.patch(`${this.baseUrl}/api/admin/users/${e}`,{json:t,headers:this.authHeaders()}).json()}async getOAuthConfig(){return this.http.get(`${this.baseUrl}/api/admin/oauth/config`,{headers:this.authHeaders()}).json()}async healthCheck(){return this.http.get(`${this.baseUrl}/api/health`,{headers:this.authHeaders()}).json()}async getStatus(){return this.http.get(`${this.baseUrl}/api/status`,{headers:this.authHeaders()}).json()}get rawHttp(){return this.http}getToken(){return this.token$.getValue()??void 0}},ic=class{constructor(e){this.transport=e}transport;async putBinary(e,t){let n=e.file instanceof File?e.file.size:e.file.length;return ir(`PUT`,`content`,{name:e.name,format:e.format,storageUri:e.storageUri,sizeBytes:n}),Bs(`content.put`,async()=>{let n=ac(e),r=this.requestHeaders(t?.auth);return typeof XMLHttpRequest<`u`&&(t?.onProgress||t?.signal)?oc({url:`${this.transport.baseUrl}/resources`,formData:n,headers:r,onProgress:t.onProgress,signal:t.signal,onApiError:e=>this.transport.pushError(e)}):{resourceId:(await this.transport.rawHttp.post(`${this.transport.baseUrl}/resources`,{body:n,headers:r}).json()).resourceId}},{kind:xs.CLIENT,attrs:{"content.format":e.format,"content.size_bytes":n}})}async getBinary(e,t){return ir(`GET`,`content`,{resourceId:e}),Bs(`content.get`,async()=>{let n=await this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${e}`,{headers:this.requestHeaders(t?.auth)}),r=n.headers.get(`content-type`)||`application/octet-stream`;return{data:await n.arrayBuffer(),contentType:r}},{kind:xs.CLIENT,attrs:{"resource.id":e}})}async getBinaryStream(e,t){return ir(`GET`,`content`,{resourceId:e,stream:!0}),Bs(`content.get`,async()=>{let n=await this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${e}`,{headers:this.requestHeaders(t?.auth)}),r=n.headers.get(`content-type`)||`application/octet-stream`;if(!n.body)throw Error(`Response body is null - cannot create stream`);return{stream:n.body,contentType:r}},{kind:xs.CLIENT,attrs:{"resource.id":e,"content.stream":!0}})}async getResourceGraph(e,t){return ir(`GET`,`content`,{resourceId:e,graph:!0}),Bs(`content.get_graph`,()=>this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${e}/jsonld`,{headers:this.requestHeaders(t?.auth)}).json(),{kind:xs.CLIENT,attrs:{"resource.id":e,"content.graph":!0}})}async putAnchoredText(e,t,n){ir(`PUT`,`anchored-text`,{checksum:e}),await Bs(`content.put_anchored_text`,()=>this.transport.rawHttp.put(`${this.transport.baseUrl}/anchored-text/${e}`,{headers:this.requestHeaders(n?.auth),json:t}).json(),{kind:xs.CLIENT,attrs:{"content.checksum":e}})}async getAnchoredText(e,t){return ir(`GET`,`anchored-text`,{resourceId:e}),Bs(`content.get_anchored_text`,async()=>{let n=await this.transport.rawHttp.get(`${this.transport.baseUrl}/resources/${e}/anchored-text`,{headers:this.requestHeaders(t?.auth),throwHttpErrors:!1});if(n.status===204||n.status===404)return null;if(!n.ok)throw Error(`anchored-text read failed: ${n.status}`);return n.json()},{kind:xs.CLIENT,attrs:{"resource.id":e}})}async getAnchoredTextByChecksum(e,t){return ir(`GET`,`anchored-text-by-checksum`,{checksum:e}),Bs(`content.get_anchored_text_by_checksum`,async()=>{let n=await this.transport.rawHttp.get(`${this.transport.baseUrl}/anchored-text/${e}`,{headers:this.requestHeaders(t?.auth),throwHttpErrors:!1});if(n.status===204)return null;if(!n.ok)throw Error(`anchored-text checksum read failed: ${n.status}`);return n.json()},{kind:xs.CLIENT,attrs:{"content.checksum":e}})}async listAnchoredTextKeys(e){return ir(`GET`,`anchored-text-keys`,{}),Bs(`content.list_anchored_text_keys`,async()=>{let{keys:t}=await this.transport.rawHttp.get(`${this.transport.baseUrl}/anchored-text/keys`,{headers:this.requestHeaders(e?.auth)}).json();return t},{kind:xs.CLIENT})}dispose(){}requestHeaders(e){let t=e??this.transport.getToken(),n=t?{Authorization:`Bearer ${t}`}:{},r=Hs();return r&&(n.traceparent=r.traceparent,r.tracestate&&(n.tracestate=r.tracestate)),n}};function ac(e){let t=new FormData;if(t.append(`name`,e.name),t.append(`format`,e.format),t.append(`storageUri`,e.storageUri),e.file instanceof File)t.append(`file`,e.file);else if(typeof Buffer<`u`&&Buffer.isBuffer(e.file)){let n=new Blob([new Uint8Array(e.file)],{type:e.format});t.append(`file`,n,e.name)}else throw Error(`file must be a File or Buffer`);return e.entityTypes&&e.entityTypes.length>0&&t.append(`entityTypes`,JSON.stringify(e.entityTypes)),e.language&&t.append(`language`,e.language),e.sourceAnnotationId&&t.append(`sourceAnnotationId`,String(e.sourceAnnotationId)),e.sourceResourceId&&t.append(`sourceResourceId`,String(e.sourceResourceId)),e.generationPrompt&&t.append(`generationPrompt`,e.generationPrompt),e.generator&&t.append(`generator`,JSON.stringify(e.generator)),e.cloneToken&&t.append(`cloneToken`,e.cloneToken),e.archiveOriginal!==void 0&&t.append(`archiveOriginal`,String(e.archiveOriginal)),e.isDraft!==void 0&&t.append(`isDraft`,String(e.isDraft)),t}function oc(e){let{url:t,formData:n,headers:r,onProgress:i,signal:a,onApiError:o}=e;return new Promise((e,s)=>{let c=new XMLHttpRequest;if(a?.aborted){let e=new nc(`Upload aborted`,0,`aborted`);o(e),s(e);return}c.open(`POST`,t);for(let[e,t]of Object.entries(r))c.setRequestHeader(e,t);i&&(c.upload.onprogress=e=>{let t=e.lengthComputable?e.total:0;i({bytesUploaded:e.loaded,totalBytes:t})}),c.onload=()=>{if(c.status>=200&&c.status<300){try{e({resourceId:JSON.parse(c.responseText).resourceId})}catch(e){let t=new nc(`Upload succeeded but response was not valid JSON: ${e.message}`,c.status,c.statusText,c.responseText);o(t),s(t)}return}let t=c.responseText;try{t=JSON.parse(c.responseText)}catch{}let n=new nc(t&&typeof t==`object`&&`message`in t&&typeof t.message==`string`?t.message:`HTTP ${c.status}: ${c.statusText}`,c.status,c.statusText,t);o(n),s(n)},c.onerror=()=>{let e=new nc(`Network error during upload`,0,`network-error`);o(e),s(e)},c.ontimeout=()=>{let e=new nc(`Upload timed out`,0,`timeout`);o(e),s(e)},c.onabort=()=>{let e=new nc(`Upload aborted`,0,`aborted`);o(e),s(e)},a&&a.addEventListener(`abort`,()=>c.abort(),{once:!0}),c.send(n)})}var sc=class e extends ht{then(e,t){return _n(this).then(e,t)}run(e){return new Promise((t,n)=>{let r,i=!1;this.subscribe({next:t=>{i=!0,r=t,e(t)},error:n,complete:()=>{i?t(r):n(new gn)}})})}static from(t){return new e(e=>t.subscribe(e))}},cc=class e extends ht{fetchFresh;fresh(){return this.fetchFresh?this.fetchFresh():vn(this.pipe(An(e=>e.status!==`pending`))).then(e=>{if(e.status===`failed`)throw e.error;return e.value})}static from(t,n){let r=lc.get(t);return r||(r=new e(e=>t.subscribe(e)),r.fetchFresh=n,lc.set(t,r)),r}},lc=new WeakMap,uc=class extends ht{then(e,t){return _n(this).then(t=>{if(t.phase!==`finished`)throw Error(`UploadObservable resolved on a non-finished event: ${t.phase}`);let n={resourceId:t.resourceId};return e?e(n):n},t)}run(e){return new Promise((t,n)=>{let r;this.subscribe({next:t=>{r=t,e(t)},error:n,complete:()=>{r?.phase===`finished`?t({resourceId:r.resourceId}):n(Error(`UploadObservable completed on a non-finished event: ${r?.phase??`<none>`}`))}})})}},dc=e=>e.status===`ready`,fc=e=>e.status===`ready`?e.value:void 0;function pc(e,t){let n=t?.persister,r=n?.load()??new Map,i=new Et(r),a=new Set(r.keys()),o=new Map,s=new Map,c=!1,l=new Map,u=new wt,d=e=>e instanceof Error?e:Error(String(e)),f=t?.saveDebounceMs??50,p=null,m=null,h=e=>{try{n?.save(e)}catch(e){console.warn(`[cache PERSIST] save failed; persistence skipped (best-effort):`,e instanceof Error?e.message:e)}},g=!1;n&&(i.pipe(zn(1)).subscribe(e=>{c||g||(p!==null&&clearTimeout(p),p=setTimeout(()=>{p=null,h(e)},f))}),m=n.subscribe?.(e=>{if(!c){g=!0;try{i.next(new Map(e))}finally{g=!1}}})??null);let _=t=>{a.delete(t);let n=o.get(t);if(n)return n;let r;return r=(async()=>{try{let n=await e(t);l.delete(t);let r=new Map(i.value);return r.set(t,n),i.next(r),n}finally{o.get(t)===r&&o.delete(t)}})(),o.set(t,r),r},v=e=>{c||_(e).catch(t=>{c||(console.warn(`[cache RETRY] SWR fetch failed for key ${String(e)}; re-issuing once (B14):`,t instanceof Error?t.message:t),_(e).catch(t=>{if(!c&&(console.warn(`[cache IDLE] retry also failed for key ${String(e)}; going idle until the next observe()/invalidate() (B14):`,t instanceof Error?t.message:t),!i.value.has(e))){let n=d(t);l.set(e,n),u.next({key:e,error:n})}}))})};return{observe(e){let t=s.get(e);if(!t){let n=kn(i.pipe(Cn(t=>t.has(e)?{status:`ready`,value:t.get(e)}:{status:`pending`}),Fn((e,t)=>e.status===t.status&&(e.status!==`ready`||Object.is(e.value,t.value)))),u.pipe(An(t=>t.key===e),Cn(e=>({status:`failed`,error:e.error}))));t=new ht(t=>(c||(l.has(e)?(l.delete(e),v(e)):(a.has(e)||!i.value.has(e)&&!o.has(e))&&v(e)),n.subscribe(t))),s.set(e,t)}return t},fetch(e){return c?Promise.reject(Error(`Cache disposed`)):_(e)},get(e){return i.value.get(e)},keys(){return[...i.value.keys()]},invalidate(e){c||(o.delete(e),l.delete(e),v(e))},remove(e){if(c)return;a.delete(e);let t=new Map(i.value);t.delete(e),i.next(t),o.delete(e),l.delete(e)},set(e,t){if(c)return;l.delete(e),a.delete(e);let n=new Map(i.value);n.set(e,t),i.next(n)},invalidateAll(){if(!c)for(let e of i.value.keys())o.delete(e),v(e)},persistencePending(){return o.size>0||p!==null},dispose(){c||(c=!0,p!==null&&(clearTimeout(p),p=null,h(i.value)),m?.(),a.clear(),i.complete(),u.complete(),l.clear(),s.clear(),o.clear())}}}function mc(e,t){let n=new Map,r=null,i=()=>{let n=e.get(t);if(!n)return{};try{let e=JSON.parse(n);return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`))}catch{return{}}};return{storage:{get:t=>e.get(t),set:(a,o)=>{if(e.set(a,o),n.size>0&&(r===null||r())){let r={...i(),...Object.fromEntries(n)};e.set(t,JSON.stringify(r)),n.clear()}},delete:t=>e.delete(t),...e.subscribe?{subscribe:e.subscribe.bind(e)}:{}},saveLastEventId:(e,t)=>{n.set(e,t)},loadLastEventIds:()=>{let e=i();return Object.keys(e).length>0?e:null},setFlushGate:e=>{r=e}}}var hc=2097152;function gc(e,t){if(!e)return null;try{let n=JSON.parse(e);return typeof n!=`object`||!n||n.version!==t||!Array.isArray(n.entries)?null:n}catch{return null}}function _c(e){let{storage:t,storageKey:n,version:r}=e,i=e.maxBytes??hc,a=e.keyToJson??(e=>e),o=e.jsonToKey??(e=>e),s=new Map,c=e=>{s=new Map(e.entries.map(([e,t,n])=>[JSON.stringify(e),{valueJson:JSON.stringify(t),writtenAt:n}]))},l=e=>new Map(e.entries.map(([e,t])=>[o(e),t]));return{load(){let e=gc(t.get(n),r);return e?(c(e),l(e)):null},save(e){let o=Date.now(),c=[],l=new Map;for(let[t,n]of e){let e=a(t),r=JSON.stringify(e),i=JSON.stringify(n),u=s.get(r),d=u!==void 0&&u.valueJson===i?u.writtenAt:o;l.set(r,{valueJson:i,writtenAt:d}),c.push([e,n,d])}let u=new TextEncoder,d=e=>u.encode(JSON.stringify({version:r,writtenAt:o,entries:e})).length;if(d(c)>i)for(c=[...c].sort((e,t)=>e[2]-t[2]);c.length>0&&d(c)>i;){let[e]=c.splice(0,1);e&&l.delete(JSON.stringify(e[0]))}s=l,t.set(n,JSON.stringify({version:r,writtenAt:o,entries:c}))},subscribe(e){return t.subscribe?.((t,i)=>{if(t!==n)return;let a=gc(i,r);a&&(c(a),e(l(a)))})??(()=>{})}}}var vc=1,yc=`_`,bc=`_`,xc=`_`,Sc=class{constructor(e,t,n,r){this.transport=e,this.bus=t,this.content=n,this.busTimeoutMs=r?.busTimeoutMs;let i=r?.cachePersistence,a=e=>i?{persister:_c({storage:i.storage,storageKey:`semiont.cache.${i.keyPrefix}.${e}`,version:vc})}:void 0,o=e=>(i&&this.persistedCaches.push(e),e);this.resourceCache=o(pc(async e=>(await Yr(this.transport,`browse:resource-requested`,{resourceId:e},this.busTimeoutMs)).resource,a(`resource`))),this.resourceListCache=pc(async e=>{let t=this.resourceListFilters.get(e)??{},n=t.search?Jn(t.search):void 0,r=await Yr(this.transport,`browse:resources-requested`,{search:n,archived:t.archived,entityType:t.entityType,limit:t.limit??100,offset:0},this.busTimeoutMs);return{...r,resources:r.resources}}),this.annotationListCache=o(pc(async e=>Yr(this.transport,`browse:annotations-requested`,{resourceId:e},this.busTimeoutMs),a(`annotations`))),this.annotationDetailCache=o(pc(async e=>{let t=this.annotationResources.get(e);if(!t)throw Error(`Cannot fetch annotation ${e}: no resourceId known`);return(await Yr(this.transport,`browse:annotation-requested`,{resourceId:t,annotationId:e},this.busTimeoutMs)).annotation},a(`annotation-detail`))),this.entityTypesCache=o(pc(async()=>(await Yr(this.transport,`browse:entity-types-requested`,{},this.busTimeoutMs)).entityTypes,a(`entity-types`))),this.tagSchemasCache=o(pc(async()=>(await Yr(this.transport,`browse:tag-schemas-requested`,{},this.busTimeoutMs)).tagSchemas,a(`tag-schemas`))),this.agentsCache=pc(async()=>(await Yr(this.transport,`browse:agents-requested`,{},this.busTimeoutMs)).agents),this.referencedByCache=pc(async e=>(await Yr(this.transport,`browse:referenced-by-requested`,{resourceId:e},this.busTimeoutMs)).referencedBy),this.resourceEventsCache=pc(async e=>(await Yr(this.transport,`browse:events-requested`,{resourceId:e},this.busTimeoutMs)).events),this.subscribeToEvents()}transport;bus;content;resourceCache;resourceListCache;annotationListCache;annotationDetailCache;annotationResources=new Map;entityTypesCache;tagSchemasCache;agentsCache;referencedByCache;resourceEventsCache;resourceListFilters=new Map;annotationListObs=new Map;scopedSources=new WeakMap;busTimeoutMs;busSubs=[];persistedCaches=[];withScope(e,t){let n=this.scopedSources.get(t);return n||(n=new ht(n=>{let r=this.transport.subscribeToResource(e),i=t.subscribe(n);return()=>{i.unsubscribe(),r()}}),this.scopedSources.set(t,n)),n}resource(e){return cc.from(this.withScope(e,this.resourceCache.observe(e)),()=>this.resourceCache.fetch(e))}resources(e){let t=JSON.stringify(e??{});return this.resourceListFilters.set(t,e??{}),cc.from(this.resourceListCache.observe(t),()=>this.resourceListCache.fetch(t))}annotations(e){let t=this.annotationListObs.get(e);return t||(t=this.annotationListCache.observe(e).pipe(Cn(e=>e.status===`ready`?{status:`ready`,value:e.value.annotations}:e)),this.annotationListObs.set(e,t)),cc.from(this.withScope(e,t),()=>this.annotationListCache.fetch(e).then(e=>e.annotations))}annotation(e,t){return this.annotationResources.set(t,e),cc.from(this.withScope(e,this.annotationDetailCache.observe(t)),()=>this.annotationDetailCache.fetch(t))}entityTypes(){return cc.from(this.entityTypesCache.observe(yc),()=>this.entityTypesCache.fetch(yc))}tagSchemas(){return cc.from(this.tagSchemasCache.observe(bc),()=>this.tagSchemasCache.fetch(bc))}agents(){return cc.from(this.agentsCache.observe(xc),()=>this.agentsCache.fetch(xc))}referencedBy(e){return cc.from(this.withScope(e,this.referencedByCache.observe(e)),()=>this.referencedByCache.fetch(e))}events(e){return cc.from(this.withScope(e,this.resourceEventsCache.observe(e)),()=>this.resourceEventsCache.fetch(e))}async resourceContent(e){let t=await this.content.getBinary(e);return hi(t.data,t.contentType)}async resourceAnchoredText(e){return Yr(this.transport,`browse:anchored-text-requested`,{resourceId:e},this.busTimeoutMs)}async anchoredTextByChecksum(e){return Yr(this.transport,`browse:anchored-text-by-checksum-requested`,{checksum:e},this.busTimeoutMs)}async resourceGraph(e){return this.content.getResourceGraph(e)}async resourceRepresentation(e){return this.content.getBinary(e)}async resourceRepresentationStream(e){return this.content.getBinaryStream(e)}async resourceEvents(e){return(await Yr(this.transport,`browse:events-requested`,{resourceId:e},this.busTimeoutMs)).events}async annotationHistory(e,t){return Yr(this.transport,`browse:annotation-history-requested`,{resourceId:e,annotationId:t},this.busTimeoutMs)}async connections(e){throw Error(`Not implemented: connections endpoint does not exist yet`)}async backlinks(e){throw Error(`Not implemented: backlinks endpoint does not exist yet`)}async resourcesByName(e,t){throw Error(`Not implemented: resourcesByName endpoint does not exist yet`)}async files(e,t){return Yr(this.transport,`browse:directory-requested`,{path:e??`.`,sort:t??`name`},this.busTimeoutMs)}click(e,t){this.bus.get(`browse:click`).next({annotationId:e,...t?{anchorRect:t}:{}})}openResource(e){this.bus.get(`browse:resource-open`).next({resourceId:e})}resourceViewed(e){this.transport.emit(`browse:resource-viewed`,{resourceId:e}).catch(()=>{})}invalidateAnnotationList(e){this.annotationListCache.invalidate(e)}removeAnnotationDetail(e){this.annotationDetailCache.remove(e),this.annotationResources.delete(e)}invalidateResourceDetail(e){this.resourceCache.invalidate(e)}invalidateResourceLists(){this.resourceListCache.invalidateAll()}invalidateEntityTypes(){this.entityTypesCache.invalidate(yc)}invalidateTagSchemas(){this.tagSchemasCache.invalidate(bc)}invalidateAgents(){this.agentsCache.invalidate(xc)}persistenceSettled(){return this.persistedCaches.every(e=>!e.persistencePending())}invalidateReferencedBy(e){this.referencedByCache.invalidate(e)}invalidateResourceEvents(e){this.resourceEventsCache.invalidate(e)}updateAnnotationInPlace(e,t){let n=this.annotationListCache.get(e);if(n){let r=n.annotations.findIndex(e=>e.id===t.id),i=r>=0?n.annotations.map((e,n)=>n===r?t:e):[...n.annotations,t];this.annotationListCache.set(e,{...n,annotations:i})}let r=dr(t.id);this.annotationResources.set(r,e),this.annotationDetailCache.set(r,t)}on(e,t){this.busSubs.push(this.bus.get(e).subscribe(t))}dispose(){for(let e of this.busSubs)e.unsubscribe();this.busSubs.length=0,this.resourceCache.dispose(),this.resourceListCache.dispose(),this.annotationListCache.dispose(),this.annotationDetailCache.dispose(),this.entityTypesCache.dispose(),this.tagSchemasCache.dispose(),this.agentsCache.dispose(),this.referencedByCache.dispose(),this.resourceEventsCache.dispose(),this.annotationResources.clear(),this.resourceListFilters.clear(),this.annotationListObs.clear()}onEntityTagChanged=e=>{e.resourceId&&(this.invalidateAnnotationList(e.resourceId),this.invalidateResourceDetail(e.resourceId),this.invalidateResourceEvents(e.resourceId))};onArchiveToggled=e=>{e.resourceId&&(this.invalidateResourceDetail(e.resourceId),this.invalidateResourceLists())};invalidateMutatedResource=e=>{let t=ur(e);this.invalidateResourceDetail(t),this.invalidateResourceLists()};subscribeToEvents(){this.on(`bus:resume-gap`,e=>{let t=e.scope;if(t){let e=t;this.invalidateAnnotationList(e),this.invalidateResourceDetail(e),this.invalidateResourceEvents(e),this.invalidateReferencedBy(e)}else{this.invalidateResourceLists();for(let e of this.annotationListCache.keys())this.invalidateAnnotationList(e);for(let e of this.resourceCache.keys())this.invalidateResourceDetail(e);for(let e of this.resourceEventsCache.keys())this.invalidateResourceEvents(e);for(let e of this.referencedByCache.keys())this.invalidateReferencedBy(e)}this.invalidateEntityTypes(),this.invalidateTagSchemas(),this.invalidateAgents()}),this.on(`mark:delete-ok`,e=>{this.removeAnnotationDetail(dr(e.response.annotationId))}),this.on(`mark:added`,e=>{e.resourceId&&(this.invalidateAnnotationList(e.resourceId),this.invalidateResourceEvents(e.resourceId))}),this.on(`mark:removed`,e=>{e.resourceId&&(this.invalidateAnnotationList(e.resourceId),this.invalidateResourceEvents(e.resourceId)),this.removeAnnotationDetail(dr(e.payload.annotationId))}),this.on(`mark:body-updated`,e=>{let t=e;!t.resourceId||!t.annotation||(this.updateAnnotationInPlace(t.resourceId,t.annotation),this.invalidateResourceEvents(t.resourceId))}),this.on(`mark:entity-tag-added`,this.onEntityTagChanged),this.on(`mark:entity-tag-removed`,this.onEntityTagChanged),this.on(`replay-window-exceeded`,e=>{e.resourceId&&this.invalidateAnnotationList(e.resourceId)}),this.on(`yield:create-ok`,e=>this.invalidateMutatedResource(e.response.resourceId)),this.on(`yield:update-ok`,e=>this.invalidateMutatedResource(e.response.resourceId)),this.on(`mark:archived`,this.onArchiveToggled),this.on(`mark:unarchived`,this.onArchiveToggled),this.on(`frame:entity-type-added`,()=>this.invalidateEntityTypes()),this.on(`frame:tag-schema-added`,()=>this.invalidateTagSchemas())}},Cc=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;async annotation(e){let t=ur(e.target.source);return{annotationId:dr((await Yr(this.transport,`mark:create-request`,{resourceId:t,request:e})).annotationId)}}async delete(e,t){await Yr(this.transport,`mark:delete`,{annotationId:t,resourceId:e})}async archive(e){await Yr(this.transport,`mark:archive`,{resourceId:e})}async unarchive(e){await Yr(this.transport,`mark:unarchive`,{resourceId:e})}async updateEntityTypes(e,t,n){await Yr(this.transport,`mark:update-entity-types`,{resourceId:e,currentEntityTypes:t,updatedEntityTypes:n})}assist(e,t,n){return new sc(r=>{let i=!1,a=null,o=null,s=()=>{i=!0,a&&=(clearTimeout(a),null),o&&=(clearInterval(o),null)},c=t=>{a&&clearTimeout(a),o&&=(clearInterval(o),null),a=setTimeout(()=>{i||(o=setInterval(()=>{i||Yr(this.transport,`job:status-requested`,{jobId:t}).then(n=>{i||(n.status===`complete`?(s(),r.next({kind:`complete`,data:{jobId:t,jobType:n.type??`annotation`,resourceId:e,result:n.result}}),r.complete()):n.status===`failed`&&(s(),r.error(Error(n.error??`Job failed`))))}).catch(()=>{})},5e3))},1e4)},l=null,u=this.bus.get(`job:report-progress`).pipe(An(e=>e.jobId===l)),d=this.bus.get(`job:complete`).pipe(An(e=>e.jobId===l)),f=this.bus.get(`job:fail`).pipe(An(e=>e.jobId===l)),p=u.pipe(Hn(kn(d,f))).subscribe(e=>{e.progress&&r.next({kind:`progress`,data:e.progress}),l&&c(l)}),m=d.subscribe(e=>{s(),r.next({kind:`complete`,data:e}),r.complete()}),h=f.subscribe(e=>{s(),r.error(Error(e.error))});return this.dispatchAssist(e,t,n).then(({jobId:e})=>{e&&!i&&(l=e,c(e))}).catch(e=>{i||(s(),r.error(e))}),()=>{s(),p.unsubscribe(),m.unsubscribe(),h.unsubscribe()}})}request(e,t,n){this.bus.get(`mark:requested`).next({source:e,selector:t,motivation:n})}requestAssist(e,t,n){this.bus.get(`mark:assist-request`).next({motivation:e,options:t,...n?{correlationId:n}:{}})}submit(e){this.bus.get(`mark:submit`).next(e)}cancelPending(){this.bus.get(`mark:cancel-pending`).next(void 0)}dismissProgress(){this.bus.get(`mark:progress-dismiss`).next(void 0)}async dispatchAssist(e,t,n){let r={tagging:`tag-annotation`,linking:`reference-annotation`,highlighting:`highlight-annotation`,assessing:`assessment-annotation`,commenting:`comment-annotation`}[t];if(!r)throw Error(`Unsupported motivation: ${t}`);if(t===`tagging`){if(!n.schemaId)throw Error(`mark.assist with motivation "tagging" requires options.schemaId`);if(!n.categories?.length)throw Error(`mark.assist with motivation "tagging" requires a non-empty options.categories array`)}else if(t===`linking`&&!n.entityTypes?.length)throw Error(`mark.assist with motivation "linking" requires a non-empty entityTypes array`);let i={};return n.entityTypes&&(i.entityTypes=n.entityTypes),n.includeDescriptiveReferences!==void 0&&(i.includeDescriptiveReferences=n.includeDescriptiveReferences),n.instructions!==void 0&&(i.instructions=n.instructions),n.density!==void 0&&(i.density=n.density),n.tone!==void 0&&(i.tone=n.tone),n.language!==void 0&&(i.language=n.language),n.sourceLanguage!==void 0&&(i.sourceLanguage=n.sourceLanguage),n.schemaId!==void 0&&(i.schemaId=n.schemaId),n.categories!==void 0&&(i.categories=n.categories),Yr(this.transport,`job:create`,{jobType:r,resourceId:e,params:i})}},wc=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;async body(e,t,n){await Yr(this.transport,`bind:update-body`,{annotationId:t,resourceId:e,operations:n})}initiate(e){this.bus.get(`bind:initiate`).next(e)}reportBodyError(e){this.bus.get(`bind:body-error`).next(e)}},Tc=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;annotation(e,t,n){return new sc(r=>{let i=_r(),a=this.bus.get(`gather:complete`).pipe(An(e=>e.correlationId===i)),o=this.bus.get(`gather:failed`).pipe(An(e=>e.correlationId===i)),s=kn(this.bus.get(`gather:annotation-progress`).pipe(An(e=>e.annotationId===t),Cn(e=>e)),a.pipe(Cn(e=>e))).pipe(Hn(kn(a,o))).subscribe({next:e=>r.next(e),error:e=>r.error(e)}),c=a.subscribe(e=>{r.next(e),r.complete()}),l=o.subscribe(e=>{r.error(Error(e.message))});return this.transport.emit(`gather:requested`,{correlationId:i,annotationId:t,resourceId:e,options:{contextWindow:n?.contextWindow??2e3}}).catch(e=>{r.closed||r.error(e)}),()=>{s.unsubscribe(),c.unsubscribe(),l.unsubscribe()}})}resource(e,t){return Yr(this.transport,`gather:resource-requested`,{resourceId:e,options:{depth:t?.depth??2,maxResources:t?.maxResources??10,includeContent:t?.includeContent??!0,includeSummary:t?.includeSummary??!1,...t?.excludeEntityTypes?.length?{excludeEntityTypes:t.excludeEntityTypes}:{}}})}},Ec=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;requestSearch(e){this.bus.get(`match:search-requested`).next(e)}search(e,t,n,r){return new sc(i=>{let a=_r(),o=this.bus.get(`match:search-results`).pipe(An(e=>e.correlationId===a)),s=this.bus.get(`match:search-failed`).pipe(An(e=>e.correlationId===a)),c=o.subscribe(e=>{i.next(e),i.complete()}),l=s.subscribe(e=>{i.error(Error(e.error))});return this.transport.emit(`match:search-requested`,{correlationId:a,resourceId:e,referenceId:t,context:n,limit:r?.limit??10,useSemanticScoring:r?.useSemanticScoring??!0}).catch(e=>{i.closed||i.error(e)}),()=>{c.unsubscribe(),l.unsubscribe()}})}},Dc=12e4;function Oc(e){return Math.max(Dc,(e??500)*75)}var kc=class extends qr{constructor(e,t){super(`generation stalled: no event within ${e}ms \u2014 cancel requested`,`generation-stall`,{deadlineMs:e,jobId:t}),this.deadlineMs=e,this.jobId=t,this.name=`GenerationStallError`}deadlineMs;jobId},Ac=class{constructor(e,t,n){this.transport=e,this.bus=t,this.content=n}transport;bus;content;resource(e){let t=typeof Buffer<`u`&&e.file instanceof Buffer?e.file.length:e.file.size;return new uc(n=>{n.next({phase:`started`,totalBytes:t});let r=!1,i=new AbortController;return this.content.putBinary({name:e.name,file:e.file,format:e.format,storageUri:e.storageUri,...e.entityTypes?{entityTypes:e.entityTypes}:{},...e.language?{language:e.language}:{},...e.sourceAnnotationId?{sourceAnnotationId:e.sourceAnnotationId}:{},...e.sourceResourceId?{sourceResourceId:e.sourceResourceId}:{},...e.generationPrompt?{generationPrompt:e.generationPrompt}:{},...e.generator?{generator:e.generator}:{},...e.isDraft===void 0?{}:{isDraft:e.isDraft}},{onProgress:({bytesUploaded:e,totalBytes:i})=>{if(r)return;let a=i>0?i:t;n.next({phase:`progress`,bytesUploaded:e,totalBytes:a})},signal:i.signal}).then(e=>{r||(n.next({phase:`finished`,resourceId:ur(e.resourceId)}),n.complete())}).catch(e=>{r||n.error(e)}),()=>{r=!0,i.abort()}})}fromContext(e,t){let n=e?.focus,r=n?.kind===`resource`&&typeof n.resource?.[`@id`]==`string`?n.resource[`@id`]:n?.kind===`annotation`&&typeof n.sourceResource?.[`@id`]==`string`?n.sourceResource[`@id`]:void 0;if(r===void 0)throw Error(`yield.fromContext: context has no usable focus — pass a GatheredContext produced by gather.resource(...) or gather.annotation(...).`);let{stallDeadlineMs:i,...a}=t,o=i??Oc(t.maxTokens);return this.runGeneration(ur(r),{...a,context:e},o)}runGeneration(e,t,n){return new sc(r=>{let i=!1,a=null,o=null,s=null,c=()=>{i=!0,a&&=(clearTimeout(a),null),o&&=(clearInterval(o),null),s&&=(clearTimeout(s),null)},l=t=>{a&&clearTimeout(a),o&&=(clearInterval(o),null),a=setTimeout(()=>{i||(o=setInterval(()=>{i||Yr(this.transport,`job:status-requested`,{jobId:t}).then(n=>{i||(n.status===`complete`?(c(),r.next({kind:`complete`,data:{jobId:t,jobType:n.type??`generation`,resourceId:e,result:n.result}}),r.complete()):n.status===`failed`&&(c(),r.error(Error(n.error??`Generation failed`))))}).catch(()=>{})},5e3))},1e4)},u=null,d=this.bus.get(`job:report-progress`).pipe(An(e=>e.jobId===u)),f=this.bus.get(`job:complete`).pipe(An(e=>e.jobId===u)),p=this.bus.get(`job:fail`).pipe(An(e=>e.jobId===u)),m=()=>{s&&clearTimeout(s),s=setTimeout(()=>{if(i)return;let e=u;c(),Yr(this.transport,`job:cancel-requested`,{jobType:`generation`}).catch(()=>{}),r.error(new kc(n,e))},n)},h=d.pipe(Hn(kn(f,p))).subscribe(e=>{e.progress&&r.next({kind:`progress`,data:e.progress}),u&&l(u),m()}),g=f.subscribe(e=>{c(),r.next({kind:`complete`,data:e}),r.complete()}),_=p.subscribe(e=>{c(),r.error(Error(e.error))});return m(),Yr(this.transport,`job:create`,{jobType:`generation`,params:t}).then(({jobId:e})=>{e&&!i&&(u=e,l(e))}).catch(e=>{i||(c(),r.error(e))}),()=>{c(),h.unsubscribe(),g.unsubscribe(),_.unsubscribe()}})}async cloneToken(e){return Yr(this.transport,`yield:clone-token-requested`,{resourceId:e})}async fromToken(e){return(await Yr(this.transport,`yield:clone-resource-requested`,{token:e})).sourceResource}async createFromToken(e){let t=Ci(Ur(await this.fromToken(e.token))?.mediaType),n=typeof Buffer<`u`?Buffer.from(e.content):new File([e.content],e.name,{type:t});return this.content.putBinary({name:e.name,file:n,format:t,storageUri:Ni(e.name,t),cloneToken:e.token,...e.archiveOriginal===void 0?{}:{archiveOriginal:e.archiveOriginal}})}clone(){this.bus.get(`yield:clone`).next(void 0)}},jc=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;attention(e,t){return this.transport.emit(`beckon:focus`,{annotationId:t,resourceId:e})}openResource(e){return this.transport.emit(`browse:resource-open`,{resourceId:e})}click(e){return this.transport.emit(`browse:click`,{annotationId:e})}sparkleAll(e){return this.transport.emit(`beckon:sparkle`,{annotationId:e})}hover(e){this.bus.get(`beckon:hover`).next({annotationId:e})}sparkle(e){this.bus.get(`beckon:sparkle`).next({annotationId:e})}},Mc=class{constructor(e){this.transport=e}transport;async addEntityType(e){await Yr(this.transport,`frame:add-entity-type`,{tag:e})}async addEntityTypes(e){for(let t of e)await Yr(this.transport,`frame:add-entity-type`,{tag:t})}async addTagSchema(e){await Yr(this.transport,`frame:add-tag-schema`,{schema:e})}},Nc=class{constructor(e,t){this.transport=e,this.bus=t}transport;bus;get queued$(){return this.bus.get(`job:queued`)}get progress$(){return this.bus.get(`job:report-progress`)}get complete$(){return this.bus.get(`job:complete`)}get fail$(){return this.bus.get(`job:fail`)}async status(e){return Yr(this.transport,`job:status-requested`,{jobId:e})}async pollUntilComplete(e,t){let n=t?.interval??1e3,r=t?.timeout??6e4,i=Date.now();for(;;){let a=await this.status(e);if(t?.onProgress&&t.onProgress(a),a.status===`complete`||a.status===`failed`||a.status===`cancelled`)return a;if(Date.now()-i>r)throw Error(`Job polling timeout after ${r}ms`);await new Promise(e=>setTimeout(e,n))}}async cancelByType(e){let{cancelled:t}=await Yr(this.transport,`job:cancel-requested`,{jobType:e});return t}cancelRequest(e){this.bus.get(`job:cancel-requested`).next({jobType:e})}},Pc=class{constructor(e){this.gateway=e}gateway;async password(e,t){return this.gateway.authenticatePassword(Un(e),t)}async google(e){return this.gateway.authenticateGoogle(Wn(e))}async refresh(e){return this.gateway.refreshAccessToken(Kn(e))}async logout(){await this.gateway.logout()}async me(){return this.gateway.getCurrentUser()}async acceptTerms(){await this.gateway.acceptTerms()}async mediaToken(e){return this.gateway.getMediaToken(e)}},Fc=class{constructor(e){this.gateway=e}gateway;async users(){return(await this.gateway.listUsers()).users}async userStats(){return this.gateway.getUserStats()}async updateUser(e,t){return(await this.gateway.updateUser(e,t)).user}async oauthConfig(){return this.gateway.getOAuthConfig()}async healthCheck(){return this.gateway.healthCheck()}async status(){return this.gateway.getStatus()}},Ic=class e{transport;content;bus;baseUrl;frame;browse;mark;bind;gather;match;yield;beckon;job;auth;admin;constructor(e,t,n,r){this.transport=e,this.content=t,this.baseUrl=e.baseUrl,this.bus=new cr,this.transport.bridgeInto(this.bus),this.frame=new Mc(this.transport),this.browse=new Sc(this.transport,this.bus,this.content,{...r?.cachePersistence?{cachePersistence:r.cachePersistence}:{},...r?.busTimeoutMs===void 0?{}:{busTimeoutMs:r.busTimeoutMs}}),this.mark=new Cc(this.transport,this.bus),this.bind=new wc(this.transport,this.bus),this.gather=new Tc(this.transport,this.bus),this.match=new Ec(this.transport,this.bus),this.yield=new Ac(this.transport,this.bus,this.content),this.beckon=new jc(this.transport,this.bus),this.job=new Nc(this.transport,this.bus),this.auth=n?new Pc(n):void 0,this.admin=n?new Fc(n):void 0}get state$(){return this.transport.state$}dispose(){this.browse.dispose(),this.transport.dispose(),this.content.dispose(),this.bus.destroy()}static fromHttp(t){let n=new rc({baseUrl:typeof t.baseUrl==`string`?Yn(t.baseUrl):t.baseUrl,token$:new Et(t.token==null?null:typeof t.token==`string`?Gn(t.token):t.token)}),r=new ic(n);return new e(n,r,n)}static async signInHttp(t){let n=typeof t.baseUrl==`string`?Yn(t.baseUrl):t.baseUrl,r=new Et(null),i=new rc({baseUrl:n,token$:r}),a=new ic(i),o=new e(i,a,i);try{let e=await o.auth.password(t.email,t.password);return r.next(Gn(e.token)),o}catch(e){throw o.dispose(),e}}},Lc=`semiont.session.`,Rc=`semiont.knowledgeBases`,zc=`semiont.activeKnowledgeBaseId`,Bc=`semiont.openResourcesByKb`,Vc=`semiont.lastViewedResourceByKb`,Hc=3e5;function Uc(e){return`${Lc}${e}`}function Wc(e,t){let n=e.get(Uc(t));if(!n)return null;try{let e=JSON.parse(n);if(e&&typeof e.access==`string`&&typeof e.refresh==`string`)return{access:e.access,refresh:e.refresh}}catch{}return null}function Gc(e,t,n){e.set(Uc(t),JSON.stringify(n))}function Kc(e,t){e.delete(Uc(t))}function qc(e){try{let t=e.split(`.`);if(t.length!==3||!t[1])return null;let n=JSON.parse(atob(t[1]));return n.exp?new Date(n.exp*1e3):null}catch{return null}}function Jc(e){let t=qc(e);return!t||t.getTime()<Date.now()}function Yc(e){if(!e||typeof e!=`object`)return!1;let t=e;if(typeof t.id!=`string`||typeof t.label!=`string`||typeof t.email!=`string`||typeof t.did!=`string`)return!1;let n=t.endpoint;return!n||typeof n!=`object`?!1:n.kind===`http`?typeof n.host==`string`&&typeof n.port==`number`&&(n.protocol===`http`||n.protocol===`https`):n.kind===`local`&&typeof n.kbId==`string`}function Xc(e){try{let t=e.get(Rc);return t?JSON.parse(t).filter(Yc):[]}catch{return[]}}function Zc(e,t){e.set(Rc,JSON.stringify(t))}function Qc(e){return e===`localhost`||e===`127.0.0.1`?`http`:`https`}var $c=/^(([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?|localhost|\d{1,3}(\.\d{1,3}){3})$/;function el(e){return $c.test(e)}function tl(e){if(!el(e.host))throw Error(`Invalid KB hostname: "${e.host}"`);let t=new URL(`http://x`);return t.protocol=e.protocol+`:`,t.hostname=e.host,t.port=String(e.port),`${e.protocol}://${t.hostname}:${e.port}`}function nl(){return _r()}var rl=class extends qr{kbId;constructor(e,t,n=null){super(t,e,{kbId:n}),this.name=`SemiontSessionError`,this.kbId=n}},il=0,al=class e{id;kb;client;token$;user$;streamState$;errors$;ready;storage;doRefresh;doValidate;onAuthFailed;onError;refreshTimer=null;unsubscribeStorage=null;disposed=!1;constructor(e){this.id=`session-${++il}`,this.kb=e.kb,this.storage=e.storage,this.doRefresh=e.refresh,this.doValidate=e.validate,this.onAuthFailed=e.onAuthFailed??(()=>{}),this.onError=e.onError??(()=>{}),this.client=e.client,this.token$=e.token$,this.user$=new Et(null),this.errors$=this.client.transport.errors$;let t=Wc(this.storage,this.kb.id);t&&!Jc(t.access)&&this.token$.getValue()===null&&this.token$.next(Gn(t.access));let n=this.token$.getValue();this.streamState$=this.client.state$,n&&this.scheduleProactiveRefresh(n),this.unsubscribeStorage=this.storage.subscribe?.((e,t)=>{this.handleStorageChange(e,t)})??null,this.ready=this.validate(t)}async validate(e){if(!e)return;let t=Jc(e.access)?this.doRefresh?await this.doRefresh():null:e.access;if(!t){Jc(e.access)&&Kc(this.storage,this.kb.id);return}if(t!==e.access&&(this.token$.next(Gn(t)),this.scheduleProactiveRefresh(t)),!this.doValidate)return;let n=async e=>{if(!this.disposed)try{let t=await this.doValidate(Gn(e));if(this.disposed)return;this.user$.next(t)}catch(e){if(this.disposed)return;if(e instanceof nc&&e.status===401){let e=this.doRefresh?await this.doRefresh():null;if(this.disposed)return;if(e){this.token$.next(Gn(e)),this.scheduleProactiveRefresh(e),await n(e);return}Kc(this.storage,this.kb.id),this.token$.next(null),this.onAuthFailed(`Your session has expired. Please sign in again.`)}else this.onError(new rl(`session.auth-failed`,e instanceof Error?e.message:String(e),this.kb.id))}};await n(t)}async refresh(){if(this.disposed||!this.doRefresh)return null;let e=await this.doRefresh();if(this.disposed)return null;if(e){let t=Gn(e);return this.token$.next(t),this.scheduleProactiveRefresh(e),t}return this.token$.next(null),Kc(this.storage,this.kb.id),this.onAuthFailed(`Your session has expired. Please sign in again.`),this.onError(new rl(`session.refresh-exhausted`,`Token refresh failed`,this.kb.id)),null}scheduleProactiveRefresh(e){this.clearRefreshTimer();let t=qc(e);if(!t)return;let n=t.getTime()-Hc,r=Math.max(0,n-Date.now());this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.disposed||this.refresh()},r)}clearRefreshTimer(){this.refreshTimer&&=(clearTimeout(this.refreshTimer),null)}handleStorageChange(e,t){if(!this.disposed&&e===Uc(this.kb.id)){if(!t){this.token$.next(null),this.user$.next(null),this.clearRefreshTimer();return}try{let e=JSON.parse(t);typeof e.access==`string`&&(this.token$.next(Gn(e.access)),this.scheduleProactiveRefresh(e.access))}catch{}}}get expiresAt(){let e=this.token$.getValue();return e?qc(e):null}subscribe(e,t){let n=this.client.bus.get(e).subscribe(t);return()=>n.unsubscribe()}async dispose(){this.disposed||(this.disposed=!0,this.clearRefreshTimer(),this.unsubscribeStorage&&=(this.unsubscribeStorage(),null),this.client.dispose(),this.token$.complete(),this.user$.complete())}static fromHttp(t){let n=typeof t.baseUrl==`string`?Yn(t.baseUrl):t.baseUrl,r=new Et(t.token==null?null:typeof t.token==`string`?Gn(t.token):t.token),i=new rc({baseUrl:n,token$:r}),a=new Ic(i,new ic(i),i),o={kb:t.kb,storage:t.storage,client:a,token$:r};return t.refresh&&(o.refresh=t.refresh),t.validate&&(o.validate=t.validate),t.onAuthFailed&&(o.onAuthFailed=t.onAuthFailed),t.onError&&(o.onError=t.onError),new e(o)}static async signInHttp(t){let n=typeof t.baseUrl==`string`?Yn(t.baseUrl):t.baseUrl,r=new Et(null),i=new rc({baseUrl:n,token$:r}),a=new Ic(i,new ic(i),i),o;try{o=await a.auth.password(t.email,t.password)}catch(e){throw a.dispose(),e}Gc(t.storage,t.kb.id,{access:o.token,refresh:o.refreshToken}),r.next(Gn(o.token));let s={kb:t.kb,storage:t.storage,client:a,token$:r,refresh:async()=>{let e=Wc(t.storage,t.kb.id);if(!e)return null;try{return(await a.auth.refresh(e.refresh)).access_token}catch{return null}}};t.validate&&(s.validate=t.validate),t.onAuthFailed&&(s.onAuthFailed=t.onAuthFailed),t.onError&&(s.onError=t.onError);let c=new e(s);return await c.ready,c}},ol=class{sessionExpiredAt$;sessionExpiredMessage$;permissionDeniedAt$;permissionDeniedMessage$;constructor(){this.sessionExpiredAt$=new Et(null),this.sessionExpiredMessage$=new Et(null),this.permissionDeniedAt$=new Et(null),this.permissionDeniedMessage$=new Et(null)}notifySessionExpired(e){this.sessionExpiredMessage$.next(e??`Your session has expired. Please sign in again.`),this.sessionExpiredAt$.next(Date.now())}notifyPermissionDenied(e){this.permissionDeniedMessage$.next(e??`You do not have permission to perform this action.`),this.permissionDeniedAt$.next(Date.now())}acknowledgeSessionExpired(){this.sessionExpiredAt$.next(null),this.sessionExpiredMessage$.next(null)}acknowledgePermissionDenied(){this.permissionDeniedAt$.next(null),this.permissionDeniedMessage$.next(null)}dispose(){this.sessionExpiredAt$.complete(),this.sessionExpiredMessage$.complete(),this.permissionDeniedAt$.complete(),this.permissionDeniedMessage$.complete()}};function sl(e){return[...e].sort((e,t)=>e.order!==void 0&&t.order!==void 0?e.order-t.order:e.openedAt-t.openedAt)}function cl(e){try{let t=e.get(Bc);if(t)return JSON.parse(t)}catch{}return{}}function ll(e){try{let t=e.get(Vc);if(t)return JSON.parse(t)}catch{}return{}}var ul=class{kbs$;activeKbId$;activeSession$;activeSignals$;sessionActivating$;openResources$;lastViewedResource$;error$;identityToken$;storage;sessionFactory;eventBus=new cr;unsubscribeStorage=null;disposed=!1;activating=null;openByKb={};lastViewedByKb={};constructor(e){this.storage=e.storage,this.sessionFactory=e.sessionFactory;let t=Xc(this.storage),n=this.storage.get(zc),r=n&&t.some(e=>e.id===n)?n:t[0]?.id??null;this.kbs$=new Et(t),this.activeKbId$=new Et(r),this.activeSession$=new Et(null),this.activeSignals$=new Et(null),this.sessionActivating$=new Et(!1),this.openByKb=cl(this.storage),this.openResources$=new Et([]),this.lastViewedByKb=ll(this.storage),this.lastViewedResource$=new Et(null),this.error$=new wt,this.identityToken$=new Et(null),this.kbs$.subscribe(e=>Zc(this.storage,e)),this.activeKbId$.subscribe(e=>{e?this.storage.set(zc,e):this.storage.delete(zc)}),this.activeSession$.subscribe(()=>{this.refreshOpenResources(),this.refreshLastViewedResource()}),this.unsubscribeStorage=this.storage.subscribe?.((e,t)=>{if(t)try{e===`semiont.openResourcesByKb`?(this.openByKb=JSON.parse(t),this.refreshOpenResources()):e===`semiont.lastViewedResourceByKb`&&(this.lastViewedByKb=JSON.parse(t),this.refreshLastViewedResource())}catch{}})??null,r&&this.setActiveKb(r)}emit(e,t){this.disposed||this.eventBus.get(e).next(t)}on(e,t){let n=this.eventBus.get(e).subscribe(t);return()=>n.unsubscribe()}stream(e){return this.eventBus.get(e).asObservable()}setIdentityToken(e){this.disposed||this.identityToken$.next(e)}addKb(e,t,n){let r={id:nl(),...e};return Gc(this.storage,r.id,{access:t,refresh:n}),this.kbs$.next([...this.kbs$.getValue(),r]),this.setActiveKb(r.id),r}removeKb(e){if(Kc(this.storage,e),this.openByKb[e]){let t={...this.openByKb};delete t[e],this.openByKb=t,this.persistOpenResources()}if(this.lastViewedByKb[e]){let t={...this.lastViewedByKb};delete t[e],this.lastViewedByKb=t,this.storage.set(Vc,JSON.stringify(this.lastViewedByKb))}let t=this.kbs$.getValue().filter(t=>t.id!==e);this.kbs$.next(t),this.activeKbId$.getValue()===e&&this.setActiveKb(t[0]?.id??null)}updateKb(e,t){this.kbs$.next(this.kbs$.getValue().map(n=>n.id===e?{...n,...t}:n))}getKbSessionStatus(e){let t=Wc(this.storage,e);return t?Jc(t.access)?`expired`:`authenticated`:`signed-out`}async setActiveKb(e){if(this.disposed)return;let t=this.activeKbId$.getValue(),n=this.activeSession$.getValue();if(e===t&&n)return;for(t!==e&&this.activeKbId$.next(e),n&&(this.activeSession$.next(null),this.activeSignals$.next(null));this.activating;)if(await this.activating,this.disposed||this.activeKbId$.getValue()!==e)return;let r=(async()=>{let t=this.activeSession$.getValue(),n=this.activeSignals$.getValue();if(t&&(this.activeSession$.next(null),this.activeSignals$.next(null),await t.dispose(),n?.dispose()),!e)return;let r=this.kbs$.getValue().find(t=>t.id===e);if(!r)return;let i=new ol,a;try{a=this.sessionFactory({kb:r,storage:this.storage,signals:i,onError:e=>this.error$.next(e)})}catch(t){this.error$.next(t instanceof rl?t:new rl(`session.construct-failed`,t instanceof Error?t.message:String(t),e)),i.dispose();return}a.errors$.subscribe(e=>{e.code===`unauthorized`?i.notifySessionExpired(e.message):e.code===`forbidden`&&i.notifyPermissionDenied(e.message)});try{await a.ready}catch(t){this.error$.next(new rl(`session.construct-failed`,t instanceof Error?t.message:String(t),e)),await a.dispose(),i.dispose();return}if(this.disposed||this.activeKbId$.getValue()!==e){await a.dispose(),i.dispose();return}this.activeSession$.next(a),this.activeSignals$.next(i)})();this.activating=r,this.sessionActivating$.next(!0);try{await r}finally{this.activating===r&&(this.activating=null,this.sessionActivating$.next(!1))}}async signIn(e,t,n){if(!this.disposed){if(Gc(this.storage,e,{access:t,refresh:n}),this.activeKbId$.getValue()===e){let t=this.activeSession$.getValue(),n=this.activeSignals$.getValue();this.activeSession$.next(null),this.activeSignals$.next(null),t&&await t.dispose(),n?.dispose(),await this.setActiveKb(e);return}await this.setActiveKb(e)}}async signOut(e){if(!this.disposed&&(Kc(this.storage,e),this.kbs$.next([...this.kbs$.getValue()]),this.activeKbId$.getValue()===e)){let e=this.activeSession$.getValue(),t=this.activeSignals$.getValue();this.activeSession$.next(null),this.activeSignals$.next(null),e&&await e.dispose(),t?.dispose()}}refreshOpenResources(){let e=this.activeKbId$.getValue(),t=this.activeSession$.getValue(),n=e&&t?sl(this.openByKb[e]??[]):[];this.openResources$.next(n)}persistOpenResources(){this.storage.set(Bc,JSON.stringify(this.openByKb))}mutateOpenResources(e){let t=this.activeKbId$.getValue();!t||!this.activeSession$.getValue()||(this.openByKb={...this.openByKb,[t]:e(this.openByKb[t]??[])},this.persistOpenResources(),this.refreshOpenResources())}addOpenResource(e,t,n,r){this.mutateOpenResources(i=>{let a=i.findIndex(t=>t.id===e);if(a>=0){let e={...i[a],name:t,...n===void 0?{}:{mediaType:n},...r===void 0?{}:{storageUri:r}},o=[...i];return o[a]=e,o}return[...i,{id:e,name:t,openedAt:Date.now(),order:i.reduce((e,t)=>Math.max(e,t.order??-1),-1)+1,...n===void 0?{}:{mediaType:n},...r===void 0?{}:{storageUri:r}}]})}removeOpenResource(e){this.mutateOpenResources(t=>t.filter(t=>t.id!==e))}updateOpenResourceName(e,t){this.mutateOpenResources(n=>n.map(n=>n.id===e?{...n,name:t}:n))}reorderOpenResources(e,t){this.mutateOpenResources(n=>{let r=sl(n);if(e<0||e>=r.length||t<0||t>=r.length)return n;let[i]=r.splice(e,1);return i&&r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}refreshLastViewedResource(){let e=this.activeKbId$.getValue(),t=this.activeSession$.getValue();this.lastViewedResource$.next(e&&t?this.lastViewedByKb[e]??null:null)}setLastViewedResource(e){let t=this.activeKbId$.getValue();!t||!this.activeSession$.getValue()||this.lastViewedByKb[t]!==e&&(this.lastViewedByKb={...this.lastViewedByKb,[t]:e},this.storage.set(Vc,JSON.stringify(this.lastViewedByKb)),this.refreshLastViewedResource())}async dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribeStorage&&=(this.unsubscribeStorage(),null);let e=this.activeSession$.getValue(),t=this.activeSignals$.getValue();this.activeSession$.next(null),this.activeSignals$.next(null),e&&await e.dispose(),t?.dispose(),this.kbs$.complete(),this.activeKbId$.complete(),this.activeSession$.complete(),this.activeSignals$.complete(),this.openResources$.complete(),this.lastViewedResource$.complete(),this.error$.complete(),this.identityToken$.complete(),this.eventBus.destroy()}};function dl(){let e=new Map;return t=>{let{kb:n,storage:r,signals:i,onError:a}=t;if(n.endpoint.kind!==`http`)throw new rl(`session.construct-failed`,`HTTP session factory cannot construct a session for endpoint kind "${n.endpoint.kind}"`,n.id);let o=n.endpoint,s=async()=>{let t=e.get(n.id);if(t)return t;let i=(async()=>{let e=Wc(r,n.id);if(!e)return null;let t=new rc({baseUrl:Yn(tl(o))}),i=new Ic(t,new ic(t),t);try{let t=(await i.auth.refresh(e.refresh)).access_token;return t?(Gc(r,n.id,{access:t,refresh:e.refresh}),t):null}catch{return null}finally{i.dispose()}})();e.set(n.id,i);try{return await i}finally{e.delete(n.id)}},c=async e=>{let t=new Et(e),n=new rc({baseUrl:Yn(tl(o)),token$:t}),r=new Ic(n,new ic(n),n);try{return await r.auth.me()}finally{r.dispose(),t.complete()}},l=new Et(null),u,d=mc(r,`semiont.lastEventId.${n.id}`),f=new rc({baseUrl:Yn(tl(o)),token$:l,tokenRefresher:()=>u.refresh().then(e=>e??null),loadLastEventIds:d.loadLastEventIds,saveLastEventId:d.saveLastEventId}),p=new Ic(f,new ic(f),f,{cachePersistence:{storage:d.storage,keyPrefix:n.id}});return d.setFlushGate(()=>p.browse.persistenceSettled()),u=new al({kb:n,storage:r,client:p,token$:l,refresh:s,validate:c,onAuthFailed:e=>i.notifySessionExpired(e),onError:a}),u}}var fl=null;function pl(e){return fl||=new ul({storage:e.storage,sessionFactory:e.sessionFactory}),fl}function ml(){let e=new He;return{add:t=>e.add(typeof t==`function`?t:()=>t.dispose()),dispose:()=>e.unsubscribe()}}function hl(e,t={}){let n=t.debounceMs??250,r=t.initialQuery??``,i=new wt;return{query$:i.pipe(Bn(r)),state$:i.pipe(Bn(r),Mn(n),Fn(),Vn(t=>{let n=t.trim();return n?e(n).pipe(Cn(e=>({results:e??[],isSearching:e===void 0})),Bn({results:[],isSearching:!0})):mn({results:[],isSearching:!1})})),setQuery:e=>i.next(e),dispose:()=>i.complete()}}function gl(e){let t=[],n=new Et(null);return t.push(e.bus.get(`beckon:hover`).subscribe(({annotationId:t})=>{n.next(t),t&&e.bus.get(`beckon:sparkle`).next({annotationId:t})})),t.push(e.bus.get(`browse:click`).subscribe(({annotationId:t})=>{e.bus.get(`beckon:focus`).next({annotationId:t})})),{hoveredAnnotationId$:n.asObservable(),hover:t=>e.bus.get(`beckon:hover`).next({annotationId:t}),focus:t=>e.bus.get(`beckon:focus`).next({annotationId:t}),sparkle:t=>e.bus.get(`beckon:sparkle`).next({annotationId:t}),dispose(){t.forEach(e=>e.unsubscribe()),n.complete()}}}function _l(e,t){let n=null,r=null,i=()=>{r!==null&&(clearTimeout(r),r=null)};return{handleMouseEnter:a=>{n!==a&&(i(),r=setTimeout(()=>{r=null,n=a,e(a)},t))},handleMouseLeave:()=>{i(),n!==null&&(n=null,e(null))},cleanup:i}}function vl(e,t){let n=[],r=new Et(null),i=new Et(!1),a=new Et(null),o=new Et(null),s=new Et(null),c=new Et(!1),l=new Et(null),u=!1;return n.push(e.bus.get(`gather:requested`).subscribe(s=>{i.next(!0),a.next(null),r.next(null),o.next(dr(s.annotationId));let c=e.gather.annotation(t,dr(s.annotationId),{contextWindow:s.options?.contextWindow??2e3}).pipe(xn(6e4)).subscribe({next:e=>{`response`in e&&e.response&&(r.next(e.response??null),i.next(!1))},error:e=>{a.next(e instanceof Error?e:Error(String(e))),i.next(!1)},complete:()=>{i.next(!1)}});n.push(c)})),{context$:r.asObservable(),loading$:i.asObservable(),error$:a.asObservable(),annotationId$:o.asObservable(),resourceContext$:s.asObservable(),resourceLoading$:c.asObservable(),resourceError$:l.asObservable(),gatherResource:(t,n)=>{c.next(!0),l.next(null),s.next(null),e.gather.resource(t,n).then(e=>{u||(s.next(e),c.next(!1))}).catch(e=>{u||(l.next(e instanceof Error?e:Error(String(e))),c.next(!1))})},dispose(){u=!0,n.forEach(e=>e.unsubscribe()),r.complete(),i.complete(),a.complete(),o.complete(),s.complete(),c.complete(),l.complete()}}}function yl(e,t){let n=[];return n.push(e.bus.get(`match:search-requested`).subscribe(t=>{let r=e.match.search(ur(t.resourceId),dr(t.referenceId),t.context,{limit:t.limit,useSemanticScoring:t.useSemanticScoring}).pipe(xn(6e4)).subscribe({next:t=>e.bus.get(`match:search-results`).next(t),error:n=>e.bus.get(`match:search-failed`).next({correlationId:t.correlationId,referenceId:t.referenceId,error:n instanceof Error?n.message:String(n)})});n.push(r)})),{dispose(){n.forEach(e=>e.unsubscribe())}}}function bl(e,t){let n=[],r=new Et(!1),i=new Et(null),a=new Et(null),o=e=>{let t=e.subscribe({next:e=>{e.kind===`progress`&&(i.next(e.data),r.next(!0)),e.kind===`complete`&&e.data.result?.kind===`generation`&&a.next({resourceId:ur(e.data.result.resourceId),resourceName:e.data.result.resourceName,truncated:e.data.result.truncated})},complete:()=>{r.next(!1)},error:()=>{i.next(null),r.next(!1)}});n.push(t)};return{isGenerating$:r.asObservable(),progress$:i.asObservable(),outcome$:a.asObservable(),generate:(n,r)=>{a.next(null),o(e.yield.fromContext(n,{...r,language:r.language||t}))},dismissProgress(){i.next(null),a.next(null)},dispose(){n.forEach(e=>e.unsubscribe()),r.complete(),i.complete(),a.complete()}}}var xl=18e4;function Sl(e){if(e.svgSelector)return{type:`SvgSelector`,value:e.svgSelector};if(e.fragmentSelector){let t=[{type:`FragmentSelector`,value:e.fragmentSelector,...e.conformsTo&&{conformsTo:e.conformsTo}}];return e.exact&&t.push({type:`TextQuoteSelector`,exact:e.exact,...e.prefix&&{prefix:e.prefix},...e.suffix&&{suffix:e.suffix}}),t}return{type:`TextQuoteSelector`,exact:e.exact,...e.prefix&&{prefix:e.prefix},...e.suffix&&{suffix:e.suffix}}}function Cl(e,t){let n=[],r=new Et(null),i=new Et(null),a=new Et(null),o=e=>{r.next(e)};return n.push(e.bus.get(`mark:requested`).subscribe(e=>{e.source===t&&o({selector:e.selector,motivation:e.motivation})})),n.push(e.bus.get(`mark:select-comment`).subscribe(e=>o({selector:Sl(e),motivation:`commenting`}))),n.push(e.bus.get(`mark:select-tag`).subscribe(e=>o({selector:Sl(e),motivation:`tagging`}))),n.push(e.bus.get(`mark:select-assessment`).subscribe(e=>o({selector:Sl(e),motivation:`assessing`}))),n.push(e.bus.get(`mark:select-reference`).subscribe(e=>o({selector:Sl(e),motivation:`linking`}))),n.push(e.bus.get(`mark:cancel-pending`).subscribe(()=>r.next(null))),n.push(e.bus.get(`mark:create-ok`).subscribe(()=>r.next(null))),n.push(e.bus.get(`mark:submit`).subscribe(async n=>{if(n.source===t)try{let r=await e.mark.annotation({motivation:n.motivation,target:{source:t,selector:n.selector},body:n.body});e.bus.get(`mark:create-ok`).next({response:{annotationId:r.annotationId}})}catch(n){e.bus.get(`mark:create-error`).next({resourceId:t,message:n instanceof Error?n.message:String(n)})}})),n.push(e.bus.get(`mark:delete`).subscribe(async n=>{try{await e.mark.delete(t,n.annotationId),e.bus.get(`mark:delete-ok`).next({response:{annotationId:n.annotationId}})}catch(n){e.bus.get(`mark:delete-error`).next({resourceId:t,message:n instanceof Error?n.message:String(n)})}})),n.push(e.bus.get(`mark:assist-request`).subscribe(r=>{i.next(r.motivation),a.next(null);let o=null,s=()=>{o&&=(clearTimeout(o),null)},c=()=>{s(),o=setTimeout(()=>{o=null;let n=a.getValue();a.next({...n??{},percentage:n?.percentage??0}),e.bus.get(`mark:assist-timeout`).next({resourceId:t,motivation:r.motivation})},xl)};c();let l=e.mark.assist(t,r.motivation,r.options).subscribe({next:e=>{c(),e.kind===`progress`&&a.next(e.data)},complete:()=>{s(),i.next(null)},error:()=>{s(),i.next(null),a.next(null)}});n.push(l)})),n.push(e.bus.get(`mark:progress-dismiss`).subscribe(()=>{a.next(null)})),{pendingAnnotation$:r.asObservable(),assistingMotivation$:i.asObservable(),progress$:a.asObservable(),dispose(){n.forEach(e=>e.unsubscribe()),r.complete(),i.complete(),a.complete()}}}var wl=(e,t)=>t===void 0?{kind:`absent`,reason:e}:{kind:`absent`,reason:e,diagnostic:t},Tl=e=>e instanceof Error?e.message:String(e);function El(e){let t;try{t=JSON.parse(e)}catch(e){return wl(`not-json`,Tl(e))}if(!Ri(t))return wl(`invalid`,`document is not an object`);if(!Li(t.version))return wl(`invalid`,`missing numeric "version"`);if(t.version!==1)return wl(`unsupported-version`,`discovery document version ${t.version} is newer than this client speaks (1) \u2014 refusing to partially parse`);if(!zi(t.kbs))return wl(`invalid`,`missing "kbs" array`);let n=[];for(let e of t.kbs){if(!Ri(e))return wl(`invalid`,`kb entry is not an object`);let{host:t,port:r,placement:i,managedBy:a,repo:o,did:s,siteName:c}=e;if(!Ii(t)||!Ii(a)||!Li(r)||!Number.isInteger(r)||r<=0||r>65535)return wl(`invalid`,`kb entry missing required host/port/managedBy (port must be an integer 1-65535)`);if(i!==`local`&&i!==`codespace`)return wl(`invalid`,`kb entry has unknown placement ${JSON.stringify(i)}`);if(o!==void 0&&!Ii(o))return wl(`invalid`,`kb "repo" must be a string`);if(c!==void 0&&!Ii(c))return wl(`invalid`,`kb "siteName" must be a string`);if(!Ii(s))return wl(`invalid`,`kb entry has no "did" — identity is required; this document was likely written by a launcher predating that rule`);n.push({host:t,port:r,placement:i,managedBy:a,did:s,...o===void 0?{}:{repo:o},...c===void 0?{}:{siteName:c}})}return{kind:`managed`,kbs:n}}function Dl(e=Vi){let t=null;return{async read(){let n;try{n=await fetch(e,t===null?void 0:{headers:{"If-None-Match":t}})}catch(e){return wl(`unreadable`,Tl(e))}if(n.status===304)return{kind:`unchanged`};if(!n.ok)return wl(`not-found`,`HTTP ${n.status}`);let r=n.headers.get(`Content-Type`)??``;if(!r.toLowerCase().includes(`json`))return wl(`not-found`,`non-JSON content-type "${r}" \u2014 SPA fallback (frontend image without the discovery mount?)`);let i=El(await n.text());return i.kind===`managed`&&(t=n.headers.get(`ETag`)),i}}}var Ol=e=>`${e.host}:${e.port}`,kl=(e,t)=>e.host===t.host&&e.port===t.port&&e.placement===t.placement&&e.managedBy===t.managedBy&&e.repo===t.repo&&e.did===t.did&&e.siteName===t.siteName;function Al(e,t){let n=t?.intervalMs??5e3;return new ht(t=>{let r=!1,i=!1,a=null,o=async()=>{if(!(r||i)){i=!0;try{let n=await e.read();if(r||n.kind===`unchanged`)return;let i=a!==null&&a.kind===`managed`?a.kbs:[],o=n.kind===`managed`?n.kbs:[],s=new Map(i.map(e=>[Ol(e),e])),c=new Map(o.map(e=>[Ol(e),e]));if(c.size!==o.length){let e=new Set,t=[...new Set(o.map(Ol).filter(t=>e.size===e.add(t).size))];console.warn(`[discovery DUPLICATE] ${o.length-c.size} entr${o.length-c.size===1?`y`:`ies`} share a merge key (${t.join(`, `)}); at most one claim can be true. Diff membership collapses them \u2014 render every claimant from state.kbs rather than trusting added/removed for these.`)}let l=o.filter(e=>!s.has(Ol(e))),u=i.filter(e=>!c.has(Ol(e))),d=o.filter(e=>{let t=s.get(Ol(e));return t!==void 0&&!kl(t,e)});(a===null||a.kind!==n.kind||a.kind===`absent`&&n.kind===`absent`&&a.reason!==n.reason||l.length>0||d.length>0||u.length>0)&&(a=n,t.next({state:n,added:l,updated:d,removed:u}))}finally{i=!1}}};o();let s=setInterval(()=>{o()},n);return()=>{r=!0,clearInterval(s)}})}var jl=f(),Ml=L({"../../node_modules/rxjs/dist/cjs/internal/util/isFunction.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0;function t(e){return typeof e==`function`}e.isFunction=t}}),Nl=L({"../../node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createErrorClass=void 0;function t(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}e.createErrorClass=t}}),Pl=L({"../../node_modules/rxjs/dist/cjs/internal/util/UnsubscriptionError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UnsubscriptionError=void 0,e.UnsubscriptionError=Nl().createErrorClass(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
8
8
  `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(`
9
- `):``,this.name=`UnsubscriptionError`,this.errors=t}})}}),Fl=L({"../../node_modules/rxjs/dist/cjs/internal/util/arrRemove.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.arrRemove=void 0;function t(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}e.arrRemove=t}}),Il=L({"../../node_modules/rxjs/dist/cjs/internal/Subscription.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},n=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},r=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.isSubscription=e.EMPTY_SUBSCRIPTION=e.Subscription=void 0;var i=Ml(),a=Pl(),o=Fl(),s=(function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,o,s,c,u;if(!this.closed){this.closed=!0;var d=this._parentage;if(d){if(this._parentage=null,Array.isArray(d))try{for(var f=t(d),p=f.next();!p.done;p=f.next())p.value.remove(this)}catch(t){e={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(e)throw e.error}}else d.remove(this)}var m=this.initialTeardown;if(i.isFunction(m))try{m()}catch(e){u=e instanceof a.UnsubscriptionError?e.errors:[e]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var g=t(h),_=g.next();!_.done;_=g.next()){var v=_.value;try{l(v)}catch(e){u??=[],e instanceof a.UnsubscriptionError?u=r(r([],n(u)),n(e.errors)):u.push(e)}}}catch(e){s={error:e}}finally{try{_&&!_.done&&(c=g.return)&&c.call(g)}finally{if(s)throw s.error}}}if(u)throw new a.UnsubscriptionError(u)}},e.prototype.add=function(t){if(t&&t!==this){if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&o.arrRemove(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&o.arrRemove(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();e.Subscription=s,e.EMPTY_SUBSCRIPTION=s.EMPTY;function c(e){return e instanceof s||e&&`closed`in e&&i.isFunction(e.remove)&&i.isFunction(e.add)&&i.isFunction(e.unsubscribe)}e.isSubscription=c;function l(e){i.isFunction(e)?e():e.unsubscribe()}}}),Ll=L({"../../node_modules/rxjs/dist/cjs/internal/config.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.config=void 0,e.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}}}),Rl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/timeoutProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutProvider=void 0,e.timeoutProvider={setTimeout:function(r,i){var a=[...arguments].slice(2),o=e.timeoutProvider.delegate;return o?.setTimeout?o.setTimeout.apply(o,n([r,i],t(a))):setTimeout.apply(void 0,n([r,i],t(a)))},clearTimeout:function(t){return(e.timeoutProvider.delegate?.clearTimeout||clearTimeout)(t)},delegate:void 0}}}),zl=L({"../../node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportUnhandledError=void 0;var t=Ll(),n=Rl();function r(e){n.timeoutProvider.setTimeout(function(){var n=t.config.onUnhandledError;if(n)n(e);else throw e})}e.reportUnhandledError=r}}),Bl=L({"../../node_modules/rxjs/dist/cjs/internal/util/noop.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.noop=void 0;function t(){}e.noop=t}}),Vl=L({"../../node_modules/rxjs/dist/cjs/internal/NotificationFactories.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createNotification=e.nextNotification=e.errorNotification=e.COMPLETE_NOTIFICATION=void 0,e.COMPLETE_NOTIFICATION=(function(){return r(`C`,void 0,void 0)})();function t(e){return r(`E`,void 0,e)}e.errorNotification=t;function n(e){return r(`N`,e,void 0)}e.nextNotification=n;function r(e,t,n){return{kind:e,value:t,error:n}}e.createNotification=r}}),Hl=L({"../../node_modules/rxjs/dist/cjs/internal/util/errorContext.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.captureError=e.errorContext=void 0;var t=Ll(),n=null;function r(e){if(t.config.useDeprecatedSynchronousErrorHandling){var r=!n;if(r&&(n={errorThrown:!1,error:null}),e(),r){var i=n,a=i.errorThrown,o=i.error;if(n=null,a)throw o}}else e()}e.errorContext=r;function i(e){t.config.useDeprecatedSynchronousErrorHandling&&n&&(n.errorThrown=!0,n.error=e)}e.captureError=i}}),Ul=L({"../../node_modules/rxjs/dist/cjs/internal/Subscriber.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_OBSERVER=e.SafeSubscriber=e.Subscriber=void 0;var n=Ml(),r=Il(),i=Ll(),a=zl(),o=Bl(),s=Vl(),c=Rl(),l=Hl(),u=(function(n){t(i,n);function i(t){var i=n.call(this)||this;return i.isStopped=!1,t?(i.destination=t,r.isSubscription(t)&&t.add(i)):i.destination=e.EMPTY_OBSERVER,i}return i.create=function(e,t,n){return new m(e,t,n)},i.prototype.next=function(e){this.isStopped?_(s.nextNotification(e),this):this._next(e)},i.prototype.error=function(e){this.isStopped?_(s.errorNotification(e),this):(this.isStopped=!0,this._error(e))},i.prototype.complete=function(){this.isStopped?_(s.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},i.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},i.prototype._next=function(e){this.destination.next(e)},i.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},i.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},i})(r.Subscription);e.Subscriber=u;var d=Function.prototype.bind;function f(e,t){return d.call(e,t)}var p=(function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){h(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){h(e)}else h(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){h(e)}},e})(),m=(function(e){t(r,e);function r(t,r,a){var o=e.call(this)||this,s;if(n.isFunction(t)||!t)s={next:t??void 0,error:r??void 0,complete:a??void 0};else{var c;o&&i.config.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&f(t.next,c),error:t.error&&f(t.error,c),complete:t.complete&&f(t.complete,c)}):s=t}return o.destination=new p(s),o}return r})(u);e.SafeSubscriber=m;function h(e){i.config.useDeprecatedSynchronousErrorHandling?l.captureError(e):a.reportUnhandledError(e)}function g(e){throw e}function _(e,t){var n=i.config.onStoppedNotification;n&&c.timeoutProvider.setTimeout(function(){return n(e,t)})}e.EMPTY_OBSERVER={closed:!0,next:o.noop,error:g,complete:o.noop}}}),Wl=L({"../../node_modules/rxjs/dist/cjs/internal/symbol/observable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observable=void 0,e.observable=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})()}}),Gl=L({"../../node_modules/rxjs/dist/cjs/internal/util/identity.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.identity=void 0;function t(e){return e}e.identity=t}}),Kl=L({"../../node_modules/rxjs/dist/cjs/internal/util/pipe.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pipeFromArray=e.pipe=void 0;var t=Gl();function n(){return r([...arguments])}e.pipe=n;function r(e){return e.length===0?t.identity:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}e.pipeFromArray=r}}),ql=L({"../../node_modules/rxjs/dist/cjs/internal/Observable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var t=Ul(),n=Il(),r=Wl(),i=Kl(),a=Ll(),o=Ml(),s=Hl();e.Observable=(function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,n,r){var i=this,a=u(e)?e:new t.SafeSubscriber(e,n,r);return s.errorContext(function(){var e=i,t=e.operator,n=e.source;a.add(t?t.call(a,n):n?i._subscribe(a):i._trySubscribe(a))}),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,n){var r=this;return n=c(n),new n(function(n,i){var a=new t.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),a.unsubscribe()}},error:i,complete:n});r.subscribe(a)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[r.observable]=function(){return this},e.prototype.pipe=function(){var e=[...arguments];return i.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return e=c(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e})();function c(e){return e??a.config.Promise??Promise}function l(e){return e&&o.isFunction(e.next)&&o.isFunction(e.error)&&o.isFunction(e.complete)}function u(e){return e&&e instanceof t.Subscriber||l(e)&&n.isSubscription(e)}}}),R=L({"../../node_modules/rxjs/dist/cjs/internal/util/lift.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.operate=e.hasLift=void 0;var t=Ml();function n(e){return t.isFunction(e?.lift)}e.hasLift=n;function r(e){return function(t){if(n(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}e.operate=r}}),z=L({"../../node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.OperatorSubscriber=e.createOperatorSubscriber=void 0;var n=Ul();function r(e,t,n,r,a){return new i(e,t,n,r,a)}e.createOperatorSubscriber=r;var i=(function(e){t(n,e);function n(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},n})(n.Subscriber);e.OperatorSubscriber=i}}),Jl=L({"../../node_modules/rxjs/dist/cjs/internal/operators/refCount.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.refCount=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){var r=null;e._refCount++;var i=n.createOperatorSubscriber(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount){r=null;return}var n=e._connection,i=r;r=null,n&&(!i||n===i)&&n.unsubscribe(),t.unsubscribe()});e.subscribe(i),i.closed||(r=e.connect())})}e.refCount=r}}),Yl=L({"../../node_modules/rxjs/dist/cjs/internal/observable/ConnectableObservable.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectableObservable=void 0;var n=ql(),r=Il(),i=Jl(),a=z(),o=R();e.ConnectableObservable=(function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,o.hasLift(t)&&(r.lift=t.lift),r}return n.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},n.prototype.getSubject=function(){var e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject},n.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,e?.unsubscribe()},n.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new r.Subscription;var n=this.getSubject();t.add(this.source.subscribe(a.createOperatorSubscriber(n,void 0,function(){e._teardown(),n.complete()},function(t){e._teardown(),n.error(t)},function(){return e._teardown()}))),t.closed&&(this._connection=null,t=r.Subscription.EMPTY)}return t},n.prototype.refCount=function(){return i.refCount()(this)},n})(n.Observable)}}),Xl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/performanceTimestampProvider.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.performanceTimestampProvider=void 0,e.performanceTimestampProvider={now:function(){return(e.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}}}),Zl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrameProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrameProvider=void 0;var r=Il();e.animationFrameProvider={schedule:function(t){var n=requestAnimationFrame,i=cancelAnimationFrame,a=e.animationFrameProvider.delegate;a&&(n=a.requestAnimationFrame,i=a.cancelAnimationFrame);var o=n(function(e){i=void 0,t(e)});return new r.Subscription(function(){return i?.(o)})},requestAnimationFrame:function(){var r=[...arguments];return(e.animationFrameProvider.delegate?.requestAnimationFrame||requestAnimationFrame).apply(void 0,n([],t(r)))},cancelAnimationFrame:function(){var r=[...arguments];return(e.animationFrameProvider.delegate?.cancelAnimationFrame||cancelAnimationFrame).apply(void 0,n([],t(r)))},delegate:void 0}}}),Ql=L({"../../node_modules/rxjs/dist/cjs/internal/observable/dom/animationFrames.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrames=void 0;var t=ql(),n=Xl(),r=Zl();function i(e){return e?a(e):o}e.animationFrames=i;function a(e){return new t.Observable(function(t){var i=e||n.performanceTimestampProvider,a=i.now(),o=0,s=function(){t.closed||(o=r.animationFrameProvider.requestAnimationFrame(function(n){o=0;var r=i.now();t.next({timestamp:e?r:n,elapsed:r-a}),s()}))};return s(),function(){o&&r.animationFrameProvider.cancelAnimationFrame(o)}})}var o=a()}}),$l=L({"../../node_modules/rxjs/dist/cjs/internal/util/ObjectUnsubscribedError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectUnsubscribedError=void 0,e.ObjectUnsubscribedError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}})}}),eu=L({"../../node_modules/rxjs/dist/cjs/internal/Subject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),n=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.AnonymousSubject=e.Subject=void 0;var r=ql(),i=Il(),a=$l(),o=Fl(),s=Hl(),c=(function(e){t(c,e);function c(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return c.prototype.lift=function(e){var t=new l(this,this);return t.operator=e,t},c.prototype._throwIfClosed=function(){if(this.closed)throw new a.ObjectUnsubscribedError},c.prototype.next=function(e){var t=this;s.errorContext(function(){var r,i;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var a=n(t.currentObservers),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}})},c.prototype.error=function(e){var t=this;s.errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},c.prototype.complete=function(){var e=this;s.errorContext(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},c.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(c.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),c.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},c.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},c.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,a=n.isStopped,s=n.observers;return r||a?i.EMPTY_SUBSCRIPTION:(this.currentObservers=null,s.push(e),new i.Subscription(function(){t.currentObservers=null,o.arrRemove(s,e)}))},c.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},c.prototype.asObservable=function(){var e=new r.Observable;return e.source=this,e},c.create=function(e,t){return new l(e,t)},c})(r.Observable);e.Subject=c;var l=(function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},n.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},n.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},n.prototype._subscribe=function(e){return this.source?.subscribe(e)??i.EMPTY_SUBSCRIPTION},n})(c);e.AnonymousSubject=l}}),tu=L({"../../node_modules/rxjs/dist/cjs/internal/BehaviorSubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.BehaviorSubject=void 0,e.BehaviorSubject=(function(e){t(n,e);function n(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},n})(eu().Subject)}}),nu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/dateTimestampProvider.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dateTimestampProvider=void 0,e.dateTimestampProvider={now:function(){return(e.dateTimestampProvider.delegate||Date).now()},delegate:void 0}}}),ru=L({"../../node_modules/rxjs/dist/cjs/internal/ReplaySubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.ReplaySubject=void 0;var n=eu(),r=nu();e.ReplaySubject=(function(e){t(n,e);function n(t,n,i){t===void 0&&(t=1/0),n===void 0&&(n=1/0),i===void 0&&(i=r.dateTimestampProvider);var a=e.call(this)||this;return a._bufferSize=t,a._windowTime=n,a._timestampProvider=i,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,t),a._windowTime=Math.max(1,n),a}return n.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,o=n._timestampProvider,s=n._windowTime;r||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this,r=n._infiniteTimeWindow,i=n._buffer.slice(),a=0;a<i.length&&!e.closed;a+=r?1:2)e.next(i[a]);return this._checkFinalizedStatuses(e),t},n.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<r.length&&r.splice(0,r.length-a),!i){for(var o=n.now(),s=0,c=1;c<r.length&&r[c]<=o;c+=2)s=c;s&&r.splice(0,s+1)}},n})(n.Subject)}}),iu=L({"../../node_modules/rxjs/dist/cjs/internal/AsyncSubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncSubject=void 0,e.AsyncSubject=(function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t._hasValue,i=t._value,a=t.thrownError,o=t.isStopped,s=t._isComplete;n?e.error(a):(o||s)&&(r&&e.next(i),e.complete())},n.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},n.prototype.complete=function(){var t=this,n=t._hasValue,r=t._value;t._isComplete||(this._isComplete=!0,n&&e.prototype.next.call(this,r),e.prototype.complete.call(this))},n})(eu().Subject)}}),au=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/Action.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.Action=void 0,e.Action=(function(e){t(n,e);function n(t,n){return e.call(this)||this}return n.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},n})(Il().Subscription)}}),ou=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/intervalProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.intervalProvider=void 0,e.intervalProvider={setInterval:function(r,i){var a=[...arguments].slice(2),o=e.intervalProvider.delegate;return o?.setInterval?o.setInterval.apply(o,n([r,i],t(a))):setInterval.apply(void 0,n([r,i],t(a)))},clearInterval:function(t){return(e.intervalProvider.delegate?.clearInterval||clearInterval)(t)},delegate:void 0}}}),su=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncAction=void 0;var n=au(),r=ou(),i=Fl();e.AsyncAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),r.intervalProvider.setInterval(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&r.intervalProvider.clearInterval(t)},n.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},n.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,a=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,i.arrRemove(a,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n})(n.Action)}}),cu=L({"../../node_modules/rxjs/dist/cjs/internal/util/Immediate.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TestTools=e.Immediate=void 0;var t=1,n,r={};function i(e){return e in r&&(delete r[e],!0)}e.Immediate={setImmediate:function(e){var a=t++;return r[a]=!0,n||=Promise.resolve(),n.then(function(){return i(a)&&e()}),a},clearImmediate:function(e){i(e)}},e.TestTools={pending:function(){return Object.keys(r).length}}}}),lu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/immediateProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.immediateProvider=void 0;var r=cu(),i=r.Immediate.setImmediate,a=r.Immediate.clearImmediate;e.immediateProvider={setImmediate:function(){var r=[...arguments];return(e.immediateProvider.delegate?.setImmediate||i).apply(void 0,n([],t(r)))},clearImmediate:function(t){return(e.immediateProvider.delegate?.clearImmediate||a)(t)},delegate:void 0}}}),uu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsapAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsapAction=void 0;var n=su(),r=lu();e.AsapAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||=r.immediateProvider.setImmediate(t.flush.bind(t,void 0)))},n.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i==null?this.delay>0:i>0)return e.prototype.recycleAsyncId.call(this,t,n,i);var a=t.actions;n!=null&&a[a.length-1]?.id!==n&&(r.immediateProvider.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},n})(n.AsyncAction)}}),du=L({"../../node_modules/rxjs/dist/cjs/internal/Scheduler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Scheduler=void 0;var t=nu();e.Scheduler=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=t.dateTimestampProvider.now,e})()}}),fu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsyncScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncScheduler=void 0;var n=du();e.AsyncScheduler=(function(e){t(r,e);function r(t,r){r===void 0&&(r=n.Scheduler.now);var i=e.call(this,t,r)||this;return i.actions=[],i._active=!1,i}return r.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},r})(n.Scheduler)}}),pu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsapScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsapScheduler=void 0,e.AsapScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n=this.actions,r;e||=n.shift();do if(r=e.execute(e.state,e.delay))break;while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},n})(fu().AsyncScheduler)}}),mu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/asap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.asap=e.asapScheduler=void 0;var t=uu();e.asapScheduler=new(pu()).AsapScheduler(t.AsapAction),e.asap=e.asapScheduler}}),hu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/async.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.async=e.asyncScheduler=void 0;var t=su();e.asyncScheduler=new(fu()).AsyncScheduler(t.AsyncAction),e.async=e.asyncScheduler}}),gu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/QueueAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.QueueAction=void 0,e.QueueAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.schedule=function(t,n){return n===void 0&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},n.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},n.prototype.requestAsyncId=function(t,n,r){return r===void 0&&(r=0),r!=null&&r>0||r==null&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},n})(su().AsyncAction)}}),_u=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/QueueScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.QueueScheduler=void 0,e.QueueScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n})(fu().AsyncScheduler)}}),vu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/queue.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.queue=e.queueScheduler=void 0;var t=gu();e.queueScheduler=new(_u()).QueueScheduler(t.QueueAction),e.queue=e.queueScheduler}}),yu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AnimationFrameAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationFrameAction=void 0;var n=su(),r=Zl();e.AnimationFrameAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||=r.animationFrameProvider.requestAnimationFrame(function(){return t.flush(void 0)}))},n.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i==null?this.delay>0:i>0)return e.prototype.recycleAsyncId.call(this,t,n,i);var a=t.actions;n!=null&&n===t._scheduled&&a[a.length-1]?.id!==n&&(r.animationFrameProvider.cancelAnimationFrame(n),t._scheduled=void 0)},n})(n.AsyncAction)}}),bu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AnimationFrameScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationFrameScheduler=void 0,e.AnimationFrameScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n.prototype.flush=function(e){this._active=!0;var t;e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n=this.actions,r;e||=n.shift();do if(r=e.execute(e.state,e.delay))break;while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},n})(fu().AsyncScheduler)}}),xu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrame.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrame=e.animationFrameScheduler=void 0;var t=yu();e.animationFrameScheduler=new(bu()).AnimationFrameScheduler(t.AnimationFrameAction),e.animationFrame=e.animationFrameScheduler}}),Su=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/VirtualTimeScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.VirtualAction=e.VirtualTimeScheduler=void 0;var n=su(),r=Il();e.VirtualTimeScheduler=(function(e){t(n,e);function n(t,n){t===void 0&&(t=i),n===void 0&&(n=1/0);var r=e.call(this,t,function(){return r.frame})||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return n.prototype.flush=function(){for(var e=this,t=e.actions,n=e.maxFrames,r,i;(i=t[0])&&i.delay<=n&&(t.shift(),this.frame=i.delay,!(r=i.execute(i.state,i.delay))););if(r){for(;i=t.shift();)i.unsubscribe();throw r}},n.frameTimeFactor=10,n})(fu().AsyncScheduler);var i=(function(e){t(n,e);function n(t,n,r){r===void 0&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return n.prototype.schedule=function(t,i){if(i===void 0&&(i=0),Number.isFinite(i)){if(!this.id)return e.prototype.schedule.call(this,t,i);this.active=!1;var a=new n(this.scheduler,this.work);return this.add(a),a.schedule(t,i)}return r.Subscription.EMPTY},n.prototype.requestAsyncId=function(e,t,r){r===void 0&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,n){n===void 0&&(n=0)},n.prototype._execute=function(t,n){if(this.active===!0)return e.prototype._execute.call(this,t,n)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},n})(n.AsyncAction);e.VirtualAction=i}}),Cu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/empty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.empty=e.EMPTY=void 0;var t=ql();e.EMPTY=new t.Observable(function(e){return e.complete()});function n(t){return t?r(t):e.EMPTY}e.empty=n;function r(e){return new t.Observable(function(t){return e.schedule(function(){return t.complete()})})}}}),wu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isScheduler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isScheduler=void 0;var t=Ml();function n(e){return e&&t.isFunction(e.schedule)}e.isScheduler=n}}),Tu=L({"../../node_modules/rxjs/dist/cjs/internal/util/args.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.popNumber=e.popScheduler=e.popResultSelector=void 0;var t=Ml(),n=wu();function r(e){return e[e.length-1]}function i(e){return t.isFunction(r(e))?e.pop():void 0}e.popResultSelector=i;function a(e){return n.isScheduler(r(e))?e.pop():void 0}e.popScheduler=a;function o(e,t){return typeof r(e)==`number`?e.pop():t}e.popNumber=o}}),Eu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isArrayLike.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isArrayLike=void 0,e.isArrayLike=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`})}}),Du=L({"../../node_modules/rxjs/dist/cjs/internal/util/isPromise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isPromise=void 0;var t=Ml();function n(e){return t.isFunction(e?.then)}e.isPromise=n}}),Ou=L({"../../node_modules/rxjs/dist/cjs/internal/util/isInteropObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isInteropObservable=void 0;var t=Wl(),n=Ml();function r(e){return n.isFunction(e[t.observable])}e.isInteropObservable=r}}),ku=L({"../../node_modules/rxjs/dist/cjs/internal/util/isAsyncIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isAsyncIterable=void 0;var t=Ml();function n(e){return Symbol.asyncIterator&&t.isFunction(e?.[Symbol.asyncIterator])}e.isAsyncIterable=n}}),Au=L({"../../node_modules/rxjs/dist/cjs/internal/util/throwUnobservableError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createInvalidObservableTypeError=void 0;function t(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}e.createInvalidObservableTypeError=t}}),ju=L({"../../node_modules/rxjs/dist/cjs/internal/symbol/iterator.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.iterator=e.getSymbolIterator=void 0;function t(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}e.getSymbolIterator=t,e.iterator=t()}}),Mu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isIterable=void 0;var t=ju(),n=Ml();function r(e){return n.isFunction(e?.[t.iterator])}e.isIterable=r}}),Nu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isReadableStreamLike.js"(e){var t=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=e&&e.__await||function(e){return this instanceof n?(this.v=e,this):new n(e)},r=e&&e.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var i=r.apply(e,t||[]),a,o=[];return a={},s(`next`),s(`throw`),s(`return`),a[Symbol.asyncIterator]=function(){return this},a;function s(e){i[e]&&(a[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||c(e,t)})})}function c(e,t){try{l(i[e](t))}catch(e){f(o[0][3],e)}}function l(e){e.value instanceof n?Promise.resolve(e.value.v).then(u,d):f(o[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}};Object.defineProperty(e,"__esModule",{value:!0}),e.isReadableStreamLike=e.readableStreamLikeToAsyncGenerator=void 0;var i=Ml();function a(e){return r(this,arguments,function(){var r,i,a,o;return t(this,function(t){switch(t.label){case 0:r=e.getReader(),t.label=1;case 1:t.trys.push([1,,9,10]),t.label=2;case 2:return[4,n(r.read())];case 3:return i=t.sent(),a=i.value,o=i.done,o?[4,n(void 0)]:[3,5];case 4:return[2,t.sent()];case 5:return[4,n(a)];case 6:return[4,t.sent()];case 7:return t.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}e.readableStreamLikeToAsyncGenerator=a;function o(e){return i.isFunction(e?.getReader)}e.isReadableStreamLike=o}}),B=L({"../../node_modules/rxjs/dist/cjs/internal/observable/innerFrom.js"(e){var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},r=e&&e.__asyncValues||function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof i==`function`?i(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),a(r,i,n.done,n.value)})}}function a(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},i=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.fromReadableStreamLike=e.fromAsyncIterable=e.fromIterable=e.fromPromise=e.fromArrayLike=e.fromInteropObservable=e.innerFrom=void 0;var a=Eu(),o=Du(),s=ql(),c=Ou(),l=ku(),u=Au(),d=Mu(),f=Nu(),p=Ml(),m=zl(),h=Wl();function g(e){if(e instanceof s.Observable)return e;if(e!=null){if(c.isInteropObservable(e))return _(e);if(a.isArrayLike(e))return v(e);if(o.isPromise(e))return y(e);if(l.isAsyncIterable(e))return x(e);if(d.isIterable(e))return b(e);if(f.isReadableStreamLike(e))return S(e)}throw u.createInvalidObservableTypeError(e)}e.innerFrom=g;function _(e){return new s.Observable(function(t){var n=e[h.observable]();if(p.isFunction(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}e.fromInteropObservable=_;function v(e){return new s.Observable(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}e.fromArrayLike=v;function y(e){return new s.Observable(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,m.reportUnhandledError)})}e.fromPromise=y;function b(e){return new s.Observable(function(t){var n,r;try{for(var a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}t.complete()})}e.fromIterable=b;function x(e){return new s.Observable(function(t){C(e,t).catch(function(e){return t.error(e)})})}e.fromAsyncIterable=x;function S(e){return x(f.readableStreamLikeToAsyncGenerator(e))}e.fromReadableStreamLike=S;function C(e,i){var a,o,s,c;return t(this,void 0,void 0,function(){var t,l;return n(this,function(n){switch(n.label){case 0:n.trys.push([0,5,6,11]),a=r(e),n.label=1;case 1:return[4,a.next()];case 2:if(o=n.sent(),o.done)return[3,4];if(t=o.value,i.next(t),i.closed)return[2];n.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=n.sent(),s={error:l},[3,11];case 6:return n.trys.push([6,,9,10]),o&&!o.done&&(c=a.return)?[4,c.call(a)]:[3,8];case 7:n.sent(),n.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return i.complete(),[2]}})})}}}),Pu=L({"../../node_modules/rxjs/dist/cjs/internal/util/executeSchedule.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.executeSchedule=void 0;function t(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}e.executeSchedule=t}}),Fu=L({"../../node_modules/rxjs/dist/cjs/internal/operators/observeOn.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observeOn=void 0;var t=Pu(),n=R(),r=z();function i(e,i){return i===void 0&&(i=0),n.operate(function(n,a){n.subscribe(r.createOperatorSubscriber(a,function(n){return t.executeSchedule(a,e,function(){return a.next(n)},i)},function(){return t.executeSchedule(a,e,function(){return a.complete()},i)},function(n){return t.executeSchedule(a,e,function(){return a.error(n)},i)}))})}e.observeOn=i}}),Iu=L({"../../node_modules/rxjs/dist/cjs/internal/operators/subscribeOn.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.subscribeOn=void 0;var t=R();function n(e,n){return n===void 0&&(n=0),t.operate(function(t,r){r.add(e.schedule(function(){return t.subscribe(r)},n))})}e.subscribeOn=n}}),Lu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleObservable=void 0;var t=B(),n=Fu(),r=Iu();function i(e,i){return t.innerFrom(e).pipe(r.subscribeOn(i),n.observeOn(i))}e.scheduleObservable=i}}),Ru=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/schedulePromise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.schedulePromise=void 0;var t=B(),n=Fu(),r=Iu();function i(e,i){return t.innerFrom(e).pipe(r.subscribeOn(i),n.observeOn(i))}e.schedulePromise=i}}),zu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleArray=void 0;var t=ql();function n(e,n){return new t.Observable(function(t){var r=0;return n.schedule(function(){r===e.length?t.complete():(t.next(e[r++]),t.closed||this.schedule())})})}e.scheduleArray=n}}),Bu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleIterable=void 0;var t=ql(),n=ju(),r=Ml(),i=Pu();function a(e,a){return new t.Observable(function(t){var o;return i.executeSchedule(t,a,function(){o=e[n.iterator](),i.executeSchedule(t,a,function(){var e,n,r;try{e=o.next(),n=e.value,r=e.done}catch(e){t.error(e);return}r?t.complete():t.next(n)},0,!0)}),function(){return r.isFunction(o?.return)&&o.return()}})}e.scheduleIterable=a}}),Vu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleAsyncIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleAsyncIterable=void 0;var t=ql(),n=Pu();function r(e,r){if(!e)throw Error(`Iterable cannot be null`);return new t.Observable(function(t){n.executeSchedule(t,r,function(){var i=e[Symbol.asyncIterator]();n.executeSchedule(t,r,function(){i.next().then(function(e){e.done?t.complete():t.next(e.value)})},0,!0)})})}e.scheduleAsyncIterable=r}}),Hu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleReadableStreamLike.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleReadableStreamLike=void 0;var t=Vu(),n=Nu();function r(e,r){return t.scheduleAsyncIterable(n.readableStreamLikeToAsyncGenerator(e),r)}e.scheduleReadableStreamLike=r}}),Uu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduled.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduled=void 0;var t=Lu(),n=Ru(),r=zu(),i=Bu(),a=Vu(),o=Ou(),s=Du(),c=Eu(),l=Mu(),u=ku(),d=Au(),f=Nu(),p=Hu();function m(e,m){if(e!=null){if(o.isInteropObservable(e))return t.scheduleObservable(e,m);if(c.isArrayLike(e))return r.scheduleArray(e,m);if(s.isPromise(e))return n.schedulePromise(e,m);if(u.isAsyncIterable(e))return a.scheduleAsyncIterable(e,m);if(l.isIterable(e))return i.scheduleIterable(e,m);if(f.isReadableStreamLike(e))return p.scheduleReadableStreamLike(e,m)}throw d.createInvalidObservableTypeError(e)}e.scheduled=m}}),Wu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/from.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.from=void 0;var t=Uu(),n=B();function r(e,r){return r?t.scheduled(e,r):n.innerFrom(e)}e.from=r}}),Gu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/of.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.of=void 0;var t=Tu(),n=Wu();function r(){var e=[...arguments],r=t.popScheduler(e);return n.from(e,r)}e.of=r}}),Ku=L({"../../node_modules/rxjs/dist/cjs/internal/observable/throwError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throwError=void 0;var t=ql(),n=Ml();function r(e,r){var i=n.isFunction(e)?e:function(){return e},a=function(e){return e.error(i())};return new t.Observable(r?function(e){return r.schedule(a,0,e)}:a)}e.throwError=r}}),qu=L({"../../node_modules/rxjs/dist/cjs/internal/Notification.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observeNotification=e.Notification=e.NotificationKind=void 0;var t=Cu(),n=Gu(),r=Ku(),i=Ml();(function(e){e.NEXT=`N`,e.ERROR=`E`,e.COMPLETE=`C`})(e.NotificationKind||={}),e.Notification=(function(){function e(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue=e===`N`}return e.prototype.observe=function(e){return a(this,e)},e.prototype.do=function(e,t,n){var r=this,i=r.kind,a=r.value,o=r.error;return i===`N`?e?.(a):i===`E`?t?.(o):n?.()},e.prototype.accept=function(e,t,n){return i.isFunction(e?.next)?this.observe(e):this.do(e,t,n)},e.prototype.toObservable=function(){var e=this,i=e.kind,a=e.value,o=e.error,s=i===`N`?n.of(a):i===`E`?r.throwError(function(){return o}):i===`C`?t.EMPTY:0;if(!s)throw TypeError(`Unexpected notification kind `+i);return s},e.createNext=function(t){return new e(`N`,t)},e.createError=function(t){return new e(`E`,void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e(`C`),e})();function a(e,t){var n,r,i,a=e,o=a.kind,s=a.value,c=a.error;if(typeof o!=`string`)throw TypeError(`Invalid notification, missing "kind"`);o===`N`?(n=t.next)==null||n.call(t,s):o===`E`?(r=t.error)==null||r.call(t,c):(i=t.complete)==null||i.call(t)}e.observeNotification=a}}),Ju=L({"../../node_modules/rxjs/dist/cjs/internal/util/isObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObservable=void 0;var t=ql(),n=Ml();function r(e){return!!e&&(e instanceof t.Observable||n.isFunction(e.lift)&&n.isFunction(e.subscribe))}e.isObservable=r}}),Yu=L({"../../node_modules/rxjs/dist/cjs/internal/util/EmptyError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyError=void 0,e.EmptyError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}})}}),Xu=L({"../../node_modules/rxjs/dist/cjs/internal/lastValueFrom.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.lastValueFrom=void 0;var t=Yu();function n(e,n){var r=typeof n==`object`;return new Promise(function(i,a){var o=!1,s;e.subscribe({next:function(e){s=e,o=!0},error:a,complete:function(){o?i(s):r?i(n.defaultValue):a(new t.EmptyError)}})})}e.lastValueFrom=n}}),Zu=L({"../../node_modules/rxjs/dist/cjs/internal/firstValueFrom.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.firstValueFrom=void 0;var t=Yu(),n=Ul();function r(e,r){var i=typeof r==`object`;return new Promise(function(a,o){var s=new n.SafeSubscriber({next:function(e){a(e),s.unsubscribe()},error:o,complete:function(){i?a(r.defaultValue):o(new t.EmptyError)}});e.subscribe(s)})}e.firstValueFrom=r}}),Qu=L({"../../node_modules/rxjs/dist/cjs/internal/util/ArgumentOutOfRangeError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ArgumentOutOfRangeError=void 0,e.ArgumentOutOfRangeError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`ArgumentOutOfRangeError`,this.message=`argument out of range`}})}}),$u=L({"../../node_modules/rxjs/dist/cjs/internal/util/NotFoundError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NotFoundError=void 0,e.NotFoundError=Nl().createErrorClass(function(e){return function(t){e(this),this.name=`NotFoundError`,this.message=t}})}}),ed=L({"../../node_modules/rxjs/dist/cjs/internal/util/SequenceError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SequenceError=void 0,e.SequenceError=Nl().createErrorClass(function(e){return function(t){e(this),this.name=`SequenceError`,this.message=t}})}}),td=L({"../../node_modules/rxjs/dist/cjs/internal/util/isDate.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isValidDate=void 0;function t(e){return e instanceof Date&&!isNaN(e)}e.isValidDate=t}}),nd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeout.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeout=e.TimeoutError=void 0;var t=hu(),n=td(),r=R(),i=B(),a=Nl(),o=z(),s=Pu();e.TimeoutError=a.createErrorClass(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function c(e,a){var c=n.isValidDate(e)?{first:e}:typeof e==`number`?{each:e}:e,u=c.first,d=c.each,f=c.with,p=f===void 0?l:f,m=c.scheduler,h=m===void 0?a??t.asyncScheduler:m,g=c.meta,_=g===void 0?null:g;if(u==null&&d==null)throw TypeError(`No timeout provided.`);return r.operate(function(e,t){var n,r,a=null,c=0,l=function(e){r=s.executeSchedule(t,h,function(){try{n.unsubscribe(),i.innerFrom(p({meta:_,lastValue:a,seen:c})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe(o.createOperatorSubscriber(t,function(e){r?.unsubscribe(),c++,t.next(a=e),d>0&&l(d)},void 0,void 0,function(){r?.closed||r?.unsubscribe(),a=null})),!c&&l(u==null?d:typeof u==`number`?u:+u-h.now())})}e.timeout=c;function l(t){throw new e.TimeoutError(t)}}}),rd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/map.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.map=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){i.next(e.call(r,t,a++))}))})}e.map=r}}),id=L({"../../node_modules/rxjs/dist/cjs/internal/util/mapOneOrManyArgs.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.mapOneOrManyArgs=void 0;var r=rd(),i=Array.isArray;function a(e,r){return i(r)?e.apply(void 0,n([],t(r))):e(r)}function o(e){return r.map(function(t){return a(e,t)})}e.mapOneOrManyArgs=o}}),ad=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindCallbackInternals.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.bindCallbackInternals=void 0;var r=wu(),i=ql(),a=Iu(),o=id(),s=Fu(),c=iu();function l(e,u,d,f){if(d){if(r.isScheduler(d))f=d;else return function(){var t=[...arguments];return l(e,u,f).apply(this,t).pipe(o.mapOneOrManyArgs(d))}}return f?function(){var t=[...arguments];return l(e,u).apply(this,t).pipe(a.subscribeOn(f),s.observeOn(f))}:function(){for(var r=this,a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];var s=new c.AsyncSubject,l=!0;return new i.Observable(function(i){var o=s.subscribe(i);if(l){l=!1;var c=!1,d=!1;u.apply(r,n(n([],t(a)),[function(){var t=[...arguments];if(e){var n=t.shift();if(n!=null){s.error(n);return}}s.next(1<t.length?t:t[0]),d=!0,c&&s.complete()}])),d&&s.complete(),c=!0}return o})}}e.bindCallbackInternals=l}}),od=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindCallback.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindCallback=void 0;var t=ad();function n(e,n,r){return t.bindCallbackInternals(!1,e,n,r)}e.bindCallback=n}}),sd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindNodeCallback.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindNodeCallback=void 0;var t=ad();function n(e,n,r){return t.bindCallbackInternals(!0,e,n,r)}e.bindNodeCallback=n}}),cd=L({"../../node_modules/rxjs/dist/cjs/internal/util/argsArgArrayOrObject.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.argsArgArrayOrObject=void 0;var t=Array.isArray,n=Object.getPrototypeOf,r=Object.prototype,i=Object.keys;function a(e){if(e.length===1){var n=e[0];if(t(n))return{args:n,keys:null};if(o(n)){var r=i(n);return{args:r.map(function(e){return n[e]}),keys:r}}}return{args:e,keys:null}}e.argsArgArrayOrObject=a;function o(e){return e&&typeof e==`object`&&n(e)===r}}}),ld=L({"../../node_modules/rxjs/dist/cjs/internal/util/createObject.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createObject=void 0;function t(e,t){return e.reduce(function(e,n,r){return e[n]=t[r],e},{})}e.createObject=t}}),ud=L({"../../node_modules/rxjs/dist/cjs/internal/observable/combineLatest.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestInit=e.combineLatest=void 0;var t=ql(),n=cd(),r=Wu(),i=Gl(),a=id(),o=Tu(),s=ld(),c=z(),l=Pu();function u(){var e=[...arguments],c=o.popScheduler(e),l=o.popResultSelector(e),u=n.argsArgArrayOrObject(e),f=u.args,p=u.keys;if(f.length===0)return r.from([],c);var m=new t.Observable(d(f,c,p?function(e){return s.createObject(p,e)}:i.identity));return l?m.pipe(a.mapOneOrManyArgs(l)):m}e.combineLatest=u;function d(e,t,n){return n===void 0&&(n=i.identity),function(i){f(t,function(){for(var a=e.length,o=Array(a),s=a,l=a,u=function(a){f(t,function(){var u=r.from(e[a],t),d=!1;u.subscribe(c.createOperatorSubscriber(i,function(e){o[a]=e,d||(d=!0,l--),l||i.next(n(o.slice()))},function(){--s||i.complete()}))},i)},d=0;d<a;d++)u(d)},i)}}e.combineLatestInit=d;function f(e,t,n){e?l.executeSchedule(n,e,t):t()}}}),dd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeInternals=void 0;var t=B(),n=Pu(),r=z();function i(e,i,a,o,s,c,l,u){var d=[],f=0,p=0,m=!1,h=function(){m&&!d.length&&!f&&i.complete()},g=function(e){return f<o?_(e):d.push(e)},_=function(e){c&&i.next(e),f++;var u=!1;t.innerFrom(a(e,p++)).subscribe(r.createOperatorSubscriber(i,function(e){s?.(e),c?g(e):i.next(e)},function(){u=!0},void 0,function(){if(u)try{f--;for(var e=function(){var e=d.shift();l?n.executeSchedule(i,l,function(){return _(e)}):_(e)};d.length&&f<o;)e();h()}catch(e){i.error(e)}}))};return e.subscribe(r.createOperatorSubscriber(i,g,function(){m=!0,h()})),function(){u?.()}}e.mergeInternals=i}}),fd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeMap=void 0;var t=rd(),n=B(),r=R(),i=dd(),a=Ml();function o(e,s,c){return c===void 0&&(c=1/0),a.isFunction(s)?o(function(r,i){return t.map(function(e,t){return s(r,e,i,t)})(n.innerFrom(e(r,i)))},c):(typeof s==`number`&&(c=s),r.operate(function(t,n){return i.mergeInternals(t,n,e,c)}))}e.mergeMap=o}}),pd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeAll=void 0;var t=fd(),n=Gl();function r(e){return e===void 0&&(e=1/0),t.mergeMap(n.identity,e)}e.mergeAll=r}}),md=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatAll=void 0;var t=pd();function n(){return t.mergeAll(1)}e.concatAll=n}}),hd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/concat.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concat=void 0;var t=md(),n=Tu(),r=Wu();function i(){var e=[...arguments];return t.concatAll()(r.from(e,n.popScheduler(e)))}e.concat=i}}),gd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/defer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defer=void 0;var t=ql(),n=B();function r(e){return new t.Observable(function(t){n.innerFrom(e()).subscribe(t)})}e.defer=r}}),_d=L({"../../node_modules/rxjs/dist/cjs/internal/observable/connectable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.connectable=void 0;var t=eu(),n=ql(),r=gd(),i={connector:function(){return new t.Subject},resetOnDisconnect:!0};function a(e,t){t===void 0&&(t=i);var a=null,o=t.connector,s=t.resetOnDisconnect,c=s===void 0||s,l=o(),u=new n.Observable(function(e){return l.subscribe(e)});return u.connect=function(){return(!a||a.closed)&&(a=r.defer(function(){return e}).subscribe(l),c&&a.add(function(){return l=o()})),a},u}e.connectable=a}}),vd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.forkJoin=void 0;var t=ql(),n=cd(),r=B(),i=Tu(),a=z(),o=id(),s=ld();function c(){var e=[...arguments],c=i.popResultSelector(e),l=n.argsArgArrayOrObject(e),u=l.args,d=l.keys,f=new t.Observable(function(e){var t=u.length;if(!t){e.complete();return}for(var n=Array(t),i=t,o=t,c=function(t){var c=!1;r.innerFrom(u[t]).subscribe(a.createOperatorSubscriber(e,function(e){c||(c=!0,o--),n[t]=e},function(){return i--},void 0,function(){(!i||!c)&&(o||e.next(d?s.createObject(d,n):n),e.complete())}))},l=0;l<t;l++)c(l)});return c?f.pipe(o.mapOneOrManyArgs(c)):f}e.forkJoin=c}}),yd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromEvent.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.fromEvent=void 0;var n=B(),r=ql(),i=fd(),a=Eu(),o=Ml(),s=id(),c=[`addListener`,`removeListener`],l=[`addEventListener`,`removeEventListener`],u=[`on`,`off`];function d(e,g,_,v){if(o.isFunction(_)&&(v=_,_=void 0),v)return d(e,g,_).pipe(s.mapOneOrManyArgs(v));var y=t(h(e)?l.map(function(t){return function(n){return e[t](g,n,_)}}):p(e)?c.map(f(e,g)):m(e)?u.map(f(e,g)):[],2),b=y[0],x=y[1];if(!b&&a.isArrayLike(e))return i.mergeMap(function(e){return d(e,g,_)})(n.innerFrom(e));if(!b)throw TypeError(`Invalid event target`);return new r.Observable(function(e){var t=function(){var t=[...arguments];return e.next(1<t.length?t:t[0])};return b(t),function(){return x(t)}})}e.fromEvent=d;function f(e,t){return function(n){return function(r){return e[n](t,r)}}}function p(e){return o.isFunction(e.addListener)&&o.isFunction(e.removeListener)}function m(e){return o.isFunction(e.on)&&o.isFunction(e.off)}function h(e){return o.isFunction(e.addEventListener)&&o.isFunction(e.removeEventListener)}}}),bd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromEventPattern.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromEventPattern=void 0;var t=ql(),n=Ml(),r=id();function i(e,a,o){return o?i(e,a).pipe(r.mapOneOrManyArgs(o)):new t.Observable(function(t){var r=function(){var e=[...arguments];return t.next(e.length===1?e[0]:e)},i=e(r);return n.isFunction(a)?function(){return a(r,i)}:void 0})}e.fromEventPattern=i}}),xd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/generate.js"(e){var t=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.generate=void 0;var n=Gl(),r=wu(),i=gd(),a=Bu();function o(e,o,s,c,l){var u,d,f,p;arguments.length===1?(u=e,p=u.initialState,o=u.condition,s=u.iterate,d=u.resultSelector,f=d===void 0?n.identity:d,l=u.scheduler):(p=e,!c||r.isScheduler(c)?(f=n.identity,l=c):f=c);function m(){var e;return t(this,function(t){switch(t.label){case 0:e=p,t.label=1;case 1:return!o||o(e)?[4,f(e)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e=s(e),[3,1];case 4:return[2]}})}return i.defer(l?function(){return a.scheduleIterable(m(),l)}:m)}e.generate=o}}),Sd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/iif.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.iif=void 0;var t=gd();function n(e,n,r){return t.defer(function(){return e()?n:r})}e.iif=n}}),Cd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/timer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timer=void 0;var t=ql(),n=hu(),r=wu(),i=td();function a(e,a,o){e===void 0&&(e=0),o===void 0&&(o=n.async);var s=-1;return a!=null&&(r.isScheduler(a)?o=a:s=a),new t.Observable(function(t){var n=i.isValidDate(e)?+e-o.now():e;n<0&&(n=0);var r=0;return o.schedule(function(){t.closed||(t.next(r++),0<=s?this.schedule(void 0,s):t.complete())},n)})}e.timer=a}}),wd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/interval.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.interval=void 0;var t=hu(),n=Cd();function r(e,r){return e===void 0&&(e=0),r===void 0&&(r=t.asyncScheduler),e<0&&(e=0),n.timer(e,e,r)}e.interval=r}}),Td=L({"../../node_modules/rxjs/dist/cjs/internal/observable/merge.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.merge=void 0;var t=pd(),n=B(),r=Cu(),i=Tu(),a=Wu();function o(){var e=[...arguments],o=i.popScheduler(e),s=i.popNumber(e,1/0),c=e;return c.length?c.length===1?n.innerFrom(c[0]):t.mergeAll(s)(a.from(c,o)):r.EMPTY}e.merge=o}}),Ed=L({"../../node_modules/rxjs/dist/cjs/internal/observable/never.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.never=e.NEVER=void 0;var t=ql(),n=Bl();e.NEVER=new t.Observable(n.noop);function r(){return e.NEVER}e.never=r}}),Dd=L({"../../node_modules/rxjs/dist/cjs/internal/util/argsOrArgArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.argsOrArgArray=void 0;var t=Array.isArray;function n(e){return e.length===1&&t(e[0])?e[0]:e}e.argsOrArgArray=n}}),Od=L({"../../node_modules/rxjs/dist/cjs/internal/observable/onErrorResumeNext.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.onErrorResumeNext=void 0;var t=ql(),n=Dd(),r=z(),i=Bl(),a=B();function o(){var e=[...arguments],o=n.argsOrArgArray(e);return new t.Observable(function(e){var t=0,n=function(){if(t<o.length){var s=void 0;try{s=a.innerFrom(o[t++])}catch{n();return}var c=new r.OperatorSubscriber(e,void 0,i.noop,i.noop);s.subscribe(c),c.add(n)}else e.complete()};n()})}e.onErrorResumeNext=o}}),kd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/pairs.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pairs=void 0;var t=Wu();function n(e,n){return t.from(Object.entries(e),n)}e.pairs=n}}),Ad=L({"../../node_modules/rxjs/dist/cjs/internal/util/not.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.not=void 0;function t(e,t){return function(n,r){return!e.call(t,n,r)}}e.not=t}}),jd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/filter.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.filter=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){return e.call(r,t,a++)&&i.next(t)}))})}e.filter=r}}),Md=L({"../../node_modules/rxjs/dist/cjs/internal/observable/partition.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.partition=void 0;var t=Ad(),n=jd(),r=B();function i(e,i,a){return[n.filter(i,a)(r.innerFrom(e)),n.filter(t.not(i,a))(r.innerFrom(e))]}e.partition=i}}),Nd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/race.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.raceInit=e.race=void 0;var t=ql(),n=B(),r=Dd(),i=z();function a(){var e=[...arguments];return e=r.argsOrArgArray(e),e.length===1?n.innerFrom(e[0]):new t.Observable(o(e))}e.race=a;function o(e){return function(t){for(var r=[],a=function(a){r.push(n.innerFrom(e[a]).subscribe(i.createOperatorSubscriber(t,function(e){if(r){for(var n=0;n<r.length;n++)n!==a&&r[n].unsubscribe();r=null}t.next(e)})))},o=0;r&&!t.closed&&o<e.length;o++)a(o)}}e.raceInit=o}}),Pd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/range.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0;var t=ql(),n=Cu();function r(e,r,i){if(r??(r=e,e=0),r<=0)return n.EMPTY;var a=r+e;return new t.Observable(i?function(t){var n=e;return i.schedule(function(){n<a?(t.next(n++),this.schedule()):t.complete()})}:function(t){for(var n=e;n<a&&!t.closed;)t.next(n++);t.complete()})}e.range=r}}),Fd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/using.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.using=void 0;var t=ql(),n=B(),r=Cu();function i(e,i){return new t.Observable(function(t){var a=e(),o=i(a);return(o?n.innerFrom(o):r.EMPTY).subscribe(t),function(){a&&a.unsubscribe()}})}e.using=i}}),Id=L({"../../node_modules/rxjs/dist/cjs/internal/observable/zip.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zip=void 0;var r=ql(),i=B(),a=Dd(),o=Cu(),s=z(),c=Tu();function l(){var e=[...arguments],l=c.popResultSelector(e),u=a.argsOrArgArray(e);return u.length?new r.Observable(function(e){var r=u.map(function(){return[]}),a=u.map(function(){return!1});e.add(function(){r=a=null});for(var o=function(o){i.innerFrom(u[o]).subscribe(s.createOperatorSubscriber(e,function(i){if(r[o].push(i),r.every(function(e){return e.length})){var s=r.map(function(e){return e.shift()});e.next(l?l.apply(void 0,n([],t(s))):s),r.some(function(e,t){return!e.length&&a[t]})&&e.complete()}},function(){a[o]=!0,!r[o].length&&e.complete()}))},c=0;!e.closed&&c<u.length;c++)o(c);return function(){r=a=null}}):o.EMPTY}e.zip=l}}),Ld=L({"../../node_modules/rxjs/dist/cjs/internal/types.js"(e){Object.defineProperty(e,"__esModule",{value:!0})}}),Rd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/audit.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.audit=void 0;var t=R(),n=B(),r=z();function i(e){return t.operate(function(t,i){var a=!1,o=null,s=null,c=!1,l=function(){if(s?.unsubscribe(),s=null,a){a=!1;var e=o;o=null,i.next(e)}c&&i.complete()},u=function(){s=null,c&&i.complete()};t.subscribe(r.createOperatorSubscriber(i,function(t){a=!0,o=t,s||n.innerFrom(e(t)).subscribe(s=r.createOperatorSubscriber(i,l,u))},function(){c=!0,(!a||!s||s.closed)&&i.complete()}))})}e.audit=i}}),zd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/auditTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.auditTime=void 0;var t=hu(),n=Rd(),r=Cd();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.audit(function(){return r.timer(e,i)})}e.auditTime=i}}),Bd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/buffer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buffer=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=[];return t.subscribe(r.createOperatorSubscriber(a,function(e){return o.push(e)},function(){a.next(o),a.complete()})),i.innerFrom(e).subscribe(r.createOperatorSubscriber(a,function(){var e=o;o=[],a.next(e)},n.noop)),function(){o=null}})}e.buffer=a}}),Vd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferCount.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferCount=void 0;var n=R(),r=z(),i=Fl();function a(e,a){return a===void 0&&(a=null),a??=e,n.operate(function(n,o){var s=[],c=0;n.subscribe(r.createOperatorSubscriber(o,function(n){var r,l,u,d,f=null;c++%a===0&&s.push([]);try{for(var p=t(s),m=p.next();!m.done;m=p.next()){var h=m.value;h.push(n),e<=h.length&&(f??=[],f.push(h))}}catch(e){r={error:e}}finally{try{m&&!m.done&&(l=p.return)&&l.call(p)}finally{if(r)throw r.error}}if(f)try{for(var g=t(f),_=g.next();!_.done;_=g.next()){var h=_.value;i.arrRemove(s,h),o.next(h)}}catch(e){u={error:e}}finally{try{_&&!_.done&&(d=g.return)&&d.call(g)}finally{if(u)throw u.error}}},function(){var e,n;try{for(var r=t(s),i=r.next();!i.done;i=r.next()){var a=i.value;o.next(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}o.complete()},void 0,function(){s=null}))})}e.bufferCount=a}}),Hd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferTime.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferTime=void 0;var n=Il(),r=R(),i=z(),a=Fl(),o=hu(),s=Tu(),c=Pu();function l(e){var l=[...arguments].slice(1),u=s.popScheduler(l)??o.asyncScheduler,d=l[0]??null,f=l[1]||1/0;return r.operate(function(r,o){var s=[],l=!1,p=function(e){var t=e.buffer;e.subs.unsubscribe(),a.arrRemove(s,e),o.next(t),l&&m()},m=function(){if(s){var t=new n.Subscription;o.add(t);var r={buffer:[],subs:t};s.push(r),c.executeSchedule(t,u,function(){return p(r)},e)}};d!==null&&d>=0?c.executeSchedule(o,u,m,d,!0):l=!0,m();var h=i.createOperatorSubscriber(o,function(e){var n,r,i=s.slice();try{for(var a=t(i),o=a.next();!o.done;o=a.next()){var c=o.value,l=c.buffer;l.push(e),f<=l.length&&p(c)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},function(){for(;s?.length;)o.next(s.shift().buffer);h?.unsubscribe(),o.complete(),o.unsubscribe()},void 0,function(){return s=null});r.subscribe(h)})}e.bufferTime=l}}),Ud=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferToggle.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferToggle=void 0;var n=Il(),r=R(),i=B(),a=z(),o=Bl(),s=Fl();function c(e,c){return r.operate(function(r,l){var u=[];i.innerFrom(e).subscribe(a.createOperatorSubscriber(l,function(e){var t=[];u.push(t);var r=new n.Subscription;r.add(i.innerFrom(c(e)).subscribe(a.createOperatorSubscriber(l,function(){s.arrRemove(u,t),l.next(t),r.unsubscribe()},o.noop)))},o.noop)),r.subscribe(a.createOperatorSubscriber(l,function(e){var n,r;try{for(var i=t(u),a=i.next();!a.done;a=i.next())a.value.push(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},function(){for(;u.length>0;)l.next(u.shift());l.complete()}))})}e.bufferToggle=c}}),Wd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bufferWhen=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=null,s=null,c=function(){s?.unsubscribe();var t=o;o=[],t&&a.next(t),i.innerFrom(e()).subscribe(s=r.createOperatorSubscriber(a,c,n.noop))};c(),t.subscribe(r.createOperatorSubscriber(a,function(e){return o?.push(e)},function(){o&&a.next(o),a.complete()},void 0,function(){return o=s=null}))})}e.bufferWhen=a}}),Gd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/catchError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.catchError=void 0;var t=B(),n=z(),r=R();function i(e){return r.operate(function(r,a){var o=null,s=!1,c;o=r.subscribe(n.createOperatorSubscriber(a,void 0,void 0,function(n){c=t.innerFrom(e(n,i(e)(r))),o?(o.unsubscribe(),o=null,c.subscribe(a)):s=!0})),s&&(o.unsubscribe(),o=null,c.subscribe(a))})}e.catchError=i}}),Kd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/scanInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scanInternals=void 0;var t=z();function n(e,n,r,i,a){return function(o,s){var c=r,l=n,u=0;o.subscribe(t.createOperatorSubscriber(s,function(t){var n=u++;l=c?e(l,t,n):(c=!0,t),i&&s.next(l)},a&&(function(){c&&s.next(l),s.complete()})))}}e.scanInternals=n}}),qd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/reduce.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reduce=void 0;var t=Kd(),n=R();function r(e,r){return n.operate(t.scanInternals(e,r,arguments.length>=2,!1,!0))}e.reduce=r}}),Jd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/toArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toArray=void 0;var t=qd(),n=R(),r=function(e,t){return e.push(t),e};function i(){return n.operate(function(e,n){t.reduce(r,[])(e).subscribe(n)})}e.toArray=i}}),Yd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/joinAllInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.joinAllInternals=void 0;var t=Gl(),n=id(),r=Kl(),i=fd(),a=Jd();function o(e,o){return r.pipe(a.toArray(),i.mergeMap(function(t){return e(t)}),o?n.mapOneOrManyArgs(o):t.identity)}e.joinAllInternals=o}}),Xd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatestAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestAll=void 0;var t=ud(),n=Yd();function r(e){return n.joinAllInternals(t.combineLatest,e)}e.combineLatestAll=r}}),Zd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineAll=void 0,e.combineAll=Xd().combineLatestAll}}),Qd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatest.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatest=void 0;var r=ud(),i=R(),a=Dd(),o=id(),s=Kl(),c=Tu();function l(){var e=[...arguments],u=c.popResultSelector(e);return u?s.pipe(l.apply(void 0,n([],t(e))),o.mapOneOrManyArgs(u)):i.operate(function(i,o){r.combineLatestInit(n([i],t(a.argsOrArgArray(e))))(o)})}e.combineLatest=l}}),$d=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatestWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestWith=void 0;var r=Qd();function i(){var e=[...arguments];return r.combineLatest.apply(void 0,n([],t(e)))}e.combineLatestWith=i}}),ef=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatMap=void 0;var t=fd(),n=Ml();function r(e,r){return n.isFunction(r)?t.mergeMap(e,r,1):t.mergeMap(e,1)}e.concatMap=r}}),tf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatMapTo=void 0;var t=ef(),n=Ml();function r(e,r){return n.isFunction(r)?t.concatMap(function(){return e},r):t.concatMap(function(){return e})}e.concatMapTo=r}}),nf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concat.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.concat=void 0;var r=R(),i=md(),a=Tu(),o=Wu();function s(){var e=[...arguments],s=a.popScheduler(e);return r.operate(function(r,a){i.concatAll()(o.from(n([r],t(e)),s)).subscribe(a)})}e.concat=s}}),rf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.concatWith=void 0;var r=nf();function i(){var e=[...arguments];return r.concat.apply(void 0,n([],t(e)))}e.concatWith=i}}),af=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromSubscribable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromSubscribable=void 0;var t=ql();function n(e){return new t.Observable(function(t){return e.subscribe(t)})}e.fromSubscribable=n}}),of=L({"../../node_modules/rxjs/dist/cjs/internal/operators/connect.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.connect=void 0;var t=eu(),n=B(),r=R(),i=af(),a={connector:function(){return new t.Subject}};function o(e,t){t===void 0&&(t=a);var o=t.connector;return r.operate(function(t,r){var a=o();n.innerFrom(e(i.fromSubscribable(a))).subscribe(r),r.add(t.subscribe(a))})}e.connect=o}}),sf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/count.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.count=void 0;var t=qd();function n(e){return t.reduce(function(t,n,r){return!e||e(n,r)?t+1:t},0)}e.count=n}}),cf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/debounce.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=!1,s=null,c=null,l=function(){if(c?.unsubscribe(),c=null,o){o=!1;var e=s;s=null,a.next(e)}};t.subscribe(r.createOperatorSubscriber(a,function(t){c?.unsubscribe(),o=!0,s=t,c=r.createOperatorSubscriber(a,l,n.noop),i.innerFrom(e(t)).subscribe(c)},function(){l(),a.complete()},void 0,function(){s=c=null}))})}e.debounce=a}}),lf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/debounceTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.debounceTime=void 0;var t=hu(),n=R(),r=z();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.operate(function(t,n){var a=null,o=null,s=null,c=function(){if(a){a.unsubscribe(),a=null;var e=o;o=null,n.next(e)}};function l(){var t=s+e,r=i.now();if(r<t){a=this.schedule(void 0,t-r),n.add(a);return}c()}t.subscribe(r.createOperatorSubscriber(n,function(t){o=t,s=i.now(),a||(a=i.schedule(l,e),n.add(a))},function(){c(),n.complete()},void 0,function(){o=a=null}))})}e.debounceTime=i}}),uf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/defaultIfEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultIfEmpty=void 0;var t=R(),n=z();function r(e){return t.operate(function(t,r){var i=!1;t.subscribe(n.createOperatorSubscriber(r,function(e){i=!0,r.next(e)},function(){i||r.next(e),r.complete()}))})}e.defaultIfEmpty=r}}),df=L({"../../node_modules/rxjs/dist/cjs/internal/operators/take.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.take=void 0;var t=Cu(),n=R(),r=z();function i(e){return e<=0?function(){return t.EMPTY}:n.operate(function(t,n){var i=0;t.subscribe(r.createOperatorSubscriber(n,function(t){++i<=e&&(n.next(t),e<=i&&n.complete())}))})}e.take=i}}),ff=L({"../../node_modules/rxjs/dist/cjs/internal/operators/ignoreElements.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ignoreElements=void 0;var t=R(),n=z(),r=Bl();function i(){return t.operate(function(e,t){e.subscribe(n.createOperatorSubscriber(t,r.noop))})}e.ignoreElements=i}}),pf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapTo=void 0;var t=rd();function n(e){return t.map(function(){return e})}e.mapTo=n}}),mf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/delayWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.delayWhen=void 0;var t=hd(),n=df(),r=ff(),i=pf(),a=fd(),o=B();function s(e,c){return c?function(i){return t.concat(c.pipe(n.take(1),r.ignoreElements()),i.pipe(s(e)))}:a.mergeMap(function(t,r){return o.innerFrom(e(t,r)).pipe(n.take(1),i.mapTo(t))})}e.delayWhen=s}}),hf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/delay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.delay=void 0;var t=hu(),n=mf(),r=Cd();function i(e,i){i===void 0&&(i=t.asyncScheduler);var a=r.timer(e,i);return n.delayWhen(function(){return a})}e.delay=i}}),gf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/dematerialize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dematerialize=void 0;var t=qu(),n=R(),r=z();function i(){return n.operate(function(e,n){e.subscribe(r.createOperatorSubscriber(n,function(e){return t.observeNotification(e,n)}))})}e.dematerialize=i}}),_f=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinct.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinct=void 0;var t=R(),n=z(),r=Bl(),i=B();function a(e,a){return t.operate(function(t,o){var s=new Set;t.subscribe(n.createOperatorSubscriber(o,function(t){var n=e?e(t):t;s.has(n)||(s.add(n),o.next(t))})),a&&i.innerFrom(a).subscribe(n.createOperatorSubscriber(o,function(){return s.clear()},r.noop))})}e.distinct=a}}),vf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinctUntilChanged.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinctUntilChanged=void 0;var t=Gl(),n=R(),r=z();function i(e,i){return i===void 0&&(i=t.identity),e??=a,n.operate(function(t,n){var a,o=!0;t.subscribe(r.createOperatorSubscriber(n,function(t){var r=i(t);(o||!e(a,r))&&(o=!1,a=r,n.next(t))}))})}e.distinctUntilChanged=i;function a(e,t){return e===t}}}),yf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinctUntilKeyChanged.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinctUntilKeyChanged=void 0;var t=vf();function n(e,n){return t.distinctUntilChanged(function(t,r){return n?n(t[e],r[e]):t[e]===r[e]})}e.distinctUntilKeyChanged=n}}),bf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throwIfEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throwIfEmpty=void 0;var t=Yu(),n=R(),r=z();function i(e){return e===void 0&&(e=a),n.operate(function(t,n){var i=!1;t.subscribe(r.createOperatorSubscriber(n,function(e){i=!0,n.next(e)},function(){return i?n.complete():n.error(e())}))})}e.throwIfEmpty=i;function a(){return new t.EmptyError}}}),xf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/elementAt.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.elementAt=void 0;var t=Qu(),n=jd(),r=bf(),i=uf(),a=df();function o(e,o){if(e<0)throw new t.ArgumentOutOfRangeError;var s=arguments.length>=2;return function(c){return c.pipe(n.filter(function(t,n){return n===e}),a.take(1),s?i.defaultIfEmpty(o):r.throwIfEmpty(function(){return new t.ArgumentOutOfRangeError}))}}e.elementAt=o}}),Sf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/endWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.endWith=void 0;var r=hd(),i=Gu();function a(){var e=[...arguments];return function(a){return r.concat(a,i.of.apply(void 0,n([],t(e))))}}e.endWith=a}}),Cf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/every.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.every=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(n){e.call(r,n,a++,t)||(i.next(!1),i.complete())},function(){i.next(!0),i.complete()}))})}e.every=r}}),wf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaustMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaustMap=void 0;var t=rd(),n=B(),r=R(),i=z();function a(e,o){return o?function(r){return r.pipe(a(function(r,i){return n.innerFrom(e(r,i)).pipe(t.map(function(e,t){return o(r,e,i,t)}))}))}:r.operate(function(t,r){var a=0,o=null,s=!1;t.subscribe(i.createOperatorSubscriber(r,function(t){o||(o=i.createOperatorSubscriber(r,void 0,function(){o=null,s&&r.complete()}),n.innerFrom(e(t,a++)).subscribe(o))},function(){s=!0,!o&&r.complete()}))})}e.exhaustMap=a}}),Tf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaustAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaustAll=void 0;var t=wf(),n=Gl();function r(){return t.exhaustMap(n.identity)}e.exhaustAll=r}}),Ef=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaust.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaust=void 0,e.exhaust=Tf().exhaustAll}}),Df=L({"../../node_modules/rxjs/dist/cjs/internal/operators/expand.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.expand=void 0;var t=R(),n=dd();function r(e,r,i){return r===void 0&&(r=1/0),r=(r||0)<1?1/0:r,t.operate(function(t,a){return n.mergeInternals(t,a,e,r,void 0,!0,i)})}e.expand=r}}),Of=L({"../../node_modules/rxjs/dist/cjs/internal/operators/finalize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.finalize=void 0;var t=R();function n(e){return t.operate(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}e.finalize=n}}),kf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/find.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createFind=e.find=void 0;var t=R(),n=z();function r(e,n){return t.operate(i(e,n,`value`))}e.find=r;function i(e,t,r){var i=r===`index`;return function(r,a){var o=0;r.subscribe(n.createOperatorSubscriber(a,function(n){var s=o++;e.call(t,n,s,r)&&(a.next(i?s:n),a.complete())},function(){a.next(i?-1:void 0),a.complete()}))}}e.createFind=i}}),Af=L({"../../node_modules/rxjs/dist/cjs/internal/operators/findIndex.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findIndex=void 0;var t=R(),n=kf();function r(e,r){return t.operate(n.createFind(e,r,`index`))}e.findIndex=r}}),jf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/first.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.first=void 0;var t=Yu(),n=jd(),r=df(),i=uf(),a=bf(),o=Gl();function s(e,s){var c=arguments.length>=2;return function(l){return l.pipe(e?n.filter(function(t,n){return e(t,n,l)}):o.identity,r.take(1),c?i.defaultIfEmpty(s):a.throwIfEmpty(function(){return new t.EmptyError}))}}e.first=s}}),Mf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/groupBy.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.groupBy=void 0;var t=ql(),n=B(),r=eu(),i=R(),a=z();function o(e,o,s,c){return i.operate(function(i,l){var u;!o||typeof o==`function`?u=o:(s=o.duration,u=o.element,c=o.connector);var d=new Map,f=function(e){d.forEach(e),e(l)},p=function(e){return f(function(t){return t.error(e)})},m=0,h=!1,g=new a.OperatorSubscriber(l,function(t){try{var i=e(t),o=d.get(i);if(!o){d.set(i,o=c?c():new r.Subject);var f=_(i,o);if(l.next(f),s){var m=a.createOperatorSubscriber(o,function(){o.complete(),m?.unsubscribe()},void 0,void 0,function(){return d.delete(i)});g.add(n.innerFrom(s(f)).subscribe(m))}}o.next(u?u(t):t)}catch(e){p(e)}},function(){return f(function(e){return e.complete()})},p,function(){return d.clear()},function(){return h=!0,m===0});i.subscribe(g);function _(e,n){var r=new t.Observable(function(e){m++;var t=n.subscribe(e);return function(){t.unsubscribe(),--m===0&&h&&g.unsubscribe()}});return r.key=e,r}})}e.groupBy=o}}),Nf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/isEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isEmpty=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){e.subscribe(n.createOperatorSubscriber(t,function(){t.next(!1),t.complete()},function(){t.next(!0),t.complete()}))})}e.isEmpty=r}}),Pf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeLast.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.takeLast=void 0;var n=Cu(),r=R(),i=z();function a(e){return e<=0?function(){return n.EMPTY}:r.operate(function(n,r){var a=[];n.subscribe(i.createOperatorSubscriber(r,function(t){a.push(t),e<a.length&&a.shift()},function(){var e,n;try{for(var i=t(a),o=i.next();!o.done;o=i.next()){var s=o.value;r.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}r.complete()},void 0,function(){a=null}))})}e.takeLast=a}}),Ff=L({"../../node_modules/rxjs/dist/cjs/internal/operators/last.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.last=void 0;var t=Yu(),n=jd(),r=Pf(),i=bf(),a=uf(),o=Gl();function s(e,s){var c=arguments.length>=2;return function(l){return l.pipe(e?n.filter(function(t,n){return e(t,n,l)}):o.identity,r.takeLast(1),c?a.defaultIfEmpty(s):i.throwIfEmpty(function(){return new t.EmptyError}))}}e.last=s}}),If=L({"../../node_modules/rxjs/dist/cjs/internal/operators/materialize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.materialize=void 0;var t=qu(),n=R(),r=z();function i(){return n.operate(function(e,n){e.subscribe(r.createOperatorSubscriber(n,function(e){n.next(t.Notification.createNext(e))},function(){n.next(t.Notification.createComplete()),n.complete()},function(e){n.next(t.Notification.createError(e)),n.complete()}))})}e.materialize=i}}),Lf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/max.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.max=void 0;var t=qd(),n=Ml();function r(e){return t.reduce(n.isFunction(e)?function(t,n){return e(t,n)>0?t:n}:function(e,t){return e>t?e:t})}e.max=r}}),Rf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/flatMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.flatMap=void 0,e.flatMap=fd().mergeMap}}),zf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeMapTo=void 0;var t=fd(),n=Ml();function r(e,r,i){return i===void 0&&(i=1/0),n.isFunction(r)?t.mergeMap(function(){return e},r,i):(typeof r==`number`&&(i=r),t.mergeMap(function(){return e},i))}e.mergeMapTo=r}}),Bf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeScan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeScan=void 0;var t=R(),n=dd();function r(e,r,i){return i===void 0&&(i=1/0),t.operate(function(t,a){var o=r;return n.mergeInternals(t,a,function(t,n){return e(o,t,n)},i,function(e){o=e},!1,void 0,function(){return o=null})})}e.mergeScan=r}}),Vf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/merge.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.merge=void 0;var r=R(),i=pd(),a=Tu(),o=Wu();function s(){var e=[...arguments],s=a.popScheduler(e),c=a.popNumber(e,1/0);return r.operate(function(r,a){i.mergeAll(c)(o.from(n([r],t(e)),s)).subscribe(a)})}e.merge=s}}),Hf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.mergeWith=void 0;var r=Vf();function i(){var e=[...arguments];return r.merge.apply(void 0,n([],t(e)))}e.mergeWith=i}}),Uf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/min.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.min=void 0;var t=qd(),n=Ml();function r(e){return t.reduce(n.isFunction(e)?function(t,n){return e(t,n)<0?t:n}:function(e,t){return e<t?e:t})}e.min=r}}),Wf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/multicast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.multicast=void 0;var t=Yl(),n=Ml(),r=of();function i(e,i){var a=n.isFunction(e)?e:function(){return e};return n.isFunction(i)?r.connect(i,{connector:a}):function(e){return new t.ConnectableObservable(e,a)}}e.multicast=i}}),Gf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/onErrorResumeNextWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.onErrorResumeNext=e.onErrorResumeNextWith=void 0;var r=Dd(),i=Od();function a(){var e=[...arguments],a=r.argsOrArgArray(e);return function(e){return i.onErrorResumeNext.apply(void 0,n([e],t(a)))}}e.onErrorResumeNextWith=a,e.onErrorResumeNext=a}}),Kf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/pairwise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pairwise=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){var r,i=!1;e.subscribe(n.createOperatorSubscriber(t,function(e){var n=r;r=e,i&&t.next([n,e]),i=!0}))})}e.pairwise=r}}),qf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/pluck.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pluck=void 0;var t=rd();function n(){var e=[...arguments],n=e.length;if(n===0)throw Error(`list of properties cannot be empty.`);return t.map(function(t){for(var r=t,i=0;i<n;i++){var a=r?.[e[i]];if(a!==void 0)r=a;else return}return r})}e.pluck=n}}),Jf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publish.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publish=void 0;var t=eu(),n=Wf(),r=of();function i(e){return e?function(t){return r.connect(e)(t)}:function(e){return n.multicast(new t.Subject)(e)}}e.publish=i}}),Yf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishBehavior.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishBehavior=void 0;var t=tu(),n=Yl();function r(e){return function(r){var i=new t.BehaviorSubject(e);return new n.ConnectableObservable(r,function(){return i})}}e.publishBehavior=r}}),Xf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishLast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishLast=void 0;var t=iu(),n=Yl();function r(){return function(e){var r=new t.AsyncSubject;return new n.ConnectableObservable(e,function(){return r})}}e.publishLast=r}}),Zf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishReplay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishReplay=void 0;var t=ru(),n=Wf(),r=Ml();function i(e,i,a,o){a&&!r.isFunction(a)&&(o=a);var s=r.isFunction(a)?a:void 0;return function(r){return n.multicast(new t.ReplaySubject(e,i,o),s)(r)}}e.publishReplay=i}}),Qf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/raceWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.raceWith=void 0;var r=Nd(),i=R(),a=Gl();function o(){var e=[...arguments];return e.length?i.operate(function(i,a){r.raceInit(n([i],t(e)))(a)}):a.identity}e.raceWith=o}}),$f=L({"../../node_modules/rxjs/dist/cjs/internal/operators/repeat.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.repeat=void 0;var t=Cu(),n=R(),r=z(),i=B(),a=Cd();function o(e){var o,s=1/0,c;return e!=null&&(typeof e==`object`?(o=e.count,s=o===void 0?1/0:o,c=e.delay):s=e),s<=0?function(){return t.EMPTY}:n.operate(function(e,t){var n=0,o,l=function(){if(o?.unsubscribe(),o=null,c!=null){var e=typeof c==`number`?a.timer(c):i.innerFrom(c(n)),s=r.createOperatorSubscriber(t,function(){s.unsubscribe(),u()});e.subscribe(s)}else u()},u=function(){var i=!1;o=e.subscribe(r.createOperatorSubscriber(t,void 0,function(){++n<s?o?l():i=!0:t.complete()})),i&&l()};u()})}e.repeat=o}}),ep=L({"../../node_modules/rxjs/dist/cjs/internal/operators/repeatWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.repeatWhen=void 0;var t=B(),n=eu(),r=R(),i=z();function a(e){return r.operate(function(r,a){var o,s=!1,c,l=!1,u=!1,d=function(){return u&&l&&(a.complete(),!0)},f=function(){return c||(c=new n.Subject,t.innerFrom(e(c)).subscribe(i.createOperatorSubscriber(a,function(){o?p():s=!0},function(){l=!0,d()}))),c},p=function(){u=!1,o=r.subscribe(i.createOperatorSubscriber(a,void 0,function(){u=!0,!d()&&f().next()})),s&&(o.unsubscribe(),o=null,s=!1,p())};p()})}e.repeatWhen=a}}),tp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/retry.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.retry=void 0;var t=R(),n=z(),r=Gl(),i=Cd(),a=B();function o(e){e===void 0&&(e=1/0);var o=e&&typeof e==`object`?e:{count:e},s=o.count,c=s===void 0?1/0:s,l=o.delay,u=o.resetOnSuccess,d=u!==void 0&&u;return c<=0?r.identity:t.operate(function(e,t){var r=0,o,s=function(){var u=!1;o=e.subscribe(n.createOperatorSubscriber(t,function(e){d&&(r=0),t.next(e)},void 0,function(e){if(r++<c){var d=function(){o?(o.unsubscribe(),o=null,s()):u=!0};if(l!=null){var f=typeof l==`number`?i.timer(l):a.innerFrom(l(e,r)),p=n.createOperatorSubscriber(t,function(){p.unsubscribe(),d()},function(){t.complete()});f.subscribe(p)}else d()}else t.error(e)})),u&&(o.unsubscribe(),o=null,s())};s()})}e.retry=o}}),np=L({"../../node_modules/rxjs/dist/cjs/internal/operators/retryWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.retryWhen=void 0;var t=B(),n=eu(),r=R(),i=z();function a(e){return r.operate(function(r,a){var o,s=!1,c,l=function(){o=r.subscribe(i.createOperatorSubscriber(a,void 0,void 0,function(r){c||(c=new n.Subject,t.innerFrom(e(c)).subscribe(i.createOperatorSubscriber(a,function(){return o?l():s=!0}))),c&&c.next(r)})),s&&(o.unsubscribe(),o=null,s=!1,l())};l()})}e.retryWhen=a}}),rp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sample.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sample=void 0;var t=B(),n=R(),r=Bl(),i=z();function a(e){return n.operate(function(n,a){var o=!1,s=null;n.subscribe(i.createOperatorSubscriber(a,function(e){o=!0,s=e})),t.innerFrom(e).subscribe(i.createOperatorSubscriber(a,function(){if(o){o=!1;var e=s;s=null,a.next(e)}},r.noop))})}e.sample=a}}),ip=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sampleTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sampleTime=void 0;var t=hu(),n=rp(),r=wd();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.sample(r.interval(e,i))}e.sampleTime=i}}),ap=L({"../../node_modules/rxjs/dist/cjs/internal/operators/scan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scan=void 0;var t=R(),n=Kd();function r(e,r){return t.operate(n.scanInternals(e,r,arguments.length>=2,!0))}e.scan=r}}),op=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sequenceEqual.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sequenceEqual=void 0;var t=R(),n=z(),r=B();function i(e,i){return i===void 0&&(i=function(e,t){return e===t}),t.operate(function(t,o){var s=a(),c=a(),l=function(e){o.next(e),o.complete()},u=function(e,t){var r=n.createOperatorSubscriber(o,function(n){var r=t.buffer,a=t.complete;r.length===0?a?l(!1):e.buffer.push(n):!i(n,r.shift())&&l(!1)},function(){e.complete=!0;var n=t.complete,i=t.buffer;n&&l(i.length===0),r?.unsubscribe()});return r};t.subscribe(u(s,c)),r.innerFrom(e).subscribe(u(c,s))})}e.sequenceEqual=i;function a(){return{buffer:[],complete:!1}}}}),sp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/share.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.share=void 0;var r=B(),i=eu(),a=Ul(),o=R();function s(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new i.Subject}:t,s=e.resetOnError,l=s===void 0||s,u=e.resetOnComplete,d=u===void 0||u,f=e.resetOnRefCountZero,p=f===void 0||f;return function(e){var t,i,s,u=0,f=!1,m=!1,h=function(){i?.unsubscribe(),i=void 0},g=function(){h(),t=s=void 0,f=m=!1},_=function(){var e=t;g(),e?.unsubscribe()};return o.operate(function(e,o){u++,!m&&!f&&h();var v=s??=n();o.add(function(){u--,u===0&&!m&&!f&&(i=c(_,p))}),v.subscribe(o),!t&&u>0&&(t=new a.SafeSubscriber({next:function(e){return v.next(e)},error:function(e){m=!0,h(),i=c(g,l,e),v.error(e)},complete:function(){f=!0,h(),i=c(g,d),v.complete()}}),r.innerFrom(e).subscribe(t))})(e)}}e.share=s;function c(e,i){var o=[...arguments].slice(2);if(i===!0){e();return}if(i!==!1){var s=new a.SafeSubscriber({next:function(){s.unsubscribe(),e()}});return r.innerFrom(i.apply(void 0,n([],t(o)))).subscribe(s)}}}}),cp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/shareReplay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.shareReplay=void 0;var t=ru(),n=sp();function r(e,r,i){var a,o,s,c,l=!1;return e&&typeof e==`object`?(a=e.bufferSize,c=a===void 0?1/0:a,o=e.windowTime,r=o===void 0?1/0:o,s=e.refCount,l=s!==void 0&&s,i=e.scheduler):c=e??1/0,n.share({connector:function(){return new t.ReplaySubject(c,r,i)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:l})}e.shareReplay=r}}),lp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/single.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.single=void 0;var t=Yu(),n=ed(),r=$u(),i=R(),a=z();function o(e){return i.operate(function(i,o){var s=!1,c,l=!1,u=0;i.subscribe(a.createOperatorSubscriber(o,function(t){l=!0,(!e||e(t,u++,i))&&(s&&o.error(new n.SequenceError(`Too many matching values`)),s=!0,c=t)},function(){s?(o.next(c),o.complete()):o.error(l?new r.NotFoundError(`No matching values`):new t.EmptyError)}))})}e.single=o}}),up=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skip.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skip=void 0;var t=jd();function n(e){return t.filter(function(t,n){return e<=n})}e.skip=n}}),dp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipLast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipLast=void 0;var t=Gl(),n=R(),r=z();function i(e){return e<=0?t.identity:n.operate(function(t,n){var i=Array(e),a=0;return t.subscribe(r.createOperatorSubscriber(n,function(t){var r=a++;if(r<e)i[r]=t;else{var o=r%e,s=i[o];i[o]=t,n.next(s)}})),function(){i=null}})}e.skipLast=i}}),fp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipUntil.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipUntil=void 0;var t=R(),n=z(),r=B(),i=Bl();function a(e){return t.operate(function(t,a){var o=!1,s=n.createOperatorSubscriber(a,function(){s?.unsubscribe(),o=!0},i.noop);r.innerFrom(e).subscribe(s),t.subscribe(n.createOperatorSubscriber(a,function(e){return o&&a.next(e)}))})}e.skipUntil=a}}),pp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipWhile.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipWhile=void 0;var t=R(),n=z();function r(e){return t.operate(function(t,r){var i=!1,a=0;t.subscribe(n.createOperatorSubscriber(r,function(t){return(i||=!e(t,a++))&&r.next(t)}))})}e.skipWhile=r}}),mp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/startWith.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.startWith=void 0;var t=hd(),n=Tu(),r=R();function i(){var e=[...arguments],i=n.popScheduler(e);return r.operate(function(n,r){(i?t.concat(e,n,i):t.concat(e,n)).subscribe(r)})}e.startWith=i}}),hp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchMap=void 0;var t=B(),n=R(),r=z();function i(e,i){return n.operate(function(n,a){var o=null,s=0,c=!1,l=function(){return c&&!o&&a.complete()};n.subscribe(r.createOperatorSubscriber(a,function(n){o?.unsubscribe();var c=0,u=s++;t.innerFrom(e(n,u)).subscribe(o=r.createOperatorSubscriber(a,function(e){return a.next(i?i(n,e,u,c++):e)},function(){o=null,l()}))},function(){c=!0,l()}))})}e.switchMap=i}}),gp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchAll=void 0;var t=hp(),n=Gl();function r(){return t.switchMap(n.identity)}e.switchAll=r}}),_p=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchMapTo=void 0;var t=hp(),n=Ml();function r(e,r){return n.isFunction(r)?t.switchMap(function(){return e},r):t.switchMap(function(){return e})}e.switchMapTo=r}}),vp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchScan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchScan=void 0;var t=hp(),n=R();function r(e,r){return n.operate(function(n,i){var a=r;return t.switchMap(function(t,n){return e(a,t,n)},function(e,t){return a=t,t})(n).subscribe(i),function(){a=null}})}e.switchScan=r}}),yp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeUntil.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.takeUntil=void 0;var t=R(),n=z(),r=B(),i=Bl();function a(e){return t.operate(function(t,a){r.innerFrom(e).subscribe(n.createOperatorSubscriber(a,function(){return a.complete()},i.noop)),!a.closed&&t.subscribe(a)})}e.takeUntil=a}}),bp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeWhile.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.takeWhile=void 0;var t=R(),n=z();function r(e,r){return r===void 0&&(r=!1),t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){var n=e(t,a++);(n||r)&&i.next(t),!n&&i.complete()}))})}e.takeWhile=r}}),xp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/tap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tap=void 0;var t=Ml(),n=R(),r=z(),i=Gl();function a(e,a,o){var s=t.isFunction(e)||a||o?{next:e,error:a,complete:o}:e;return s?n.operate(function(e,t){var n;(n=s.subscribe)==null||n.call(s);var i=!0;e.subscribe(r.createOperatorSubscriber(t,function(e){var n;(n=s.next)==null||n.call(s,e),t.next(e)},function(){var e;i=!1,(e=s.complete)==null||e.call(s),t.complete()},function(e){var n;i=!1,(n=s.error)==null||n.call(s,e),t.error(e)},function(){var e,t;i&&((e=s.unsubscribe)==null||e.call(s)),(t=s.finalize)==null||t.call(s)}))}):i.identity}e.tap=a}}),Sp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throttle.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throttle=void 0;var t=R(),n=z(),r=B();function i(e,i){return t.operate(function(t,a){var o=i??{},s=o.leading,c=s===void 0||s,l=o.trailing,u=l!==void 0&&l,d=!1,f=null,p=null,m=!1,h=function(){p?.unsubscribe(),p=null,u&&(v(),m&&a.complete())},g=function(){p=null,m&&a.complete()},_=function(t){return p=r.innerFrom(e(t)).subscribe(n.createOperatorSubscriber(a,h,g))},v=function(){if(d){d=!1;var e=f;f=null,a.next(e),!m&&_(e)}};t.subscribe(n.createOperatorSubscriber(a,function(e){d=!0,f=e,!(p&&!p.closed)&&(c?v():_(e))},function(){m=!0,!(u&&d&&p&&!p.closed)&&a.complete()}))})}e.throttle=i}}),Cp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throttleTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throttleTime=void 0;var t=hu(),n=Sp(),r=Cd();function i(e,i,a){i===void 0&&(i=t.asyncScheduler);var o=r.timer(e,i);return n.throttle(function(){return o},a)}e.throttleTime=i}}),wp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeInterval.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TimeInterval=e.timeInterval=void 0;var t=hu(),n=R(),r=z();function i(e){return e===void 0&&(e=t.asyncScheduler),n.operate(function(t,n){var i=e.now();t.subscribe(r.createOperatorSubscriber(n,function(t){var r=e.now(),o=r-i;i=r,n.next(new a(t,o))}))})}e.timeInterval=i;var a=(function(){function e(e,t){this.value=e,this.interval=t}return e})();e.TimeInterval=a}}),Tp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeoutWith.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutWith=void 0;var t=hu(),n=td(),r=nd();function i(e,i,a){var o,s,c;if(a??=t.async,n.isValidDate(e)?o=e:typeof e==`number`&&(s=e),i)c=function(){return i};else throw TypeError(`No observable provided to switch to`);if(o==null&&s==null)throw TypeError(`No timeout provided.`);return r.timeout({first:o,each:s,scheduler:a,with:c})}e.timeoutWith=i}}),Ep=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timestamp.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timestamp=void 0;var t=nu(),n=rd();function r(e){return e===void 0&&(e=t.dateTimestampProvider),n.map(function(t){return{value:t,timestamp:e.now()}})}e.timestamp=r}}),Dp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/window.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.window=void 0;var t=eu(),n=R(),r=z(),i=Bl(),a=B();function o(e){return n.operate(function(n,o){var s=new t.Subject;o.next(s.asObservable());var c=function(e){s.error(e),o.error(e)};return n.subscribe(r.createOperatorSubscriber(o,function(e){return s?.next(e)},function(){s.complete(),o.complete()},c)),a.innerFrom(e).subscribe(r.createOperatorSubscriber(o,function(){s.complete(),o.next(s=new t.Subject)},i.noop,c)),function(){s?.unsubscribe(),s=null}})}e.window=o}}),Op=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowCount.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.windowCount=void 0;var n=eu(),r=R(),i=z();function a(e,a){a===void 0&&(a=0);var o=a>0?a:e;return r.operate(function(r,a){var s=[new n.Subject],c=0;a.next(s[0].asObservable()),r.subscribe(i.createOperatorSubscriber(a,function(r){var i,l;try{for(var u=t(s),d=u.next();!d.done;d=u.next())d.value.next(r)}catch(e){i={error:e}}finally{try{d&&!d.done&&(l=u.return)&&l.call(u)}finally{if(i)throw i.error}}var f=c-e+1;if(f>=0&&f%o===0&&s.shift().complete(),++c%o===0){var p=new n.Subject;s.push(p),a.next(p.asObservable())}},function(){for(;s.length>0;)s.shift().complete();a.complete()},function(e){for(;s.length>0;)s.shift().error(e);a.error(e)},function(){s=null}))})}e.windowCount=a}}),kp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.windowTime=void 0;var t=eu(),n=hu(),r=Il(),i=R(),a=z(),o=Fl(),s=Tu(),c=Pu();function l(e){var l=[...arguments].slice(1),u=s.popScheduler(l)??n.asyncScheduler,d=l[0]??null,f=l[1]||1/0;return i.operate(function(n,i){var s=[],l=!1,p=function(e){var t=e.window,n=e.subs;t.complete(),n.unsubscribe(),o.arrRemove(s,e),l&&m()},m=function(){if(s){var n=new r.Subscription;i.add(n);var a=new t.Subject,o={window:a,subs:n,seen:0};s.push(o),i.next(a.asObservable()),c.executeSchedule(n,u,function(){return p(o)},e)}};d!==null&&d>=0?c.executeSchedule(i,u,m,d,!0):l=!0,m();var h=function(e){return s.slice().forEach(e)},g=function(e){h(function(t){var n=t.window;return e(n)}),e(i),i.unsubscribe()};return n.subscribe(a.createOperatorSubscriber(i,function(e){h(function(t){t.window.next(e),f<=++t.seen&&p(t)})},function(){return g(function(e){return e.complete()})},function(e){return g(function(t){return t.error(e)})})),function(){s=null}})}e.windowTime=l}}),Ap=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowToggle.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.windowToggle=void 0;var n=eu(),r=Il(),i=R(),a=B(),o=z(),s=Bl(),c=Fl();function l(e,l){return i.operate(function(i,u){var d=[],f=function(e){for(;0<d.length;)d.shift().error(e);u.error(e)};a.innerFrom(e).subscribe(o.createOperatorSubscriber(u,function(e){var t=new n.Subject;d.push(t);var i=new r.Subscription,p=function(){c.arrRemove(d,t),t.complete(),i.unsubscribe()},m;try{m=a.innerFrom(l(e))}catch(e){f(e);return}u.next(t.asObservable()),i.add(m.subscribe(o.createOperatorSubscriber(u,p,s.noop,f)))},s.noop)),i.subscribe(o.createOperatorSubscriber(u,function(e){var n,r,i=d.slice();try{for(var a=t(i),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},function(){for(;0<d.length;)d.shift().complete();u.complete()},f,function(){for(;0<d.length;)d.shift().unsubscribe()}))})}e.windowToggle=l}}),jp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.windowWhen=void 0;var t=eu(),n=R(),r=z(),i=B();function a(e){return n.operate(function(n,a){var o,s,c=function(e){o.error(e),a.error(e)},l=function(){s?.unsubscribe(),o?.complete(),o=new t.Subject,a.next(o.asObservable());var n;try{n=i.innerFrom(e())}catch(e){c(e);return}n.subscribe(s=r.createOperatorSubscriber(a,l,l,c))};l(),n.subscribe(r.createOperatorSubscriber(a,function(e){return o.next(e)},function(){o.complete(),a.complete()},c,function(){s?.unsubscribe(),o=null}))})}e.windowWhen=a}}),Mp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/withLatestFrom.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.withLatestFrom=void 0;var r=R(),i=z(),a=B(),o=Gl(),s=Bl(),c=Tu();function l(){var e=[...arguments],l=c.popResultSelector(e);return r.operate(function(r,c){for(var u=e.length,d=Array(u),f=e.map(function(){return!1}),p=!1,m=function(t){a.innerFrom(e[t]).subscribe(i.createOperatorSubscriber(c,function(e){d[t]=e,!p&&!f[t]&&(f[t]=!0,(p=f.every(o.identity))&&(f=null))},s.noop))},h=0;h<u;h++)m(h);r.subscribe(i.createOperatorSubscriber(c,function(e){if(p){var r=n([e],t(d));c.next(l?l.apply(void 0,n([],t(r))):r)}}))})}e.withLatestFrom=l}}),Np=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zipAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.zipAll=void 0;var t=Id(),n=Yd();function r(e){return n.joinAllInternals(t.zip,e)}e.zipAll=r}}),Pp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zip.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zip=void 0;var r=Id(),i=R();function a(){var e=[...arguments];return i.operate(function(i,a){r.zip.apply(void 0,n([i],t(e))).subscribe(a)})}e.zip=a}}),Fp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zipWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zipWith=void 0;var r=Pp();function i(){var e=[...arguments];return r.zip.apply(void 0,n([],t(e)))}e.zipWith=i}}),Ip=L({"../../node_modules/rxjs/dist/cjs/index.js"(e){var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.interval=e.iif=e.generate=e.fromEventPattern=e.fromEvent=e.from=e.forkJoin=e.empty=e.defer=e.connectable=e.concat=e.combineLatest=e.bindNodeCallback=e.bindCallback=e.UnsubscriptionError=e.TimeoutError=e.SequenceError=e.ObjectUnsubscribedError=e.NotFoundError=e.EmptyError=e.ArgumentOutOfRangeError=e.firstValueFrom=e.lastValueFrom=e.isObservable=e.identity=e.noop=e.pipe=e.NotificationKind=e.Notification=e.Subscriber=e.Subscription=e.Scheduler=e.VirtualAction=e.VirtualTimeScheduler=e.animationFrameScheduler=e.animationFrame=e.queueScheduler=e.queue=e.asyncScheduler=e.async=e.asapScheduler=e.asap=e.AsyncSubject=e.ReplaySubject=e.BehaviorSubject=e.Subject=e.animationFrames=e.observable=e.ConnectableObservable=e.Observable=void 0,e.filter=e.expand=e.exhaustMap=e.exhaustAll=e.exhaust=e.every=e.endWith=e.elementAt=e.distinctUntilKeyChanged=e.distinctUntilChanged=e.distinct=e.dematerialize=e.delayWhen=e.delay=e.defaultIfEmpty=e.debounceTime=e.debounce=e.count=e.connect=e.concatWith=e.concatMapTo=e.concatMap=e.concatAll=e.combineLatestWith=e.combineLatestAll=e.combineAll=e.catchError=e.bufferWhen=e.bufferToggle=e.bufferTime=e.bufferCount=e.buffer=e.auditTime=e.audit=e.config=e.NEVER=e.EMPTY=e.scheduled=e.zip=e.using=e.timer=e.throwError=e.range=e.race=e.partition=e.pairs=e.onErrorResumeNext=e.of=e.never=e.merge=void 0,e.switchMap=e.switchAll=e.subscribeOn=e.startWith=e.skipWhile=e.skipUntil=e.skipLast=e.skip=e.single=e.shareReplay=e.share=e.sequenceEqual=e.scan=e.sampleTime=e.sample=e.refCount=e.retryWhen=e.retry=e.repeatWhen=e.repeat=e.reduce=e.raceWith=e.publishReplay=e.publishLast=e.publishBehavior=e.publish=e.pluck=e.pairwise=e.onErrorResumeNextWith=e.observeOn=e.multicast=e.min=e.mergeWith=e.mergeScan=e.mergeMapTo=e.mergeMap=e.flatMap=e.mergeAll=e.max=e.materialize=e.mapTo=e.map=e.last=e.isEmpty=e.ignoreElements=e.groupBy=e.first=e.findIndex=e.find=e.finalize=void 0,e.zipWith=e.zipAll=e.withLatestFrom=e.windowWhen=e.windowToggle=e.windowTime=e.windowCount=e.window=e.toArray=e.timestamp=e.timeoutWith=e.timeout=e.timeInterval=e.throwIfEmpty=e.throttleTime=e.throttle=e.tap=e.takeWhile=e.takeUntil=e.takeLast=e.take=e.switchScan=e.switchMapTo=void 0;var r=ql();Object.defineProperty(e,"Observable",{enumerable:!0,get:function(){return r.Observable}});var i=Yl();Object.defineProperty(e,"ConnectableObservable",{enumerable:!0,get:function(){return i.ConnectableObservable}});var a=Wl();Object.defineProperty(e,"observable",{enumerable:!0,get:function(){return a.observable}});var o=Ql();Object.defineProperty(e,"animationFrames",{enumerable:!0,get:function(){return o.animationFrames}});var s=eu();Object.defineProperty(e,"Subject",{enumerable:!0,get:function(){return s.Subject}});var c=tu();Object.defineProperty(e,"BehaviorSubject",{enumerable:!0,get:function(){return c.BehaviorSubject}});var l=ru();Object.defineProperty(e,"ReplaySubject",{enumerable:!0,get:function(){return l.ReplaySubject}});var u=iu();Object.defineProperty(e,"AsyncSubject",{enumerable:!0,get:function(){return u.AsyncSubject}});var d=mu();Object.defineProperty(e,"asap",{enumerable:!0,get:function(){return d.asap}}),Object.defineProperty(e,"asapScheduler",{enumerable:!0,get:function(){return d.asapScheduler}});var f=hu();Object.defineProperty(e,"async",{enumerable:!0,get:function(){return f.async}}),Object.defineProperty(e,"asyncScheduler",{enumerable:!0,get:function(){return f.asyncScheduler}});var p=vu();Object.defineProperty(e,"queue",{enumerable:!0,get:function(){return p.queue}}),Object.defineProperty(e,"queueScheduler",{enumerable:!0,get:function(){return p.queueScheduler}});var m=xu();Object.defineProperty(e,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(e,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var h=Su();Object.defineProperty(e,"VirtualTimeScheduler",{enumerable:!0,get:function(){return h.VirtualTimeScheduler}}),Object.defineProperty(e,"VirtualAction",{enumerable:!0,get:function(){return h.VirtualAction}});var g=du();Object.defineProperty(e,"Scheduler",{enumerable:!0,get:function(){return g.Scheduler}});var _=Il();Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return _.Subscription}});var v=Ul();Object.defineProperty(e,"Subscriber",{enumerable:!0,get:function(){return v.Subscriber}});var y=qu();Object.defineProperty(e,"Notification",{enumerable:!0,get:function(){return y.Notification}}),Object.defineProperty(e,"NotificationKind",{enumerable:!0,get:function(){return y.NotificationKind}});var b=Kl();Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return b.pipe}});var x=Bl();Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return x.noop}});var S=Gl();Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return S.identity}});var C=Ju();Object.defineProperty(e,"isObservable",{enumerable:!0,get:function(){return C.isObservable}});var w=Xu();Object.defineProperty(e,"lastValueFrom",{enumerable:!0,get:function(){return w.lastValueFrom}});var T=Zu();Object.defineProperty(e,"firstValueFrom",{enumerable:!0,get:function(){return T.firstValueFrom}});var E=Qu();Object.defineProperty(e,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return E.ArgumentOutOfRangeError}});var D=Yu();Object.defineProperty(e,"EmptyError",{enumerable:!0,get:function(){return D.EmptyError}});var O=$u();Object.defineProperty(e,"NotFoundError",{enumerable:!0,get:function(){return O.NotFoundError}});var k=$l();Object.defineProperty(e,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return k.ObjectUnsubscribedError}});var A=ed();Object.defineProperty(e,"SequenceError",{enumerable:!0,get:function(){return A.SequenceError}});var j=nd();Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return j.TimeoutError}});var ee=Pl();Object.defineProperty(e,"UnsubscriptionError",{enumerable:!0,get:function(){return ee.UnsubscriptionError}});var M=od();Object.defineProperty(e,"bindCallback",{enumerable:!0,get:function(){return M.bindCallback}});var N=sd();Object.defineProperty(e,"bindNodeCallback",{enumerable:!0,get:function(){return N.bindNodeCallback}});var te=ud();Object.defineProperty(e,"combineLatest",{enumerable:!0,get:function(){return te.combineLatest}});var ne=hd();Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return ne.concat}});var re=_d();Object.defineProperty(e,"connectable",{enumerable:!0,get:function(){return re.connectable}});var ie=gd();Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return ie.defer}});var ae=Cu();Object.defineProperty(e,"empty",{enumerable:!0,get:function(){return ae.empty}});var oe=vd();Object.defineProperty(e,"forkJoin",{enumerable:!0,get:function(){return oe.forkJoin}});var se=Wu();Object.defineProperty(e,"from",{enumerable:!0,get:function(){return se.from}});var ce=yd();Object.defineProperty(e,"fromEvent",{enumerable:!0,get:function(){return ce.fromEvent}});var le=bd();Object.defineProperty(e,"fromEventPattern",{enumerable:!0,get:function(){return le.fromEventPattern}});var P=xd();Object.defineProperty(e,"generate",{enumerable:!0,get:function(){return P.generate}});var F=Sd();Object.defineProperty(e,"iif",{enumerable:!0,get:function(){return F.iif}});var ue=wd();Object.defineProperty(e,"interval",{enumerable:!0,get:function(){return ue.interval}});var de=Td();Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return de.merge}});var I=Ed();Object.defineProperty(e,"never",{enumerable:!0,get:function(){return I.never}});var fe=Gu();Object.defineProperty(e,"of",{enumerable:!0,get:function(){return fe.of}});var pe=Od();Object.defineProperty(e,"onErrorResumeNext",{enumerable:!0,get:function(){return pe.onErrorResumeNext}});var me=kd();Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return me.pairs}});var he=Md();Object.defineProperty(e,"partition",{enumerable:!0,get:function(){return he.partition}});var ge=Nd();Object.defineProperty(e,"race",{enumerable:!0,get:function(){return ge.race}});var _e=Pd();Object.defineProperty(e,"range",{enumerable:!0,get:function(){return _e.range}});var ve=Ku();Object.defineProperty(e,"throwError",{enumerable:!0,get:function(){return ve.throwError}});var ye=Cd();Object.defineProperty(e,"timer",{enumerable:!0,get:function(){return ye.timer}});var be=Fd();Object.defineProperty(e,"using",{enumerable:!0,get:function(){return be.using}});var xe=Id();Object.defineProperty(e,"zip",{enumerable:!0,get:function(){return xe.zip}});var Se=Uu();Object.defineProperty(e,"scheduled",{enumerable:!0,get:function(){return Se.scheduled}});var Ce=Cu();Object.defineProperty(e,"EMPTY",{enumerable:!0,get:function(){return Ce.EMPTY}});var we=Ed();Object.defineProperty(e,"NEVER",{enumerable:!0,get:function(){return we.NEVER}}),n(Ld(),e);var Te=Ll();Object.defineProperty(e,"config",{enumerable:!0,get:function(){return Te.config}});var L=Rd();Object.defineProperty(e,"audit",{enumerable:!0,get:function(){return L.audit}});var Ee=zd();Object.defineProperty(e,"auditTime",{enumerable:!0,get:function(){return Ee.auditTime}});var De=Bd();Object.defineProperty(e,"buffer",{enumerable:!0,get:function(){return De.buffer}});var Oe=Vd();Object.defineProperty(e,"bufferCount",{enumerable:!0,get:function(){return Oe.bufferCount}});var ke=Hd();Object.defineProperty(e,"bufferTime",{enumerable:!0,get:function(){return ke.bufferTime}});var Ae=Ud();Object.defineProperty(e,"bufferToggle",{enumerable:!0,get:function(){return Ae.bufferToggle}});var je=Wd();Object.defineProperty(e,"bufferWhen",{enumerable:!0,get:function(){return je.bufferWhen}});var Me=Gd();Object.defineProperty(e,"catchError",{enumerable:!0,get:function(){return Me.catchError}});var Ne=Zd();Object.defineProperty(e,"combineAll",{enumerable:!0,get:function(){return Ne.combineAll}});var Pe=Xd();Object.defineProperty(e,"combineLatestAll",{enumerable:!0,get:function(){return Pe.combineLatestAll}});var Fe=$d();Object.defineProperty(e,"combineLatestWith",{enumerable:!0,get:function(){return Fe.combineLatestWith}});var Ie=md();Object.defineProperty(e,"concatAll",{enumerable:!0,get:function(){return Ie.concatAll}});var Le=ef();Object.defineProperty(e,"concatMap",{enumerable:!0,get:function(){return Le.concatMap}});var Re=tf();Object.defineProperty(e,"concatMapTo",{enumerable:!0,get:function(){return Re.concatMapTo}});var ze=rf();Object.defineProperty(e,"concatWith",{enumerable:!0,get:function(){return ze.concatWith}});var Be=of();Object.defineProperty(e,"connect",{enumerable:!0,get:function(){return Be.connect}});var Ve=sf();Object.defineProperty(e,"count",{enumerable:!0,get:function(){return Ve.count}});var He=cf();Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return He.debounce}});var Ue=lf();Object.defineProperty(e,"debounceTime",{enumerable:!0,get:function(){return Ue.debounceTime}});var We=uf();Object.defineProperty(e,"defaultIfEmpty",{enumerable:!0,get:function(){return We.defaultIfEmpty}});var Ge=hf();Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return Ge.delay}});var Ke=mf();Object.defineProperty(e,"delayWhen",{enumerable:!0,get:function(){return Ke.delayWhen}});var qe=gf();Object.defineProperty(e,"dematerialize",{enumerable:!0,get:function(){return qe.dematerialize}});var Je=_f();Object.defineProperty(e,"distinct",{enumerable:!0,get:function(){return Je.distinct}});var Ye=vf();Object.defineProperty(e,"distinctUntilChanged",{enumerable:!0,get:function(){return Ye.distinctUntilChanged}});var Xe=yf();Object.defineProperty(e,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return Xe.distinctUntilKeyChanged}});var Ze=xf();Object.defineProperty(e,"elementAt",{enumerable:!0,get:function(){return Ze.elementAt}});var Qe=Sf();Object.defineProperty(e,"endWith",{enumerable:!0,get:function(){return Qe.endWith}});var $e=Cf();Object.defineProperty(e,"every",{enumerable:!0,get:function(){return $e.every}});var et=Ef();Object.defineProperty(e,"exhaust",{enumerable:!0,get:function(){return et.exhaust}});var tt=Tf();Object.defineProperty(e,"exhaustAll",{enumerable:!0,get:function(){return tt.exhaustAll}});var nt=wf();Object.defineProperty(e,"exhaustMap",{enumerable:!0,get:function(){return nt.exhaustMap}});var rt=Df();Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return rt.expand}});var it=jd();Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return it.filter}});var at=Of();Object.defineProperty(e,"finalize",{enumerable:!0,get:function(){return at.finalize}});var ot=kf();Object.defineProperty(e,"find",{enumerable:!0,get:function(){return ot.find}});var st=Af();Object.defineProperty(e,"findIndex",{enumerable:!0,get:function(){return st.findIndex}});var ct=jf();Object.defineProperty(e,"first",{enumerable:!0,get:function(){return ct.first}});var lt=Mf();Object.defineProperty(e,"groupBy",{enumerable:!0,get:function(){return lt.groupBy}});var ut=ff();Object.defineProperty(e,"ignoreElements",{enumerable:!0,get:function(){return ut.ignoreElements}});var dt=Nf();Object.defineProperty(e,"isEmpty",{enumerable:!0,get:function(){return dt.isEmpty}});var ft=Ff();Object.defineProperty(e,"last",{enumerable:!0,get:function(){return ft.last}});var pt=rd();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return pt.map}});var mt=pf();Object.defineProperty(e,"mapTo",{enumerable:!0,get:function(){return mt.mapTo}});var ht=If();Object.defineProperty(e,"materialize",{enumerable:!0,get:function(){return ht.materialize}});var gt=Lf();Object.defineProperty(e,"max",{enumerable:!0,get:function(){return gt.max}});var _t=pd();Object.defineProperty(e,"mergeAll",{enumerable:!0,get:function(){return _t.mergeAll}});var vt=Rf();Object.defineProperty(e,"flatMap",{enumerable:!0,get:function(){return vt.flatMap}});var yt=fd();Object.defineProperty(e,"mergeMap",{enumerable:!0,get:function(){return yt.mergeMap}});var bt=zf();Object.defineProperty(e,"mergeMapTo",{enumerable:!0,get:function(){return bt.mergeMapTo}});var xt=Bf();Object.defineProperty(e,"mergeScan",{enumerable:!0,get:function(){return xt.mergeScan}});var St=Hf();Object.defineProperty(e,"mergeWith",{enumerable:!0,get:function(){return St.mergeWith}});var Ct=Uf();Object.defineProperty(e,"min",{enumerable:!0,get:function(){return Ct.min}});var wt=Wf();Object.defineProperty(e,"multicast",{enumerable:!0,get:function(){return wt.multicast}});var Tt=Fu();Object.defineProperty(e,"observeOn",{enumerable:!0,get:function(){return Tt.observeOn}});var Et=Gf();Object.defineProperty(e,"onErrorResumeNextWith",{enumerable:!0,get:function(){return Et.onErrorResumeNextWith}});var Dt=Kf();Object.defineProperty(e,"pairwise",{enumerable:!0,get:function(){return Dt.pairwise}});var Ot=qf();Object.defineProperty(e,"pluck",{enumerable:!0,get:function(){return Ot.pluck}});var kt=Jf();Object.defineProperty(e,"publish",{enumerable:!0,get:function(){return kt.publish}});var At=Yf();Object.defineProperty(e,"publishBehavior",{enumerable:!0,get:function(){return At.publishBehavior}});var jt=Xf();Object.defineProperty(e,"publishLast",{enumerable:!0,get:function(){return jt.publishLast}});var Mt=Zf();Object.defineProperty(e,"publishReplay",{enumerable:!0,get:function(){return Mt.publishReplay}});var Nt=Qf();Object.defineProperty(e,"raceWith",{enumerable:!0,get:function(){return Nt.raceWith}});var Pt=qd();Object.defineProperty(e,"reduce",{enumerable:!0,get:function(){return Pt.reduce}});var Ft=$f();Object.defineProperty(e,"repeat",{enumerable:!0,get:function(){return Ft.repeat}});var It=ep();Object.defineProperty(e,"repeatWhen",{enumerable:!0,get:function(){return It.repeatWhen}});var Lt=tp();Object.defineProperty(e,"retry",{enumerable:!0,get:function(){return Lt.retry}});var Rt=np();Object.defineProperty(e,"retryWhen",{enumerable:!0,get:function(){return Rt.retryWhen}});var zt=Jl();Object.defineProperty(e,"refCount",{enumerable:!0,get:function(){return zt.refCount}});var Bt=rp();Object.defineProperty(e,"sample",{enumerable:!0,get:function(){return Bt.sample}});var Vt=ip();Object.defineProperty(e,"sampleTime",{enumerable:!0,get:function(){return Vt.sampleTime}});var Ht=ap();Object.defineProperty(e,"scan",{enumerable:!0,get:function(){return Ht.scan}});var Ut=op();Object.defineProperty(e,"sequenceEqual",{enumerable:!0,get:function(){return Ut.sequenceEqual}});var Wt=sp();Object.defineProperty(e,"share",{enumerable:!0,get:function(){return Wt.share}});var Gt=cp();Object.defineProperty(e,"shareReplay",{enumerable:!0,get:function(){return Gt.shareReplay}});var Kt=lp();Object.defineProperty(e,"single",{enumerable:!0,get:function(){return Kt.single}});var qt=up();Object.defineProperty(e,"skip",{enumerable:!0,get:function(){return qt.skip}});var Jt=dp();Object.defineProperty(e,"skipLast",{enumerable:!0,get:function(){return Jt.skipLast}});var Yt=fp();Object.defineProperty(e,"skipUntil",{enumerable:!0,get:function(){return Yt.skipUntil}});var Xt=pp();Object.defineProperty(e,"skipWhile",{enumerable:!0,get:function(){return Xt.skipWhile}});var Zt=mp();Object.defineProperty(e,"startWith",{enumerable:!0,get:function(){return Zt.startWith}});var Qt=Iu();Object.defineProperty(e,"subscribeOn",{enumerable:!0,get:function(){return Qt.subscribeOn}});var $t=gp();Object.defineProperty(e,"switchAll",{enumerable:!0,get:function(){return $t.switchAll}});var en=hp();Object.defineProperty(e,"switchMap",{enumerable:!0,get:function(){return en.switchMap}});var tn=_p();Object.defineProperty(e,"switchMapTo",{enumerable:!0,get:function(){return tn.switchMapTo}});var nn=vp();Object.defineProperty(e,"switchScan",{enumerable:!0,get:function(){return nn.switchScan}});var rn=df();Object.defineProperty(e,"take",{enumerable:!0,get:function(){return rn.take}});var an=Pf();Object.defineProperty(e,"takeLast",{enumerable:!0,get:function(){return an.takeLast}});var on=yp();Object.defineProperty(e,"takeUntil",{enumerable:!0,get:function(){return on.takeUntil}});var sn=bp();Object.defineProperty(e,"takeWhile",{enumerable:!0,get:function(){return sn.takeWhile}});var cn=xp();Object.defineProperty(e,"tap",{enumerable:!0,get:function(){return cn.tap}});var ln=Sp();Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return ln.throttle}});var un=Cp();Object.defineProperty(e,"throttleTime",{enumerable:!0,get:function(){return un.throttleTime}});var dn=bf();Object.defineProperty(e,"throwIfEmpty",{enumerable:!0,get:function(){return dn.throwIfEmpty}});var fn=wp();Object.defineProperty(e,"timeInterval",{enumerable:!0,get:function(){return fn.timeInterval}});var pn=nd();Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return pn.timeout}});var mn=Tp();Object.defineProperty(e,"timeoutWith",{enumerable:!0,get:function(){return mn.timeoutWith}});var hn=Ep();Object.defineProperty(e,"timestamp",{enumerable:!0,get:function(){return hn.timestamp}});var gn=Jd();Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return gn.toArray}});var _n=Dp();Object.defineProperty(e,"window",{enumerable:!0,get:function(){return _n.window}});var vn=Op();Object.defineProperty(e,"windowCount",{enumerable:!0,get:function(){return vn.windowCount}});var yn=kp();Object.defineProperty(e,"windowTime",{enumerable:!0,get:function(){return yn.windowTime}});var bn=Ap();Object.defineProperty(e,"windowToggle",{enumerable:!0,get:function(){return bn.windowToggle}});var xn=jp();Object.defineProperty(e,"windowWhen",{enumerable:!0,get:function(){return xn.windowWhen}});var Sn=Mp();Object.defineProperty(e,"withLatestFrom",{enumerable:!0,get:function(){return Sn.withLatestFrom}});var Cn=Np();Object.defineProperty(e,"zipAll",{enumerable:!0,get:function(){return Cn.zipAll}});var wn=Fp();Object.defineProperty(e,"zipWith",{enumerable:!0,get:function(){return wn.zipWith}})}}),Lp=(0,y.createContext)(null);function Rp({children:e}){let[t,n]=(0,y.useState)(()=>typeof window<`u`&&localStorage.getItem(`showLineNumbers`)===`true`),r=(0,y.useCallback)(()=>{n(e=>{let t=!e;return typeof window<`u`&&localStorage.setItem(`showLineNumbers`,t.toString()),t})},[]);return(0,I.jsx)(Lp.Provider,{value:{showLineNumbers:t,toggleLineNumbers:r},children:e})}function zp(){let e=(0,y.useContext)(Lp);if(!e)throw Error(`useLineNumbers must be used within a LineNumbersProvider`);return e}var Bp=class{constructor(){if(typeof window>`u`)throw Error(`WebBrowserStorage is client-only. It must not be constructed on the server — a single process-wide instance would leak tokens between HTTP requests. Wrap any code path that constructs this in "use client".`)}get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}delete(e){localStorage.removeItem(e)}subscribe(e){let t=t=>{t.key!==null&&e(t.key,t.newValue)};return window.addEventListener(`storage`,t),()=>{window.removeEventListener(`storage`,t)}}},Vp=(0,y.createContext)(null);function Hp({browser:e,storage:t,sessionFactory:n,children:r}){let i=(0,y.useMemo)(()=>e??pl({storage:t??new Bp,sessionFactory:n??dl()}),[e,t,n]);return(0,I.jsx)(Vp.Provider,{value:i,children:r})}function Up(){let e=(0,y.useContext)(Vp);if(!e)throw Error(`useSemiont must be used within a <SemiontProvider>`);return e}var Wp={success:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}),error:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})}),warning:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`})}),info:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})})};function Gp({toast:e,onClose:t}){return(0,y.useEffect)(()=>{let n=setTimeout(()=>{t(e.id)},e.duration||3e3);return()=>clearTimeout(n)},[e,t]),(0,I.jsxs)(`div`,{className:`semiont-toast`,"data-variant":e.type,role:`alert`,children:[(0,I.jsx)(`div`,{className:`semiont-toast-icon-wrapper`,children:Wp[e.type]}),(0,I.jsx)(`p`,{className:`semiont-toast-message`,children:e.message}),(0,I.jsx)(`button`,{onClick:()=>t(e.id),className:`semiont-toast-close`,"aria-label":`Close`,children:(0,I.jsx)(`svg`,{className:`semiont-toast-close-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})})]})}function Kp({toasts:e,onClose:t}){let[n,r]=(0,y.useState)(!1);return(0,y.useEffect)(()=>(r(!0),()=>r(!1)),[]),n?(0,jl.createPortal)((0,I.jsx)(`div`,{className:`semiont-toast-container`,children:e.map(e=>(0,I.jsx)(Gp,{toast:e,onClose:t},e.id))}),document.body):null}var qp=y.createContext(void 0);function Jp({children:e}){let[t,n]=(0,y.useState)([]),r=y.useCallback((e,t=`info`,r)=>{let i=Date.now().toString(),a=r===void 0?{id:i,message:e,type:t}:{id:i,message:e,type:t,duration:r};n(e=>[...e,a])},[]),i=y.useCallback((e,t)=>r(e,`success`,t),[r]),a=y.useCallback((e,t)=>r(e,`error`,t),[r]),o=y.useCallback((e,t)=>r(e,`warning`,t),[r]),s=y.useCallback((e,t)=>r(e,`info`,t),[r]),c=y.useCallback(e=>{n(t=>t.filter(t=>t.id!==e))},[]),l=y.useMemo(()=>({showToast:r,showSuccess:i,showError:a,showWarning:o,showInfo:s}),[r,i,a,o,s]);return(0,I.jsxs)(qp.Provider,{value:l,children:[e,(0,I.jsx)(Kp,{toasts:t,onClose:c})]})}function Yp(){let e=y.useContext(qp);if(e===void 0)throw Error(`useToast must be used within a ToastProvider`);return e}var Xp={close:`Close`,codeLoading:`Loading…`,codeAnalyzing:`Marking…`,codeAnalyzingTags:`Marking tags…`,codeDetectingEntities:`Marking…`,codeCreatingAnnotations:`Creating {{count}} annotations…`,codeCreatingTagAnnotations:`Creating {{count}} tags…`,codeCompleteCreated:`Created {{count}} {{kind}}`,codeGeneratingResource:`Generating…`,codeCreatingResource:`Creating the resource…`,codeCompleteGenerated:`Created the resource`,codeCompleteGeneratedTruncated:`Created the resource — cut off at the length limit`,kindHighlight:`highlights`,kindComment:`comments`,kindAssessment:`assessments`,kindReference:`references`,kindTag:`tags`,subject:`{{kind}}: {{label}}`,subjectWithPosition:`{{kind}}: {{label}} ({{done}} of {{total}})`,paramEntityTypes:`Entity Types`,paramInstructions:`Instructions`,paramTone:`Tone`,paramDensity:`Density`,subjectKindEntityType:`Entity type`,subjectKindCategory:`Category`,cancel:`Cancel`,inProgress:`Annotating...`},Zp={loadFailed:`Failed to load PDF`,loading:`Loading PDF...`,next:`Next`,pageLoadFailed:`Failed to load page`,pageOf:`Page {{page}} of {{total}}`,pagination:`Page navigation`,previous:`Previous`,viewerLoading:`Loading PDF viewer...`},Qp={annotations:`Annotations`,history:`History`,resourceInfo:`Resource Info`,collaboration:`Collaboration`,userAccount:`User Account`,settings:`Settings`,knowledgeBase:`Knowledge Base`},$p={title:`Resource Info`,locale:`Locale`,notSpecified:`Not specified`,entityTypeTags:`Entity Type Tags`,representation:`Representation`,mediaType:`Media Type`,byteSize:`Size`,storageUri:`Storage`,clone:`Clone`,cloneDescription:`Generate a shareable clone link for this resource`,generate:`Generate`,generateDescription:`Generate a new resource from this one's context`,archive:`Archive`,archiveDescription:`Move this resource to archived status`,unarchive:`Unarchive`,unarchiveDescription:`Restore this resource to active status`,provenance:`Provenance`,createdAt:`Created`,modifiedAt:`Modified`,attributedTo:`Attributed to`,derivedFrom:`Derived from`},em={title:`Collaboration`,connectionStatus:`Connection Status`,live:`Live`,disconnected:`Disconnected`,events:`{{count}} events`,lastSync:`Last sync:`,noActivity:`No activity yet`,justNow:`Just now`,secondsAgo:`{{count}} seconds ago`,minuteAgo:`1 minute ago`,minutesAgo:`{{count}} minutes ago`,hourAgo:`1 hour ago`,hoursAgo:`{{count}} hours ago`,realtimeActive:`Real-time updates are active`,reconnecting:`Reconnecting to server...`,sharing:`Sharing`,collaborationComingSoon:`Collaboration features coming soon`,collaborators:`Collaborators`,ceilings:`{{contextTokens}} in / {{maxOutputTokens}} out`,sharedWindow:`{{contextTokens}} window`},tm={history:`History`,loading:`Loading...`,user:`User`,viewOriginal:`View original`,viewAnnotation:`View annotation: {{content}}`,resourceCreated:`Created Resource`,resourceCloned:`Cloned`,resourceArchived:`Archived`,resourceUnarchived:`Unarchived`,highlightAdded:`Highlight Added`,highlightRemoved:`Highlight Removed`,referenceCreated:`Reference Created`,referenceResolved:`Reference Resolved`,referenceDeleted:`Reference Deleted`,entitytagAdded:`Tag Added`,entitytagRemoved:`Tag Removed`,assessmentAdded:`Assessment Added`,assessmentRemoved:`Assessment Removed`,annotationAdded:`Annotation Added`,annotationRemoved:`Annotation Removed`,annotationBodyUpdated:`Annotation Updated`,jobEvent:`Job Event`,embeddingComputed:`Embedding Computed`,justNow:`just now`,minutesAgo:`{{count}}m ago`,hoursAgo:`{{count}}h ago`,daysAgo:`{{count}}d ago`,failed:`Could not load history.`,retry:`Try again`},nm={title:`Comments`,noComments:`No comments yet. Select text and click Comment to add one.`,commentPlaceholder:`Type your comment here...`,save:`Save`,cancel:`Cancel`,edit:`Edit`,annotateComments:`Annotate Comments`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Focus on technical terminology...`,annotate:`Annotate`,annotating:`Annotating...`,toneLabel:`Tone`,toneOptional:`(optional)`,toneScholarly:`Scholarly`,toneExplanatory:`Explanatory`,toneConversational:`Conversational`,toneTechnical:`Technical`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},rm={title:`Highlights`,noHighlights:`No highlights yet. Use AI annotation to find important passages.`,annotateHighlights:`Annotate Highlights`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Focus on key technical concepts...`,annotate:`Annotate`,annotating:`Annotating...`,cancel:`Cancel`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},im={title:`Assessments`,noAssessments:`No assessments yet. Use AI annotation to evaluate passages.`,assessmentPlaceholder:`Type your assessment here...`,save:`Save`,cancel:`Cancel`,annotateAssessments:`Annotate Assessments`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Evaluate claims for accuracy and evidence...`,annotate:`Annotate`,annotating:`Annotating...`,toneLabel:`Tone`,toneOptional:`(optional)`,toneAnalytical:`Analytical`,toneCritical:`Critical`,toneBalanced:`Balanced`,toneConstructive:`Constructive`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},am={title:`Tags`,noTags:`No tags yet. Use AI annotation to identify structural roles.`,noSchemas:"No tag schemas registered for this knowledge base. A KB administrator must register at least one structural-analysis schema (e.g. via the `register-tag-schemas` skill) before tagging can be used.",annotateTags:`Annotate Tags`,selectSchema:`Select Framework`,selectCategories:`Select Categories`,annotate:`Annotate`,annotating:`Annotating...`,cancel:`Cancel`,selectAll:`Select All`,deselectAll:`Deselect All`,categoriesSelected:`{count, plural, =0 {No categories selected} =1 {1 category selected} other {# categories selected}}`,createTagForSelection:`Create Tag for Selection`,selectCategory:`Select Category`,chooseCategory:`Choose a category...`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`},om={title:`Annotations`,statistics:`Statistics`,highlight:`Highlights`,reference:`References`,assessment:`Assessments`,comment:`Comments`,tag:`Tags`,annotationsFailed:`Could not load annotations.`,retry:`Try again`},sm={title:`Statistics`,highlights:`Highlights`,comments:`Comments`,assessments:`Assessments`,tags:`Tags`,references:`References`,stub:`Stub`,resolved:`Resolved`,entityTypes:`Entity Types`},cm={title:`References`,noReferences:`No references yet. Select text to create references to other resources.`,outgoingReferences:`Outgoing References`,incomingReferences:`Incoming References`,noIncomingReferences:`No incoming references`,stub:`Stub reference (not linked)`,resolved:`Resolved reference (linked)`,derived:`Derived`,open:`Open`,unlink:`Unlink`,resolve:`Resolve Reference`,cancel:`Cancel`,createReference:`Create Reference`,entityTypesOptional:`Entity Types (Optional)`,fragmentSelected:`Fragment selected`,annotateReferences:`Annotate References`,selectEntityTypes:`Entity types:`,select:`Select`,deselect:`Deselect`,noEntityTypes:`No entity types available`,typesSelected:`{count, plural, =1 {1 type selected} other {# types selected}}`,annotate:`Annotate`,annotating:`Annotating...`,includeDescriptiveReferences:`Include descriptive references`,descriptiveReferencesTooltip:`Also find phrases like 'the CEO', 'the tech giant', 'the physicist' (in addition to names)`,found:`{{count}} found`,complete:`Annotation complete!`,failed:`Annotation failed`,current:`Current: {{entityType}}`,loading:`loading...`,loadingEllipsis:`Loading...`,untitledResource:`Untitled Resource`,noText:`No text`,incomingReferencesFailed:`Could not load incoming references.`,retry:`Try again`,entityTypesFailed:`Could not load entity types.`},lm={title:`Keyboard Shortcuts`,closeDialog:`Close dialog`,or:`or`,navigationTitle:`Navigation`,navOpenSearch:`Open global search`,navOpenSearchAlt:`Open global search (alternative)`,navCreateResource:`Create new resource`,navCloseOverlays:`Close all overlays (double press)`,navShowHelp:`Show keyboard shortcuts help`,sidebarTitle:`Knowledge Sidebar`,sidebarCollapse:`Collapse sidebar`,sidebarExpand:`Expand sidebar`,sidebarPickup:`Pick up resource tab (when focused)`,sidebarMove:`Move resource tab (when dragging)`,sidebarDrop:`Drop resource tab (when dragging)`,sidebarCancel:`Cancel drag operation`,annotationsTitle:`Resource Annotations`,annotHighlight:`Create highlight from annotation (direct)`,annotReference:`Open reference popup for annotation`,annotDelete:`Delete focused annotation`,annotNavigate:`Navigate through annotations`,annotNavigateBack:`Navigate annotations backward`,listsTitle:`Lists & Grids`,listsFilterNav:`Navigate entity type filters`,listsGridNav:`Navigate resource grid`,listsJumpFirst:`Jump to first item`,listsJumpLast:`Jump to last item`,searchModalTitle:`In Search Modal`,searchNav:`Navigate search results`,searchSelect:`Select result`,searchClose:`Close search`,modalTitle:`Modal Controls`,modalClose:`Close active modal`,modalNavForward:`Navigate forward through buttons`,modalNavBackward:`Navigate backward through buttons`,modalActivate:`Activate focused button`,accessibilityTitle:`Accessibility`,a11ySkipLinks:`Navigate to skip links (when at page start)`,a11yFollowLink:`Follow skip link`,macNote:`Using Mac keyboard shortcuts. ⌘ is the Command key.`,windowsNote:`Using Windows/Linux keyboard shortcuts. Ctrl is the Control key.`,footerHint:`Press {{key}} anytime to show this help`,close:`Close`},um={modeGroup:`Mode`,browse:`Browse`,annotate:`Annotate`,selectionGroup:`Motivation`,clickGroup:`Click`,shapeGroup:`Shape`,none:`None`,linking:`Reference`,highlighting:`Highlight`,assessing:`Assess`,commenting:`Comment`,tagging:`Tag`,detail:`Detail`,follow:`Follow`,deleting:`Delete`,jsonld:`JSON-LD`,rectangle:`Rectangle`,circle:`Circle`,polygon:`Polygon`},dm={title:`Navigation`,collapseSidebar:`Collapse sidebar`,expandSidebar:`Expand sidebar`,dragToReorder:`Drag to reorder`,dragToReorderDoc:`Drag to reorder {{name}}`,closeResource:`Close resource`,dragInstructions:`To reorder resources: Use Tab to navigate to a resource. Press Alt+Up arrow to move up or Alt+Down arrow to move down. For drag and drop: Press space bar to pick up the item. Use arrow keys to move it. Press space bar again to drop.`},fm={deleteConfirmationTitle:`Delete Annotation`,deleteConfirmationMessage:`Are you sure you want to delete this annotation? This action cannot be undone.`,deleteConfirmationCancel:`Cancel`,deleteConfirmationDelete:`Delete`},pm={title:`Settings`,lineNumbers:`Line Numbers`,lineNumbersVisible:`Visible`,lineNumbersHidden:`Hidden`,theme:`Theme`,themeLight:`Light`,themeDark:`Dark`,themeSystem:`System`,themeSystemActive:`System ({{mode}})`,themeModeActive:`Using {{mode}} mode`,language:`Language`,languageHint:`Change language in the main navigation`,languageChanging:`Changing language...`,hoverDelay:`Hover Delay`,hoverDelayFast:`Fast`,hoverDelaySlow:`Slow`,hoverDelayDescription:`{{delay}}ms delay before hover effects appear`},mm={},hm={gatherIntro:`Choose what to include in the gathered context.`,includeContent:`Include resource content`,includeSummary:`Include summary`,gatherDepth:`Depth`,gatherMaxResources:`Max resources`,gatherButton:`Gather`,editGather:`Change gather settings`,recallLabel:`Included in recall — deselect to exclude`,loadingContext:`Gathering context...`,failedContext:`Failed to gather context`,sourceContextLabel:`Resource`,connectionsLabel:`Connections`,citedByLabel:`Cited by`,resourceTitle:`New resource title`,resourceTitlePlaceholder:`Title for the generated resource...`,additionalInstructions:`Additional Instructions`,additionalInstructionsPlaceholder:`Optional guidance for the generation...`,language:`Language`,languageHelp:`Language for the generated resource`,creativity:`Creativity`,creativityFocused:`Focused`,creativityCreative:`Creative`,maxLength:`Max Length`,maxLengthHelp:`Maximum number of tokens`,generate:`Generate`,maxLengthCeiling:`Limited to {{maxOutputTokens}} tokens by {{model}}.`,outputFormat:`Format`,formatExtensionMismatch:`Save location must end in {{extension}} to match the selected format.`,graphPaneTitle:`Neighborhood`,graphEmpty:`No links yet.`,resourceLinkLabel:`Resource link`,corpusPaneTitle:`Similar passages`,corpusEmpty:`No similar passages found.`,excludedReceipt:`{{types}} excluded from this recall`,machineRead:`OCR`,score:`Score`,saveLocation:`Save location`,discardDraftPrompt:`Discard this draft?`,discardDraft:`Discard`,keepEditing:`Keep editing`,title:`Generate from this Resource`},gm={sourceContextLabel:`Annotation context in resource`,connectionsLabel:`Peer Annotations`,citedByLabel:`Resource Cited By`,userHintLabel:`Hint`,userHintPlaceholder:`Describe what this annotation refers to...`,loadingContext:`Gathering context...`,failedContext:`Failed to gather context`,generate:`Generate`,compose:`Compose`,resolutionStrategyLabel:`Resolution Strategy`,back:`Back`,link:`Link`,score:`Score`,noResults:`No results found`,resourceTitle:`Resource Title`,resourceTitlePlaceholder:`Enter resource title...`,additionalInstructions:`Additional Instructions`,additionalInstructionsPlaceholder:`Enter additional instructions...`,language:`Language`,languageHelp:`Language for generated content`,creativity:`Creativity`,creativityFocused:`Focused`,creativityCreative:`Creative`,maxLength:`Max Length`,maxLengthHelp:`Maximum number of tokens`,maxResults:`Max Results`,semanticScoring:`Semantic Scoring`,semanticScoringHelp:`Use AI to score results by semantic relevance`,searching:`Searching...`,searchFailed:`Search failed`,search:`Search`,maxLengthCeiling:`Limited to {{maxOutputTokens}} tokens by {{model}}.`,outputFormat:`Format`,formatExtensionMismatch:`Save location must end in {{extension}} to match the selected format.`,graphPaneTitle:`Neighborhood`,graphEmpty:`No links yet — resolving this reference creates the first.`,resourceLinkLabel:`Resource link`,corpusPaneTitle:`Similar passages`,corpusEmpty:`No similar passages found — Search is unlikely to land.`,excludedReceipt:`{{types}} excluded from this recall`,machineRead:`OCR`,userHintEffect:`steers Search and Generate`,saveLocation:`Save location`,entityTypes:`Entity types`,contentLabel:`Content`,createAndLink:`Create & Link`,creatingAndLinking:`Creating & linking…`,discardDraftPrompt:`Discard this draft?`,discardDraft:`Discard`,keepEditing:`Keep editing`,resolveTitle:`Resolve Reference`},_m={createFailed:`Couldn’t create the annotation: {{detail}}`,deleteFailed:`Couldn’t delete the annotation: {{detail}}`,referenceUpdateFailed:`Couldn’t update the reference: {{detail}}`,unknownError:`unknown error`,assistQuiet:`Still working — no update from the annotation job for a few minutes`,resourceCreatedNamed:`Created “{{name}}”`,resourceCreated:`Resource created`,annotationComplete:`Annotation complete`,annotationFailed:`Annotation failed`,generationFailed:`Generation failed: {{detail}}`,"decline_no-text-layer":`This PDF is a scan whose text couldn’t be recognized, so there’s nothing to annotate.`,decline_encrypted:`This PDF is password-protected, so its text can’t be read.`,decline_corrupt:`This PDF couldn’t be read — the file may be damaged.`,"decline_too-large":`This document is too large to extract text from.`,decline_empty:`This document has no text to annotate.`},vm={AssistProgress:Xp,PdfViewer:Zp,Toolbar:Qp,ResourceInfoPanel:$p,CollaborationPanel:em,AnnotationHistory:tm,CommentsPanel:nm,HighlightPanel:rm,AssessmentPanel:im,TaggingPanel:am,UnifiedAnnotationsPanel:om,StatisticsPanel:sm,ReferencesPanel:cm,KeyboardShortcuts:lm,AnnotateToolbar:um,CollapsibleResourceNavigation:dm,ResourceViewer:fm,Settings:pm,AnnotateView:mm,ResourceGenerate:hm,ReferenceWizard:gm,OutcomeToasts:_m},ym=Te({"../../translations/ar.json":()=>s(()=>import(`./ar-AZBRADEB-CvnkaLQS.js`),[]),"../../translations/bn.json":()=>s(()=>import(`./bn-CCEW6AOS-BCI1FG86.js`),[]),"../../translations/cs.json":()=>s(()=>import(`./cs-HXPF2CTE-CbMUDpDp.js`),[]),"../../translations/da.json":()=>s(()=>import(`./da-K5NTK7LH-D2rWDXq3.js`),[]),"../../translations/de.json":()=>s(()=>import(`./de-GMRQEDZI-CVlSEip_.js`),[]),"../../translations/el.json":()=>s(()=>import(`./el-EUB4CI4G-C80i0753.js`),[]),"../../translations/en.json":()=>s(()=>import(`./en-R5XA26NF-Cuox0uQn.js`),[]),"../../translations/es.json":()=>s(()=>import(`./es-Z32DAZ6W-D7UTS3Fx.js`),[]),"../../translations/fa.json":()=>s(()=>import(`./fa-G7HN6B32-DdDi1TG_.js`),[]),"../../translations/fi.json":()=>s(()=>import(`./fi-3YBLZO7I-B3OjL1PQ.js`),[]),"../../translations/fr.json":()=>s(()=>import(`./fr-VUBH7BBS-CjoeoL9n.js`),[]),"../../translations/he.json":()=>s(()=>import(`./he-WQQEY26B-2RRJq7To.js`),[]),"../../translations/hi.json":()=>s(()=>import(`./hi-HJZ6W4JB-DPflxelg.js`),[]),"../../translations/id.json":()=>s(()=>import(`./id-ZOGZ37MI-Dd4wSvWi.js`),[]),"../../translations/it.json":()=>s(()=>import(`./it-DT6UW66F-B7ZzCBm1.js`),[]),"../../translations/ja.json":()=>s(()=>import(`./ja-RUKQCOLO-Br1kLTUs.js`),[]),"../../translations/ko.json":()=>s(()=>import(`./ko-ZH5ADKZM-8IO4IU-2.js`),[]),"../../translations/ms.json":()=>s(()=>import(`./ms-Y2AFPZTU-q4v04hSa.js`),[]),"../../translations/nl.json":()=>s(()=>import(`./nl-OQEWIXNA-DiHanxnO.js`),[]),"../../translations/no.json":()=>s(()=>import(`./no-KPAYJZWY-DdGouMG_.js`),[]),"../../translations/pl.json":()=>s(()=>import(`./pl-WSXK2UUD-DK_ieA8X.js`),[]),"../../translations/pt.json":()=>s(()=>import(`./pt-NWRJRUCK-I6-gHOkB.js`),[]),"../../translations/ro.json":()=>s(()=>import(`./ro-3CGVMOC6-wdwqXMaO.js`),[]),"../../translations/sv.json":()=>s(()=>import(`./sv-HGSEBA7S-2KvJx_dY.js`),[]),"../../translations/th.json":()=>s(()=>import(`./th-NZ4G352Z-ZMBwAbgb.js`),[]),"../../translations/tr.json":()=>s(()=>import(`./tr-LGGS4DLW-BwMx3CfM.js`),[]),"../../translations/uk.json":()=>s(()=>import(`./uk-AIX536L4-cREJjolM.js`),[]),"../../translations/vi.json":()=>s(()=>import(`./vi-V6CVQZLQ-CXAniXLX.js`),[]),"../../translations/zh.json":()=>s(()=>import(`./zh-AGKPGI3L-MsKTx_dK.js`),[])}),bm=(0,y.createContext)(null),xm=new Map;function Sm(e,t){let n=e.match(/\{(\w+),\s*plural,\s*/);if(!n)return e;let r=t[n[1]];if(r===void 0)return e;let i=n[0].length,a=1,o=i;for(let t=i;t<e.length;t++)if(e[t]===`{`)a++;else if(e[t]===`}`&&(a--,a===0)){o=t;break}let s=e.substring(i,o),c={},l=/(?:=(\d+)|(\w+))\s*\{([^}]+)\}/g,u;for(;(u=l.exec(s))!==null;){let[,e,t,n]=u,r=e===void 0?t:`=${e}`;c[r]=n}let d=c[`=${r}`];if(d!==void 0){let t=d.replace(/#/g,String(r));return e.substring(0,n.index)+t+e.substring(o+1)}let f=c.other;if(f!==void 0){let t=f.replace(/#/g,String(r));return e.substring(0,n.index)+t+e.substring(o+1)}return e}async function Cm(e){if(xm.has(e))return xm.get(e);if(e===`en`)return xm.set(`en`,vm),vm;try{let t=await ym(`../../translations/${e}.json`),n=t.default||t;return xm.set(e,n),n}catch(t){return console.error(`Failed to load translations for locale: ${e}`,t),vm}}var wm={t:(e,t,n)=>{let r=vm[e]?.[t];if(!r)return console.warn(`Translation not found for ${e}.${t}`),`${e}.${t}`;if(n&&typeof r==`string`){let e=r;return e=Sm(e,n),Object.entries(n).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return r}};function Tm({translationManager:e,locale:t,loadingComponent:n=null,children:r}){let[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{t&&!e&&(s(!0),Cm(t).then(e=>{a(e),s(!1)}).catch(e=>{console.error(`Failed to load translations:`,e),a(vm),s(!1)}))},[t,e]);let c=(0,y.useMemo)(()=>i?{t:(e,n,r)=>{let a=i[e]?.[n];if(!a)return console.warn(`Translation not found for ${e}.${n} in locale ${t}`),`${e}.${n}`;if(r&&typeof a==`string`){let e=a;return e=Sm(e,r),Object.entries(r).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return a}}:null,[i,t]);return e?(0,I.jsx)(bm.Provider,{value:e,children:r}):t&&o?(0,I.jsx)(I.Fragment,{children:n}):t&&c?(0,I.jsx)(bm.Provider,{value:c,children:r}):(0,I.jsx)(bm.Provider,{value:wm,children:r})}function Em(e){let t=(0,y.useContext)(bm);return t?(n,r)=>t.t(e,n,r):(t,n)=>{let r=vm[e]?.[t];if(!r)return console.warn(`Translation not found for ${e}.${t}`),`${e}.${t}`;if(n&&typeof r==`string`){let e=r;return e=Sm(e,n),Object.entries(n).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return r}}var Dm={colors:{primary:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#0080ff`,600:`#0066cc`,700:`#0052a3`,800:`#1e40af`,900:`#1e3a8a`},secondary:{50:`#f0fffe`,100:`#e0fffd`,200:`#b3fffa`,300:`#66fff6`,400:`#1afff1`,500:`#00ffff`,600:`#00cccc`,700:`#00a3a3`,800:`#007a7a`,900:`#005252`},semantic:{error:`#ef4444`,errorLight:`#fca5a5`,errorDark:`#b91c1c`,warning:`#f59e0b`,warningLight:`#fcd34d`,warningDark:`#d97706`,success:`#10b981`,successLight:`#6ee7b7`,successDark:`#047857`,info:`#3b82f6`,infoLight:`#93c5fd`,infoDark:`#1d4ed8`},neutral:{0:`#ffffff`,50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`,1e3:`#000000`},background:{primary:`#ffffff`,secondary:`#f9fafb`,tertiary:`#f3f4f6`,inverse:`#111827`},text:{primary:`#111827`,secondary:`#4b5563`,tertiary:`#6b7280`,disabled:`#9ca3af`,inverse:`#ffffff`}},spacing:{0:`0`,xs:`0.25rem`,sm:`0.5rem`,md:`1rem`,lg:`1.5rem`,xl:`2rem`,"2xl":`2.5rem`,"3xl":`3rem`,"4xl":`4rem`,"5xl":`5rem`},typography:{fontFamily:{sans:`Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`,mono:`JetBrains Mono, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`,"5xl":`3rem`},fontWeight:{thin:100,light:300,normal:400,medium:500,semibold:600,bold:700,black:900},lineHeight:{none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2}},borderRadius:{none:`0`,sm:`0.125rem`,base:`0.25rem`,md:`0.375rem`,lg:`0.5rem`,xl:`0.75rem`,"2xl":`1rem`,"3xl":`1.5rem`,full:`9999px`},shadows:{none:`none`,xs:`0 1px 2px 0 rgb(0 0 0 / 0.05)`,sm:`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,base:`0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`,md:`0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`,lg:`0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`,xl:`0 25px 50px -12px rgb(0 0 0 / 0.25)`,inner:`inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`},transitions:{duration:{fast:`150ms`,base:`250ms`,slow:`350ms`,slower:`500ms`},timing:{linear:`linear`,ease:`cubic-bezier(0.4, 0, 0.2, 1)`,easeIn:`cubic-bezier(0.4, 0, 1, 1)`,easeOut:`cubic-bezier(0, 0, 0.2, 1)`,easeInOut:`cubic-bezier(0.4, 0, 0.2, 1)`}},breakpoints:{sm:`640px`,md:`768px`,lg:`1024px`,xl:`1280px`,"2xl":`1536px`}};function Om(){let e=[`:root {`];return Object.entries(Dm.colors.primary).forEach(([t,n])=>{e.push(` --semiont-color-primary-${t}: ${n};`)}),Object.entries(Dm.colors.secondary).forEach(([t,n])=>{e.push(` --semiont-color-secondary-${t}: ${n};`)}),Object.entries(Dm.colors.semantic).forEach(([t,n])=>{e.push(` --semiont-color-${t.toLowerCase().replace(/([A-Z])/g,`-$1`).toLowerCase()}: ${n};`)}),Object.entries(Dm.colors.neutral).forEach(([t,n])=>{e.push(` --semiont-color-neutral-${t}: ${n};`)}),Object.entries(Dm.spacing).forEach(([t,n])=>{e.push(` --semiont-spacing-${t}: ${n};`)}),Object.entries(Dm.typography.fontSize).forEach(([t,n])=>{e.push(` --semiont-text-${t}: ${n};`)}),Object.entries(Dm.typography.fontWeight).forEach(([t,n])=>{e.push(` --semiont-font-${t}: ${n};`)}),e.push(` --semiont-font-sans: ${Dm.typography.fontFamily.sans};`),e.push(` --semiont-font-mono: ${Dm.typography.fontFamily.mono};`),Object.entries(Dm.borderRadius).forEach(([t,n])=>{e.push(` --semiont-radius-${t}: ${n};`)}),Object.entries(Dm.shadows).forEach(([t,n])=>{e.push(` --semiont-shadow-${t}: ${n};`)}),Object.entries(Dm.transitions.duration).forEach(([t,n])=>{e.push(` --semiont-duration-${t}: ${n};`)}),e.push(`}`),e.join(`
9
+ `):``,this.name=`UnsubscriptionError`,this.errors=t}})}}),Fl=L({"../../node_modules/rxjs/dist/cjs/internal/util/arrRemove.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.arrRemove=void 0;function t(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}e.arrRemove=t}}),Il=L({"../../node_modules/rxjs/dist/cjs/internal/Subscription.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},n=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},r=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.isSubscription=e.EMPTY_SUBSCRIPTION=e.Subscription=void 0;var i=Ml(),a=Pl(),o=Fl(),s=(function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,o,s,c,u;if(!this.closed){this.closed=!0;var d=this._parentage;if(d){if(this._parentage=null,Array.isArray(d))try{for(var f=t(d),p=f.next();!p.done;p=f.next())p.value.remove(this)}catch(t){e={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(e)throw e.error}}else d.remove(this)}var m=this.initialTeardown;if(i.isFunction(m))try{m()}catch(e){u=e instanceof a.UnsubscriptionError?e.errors:[e]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var g=t(h),_=g.next();!_.done;_=g.next()){var v=_.value;try{l(v)}catch(e){u??=[],e instanceof a.UnsubscriptionError?u=r(r([],n(u)),n(e.errors)):u.push(e)}}}catch(e){s={error:e}}finally{try{_&&!_.done&&(c=g.return)&&c.call(g)}finally{if(s)throw s.error}}}if(u)throw new a.UnsubscriptionError(u)}},e.prototype.add=function(t){if(t&&t!==this){if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&o.arrRemove(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&o.arrRemove(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();e.Subscription=s,e.EMPTY_SUBSCRIPTION=s.EMPTY;function c(e){return e instanceof s||e&&`closed`in e&&i.isFunction(e.remove)&&i.isFunction(e.add)&&i.isFunction(e.unsubscribe)}e.isSubscription=c;function l(e){i.isFunction(e)?e():e.unsubscribe()}}}),Ll=L({"../../node_modules/rxjs/dist/cjs/internal/config.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.config=void 0,e.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}}}),Rl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/timeoutProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutProvider=void 0,e.timeoutProvider={setTimeout:function(r,i){var a=[...arguments].slice(2),o=e.timeoutProvider.delegate;return o?.setTimeout?o.setTimeout.apply(o,n([r,i],t(a))):setTimeout.apply(void 0,n([r,i],t(a)))},clearTimeout:function(t){return(e.timeoutProvider.delegate?.clearTimeout||clearTimeout)(t)},delegate:void 0}}}),zl=L({"../../node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportUnhandledError=void 0;var t=Ll(),n=Rl();function r(e){n.timeoutProvider.setTimeout(function(){var n=t.config.onUnhandledError;if(n)n(e);else throw e})}e.reportUnhandledError=r}}),Bl=L({"../../node_modules/rxjs/dist/cjs/internal/util/noop.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.noop=void 0;function t(){}e.noop=t}}),Vl=L({"../../node_modules/rxjs/dist/cjs/internal/NotificationFactories.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createNotification=e.nextNotification=e.errorNotification=e.COMPLETE_NOTIFICATION=void 0,e.COMPLETE_NOTIFICATION=(function(){return r(`C`,void 0,void 0)})();function t(e){return r(`E`,void 0,e)}e.errorNotification=t;function n(e){return r(`N`,e,void 0)}e.nextNotification=n;function r(e,t,n){return{kind:e,value:t,error:n}}e.createNotification=r}}),Hl=L({"../../node_modules/rxjs/dist/cjs/internal/util/errorContext.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.captureError=e.errorContext=void 0;var t=Ll(),n=null;function r(e){if(t.config.useDeprecatedSynchronousErrorHandling){var r=!n;if(r&&(n={errorThrown:!1,error:null}),e(),r){var i=n,a=i.errorThrown,o=i.error;if(n=null,a)throw o}}else e()}e.errorContext=r;function i(e){t.config.useDeprecatedSynchronousErrorHandling&&n&&(n.errorThrown=!0,n.error=e)}e.captureError=i}}),Ul=L({"../../node_modules/rxjs/dist/cjs/internal/Subscriber.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_OBSERVER=e.SafeSubscriber=e.Subscriber=void 0;var n=Ml(),r=Il(),i=Ll(),a=zl(),o=Bl(),s=Vl(),c=Rl(),l=Hl(),u=(function(n){t(i,n);function i(t){var i=n.call(this)||this;return i.isStopped=!1,t?(i.destination=t,r.isSubscription(t)&&t.add(i)):i.destination=e.EMPTY_OBSERVER,i}return i.create=function(e,t,n){return new m(e,t,n)},i.prototype.next=function(e){this.isStopped?_(s.nextNotification(e),this):this._next(e)},i.prototype.error=function(e){this.isStopped?_(s.errorNotification(e),this):(this.isStopped=!0,this._error(e))},i.prototype.complete=function(){this.isStopped?_(s.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},i.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},i.prototype._next=function(e){this.destination.next(e)},i.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},i.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},i})(r.Subscription);e.Subscriber=u;var d=Function.prototype.bind;function f(e,t){return d.call(e,t)}var p=(function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){h(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){h(e)}else h(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){h(e)}},e})(),m=(function(e){t(r,e);function r(t,r,a){var o=e.call(this)||this,s;if(n.isFunction(t)||!t)s={next:t??void 0,error:r??void 0,complete:a??void 0};else{var c;o&&i.config.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&f(t.next,c),error:t.error&&f(t.error,c),complete:t.complete&&f(t.complete,c)}):s=t}return o.destination=new p(s),o}return r})(u);e.SafeSubscriber=m;function h(e){i.config.useDeprecatedSynchronousErrorHandling?l.captureError(e):a.reportUnhandledError(e)}function g(e){throw e}function _(e,t){var n=i.config.onStoppedNotification;n&&c.timeoutProvider.setTimeout(function(){return n(e,t)})}e.EMPTY_OBSERVER={closed:!0,next:o.noop,error:g,complete:o.noop}}}),Wl=L({"../../node_modules/rxjs/dist/cjs/internal/symbol/observable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observable=void 0,e.observable=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})()}}),Gl=L({"../../node_modules/rxjs/dist/cjs/internal/util/identity.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.identity=void 0;function t(e){return e}e.identity=t}}),Kl=L({"../../node_modules/rxjs/dist/cjs/internal/util/pipe.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pipeFromArray=e.pipe=void 0;var t=Gl();function n(){return r([...arguments])}e.pipe=n;function r(e){return e.length===0?t.identity:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}e.pipeFromArray=r}}),ql=L({"../../node_modules/rxjs/dist/cjs/internal/Observable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var t=Ul(),n=Il(),r=Wl(),i=Kl(),a=Ll(),o=Ml(),s=Hl();e.Observable=(function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,n,r){var i=this,a=u(e)?e:new t.SafeSubscriber(e,n,r);return s.errorContext(function(){var e=i,t=e.operator,n=e.source;a.add(t?t.call(a,n):n?i._subscribe(a):i._trySubscribe(a))}),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,n){var r=this;return n=c(n),new n(function(n,i){var a=new t.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),a.unsubscribe()}},error:i,complete:n});r.subscribe(a)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[r.observable]=function(){return this},e.prototype.pipe=function(){var e=[...arguments];return i.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return e=c(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e})();function c(e){return e??a.config.Promise??Promise}function l(e){return e&&o.isFunction(e.next)&&o.isFunction(e.error)&&o.isFunction(e.complete)}function u(e){return e&&e instanceof t.Subscriber||l(e)&&n.isSubscription(e)}}}),R=L({"../../node_modules/rxjs/dist/cjs/internal/util/lift.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.operate=e.hasLift=void 0;var t=Ml();function n(e){return t.isFunction(e?.lift)}e.hasLift=n;function r(e){return function(t){if(n(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}e.operate=r}}),z=L({"../../node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.OperatorSubscriber=e.createOperatorSubscriber=void 0;var n=Ul();function r(e,t,n,r,a){return new i(e,t,n,r,a)}e.createOperatorSubscriber=r;var i=(function(e){t(n,e);function n(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},n})(n.Subscriber);e.OperatorSubscriber=i}}),Jl=L({"../../node_modules/rxjs/dist/cjs/internal/operators/refCount.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.refCount=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){var r=null;e._refCount++;var i=n.createOperatorSubscriber(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount){r=null;return}var n=e._connection,i=r;r=null,n&&(!i||n===i)&&n.unsubscribe(),t.unsubscribe()});e.subscribe(i),i.closed||(r=e.connect())})}e.refCount=r}}),Yl=L({"../../node_modules/rxjs/dist/cjs/internal/observable/ConnectableObservable.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectableObservable=void 0;var n=ql(),r=Il(),i=Jl(),a=z(),o=R();e.ConnectableObservable=(function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,o.hasLift(t)&&(r.lift=t.lift),r}return n.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},n.prototype.getSubject=function(){var e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject},n.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,e?.unsubscribe()},n.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new r.Subscription;var n=this.getSubject();t.add(this.source.subscribe(a.createOperatorSubscriber(n,void 0,function(){e._teardown(),n.complete()},function(t){e._teardown(),n.error(t)},function(){return e._teardown()}))),t.closed&&(this._connection=null,t=r.Subscription.EMPTY)}return t},n.prototype.refCount=function(){return i.refCount()(this)},n})(n.Observable)}}),Xl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/performanceTimestampProvider.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.performanceTimestampProvider=void 0,e.performanceTimestampProvider={now:function(){return(e.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}}}),Zl=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrameProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrameProvider=void 0;var r=Il();e.animationFrameProvider={schedule:function(t){var n=requestAnimationFrame,i=cancelAnimationFrame,a=e.animationFrameProvider.delegate;a&&(n=a.requestAnimationFrame,i=a.cancelAnimationFrame);var o=n(function(e){i=void 0,t(e)});return new r.Subscription(function(){return i?.(o)})},requestAnimationFrame:function(){var r=[...arguments];return(e.animationFrameProvider.delegate?.requestAnimationFrame||requestAnimationFrame).apply(void 0,n([],t(r)))},cancelAnimationFrame:function(){var r=[...arguments];return(e.animationFrameProvider.delegate?.cancelAnimationFrame||cancelAnimationFrame).apply(void 0,n([],t(r)))},delegate:void 0}}}),Ql=L({"../../node_modules/rxjs/dist/cjs/internal/observable/dom/animationFrames.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrames=void 0;var t=ql(),n=Xl(),r=Zl();function i(e){return e?a(e):o}e.animationFrames=i;function a(e){return new t.Observable(function(t){var i=e||n.performanceTimestampProvider,a=i.now(),o=0,s=function(){t.closed||(o=r.animationFrameProvider.requestAnimationFrame(function(n){o=0;var r=i.now();t.next({timestamp:e?r:n,elapsed:r-a}),s()}))};return s(),function(){o&&r.animationFrameProvider.cancelAnimationFrame(o)}})}var o=a()}}),$l=L({"../../node_modules/rxjs/dist/cjs/internal/util/ObjectUnsubscribedError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectUnsubscribedError=void 0,e.ObjectUnsubscribedError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}})}}),eu=L({"../../node_modules/rxjs/dist/cjs/internal/Subject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),n=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.AnonymousSubject=e.Subject=void 0;var r=ql(),i=Il(),a=$l(),o=Fl(),s=Hl(),c=(function(e){t(c,e);function c(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return c.prototype.lift=function(e){var t=new l(this,this);return t.operator=e,t},c.prototype._throwIfClosed=function(){if(this.closed)throw new a.ObjectUnsubscribedError},c.prototype.next=function(e){var t=this;s.errorContext(function(){var r,i;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var a=n(t.currentObservers),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}})},c.prototype.error=function(e){var t=this;s.errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},c.prototype.complete=function(){var e=this;s.errorContext(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},c.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(c.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),c.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},c.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},c.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,a=n.isStopped,s=n.observers;return r||a?i.EMPTY_SUBSCRIPTION:(this.currentObservers=null,s.push(e),new i.Subscription(function(){t.currentObservers=null,o.arrRemove(s,e)}))},c.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},c.prototype.asObservable=function(){var e=new r.Observable;return e.source=this,e},c.create=function(e,t){return new l(e,t)},c})(r.Observable);e.Subject=c;var l=(function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},n.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},n.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},n.prototype._subscribe=function(e){return this.source?.subscribe(e)??i.EMPTY_SUBSCRIPTION},n})(c);e.AnonymousSubject=l}}),tu=L({"../../node_modules/rxjs/dist/cjs/internal/BehaviorSubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.BehaviorSubject=void 0,e.BehaviorSubject=(function(e){t(n,e);function n(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},n})(eu().Subject)}}),nu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/dateTimestampProvider.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dateTimestampProvider=void 0,e.dateTimestampProvider={now:function(){return(e.dateTimestampProvider.delegate||Date).now()},delegate:void 0}}}),ru=L({"../../node_modules/rxjs/dist/cjs/internal/ReplaySubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.ReplaySubject=void 0;var n=eu(),r=nu();e.ReplaySubject=(function(e){t(n,e);function n(t,n,i){t===void 0&&(t=1/0),n===void 0&&(n=1/0),i===void 0&&(i=r.dateTimestampProvider);var a=e.call(this)||this;return a._bufferSize=t,a._windowTime=n,a._timestampProvider=i,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,t),a._windowTime=Math.max(1,n),a}return n.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,o=n._timestampProvider,s=n._windowTime;r||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this,r=n._infiniteTimeWindow,i=n._buffer.slice(),a=0;a<i.length&&!e.closed;a+=r?1:2)e.next(i[a]);return this._checkFinalizedStatuses(e),t},n.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<r.length&&r.splice(0,r.length-a),!i){for(var o=n.now(),s=0,c=1;c<r.length&&r[c]<=o;c+=2)s=c;s&&r.splice(0,s+1)}},n})(n.Subject)}}),iu=L({"../../node_modules/rxjs/dist/cjs/internal/AsyncSubject.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncSubject=void 0,e.AsyncSubject=(function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t._hasValue,i=t._value,a=t.thrownError,o=t.isStopped,s=t._isComplete;n?e.error(a):(o||s)&&(r&&e.next(i),e.complete())},n.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},n.prototype.complete=function(){var t=this,n=t._hasValue,r=t._value;t._isComplete||(this._isComplete=!0,n&&e.prototype.next.call(this,r),e.prototype.complete.call(this))},n})(eu().Subject)}}),au=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/Action.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.Action=void 0,e.Action=(function(e){t(n,e);function n(t,n){return e.call(this)||this}return n.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},n})(Il().Subscription)}}),ou=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/intervalProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.intervalProvider=void 0,e.intervalProvider={setInterval:function(r,i){var a=[...arguments].slice(2),o=e.intervalProvider.delegate;return o?.setInterval?o.setInterval.apply(o,n([r,i],t(a))):setInterval.apply(void 0,n([r,i],t(a)))},clearInterval:function(t){return(e.intervalProvider.delegate?.clearInterval||clearInterval)(t)},delegate:void 0}}}),su=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsyncAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncAction=void 0;var n=au(),r=ou(),i=Fl();e.AsyncAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),r.intervalProvider.setInterval(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&r.intervalProvider.clearInterval(t)},n.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},n.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,a=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,i.arrRemove(a,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n})(n.Action)}}),cu=L({"../../node_modules/rxjs/dist/cjs/internal/util/Immediate.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TestTools=e.Immediate=void 0;var t=1,n,r={};function i(e){return e in r&&(delete r[e],!0)}e.Immediate={setImmediate:function(e){var a=t++;return r[a]=!0,n||=Promise.resolve(),n.then(function(){return i(a)&&e()}),a},clearImmediate:function(e){i(e)}},e.TestTools={pending:function(){return Object.keys(r).length}}}}),lu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/immediateProvider.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.immediateProvider=void 0;var r=cu(),i=r.Immediate.setImmediate,a=r.Immediate.clearImmediate;e.immediateProvider={setImmediate:function(){var r=[...arguments];return(e.immediateProvider.delegate?.setImmediate||i).apply(void 0,n([],t(r)))},clearImmediate:function(t){return(e.immediateProvider.delegate?.clearImmediate||a)(t)},delegate:void 0}}}),uu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsapAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsapAction=void 0;var n=su(),r=lu();e.AsapAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||=r.immediateProvider.setImmediate(t.flush.bind(t,void 0)))},n.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i==null?this.delay>0:i>0)return e.prototype.recycleAsyncId.call(this,t,n,i);var a=t.actions;n!=null&&a[a.length-1]?.id!==n&&(r.immediateProvider.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},n})(n.AsyncAction)}}),du=L({"../../node_modules/rxjs/dist/cjs/internal/Scheduler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Scheduler=void 0;var t=nu();e.Scheduler=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=t.dateTimestampProvider.now,e})()}}),fu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsyncScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncScheduler=void 0;var n=du();e.AsyncScheduler=(function(e){t(r,e);function r(t,r){r===void 0&&(r=n.Scheduler.now);var i=e.call(this,t,r)||this;return i.actions=[],i._active=!1,i}return r.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},r})(n.Scheduler)}}),pu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AsapScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AsapScheduler=void 0,e.AsapScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n=this.actions,r;e||=n.shift();do if(r=e.execute(e.state,e.delay))break;while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},n})(fu().AsyncScheduler)}}),mu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/asap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.asap=e.asapScheduler=void 0;var t=uu();e.asapScheduler=new(pu()).AsapScheduler(t.AsapAction),e.asap=e.asapScheduler}}),hu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/async.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.async=e.asyncScheduler=void 0;var t=su();e.asyncScheduler=new(fu()).AsyncScheduler(t.AsyncAction),e.async=e.asyncScheduler}}),gu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/QueueAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.QueueAction=void 0,e.QueueAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.schedule=function(t,n){return n===void 0&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},n.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},n.prototype.requestAsyncId=function(t,n,r){return r===void 0&&(r=0),r!=null&&r>0||r==null&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},n})(su().AsyncAction)}}),_u=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/QueueScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.QueueScheduler=void 0,e.QueueScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n})(fu().AsyncScheduler)}}),vu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/queue.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.queue=e.queueScheduler=void 0;var t=gu();e.queueScheduler=new(_u()).QueueScheduler(t.QueueAction),e.queue=e.queueScheduler}}),yu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AnimationFrameAction.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationFrameAction=void 0;var n=su(),r=Zl();e.AnimationFrameAction=(function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||=r.animationFrameProvider.requestAnimationFrame(function(){return t.flush(void 0)}))},n.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i==null?this.delay>0:i>0)return e.prototype.recycleAsyncId.call(this,t,n,i);var a=t.actions;n!=null&&n===t._scheduled&&a[a.length-1]?.id!==n&&(r.animationFrameProvider.cancelAnimationFrame(n),t._scheduled=void 0)},n})(n.AsyncAction)}}),bu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/AnimationFrameScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationFrameScheduler=void 0,e.AnimationFrameScheduler=(function(e){t(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n.prototype.flush=function(e){this._active=!0;var t;e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n=this.actions,r;e||=n.shift();do if(r=e.execute(e.state,e.delay))break;while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},n})(fu().AsyncScheduler)}}),xu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrame.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrame=e.animationFrameScheduler=void 0;var t=yu();e.animationFrameScheduler=new(bu()).AnimationFrameScheduler(t.AnimationFrameAction),e.animationFrame=e.animationFrameScheduler}}),Su=L({"../../node_modules/rxjs/dist/cjs/internal/scheduler/VirtualTimeScheduler.js"(e){var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.VirtualAction=e.VirtualTimeScheduler=void 0;var n=su(),r=Il();e.VirtualTimeScheduler=(function(e){t(n,e);function n(t,n){t===void 0&&(t=i),n===void 0&&(n=1/0);var r=e.call(this,t,function(){return r.frame})||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return n.prototype.flush=function(){for(var e=this,t=e.actions,n=e.maxFrames,r,i;(i=t[0])&&i.delay<=n&&(t.shift(),this.frame=i.delay,!(r=i.execute(i.state,i.delay))););if(r){for(;i=t.shift();)i.unsubscribe();throw r}},n.frameTimeFactor=10,n})(fu().AsyncScheduler);var i=(function(e){t(n,e);function n(t,n,r){r===void 0&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return n.prototype.schedule=function(t,i){if(i===void 0&&(i=0),Number.isFinite(i)){if(!this.id)return e.prototype.schedule.call(this,t,i);this.active=!1;var a=new n(this.scheduler,this.work);return this.add(a),a.schedule(t,i)}return r.Subscription.EMPTY},n.prototype.requestAsyncId=function(e,t,r){r===void 0&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,n){n===void 0&&(n=0)},n.prototype._execute=function(t,n){if(this.active===!0)return e.prototype._execute.call(this,t,n)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},n})(n.AsyncAction);e.VirtualAction=i}}),Cu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/empty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.empty=e.EMPTY=void 0;var t=ql();e.EMPTY=new t.Observable(function(e){return e.complete()});function n(t){return t?r(t):e.EMPTY}e.empty=n;function r(e){return new t.Observable(function(t){return e.schedule(function(){return t.complete()})})}}}),wu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isScheduler.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isScheduler=void 0;var t=Ml();function n(e){return e&&t.isFunction(e.schedule)}e.isScheduler=n}}),Tu=L({"../../node_modules/rxjs/dist/cjs/internal/util/args.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.popNumber=e.popScheduler=e.popResultSelector=void 0;var t=Ml(),n=wu();function r(e){return e[e.length-1]}function i(e){return t.isFunction(r(e))?e.pop():void 0}e.popResultSelector=i;function a(e){return n.isScheduler(r(e))?e.pop():void 0}e.popScheduler=a;function o(e,t){return typeof r(e)==`number`?e.pop():t}e.popNumber=o}}),Eu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isArrayLike.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isArrayLike=void 0,e.isArrayLike=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`})}}),Du=L({"../../node_modules/rxjs/dist/cjs/internal/util/isPromise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isPromise=void 0;var t=Ml();function n(e){return t.isFunction(e?.then)}e.isPromise=n}}),Ou=L({"../../node_modules/rxjs/dist/cjs/internal/util/isInteropObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isInteropObservable=void 0;var t=Wl(),n=Ml();function r(e){return n.isFunction(e[t.observable])}e.isInteropObservable=r}}),ku=L({"../../node_modules/rxjs/dist/cjs/internal/util/isAsyncIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isAsyncIterable=void 0;var t=Ml();function n(e){return Symbol.asyncIterator&&t.isFunction(e?.[Symbol.asyncIterator])}e.isAsyncIterable=n}}),Au=L({"../../node_modules/rxjs/dist/cjs/internal/util/throwUnobservableError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createInvalidObservableTypeError=void 0;function t(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}e.createInvalidObservableTypeError=t}}),ju=L({"../../node_modules/rxjs/dist/cjs/internal/symbol/iterator.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.iterator=e.getSymbolIterator=void 0;function t(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}e.getSymbolIterator=t,e.iterator=t()}}),Mu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isIterable=void 0;var t=ju(),n=Ml();function r(e){return n.isFunction(e?.[t.iterator])}e.isIterable=r}}),Nu=L({"../../node_modules/rxjs/dist/cjs/internal/util/isReadableStreamLike.js"(e){var t=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},n=e&&e.__await||function(e){return this instanceof n?(this.v=e,this):new n(e)},r=e&&e.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var i=r.apply(e,t||[]),a,o=[];return a={},s(`next`),s(`throw`),s(`return`),a[Symbol.asyncIterator]=function(){return this},a;function s(e){i[e]&&(a[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||c(e,t)})})}function c(e,t){try{l(i[e](t))}catch(e){f(o[0][3],e)}}function l(e){e.value instanceof n?Promise.resolve(e.value.v).then(u,d):f(o[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}};Object.defineProperty(e,"__esModule",{value:!0}),e.isReadableStreamLike=e.readableStreamLikeToAsyncGenerator=void 0;var i=Ml();function a(e){return r(this,arguments,function(){var r,i,a,o;return t(this,function(t){switch(t.label){case 0:r=e.getReader(),t.label=1;case 1:t.trys.push([1,,9,10]),t.label=2;case 2:return[4,n(r.read())];case 3:return i=t.sent(),a=i.value,o=i.done,o?[4,n(void 0)]:[3,5];case 4:return[2,t.sent()];case 5:return[4,n(a)];case 6:return[4,t.sent()];case 7:return t.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}e.readableStreamLikeToAsyncGenerator=a;function o(e){return i.isFunction(e?.getReader)}e.isReadableStreamLike=o}}),B=L({"../../node_modules/rxjs/dist/cjs/internal/observable/innerFrom.js"(e){var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},r=e&&e.__asyncValues||function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof i==`function`?i(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),a(r,i,n.done,n.value)})}}function a(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},i=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.fromReadableStreamLike=e.fromAsyncIterable=e.fromIterable=e.fromPromise=e.fromArrayLike=e.fromInteropObservable=e.innerFrom=void 0;var a=Eu(),o=Du(),s=ql(),c=Ou(),l=ku(),u=Au(),d=Mu(),f=Nu(),p=Ml(),m=zl(),h=Wl();function g(e){if(e instanceof s.Observable)return e;if(e!=null){if(c.isInteropObservable(e))return _(e);if(a.isArrayLike(e))return v(e);if(o.isPromise(e))return y(e);if(l.isAsyncIterable(e))return x(e);if(d.isIterable(e))return b(e);if(f.isReadableStreamLike(e))return S(e)}throw u.createInvalidObservableTypeError(e)}e.innerFrom=g;function _(e){return new s.Observable(function(t){var n=e[h.observable]();if(p.isFunction(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}e.fromInteropObservable=_;function v(e){return new s.Observable(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}e.fromArrayLike=v;function y(e){return new s.Observable(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,m.reportUnhandledError)})}e.fromPromise=y;function b(e){return new s.Observable(function(t){var n,r;try{for(var a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}t.complete()})}e.fromIterable=b;function x(e){return new s.Observable(function(t){C(e,t).catch(function(e){return t.error(e)})})}e.fromAsyncIterable=x;function S(e){return x(f.readableStreamLikeToAsyncGenerator(e))}e.fromReadableStreamLike=S;function C(e,i){var a,o,s,c;return t(this,void 0,void 0,function(){var t,l;return n(this,function(n){switch(n.label){case 0:n.trys.push([0,5,6,11]),a=r(e),n.label=1;case 1:return[4,a.next()];case 2:if(o=n.sent(),o.done)return[3,4];if(t=o.value,i.next(t),i.closed)return[2];n.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=n.sent(),s={error:l},[3,11];case 6:return n.trys.push([6,,9,10]),o&&!o.done&&(c=a.return)?[4,c.call(a)]:[3,8];case 7:n.sent(),n.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return i.complete(),[2]}})})}}}),Pu=L({"../../node_modules/rxjs/dist/cjs/internal/util/executeSchedule.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.executeSchedule=void 0;function t(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}e.executeSchedule=t}}),Fu=L({"../../node_modules/rxjs/dist/cjs/internal/operators/observeOn.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observeOn=void 0;var t=Pu(),n=R(),r=z();function i(e,i){return i===void 0&&(i=0),n.operate(function(n,a){n.subscribe(r.createOperatorSubscriber(a,function(n){return t.executeSchedule(a,e,function(){return a.next(n)},i)},function(){return t.executeSchedule(a,e,function(){return a.complete()},i)},function(n){return t.executeSchedule(a,e,function(){return a.error(n)},i)}))})}e.observeOn=i}}),Iu=L({"../../node_modules/rxjs/dist/cjs/internal/operators/subscribeOn.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.subscribeOn=void 0;var t=R();function n(e,n){return n===void 0&&(n=0),t.operate(function(t,r){r.add(e.schedule(function(){return t.subscribe(r)},n))})}e.subscribeOn=n}}),Lu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleObservable=void 0;var t=B(),n=Fu(),r=Iu();function i(e,i){return t.innerFrom(e).pipe(r.subscribeOn(i),n.observeOn(i))}e.scheduleObservable=i}}),Ru=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/schedulePromise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.schedulePromise=void 0;var t=B(),n=Fu(),r=Iu();function i(e,i){return t.innerFrom(e).pipe(r.subscribeOn(i),n.observeOn(i))}e.schedulePromise=i}}),zu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleArray=void 0;var t=ql();function n(e,n){return new t.Observable(function(t){var r=0;return n.schedule(function(){r===e.length?t.complete():(t.next(e[r++]),t.closed||this.schedule())})})}e.scheduleArray=n}}),Bu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleIterable=void 0;var t=ql(),n=ju(),r=Ml(),i=Pu();function a(e,a){return new t.Observable(function(t){var o;return i.executeSchedule(t,a,function(){o=e[n.iterator](),i.executeSchedule(t,a,function(){var e,n,r;try{e=o.next(),n=e.value,r=e.done}catch(e){t.error(e);return}r?t.complete():t.next(n)},0,!0)}),function(){return r.isFunction(o?.return)&&o.return()}})}e.scheduleIterable=a}}),Vu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleAsyncIterable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleAsyncIterable=void 0;var t=ql(),n=Pu();function r(e,r){if(!e)throw Error(`Iterable cannot be null`);return new t.Observable(function(t){n.executeSchedule(t,r,function(){var i=e[Symbol.asyncIterator]();n.executeSchedule(t,r,function(){i.next().then(function(e){e.done?t.complete():t.next(e.value)})},0,!0)})})}e.scheduleAsyncIterable=r}}),Hu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduleReadableStreamLike.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduleReadableStreamLike=void 0;var t=Vu(),n=Nu();function r(e,r){return t.scheduleAsyncIterable(n.readableStreamLikeToAsyncGenerator(e),r)}e.scheduleReadableStreamLike=r}}),Uu=L({"../../node_modules/rxjs/dist/cjs/internal/scheduled/scheduled.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scheduled=void 0;var t=Lu(),n=Ru(),r=zu(),i=Bu(),a=Vu(),o=Ou(),s=Du(),c=Eu(),l=Mu(),u=ku(),d=Au(),f=Nu(),p=Hu();function m(e,m){if(e!=null){if(o.isInteropObservable(e))return t.scheduleObservable(e,m);if(c.isArrayLike(e))return r.scheduleArray(e,m);if(s.isPromise(e))return n.schedulePromise(e,m);if(u.isAsyncIterable(e))return a.scheduleAsyncIterable(e,m);if(l.isIterable(e))return i.scheduleIterable(e,m);if(f.isReadableStreamLike(e))return p.scheduleReadableStreamLike(e,m)}throw d.createInvalidObservableTypeError(e)}e.scheduled=m}}),Wu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/from.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.from=void 0;var t=Uu(),n=B();function r(e,r){return r?t.scheduled(e,r):n.innerFrom(e)}e.from=r}}),Gu=L({"../../node_modules/rxjs/dist/cjs/internal/observable/of.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.of=void 0;var t=Tu(),n=Wu();function r(){var e=[...arguments],r=t.popScheduler(e);return n.from(e,r)}e.of=r}}),Ku=L({"../../node_modules/rxjs/dist/cjs/internal/observable/throwError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throwError=void 0;var t=ql(),n=Ml();function r(e,r){var i=n.isFunction(e)?e:function(){return e},a=function(e){return e.error(i())};return new t.Observable(r?function(e){return r.schedule(a,0,e)}:a)}e.throwError=r}}),qu=L({"../../node_modules/rxjs/dist/cjs/internal/Notification.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observeNotification=e.Notification=e.NotificationKind=void 0;var t=Cu(),n=Gu(),r=Ku(),i=Ml();(function(e){e.NEXT=`N`,e.ERROR=`E`,e.COMPLETE=`C`})(e.NotificationKind||={}),e.Notification=(function(){function e(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue=e===`N`}return e.prototype.observe=function(e){return a(this,e)},e.prototype.do=function(e,t,n){var r=this,i=r.kind,a=r.value,o=r.error;return i===`N`?e?.(a):i===`E`?t?.(o):n?.()},e.prototype.accept=function(e,t,n){return i.isFunction(e?.next)?this.observe(e):this.do(e,t,n)},e.prototype.toObservable=function(){var e=this,i=e.kind,a=e.value,o=e.error,s=i===`N`?n.of(a):i===`E`?r.throwError(function(){return o}):i===`C`?t.EMPTY:0;if(!s)throw TypeError(`Unexpected notification kind `+i);return s},e.createNext=function(t){return new e(`N`,t)},e.createError=function(t){return new e(`E`,void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e(`C`),e})();function a(e,t){var n,r,i,a=e,o=a.kind,s=a.value,c=a.error;if(typeof o!=`string`)throw TypeError(`Invalid notification, missing "kind"`);o===`N`?(n=t.next)==null||n.call(t,s):o===`E`?(r=t.error)==null||r.call(t,c):(i=t.complete)==null||i.call(t)}e.observeNotification=a}}),Ju=L({"../../node_modules/rxjs/dist/cjs/internal/util/isObservable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObservable=void 0;var t=ql(),n=Ml();function r(e){return!!e&&(e instanceof t.Observable||n.isFunction(e.lift)&&n.isFunction(e.subscribe))}e.isObservable=r}}),Yu=L({"../../node_modules/rxjs/dist/cjs/internal/util/EmptyError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyError=void 0,e.EmptyError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}})}}),Xu=L({"../../node_modules/rxjs/dist/cjs/internal/lastValueFrom.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.lastValueFrom=void 0;var t=Yu();function n(e,n){var r=typeof n==`object`;return new Promise(function(i,a){var o=!1,s;e.subscribe({next:function(e){s=e,o=!0},error:a,complete:function(){o?i(s):r?i(n.defaultValue):a(new t.EmptyError)}})})}e.lastValueFrom=n}}),Zu=L({"../../node_modules/rxjs/dist/cjs/internal/firstValueFrom.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.firstValueFrom=void 0;var t=Yu(),n=Ul();function r(e,r){var i=typeof r==`object`;return new Promise(function(a,o){var s=new n.SafeSubscriber({next:function(e){a(e),s.unsubscribe()},error:o,complete:function(){i?a(r.defaultValue):o(new t.EmptyError)}});e.subscribe(s)})}e.firstValueFrom=r}}),Qu=L({"../../node_modules/rxjs/dist/cjs/internal/util/ArgumentOutOfRangeError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ArgumentOutOfRangeError=void 0,e.ArgumentOutOfRangeError=Nl().createErrorClass(function(e){return function(){e(this),this.name=`ArgumentOutOfRangeError`,this.message=`argument out of range`}})}}),$u=L({"../../node_modules/rxjs/dist/cjs/internal/util/NotFoundError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NotFoundError=void 0,e.NotFoundError=Nl().createErrorClass(function(e){return function(t){e(this),this.name=`NotFoundError`,this.message=t}})}}),ed=L({"../../node_modules/rxjs/dist/cjs/internal/util/SequenceError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SequenceError=void 0,e.SequenceError=Nl().createErrorClass(function(e){return function(t){e(this),this.name=`SequenceError`,this.message=t}})}}),td=L({"../../node_modules/rxjs/dist/cjs/internal/util/isDate.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isValidDate=void 0;function t(e){return e instanceof Date&&!isNaN(e)}e.isValidDate=t}}),nd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeout.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeout=e.TimeoutError=void 0;var t=hu(),n=td(),r=R(),i=B(),a=Nl(),o=z(),s=Pu();e.TimeoutError=a.createErrorClass(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function c(e,a){var c=n.isValidDate(e)?{first:e}:typeof e==`number`?{each:e}:e,u=c.first,d=c.each,f=c.with,p=f===void 0?l:f,m=c.scheduler,h=m===void 0?a??t.asyncScheduler:m,g=c.meta,_=g===void 0?null:g;if(u==null&&d==null)throw TypeError(`No timeout provided.`);return r.operate(function(e,t){var n,r,a=null,c=0,l=function(e){r=s.executeSchedule(t,h,function(){try{n.unsubscribe(),i.innerFrom(p({meta:_,lastValue:a,seen:c})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe(o.createOperatorSubscriber(t,function(e){r?.unsubscribe(),c++,t.next(a=e),d>0&&l(d)},void 0,void 0,function(){r?.closed||r?.unsubscribe(),a=null})),!c&&l(u==null?d:typeof u==`number`?u:+u-h.now())})}e.timeout=c;function l(t){throw new e.TimeoutError(t)}}}),rd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/map.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.map=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){i.next(e.call(r,t,a++))}))})}e.map=r}}),id=L({"../../node_modules/rxjs/dist/cjs/internal/util/mapOneOrManyArgs.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.mapOneOrManyArgs=void 0;var r=rd(),i=Array.isArray;function a(e,r){return i(r)?e.apply(void 0,n([],t(r))):e(r)}function o(e){return r.map(function(t){return a(e,t)})}e.mapOneOrManyArgs=o}}),ad=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindCallbackInternals.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.bindCallbackInternals=void 0;var r=wu(),i=ql(),a=Iu(),o=id(),s=Fu(),c=iu();function l(e,u,d,f){if(d){if(r.isScheduler(d))f=d;else return function(){var t=[...arguments];return l(e,u,f).apply(this,t).pipe(o.mapOneOrManyArgs(d))}}return f?function(){var t=[...arguments];return l(e,u).apply(this,t).pipe(a.subscribeOn(f),s.observeOn(f))}:function(){for(var r=this,a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];var s=new c.AsyncSubject,l=!0;return new i.Observable(function(i){var o=s.subscribe(i);if(l){l=!1;var c=!1,d=!1;u.apply(r,n(n([],t(a)),[function(){var t=[...arguments];if(e){var n=t.shift();if(n!=null){s.error(n);return}}s.next(1<t.length?t:t[0]),d=!0,c&&s.complete()}])),d&&s.complete(),c=!0}return o})}}e.bindCallbackInternals=l}}),od=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindCallback.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindCallback=void 0;var t=ad();function n(e,n,r){return t.bindCallbackInternals(!1,e,n,r)}e.bindCallback=n}}),sd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/bindNodeCallback.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindNodeCallback=void 0;var t=ad();function n(e,n,r){return t.bindCallbackInternals(!0,e,n,r)}e.bindNodeCallback=n}}),cd=L({"../../node_modules/rxjs/dist/cjs/internal/util/argsArgArrayOrObject.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.argsArgArrayOrObject=void 0;var t=Array.isArray,n=Object.getPrototypeOf,r=Object.prototype,i=Object.keys;function a(e){if(e.length===1){var n=e[0];if(t(n))return{args:n,keys:null};if(o(n)){var r=i(n);return{args:r.map(function(e){return n[e]}),keys:r}}}return{args:e,keys:null}}e.argsArgArrayOrObject=a;function o(e){return e&&typeof e==`object`&&n(e)===r}}}),ld=L({"../../node_modules/rxjs/dist/cjs/internal/util/createObject.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createObject=void 0;function t(e,t){return e.reduce(function(e,n,r){return e[n]=t[r],e},{})}e.createObject=t}}),ud=L({"../../node_modules/rxjs/dist/cjs/internal/observable/combineLatest.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestInit=e.combineLatest=void 0;var t=ql(),n=cd(),r=Wu(),i=Gl(),a=id(),o=Tu(),s=ld(),c=z(),l=Pu();function u(){var e=[...arguments],c=o.popScheduler(e),l=o.popResultSelector(e),u=n.argsArgArrayOrObject(e),f=u.args,p=u.keys;if(f.length===0)return r.from([],c);var m=new t.Observable(d(f,c,p?function(e){return s.createObject(p,e)}:i.identity));return l?m.pipe(a.mapOneOrManyArgs(l)):m}e.combineLatest=u;function d(e,t,n){return n===void 0&&(n=i.identity),function(i){f(t,function(){for(var a=e.length,o=Array(a),s=a,l=a,u=function(a){f(t,function(){var u=r.from(e[a],t),d=!1;u.subscribe(c.createOperatorSubscriber(i,function(e){o[a]=e,d||(d=!0,l--),l||i.next(n(o.slice()))},function(){--s||i.complete()}))},i)},d=0;d<a;d++)u(d)},i)}}e.combineLatestInit=d;function f(e,t,n){e?l.executeSchedule(n,e,t):t()}}}),dd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeInternals=void 0;var t=B(),n=Pu(),r=z();function i(e,i,a,o,s,c,l,u){var d=[],f=0,p=0,m=!1,h=function(){m&&!d.length&&!f&&i.complete()},g=function(e){return f<o?_(e):d.push(e)},_=function(e){c&&i.next(e),f++;var u=!1;t.innerFrom(a(e,p++)).subscribe(r.createOperatorSubscriber(i,function(e){s?.(e),c?g(e):i.next(e)},function(){u=!0},void 0,function(){if(u)try{f--;for(var e=function(){var e=d.shift();l?n.executeSchedule(i,l,function(){return _(e)}):_(e)};d.length&&f<o;)e();h()}catch(e){i.error(e)}}))};return e.subscribe(r.createOperatorSubscriber(i,g,function(){m=!0,h()})),function(){u?.()}}e.mergeInternals=i}}),fd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeMap=void 0;var t=rd(),n=B(),r=R(),i=dd(),a=Ml();function o(e,s,c){return c===void 0&&(c=1/0),a.isFunction(s)?o(function(r,i){return t.map(function(e,t){return s(r,e,i,t)})(n.innerFrom(e(r,i)))},c):(typeof s==`number`&&(c=s),r.operate(function(t,n){return i.mergeInternals(t,n,e,c)}))}e.mergeMap=o}}),pd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeAll=void 0;var t=fd(),n=Gl();function r(e){return e===void 0&&(e=1/0),t.mergeMap(n.identity,e)}e.mergeAll=r}}),md=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatAll=void 0;var t=pd();function n(){return t.mergeAll(1)}e.concatAll=n}}),hd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/concat.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concat=void 0;var t=md(),n=Tu(),r=Wu();function i(){var e=[...arguments];return t.concatAll()(r.from(e,n.popScheduler(e)))}e.concat=i}}),gd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/defer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defer=void 0;var t=ql(),n=B();function r(e){return new t.Observable(function(t){n.innerFrom(e()).subscribe(t)})}e.defer=r}}),_d=L({"../../node_modules/rxjs/dist/cjs/internal/observable/connectable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.connectable=void 0;var t=eu(),n=ql(),r=gd(),i={connector:function(){return new t.Subject},resetOnDisconnect:!0};function a(e,t){t===void 0&&(t=i);var a=null,o=t.connector,s=t.resetOnDisconnect,c=s===void 0||s,l=o(),u=new n.Observable(function(e){return l.subscribe(e)});return u.connect=function(){return(!a||a.closed)&&(a=r.defer(function(){return e}).subscribe(l),c&&a.add(function(){return l=o()})),a},u}e.connectable=a}}),vd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/forkJoin.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.forkJoin=void 0;var t=ql(),n=cd(),r=B(),i=Tu(),a=z(),o=id(),s=ld();function c(){var e=[...arguments],c=i.popResultSelector(e),l=n.argsArgArrayOrObject(e),u=l.args,d=l.keys,f=new t.Observable(function(e){var t=u.length;if(!t){e.complete();return}for(var n=Array(t),i=t,o=t,c=function(t){var c=!1;r.innerFrom(u[t]).subscribe(a.createOperatorSubscriber(e,function(e){c||(c=!0,o--),n[t]=e},function(){return i--},void 0,function(){(!i||!c)&&(o||e.next(d?s.createObject(d,n):n),e.complete())}))},l=0;l<t;l++)c(l)});return c?f.pipe(o.mapOneOrManyArgs(c)):f}e.forkJoin=c}}),yd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromEvent.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.fromEvent=void 0;var n=B(),r=ql(),i=fd(),a=Eu(),o=Ml(),s=id(),c=[`addListener`,`removeListener`],l=[`addEventListener`,`removeEventListener`],u=[`on`,`off`];function d(e,g,_,v){if(o.isFunction(_)&&(v=_,_=void 0),v)return d(e,g,_).pipe(s.mapOneOrManyArgs(v));var y=t(h(e)?l.map(function(t){return function(n){return e[t](g,n,_)}}):p(e)?c.map(f(e,g)):m(e)?u.map(f(e,g)):[],2),b=y[0],x=y[1];if(!b&&a.isArrayLike(e))return i.mergeMap(function(e){return d(e,g,_)})(n.innerFrom(e));if(!b)throw TypeError(`Invalid event target`);return new r.Observable(function(e){var t=function(){var t=[...arguments];return e.next(1<t.length?t:t[0])};return b(t),function(){return x(t)}})}e.fromEvent=d;function f(e,t){return function(n){return function(r){return e[n](t,r)}}}function p(e){return o.isFunction(e.addListener)&&o.isFunction(e.removeListener)}function m(e){return o.isFunction(e.on)&&o.isFunction(e.off)}function h(e){return o.isFunction(e.addEventListener)&&o.isFunction(e.removeEventListener)}}}),bd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromEventPattern.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromEventPattern=void 0;var t=ql(),n=Ml(),r=id();function i(e,a,o){return o?i(e,a).pipe(r.mapOneOrManyArgs(o)):new t.Observable(function(t){var r=function(){var e=[...arguments];return t.next(e.length===1?e[0]:e)},i=e(r);return n.isFunction(a)?function(){return a(r,i)}:void 0})}e.fromEventPattern=i}}),xd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/generate.js"(e){var t=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.generate=void 0;var n=Gl(),r=wu(),i=gd(),a=Bu();function o(e,o,s,c,l){var u,d,f,p;arguments.length===1?(u=e,p=u.initialState,o=u.condition,s=u.iterate,d=u.resultSelector,f=d===void 0?n.identity:d,l=u.scheduler):(p=e,!c||r.isScheduler(c)?(f=n.identity,l=c):f=c);function m(){var e;return t(this,function(t){switch(t.label){case 0:e=p,t.label=1;case 1:return!o||o(e)?[4,f(e)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e=s(e),[3,1];case 4:return[2]}})}return i.defer(l?function(){return a.scheduleIterable(m(),l)}:m)}e.generate=o}}),Sd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/iif.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.iif=void 0;var t=gd();function n(e,n,r){return t.defer(function(){return e()?n:r})}e.iif=n}}),Cd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/timer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timer=void 0;var t=ql(),n=hu(),r=wu(),i=td();function a(e,a,o){e===void 0&&(e=0),o===void 0&&(o=n.async);var s=-1;return a!=null&&(r.isScheduler(a)?o=a:s=a),new t.Observable(function(t){var n=i.isValidDate(e)?+e-o.now():e;n<0&&(n=0);var r=0;return o.schedule(function(){t.closed||(t.next(r++),0<=s?this.schedule(void 0,s):t.complete())},n)})}e.timer=a}}),wd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/interval.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.interval=void 0;var t=hu(),n=Cd();function r(e,r){return e===void 0&&(e=0),r===void 0&&(r=t.asyncScheduler),e<0&&(e=0),n.timer(e,e,r)}e.interval=r}}),Td=L({"../../node_modules/rxjs/dist/cjs/internal/observable/merge.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.merge=void 0;var t=pd(),n=B(),r=Cu(),i=Tu(),a=Wu();function o(){var e=[...arguments],o=i.popScheduler(e),s=i.popNumber(e,1/0),c=e;return c.length?c.length===1?n.innerFrom(c[0]):t.mergeAll(s)(a.from(c,o)):r.EMPTY}e.merge=o}}),Ed=L({"../../node_modules/rxjs/dist/cjs/internal/observable/never.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.never=e.NEVER=void 0;var t=ql(),n=Bl();e.NEVER=new t.Observable(n.noop);function r(){return e.NEVER}e.never=r}}),Dd=L({"../../node_modules/rxjs/dist/cjs/internal/util/argsOrArgArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.argsOrArgArray=void 0;var t=Array.isArray;function n(e){return e.length===1&&t(e[0])?e[0]:e}e.argsOrArgArray=n}}),Od=L({"../../node_modules/rxjs/dist/cjs/internal/observable/onErrorResumeNext.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.onErrorResumeNext=void 0;var t=ql(),n=Dd(),r=z(),i=Bl(),a=B();function o(){var e=[...arguments],o=n.argsOrArgArray(e);return new t.Observable(function(e){var t=0,n=function(){if(t<o.length){var s=void 0;try{s=a.innerFrom(o[t++])}catch{n();return}var c=new r.OperatorSubscriber(e,void 0,i.noop,i.noop);s.subscribe(c),c.add(n)}else e.complete()};n()})}e.onErrorResumeNext=o}}),kd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/pairs.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pairs=void 0;var t=Wu();function n(e,n){return t.from(Object.entries(e),n)}e.pairs=n}}),Ad=L({"../../node_modules/rxjs/dist/cjs/internal/util/not.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.not=void 0;function t(e,t){return function(n,r){return!e.call(t,n,r)}}e.not=t}}),jd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/filter.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.filter=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){return e.call(r,t,a++)&&i.next(t)}))})}e.filter=r}}),Md=L({"../../node_modules/rxjs/dist/cjs/internal/observable/partition.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.partition=void 0;var t=Ad(),n=jd(),r=B();function i(e,i,a){return[n.filter(i,a)(r.innerFrom(e)),n.filter(t.not(i,a))(r.innerFrom(e))]}e.partition=i}}),Nd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/race.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.raceInit=e.race=void 0;var t=ql(),n=B(),r=Dd(),i=z();function a(){var e=[...arguments];return e=r.argsOrArgArray(e),e.length===1?n.innerFrom(e[0]):new t.Observable(o(e))}e.race=a;function o(e){return function(t){for(var r=[],a=function(a){r.push(n.innerFrom(e[a]).subscribe(i.createOperatorSubscriber(t,function(e){if(r){for(var n=0;n<r.length;n++)n!==a&&r[n].unsubscribe();r=null}t.next(e)})))},o=0;r&&!t.closed&&o<e.length;o++)a(o)}}e.raceInit=o}}),Pd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/range.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0;var t=ql(),n=Cu();function r(e,r,i){if(r??(r=e,e=0),r<=0)return n.EMPTY;var a=r+e;return new t.Observable(i?function(t){var n=e;return i.schedule(function(){n<a?(t.next(n++),this.schedule()):t.complete()})}:function(t){for(var n=e;n<a&&!t.closed;)t.next(n++);t.complete()})}e.range=r}}),Fd=L({"../../node_modules/rxjs/dist/cjs/internal/observable/using.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.using=void 0;var t=ql(),n=B(),r=Cu();function i(e,i){return new t.Observable(function(t){var a=e(),o=i(a);return(o?n.innerFrom(o):r.EMPTY).subscribe(t),function(){a&&a.unsubscribe()}})}e.using=i}}),Id=L({"../../node_modules/rxjs/dist/cjs/internal/observable/zip.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zip=void 0;var r=ql(),i=B(),a=Dd(),o=Cu(),s=z(),c=Tu();function l(){var e=[...arguments],l=c.popResultSelector(e),u=a.argsOrArgArray(e);return u.length?new r.Observable(function(e){var r=u.map(function(){return[]}),a=u.map(function(){return!1});e.add(function(){r=a=null});for(var o=function(o){i.innerFrom(u[o]).subscribe(s.createOperatorSubscriber(e,function(i){if(r[o].push(i),r.every(function(e){return e.length})){var s=r.map(function(e){return e.shift()});e.next(l?l.apply(void 0,n([],t(s))):s),r.some(function(e,t){return!e.length&&a[t]})&&e.complete()}},function(){a[o]=!0,!r[o].length&&e.complete()}))},c=0;!e.closed&&c<u.length;c++)o(c);return function(){r=a=null}}):o.EMPTY}e.zip=l}}),Ld=L({"../../node_modules/rxjs/dist/cjs/internal/types.js"(e){Object.defineProperty(e,"__esModule",{value:!0})}}),Rd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/audit.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.audit=void 0;var t=R(),n=B(),r=z();function i(e){return t.operate(function(t,i){var a=!1,o=null,s=null,c=!1,l=function(){if(s?.unsubscribe(),s=null,a){a=!1;var e=o;o=null,i.next(e)}c&&i.complete()},u=function(){s=null,c&&i.complete()};t.subscribe(r.createOperatorSubscriber(i,function(t){a=!0,o=t,s||n.innerFrom(e(t)).subscribe(s=r.createOperatorSubscriber(i,l,u))},function(){c=!0,(!a||!s||s.closed)&&i.complete()}))})}e.audit=i}}),zd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/auditTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.auditTime=void 0;var t=hu(),n=Rd(),r=Cd();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.audit(function(){return r.timer(e,i)})}e.auditTime=i}}),Bd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/buffer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.buffer=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=[];return t.subscribe(r.createOperatorSubscriber(a,function(e){return o.push(e)},function(){a.next(o),a.complete()})),i.innerFrom(e).subscribe(r.createOperatorSubscriber(a,function(){var e=o;o=[],a.next(e)},n.noop)),function(){o=null}})}e.buffer=a}}),Vd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferCount.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferCount=void 0;var n=R(),r=z(),i=Fl();function a(e,a){return a===void 0&&(a=null),a??=e,n.operate(function(n,o){var s=[],c=0;n.subscribe(r.createOperatorSubscriber(o,function(n){var r,l,u,d,f=null;c++%a===0&&s.push([]);try{for(var p=t(s),m=p.next();!m.done;m=p.next()){var h=m.value;h.push(n),e<=h.length&&(f??=[],f.push(h))}}catch(e){r={error:e}}finally{try{m&&!m.done&&(l=p.return)&&l.call(p)}finally{if(r)throw r.error}}if(f)try{for(var g=t(f),_=g.next();!_.done;_=g.next()){var h=_.value;i.arrRemove(s,h),o.next(h)}}catch(e){u={error:e}}finally{try{_&&!_.done&&(d=g.return)&&d.call(g)}finally{if(u)throw u.error}}},function(){var e,n;try{for(var r=t(s),i=r.next();!i.done;i=r.next()){var a=i.value;o.next(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}o.complete()},void 0,function(){s=null}))})}e.bufferCount=a}}),Hd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferTime.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferTime=void 0;var n=Il(),r=R(),i=z(),a=Fl(),o=hu(),s=Tu(),c=Pu();function l(e){var l=[...arguments].slice(1),u=s.popScheduler(l)??o.asyncScheduler,d=l[0]??null,f=l[1]||1/0;return r.operate(function(r,o){var s=[],l=!1,p=function(e){var t=e.buffer;e.subs.unsubscribe(),a.arrRemove(s,e),o.next(t),l&&m()},m=function(){if(s){var t=new n.Subscription;o.add(t);var r={buffer:[],subs:t};s.push(r),c.executeSchedule(t,u,function(){return p(r)},e)}};d!==null&&d>=0?c.executeSchedule(o,u,m,d,!0):l=!0,m();var h=i.createOperatorSubscriber(o,function(e){var n,r,i=s.slice();try{for(var a=t(i),o=a.next();!o.done;o=a.next()){var c=o.value,l=c.buffer;l.push(e),f<=l.length&&p(c)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},function(){for(;s?.length;)o.next(s.shift().buffer);h?.unsubscribe(),o.complete(),o.unsubscribe()},void 0,function(){return s=null});r.subscribe(h)})}e.bufferTime=l}}),Ud=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferToggle.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.bufferToggle=void 0;var n=Il(),r=R(),i=B(),a=z(),o=Bl(),s=Fl();function c(e,c){return r.operate(function(r,l){var u=[];i.innerFrom(e).subscribe(a.createOperatorSubscriber(l,function(e){var t=[];u.push(t);var r=new n.Subscription;r.add(i.innerFrom(c(e)).subscribe(a.createOperatorSubscriber(l,function(){s.arrRemove(u,t),l.next(t),r.unsubscribe()},o.noop)))},o.noop)),r.subscribe(a.createOperatorSubscriber(l,function(e){var n,r;try{for(var i=t(u),a=i.next();!a.done;a=i.next())a.value.push(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},function(){for(;u.length>0;)l.next(u.shift());l.complete()}))})}e.bufferToggle=c}}),Wd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/bufferWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bufferWhen=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=null,s=null,c=function(){s?.unsubscribe();var t=o;o=[],t&&a.next(t),i.innerFrom(e()).subscribe(s=r.createOperatorSubscriber(a,c,n.noop))};c(),t.subscribe(r.createOperatorSubscriber(a,function(e){return o?.push(e)},function(){o&&a.next(o),a.complete()},void 0,function(){return o=s=null}))})}e.bufferWhen=a}}),Gd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/catchError.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.catchError=void 0;var t=B(),n=z(),r=R();function i(e){return r.operate(function(r,a){var o=null,s=!1,c;o=r.subscribe(n.createOperatorSubscriber(a,void 0,void 0,function(n){c=t.innerFrom(e(n,i(e)(r))),o?(o.unsubscribe(),o=null,c.subscribe(a)):s=!0})),s&&(o.unsubscribe(),o=null,c.subscribe(a))})}e.catchError=i}}),Kd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/scanInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scanInternals=void 0;var t=z();function n(e,n,r,i,a){return function(o,s){var c=r,l=n,u=0;o.subscribe(t.createOperatorSubscriber(s,function(t){var n=u++;l=c?e(l,t,n):(c=!0,t),i&&s.next(l)},a&&(function(){c&&s.next(l),s.complete()})))}}e.scanInternals=n}}),qd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/reduce.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reduce=void 0;var t=Kd(),n=R();function r(e,r){return n.operate(t.scanInternals(e,r,arguments.length>=2,!1,!0))}e.reduce=r}}),Jd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/toArray.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toArray=void 0;var t=qd(),n=R(),r=function(e,t){return e.push(t),e};function i(){return n.operate(function(e,n){t.reduce(r,[])(e).subscribe(n)})}e.toArray=i}}),Yd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/joinAllInternals.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.joinAllInternals=void 0;var t=Gl(),n=id(),r=Kl(),i=fd(),a=Jd();function o(e,o){return r.pipe(a.toArray(),i.mergeMap(function(t){return e(t)}),o?n.mapOneOrManyArgs(o):t.identity)}e.joinAllInternals=o}}),Xd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatestAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestAll=void 0;var t=ud(),n=Yd();function r(e){return n.joinAllInternals(t.combineLatest,e)}e.combineLatestAll=r}}),Zd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineAll=void 0,e.combineAll=Xd().combineLatestAll}}),Qd=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatest.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatest=void 0;var r=ud(),i=R(),a=Dd(),o=id(),s=Kl(),c=Tu();function l(){var e=[...arguments],u=c.popResultSelector(e);return u?s.pipe(l.apply(void 0,n([],t(e))),o.mapOneOrManyArgs(u)):i.operate(function(i,o){r.combineLatestInit(n([i],t(a.argsOrArgArray(e))))(o)})}e.combineLatest=l}}),$d=L({"../../node_modules/rxjs/dist/cjs/internal/operators/combineLatestWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.combineLatestWith=void 0;var r=Qd();function i(){var e=[...arguments];return r.combineLatest.apply(void 0,n([],t(e)))}e.combineLatestWith=i}}),ef=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatMap=void 0;var t=fd(),n=Ml();function r(e,r){return n.isFunction(r)?t.mergeMap(e,r,1):t.mergeMap(e,1)}e.concatMap=r}}),tf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatMapTo=void 0;var t=ef(),n=Ml();function r(e,r){return n.isFunction(r)?t.concatMap(function(){return e},r):t.concatMap(function(){return e})}e.concatMapTo=r}}),nf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concat.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.concat=void 0;var r=R(),i=md(),a=Tu(),o=Wu();function s(){var e=[...arguments],s=a.popScheduler(e);return r.operate(function(r,a){i.concatAll()(o.from(n([r],t(e)),s)).subscribe(a)})}e.concat=s}}),rf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/concatWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.concatWith=void 0;var r=nf();function i(){var e=[...arguments];return r.concat.apply(void 0,n([],t(e)))}e.concatWith=i}}),af=L({"../../node_modules/rxjs/dist/cjs/internal/observable/fromSubscribable.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fromSubscribable=void 0;var t=ql();function n(e){return new t.Observable(function(t){return e.subscribe(t)})}e.fromSubscribable=n}}),of=L({"../../node_modules/rxjs/dist/cjs/internal/operators/connect.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.connect=void 0;var t=eu(),n=B(),r=R(),i=af(),a={connector:function(){return new t.Subject}};function o(e,t){t===void 0&&(t=a);var o=t.connector;return r.operate(function(t,r){var a=o();n.innerFrom(e(i.fromSubscribable(a))).subscribe(r),r.add(t.subscribe(a))})}e.connect=o}}),sf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/count.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.count=void 0;var t=qd();function n(e){return t.reduce(function(t,n,r){return!e||e(n,r)?t+1:t},0)}e.count=n}}),cf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/debounce.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=void 0;var t=R(),n=Bl(),r=z(),i=B();function a(e){return t.operate(function(t,a){var o=!1,s=null,c=null,l=function(){if(c?.unsubscribe(),c=null,o){o=!1;var e=s;s=null,a.next(e)}};t.subscribe(r.createOperatorSubscriber(a,function(t){c?.unsubscribe(),o=!0,s=t,c=r.createOperatorSubscriber(a,l,n.noop),i.innerFrom(e(t)).subscribe(c)},function(){l(),a.complete()},void 0,function(){s=c=null}))})}e.debounce=a}}),lf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/debounceTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.debounceTime=void 0;var t=hu(),n=R(),r=z();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.operate(function(t,n){var a=null,o=null,s=null,c=function(){if(a){a.unsubscribe(),a=null;var e=o;o=null,n.next(e)}};function l(){var t=s+e,r=i.now();if(r<t){a=this.schedule(void 0,t-r),n.add(a);return}c()}t.subscribe(r.createOperatorSubscriber(n,function(t){o=t,s=i.now(),a||(a=i.schedule(l,e),n.add(a))},function(){c(),n.complete()},void 0,function(){o=a=null}))})}e.debounceTime=i}}),uf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/defaultIfEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultIfEmpty=void 0;var t=R(),n=z();function r(e){return t.operate(function(t,r){var i=!1;t.subscribe(n.createOperatorSubscriber(r,function(e){i=!0,r.next(e)},function(){i||r.next(e),r.complete()}))})}e.defaultIfEmpty=r}}),df=L({"../../node_modules/rxjs/dist/cjs/internal/operators/take.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.take=void 0;var t=Cu(),n=R(),r=z();function i(e){return e<=0?function(){return t.EMPTY}:n.operate(function(t,n){var i=0;t.subscribe(r.createOperatorSubscriber(n,function(t){++i<=e&&(n.next(t),e<=i&&n.complete())}))})}e.take=i}}),ff=L({"../../node_modules/rxjs/dist/cjs/internal/operators/ignoreElements.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ignoreElements=void 0;var t=R(),n=z(),r=Bl();function i(){return t.operate(function(e,t){e.subscribe(n.createOperatorSubscriber(t,r.noop))})}e.ignoreElements=i}}),pf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapTo=void 0;var t=rd();function n(e){return t.map(function(){return e})}e.mapTo=n}}),mf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/delayWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.delayWhen=void 0;var t=hd(),n=df(),r=ff(),i=pf(),a=fd(),o=B();function s(e,c){return c?function(i){return t.concat(c.pipe(n.take(1),r.ignoreElements()),i.pipe(s(e)))}:a.mergeMap(function(t,r){return o.innerFrom(e(t,r)).pipe(n.take(1),i.mapTo(t))})}e.delayWhen=s}}),hf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/delay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.delay=void 0;var t=hu(),n=mf(),r=Cd();function i(e,i){i===void 0&&(i=t.asyncScheduler);var a=r.timer(e,i);return n.delayWhen(function(){return a})}e.delay=i}}),gf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/dematerialize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dematerialize=void 0;var t=qu(),n=R(),r=z();function i(){return n.operate(function(e,n){e.subscribe(r.createOperatorSubscriber(n,function(e){return t.observeNotification(e,n)}))})}e.dematerialize=i}}),_f=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinct.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinct=void 0;var t=R(),n=z(),r=Bl(),i=B();function a(e,a){return t.operate(function(t,o){var s=new Set;t.subscribe(n.createOperatorSubscriber(o,function(t){var n=e?e(t):t;s.has(n)||(s.add(n),o.next(t))})),a&&i.innerFrom(a).subscribe(n.createOperatorSubscriber(o,function(){return s.clear()},r.noop))})}e.distinct=a}}),vf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinctUntilChanged.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinctUntilChanged=void 0;var t=Gl(),n=R(),r=z();function i(e,i){return i===void 0&&(i=t.identity),e??=a,n.operate(function(t,n){var a,o=!0;t.subscribe(r.createOperatorSubscriber(n,function(t){var r=i(t);(o||!e(a,r))&&(o=!1,a=r,n.next(t))}))})}e.distinctUntilChanged=i;function a(e,t){return e===t}}}),yf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/distinctUntilKeyChanged.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.distinctUntilKeyChanged=void 0;var t=vf();function n(e,n){return t.distinctUntilChanged(function(t,r){return n?n(t[e],r[e]):t[e]===r[e]})}e.distinctUntilKeyChanged=n}}),bf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throwIfEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throwIfEmpty=void 0;var t=Yu(),n=R(),r=z();function i(e){return e===void 0&&(e=a),n.operate(function(t,n){var i=!1;t.subscribe(r.createOperatorSubscriber(n,function(e){i=!0,n.next(e)},function(){return i?n.complete():n.error(e())}))})}e.throwIfEmpty=i;function a(){return new t.EmptyError}}}),xf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/elementAt.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.elementAt=void 0;var t=Qu(),n=jd(),r=bf(),i=uf(),a=df();function o(e,o){if(e<0)throw new t.ArgumentOutOfRangeError;var s=arguments.length>=2;return function(c){return c.pipe(n.filter(function(t,n){return n===e}),a.take(1),s?i.defaultIfEmpty(o):r.throwIfEmpty(function(){return new t.ArgumentOutOfRangeError}))}}e.elementAt=o}}),Sf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/endWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.endWith=void 0;var r=hd(),i=Gu();function a(){var e=[...arguments];return function(a){return r.concat(a,i.of.apply(void 0,n([],t(e))))}}e.endWith=a}}),Cf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/every.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.every=void 0;var t=R(),n=z();function r(e,r){return t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(n){e.call(r,n,a++,t)||(i.next(!1),i.complete())},function(){i.next(!0),i.complete()}))})}e.every=r}}),wf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaustMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaustMap=void 0;var t=rd(),n=B(),r=R(),i=z();function a(e,o){return o?function(r){return r.pipe(a(function(r,i){return n.innerFrom(e(r,i)).pipe(t.map(function(e,t){return o(r,e,i,t)}))}))}:r.operate(function(t,r){var a=0,o=null,s=!1;t.subscribe(i.createOperatorSubscriber(r,function(t){o||(o=i.createOperatorSubscriber(r,void 0,function(){o=null,s&&r.complete()}),n.innerFrom(e(t,a++)).subscribe(o))},function(){s=!0,!o&&r.complete()}))})}e.exhaustMap=a}}),Tf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaustAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaustAll=void 0;var t=wf(),n=Gl();function r(){return t.exhaustMap(n.identity)}e.exhaustAll=r}}),Ef=L({"../../node_modules/rxjs/dist/cjs/internal/operators/exhaust.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.exhaust=void 0,e.exhaust=Tf().exhaustAll}}),Df=L({"../../node_modules/rxjs/dist/cjs/internal/operators/expand.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.expand=void 0;var t=R(),n=dd();function r(e,r,i){return r===void 0&&(r=1/0),r=(r||0)<1?1/0:r,t.operate(function(t,a){return n.mergeInternals(t,a,e,r,void 0,!0,i)})}e.expand=r}}),Of=L({"../../node_modules/rxjs/dist/cjs/internal/operators/finalize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.finalize=void 0;var t=R();function n(e){return t.operate(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}e.finalize=n}}),kf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/find.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createFind=e.find=void 0;var t=R(),n=z();function r(e,n){return t.operate(i(e,n,`value`))}e.find=r;function i(e,t,r){var i=r===`index`;return function(r,a){var o=0;r.subscribe(n.createOperatorSubscriber(a,function(n){var s=o++;e.call(t,n,s,r)&&(a.next(i?s:n),a.complete())},function(){a.next(i?-1:void 0),a.complete()}))}}e.createFind=i}}),Af=L({"../../node_modules/rxjs/dist/cjs/internal/operators/findIndex.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findIndex=void 0;var t=R(),n=kf();function r(e,r){return t.operate(n.createFind(e,r,`index`))}e.findIndex=r}}),jf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/first.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.first=void 0;var t=Yu(),n=jd(),r=df(),i=uf(),a=bf(),o=Gl();function s(e,s){var c=arguments.length>=2;return function(l){return l.pipe(e?n.filter(function(t,n){return e(t,n,l)}):o.identity,r.take(1),c?i.defaultIfEmpty(s):a.throwIfEmpty(function(){return new t.EmptyError}))}}e.first=s}}),Mf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/groupBy.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.groupBy=void 0;var t=ql(),n=B(),r=eu(),i=R(),a=z();function o(e,o,s,c){return i.operate(function(i,l){var u;!o||typeof o==`function`?u=o:(s=o.duration,u=o.element,c=o.connector);var d=new Map,f=function(e){d.forEach(e),e(l)},p=function(e){return f(function(t){return t.error(e)})},m=0,h=!1,g=new a.OperatorSubscriber(l,function(t){try{var i=e(t),o=d.get(i);if(!o){d.set(i,o=c?c():new r.Subject);var f=_(i,o);if(l.next(f),s){var m=a.createOperatorSubscriber(o,function(){o.complete(),m?.unsubscribe()},void 0,void 0,function(){return d.delete(i)});g.add(n.innerFrom(s(f)).subscribe(m))}}o.next(u?u(t):t)}catch(e){p(e)}},function(){return f(function(e){return e.complete()})},p,function(){return d.clear()},function(){return h=!0,m===0});i.subscribe(g);function _(e,n){var r=new t.Observable(function(e){m++;var t=n.subscribe(e);return function(){t.unsubscribe(),--m===0&&h&&g.unsubscribe()}});return r.key=e,r}})}e.groupBy=o}}),Nf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/isEmpty.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isEmpty=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){e.subscribe(n.createOperatorSubscriber(t,function(){t.next(!1),t.complete()},function(){t.next(!0),t.complete()}))})}e.isEmpty=r}}),Pf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeLast.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.takeLast=void 0;var n=Cu(),r=R(),i=z();function a(e){return e<=0?function(){return n.EMPTY}:r.operate(function(n,r){var a=[];n.subscribe(i.createOperatorSubscriber(r,function(t){a.push(t),e<a.length&&a.shift()},function(){var e,n;try{for(var i=t(a),o=i.next();!o.done;o=i.next()){var s=o.value;r.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}r.complete()},void 0,function(){a=null}))})}e.takeLast=a}}),Ff=L({"../../node_modules/rxjs/dist/cjs/internal/operators/last.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.last=void 0;var t=Yu(),n=jd(),r=Pf(),i=bf(),a=uf(),o=Gl();function s(e,s){var c=arguments.length>=2;return function(l){return l.pipe(e?n.filter(function(t,n){return e(t,n,l)}):o.identity,r.takeLast(1),c?a.defaultIfEmpty(s):i.throwIfEmpty(function(){return new t.EmptyError}))}}e.last=s}}),If=L({"../../node_modules/rxjs/dist/cjs/internal/operators/materialize.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.materialize=void 0;var t=qu(),n=R(),r=z();function i(){return n.operate(function(e,n){e.subscribe(r.createOperatorSubscriber(n,function(e){n.next(t.Notification.createNext(e))},function(){n.next(t.Notification.createComplete()),n.complete()},function(e){n.next(t.Notification.createError(e)),n.complete()}))})}e.materialize=i}}),Lf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/max.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.max=void 0;var t=qd(),n=Ml();function r(e){return t.reduce(n.isFunction(e)?function(t,n){return e(t,n)>0?t:n}:function(e,t){return e>t?e:t})}e.max=r}}),Rf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/flatMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.flatMap=void 0,e.flatMap=fd().mergeMap}}),zf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeMapTo=void 0;var t=fd(),n=Ml();function r(e,r,i){return i===void 0&&(i=1/0),n.isFunction(r)?t.mergeMap(function(){return e},r,i):(typeof r==`number`&&(i=r),t.mergeMap(function(){return e},i))}e.mergeMapTo=r}}),Bf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeScan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeScan=void 0;var t=R(),n=dd();function r(e,r,i){return i===void 0&&(i=1/0),t.operate(function(t,a){var o=r;return n.mergeInternals(t,a,function(t,n){return e(o,t,n)},i,function(e){o=e},!1,void 0,function(){return o=null})})}e.mergeScan=r}}),Vf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/merge.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.merge=void 0;var r=R(),i=pd(),a=Tu(),o=Wu();function s(){var e=[...arguments],s=a.popScheduler(e),c=a.popNumber(e,1/0);return r.operate(function(r,a){i.mergeAll(c)(o.from(n([r],t(e)),s)).subscribe(a)})}e.merge=s}}),Hf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/mergeWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.mergeWith=void 0;var r=Vf();function i(){var e=[...arguments];return r.merge.apply(void 0,n([],t(e)))}e.mergeWith=i}}),Uf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/min.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.min=void 0;var t=qd(),n=Ml();function r(e){return t.reduce(n.isFunction(e)?function(t,n){return e(t,n)<0?t:n}:function(e,t){return e<t?e:t})}e.min=r}}),Wf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/multicast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.multicast=void 0;var t=Yl(),n=Ml(),r=of();function i(e,i){var a=n.isFunction(e)?e:function(){return e};return n.isFunction(i)?r.connect(i,{connector:a}):function(e){return new t.ConnectableObservable(e,a)}}e.multicast=i}}),Gf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/onErrorResumeNextWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.onErrorResumeNext=e.onErrorResumeNextWith=void 0;var r=Dd(),i=Od();function a(){var e=[...arguments],a=r.argsOrArgArray(e);return function(e){return i.onErrorResumeNext.apply(void 0,n([e],t(a)))}}e.onErrorResumeNextWith=a,e.onErrorResumeNext=a}}),Kf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/pairwise.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pairwise=void 0;var t=R(),n=z();function r(){return t.operate(function(e,t){var r,i=!1;e.subscribe(n.createOperatorSubscriber(t,function(e){var n=r;r=e,i&&t.next([n,e]),i=!0}))})}e.pairwise=r}}),qf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/pluck.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pluck=void 0;var t=rd();function n(){var e=[...arguments],n=e.length;if(n===0)throw Error(`list of properties cannot be empty.`);return t.map(function(t){for(var r=t,i=0;i<n;i++){var a=r?.[e[i]];if(a!==void 0)r=a;else return}return r})}e.pluck=n}}),Jf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publish.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publish=void 0;var t=eu(),n=Wf(),r=of();function i(e){return e?function(t){return r.connect(e)(t)}:function(e){return n.multicast(new t.Subject)(e)}}e.publish=i}}),Yf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishBehavior.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishBehavior=void 0;var t=tu(),n=Yl();function r(e){return function(r){var i=new t.BehaviorSubject(e);return new n.ConnectableObservable(r,function(){return i})}}e.publishBehavior=r}}),Xf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishLast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishLast=void 0;var t=iu(),n=Yl();function r(){return function(e){var r=new t.AsyncSubject;return new n.ConnectableObservable(e,function(){return r})}}e.publishLast=r}}),Zf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/publishReplay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.publishReplay=void 0;var t=ru(),n=Wf(),r=Ml();function i(e,i,a,o){a&&!r.isFunction(a)&&(o=a);var s=r.isFunction(a)?a:void 0;return function(r){return n.multicast(new t.ReplaySubject(e,i,o),s)(r)}}e.publishReplay=i}}),Qf=L({"../../node_modules/rxjs/dist/cjs/internal/operators/raceWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.raceWith=void 0;var r=Nd(),i=R(),a=Gl();function o(){var e=[...arguments];return e.length?i.operate(function(i,a){r.raceInit(n([i],t(e)))(a)}):a.identity}e.raceWith=o}}),$f=L({"../../node_modules/rxjs/dist/cjs/internal/operators/repeat.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.repeat=void 0;var t=Cu(),n=R(),r=z(),i=B(),a=Cd();function o(e){var o,s=1/0,c;return e!=null&&(typeof e==`object`?(o=e.count,s=o===void 0?1/0:o,c=e.delay):s=e),s<=0?function(){return t.EMPTY}:n.operate(function(e,t){var n=0,o,l=function(){if(o?.unsubscribe(),o=null,c!=null){var e=typeof c==`number`?a.timer(c):i.innerFrom(c(n)),s=r.createOperatorSubscriber(t,function(){s.unsubscribe(),u()});e.subscribe(s)}else u()},u=function(){var i=!1;o=e.subscribe(r.createOperatorSubscriber(t,void 0,function(){++n<s?o?l():i=!0:t.complete()})),i&&l()};u()})}e.repeat=o}}),ep=L({"../../node_modules/rxjs/dist/cjs/internal/operators/repeatWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.repeatWhen=void 0;var t=B(),n=eu(),r=R(),i=z();function a(e){return r.operate(function(r,a){var o,s=!1,c,l=!1,u=!1,d=function(){return u&&l&&(a.complete(),!0)},f=function(){return c||(c=new n.Subject,t.innerFrom(e(c)).subscribe(i.createOperatorSubscriber(a,function(){o?p():s=!0},function(){l=!0,d()}))),c},p=function(){u=!1,o=r.subscribe(i.createOperatorSubscriber(a,void 0,function(){u=!0,!d()&&f().next()})),s&&(o.unsubscribe(),o=null,s=!1,p())};p()})}e.repeatWhen=a}}),tp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/retry.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.retry=void 0;var t=R(),n=z(),r=Gl(),i=Cd(),a=B();function o(e){e===void 0&&(e=1/0);var o=e&&typeof e==`object`?e:{count:e},s=o.count,c=s===void 0?1/0:s,l=o.delay,u=o.resetOnSuccess,d=u!==void 0&&u;return c<=0?r.identity:t.operate(function(e,t){var r=0,o,s=function(){var u=!1;o=e.subscribe(n.createOperatorSubscriber(t,function(e){d&&(r=0),t.next(e)},void 0,function(e){if(r++<c){var d=function(){o?(o.unsubscribe(),o=null,s()):u=!0};if(l!=null){var f=typeof l==`number`?i.timer(l):a.innerFrom(l(e,r)),p=n.createOperatorSubscriber(t,function(){p.unsubscribe(),d()},function(){t.complete()});f.subscribe(p)}else d()}else t.error(e)})),u&&(o.unsubscribe(),o=null,s())};s()})}e.retry=o}}),np=L({"../../node_modules/rxjs/dist/cjs/internal/operators/retryWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.retryWhen=void 0;var t=B(),n=eu(),r=R(),i=z();function a(e){return r.operate(function(r,a){var o,s=!1,c,l=function(){o=r.subscribe(i.createOperatorSubscriber(a,void 0,void 0,function(r){c||(c=new n.Subject,t.innerFrom(e(c)).subscribe(i.createOperatorSubscriber(a,function(){return o?l():s=!0}))),c&&c.next(r)})),s&&(o.unsubscribe(),o=null,s=!1,l())};l()})}e.retryWhen=a}}),rp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sample.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sample=void 0;var t=B(),n=R(),r=Bl(),i=z();function a(e){return n.operate(function(n,a){var o=!1,s=null;n.subscribe(i.createOperatorSubscriber(a,function(e){o=!0,s=e})),t.innerFrom(e).subscribe(i.createOperatorSubscriber(a,function(){if(o){o=!1;var e=s;s=null,a.next(e)}},r.noop))})}e.sample=a}}),ip=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sampleTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sampleTime=void 0;var t=hu(),n=rp(),r=wd();function i(e,i){return i===void 0&&(i=t.asyncScheduler),n.sample(r.interval(e,i))}e.sampleTime=i}}),ap=L({"../../node_modules/rxjs/dist/cjs/internal/operators/scan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.scan=void 0;var t=R(),n=Kd();function r(e,r){return t.operate(n.scanInternals(e,r,arguments.length>=2,!0))}e.scan=r}}),op=L({"../../node_modules/rxjs/dist/cjs/internal/operators/sequenceEqual.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sequenceEqual=void 0;var t=R(),n=z(),r=B();function i(e,i){return i===void 0&&(i=function(e,t){return e===t}),t.operate(function(t,o){var s=a(),c=a(),l=function(e){o.next(e),o.complete()},u=function(e,t){var r=n.createOperatorSubscriber(o,function(n){var r=t.buffer,a=t.complete;r.length===0?a?l(!1):e.buffer.push(n):!i(n,r.shift())&&l(!1)},function(){e.complete=!0;var n=t.complete,i=t.buffer;n&&l(i.length===0),r?.unsubscribe()});return r};t.subscribe(u(s,c)),r.innerFrom(e).subscribe(u(c,s))})}e.sequenceEqual=i;function a(){return{buffer:[],complete:!1}}}}),sp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/share.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.share=void 0;var r=B(),i=eu(),a=Ul(),o=R();function s(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new i.Subject}:t,s=e.resetOnError,l=s===void 0||s,u=e.resetOnComplete,d=u===void 0||u,f=e.resetOnRefCountZero,p=f===void 0||f;return function(e){var t,i,s,u=0,f=!1,m=!1,h=function(){i?.unsubscribe(),i=void 0},g=function(){h(),t=s=void 0,f=m=!1},_=function(){var e=t;g(),e?.unsubscribe()};return o.operate(function(e,o){u++,!m&&!f&&h();var v=s??=n();o.add(function(){u--,u===0&&!m&&!f&&(i=c(_,p))}),v.subscribe(o),!t&&u>0&&(t=new a.SafeSubscriber({next:function(e){return v.next(e)},error:function(e){m=!0,h(),i=c(g,l,e),v.error(e)},complete:function(){f=!0,h(),i=c(g,d),v.complete()}}),r.innerFrom(e).subscribe(t))})(e)}}e.share=s;function c(e,i){var o=[...arguments].slice(2);if(i===!0){e();return}if(i!==!1){var s=new a.SafeSubscriber({next:function(){s.unsubscribe(),e()}});return r.innerFrom(i.apply(void 0,n([],t(o)))).subscribe(s)}}}}),cp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/shareReplay.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.shareReplay=void 0;var t=ru(),n=sp();function r(e,r,i){var a,o,s,c,l=!1;return e&&typeof e==`object`?(a=e.bufferSize,c=a===void 0?1/0:a,o=e.windowTime,r=o===void 0?1/0:o,s=e.refCount,l=s!==void 0&&s,i=e.scheduler):c=e??1/0,n.share({connector:function(){return new t.ReplaySubject(c,r,i)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:l})}e.shareReplay=r}}),lp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/single.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.single=void 0;var t=Yu(),n=ed(),r=$u(),i=R(),a=z();function o(e){return i.operate(function(i,o){var s=!1,c,l=!1,u=0;i.subscribe(a.createOperatorSubscriber(o,function(t){l=!0,(!e||e(t,u++,i))&&(s&&o.error(new n.SequenceError(`Too many matching values`)),s=!0,c=t)},function(){s?(o.next(c),o.complete()):o.error(l?new r.NotFoundError(`No matching values`):new t.EmptyError)}))})}e.single=o}}),up=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skip.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skip=void 0;var t=jd();function n(e){return t.filter(function(t,n){return e<=n})}e.skip=n}}),dp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipLast.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipLast=void 0;var t=Gl(),n=R(),r=z();function i(e){return e<=0?t.identity:n.operate(function(t,n){var i=Array(e),a=0;return t.subscribe(r.createOperatorSubscriber(n,function(t){var r=a++;if(r<e)i[r]=t;else{var o=r%e,s=i[o];i[o]=t,n.next(s)}})),function(){i=null}})}e.skipLast=i}}),fp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipUntil.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipUntil=void 0;var t=R(),n=z(),r=B(),i=Bl();function a(e){return t.operate(function(t,a){var o=!1,s=n.createOperatorSubscriber(a,function(){s?.unsubscribe(),o=!0},i.noop);r.innerFrom(e).subscribe(s),t.subscribe(n.createOperatorSubscriber(a,function(e){return o&&a.next(e)}))})}e.skipUntil=a}}),pp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/skipWhile.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.skipWhile=void 0;var t=R(),n=z();function r(e){return t.operate(function(t,r){var i=!1,a=0;t.subscribe(n.createOperatorSubscriber(r,function(t){return(i||=!e(t,a++))&&r.next(t)}))})}e.skipWhile=r}}),mp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/startWith.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.startWith=void 0;var t=hd(),n=Tu(),r=R();function i(){var e=[...arguments],i=n.popScheduler(e);return r.operate(function(n,r){(i?t.concat(e,n,i):t.concat(e,n)).subscribe(r)})}e.startWith=i}}),hp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchMap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchMap=void 0;var t=B(),n=R(),r=z();function i(e,i){return n.operate(function(n,a){var o=null,s=0,c=!1,l=function(){return c&&!o&&a.complete()};n.subscribe(r.createOperatorSubscriber(a,function(n){o?.unsubscribe();var c=0,u=s++;t.innerFrom(e(n,u)).subscribe(o=r.createOperatorSubscriber(a,function(e){return a.next(i?i(n,e,u,c++):e)},function(){o=null,l()}))},function(){c=!0,l()}))})}e.switchMap=i}}),gp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchAll=void 0;var t=hp(),n=Gl();function r(){return t.switchMap(n.identity)}e.switchAll=r}}),_p=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchMapTo.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchMapTo=void 0;var t=hp(),n=Ml();function r(e,r){return n.isFunction(r)?t.switchMap(function(){return e},r):t.switchMap(function(){return e})}e.switchMapTo=r}}),vp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/switchScan.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.switchScan=void 0;var t=hp(),n=R();function r(e,r){return n.operate(function(n,i){var a=r;return t.switchMap(function(t,n){return e(a,t,n)},function(e,t){return a=t,t})(n).subscribe(i),function(){a=null}})}e.switchScan=r}}),yp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeUntil.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.takeUntil=void 0;var t=R(),n=z(),r=B(),i=Bl();function a(e){return t.operate(function(t,a){r.innerFrom(e).subscribe(n.createOperatorSubscriber(a,function(){return a.complete()},i.noop)),!a.closed&&t.subscribe(a)})}e.takeUntil=a}}),bp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/takeWhile.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.takeWhile=void 0;var t=R(),n=z();function r(e,r){return r===void 0&&(r=!1),t.operate(function(t,i){var a=0;t.subscribe(n.createOperatorSubscriber(i,function(t){var n=e(t,a++);(n||r)&&i.next(t),!n&&i.complete()}))})}e.takeWhile=r}}),xp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/tap.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tap=void 0;var t=Ml(),n=R(),r=z(),i=Gl();function a(e,a,o){var s=t.isFunction(e)||a||o?{next:e,error:a,complete:o}:e;return s?n.operate(function(e,t){var n;(n=s.subscribe)==null||n.call(s);var i=!0;e.subscribe(r.createOperatorSubscriber(t,function(e){var n;(n=s.next)==null||n.call(s,e),t.next(e)},function(){var e;i=!1,(e=s.complete)==null||e.call(s),t.complete()},function(e){var n;i=!1,(n=s.error)==null||n.call(s,e),t.error(e)},function(){var e,t;i&&((e=s.unsubscribe)==null||e.call(s)),(t=s.finalize)==null||t.call(s)}))}):i.identity}e.tap=a}}),Sp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throttle.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throttle=void 0;var t=R(),n=z(),r=B();function i(e,i){return t.operate(function(t,a){var o=i??{},s=o.leading,c=s===void 0||s,l=o.trailing,u=l!==void 0&&l,d=!1,f=null,p=null,m=!1,h=function(){p?.unsubscribe(),p=null,u&&(v(),m&&a.complete())},g=function(){p=null,m&&a.complete()},_=function(t){return p=r.innerFrom(e(t)).subscribe(n.createOperatorSubscriber(a,h,g))},v=function(){if(d){d=!1;var e=f;f=null,a.next(e),!m&&_(e)}};t.subscribe(n.createOperatorSubscriber(a,function(e){d=!0,f=e,!(p&&!p.closed)&&(c?v():_(e))},function(){m=!0,!(u&&d&&p&&!p.closed)&&a.complete()}))})}e.throttle=i}}),Cp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/throttleTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.throttleTime=void 0;var t=hu(),n=Sp(),r=Cd();function i(e,i,a){i===void 0&&(i=t.asyncScheduler);var o=r.timer(e,i);return n.throttle(function(){return o},a)}e.throttleTime=i}}),wp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeInterval.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TimeInterval=e.timeInterval=void 0;var t=hu(),n=R(),r=z();function i(e){return e===void 0&&(e=t.asyncScheduler),n.operate(function(t,n){var i=e.now();t.subscribe(r.createOperatorSubscriber(n,function(t){var r=e.now(),o=r-i;i=r,n.next(new a(t,o))}))})}e.timeInterval=i;var a=(function(){function e(e,t){this.value=e,this.interval=t}return e})();e.TimeInterval=a}}),Tp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timeoutWith.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutWith=void 0;var t=hu(),n=td(),r=nd();function i(e,i,a){var o,s,c;if(a??=t.async,n.isValidDate(e)?o=e:typeof e==`number`&&(s=e),i)c=function(){return i};else throw TypeError(`No observable provided to switch to`);if(o==null&&s==null)throw TypeError(`No timeout provided.`);return r.timeout({first:o,each:s,scheduler:a,with:c})}e.timeoutWith=i}}),Ep=L({"../../node_modules/rxjs/dist/cjs/internal/operators/timestamp.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timestamp=void 0;var t=nu(),n=rd();function r(e){return e===void 0&&(e=t.dateTimestampProvider),n.map(function(t){return{value:t,timestamp:e.now()}})}e.timestamp=r}}),Dp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/window.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.window=void 0;var t=eu(),n=R(),r=z(),i=Bl(),a=B();function o(e){return n.operate(function(n,o){var s=new t.Subject;o.next(s.asObservable());var c=function(e){s.error(e),o.error(e)};return n.subscribe(r.createOperatorSubscriber(o,function(e){return s?.next(e)},function(){s.complete(),o.complete()},c)),a.innerFrom(e).subscribe(r.createOperatorSubscriber(o,function(){s.complete(),o.next(s=new t.Subject)},i.noop,c)),function(){s?.unsubscribe(),s=null}})}e.window=o}}),Op=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowCount.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.windowCount=void 0;var n=eu(),r=R(),i=z();function a(e,a){a===void 0&&(a=0);var o=a>0?a:e;return r.operate(function(r,a){var s=[new n.Subject],c=0;a.next(s[0].asObservable()),r.subscribe(i.createOperatorSubscriber(a,function(r){var i,l;try{for(var u=t(s),d=u.next();!d.done;d=u.next())d.value.next(r)}catch(e){i={error:e}}finally{try{d&&!d.done&&(l=u.return)&&l.call(u)}finally{if(i)throw i.error}}var f=c-e+1;if(f>=0&&f%o===0&&s.shift().complete(),++c%o===0){var p=new n.Subject;s.push(p),a.next(p.asObservable())}},function(){for(;s.length>0;)s.shift().complete();a.complete()},function(e){for(;s.length>0;)s.shift().error(e);a.error(e)},function(){s=null}))})}e.windowCount=a}}),kp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowTime.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.windowTime=void 0;var t=eu(),n=hu(),r=Il(),i=R(),a=z(),o=Fl(),s=Tu(),c=Pu();function l(e){var l=[...arguments].slice(1),u=s.popScheduler(l)??n.asyncScheduler,d=l[0]??null,f=l[1]||1/0;return i.operate(function(n,i){var s=[],l=!1,p=function(e){var t=e.window,n=e.subs;t.complete(),n.unsubscribe(),o.arrRemove(s,e),l&&m()},m=function(){if(s){var n=new r.Subscription;i.add(n);var a=new t.Subject,o={window:a,subs:n,seen:0};s.push(o),i.next(a.asObservable()),c.executeSchedule(n,u,function(){return p(o)},e)}};d!==null&&d>=0?c.executeSchedule(i,u,m,d,!0):l=!0,m();var h=function(e){return s.slice().forEach(e)},g=function(e){h(function(t){var n=t.window;return e(n)}),e(i),i.unsubscribe()};return n.subscribe(a.createOperatorSubscriber(i,function(e){h(function(t){t.window.next(e),f<=++t.seen&&p(t)})},function(){return g(function(e){return e.complete()})},function(e){return g(function(t){return t.error(e)})})),function(){s=null}})}e.windowTime=l}}),Ap=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowToggle.js"(e){var t=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.windowToggle=void 0;var n=eu(),r=Il(),i=R(),a=B(),o=z(),s=Bl(),c=Fl();function l(e,l){return i.operate(function(i,u){var d=[],f=function(e){for(;0<d.length;)d.shift().error(e);u.error(e)};a.innerFrom(e).subscribe(o.createOperatorSubscriber(u,function(e){var t=new n.Subject;d.push(t);var i=new r.Subscription,p=function(){c.arrRemove(d,t),t.complete(),i.unsubscribe()},m;try{m=a.innerFrom(l(e))}catch(e){f(e);return}u.next(t.asObservable()),i.add(m.subscribe(o.createOperatorSubscriber(u,p,s.noop,f)))},s.noop)),i.subscribe(o.createOperatorSubscriber(u,function(e){var n,r,i=d.slice();try{for(var a=t(i),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},function(){for(;0<d.length;)d.shift().complete();u.complete()},f,function(){for(;0<d.length;)d.shift().unsubscribe()}))})}e.windowToggle=l}}),jp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/windowWhen.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.windowWhen=void 0;var t=eu(),n=R(),r=z(),i=B();function a(e){return n.operate(function(n,a){var o,s,c=function(e){o.error(e),a.error(e)},l=function(){s?.unsubscribe(),o?.complete(),o=new t.Subject,a.next(o.asObservable());var n;try{n=i.innerFrom(e())}catch(e){c(e);return}n.subscribe(s=r.createOperatorSubscriber(a,l,l,c))};l(),n.subscribe(r.createOperatorSubscriber(a,function(e){return o.next(e)},function(){o.complete(),a.complete()},c,function(){s?.unsubscribe(),o=null}))})}e.windowWhen=a}}),Mp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/withLatestFrom.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.withLatestFrom=void 0;var r=R(),i=z(),a=B(),o=Gl(),s=Bl(),c=Tu();function l(){var e=[...arguments],l=c.popResultSelector(e);return r.operate(function(r,c){for(var u=e.length,d=Array(u),f=e.map(function(){return!1}),p=!1,m=function(t){a.innerFrom(e[t]).subscribe(i.createOperatorSubscriber(c,function(e){d[t]=e,!p&&!f[t]&&(f[t]=!0,(p=f.every(o.identity))&&(f=null))},s.noop))},h=0;h<u;h++)m(h);r.subscribe(i.createOperatorSubscriber(c,function(e){if(p){var r=n([e],t(d));c.next(l?l.apply(void 0,n([],t(r))):r)}}))})}e.withLatestFrom=l}}),Np=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zipAll.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.zipAll=void 0;var t=Id(),n=Yd();function r(e){return n.joinAllInternals(t.zip,e)}e.zipAll=r}}),Pp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zip.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zip=void 0;var r=Id(),i=R();function a(){var e=[...arguments];return i.operate(function(i,a){r.zip.apply(void 0,n([i],t(e))).subscribe(a)})}e.zip=a}}),Fp=L({"../../node_modules/rxjs/dist/cjs/internal/operators/zipWith.js"(e){var t=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.zipWith=void 0;var r=Pp();function i(){var e=[...arguments];return r.zip.apply(void 0,n([],t(e)))}e.zipWith=i}}),Ip=L({"../../node_modules/rxjs/dist/cjs/index.js"(e){var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.interval=e.iif=e.generate=e.fromEventPattern=e.fromEvent=e.from=e.forkJoin=e.empty=e.defer=e.connectable=e.concat=e.combineLatest=e.bindNodeCallback=e.bindCallback=e.UnsubscriptionError=e.TimeoutError=e.SequenceError=e.ObjectUnsubscribedError=e.NotFoundError=e.EmptyError=e.ArgumentOutOfRangeError=e.firstValueFrom=e.lastValueFrom=e.isObservable=e.identity=e.noop=e.pipe=e.NotificationKind=e.Notification=e.Subscriber=e.Subscription=e.Scheduler=e.VirtualAction=e.VirtualTimeScheduler=e.animationFrameScheduler=e.animationFrame=e.queueScheduler=e.queue=e.asyncScheduler=e.async=e.asapScheduler=e.asap=e.AsyncSubject=e.ReplaySubject=e.BehaviorSubject=e.Subject=e.animationFrames=e.observable=e.ConnectableObservable=e.Observable=void 0,e.filter=e.expand=e.exhaustMap=e.exhaustAll=e.exhaust=e.every=e.endWith=e.elementAt=e.distinctUntilKeyChanged=e.distinctUntilChanged=e.distinct=e.dematerialize=e.delayWhen=e.delay=e.defaultIfEmpty=e.debounceTime=e.debounce=e.count=e.connect=e.concatWith=e.concatMapTo=e.concatMap=e.concatAll=e.combineLatestWith=e.combineLatestAll=e.combineAll=e.catchError=e.bufferWhen=e.bufferToggle=e.bufferTime=e.bufferCount=e.buffer=e.auditTime=e.audit=e.config=e.NEVER=e.EMPTY=e.scheduled=e.zip=e.using=e.timer=e.throwError=e.range=e.race=e.partition=e.pairs=e.onErrorResumeNext=e.of=e.never=e.merge=void 0,e.switchMap=e.switchAll=e.subscribeOn=e.startWith=e.skipWhile=e.skipUntil=e.skipLast=e.skip=e.single=e.shareReplay=e.share=e.sequenceEqual=e.scan=e.sampleTime=e.sample=e.refCount=e.retryWhen=e.retry=e.repeatWhen=e.repeat=e.reduce=e.raceWith=e.publishReplay=e.publishLast=e.publishBehavior=e.publish=e.pluck=e.pairwise=e.onErrorResumeNextWith=e.observeOn=e.multicast=e.min=e.mergeWith=e.mergeScan=e.mergeMapTo=e.mergeMap=e.flatMap=e.mergeAll=e.max=e.materialize=e.mapTo=e.map=e.last=e.isEmpty=e.ignoreElements=e.groupBy=e.first=e.findIndex=e.find=e.finalize=void 0,e.zipWith=e.zipAll=e.withLatestFrom=e.windowWhen=e.windowToggle=e.windowTime=e.windowCount=e.window=e.toArray=e.timestamp=e.timeoutWith=e.timeout=e.timeInterval=e.throwIfEmpty=e.throttleTime=e.throttle=e.tap=e.takeWhile=e.takeUntil=e.takeLast=e.take=e.switchScan=e.switchMapTo=void 0;var r=ql();Object.defineProperty(e,"Observable",{enumerable:!0,get:function(){return r.Observable}});var i=Yl();Object.defineProperty(e,"ConnectableObservable",{enumerable:!0,get:function(){return i.ConnectableObservable}});var a=Wl();Object.defineProperty(e,"observable",{enumerable:!0,get:function(){return a.observable}});var o=Ql();Object.defineProperty(e,"animationFrames",{enumerable:!0,get:function(){return o.animationFrames}});var s=eu();Object.defineProperty(e,"Subject",{enumerable:!0,get:function(){return s.Subject}});var c=tu();Object.defineProperty(e,"BehaviorSubject",{enumerable:!0,get:function(){return c.BehaviorSubject}});var l=ru();Object.defineProperty(e,"ReplaySubject",{enumerable:!0,get:function(){return l.ReplaySubject}});var u=iu();Object.defineProperty(e,"AsyncSubject",{enumerable:!0,get:function(){return u.AsyncSubject}});var d=mu();Object.defineProperty(e,"asap",{enumerable:!0,get:function(){return d.asap}}),Object.defineProperty(e,"asapScheduler",{enumerable:!0,get:function(){return d.asapScheduler}});var f=hu();Object.defineProperty(e,"async",{enumerable:!0,get:function(){return f.async}}),Object.defineProperty(e,"asyncScheduler",{enumerable:!0,get:function(){return f.asyncScheduler}});var p=vu();Object.defineProperty(e,"queue",{enumerable:!0,get:function(){return p.queue}}),Object.defineProperty(e,"queueScheduler",{enumerable:!0,get:function(){return p.queueScheduler}});var m=xu();Object.defineProperty(e,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(e,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var h=Su();Object.defineProperty(e,"VirtualTimeScheduler",{enumerable:!0,get:function(){return h.VirtualTimeScheduler}}),Object.defineProperty(e,"VirtualAction",{enumerable:!0,get:function(){return h.VirtualAction}});var g=du();Object.defineProperty(e,"Scheduler",{enumerable:!0,get:function(){return g.Scheduler}});var _=Il();Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return _.Subscription}});var v=Ul();Object.defineProperty(e,"Subscriber",{enumerable:!0,get:function(){return v.Subscriber}});var y=qu();Object.defineProperty(e,"Notification",{enumerable:!0,get:function(){return y.Notification}}),Object.defineProperty(e,"NotificationKind",{enumerable:!0,get:function(){return y.NotificationKind}});var b=Kl();Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return b.pipe}});var x=Bl();Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return x.noop}});var S=Gl();Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return S.identity}});var C=Ju();Object.defineProperty(e,"isObservable",{enumerable:!0,get:function(){return C.isObservable}});var w=Xu();Object.defineProperty(e,"lastValueFrom",{enumerable:!0,get:function(){return w.lastValueFrom}});var T=Zu();Object.defineProperty(e,"firstValueFrom",{enumerable:!0,get:function(){return T.firstValueFrom}});var E=Qu();Object.defineProperty(e,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return E.ArgumentOutOfRangeError}});var D=Yu();Object.defineProperty(e,"EmptyError",{enumerable:!0,get:function(){return D.EmptyError}});var O=$u();Object.defineProperty(e,"NotFoundError",{enumerable:!0,get:function(){return O.NotFoundError}});var k=$l();Object.defineProperty(e,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return k.ObjectUnsubscribedError}});var A=ed();Object.defineProperty(e,"SequenceError",{enumerable:!0,get:function(){return A.SequenceError}});var j=nd();Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return j.TimeoutError}});var ee=Pl();Object.defineProperty(e,"UnsubscriptionError",{enumerable:!0,get:function(){return ee.UnsubscriptionError}});var M=od();Object.defineProperty(e,"bindCallback",{enumerable:!0,get:function(){return M.bindCallback}});var N=sd();Object.defineProperty(e,"bindNodeCallback",{enumerable:!0,get:function(){return N.bindNodeCallback}});var te=ud();Object.defineProperty(e,"combineLatest",{enumerable:!0,get:function(){return te.combineLatest}});var ne=hd();Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return ne.concat}});var re=_d();Object.defineProperty(e,"connectable",{enumerable:!0,get:function(){return re.connectable}});var ie=gd();Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return ie.defer}});var ae=Cu();Object.defineProperty(e,"empty",{enumerable:!0,get:function(){return ae.empty}});var oe=vd();Object.defineProperty(e,"forkJoin",{enumerable:!0,get:function(){return oe.forkJoin}});var se=Wu();Object.defineProperty(e,"from",{enumerable:!0,get:function(){return se.from}});var ce=yd();Object.defineProperty(e,"fromEvent",{enumerable:!0,get:function(){return ce.fromEvent}});var le=bd();Object.defineProperty(e,"fromEventPattern",{enumerable:!0,get:function(){return le.fromEventPattern}});var P=xd();Object.defineProperty(e,"generate",{enumerable:!0,get:function(){return P.generate}});var F=Sd();Object.defineProperty(e,"iif",{enumerable:!0,get:function(){return F.iif}});var ue=wd();Object.defineProperty(e,"interval",{enumerable:!0,get:function(){return ue.interval}});var de=Td();Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return de.merge}});var I=Ed();Object.defineProperty(e,"never",{enumerable:!0,get:function(){return I.never}});var fe=Gu();Object.defineProperty(e,"of",{enumerable:!0,get:function(){return fe.of}});var pe=Od();Object.defineProperty(e,"onErrorResumeNext",{enumerable:!0,get:function(){return pe.onErrorResumeNext}});var me=kd();Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return me.pairs}});var he=Md();Object.defineProperty(e,"partition",{enumerable:!0,get:function(){return he.partition}});var ge=Nd();Object.defineProperty(e,"race",{enumerable:!0,get:function(){return ge.race}});var _e=Pd();Object.defineProperty(e,"range",{enumerable:!0,get:function(){return _e.range}});var ve=Ku();Object.defineProperty(e,"throwError",{enumerable:!0,get:function(){return ve.throwError}});var ye=Cd();Object.defineProperty(e,"timer",{enumerable:!0,get:function(){return ye.timer}});var be=Fd();Object.defineProperty(e,"using",{enumerable:!0,get:function(){return be.using}});var xe=Id();Object.defineProperty(e,"zip",{enumerable:!0,get:function(){return xe.zip}});var Se=Uu();Object.defineProperty(e,"scheduled",{enumerable:!0,get:function(){return Se.scheduled}});var Ce=Cu();Object.defineProperty(e,"EMPTY",{enumerable:!0,get:function(){return Ce.EMPTY}});var we=Ed();Object.defineProperty(e,"NEVER",{enumerable:!0,get:function(){return we.NEVER}}),n(Ld(),e);var Te=Ll();Object.defineProperty(e,"config",{enumerable:!0,get:function(){return Te.config}});var L=Rd();Object.defineProperty(e,"audit",{enumerable:!0,get:function(){return L.audit}});var Ee=zd();Object.defineProperty(e,"auditTime",{enumerable:!0,get:function(){return Ee.auditTime}});var De=Bd();Object.defineProperty(e,"buffer",{enumerable:!0,get:function(){return De.buffer}});var Oe=Vd();Object.defineProperty(e,"bufferCount",{enumerable:!0,get:function(){return Oe.bufferCount}});var ke=Hd();Object.defineProperty(e,"bufferTime",{enumerable:!0,get:function(){return ke.bufferTime}});var Ae=Ud();Object.defineProperty(e,"bufferToggle",{enumerable:!0,get:function(){return Ae.bufferToggle}});var je=Wd();Object.defineProperty(e,"bufferWhen",{enumerable:!0,get:function(){return je.bufferWhen}});var Me=Gd();Object.defineProperty(e,"catchError",{enumerable:!0,get:function(){return Me.catchError}});var Ne=Zd();Object.defineProperty(e,"combineAll",{enumerable:!0,get:function(){return Ne.combineAll}});var Pe=Xd();Object.defineProperty(e,"combineLatestAll",{enumerable:!0,get:function(){return Pe.combineLatestAll}});var Fe=$d();Object.defineProperty(e,"combineLatestWith",{enumerable:!0,get:function(){return Fe.combineLatestWith}});var Ie=md();Object.defineProperty(e,"concatAll",{enumerable:!0,get:function(){return Ie.concatAll}});var Le=ef();Object.defineProperty(e,"concatMap",{enumerable:!0,get:function(){return Le.concatMap}});var Re=tf();Object.defineProperty(e,"concatMapTo",{enumerable:!0,get:function(){return Re.concatMapTo}});var ze=rf();Object.defineProperty(e,"concatWith",{enumerable:!0,get:function(){return ze.concatWith}});var Be=of();Object.defineProperty(e,"connect",{enumerable:!0,get:function(){return Be.connect}});var Ve=sf();Object.defineProperty(e,"count",{enumerable:!0,get:function(){return Ve.count}});var He=cf();Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return He.debounce}});var Ue=lf();Object.defineProperty(e,"debounceTime",{enumerable:!0,get:function(){return Ue.debounceTime}});var We=uf();Object.defineProperty(e,"defaultIfEmpty",{enumerable:!0,get:function(){return We.defaultIfEmpty}});var Ge=hf();Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return Ge.delay}});var Ke=mf();Object.defineProperty(e,"delayWhen",{enumerable:!0,get:function(){return Ke.delayWhen}});var qe=gf();Object.defineProperty(e,"dematerialize",{enumerable:!0,get:function(){return qe.dematerialize}});var Je=_f();Object.defineProperty(e,"distinct",{enumerable:!0,get:function(){return Je.distinct}});var Ye=vf();Object.defineProperty(e,"distinctUntilChanged",{enumerable:!0,get:function(){return Ye.distinctUntilChanged}});var Xe=yf();Object.defineProperty(e,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return Xe.distinctUntilKeyChanged}});var Ze=xf();Object.defineProperty(e,"elementAt",{enumerable:!0,get:function(){return Ze.elementAt}});var Qe=Sf();Object.defineProperty(e,"endWith",{enumerable:!0,get:function(){return Qe.endWith}});var $e=Cf();Object.defineProperty(e,"every",{enumerable:!0,get:function(){return $e.every}});var et=Ef();Object.defineProperty(e,"exhaust",{enumerable:!0,get:function(){return et.exhaust}});var tt=Tf();Object.defineProperty(e,"exhaustAll",{enumerable:!0,get:function(){return tt.exhaustAll}});var nt=wf();Object.defineProperty(e,"exhaustMap",{enumerable:!0,get:function(){return nt.exhaustMap}});var rt=Df();Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return rt.expand}});var it=jd();Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return it.filter}});var at=Of();Object.defineProperty(e,"finalize",{enumerable:!0,get:function(){return at.finalize}});var ot=kf();Object.defineProperty(e,"find",{enumerable:!0,get:function(){return ot.find}});var st=Af();Object.defineProperty(e,"findIndex",{enumerable:!0,get:function(){return st.findIndex}});var ct=jf();Object.defineProperty(e,"first",{enumerable:!0,get:function(){return ct.first}});var lt=Mf();Object.defineProperty(e,"groupBy",{enumerable:!0,get:function(){return lt.groupBy}});var ut=ff();Object.defineProperty(e,"ignoreElements",{enumerable:!0,get:function(){return ut.ignoreElements}});var dt=Nf();Object.defineProperty(e,"isEmpty",{enumerable:!0,get:function(){return dt.isEmpty}});var ft=Ff();Object.defineProperty(e,"last",{enumerable:!0,get:function(){return ft.last}});var pt=rd();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return pt.map}});var mt=pf();Object.defineProperty(e,"mapTo",{enumerable:!0,get:function(){return mt.mapTo}});var ht=If();Object.defineProperty(e,"materialize",{enumerable:!0,get:function(){return ht.materialize}});var gt=Lf();Object.defineProperty(e,"max",{enumerable:!0,get:function(){return gt.max}});var _t=pd();Object.defineProperty(e,"mergeAll",{enumerable:!0,get:function(){return _t.mergeAll}});var vt=Rf();Object.defineProperty(e,"flatMap",{enumerable:!0,get:function(){return vt.flatMap}});var yt=fd();Object.defineProperty(e,"mergeMap",{enumerable:!0,get:function(){return yt.mergeMap}});var bt=zf();Object.defineProperty(e,"mergeMapTo",{enumerable:!0,get:function(){return bt.mergeMapTo}});var xt=Bf();Object.defineProperty(e,"mergeScan",{enumerable:!0,get:function(){return xt.mergeScan}});var St=Hf();Object.defineProperty(e,"mergeWith",{enumerable:!0,get:function(){return St.mergeWith}});var Ct=Uf();Object.defineProperty(e,"min",{enumerable:!0,get:function(){return Ct.min}});var wt=Wf();Object.defineProperty(e,"multicast",{enumerable:!0,get:function(){return wt.multicast}});var Tt=Fu();Object.defineProperty(e,"observeOn",{enumerable:!0,get:function(){return Tt.observeOn}});var Et=Gf();Object.defineProperty(e,"onErrorResumeNextWith",{enumerable:!0,get:function(){return Et.onErrorResumeNextWith}});var Dt=Kf();Object.defineProperty(e,"pairwise",{enumerable:!0,get:function(){return Dt.pairwise}});var Ot=qf();Object.defineProperty(e,"pluck",{enumerable:!0,get:function(){return Ot.pluck}});var kt=Jf();Object.defineProperty(e,"publish",{enumerable:!0,get:function(){return kt.publish}});var At=Yf();Object.defineProperty(e,"publishBehavior",{enumerable:!0,get:function(){return At.publishBehavior}});var jt=Xf();Object.defineProperty(e,"publishLast",{enumerable:!0,get:function(){return jt.publishLast}});var Mt=Zf();Object.defineProperty(e,"publishReplay",{enumerable:!0,get:function(){return Mt.publishReplay}});var Nt=Qf();Object.defineProperty(e,"raceWith",{enumerable:!0,get:function(){return Nt.raceWith}});var Pt=qd();Object.defineProperty(e,"reduce",{enumerable:!0,get:function(){return Pt.reduce}});var Ft=$f();Object.defineProperty(e,"repeat",{enumerable:!0,get:function(){return Ft.repeat}});var It=ep();Object.defineProperty(e,"repeatWhen",{enumerable:!0,get:function(){return It.repeatWhen}});var Lt=tp();Object.defineProperty(e,"retry",{enumerable:!0,get:function(){return Lt.retry}});var Rt=np();Object.defineProperty(e,"retryWhen",{enumerable:!0,get:function(){return Rt.retryWhen}});var zt=Jl();Object.defineProperty(e,"refCount",{enumerable:!0,get:function(){return zt.refCount}});var Bt=rp();Object.defineProperty(e,"sample",{enumerable:!0,get:function(){return Bt.sample}});var Vt=ip();Object.defineProperty(e,"sampleTime",{enumerable:!0,get:function(){return Vt.sampleTime}});var Ht=ap();Object.defineProperty(e,"scan",{enumerable:!0,get:function(){return Ht.scan}});var Ut=op();Object.defineProperty(e,"sequenceEqual",{enumerable:!0,get:function(){return Ut.sequenceEqual}});var Wt=sp();Object.defineProperty(e,"share",{enumerable:!0,get:function(){return Wt.share}});var Gt=cp();Object.defineProperty(e,"shareReplay",{enumerable:!0,get:function(){return Gt.shareReplay}});var Kt=lp();Object.defineProperty(e,"single",{enumerable:!0,get:function(){return Kt.single}});var qt=up();Object.defineProperty(e,"skip",{enumerable:!0,get:function(){return qt.skip}});var Jt=dp();Object.defineProperty(e,"skipLast",{enumerable:!0,get:function(){return Jt.skipLast}});var Yt=fp();Object.defineProperty(e,"skipUntil",{enumerable:!0,get:function(){return Yt.skipUntil}});var Xt=pp();Object.defineProperty(e,"skipWhile",{enumerable:!0,get:function(){return Xt.skipWhile}});var Zt=mp();Object.defineProperty(e,"startWith",{enumerable:!0,get:function(){return Zt.startWith}});var Qt=Iu();Object.defineProperty(e,"subscribeOn",{enumerable:!0,get:function(){return Qt.subscribeOn}});var $t=gp();Object.defineProperty(e,"switchAll",{enumerable:!0,get:function(){return $t.switchAll}});var en=hp();Object.defineProperty(e,"switchMap",{enumerable:!0,get:function(){return en.switchMap}});var tn=_p();Object.defineProperty(e,"switchMapTo",{enumerable:!0,get:function(){return tn.switchMapTo}});var nn=vp();Object.defineProperty(e,"switchScan",{enumerable:!0,get:function(){return nn.switchScan}});var rn=df();Object.defineProperty(e,"take",{enumerable:!0,get:function(){return rn.take}});var an=Pf();Object.defineProperty(e,"takeLast",{enumerable:!0,get:function(){return an.takeLast}});var on=yp();Object.defineProperty(e,"takeUntil",{enumerable:!0,get:function(){return on.takeUntil}});var sn=bp();Object.defineProperty(e,"takeWhile",{enumerable:!0,get:function(){return sn.takeWhile}});var cn=xp();Object.defineProperty(e,"tap",{enumerable:!0,get:function(){return cn.tap}});var ln=Sp();Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return ln.throttle}});var un=Cp();Object.defineProperty(e,"throttleTime",{enumerable:!0,get:function(){return un.throttleTime}});var dn=bf();Object.defineProperty(e,"throwIfEmpty",{enumerable:!0,get:function(){return dn.throwIfEmpty}});var fn=wp();Object.defineProperty(e,"timeInterval",{enumerable:!0,get:function(){return fn.timeInterval}});var pn=nd();Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return pn.timeout}});var mn=Tp();Object.defineProperty(e,"timeoutWith",{enumerable:!0,get:function(){return mn.timeoutWith}});var hn=Ep();Object.defineProperty(e,"timestamp",{enumerable:!0,get:function(){return hn.timestamp}});var gn=Jd();Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return gn.toArray}});var _n=Dp();Object.defineProperty(e,"window",{enumerable:!0,get:function(){return _n.window}});var vn=Op();Object.defineProperty(e,"windowCount",{enumerable:!0,get:function(){return vn.windowCount}});var yn=kp();Object.defineProperty(e,"windowTime",{enumerable:!0,get:function(){return yn.windowTime}});var bn=Ap();Object.defineProperty(e,"windowToggle",{enumerable:!0,get:function(){return bn.windowToggle}});var xn=jp();Object.defineProperty(e,"windowWhen",{enumerable:!0,get:function(){return xn.windowWhen}});var Sn=Mp();Object.defineProperty(e,"withLatestFrom",{enumerable:!0,get:function(){return Sn.withLatestFrom}});var Cn=Np();Object.defineProperty(e,"zipAll",{enumerable:!0,get:function(){return Cn.zipAll}});var wn=Fp();Object.defineProperty(e,"zipWith",{enumerable:!0,get:function(){return wn.zipWith}})}}),Lp=(0,y.createContext)(null);function Rp({children:e}){let[t,n]=(0,y.useState)(()=>typeof window<`u`&&localStorage.getItem(`showLineNumbers`)===`true`),r=(0,y.useCallback)(()=>{n(e=>{let t=!e;return typeof window<`u`&&localStorage.setItem(`showLineNumbers`,t.toString()),t})},[]);return(0,I.jsx)(Lp.Provider,{value:{showLineNumbers:t,toggleLineNumbers:r},children:e})}function zp(){let e=(0,y.useContext)(Lp);if(!e)throw Error(`useLineNumbers must be used within a LineNumbersProvider`);return e}var Bp=class{constructor(){if(typeof window>`u`)throw Error(`WebBrowserStorage is client-only. It must not be constructed on the server — a single process-wide instance would leak tokens between HTTP requests. Wrap any code path that constructs this in "use client".`)}get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}delete(e){localStorage.removeItem(e)}subscribe(e){let t=t=>{t.key!==null&&e(t.key,t.newValue)};return window.addEventListener(`storage`,t),()=>{window.removeEventListener(`storage`,t)}}},Vp=(0,y.createContext)(null);function Hp({browser:e,storage:t,sessionFactory:n,children:r}){let i=(0,y.useMemo)(()=>e??pl({storage:t??new Bp,sessionFactory:n??dl()}),[e,t,n]);return(0,I.jsx)(Vp.Provider,{value:i,children:r})}function Up(){let e=(0,y.useContext)(Vp);if(!e)throw Error(`useSemiont must be used within a <SemiontProvider>`);return e}var Wp={success:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}),error:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})}),warning:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`})}),info:(0,I.jsx)(`svg`,{className:`semiont-toast-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})})};function Gp({toast:e,onClose:t}){return(0,y.useEffect)(()=>{let n=setTimeout(()=>{t(e.id)},e.duration||3e3);return()=>clearTimeout(n)},[e,t]),(0,I.jsxs)(`div`,{className:`semiont-toast`,"data-variant":e.type,role:`alert`,children:[(0,I.jsx)(`div`,{className:`semiont-toast-icon-wrapper`,children:Wp[e.type]}),(0,I.jsx)(`p`,{className:`semiont-toast-message`,children:e.message}),(0,I.jsx)(`button`,{onClick:()=>t(e.id),className:`semiont-toast-close`,"aria-label":`Close`,children:(0,I.jsx)(`svg`,{className:`semiont-toast-close-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})})]})}function Kp({toasts:e,onClose:t}){let[n,r]=(0,y.useState)(!1);return(0,y.useEffect)(()=>(r(!0),()=>r(!1)),[]),n?(0,jl.createPortal)((0,I.jsx)(`div`,{className:`semiont-toast-container`,children:e.map(e=>(0,I.jsx)(Gp,{toast:e,onClose:t},e.id))}),document.body):null}var qp=y.createContext(void 0);function Jp({children:e}){let[t,n]=(0,y.useState)([]),r=y.useCallback((e,t=`info`,r)=>{let i=Date.now().toString(),a=r===void 0?{id:i,message:e,type:t}:{id:i,message:e,type:t,duration:r};n(e=>[...e,a])},[]),i=y.useCallback((e,t)=>r(e,`success`,t),[r]),a=y.useCallback((e,t)=>r(e,`error`,t),[r]),o=y.useCallback((e,t)=>r(e,`warning`,t),[r]),s=y.useCallback((e,t)=>r(e,`info`,t),[r]),c=y.useCallback(e=>{n(t=>t.filter(t=>t.id!==e))},[]),l=y.useMemo(()=>({showToast:r,showSuccess:i,showError:a,showWarning:o,showInfo:s}),[r,i,a,o,s]);return(0,I.jsxs)(qp.Provider,{value:l,children:[e,(0,I.jsx)(Kp,{toasts:t,onClose:c})]})}function Yp(){let e=y.useContext(qp);if(e===void 0)throw Error(`useToast must be used within a ToastProvider`);return e}var Xp={close:`Close`,codeLoading:`Loading…`,codeAnalyzing:`Marking…`,codeAnalyzingTags:`Marking tags…`,codeDetectingEntities:`Marking…`,codeCreatingAnnotations:`Creating {{count}} annotations…`,codeCreatingTagAnnotations:`Creating {{count}} tags…`,codeCompleteCreated:`Created {{count}} {{kind}}`,codeGeneratingResource:`Generating…`,codeCreatingResource:`Creating the resource…`,codeCompleteGenerated:`Created the resource`,codeCompleteGeneratedTruncated:`Created the resource — cut off at the length limit`,kindHighlight:`highlights`,kindComment:`comments`,kindAssessment:`assessments`,kindReference:`references`,kindTag:`tags`,subject:`{{kind}}: {{label}}`,subjectWithPosition:`{{kind}}: {{label}} ({{done}} of {{total}})`,paramEntityTypes:`Entity Types`,paramInstructions:`Instructions`,paramTone:`Tone`,paramDensity:`Density`,subjectKindEntityType:`Entity type`,subjectKindCategory:`Category`,cancel:`Cancel`,inProgress:`Annotating...`},Zp={loadFailed:`Failed to load PDF`,loading:`Loading PDF...`,next:`Next`,pageLoadFailed:`Failed to load page`,pageOf:`Page {{page}} of {{total}}`,pagination:`Page navigation`,previous:`Previous`,viewerLoading:`Loading PDF viewer...`},Qp={annotations:`Annotations`,history:`History`,resourceInfo:`Resource Info`,collaboration:`Collaboration`,userAccount:`User Account`,settings:`Settings`,knowledgeBase:`Knowledge Base`},$p={title:`Resource Info`,locale:`Locale`,notSpecified:`Not specified`,entityTypeTags:`Entity Type Tags`,representation:`Representation`,mediaType:`Media Type`,byteSize:`Size`,storageUri:`Storage`,clone:`Clone`,cloneDescription:`Generate a shareable clone link for this resource`,generate:`Generate`,generateDescription:`Generate a new resource from this one's context`,archive:`Archive`,archiveDescription:`Move this resource to archived status`,unarchive:`Unarchive`,unarchiveDescription:`Restore this resource to active status`,provenance:`Provenance`,createdAt:`Created`,modifiedAt:`Modified`,attributedTo:`Attributed to`,derivedFrom:`Derived from`},em={title:`Collaboration`,connectionStatus:`Connection Status`,live:`Live`,disconnected:`Disconnected`,events:`{{count}} events`,lastSync:`Last sync:`,noActivity:`No activity yet`,justNow:`Just now`,secondsAgo:`{{count}} seconds ago`,minuteAgo:`1 minute ago`,minutesAgo:`{{count}} minutes ago`,hourAgo:`1 hour ago`,hoursAgo:`{{count}} hours ago`,realtimeActive:`Real-time updates are active`,reconnecting:`Reconnecting to server...`,sharing:`Sharing`,collaborationComingSoon:`Collaboration features coming soon`,collaborators:`Collaborators`,ceilings:`{{contextTokens}} in / {{maxOutputTokens}} out`,sharedWindow:`{{contextTokens}} window`},tm={history:`History`,loading:`Loading...`,user:`User`,viewOriginal:`View original`,viewAnnotation:`View annotation: {{content}}`,resourceCreated:`Created Resource`,resourceCloned:`Cloned`,resourceArchived:`Archived`,resourceUnarchived:`Unarchived`,highlightAdded:`Highlight Added`,highlightRemoved:`Highlight Removed`,referenceCreated:`Reference Created`,referenceResolved:`Reference Resolved`,referenceDeleted:`Reference Deleted`,entitytagAdded:`Tag Added`,entitytagRemoved:`Tag Removed`,assessmentAdded:`Assessment Added`,assessmentRemoved:`Assessment Removed`,annotationAdded:`Annotation Added`,annotationRemoved:`Annotation Removed`,annotationBodyUpdated:`Annotation Updated`,jobEvent:`Job Event`,embeddingComputed:`Embedding Computed`,justNow:`just now`,minutesAgo:`{{count}}m ago`,hoursAgo:`{{count}}h ago`,daysAgo:`{{count}}d ago`,failed:`Could not load history.`,retry:`Try again`},nm={title:`Comments`,noComments:`No comments yet. Select text and click Comment to add one.`,commentPlaceholder:`Type your comment here...`,save:`Save`,cancel:`Cancel`,edit:`Edit`,annotateComments:`Annotate Comments`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Focus on technical terminology...`,annotate:`Annotate`,annotating:`Annotating...`,toneLabel:`Tone`,toneOptional:`(optional)`,toneScholarly:`Scholarly`,toneExplanatory:`Explanatory`,toneConversational:`Conversational`,toneTechnical:`Technical`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},rm={title:`Highlights`,noHighlights:`No highlights yet. Use AI annotation to find important passages.`,annotateHighlights:`Annotate Highlights`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Focus on key technical concepts...`,annotate:`Annotate`,annotating:`Annotating...`,cancel:`Cancel`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},im={title:`Assessments`,noAssessments:`No assessments yet. Use AI annotation to evaluate passages.`,assessmentPlaceholder:`Type your assessment here...`,save:`Save`,cancel:`Cancel`,annotateAssessments:`Annotate Assessments`,instructions:`Instructions`,optional:`(optional)`,instructionsPlaceholder:`e.g., Evaluate claims for accuracy and evidence...`,annotate:`Annotate`,annotating:`Annotating...`,toneLabel:`Tone`,toneOptional:`(optional)`,toneAnalytical:`Analytical`,toneCritical:`Critical`,toneBalanced:`Balanced`,toneConstructive:`Constructive`,densityLabel:`Density`,densitySparse:`Sparse`,densityDense:`Dense`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`,densityPerWords:`{{density}} per 2000 words`},am={title:`Tags`,noTags:`No tags yet. Use AI annotation to identify structural roles.`,noSchemas:"No tag schemas registered for this knowledge base. A KB administrator must register at least one structural-analysis schema (e.g. via the `register-tag-schemas` skill) before tagging can be used.",annotateTags:`Annotate Tags`,selectSchema:`Select Framework`,selectCategories:`Select Categories`,annotate:`Annotate`,annotating:`Annotating...`,cancel:`Cancel`,selectAll:`Select All`,deselectAll:`Deselect All`,categoriesSelected:`{count, plural, =0 {No categories selected} =1 {1 category selected} other {# categories selected}}`,createTagForSelection:`Create Tag for Selection`,selectCategory:`Select Category`,chooseCategory:`Choose a category...`,fragmentSelected:`Fragment selected`,imageRegionSelected:`Image region selected`,complete:`Annotation complete!`,failed:`Annotation failed`},om={title:`Annotations`,statistics:`Statistics`,highlight:`Highlights`,reference:`References`,assessment:`Assessments`,comment:`Comments`,tag:`Tags`,annotationsFailed:`Could not load annotations.`,retry:`Try again`},sm={title:`Statistics`,highlights:`Highlights`,comments:`Comments`,assessments:`Assessments`,tags:`Tags`,references:`References`,stub:`Stub`,resolved:`Resolved`,entityTypes:`Entity Types`},cm={title:`References`,noReferences:`No references yet. Select text to create references to other resources.`,outgoingReferences:`Outgoing References`,incomingReferences:`Incoming References`,noIncomingReferences:`No incoming references`,stub:`Stub reference (not linked)`,resolved:`Resolved reference (linked)`,derived:`Derived`,open:`Open`,unlink:`Unlink`,resolve:`Resolve Reference`,cancel:`Cancel`,createReference:`Create Reference`,entityTypesOptional:`Entity Types (Optional)`,fragmentSelected:`Fragment selected`,annotateReferences:`Annotate References`,selectEntityTypes:`Entity types:`,select:`Select`,deselect:`Deselect`,noEntityTypes:`No entity types available`,typesSelected:`{count, plural, =1 {1 type selected} other {# types selected}}`,annotate:`Annotate`,annotating:`Annotating...`,includeDescriptiveReferences:`Include descriptive references`,descriptiveReferencesTooltip:`Also find phrases like 'the CEO', 'the tech giant', 'the physicist' (in addition to names)`,found:`{{count}} found`,complete:`Annotation complete!`,failed:`Annotation failed`,current:`Current: {{entityType}}`,loading:`loading...`,loadingEllipsis:`Loading...`,untitledResource:`Untitled Resource`,noText:`No text`,incomingReferencesFailed:`Could not load incoming references.`,retry:`Try again`,entityTypesFailed:`Could not load entity types.`},lm={title:`Keyboard Shortcuts`,closeDialog:`Close dialog`,or:`or`,navigationTitle:`Navigation`,navOpenSearch:`Open global search`,navOpenSearchAlt:`Open global search (alternative)`,navCreateResource:`Create new resource`,navCloseOverlays:`Close all overlays (double press)`,navShowHelp:`Show keyboard shortcuts help`,sidebarTitle:`Knowledge Sidebar`,sidebarCollapse:`Collapse sidebar`,sidebarExpand:`Expand sidebar`,sidebarPickup:`Pick up resource tab (when focused)`,sidebarMove:`Move resource tab (when dragging)`,sidebarDrop:`Drop resource tab (when dragging)`,sidebarCancel:`Cancel drag operation`,annotationsTitle:`Resource Annotations`,annotHighlight:`Create highlight from annotation (direct)`,annotReference:`Open reference popup for annotation`,annotDelete:`Delete focused annotation`,annotNavigate:`Navigate through annotations`,annotNavigateBack:`Navigate annotations backward`,listsTitle:`Lists & Grids`,listsFilterNav:`Navigate entity type filters`,listsGridNav:`Navigate resource grid`,listsJumpFirst:`Jump to first item`,listsJumpLast:`Jump to last item`,searchModalTitle:`In Search Modal`,searchNav:`Navigate search results`,searchSelect:`Select result`,searchClose:`Close search`,modalTitle:`Modal Controls`,modalClose:`Close active modal`,modalNavForward:`Navigate forward through buttons`,modalNavBackward:`Navigate backward through buttons`,modalActivate:`Activate focused button`,accessibilityTitle:`Accessibility`,a11ySkipLinks:`Navigate to skip links (when at page start)`,a11yFollowLink:`Follow skip link`,macNote:`Using Mac keyboard shortcuts. ⌘ is the Command key.`,windowsNote:`Using Windows/Linux keyboard shortcuts. Ctrl is the Control key.`,footerHint:`Press {{key}} anytime to show this help`,close:`Close`},um={modeGroup:`Mode`,browse:`Browse`,annotate:`Annotate`,selectionGroup:`Motivation`,clickGroup:`Click`,shapeGroup:`Shape`,none:`None`,linking:`Reference`,highlighting:`Highlight`,assessing:`Assess`,commenting:`Comment`,tagging:`Tag`,detail:`Detail`,follow:`Follow`,deleting:`Delete`,jsonld:`JSON-LD`,rectangle:`Rectangle`,circle:`Circle`,polygon:`Polygon`},dm={title:`Navigation`,collapseSidebar:`Collapse sidebar`,expandSidebar:`Expand sidebar`,dragToReorder:`Drag to reorder`,dragToReorderDoc:`Drag to reorder {{name}}`,closeResource:`Close resource`,dragInstructions:`To reorder resources: Use Tab to navigate to a resource. Press Alt+Up arrow to move up or Alt+Down arrow to move down. For drag and drop: Press space bar to pick up the item. Use arrow keys to move it. Press space bar again to drop.`},fm={deleteConfirmationTitle:`Delete Annotation`,deleteConfirmationMessage:`Are you sure you want to delete this annotation? This action cannot be undone.`,deleteConfirmationCancel:`Cancel`,deleteConfirmationDelete:`Delete`},pm={title:`Settings`,lineNumbers:`Line Numbers`,lineNumbersVisible:`Visible`,lineNumbersHidden:`Hidden`,theme:`Theme`,themeLight:`Light`,themeDark:`Dark`,themeSystem:`System`,themeSystemActive:`System ({{mode}})`,themeModeActive:`Using {{mode}} mode`,language:`Language`,languageHint:`Change language in the main navigation`,languageChanging:`Changing language...`,hoverDelay:`Hover Delay`,hoverDelayFast:`Fast`,hoverDelaySlow:`Slow`,hoverDelayDescription:`{{delay}}ms delay before hover effects appear`},mm={},hm={gatherIntro:`Choose what to include in the gathered context.`,includeContent:`Include resource content`,includeSummary:`Include summary`,gatherDepth:`Depth`,gatherMaxResources:`Max resources`,gatherButton:`Gather`,editGather:`Change gather settings`,recallLabel:`Included in recall — deselect to exclude`,loadingContext:`Gathering context...`,failedContext:`Failed to gather context`,sourceContextLabel:`Resource`,connectionsLabel:`Connections`,citedByLabel:`Cited by`,resourceTitle:`New resource title`,resourceTitlePlaceholder:`Title for the generated resource...`,additionalInstructions:`Additional Instructions`,additionalInstructionsPlaceholder:`Optional guidance for the generation...`,language:`Language`,languageHelp:`Language for the generated resource`,creativity:`Creativity`,creativityFocused:`Focused`,creativityCreative:`Creative`,maxLength:`Max Length`,maxLengthHelp:`Maximum number of tokens`,generate:`Generate`,maxLengthCeiling:`Limited to {{maxOutputTokens}} tokens by {{model}}.`,outputFormat:`Format`,formatExtensionMismatch:`Save location must end in {{extension}} to match the selected format.`,graphPaneTitle:`Neighborhood`,graphEmpty:`No links yet.`,resourceLinkLabel:`Resource link`,corpusPaneTitle:`Similar passages`,corpusEmpty:`No similar passages found.`,excludedReceipt:`{{types}} excluded from this recall`,machineRead:`OCR`,score:`Score`,saveLocation:`Save location`,discardDraftPrompt:`Discard this draft?`,discardDraft:`Discard`,keepEditing:`Keep editing`,title:`Generate from this Resource`},gm={sourceContextLabel:`Annotation context in resource`,connectionsLabel:`Peer Annotations`,citedByLabel:`Resource Cited By`,userHintLabel:`Hint`,userHintPlaceholder:`Describe what this annotation refers to...`,loadingContext:`Gathering context...`,failedContext:`Failed to gather context`,generate:`Generate`,compose:`Compose`,resolutionStrategyLabel:`Resolution Strategy`,back:`Back`,link:`Link`,score:`Score`,noResults:`No results found`,resourceTitle:`Resource Title`,resourceTitlePlaceholder:`Enter resource title...`,additionalInstructions:`Additional Instructions`,additionalInstructionsPlaceholder:`Enter additional instructions...`,language:`Language`,languageHelp:`Language for generated content`,creativity:`Creativity`,creativityFocused:`Focused`,creativityCreative:`Creative`,maxLength:`Max Length`,maxLengthHelp:`Maximum number of tokens`,maxResults:`Max Results`,semanticScoring:`Semantic Scoring`,semanticScoringHelp:`Use AI to score results by semantic relevance`,searching:`Searching...`,searchFailed:`Search failed`,search:`Search`,maxLengthCeiling:`Limited to {{maxOutputTokens}} tokens by {{model}}.`,outputFormat:`Format`,formatExtensionMismatch:`Save location must end in {{extension}} to match the selected format.`,graphPaneTitle:`Neighborhood`,graphEmpty:`No links yet — resolving this reference creates the first.`,resourceLinkLabel:`Resource link`,corpusPaneTitle:`Similar passages`,corpusEmpty:`No similar passages found — Search is unlikely to land.`,excludedReceipt:`{{types}} excluded from this recall`,machineRead:`OCR`,userHintEffect:`steers Search and Generate`,saveLocation:`Save location`,entityTypes:`Entity types`,contentLabel:`Content`,createAndLink:`Create & Link`,creatingAndLinking:`Creating & linking…`,discardDraftPrompt:`Discard this draft?`,discardDraft:`Discard`,keepEditing:`Keep editing`,resolveTitle:`Resolve Reference`},_m={createFailed:`Couldn’t create the annotation: {{detail}}`,deleteFailed:`Couldn’t delete the annotation: {{detail}}`,referenceUpdateFailed:`Couldn’t update the reference: {{detail}}`,unknownError:`unknown error`,assistQuiet:`Still working — no update from the annotation job for a few minutes`,resourceCreatedNamed:`Created “{{name}}”`,resourceCreated:`Resource created`,annotationComplete:`Annotation complete`,annotationFailed:`Annotation failed`,generationFailed:`Generation failed: {{detail}}`,"decline_no-text-layer":`This PDF is a scan whose text couldn’t be recognized, so there’s nothing to annotate.`,decline_encrypted:`This PDF is password-protected, so its text can’t be read.`,decline_corrupt:`This PDF couldn’t be read — the file may be damaged.`,"decline_too-large":`This document is too large to extract text from.`,decline_empty:`This document has no text to annotate.`},vm={AssistProgress:Xp,PdfViewer:Zp,Toolbar:Qp,ResourceInfoPanel:$p,CollaborationPanel:em,AnnotationHistory:tm,CommentsPanel:nm,HighlightPanel:rm,AssessmentPanel:im,TaggingPanel:am,UnifiedAnnotationsPanel:om,StatisticsPanel:sm,ReferencesPanel:cm,KeyboardShortcuts:lm,AnnotateToolbar:um,CollapsibleResourceNavigation:dm,ResourceViewer:fm,Settings:pm,AnnotateView:mm,ResourceGenerate:hm,ReferenceWizard:gm,OutcomeToasts:_m},ym=Te({"../../translations/ar.json":()=>s(()=>import(`./ar-AZBRADEB-CvnkaLQS.js`),[]),"../../translations/bn.json":()=>s(()=>import(`./bn-CCEW6AOS-BCI1FG86.js`),[]),"../../translations/cs.json":()=>s(()=>import(`./cs-HXPF2CTE-CbMUDpDp.js`),[]),"../../translations/da.json":()=>s(()=>import(`./da-K5NTK7LH-D2rWDXq3.js`),[]),"../../translations/de.json":()=>s(()=>import(`./de-GMRQEDZI-CVlSEip_.js`),[]),"../../translations/el.json":()=>s(()=>import(`./el-EUB4CI4G-C80i0753.js`),[]),"../../translations/en.json":()=>s(()=>import(`./en-R5XA26NF-BqWytpwo.js`),[]),"../../translations/es.json":()=>s(()=>import(`./es-Z32DAZ6W-D7UTS3Fx.js`),[]),"../../translations/fa.json":()=>s(()=>import(`./fa-G7HN6B32-DdDi1TG_.js`),[]),"../../translations/fi.json":()=>s(()=>import(`./fi-3YBLZO7I-B3OjL1PQ.js`),[]),"../../translations/fr.json":()=>s(()=>import(`./fr-VUBH7BBS-CjoeoL9n.js`),[]),"../../translations/he.json":()=>s(()=>import(`./he-WQQEY26B-2RRJq7To.js`),[]),"../../translations/hi.json":()=>s(()=>import(`./hi-HJZ6W4JB-DPflxelg.js`),[]),"../../translations/id.json":()=>s(()=>import(`./id-ZOGZ37MI-Dd4wSvWi.js`),[]),"../../translations/it.json":()=>s(()=>import(`./it-DT6UW66F-B7ZzCBm1.js`),[]),"../../translations/ja.json":()=>s(()=>import(`./ja-RUKQCOLO-Br1kLTUs.js`),[]),"../../translations/ko.json":()=>s(()=>import(`./ko-ZH5ADKZM-8IO4IU-2.js`),[]),"../../translations/ms.json":()=>s(()=>import(`./ms-Y2AFPZTU-q4v04hSa.js`),[]),"../../translations/nl.json":()=>s(()=>import(`./nl-OQEWIXNA-DiHanxnO.js`),[]),"../../translations/no.json":()=>s(()=>import(`./no-KPAYJZWY-DdGouMG_.js`),[]),"../../translations/pl.json":()=>s(()=>import(`./pl-WSXK2UUD-DK_ieA8X.js`),[]),"../../translations/pt.json":()=>s(()=>import(`./pt-NWRJRUCK-I6-gHOkB.js`),[]),"../../translations/ro.json":()=>s(()=>import(`./ro-3CGVMOC6-wdwqXMaO.js`),[]),"../../translations/sv.json":()=>s(()=>import(`./sv-HGSEBA7S-2KvJx_dY.js`),[]),"../../translations/th.json":()=>s(()=>import(`./th-NZ4G352Z-ZMBwAbgb.js`),[]),"../../translations/tr.json":()=>s(()=>import(`./tr-LGGS4DLW-BwMx3CfM.js`),[]),"../../translations/uk.json":()=>s(()=>import(`./uk-AIX536L4-cREJjolM.js`),[]),"../../translations/vi.json":()=>s(()=>import(`./vi-V6CVQZLQ-CXAniXLX.js`),[]),"../../translations/zh.json":()=>s(()=>import(`./zh-AGKPGI3L-MsKTx_dK.js`),[])}),bm=(0,y.createContext)(null),xm=new Map;function Sm(e,t){let n=e.match(/\{(\w+),\s*plural,\s*/);if(!n)return e;let r=t[n[1]];if(r===void 0)return e;let i=n[0].length,a=1,o=i;for(let t=i;t<e.length;t++)if(e[t]===`{`)a++;else if(e[t]===`}`&&(a--,a===0)){o=t;break}let s=e.substring(i,o),c={},l=/(?:=(\d+)|(\w+))\s*\{([^}]+)\}/g,u;for(;(u=l.exec(s))!==null;){let[,e,t,n]=u,r=e===void 0?t:`=${e}`;c[r]=n}let d=c[`=${r}`];if(d!==void 0){let t=d.replace(/#/g,String(r));return e.substring(0,n.index)+t+e.substring(o+1)}let f=c.other;if(f!==void 0){let t=f.replace(/#/g,String(r));return e.substring(0,n.index)+t+e.substring(o+1)}return e}async function Cm(e){if(xm.has(e))return xm.get(e);if(e===`en`)return xm.set(`en`,vm),vm;try{let t=await ym(`../../translations/${e}.json`),n=t.default||t;return xm.set(e,n),n}catch(t){return console.error(`Failed to load translations for locale: ${e}`,t),vm}}var wm={t:(e,t,n)=>{let r=vm[e]?.[t];if(!r)return console.warn(`Translation not found for ${e}.${t}`),`${e}.${t}`;if(n&&typeof r==`string`){let e=r;return e=Sm(e,n),Object.entries(n).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return r}};function Tm({translationManager:e,locale:t,loadingComponent:n=null,children:r}){let[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{t&&!e&&(s(!0),Cm(t).then(e=>{a(e),s(!1)}).catch(e=>{console.error(`Failed to load translations:`,e),a(vm),s(!1)}))},[t,e]);let c=(0,y.useMemo)(()=>i?{t:(e,n,r)=>{let a=i[e]?.[n];if(!a)return console.warn(`Translation not found for ${e}.${n} in locale ${t}`),`${e}.${n}`;if(r&&typeof a==`string`){let e=a;return e=Sm(e,r),Object.entries(r).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return a}}:null,[i,t]);return e?(0,I.jsx)(bm.Provider,{value:e,children:r}):t&&o?(0,I.jsx)(I.Fragment,{children:n}):t&&c?(0,I.jsx)(bm.Provider,{value:c,children:r}):(0,I.jsx)(bm.Provider,{value:wm,children:r})}function Em(e){let t=(0,y.useContext)(bm);return t?(n,r)=>t.t(e,n,r):(t,n)=>{let r=vm[e]?.[t];if(!r)return console.warn(`Translation not found for ${e}.${t}`),`${e}.${t}`;if(n&&typeof r==`string`){let e=r;return e=Sm(e,n),Object.entries(n).forEach(([t,n])=>{e=e.replace(RegExp(`\\{\\{${t}\\}\\}`,`g`),String(n))}),e}return r}}var Dm={colors:{primary:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#0080ff`,600:`#0066cc`,700:`#0052a3`,800:`#1e40af`,900:`#1e3a8a`},secondary:{50:`#f0fffe`,100:`#e0fffd`,200:`#b3fffa`,300:`#66fff6`,400:`#1afff1`,500:`#00ffff`,600:`#00cccc`,700:`#00a3a3`,800:`#007a7a`,900:`#005252`},semantic:{error:`#ef4444`,errorLight:`#fca5a5`,errorDark:`#b91c1c`,warning:`#f59e0b`,warningLight:`#fcd34d`,warningDark:`#d97706`,success:`#10b981`,successLight:`#6ee7b7`,successDark:`#047857`,info:`#3b82f6`,infoLight:`#93c5fd`,infoDark:`#1d4ed8`},neutral:{0:`#ffffff`,50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`,1e3:`#000000`},background:{primary:`#ffffff`,secondary:`#f9fafb`,tertiary:`#f3f4f6`,inverse:`#111827`},text:{primary:`#111827`,secondary:`#4b5563`,tertiary:`#6b7280`,disabled:`#9ca3af`,inverse:`#ffffff`}},spacing:{0:`0`,xs:`0.25rem`,sm:`0.5rem`,md:`1rem`,lg:`1.5rem`,xl:`2rem`,"2xl":`2.5rem`,"3xl":`3rem`,"4xl":`4rem`,"5xl":`5rem`},typography:{fontFamily:{sans:`Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`,mono:`JetBrains Mono, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`,"5xl":`3rem`},fontWeight:{thin:100,light:300,normal:400,medium:500,semibold:600,bold:700,black:900},lineHeight:{none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2}},borderRadius:{none:`0`,sm:`0.125rem`,base:`0.25rem`,md:`0.375rem`,lg:`0.5rem`,xl:`0.75rem`,"2xl":`1rem`,"3xl":`1.5rem`,full:`9999px`},shadows:{none:`none`,xs:`0 1px 2px 0 rgb(0 0 0 / 0.05)`,sm:`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,base:`0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`,md:`0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`,lg:`0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`,xl:`0 25px 50px -12px rgb(0 0 0 / 0.25)`,inner:`inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`},transitions:{duration:{fast:`150ms`,base:`250ms`,slow:`350ms`,slower:`500ms`},timing:{linear:`linear`,ease:`cubic-bezier(0.4, 0, 0.2, 1)`,easeIn:`cubic-bezier(0.4, 0, 1, 1)`,easeOut:`cubic-bezier(0, 0, 0.2, 1)`,easeInOut:`cubic-bezier(0.4, 0, 0.2, 1)`}},breakpoints:{sm:`640px`,md:`768px`,lg:`1024px`,xl:`1280px`,"2xl":`1536px`}};function Om(){let e=[`:root {`];return Object.entries(Dm.colors.primary).forEach(([t,n])=>{e.push(` --semiont-color-primary-${t}: ${n};`)}),Object.entries(Dm.colors.secondary).forEach(([t,n])=>{e.push(` --semiont-color-secondary-${t}: ${n};`)}),Object.entries(Dm.colors.semantic).forEach(([t,n])=>{e.push(` --semiont-color-${t.toLowerCase().replace(/([A-Z])/g,`-$1`).toLowerCase()}: ${n};`)}),Object.entries(Dm.colors.neutral).forEach(([t,n])=>{e.push(` --semiont-color-neutral-${t}: ${n};`)}),Object.entries(Dm.spacing).forEach(([t,n])=>{e.push(` --semiont-spacing-${t}: ${n};`)}),Object.entries(Dm.typography.fontSize).forEach(([t,n])=>{e.push(` --semiont-text-${t}: ${n};`)}),Object.entries(Dm.typography.fontWeight).forEach(([t,n])=>{e.push(` --semiont-font-${t}: ${n};`)}),e.push(` --semiont-font-sans: ${Dm.typography.fontFamily.sans};`),e.push(` --semiont-font-mono: ${Dm.typography.fontFamily.mono};`),Object.entries(Dm.borderRadius).forEach(([t,n])=>{e.push(` --semiont-radius-${t}: ${n};`)}),Object.entries(Dm.shadows).forEach(([t,n])=>{e.push(` --semiont-shadow-${t}: ${n};`)}),Object.entries(Dm.transitions.duration).forEach(([t,n])=>{e.push(` --semiont-duration-${t}: ${n};`)}),e.push(`}`),e.join(`
10
10
  `)}Om();var km=(0,y.createContext)(null),Am={didCatch:!1,error:null},jm=class extends y.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Am}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(Am))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&Mm(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(Am))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,y.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,y.createElement)(km.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Mm(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var Nm=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Pm=n(((e,t)=>{t.exports=Nm()}));function Fm(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Im=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lm=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rm={};function zm(e,t){return((t||Rm).jsx?Lm:Im).test(e)}var Bm=/[ \t\n\f\r]/g;function Vm(e){return typeof e==`object`?e.type===`text`&&Hm(e.value):Hm(e)}function Hm(e){return e.replace(Bm,``)===``}var Um=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Um.prototype.normal={},Um.prototype.property={},Um.prototype.space=void 0;function Wm(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Um(n,r,t)}function Gm(e){return e.toLowerCase()}var Km=class{constructor(e,t){this.attribute=t,this.property=e}};Km.prototype.attribute=``,Km.prototype.booleanish=!1,Km.prototype.boolean=!1,Km.prototype.commaOrSpaceSeparated=!1,Km.prototype.commaSeparated=!1,Km.prototype.defined=!1,Km.prototype.mustUseProperty=!1,Km.prototype.number=!1,Km.prototype.overloadedBoolean=!1,Km.prototype.property=``,Km.prototype.spaceSeparated=!1,Km.prototype.space=void 0;var qm=e({boolean:()=>V,booleanish:()=>Ym,commaOrSpaceSeparated:()=>$m,commaSeparated:()=>Qm,number:()=>H,overloadedBoolean:()=>Xm,spaceSeparated:()=>Zm}),Jm=0,V=eh(),Ym=eh(),Xm=eh(),H=eh(),Zm=eh(),Qm=eh(),$m=eh();function eh(){return 2**++Jm}var th=Object.keys(qm),nh=class extends Km{constructor(e,t,n,r){let i=-1;if(super(e,t),rh(this,`space`,r),typeof n==`number`)for(;++i<th.length;){let e=th[i];rh(this,th[i],(n&qm[e])===qm[e])}}};nh.prototype.defined=!0;function rh(e,t,n){n&&(e[t]=n)}function ih(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new nh(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Gm(r)]=r,n[Gm(a.attribute)]=r}return new Um(t,n,e.space)}var ah=ih({properties:{ariaActiveDescendant:null,ariaAtomic:Ym,ariaAutoComplete:null,ariaBusy:Ym,ariaChecked:Ym,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:Zm,ariaCurrent:null,ariaDescribedBy:Zm,ariaDetails:null,ariaDisabled:Ym,ariaDropEffect:Zm,ariaErrorMessage:null,ariaExpanded:Ym,ariaFlowTo:Zm,ariaGrabbed:Ym,ariaHasPopup:null,ariaHidden:Ym,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zm,ariaLevel:H,ariaLive:null,ariaModal:Ym,ariaMultiLine:Ym,ariaMultiSelectable:Ym,ariaOrientation:null,ariaOwns:Zm,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:Ym,ariaReadOnly:Ym,ariaRelevant:null,ariaRequired:Ym,ariaRoleDescription:Zm,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:Ym,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function oh(e,t){return t in e?e[t]:t}function sh(e,t){return oh(e,t.toLowerCase())}var ch=ih({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Qm,acceptCharset:Zm,accessKey:Zm,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alpha:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:Zm,autoFocus:V,autoPlay:V,blocking:Zm,capture:null,charSet:null,checked:V,cite:null,className:Zm,closedBy:null,colorSpace:null,cols:H,colSpan:H,command:null,commandFor:null,content:null,contentEditable:Ym,controls:V,controlsList:Zm,coords:H|Qm,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Xm,draggable:Ym,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:Zm,height:H,hidden:Xm,high:H,href:null,hrefLang:null,htmlFor:Zm,httpEquiv:Zm,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:Zm,itemRef:Zm,itemScope:V,itemType:Zm,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:V,optimum:H,pattern:null,ping:Zm,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:Zm,required:V,reversed:V,rows:H,rowSpan:H,sandbox:Zm,scope:null,scoped:V,seamless:V,selected:V,shadowRootClonable:V,shadowRootCustomElementRegistry:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shadowRootSerializable:V,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:Ym,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:Ym,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zm,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:Ym,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:V,disablePictureInPicture:V,disableRemotePlayback:V,exportParts:Qm,part:Zm,prefix:null,property:null,results:H,security:null,unselectable:null},space:`html`,transform:sh}),lh=ih({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:$m,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:Zm,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Qm,g2:Qm,glyphName:Qm,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:$m,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zm,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$m,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$m,rev:$m,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$m,requiredFeatures:$m,requiredFonts:$m,requiredFormats:$m,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:$m,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$m,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$m,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:oh}),uh=ih({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),dh=ih({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:sh}),fh=ih({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ph={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},mh=/[A-Z]/g,hh=/-[a-z]/g,gh=/^data[-\w.:]+$/i;function _h(e,t){let n=Gm(t),r=t,i=Km;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&gh.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(hh,yh);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!hh.test(e)){let n=e.replace(mh,vh);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=nh}return new i(r,t)}function vh(e){return`-`+e.toLowerCase()}function yh(e){return e.charAt(1).toUpperCase()}var bh=Wm([ah,ch,uh,dh,fh],`html`),xh=Wm([ah,lh,uh,dh,fh],`svg`);function Sh(e){return e.join(` `).trim()}var Ch=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
11
11
  `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),wh=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ch());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Th=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Eh=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(wh()),r=Th();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Dh=kh(`end`),Oh=kh(`start`);function kh(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ah(e){let t=Oh(e),n=Dh(e);if(t&&n)return{start:t,end:n}}function jh(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Nh(e.position):`start`in e||`end`in e?Nh(e):`line`in e||`column`in e?Mh(e):``}function Mh(e){return Ph(e&&e.line)+`:`+Ph(e&&e.column)}function Nh(e){return Mh(e&&e.start)+`-`+Mh(e&&e.end)}function Ph(e){return e&&typeof e==`number`?e:1}var Fh=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=jh(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Fh.prototype.file=``,Fh.prototype.name=``,Fh.prototype.reason=``,Fh.prototype.message=``,Fh.prototype.stack=``,Fh.prototype.column=void 0,Fh.prototype.line=void 0,Fh.prototype.ancestors=void 0,Fh.prototype.cause=void 0,Fh.prototype.fatal=void 0,Fh.prototype.place=void 0,Fh.prototype.ruleId=void 0,Fh.prototype.source=void 0;var Ih=t(Eh(),1),Lh={}.hasOwnProperty,Rh=new Map,zh=/[A-Z]/g,Bh=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Vh=new Set([`td`,`th`]),Hh=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Uh(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=eg(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=$h(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?xh:bh,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Wh(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Wh(e,t,n){if(t.type===`element`)return Gh(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Kh(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Jh(e,t,n);if(t.type===`mdxjsEsm`)return qh(e,t);if(t.type===`root`)return Yh(e,t,n);if(t.type===`text`)return Xh(e,t)}function Gh(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=xh,e.schema=i),e.ancestors.push(t);let a=og(e,t.tagName,!1),o=tg(e,t),s=rg(e,t);return Bh.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Vm(e)})),Zh(e,o,a,t),Qh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Kh(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}sg(e,t.position)}function qh(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);sg(e,t.position)}function Jh(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=xh,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:og(e,t.name,!0),o=ng(e,t),s=rg(e,t);return Zh(e,o,a,t),Qh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Yh(e,t,n){let r={};return Qh(r,rg(e,t)),e.create(t,e.Fragment,r,n)}function Xh(e,t){return t.value}function Zh(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Qh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function $h(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function eg(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Oh(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function tg(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Lh.call(t.properties,i)){let a=ig(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Vh.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ng(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else sg(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else sg(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function rg(e,t){let n=[],r=-1,i=e.passKeys?new Map:Rh;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Wh(e,a,o);s!==void 0&&n.push(s)}return n}function ig(e,t,n){let r=_h(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Fm(n):Sh(n)),r.property===`style`){let t=typeof n==`object`?n:ag(e,String(n));return e.stylePropertyNameCase===`css`&&(t=cg(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ph[r.property]||r.property:r.attribute,n]}}function ag(e,t){try{return(0,Ih.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Fh("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Hh+`#cannot-parse-style-attribute`,r}}function og(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=zm(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=zm(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Lh.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);sg(e)}function sg(e,t){let n=new Fh("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Hh+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function cg(e){let t={},n;for(n in e)Lh.call(e,n)&&(t[lg(n)]=e[n]);return t}function lg(e){let t=e.replace(zh,ug);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function ug(e){return`-`+e.toLowerCase()}var dg={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},fg={};function pg(e,t){let n=t||fg;return mg(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function mg(e,t,n){if(gg(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return hg(e.children,t,n)}return Array.isArray(e)?hg(e,t,n):``}function hg(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=mg(e[i],t,n);return r.join(``)}function gg(e){return!!(e&&typeof e==`object`)}var _g=document.createElement(`i`);function vg(e){let t=`&`+e+`;`;_g.innerHTML=t;let n=_g.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function yg(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function bg(e,t){return e.length>0?(yg(e,e.length,0,t),e):t}var xg={}.hasOwnProperty;function Sg(e){let t={},n=-1;for(;++n<e.length;)Cg(t,e[n]);return t}function Cg(e,t){let n;for(n in t){let r=(xg.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){xg.call(r,a)||(r[a]=[]);let e=i[a];wg(r[a],Array.isArray(e)?e:e?[e]:[])}}}function wg(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);yg(e,0,0,r)}function Tg(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Eg(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Dg=Rg(/[A-Za-z]/),Og=Rg(/[\dA-Za-z]/),kg=Rg(/[#-'*+\--9=?A-Z^-~]/);function Ag(e){return e!==null&&(e<32||e===127)}var jg=Rg(/\d/),Mg=Rg(/[\dA-Fa-f]/),Ng=Rg(/[!-/:-@[-`{-~]/);function U(e){return e!==null&&e<-2}function Pg(e){return e!==null&&(e<0||e===32)}function Fg(e){return e===-2||e===-1||e===32}var Ig=Rg(/\p{P}|\p{S}/u),Lg=Rg(/\s/);function Rg(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function zg(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Og(e.charCodeAt(n+1))&&Og(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Bg(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Fg(r)?(e.enter(n),s(r)):t(r)}function s(r){return Fg(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Vg={tokenize:Hg};function Hg(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Bg(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return U(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ug={tokenize:Gg},Wg={tokenize:Kg};function Gg(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return yg(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wg,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Wg,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return U(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;yg(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Kg(e,t,n){return Bg(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function qg(e){if(e===null||Pg(e)||Lg(e))return 1;if(Ig(e))return 2}function Jg(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Yg={name:`attention`,resolveAll:Xg,tokenize:Zg};function Xg(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Qg(d,-c),Qg(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=bg(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=bg(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=bg(l,Jg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=bg(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=bg(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,yg(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Zg(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qg(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=qg(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Qg(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $g={name:`autolink`,tokenize:e_};function e_(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Dg(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Og(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Og(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ag(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):kg(t)?(e.consume(t),l):n(t)}function u(e){return Og(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Og(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var t_={partial:!0,tokenize:n_};function n_(e,t,n){return r;function r(t){return Fg(t)?Bg(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||U(e)?t(e):n(e)}}var r_={continuation:{tokenize:a_},exit:o_,name:`blockQuote`,tokenize:i_};function i_(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Fg(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function a_(e,t,n){let r=this;return i;function i(t){return Fg(t)?Bg(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(r_,t,n)(r)}}function o_(e){e.exit(`blockQuote`)}var s_={name:`characterEscape`,tokenize:c_};function c_(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Ng(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var l_={name:`characterReference`,tokenize:u_};function u_(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Og,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Mg,u):(e.enter(`characterReferenceValue`),a=7,o=jg,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Og&&!vg(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var d_={partial:!0,tokenize:m_},f_={concrete:!0,name:`codeFenced`,tokenize:p_};function p_(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Fg(t)?Bg(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||U(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(d_,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Fg(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Bg(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||U(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Fg(t)?Bg(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||U(t)?e.check(d_,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||U(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Fg(t)?Bg(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Fg(t)?Bg(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||U(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function m_(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var h_={name:`codeIndented`,tokenize:__},g_={partial:!0,tokenize:v_};function __(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Bg(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):U(t)?e.attempt(g_,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||U(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function v_(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Bg(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):U(e)?i(e):n(e)}}var y_={name:`codeText`,previous:x_,resolve:b_,tokenize:S_};function b_(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function x_(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function S_(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||U(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var C_=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&w_(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),w_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),w_(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);w_(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);w_(this.left,t.reverse())}}}};function w_(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function T_(e){let t={},n=-1,r,i,a,o,s,c,l,u=new C_(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,E_(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return yg(e,0,1/0,u.slice(0)),!l}function E_(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var D_={resolve:k_,tokenize:A_},O_={partial:!0,tokenize:j_};function k_(e){return T_(e),e}function A_(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):U(t)?e.check(O_,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function j_(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Bg(e,a,`linePrefix`)}function a(i){if(i===null||U(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function M_(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ag(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||U(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Pg(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ag(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function N_(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):U(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||U(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Fg(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function P_(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Bg(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||U(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function F_(e,t){let n;return r;function r(i){return U(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Fg(i)?Bg(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var I_={name:`definition`,tokenize:R_},L_={partial:!0,tokenize:z_};function R_(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return N_.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Eg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Pg(t)?F_(e,l)(t):l(t)}function l(t){return M_(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(L_,d,d)(t)}function d(t){return Fg(t)?Bg(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||U(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function z_(e,t,n){return r;function r(t){return Pg(t)?F_(e,i)(t):n(t)}function i(t){return P_(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Fg(t)?Bg(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||U(e)?t(e):n(e)}}var B_={name:`hardBreakEscape`,tokenize:V_};function V_(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return U(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var H_={name:`headingAtx`,resolve:U_,tokenize:W_};function U_(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},yg(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function W_(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Pg(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||U(n)?(e.exit(`atxHeading`),t(n)):Fg(n)?Bg(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Pg(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var G_=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),K_=[`pre`,`script`,`style`,`textarea`],q_={concrete:!0,name:`htmlFlow`,resolveTo:X_,tokenize:Z_},J_={partial:!0,tokenize:$_},Y_={partial:!0,tokenize:Q_};function X_(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Z_(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ne):Dg(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Dg(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Dg(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Pg(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&K_.includes(l)?(i=1,r.interrupt?t(s):O(s)):G_.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Og(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Fg(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Dg(t)?(e.consume(t),b):Fg(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Og(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Fg(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Fg(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||U(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Pg(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Fg(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||U(t)?O(t):Fg(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ee):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),te):U(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(J_,ie,k)(t)):t===null||U(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Y_,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||U(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ee(t){return t===45?(e.consume(t),ne):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return K_.includes(n)?(e.consume(t),re):O(t)}return Dg(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function te(t){return t===93?(e.consume(t),ne):O(t)}function ne(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),ne):O(t)}function re(t){return t===null||U(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Q_(e,t,n){let r=this;return i;function i(t){return U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function $_(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(t_,t,n)}}var ev={name:`htmlText`,tokenize:tv};function tv(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Dg(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Dg(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):U(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ee(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):U(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ee(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ee(t):U(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):U(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?ee(e):y(e)}function x(t){return Dg(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Og(t)?(e.consume(t),S):C(t)}function C(t){return U(t)?(o=C,M(t)):Fg(t)?(e.consume(t),C):ee(t)}function w(t){return t===45||Og(t)?(e.consume(t),w):t===47||t===62||Pg(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ee):t===58||t===95||Dg(t)?(e.consume(t),E):U(t)?(o=T,M(t)):Fg(t)?(e.consume(t),T):ee(t)}function E(t){return t===45||t===46||t===58||t===95||Og(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):U(t)?(o=D,M(t)):Fg(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):U(t)?(o=O,M(t)):Fg(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):U(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Pg(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Pg(e)?T(e):n(e)}function ee(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return Fg(t)?Bg(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var nv={name:`labelEnd`,resolveAll:ov,resolveTo:sv,tokenize:cv},rv={tokenize:lv},iv={tokenize:uv},av={tokenize:dv};function ov(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&yg(e,0,e.length,n),e}function sv(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=bg(s,e.slice(a+1,a+r+3)),s=bg(s,[[`enter`,u,t]]),s=bg(s,Jg(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=bg(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=bg(s,e.slice(o+1)),s=bg(s,[[`exit`,c,t]]),yg(e,a,e.length,s),e}function cv(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Eg(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(rv,u,o?u:d)(t):t===91?e.attempt(iv,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(av,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function lv(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Pg(t)?F_(e,a)(t):a(t)}function a(t){return t===41?u(t):M_(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Pg(t)?F_(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?P_(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Pg(t)?F_(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function uv(e,t,n){let r=this;return i;function i(t){return N_.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Eg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function dv(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var fv={name:`labelStartImage`,resolveAll:nv.resolveAll,tokenize:pv};function pv(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var mv={name:`labelStartLink`,resolveAll:nv.resolveAll,tokenize:hv};function hv(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var gv={name:`lineEnding`,tokenize:_v};function _v(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Bg(e,t,`linePrefix`)}}var vv={name:`thematicBreak`,tokenize:yv};function yv(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||U(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Fg(t)?Bg(e,s,`whitespace`)(t):s(t))}}var bv={continuation:{tokenize:wv},exit:Ev,name:`list`,tokenize:Cv},xv={partial:!0,tokenize:Dv},Sv={partial:!0,tokenize:Tv};function Cv(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:jg(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(vv,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return jg(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(t_,r.interrupt?n:u,e.attempt(xv,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Fg(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function wv(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(t_,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Bg(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Fg(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Sv,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Bg(e,e.attempt(bv,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Tv(e,t,n){let r=this;return Bg(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Ev(e){e.exit(this.containerState.type)}function Dv(e,t,n){let r=this;return Bg(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Fg(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ov={name:`setextUnderline`,resolveTo:kv,tokenize:Av};function kv(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Av(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Fg(t)?Bg(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||U(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var jv={tokenize:Mv};function Mv(e){let t=this,n=e.attempt(t_,r,e.attempt(this.parser.constructs.flowInitial,i,Bg(e,e.attempt(this.parser.constructs.flow,i,e.attempt(D_,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Nv={resolveAll:Lv()},Pv=Iv(`string`),Fv=Iv(`text`);function Iv(e){return{resolveAll:Lv(e===`text`?Rv:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Lv(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Rv(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var zv=e({attentionMarkers:()=>qv,contentInitial:()=>Vv,disable:()=>Jv,document:()=>Bv,flow:()=>Uv,flowInitial:()=>Hv,insideSpan:()=>Kv,string:()=>Wv,text:()=>Gv}),Bv={42:bv,43:bv,45:bv,48:bv,49:bv,50:bv,51:bv,52:bv,53:bv,54:bv,55:bv,56:bv,57:bv,62:r_},Vv={91:I_},Hv={[-2]:h_,[-1]:h_,32:h_},Uv={35:H_,42:vv,45:[Ov,vv],60:q_,61:Ov,95:vv,96:f_,126:f_},Wv={38:l_,92:s_},Gv={[-5]:gv,[-4]:gv,[-3]:gv,33:fv,38:l_,42:Yg,60:[$g,ev],91:mv,92:[B_,s_],93:nv,95:Yg,96:y_},Kv={null:[Yg,Nv]},qv={null:[42,95]},Jv={null:[]};function Yv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=bg(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Jg(a,l.events,l),l.events):[]}function f(e,t){return Zv(p(e),t)}function p(e){return Xv(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){U(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&yg(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Xv(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Zv(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
12
12
  `;break;case-3:o=`\r
@@ -131,12 +131,12 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{i as r,n
131
131
  `),``,`You can apply a few solutions:`,['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',`Render a single element as the child so that we can forward the props onto that element.`].map(e=>` - ${e}`).join(`
132
132
  `)].join(`
133
133
  `))}else{let e=u.props?.className,t=typeof e==`function`?(...t)=>WU(e(...t),c.className):WU(e,c.className),n=t?{className:t}:{},r=$U(u.props,tW(nW(c,[`ref`])));for(let e in d)e in r&&delete d[e];return(0,y.cloneElement)(u,Object.assign({},r,d,l,{ref:i(rW(u),l.ref)},n))}}return(0,y.createElement)(a,Object.assign({},nW(c,[`ref`]),!aW(a)&&l,!aW(a)&&d),u)}function ZU(){let e=(0,y.useRef)([]),t=(0,y.useCallback)(t=>{for(let n of e.current)n!=null&&(typeof n==`function`?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>e==null))return e.current=n,t}}function QU(...e){return e.every(e=>e==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n==`function`?n(t):n.current=t)}}function $U(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith(`on`)&&typeof r[e]==`function`?(n[e]??(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t[`aria-disabled`])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>(e?.preventDefault)?.call(e)]);for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||t?.nativeEvent instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function eW(e){return Object.assign((0,y.forwardRef)(e),{displayName:e.displayName??e.name})}function tW(e){let t=Object.assign({},e);for(let e in t)t[e]===void 0&&delete t[e];return t}function nW(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function rW(e){return`19.2.8`.split(`.`)[0]>=`19`?e.props.ref:e.ref}function iW(e){if(e!=null&&e.$$typeof===Symbol.for(`react.lazy`)){let t=e._payload;if(t!=null&&t.status===`fulfilled`)return iW(t.value)}return e}function aW(e){return e===y.Fragment||e===Symbol.for(`react.fragment`)}function oW(e){return aW(e.type)}var sW=`span`,cW=(e=>(e[e.None=1]=`None`,e[e.Focusable=2]=`Focusable`,e[e.Hidden=4]=`Hidden`,e))(cW||{});function lW(e,t){let{features:n=1,...r}=e,i={ref:t,"aria-hidden":(n&2)==2?!0:r[`aria-hidden`]??void 0,hidden:(n&4)==4||void 0,style:{position:`fixed`,top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,...(n&4)==4&&(n&2)!=2&&{display:`none`}}};return JU()({ourProps:i,theirProps:r,slot:{},defaultTag:sW,name:`Hidden`})}var uW=eW(lW);function dW(e){return typeof e!=`object`||!e?!1:`nodeType`in e}function fW(e){return dW(e)&&`tagName`in e}function pW(e){return fW(e)&&`accessKey`in e}function mW(e){return fW(e)&&`tabIndex`in e}function hW(e){return fW(e)&&`style`in e}function gW(e){return pW(e)&&e.nodeName===`IFRAME`}function _W(e){return pW(e)&&e.nodeName===`INPUT`}var vW=Symbol();function yW(e,t=!0){return Object.assign(e,{[vW]:t})}function bW(...e){let t=(0,y.useRef)(e);(0,y.useEffect)(()=>{t.current=e},[e]);let n=BU(e=>{for(let n of t.current)n!=null&&(typeof n==`function`?n(e):n.current=e)});return e.every(e=>e==null||e?.[vW])?void 0:n}var xW=(0,y.createContext)(null);xW.displayName=`DescriptionContext`;function SW(){let e=(0,y.useContext)(xW);if(e===null){let e=Error(`You used a <Description /> component, but it is not inside a relevant parent.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,SW),e}return e}function CW(){let[e,t]=(0,y.useState)([]);return[e.length>0?e.join(` `):void 0,(0,y.useMemo)(()=>function(e){let n=BU(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}))),r=(0,y.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return y.createElement(xW.Provider,{value:r},e.children)},[t])]}var wW=`p`;function TW(e,t){let n=(0,y.useId)(),r=UU(),{id:i=`headlessui-description-${n}`,...a}=e,o=SW(),s=bW(t);RU(()=>o.register(i),[i,o.register]);let c=VU({...o.slot,disabled:r||!1}),l={ref:s,...o.props,id:i};return JU()({ourProps:l,theirProps:a,slot:c,defaultTag:wW,name:o.name||`Description`})}var EW=eW(TW),DW=Object.assign(EW,{}),OW=(e=>(e.Space=` `,e.Enter=`Enter`,e.Escape=`Escape`,e.Backspace=`Backspace`,e.Delete=`Delete`,e.ArrowLeft=`ArrowLeft`,e.ArrowUp=`ArrowUp`,e.ArrowRight=`ArrowRight`,e.ArrowDown=`ArrowDown`,e.Home=`Home`,e.End=`End`,e.PageUp=`PageUp`,e.PageDown=`PageDown`,e.Tab=`Tab`,e))(OW||{}),kW=(0,y.createContext)(()=>{});function AW({value:e,children:t}){return y.createElement(kW.Provider,{value:e},t)}var jW=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}},MW=Object.defineProperty,NW=(e,t,n)=>t in e?MW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PW=(e,t,n)=>(NW(e,typeof t==`symbol`?t:t+``,n),n),FW=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},IW=(e,t,n)=>(FW(e,t,`read from private field`),n?n.call(e):t.get(e)),LW=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},RW=(e,t,n,r)=>(FW(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),zW,BW,VW,HW=class{constructor(e){LW(this,zW,{}),LW(this,BW,new jW(()=>new Set)),LW(this,VW,new Set),PW(this,`disposables`,IU()),RW(this,zW,e),AU.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return IW(this,zW)}subscribe(e,t){if(AU.isServer)return()=>{};let n={selector:e,callback:t,current:e(IW(this,zW))};return IW(this,VW).add(n),this.disposables.add(()=>{IW(this,VW).delete(n)})}on(e,t){return AU.isServer?()=>{}:(IW(this,BW).get(e).add(t),this.disposables.add(()=>{IW(this,BW).get(e).delete(t)}))}send(e){let t=this.reduce(IW(this,zW),e);if(t!==IW(this,zW)){RW(this,zW,t);for(let e of IW(this,VW)){let t=e.selector(IW(this,zW));UW(e.current,t)||(e.current=t,e.callback(t))}for(let t of IW(this,BW).get(e.type))t(IW(this,zW),e)}}};zW=new WeakMap,BW=new WeakMap,VW=new WeakMap;function UW(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t?!1:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&WW(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&WW(e.entries(),t.entries()):GW(e)&&GW(t)?WW(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function WW(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function GW(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var KW=Object.defineProperty,qW=(e,t,n)=>t in e?KW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JW=(e,t,n)=>(qW(e,typeof t==`symbol`?t:t+``,n),n),YW=(e=>(e[e.Push=0]=`Push`,e[e.Pop=1]=`Pop`,e))(YW||{}),XW={0(e,t){let n=t.id,r=e.stack,i=e.stack.indexOf(n);if(i!==-1){let t=e.stack.slice();return t.splice(i,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let i=e.stack.slice();return i.splice(r,1),{...e,stack:i}}},ZW=class e extends HW{constructor(){super(...arguments),JW(this,`actions`,{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),JW(this,`selectors`,{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new e({stack:[]})}reduce(e,t){return GU(t.type,XW,e,t)}},QW=new jW(()=>ZW.new());function $W(e,t,n=UW){return(0,bw.useSyncExternalStoreWithSelector)(BU(t=>e.subscribe(eG,t)),BU(()=>e.state),BU(()=>e.state),BU(t),n)}function eG(e){return e}function tG(e,t){let n=(0,y.useId)(),r=QW.get(t),[i,a]=$W(r,(0,y.useCallback)(e=>[r.selectors.isTop(e,n),r.selectors.inStack(e,n)],[r,n]));return RU(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?!a||i:!1}var nG=new Map,rG=new Map;function iG(e){let t=rG.get(e)??0;return rG.set(e,t+1),t===0?(nG.set(e,{"aria-hidden":e.getAttribute(`aria-hidden`),inert:e.inert}),e.setAttribute(`aria-hidden`,`true`),e.inert=!0,()=>aG(e)):()=>aG(e)}function aG(e){let t=rG.get(e)??1;if(t===1?rG.delete(e):rG.set(e,t-1),t!==1)return;let n=nG.get(e);n&&(n[`aria-hidden`]===null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,n[`aria-hidden`]),e.inert=n.inert,nG.delete(e))}function oG(e,{allowed:t,disallowed:n}={}){let r=tG(e,`inert-others`);RU(()=>{if(!r)return;let e=IU();for(let t of n?.()??[])t&&e.add(iG(t));let i=t?.()??[];for(let t of i){if(!t)continue;let n=jU(t);if(!n)continue;let r=t.parentElement;for(;r&&r!==n.body;){for(let t of r.children)i.some(e=>t.contains(e))||e.add(iG(t));r=r.parentElement}}return e.dispose},[r,t,n])}function sG(e,t,n){let r=zU(e=>{let t=e.getBoundingClientRect();t.x===0&&t.y===0&&t.width===0&&t.height===0&&n()});(0,y.useEffect)(()=>{if(!e)return;let n=t===null?null:pW(t)?t:t.current;if(!n)return;let i=IU();if(typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}if(typeof IntersectionObserver<`u`){let e=new IntersectionObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,r,e])}var cG=[`[contentEditable=true]`,`[tabindex]`,`a[href]`,`area[href]`,`button:not([disabled])`,`iframe`,`input:not([disabled])`,`select:not([disabled])`,`details>summary`,`textarea:not([disabled])`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),lG=[`[data-autofocus]`].map(e=>`${e}:not([tabindex='-1'])`).join(`,`),uG=(e=>(e[e.First=1]=`First`,e[e.Previous=2]=`Previous`,e[e.Next=4]=`Next`,e[e.Last=8]=`Last`,e[e.WrapAround=16]=`WrapAround`,e[e.NoScroll=32]=`NoScroll`,e[e.AutoFocus=64]=`AutoFocus`,e))(uG||{}),dG=(e=>(e[e.Error=0]=`Error`,e[e.Overflow=1]=`Overflow`,e[e.Success=2]=`Success`,e[e.Underflow=3]=`Underflow`,e))(dG||{}),fG=(e=>(e[e.Previous=-1]=`Previous`,e[e.Next=1]=`Next`,e))(fG||{});function pG(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(cG)).sort((e,t)=>Math.sign((e.tabIndex||2**53-1)-(t.tabIndex||2**53-1)))}function mG(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(lG)).sort((e,t)=>Math.sign((e.tabIndex||2**53-1)-(t.tabIndex||2**53-1)))}var hG=(e=>(e[e.Strict=0]=`Strict`,e[e.Loose=1]=`Loose`,e))(hG||{});function gG(e,t=0){return e!==jU(e)?.body&&GU(t,{0(){return e.matches(cG)},1(){let t=e;for(;t!==null;){if(t.matches(cG))return!0;t=t.parentElement}return!1}})}var _G=(e=>(e[e.Keyboard=0]=`Keyboard`,e[e.Mouse=1]=`Mouse`,e))(_G||{});typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible=``)},!0),document.addEventListener(`click`,e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible=``)},!0));function vG(e){e?.focus({preventScroll:!0})}var yG=[`textarea`,`input`].join(`,`);function bG(e){return(e?.matches)?.call(e,yG)??!1}function xG(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(r===null||i===null)return 0;let a=r.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function SG(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:i=[]}={}){let a=Array.isArray(e)?e.length>0?MU(e[0]):document:MU(e),o=Array.isArray(e)?n?xG(e):e:t&64?mG(e):pG(e);i.length>0&&o.length>1&&(o=o.filter(e=>!i.some(t=>t!=null&&`current`in t?t?.current===e:t===e))),r??=a?.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw Error(`Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last`)})(),c=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(r))-1;if(t&4)return Math.max(0,o.indexOf(r))+1;if(t&8)return o.length-1;throw Error(`Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last`)})(),l=t&32?{preventScroll:!0}:{},u=0,d=o.length,f;do{if(u>=d||u+d<=0)return 0;let e=c+u;if(t&16)e=(e+d)%d;else{if(e<0)return 3;if(e>=d)return 1}f=o[e],f?.focus(l),u+=s}while(f!==NU(f));return t&6&&bG(f)&&f.select(),2}function CG(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function wG(){return/Android/gi.test(window.navigator.userAgent)}function TG(){return CG()||wG()}function EG(e,t,n,r){let i=zU(n);(0,y.useEffect)(()=>{if(!e)return;function n(e){i.current(e)}return document.addEventListener(t,n,r),()=>document.removeEventListener(t,n,r)},[e,t,r])}function DG(e,t,n,r){let i=zU(n);(0,y.useEffect)(()=>{if(!e)return;function n(e){i.current(e)}return window.addEventListener(t,n,r),()=>window.removeEventListener(t,n,r)},[e,t,r])}var OG=30;function kG(e,t,n){let r=zU(n),i=(0,y.useCallback)(function(e,n){if(e.defaultPrevented)return;let i=n(e);if(i===null||!i.getRootNode().contains(i)||!i.isConnected)return;let a=(function e(t){return typeof t==`function`?e(t()):Array.isArray(t)||t instanceof Set?t:[t]})(t);for(let t of a)if(t!==null&&(t.contains(i)||e.composed&&e.composedPath().includes(t)))return;return!gG(i,hG.Loose)&&i.tabIndex!==-1&&e.preventDefault(),r.current(e,i)},[r,t]),a=(0,y.useRef)(null);EG(e,`pointerdown`,e=>{TG()||(a.current=e.composedPath?.call(e)?.[0]||e.target)},!0),EG(e,`pointerup`,e=>{if(TG()||!a.current)return;let t=a.current;return a.current=null,i(e,()=>t)},!0);let o=(0,y.useRef)({x:0,y:0});EG(e,`touchstart`,e=>{o.current.x=e.touches[0].clientX,o.current.y=e.touches[0].clientY},!0),EG(e,`touchend`,e=>{let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY};if(!(Math.abs(t.x-o.current.x)>=OG||Math.abs(t.y-o.current.y)>=OG))return i(e,()=>mW(e.target)?e.target:null)},!0),DG(e,`blur`,e=>i(e,()=>gW(window.document.activeElement)?window.document.activeElement:null),!0)}function AG(...e){return(0,y.useMemo)(()=>jU(...e),[...e])}function jG(e,t,n,r){let i=zU(n);(0,y.useEffect)(()=>{e??=window;function n(e){i.current(e)}return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,r])}function MG(e){return(0,y.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}function NG(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(e){return r.add(e),()=>r.delete(e)},dispatch(e,...i){let a=t[e].call(n,...i);a&&(n=a,r.forEach(e=>e()))}}}function PG(){let e;return{before({doc:t}){let n=t.documentElement,r=t.defaultView??window;e=Math.max(0,r.innerWidth-n.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),a=Math.max(0,e-i);n.style(r,`paddingRight`,`${a}px`)}}}function FG(){return CG()?{before({doc:e,d:t,meta:n}){function r(e){for(let t of n().containers)for(let n of t())if(n.contains(e))return!0;return!1}t.microTask(()=>{if(window.getComputedStyle(e.documentElement).scrollBehavior!==`auto`){let n=IU();n.style(e.documentElement,`scrollBehavior`,`auto`),t.add(()=>t.microTask(()=>n.dispose()))}let n=window.scrollY??window.pageYOffset,i=null;t.addEventListener(e,`click`,t=>{if(mW(t.target))try{let n=t.target.closest(`a`);if(!n)return;let{hash:a}=new URL(n.href),o=e.querySelector(a);mW(o)&&!r(o)&&(i=o)}catch{}},!0),t.group(n=>{t.addEventListener(e,`touchstart`,e=>{if(n.dispose(),mW(e.target)&&hW(e.target)){if(r(e.target)){let t=e.target;for(;t.parentElement&&r(t.parentElement);)t=t.parentElement;n.style(t,`overscrollBehavior`,`contain`)}else n.style(e.target,`touchAction`,`none`)}})}),t.addEventListener(e,`touchmove`,e=>{if(mW(e.target)){if(_W(e.target))return;if(r(e.target)){let t=e.target;for(;t.parentElement&&t.dataset.headlessuiPortal!==``&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;t.dataset.headlessuiPortal===``&&e.preventDefault()}else e.preventDefault()}},{passive:!1}),t.add(()=>{let e=window.scrollY??window.pageYOffset;n!==e&&window.scrollTo(0,n),i&&i.isConnected&&(i.scrollIntoView({block:`nearest`}),i=null)})})}}:{}}function IG(){return{before({doc:e,d:t}){t.style(e.documentElement,`overflow`,`hidden`)}}}function LG(e){let t={};for(let n of e)Object.assign(t,n(t));return t}var RG=NG(()=>new Map,{PUSH(e,t){let n=this.get(e)??{doc:e,count:0,d:IU(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=LG(n.meta),this.set(e,n),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=LG(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[FG(),PG(),IG()];n.forEach(({before:e})=>e?.(t)),n.forEach(({after:e})=>e?.(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});RG.subscribe(()=>{let e=RG.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e=t.get(n.doc)===`hidden`,r=n.count!==0;(r&&!e||!r&&e)&&RG.dispatch(n.count>0?`SCROLL_PREVENT`:`SCROLL_ALLOW`,n),n.count===0&&RG.dispatch(`TEARDOWN`,n)}});function zG(e,t,n=()=>({containers:[]})){let r=MG(RG),i=t?r.get(t):void 0,a=i?i.count>0:!1;return RU(()=>{if(!(!t||!e))return RG.dispatch(`PUSH`,t,n),()=>RG.dispatch(`POP`,t,n)},[e,t]),a}function BG(e,t,n=()=>[document.body]){zG(tG(e,`scroll-lock`),t,e=>({containers:[...e.containers??[],n]}))}function VG(e=0){let[t,n]=(0,y.useState)(e);return{flags:t,setFlag:(0,y.useCallback)(e=>n(e),[]),addFlag:(0,y.useCallback)(e=>n(t=>t|e),[]),hasFlag:(0,y.useCallback)(e=>(t&e)===e,[t]),removeFlag:(0,y.useCallback)(e=>n(t=>t&~e),[]),toggleFlag:(0,y.useCallback)(e=>n(t=>t^e),[])}}typeof process<`u`&&typeof globalThis<`u`&&typeof Element<`u`&&(process==null?void 0:{})?.NODE_ENV===`test`&&(Element==null?void 0:Element.prototype)?.getAnimations===void 0&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.",``,`Example usage:`,"```js",`import { mockAnimationsApi } from 'jsdom-testing-mocks'`,`mockAnimationsApi()`,"```"].join(`
134
- `)),[]});var HG=(e=>(e[e.None=0]=`None`,e[e.Closed=1]=`Closed`,e[e.Enter=2]=`Enter`,e[e.Leave=4]=`Leave`,e))(HG||{});function UG(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]=``);return t}function WG(e,t,n,r){let[i,a]=(0,y.useState)(n),{hasFlag:o,addFlag:s,removeFlag:c}=VG(e&&i?3:0),l=(0,y.useRef)(!1),u=(0,y.useRef)(!1);return RU(()=>{var i;if(e){if(n&&a(!0),!t){n&&s(3);return}return(i=r?.start)==null||i.call(r,n),GG(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(s(3),c(4)):(s(4),c(2)))},run(){u.current?n?(c(3),s(4)):(c(4),s(3)):n?c(1):s(1)},done(){var e;u.current&&JG(t)||(l.current=!1,c(7),n||a(!1),(e=r?.end)==null||e.call(r,n))}})}},[e,n,t,LU()]),e?[i,{closed:o(1),enter:o(2),leave:o(4),transition:o(2)||o(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function GG(e,{prepare:t,run:n,done:r,inFlight:i}){let a=IU();return qG(e,{prepare:t,inFlight:i}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(KG(e,r))})}),a.dispose}function KG(e,t){let n=IU();if(!e)return n.dispose;let r=!1;n.add(()=>{r=!0});let i=e.getAnimations?.call(e).filter(e=>e instanceof CSSTransition)??[];return i.length===0?(t(),n.dispose):(Promise.allSettled(i.map(e=>e.finished)).then(()=>{r||t()}),n.dispose)}function qG(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition=`none`,n(),e.offsetHeight,e.style.transition=r}function JG(e){return(e.getAnimations?.call(e)??[]).some(e=>e instanceof CSSTransition&&e.playState!==`finished`)}function YG(e,t){let n=(0,y.useRef)([]),r=BU(e);(0,y.useEffect)(()=>{let e=[...n.current];for(let[i,a]of t.entries())if(n.current[i]!==a){let i=r(t,e);return n.current=t,i}},[r,...t])}var XG=(0,y.createContext)(null);XG.displayName=`OpenClosedContext`;var ZG=(e=>(e[e.Open=1]=`Open`,e[e.Closed=2]=`Closed`,e[e.Closing=4]=`Closing`,e[e.Opening=8]=`Opening`,e))(ZG||{});function QG(){return(0,y.useContext)(XG)}function $G({value:e,children:t}){return y.createElement(XG.Provider,{value:e},t)}function eK({children:e}){return y.createElement(XG.Provider,{value:null},e)}function tK(e){function t(){document.readyState!==`loading`&&(e(),document.removeEventListener(`DOMContentLoaded`,t))}typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`DOMContentLoaded`,t),t())}var nK=[];tK(()=>{function e(e){if(!mW(e.target)||e.target===document.body||nK[0]===e.target)return;let t=e.target;t=t.closest(cG),nK.unshift(t??e.target),nK=nK.filter(e=>e!=null&&e.isConnected),nK.splice(10)}window.addEventListener(`click`,e,{capture:!0}),window.addEventListener(`mousedown`,e,{capture:!0}),window.addEventListener(`focus`,e,{capture:!0}),document.body.addEventListener(`click`,e,{capture:!0}),document.body.addEventListener(`mousedown`,e,{capture:!0}),document.body.addEventListener(`focus`,e,{capture:!0})});function rK(e){let t=BU(e),n=(0,y.useRef)(!1);(0,y.useEffect)(()=>(n.current=!1,()=>{n.current=!0,FU(()=>{n.current&&t()})}),[t])}function iK(){let e=typeof document>`u`;return`useSyncExternalStore`in y&&(e=>e.useSyncExternalStore)(y)(()=>()=>{},()=>!1,()=>!e)}function aK(){let e=iK(),[t,n]=y.useState(AU.isHandoffComplete);return t&&AU.isHandoffComplete===!1&&n(!1),y.useEffect(()=>{t!==!0&&n(!0)},[t]),y.useEffect(()=>AU.handoff(),[]),!e&&t}var oK=(0,y.createContext)(!1);function sK(){return(0,y.useContext)(oK)}function cK(e){return y.createElement(oK.Provider,{value:e.force},e.children)}function lK(e){let t=sK(),n=(0,y.useContext)(mK),[r,i]=(0,y.useState)(()=>{if(!t&&n!==null)return n.current??null;if(AU.isServer)return null;let r=e?.getElementById(`headlessui-portal-root`);if(r)return r;if(e===null)return null;let i=e.createElement(`div`);return i.setAttribute(`id`,`headlessui-portal-root`),e.body.appendChild(i)});return(0,y.useEffect)(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),(0,y.useEffect)(()=>{t||n!==null&&i(n.current)},[n,i,t]),r}var uK=y.Fragment,dK=eW(function(e,t){let{ownerDocument:n=null,...r}=e,i=(0,y.useRef)(null),a=bW(yW(e=>{i.current=e}),t),o=AG(i.current),s=lK(n??o),c=(0,y.useContext)(gK),l=LU(),u=aK(),d=JU();return rK(()=>{var e;s&&s.childNodes.length<=0&&((e=s.parentElement)==null||e.removeChild(s))}),!s||!u?null:(0,jl.createPortal)(y.createElement(`div`,{"data-headlessui-portal":``,ref:e=>{l.dispose(),c&&e&&l.add(c.register(e))}},d({ourProps:{ref:a},theirProps:r,slot:{},defaultTag:uK,name:`Portal`})),s)});function fK(e,t){let n=bW(t),{enabled:r=!0,ownerDocument:i,...a}=e,o=JU();return r?y.createElement(dK,{...a,ownerDocument:i,ref:n}):o({ourProps:{ref:n},theirProps:a,slot:{},defaultTag:uK,name:`Portal`})}var pK=y.Fragment,mK=(0,y.createContext)(null);function hK(e,t){let{target:n,...r}=e,i={ref:bW(t)},a=JU();return y.createElement(mK.Provider,{value:n},a({ourProps:i,theirProps:r,defaultTag:pK,name:`Popover.Group`}))}var gK=(0,y.createContext)(null);function _K(){let e=(0,y.useContext)(gK),t=(0,y.useRef)([]),n=BU(n=>(t.current.push(n),e&&e.register(n),()=>r(n))),r=BU(n=>{let r=t.current.indexOf(n);r!==-1&&t.current.splice(r,1),e&&e.unregister(n)}),i=(0,y.useMemo)(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,(0,y.useMemo)(()=>function({children:e}){return y.createElement(gK.Provider,{value:i},e)},[i])]}var vK=eW(fK),yK=eW(hK),bK=Object.assign(vK,{Group:yK});function xK(e,t=typeof document<`u`?document.defaultView:null,n){let r=tG(e,`escape`);jG(t,`keydown`,e=>{r&&(e.defaultPrevented||e.key===OW.Escape&&n(e))})}function SK(){let[e]=(0,y.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null),[t,n]=(0,y.useState)(e?.matches??!1);return RU(()=>{if(!e)return;function t(e){n(e.matches)}return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[e]),t}function CK({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=BU(()=>{let r=jU(n),i=[];for(let t of e)t!==null&&(fW(t)?i.push(t):`current`in t&&fW(t.current)&&i.push(t.current));if(t!=null&&t.current)for(let e of t.current)i.push(e);for(let e of r?.querySelectorAll(`html > *, body > *`)??[])e!==document.body&&e!==document.head&&fW(e)&&e.id!==`headlessui-portal-root`&&(n&&(e.contains(n)||e.contains(n?.getRootNode()?.host))||i.some(t=>e.contains(t))||i.push(e));return i});return{resolveContainers:r,contains:BU(e=>r().some(t=>t.contains(e)))}}var wK=(0,y.createContext)(null);function TK({children:e,node:t}){let[n,r]=(0,y.useState)(null),i=EK(t??n);return y.createElement(wK.Provider,{value:i},e,i===null&&y.createElement(uW,{features:cW.Hidden,ref:e=>{if(e){for(let t of jU(e)?.querySelectorAll(`html > *, body > *`)??[])if(t!==document.body&&t!==document.head&&fW(t)&&t!=null&&t.contains(e)){r(t);break}}}}))}function EK(e=null){return(0,y.useContext)(wK)??e}function DK(){let e=(0,y.useRef)(!1);return RU(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var OK=(e=>(e[e.Forwards=0]=`Forwards`,e[e.Backwards=1]=`Backwards`,e))(OK||{});function kK(){let e=(0,y.useRef)(0);return DG(!0,`keydown`,t=>{t.key===`Tab`&&(e.current=+!!t.shiftKey)},!0),e}function AK(e){if(!e)return new Set;if(typeof e==`function`)return new Set(e());let t=new Set;for(let n of e.current)fW(n.current)&&t.add(n.current);return t}var jK=`div`,MK=(e=>(e[e.None=0]=`None`,e[e.InitialFocus=1]=`InitialFocus`,e[e.TabLock=2]=`TabLock`,e[e.FocusLock=4]=`FocusLock`,e[e.RestoreFocus=8]=`RestoreFocus`,e[e.AutoFocus=16]=`AutoFocus`,e))(MK||{});function NK(e,t){let n=(0,y.useRef)(null),r=bW(n,t),{initialFocus:i,initialFocusFallback:a,containers:o,features:s=15,...c}=e;aK()||(s=0);let l=AG(n.current);LK(s,{ownerDocument:l});let u=RK(s,{ownerDocument:l,container:n,initialFocus:i,initialFocusFallback:a});zK(s,{ownerDocument:l,container:n,containers:o,previousActiveElement:u});let d=kK(),f=BU(e=>{if(!pW(n.current))return;let t=n.current;(e=>e())(()=>{GU(d.current,{[OK.Forwards]:()=>{SG(t,uG.First,{skipElements:[e.relatedTarget,a]})},[OK.Backwards]:()=>{SG(t,uG.Last,{skipElements:[e.relatedTarget,a]})}})})}),p=tG(!!(s&2),`focus-trap#tab-lock`),m=LU(),h=(0,y.useRef)(!1),g={ref:r,onKeyDown(e){e.key==`Tab`&&(h.current=!0,m.requestAnimationFrame(()=>{h.current=!1}))},onBlur(e){if(!(s&4))return;let t=AK(o);pW(n.current)&&t.add(n.current);let r=e.relatedTarget;mW(r)&&r.dataset.headlessuiFocusGuard!==`true`&&(BK(t,r)||(h.current?SG(n.current,GU(d.current,{[OK.Forwards]:()=>uG.Next,[OK.Backwards]:()=>uG.Previous})|uG.WrapAround,{relativeTo:e.target}):mW(e.target)&&vG(e.target)))}},_=JU();return y.createElement(y.Fragment,null,p&&y.createElement(uW,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:f,features:cW.Focusable}),_({ourProps:g,theirProps:c,defaultTag:jK,name:`FocusTrap`}),p&&y.createElement(uW,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:f,features:cW.Focusable}))}var PK=eW(NK),FK=Object.assign(PK,{features:MK});function IK(e=!0){let t=(0,y.useRef)(nK.slice());return YG(([e],[n])=>{n===!0&&e===!1&&FU(()=>{t.current.splice(0)}),n===!1&&e===!0&&(t.current=nK.slice())},[e,nK,t]),BU(()=>t.current.find(e=>e!=null&&e.isConnected)??null)}function LK(e,{ownerDocument:t}){let n=!!(e&8),r=IK(n);YG(()=>{n||PU(t?.body)&&vG(r())},[n]),rK(()=>{n&&vG(r())})}function RK(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:i}){let a=(0,y.useRef)(null),o=tG(!!(e&1),`focus-trap#initial-focus`),s=DK();return YG(()=>{if(e===0)return;if(!o){i!=null&&i.current&&vG(i.current);return}let c=n.current;c&&FU(()=>{if(!s.current)return;let n=t?.activeElement;if(r!=null&&r.current){if(r?.current===n){a.current=n;return}}else if(c.contains(n)){a.current=n;return}if(r!=null&&r.current)vG(r.current);else{if(e&16){if(SG(c,uG.First|uG.AutoFocus)!==dG.Error)return}else if(SG(c,uG.First)!==dG.Error)return;if(i!=null&&i.current&&(vG(i.current),t?.activeElement===i.current))return;console.warn(`There are no focusable elements inside the <FocusTrap />`)}a.current=t?.activeElement})},[i,o,e]),a}function zK(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:i}){let a=DK(),o=!!(e&4);jG(t?.defaultView,`focus`,e=>{if(!o||!a.current)return;let t=AK(r);pW(n.current)&&t.add(n.current);let s=i.current;if(!s)return;let c=e.target;pW(c)?BK(t,c)?(i.current=c,vG(c)):(e.preventDefault(),e.stopPropagation(),vG(s)):vG(i.current)},!0)}function BK(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function VK(e){return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!aW(e.as??YK)||y.Children.count(e.children)===1}var HK=(0,y.createContext)(null);HK.displayName=`TransitionContext`;var UK=(e=>(e.Visible=`visible`,e.Hidden=`hidden`,e))(UK||{});function WK(){let e=(0,y.useContext)(HK);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}function GK(){let e=(0,y.useContext)(KK);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}var KK=(0,y.createContext)(null);KK.displayName=`NestingContext`;function qK(e){return`children`in e?qK(e.children):e.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e===`visible`).length>0}function JK(e,t){let n=zU(e),r=(0,y.useRef)([]),i=DK(),a=LU(),o=BU((e,t=qU.Hidden)=>{let o=r.current.findIndex(({el:t})=>t===e);o!==-1&&(GU(t,{[qU.Unmount](){r.current.splice(o,1)},[qU.Hidden](){r.current[o].state=`hidden`}}),a.microTask(()=>{var e;!qK(r)&&i.current&&((e=n.current)==null||e.call(n))}))}),s=BU(e=>{let t=r.current.find(({el:t})=>t===e);return t?t.state!==`visible`&&(t.state=`visible`):r.current.push({el:e,state:`visible`}),()=>o(e,qU.Unmount)}),c=(0,y.useRef)([]),l=(0,y.useRef)(Promise.resolve()),u=(0,y.useRef)({enter:[],leave:[]}),d=BU((e,n,r)=>{c.current.splice(0),t&&(t.chains.current[n]=t.chains.current[n].filter(([t])=>t!==e)),t?.chains.current[n].push([e,new Promise(e=>{c.current.push(e)})]),t?.chains.current[n].push([e,new Promise(e=>{Promise.all(u.current[n].map(([e,t])=>t)).then(()=>e())})]),n===`enter`?l.current=l.current.then(()=>t?.wait.current).then(()=>r(n)):r(n)}),f=BU((e,t,n)=>{Promise.all(u.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;(e=c.current.shift())==null||e()}).then(()=>n(t))});return(0,y.useMemo)(()=>({children:r,register:s,unregister:o,onStart:d,onStop:f,wait:l,chains:u}),[s,o,r,d,f,u,l])}var YK=y.Fragment,XK=KU.RenderStrategy;function ZK(e,t){var n;let{transition:r=!0,beforeEnter:i,afterEnter:a,beforeLeave:o,afterLeave:s,enter:c,enterFrom:l,enterTo:u,entered:d,leave:f,leaveFrom:p,leaveTo:m,...h}=e,[g,_]=(0,y.useState)(null),v=(0,y.useRef)(null),b=VK(e),x=bW(...b?[v,t,_]:t===null?[]:[t]),S=(n=h.unmount)==null||n?qU.Unmount:qU.Hidden,{show:C,appear:w,initial:T}=WK(),[E,D]=(0,y.useState)(C?`visible`:`hidden`),O=GK(),{register:k,unregister:A}=O;RU(()=>k(v),[k,v]),RU(()=>{if(S===qU.Hidden&&v.current){if(C&&E!==`visible`){D(`visible`);return}return GU(E,{hidden:()=>A(v),visible:()=>k(v)})}},[E,v,k,A,C,S]);let j=aK();RU(()=>{if(b&&j&&E===`visible`&&v.current===null)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,E,j,b]);let ee=T&&!w,M=w&&C&&T,N=(0,y.useRef)(!1),te=JK(()=>{N.current||(D(`hidden`),A(v))},O),ne=BU(e=>{N.current=!0;let t=e?`enter`:`leave`;te.onStart(v,t,e=>{e===`enter`?i?.():e===`leave`&&o?.()})}),re=BU(e=>{let t=e?`enter`:`leave`;N.current=!1,te.onStop(v,t,e=>{e===`enter`?a?.():e===`leave`&&s?.()}),t===`leave`&&!qK(te)&&(D(`hidden`),A(v))});(0,y.useEffect)(()=>{b&&r||(ne(C),re(C))},[C,b,r]);let[,ie]=WG(!(!r||!b||!j||ee),g,C,{start:ne,end:re}),ae=tW({ref:x,className:WU(h.className,M&&c,M&&l,ie.enter&&c,ie.enter&&ie.closed&&l,ie.enter&&!ie.closed&&u,ie.leave&&f,ie.leave&&!ie.closed&&p,ie.leave&&ie.closed&&m,!ie.transition&&C&&d)?.trim()||void 0,...UG(ie)}),oe=0;E===`visible`&&(oe|=ZG.Open),E===`hidden`&&(oe|=ZG.Closed),C&&E===`hidden`&&(oe|=ZG.Opening),!C&&E===`visible`&&(oe|=ZG.Closing);let se=JU();return y.createElement(KK.Provider,{value:te},y.createElement($G,{value:oe},se({ourProps:ae,theirProps:h,defaultTag:YK,features:XK,visible:E===`visible`,name:`Transition.Child`})))}function QK(e,t){let{show:n,appear:r=!1,unmount:i=!0,...a}=e,o=(0,y.useRef)(null),s=bW(...VK(e)?[o,t]:t===null?[]:[t]);aK();let c=QG();if(n===void 0&&c!==null&&(n=(c&ZG.Open)===ZG.Open),n===void 0)throw Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,u]=(0,y.useState)(n?`visible`:`hidden`),d=JK(()=>{n||u(`hidden`)}),[f,p]=(0,y.useState)(!0),m=(0,y.useRef)([n]);RU(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),p(!1))},[m,n]);let h=(0,y.useMemo)(()=>({show:n,appear:r,initial:f}),[n,r,f]);RU(()=>{n?u(`visible`):!qK(d)&&o.current!==null&&u(`hidden`)},[n,d]);let g={unmount:i},_=BU(()=>{var t;f&&p(!1),(t=e.beforeEnter)==null||t.call(e)}),v=BU(()=>{var t;f&&p(!1),(t=e.beforeLeave)==null||t.call(e)}),b=JU();return y.createElement(KK.Provider,{value:d},y.createElement(HK.Provider,{value:h},b({ourProps:{...g,as:y.Fragment,children:y.createElement(tq,{ref:s,...g,...a,beforeEnter:_,beforeLeave:v})},theirProps:{},defaultTag:y.Fragment,features:XK,visible:l===`visible`,name:`Transition`})))}function $K(e,t){let n=(0,y.useContext)(HK)!==null,r=QG()!==null;return y.createElement(y.Fragment,null,!n&&r?y.createElement(eq,{ref:t,...e}):y.createElement(tq,{ref:t,...e}))}var eq=eW(QK),tq=eW(ZK),nq=eW($K),rq=Object.assign(eq,{Child:nq,Root:eq}),iq=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(iq||{}),aq=(e=>(e[e.SetTitleId=0]=`SetTitleId`,e))(aq||{}),oq={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},sq=(0,y.createContext)(null);sq.displayName=`DialogContext`;function cq(e){let t=(0,y.useContext)(sq);if(t===null){let t=Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,cq),t}return t}function lq(e,t){return GU(t.type,oq,e,t)}var uq=eW(function(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-${n}`,open:i,onClose:a,initialFocus:o,role:s=`dialog`,autoFocus:c=!0,__demoMode:l=!1,unmount:u=!1,...d}=e,f=(0,y.useRef)(!1);s=(function(){return s===`dialog`||s===`alertdialog`?s:(f.current||(f.current=!0,console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),`dialog`)})();let p=QG();i===void 0&&p!==null&&(i=(p&ZG.Open)===ZG.Open);let m=(0,y.useRef)(null),h=bW(m,t),g=AG(m.current),_=+!i,[v,b]=(0,y.useReducer)(lq,{titleId:null,descriptionId:null,panelRef:(0,y.createRef)()}),x=BU(()=>a(!1)),S=BU(e=>b({type:0,id:e})),C=aK()?_===0:!1,[w,T]=_K(),E={get current(){return v.panelRef.current??m.current}},D=EK(),{resolveContainers:O}=CK({mainTreeNode:D,portals:w,defaultContainers:[E]}),k=p!==null&&(p&ZG.Closing)===ZG.Closing;oG(l||k?!1:C,{allowed:BU(()=>[m.current?.closest(`[data-headlessui-portal]`)??null]),disallowed:BU(()=>[D?.closest(`body > *:not(#headlessui-portal-root)`)??null])});let A=QW.get(null);RU(()=>{if(C)return A.actions.push(r),()=>A.actions.pop(r)},[A,r,C]);let j=$W(A,(0,y.useCallback)(e=>A.selectors.isTop(e,r),[A,r]));kG(j,O,e=>{e.preventDefault(),x()}),xK(j,g?.defaultView,e=>{e.preventDefault(),e.stopPropagation(),document.activeElement&&`blur`in document.activeElement&&typeof document.activeElement.blur==`function`&&document.activeElement.blur(),x()}),BG(l||k?!1:C,g,O),sG(C,m,x);let[ee,M]=CW(),N=(0,y.useMemo)(()=>[{dialogState:_,close:x,setTitleId:S,unmount:u},v],[_,x,S,u,v]),te=VU({open:_===0}),ne={ref:h,id:r,role:s,tabIndex:-1,"aria-modal":l?void 0:_===0||void 0,"aria-labelledby":v.titleId,"aria-describedby":ee,unmount:u},re=!SK(),ie=MK.None;C&&!l&&(ie|=MK.RestoreFocus,ie|=MK.TabLock,c&&(ie|=MK.AutoFocus),re&&(ie|=MK.InitialFocus));let ae=JU();return y.createElement(eK,null,y.createElement(cK,{force:!0},y.createElement(bK,null,y.createElement(sq.Provider,{value:N},y.createElement(yK,{target:m},y.createElement(cK,{force:!1},y.createElement(M,{slot:te},y.createElement(T,null,y.createElement(FK,{initialFocus:o,initialFocusFallback:m,containers:O,features:ie},y.createElement(AW,{value:x},ae({ourProps:ne,theirProps:d,slot:te,defaultTag:dq,features:fq,visible:_===0,name:`Dialog`})))))))))))}),dq=`div`,fq=KU.RenderStrategy|KU.Static;function pq(e,t){let{transition:n=!1,open:r,...i}=e,a=QG(),o=e.hasOwnProperty(`open`)||a!==null,s=e.hasOwnProperty(`onClose`);if(!o&&!s)throw Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!s)throw Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!=`boolean`)throw Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!=`function`)throw Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!i.static?y.createElement(TK,null,y.createElement(rq,{show:r,transition:n,unmount:i.unmount},y.createElement(uq,{ref:t,...i}))):y.createElement(TK,null,y.createElement(uq,{ref:t,open:r,...i}))}var mq=`div`;function hq(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-panel-${n}`,transition:i=!1,...a}=e,[{dialogState:o,unmount:s},c]=cq(`Dialog.Panel`),l=bW(t,c.panelRef),u=VU({open:o===0}),d={ref:l,id:r,onClick:BU(e=>{e.stopPropagation()})},f=i?nq:y.Fragment,p=i?{unmount:s}:{},m=JU();return y.createElement(f,{...p},m({ourProps:d,theirProps:a,slot:u,defaultTag:mq,name:`Dialog.Panel`}))}var gq=`div`;function _q(e,t){let{transition:n=!1,...r}=e,[{dialogState:i,unmount:a}]=cq(`Dialog.Backdrop`),o=VU({open:i===0}),s={ref:t,"aria-hidden":!0},c=n?nq:y.Fragment,l=n?{unmount:a}:{},u=JU();return y.createElement(c,{...l},u({ourProps:s,theirProps:r,slot:o,defaultTag:gq,name:`Dialog.Backdrop`}))}var vq=`h2`;function yq(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-title-${n}`,...i}=e,[{dialogState:a,setTitleId:o}]=cq(`Dialog.Title`),s=bW(t);(0,y.useEffect)(()=>(o(r),()=>o(null)),[r,o]);let c=VU({open:a===0}),l={ref:s,id:r};return JU()({ourProps:l,theirProps:i,slot:c,defaultTag:vq,name:`Dialog.Title`})}var bq=eW(pq),xq=eW(hq);eW(_q);var Sq=eW(yq),Cq=Object.assign(bq,{Panel:xq,Title:Sq,Description:DW});function wq({children:e,position:t,onClose:n,isOpen:r,wide:i=!1}){let a=i?800:400,o=i?700:500,s={position:`fixed`,left:`${Math.min(t.x,typeof window<`u`?window.innerWidth-a:t.x)}px`,top:`${Math.min(t.y,typeof window<`u`?window.innerHeight-o:t.y)}px`};return(0,I.jsx)(rq,{appear:!0,show:r,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-popup-overlay`,onClose:n,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-popup-backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-popup-container`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsx)(xq,{className:`semiont-popup-panel`,style:s,"data-annotation-ui":!0,"data-wide":i?`true`:`false`,children:(0,I.jsx)(I.Fragment,{children:e})})})})]})})}function Tq(e){return wr(e)?{stroke:`rgb(250, 204, 21)`,fill:`rgba(250, 204, 21, 0.2)`}:Tr(e)?{stroke:`rgb(59, 130, 246)`,fill:`rgba(59, 130, 246, 0.2)`}:Er(e)?{stroke:`rgb(239, 68, 68)`,fill:`rgba(239, 68, 68, 0.2)`}:Dr(e)?{stroke:`rgb(255, 255, 255)`,fill:`rgba(255, 255, 255, 0.2)`}:Or(e)?{stroke:`rgb(234, 88, 12)`,fill:`rgba(234, 88, 12, 0.2)`}:{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`}}function Eq(e){return Dr(e)?`Comment`:wr(e)?`Highlight`:Er(e)?`Assessment`:Or(e)?`Tag`:Ar(e)?`Resolved Reference`:Tr(e)?`Unresolved Reference`:`Annotation`}function Dq({annotations:e,imageWidth:t,imageHeight:n,displayWidth:r,displayHeight:i,session:a,hoveredAnnotationId:o,selectedAnnotationId:s,hoverDelayMs:c}){let l=r/t,u=i/n,{handleMouseEnter:d,handleMouseLeave:f}=(0,y.useMemo)(()=>_l(e=>a?.client.beckon.hover(e),c),[a,c]);return(0,I.jsx)(`svg`,{className:`semiont-annotation-overlay`,style:{width:r,height:i},children:e.map(e=>{if(typeof e.target==`string`)return null;let t=yr(e.target.selector);if(!t)return null;let n=li(t.value);if(!n)return null;let r=e.id===o,i=e.id===s,c=Tq(e),p=Tr(e),m=p&&Sr(e.body),h=p?m?`🔗`:`❓`:null;switch(n.type){case`rect`:{let{x:t,y:o,width:s,height:p}=n.data,m=(t+s)*l+8,g=(o+p)*u+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`rect`,{x:t*l,y:o*u,width:s*l,height:p*u,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:m,y:g,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}case`circle`:{let{cx:t,cy:o,r:s}=n.data,p=s*Math.min(l,u),m=Math.PI/4,g=t*l+p*Math.cos(m)+8,_=o*u+p*Math.sin(m)+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`circle`,{cx:t*l,cy:o*u,r:p,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:g,y:_,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}case`polygon`:{let t=n.data.points.map(e=>`${e.x*l},${e.y*u}`).join(` `),o=[...n.data.points.map(e=>({x:e.x*l,y:e.y*u,sum:e.x*l+e.y*u}))].sort((e,t)=>t.sum-e.sum),s=o[0],p=o[1],m=(s.x+p.x)/2+8,g=(s.y+p.y)/2+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`polygon`,{points:t,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:m,y:g,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}default:return null}})})}function Oq(e){if(!e)return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`};switch(e){case`highlighting`:return{stroke:`rgb(250, 204, 21)`,fill:`rgba(250, 204, 21, 0.2)`};case`linking`:return{stroke:`rgb(59, 130, 246)`,fill:`rgba(59, 130, 246, 0.2)`};case`assessing`:return{stroke:`rgb(239, 68, 68)`,fill:`rgba(239, 68, 68, 0.2)`};case`commenting`:return{stroke:`rgb(255, 255, 255)`,fill:`rgba(255, 255, 255, 0.2)`};default:return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`}}}function kq({imageUrl:e,resourceUri:t,existingAnnotations:n=[],drawingMode:r,selectedMotivation:i,session:a,hoveredAnnotationId:o,selectedAnnotationId:s}){let{hoverDelayMs:c}=nF(),l=(0,y.useRef)(null),u=(0,y.useRef)(null),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null);(0,y.useEffect)(()=>{let t=new Image;t.onload=()=>{f({width:t.naturalWidth,height:t.naturalHeight})},t.src=e},[e]),(0,y.useEffect)(()=>{let e=()=>{u.current&&m({width:u.current.clientWidth,height:u.current.clientHeight})};e();let t=null;try{t=new ResizeObserver(e),u.current&&t.observe(u.current)}catch{console.warn(`ResizeObserver not supported, falling back to window resize listener`),window.addEventListener(`resize`,e)}return()=>{t?t.disconnect():window.removeEventListener(`resize`,e)}},[]);let S=(0,y.useCallback)(e=>{if(!u.current)return null;let t=u.current.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},[]),C=(0,y.useCallback)(e=>{if(!r)return;let t=S(e);t&&(g(!0),v(t),x(t))},[r,S]),w=(0,y.useCallback)(e=>{if(!h||!_)return;let t=S(e);t&&x(t)},[h,_,S]),T=(0,y.useCallback)(e=>{if(!h||!_||!r)return;let o=S(e);if(!o||!p||!d)return;if(Math.sqrt((o.x-_.x)**2+(o.y-_.y)**2)<10){if(n.length>0){let e,t=n.find(t=>{if(typeof t.target==`string`)return!1;let n=t.target.selector;if(!n)return!1;let r=(Array.isArray(n)?n:[n]).find(e=>e.type===`SvgSelector`);if(!r||r.type!==`SvgSelector`)return!1;let i=li(r.value);if(!i)return!1;let a=p.width/d.width,s=p.height/d.height;if(i.type===`rect`){let{x:t,y:n,width:r,height:c}=i.data,l=t*a,d=n*s,f=r*a,p=c*s,m=o.x>=l&&o.x<=l+f&&o.y>=d&&o.y<=d+p;return m&&u.current&&(e=ve(u.current.getBoundingClientRect(),l,d,f,p)),m}return!1});if(t){a?.client.browse.click(t.id,e),g(!1),v(null),x(null);return}}g(!1),v(null),x(null);return}let s;switch(r){case`circle`:{let e=Math.sqrt((o.x-_.x)**2+(o.y-_.y)**2);s=ci(_,e);break}case`polygon`:{let e=(_.x+o.x)/2,t=(_.y+o.y)/2,n=Math.abs(o.x-_.x)/2,r=Math.abs(o.y-_.y)/2;s=si([{x:e,y:t-r},{x:e+n,y:t},{x:e,y:t+r},{x:e-n,y:t}]);break}default:s=oi(_,o)}let c=ui(s,p.width,p.height,d.width,d.height);a&&i&&a.client.mark.request(ur(t),{type:`SvgSelector`,value:c},i),g(!1),v(null),x(null)},[h,_,r,p,d,S,i,n]),E=(0,y.useCallback)(()=>{h&&(g(!1),v(null),x(null))},[h]);return(0,I.jsxs)(`div`,{ref:l,className:`semiont-svg-drawing-canvas`,onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:E,"data-drawing-mode":r||`none`,children:[(0,I.jsx)(`img`,{ref:u,src:e,alt:`Annotatable content`,className:`semiont-svg-drawing-canvas__image`,draggable:!1}),p&&d&&(0,I.jsx)(`div`,{className:`semiont-svg-drawing-canvas__overlay-container`,children:(0,I.jsxs)(`div`,{className:`semiont-svg-drawing-canvas__overlay`,style:{width:p.width,height:p.height},children:[(0,I.jsx)(Dq,{annotations:n,imageWidth:d.width,imageHeight:d.height,displayWidth:p.width,displayHeight:p.height,hoverDelayMs:c,...a&&{session:a},...o!==void 0&&{hoveredAnnotationId:o},...s!==void 0&&{selectedAnnotationId:s}}),h&&_&&b&&(()=>{let e=Oq(i||null);return(0,I.jsxs)(`svg`,{className:`semiont-svg-drawing-canvas__preview`,style:{width:p.width,height:p.height},children:[r===`circle`&&(()=>{let t=Math.sqrt((b.x-_.x)**2+(b.y-_.y)**2);return(0,I.jsx)(`circle`,{cx:_.x,cy:_.y,r:t,fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})})(),r===`polygon`&&(()=>{let t=(_.x+b.x)/2,n=(_.y+b.y)/2,r=Math.abs(b.x-_.x)/2,i=Math.abs(b.y-_.y)/2,a=[{x:t,y:n-i},{x:t+r,y:n},{x:t,y:n+i},{x:t-r,y:n}].map(e=>`${e.x},${e.y}`).join(` `);return(0,I.jsx)(`polygon`,{points:a,fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})})(),r===`rectangle`&&(0,I.jsx)(`rect`,{x:Math.min(_.x,b.x),y:Math.min(_.y,b.y),width:Math.abs(b.x-_.x),height:Math.abs(b.y-_.y),fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})]})})()]})})]})}var Aq=[{titleKey:`navigationTitle`,shortcuts:[{keys:[`⌘K`,`Ctrl K`],descriptionKey:`navOpenSearch`},{keys:[`/`],descriptionKey:`navOpenSearchAlt`},{keys:[`⌘N`,`Ctrl N`],descriptionKey:`navCreateResource`},{keys:[`Esc Esc`],descriptionKey:`navCloseOverlays`},{keys:[`?`],descriptionKey:`navShowHelp`}]},{titleKey:`sidebarTitle`,shortcuts:[{keys:[`Click <`],descriptionKey:`sidebarCollapse`},{keys:[`Click ☰`],descriptionKey:`sidebarExpand`},{keys:[`Space`],descriptionKey:`sidebarPickup`},{keys:[`↑`,`↓`],descriptionKey:`sidebarMove`},{keys:[`Space`],descriptionKey:`sidebarDrop`},{keys:[`Esc`],descriptionKey:`sidebarCancel`}]},{titleKey:`annotationsTitle`,shortcuts:[{keys:[`H`],descriptionKey:`annotHighlight`},{keys:[`R`],descriptionKey:`annotReference`},{keys:[`Delete`],descriptionKey:`annotDelete`},{keys:[`Tab`],descriptionKey:`annotNavigate`},{keys:[`Shift Tab`],descriptionKey:`annotNavigateBack`}]},{titleKey:`listsTitle`,shortcuts:[{keys:[`←`,`→`],descriptionKey:`listsFilterNav`},{keys:[`↑`,`↓`,`←`,`→`],descriptionKey:`listsGridNav`},{keys:[`Home`],descriptionKey:`listsJumpFirst`},{keys:[`End`],descriptionKey:`listsJumpLast`}]},{titleKey:`searchModalTitle`,shortcuts:[{keys:[`↑`,`↓`],descriptionKey:`searchNav`},{keys:[`Enter`],descriptionKey:`searchSelect`},{keys:[`Esc`],descriptionKey:`searchClose`}]},{titleKey:`modalTitle`,shortcuts:[{keys:[`Esc`],descriptionKey:`modalClose`},{keys:[`Tab`],descriptionKey:`modalNavForward`},{keys:[`Shift Tab`],descriptionKey:`modalNavBackward`},{keys:[`Enter`],descriptionKey:`modalActivate`},{keys:[`Space`],descriptionKey:`modalActivate`}]},{titleKey:`accessibilityTitle`,shortcuts:[{keys:[`Tab`],descriptionKey:`a11ySkipLinks`},{keys:[`Enter`],descriptionKey:`a11yFollowLink`}]}];function jq({isOpen:e,onClose:t}){let n=Em(`KeyboardShortcuts`),r=typeof window<`u`&&navigator.platform.toUpperCase().indexOf(`MAC`)>=0;return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:t,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--large`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__header`,children:(0,I.jsxs)(`div`,{className:`semiont-modal__header-content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title`,children:n(`title`)}),(0,I.jsx)(`button`,{onClick:t,"aria-label":n(`closeDialog`),className:`semiont-modal__close`,children:(0,I.jsx)(`svg`,{className:`semiont-modal__close-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})})]})}),(0,I.jsxs)(`div`,{className:`semiont-modal__body`,children:[(0,I.jsx)(`div`,{className:`semiont-shortcuts`,children:Aq.map(e=>(0,I.jsxs)(`div`,{className:`semiont-shortcuts__group`,children:[(0,I.jsx)(`h3`,{className:`semiont-shortcuts__group-title`,children:n(e.titleKey)}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__list`,children:e.shortcuts.map((e,t)=>(0,I.jsxs)(`div`,{className:`semiont-shortcuts__item`,children:[(0,I.jsx)(`span`,{className:`semiont-shortcuts__description`,children:n(e.descriptionKey)}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__keys`,children:e.keys.map((e,t)=>e.includes(`⌘`)&&!r||e.includes(`Ctrl`)&&r?null:(0,I.jsxs)(y.Fragment,{children:[t>0&&!e.includes(`⌘`)&&!e.includes(`Ctrl`)&&(0,I.jsx)(`span`,{className:`semiont-shortcuts__separator`,children:n(`or`)}),(0,I.jsx)(`kbd`,{className:`semiont-shortcuts__key`,children:e})]},t))})]},t))})]},e.titleKey))}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__note`,children:(0,I.jsx)(`p`,{className:`semiont-shortcuts__note-text`,children:n(r?`macNote`:`windowsNote`)})})]}),(0,I.jsx)(`div`,{className:`semiont-modal__footer`,children:(0,I.jsxs)(`div`,{className:`semiont-modal__footer-content`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__hint`,children:n(`footerHint`,{key:`?`}).split(`?`).map((e,t,n)=>(0,I.jsxs)(y.Fragment,{children:[e,t<n.length-1&&(0,I.jsx)(`kbd`,{className:`semiont-modal__hint-key`,children:`?`})]},t))}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-button semiont-button--secondary`,children:n(`close`)})]})})]})})})})]})})}function Mq(){let e=Z(Up().activeSignals$),t=Z(e?.permissionDeniedAt$)??null,n=Z(e?.permissionDeniedMessage$)??null,r=()=>e?.acknowledgePermissionDenied(),i=t!==null,a=n??`You do not have permission to perform this action.`,o=()=>{r(),window.history.back()};return(0,I.jsx)(rq,{appear:!0,show:i,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:o,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--medium`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-modal__icon`,children:(0,I.jsx)(`svg`,{style:{width:`1.5rem`,height:`1.5rem`,color:`var(--semiont-color-amber-600, #d97706)`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})})})}),(0,I.jsxs)(`div`,{className:`semiont-modal__content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title semiont-modal__title--centered`,children:`Access Denied`}),(0,I.jsx)(`p`,{className:`semiont-modal__description`,children:a})]}),(0,I.jsxs)(`div`,{style:{padding:`0.75rem`,backgroundColor:`var(--semiont-bg-secondary)`,borderRadius:`var(--semiont-radius-md, 0.375rem)`,border:`1px solid var(--semiont-border-primary)`,fontSize:`var(--semiont-text-sm, 0.875rem)`,marginBottom:`1rem`},children:[(0,I.jsx)(`p`,{style:{color:`var(--semiont-text-secondary)`,marginBottom:`0.5rem`},children:`This could be because:`}),(0,I.jsxs)(`ul`,{style:{listStyle:`disc`,listStylePosition:`inside`,color:`var(--semiont-text-tertiary)`,display:`flex`,flexDirection:`column`,gap:`0.25rem`},children:[(0,I.jsx)(`li`,{children:`You don't have the required permissions`}),(0,I.jsx)(`li`,{children:`The resource is restricted to specific users or teams`}),(0,I.jsx)(`li`,{children:`Your account type doesn't include this feature`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-modal__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,className:`semiont-button--primary semiont-button--flex`,children:`Go Back`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{r(),window.location.href=`/`},className:`semiont-button--secondary semiont-button--flex`,children:`Go to Home`})]}),(0,I.jsx)(`div`,{className:`semiont-modal__actions`,style:{marginTop:`0.5rem`,paddingTop:`0.5rem`,borderTop:`1px solid var(--semiont-border-primary)`},children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>{r(),window.location.href=`/auth/connect?callbackUrl=${encodeURIComponent(window.location.pathname)}`},className:`semiont-button--secondary semiont-button--flex`,style:{fontSize:`var(--semiont-text-sm, 0.875rem)`},children:`Switch Account`})})]})})})})]})})}function Nq(){let e=Z(Up().activeSignals$),t=Z(e?.sessionExpiredAt$)??null,n=Z(e?.sessionExpiredMessage$)??null,r=()=>e?.acknowledgeSessionExpired(),i=t!==null,a=()=>{r(),window.location.href=`/auth/connect?callbackUrl=${encodeURIComponent(window.location.pathname)}`},o=()=>{r(),window.location.href=`/`};return(0,I.jsx)(rq,{appear:!0,show:i,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:o,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--medium`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-modal__icon`,style:{background:`linear-gradient(to bottom right, var(--semiont-color-red-100, #fee2e2), var(--semiont-color-red-300, #fca5a5))`},children:(0,I.jsx)(`svg`,{style:{width:`1.5rem`,height:`1.5rem`,color:`var(--semiont-color-red-600, #dc2626)`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})})})}),(0,I.jsxs)(`div`,{className:`semiont-modal__content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title semiont-modal__title--centered`,children:`Session Expired`}),(0,I.jsx)(`p`,{className:`semiont-modal__description`,children:n??`Your session has expired for security reasons. Please sign in again to continue working.`})]}),(0,I.jsxs)(`div`,{className:`semiont-modal__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,className:`semiont-button--secondary semiont-button--flex`,children:`Go to Home`}),(0,I.jsx)(`button`,{type:`button`,onClick:a,className:`semiont-button--primary semiont-button--flex`,children:`Sign In Again`})]})]})})})})]})})}function Pq(e,t,n,r){if(!t||n<0||r<=n||r>e.length)return null;let i=pi(e,n,r);return[{type:`TextPositionSelector`,start:n,end:r},{type:`TextQuoteSelector`,exact:t,...i.prefix&&{prefix:i.prefix},...i.suffix&&{suffix:i.suffix}}]}function Fq(e,t){let n=e.indexOf(t);return n===-1?null:{start:n,end:n+t.length}}var Iq=new Set;function Lq(e,t){if(!e)return[{exact:``,start:0,end:0}];let n=t.map(t=>{let n=Cr(t.target),r=vr(n),i=n?Nr(n):null,a=Zr(e,{...r?{position:{start:r.start,end:r.end}}:{},...i?{quote:{exact:i.exact,...i.prefix===void 0?{}:{prefix:i.prefix},...i.suffix===void 0?{}:{suffix:i.suffix}}}:{}});return a&&a.confidence!==`high`&&Rq(t.id,a.strategy,a.confidence),{annotation:t,start:a?.start??0,end:a?.end??0,...a?.strategy?{strategy:a.strategy}:{},...a?.confidence?{confidence:a.confidence}:{}}}).filter(t=>t.start>=0&&t.end<=e.length&&t.start<t.end).sort((e,t)=>e.start-t.start);if(n.length===0)return[{exact:e,start:0,end:e.length}];let r=[],i=0;for(let{annotation:t,start:a,end:o,strategy:s,confidence:c}of n)a<i||(a>i&&r.push({exact:e.slice(i,a),start:i,end:a}),r.push({exact:e.slice(a,o),annotation:t,start:a,end:o,...s?{strategy:s}:{},...c?{confidence:c}:{}}),i=o);return i<e.length&&r.push({exact:e.slice(i),start:i,end:e.length}),r}function Rq(e,t,n){Iq.has(e)||(Iq.add(e),console.warn(`[segmentTextWithAnnotations] annotation anchored via degraded strategy`,{annotationId:e,strategy:t,confidence:n}))}function zq(){let e=Em(`PdfViewer`);return(0,I.jsx)(I.Fragment,{children:e(`viewerLoading`)})}var Bq=(0,y.lazy)(()=>s(()=>import(`./PdfAnnotationCanvas.client-LSH3PZPY-B8dnEIps.js`).then(e=>({default:e.PdfAnnotationCanvas})),__vite__mapDeps([4,2,3,1])));function Vq({content:e,annotations:t,session:n,sparkleAnnotationIds:r,hoveredAnnotationId:i,scrollToAnnotationId:a,showLineNumbers:o=!1,hoverDelayMs:s=150,enableWidgets:c=!1,getTargetResourceName:l,generatingReferenceId:u}){let d=Lq(e,t);return(0,I.jsx)(KH,{content:e,segments:d,editable:!1,sparkleAnnotationIds:r,...i!==void 0&&{hoveredAnnotationId:i},...a!==void 0&&{scrollToAnnotationId:a},sourceView:!0,showLineNumbers:o,hoverDelayMs:s,enableWidgets:c,session:n,...l&&{getTargetResourceName:l},...u!==void 0&&{generatingReferenceId:u}})}function Hq({content:e,resourceUri:t,annotations:n,session:r,drawingMode:i,selectedMotivation:a,hoveredAnnotationId:o,hoverDelayMs:s=150}){return e?(0,I.jsx)(kq,{imageUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:i,selectedMotivation:a,session:r,hoveredAnnotationId:o||null,hoverDelayMs:s}):null}function Uq({content:e,resourceUri:t,annotations:n,session:r,drawingMode:i,selectedMotivation:a,hoveredAnnotationId:o,hoverDelayMs:s=150}){return e?(0,I.jsx)(y.Suspense,{fallback:(0,I.jsx)(`div`,{className:`semiont-annotate-view__loading`,children:(0,I.jsx)(zq,{})}),children:(0,I.jsx)(Bq,{pdfUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:i,selectedMotivation:a,session:r,hoveredAnnotationId:o||null,hoverDelayMs:s,pageLayout:`scroll`})}):null}var Wq={text:Vq,image:Hq,pdf:Uq};function Gq({resourceUri:e,session:t}){let n=t?.client??null,{token:r}=pF(n,ur(e)),i=zP(n,ur(e),r);return i?(0,I.jsx)(`a`,{href:i,download:!0,className:`semiont-button semiont-button--primary`,children:`Download File`}):(0,I.jsx)(`button`,{type:`button`,disabled:!0,className:`semiont-button semiont-button--primary semiont-button--disabled`,children:`Download File`})}function Kq({content:e,mimeType:t=`text/plain`,resourceUri:n,annotations:r,uiState:i,onUIStateChange:a,enableWidgets:o=!1,getTargetResourceName:s,generatingReferenceId:c,showLineNumbers:l=!1,hoverDelayMs:u=150,annotateMode:d,session:f,sparkleAnnotationIds:p,onModeChange:m,showToolbar:h=!0,renderers:g}){let _=(0,y.useRef)(null),v=Si(t)?.render??`none`,{highlights:b,references:x,assessments:S,comments:C,tags:w}=r,T=[...b,...x,...S,...C,...w],{selectedMotivation:E,selectedClick:D,selectedShape:O,hoveredAnnotationId:k,scrollToAnnotationId:A}=i,j=(0,y.useRef)(a);j.current=a;let ee=(0,y.useCallback)(e=>{j.current?.({selectedMotivation:e})},[]),M=(0,y.useCallback)(e=>{j.current?.({selectedClick:e})},[]),N=(0,y.useCallback)(e=>{j.current?.({selectedShape:e})},[]);hF(f,{"beckon:hover":(0,y.useCallback)(({annotationId:e})=>{j.current?.({hoveredAnnotationId:e})},[]),"beckon:focus":(0,y.useCallback)(({annotationId:e,resourceId:t})=>{t&&t!==n||_.current&&kH(e??null,_.current,{pulse:!0})},[n])}),(0,y.useEffect)(()=>{let t=_.current;if(!t)return;let r=!1,i=e=>{let t=e.target;r=!!t.closest(`[data-annotation-id]`),t.closest(`[data-annotation-ui]`)},a=i=>{let a=i.target;if(a.closest(`.semiont-pdf-annotation-canvas`)||a.closest(`.semiont-svg-drawing-canvas`))return;let o=window.getSelection();if(!o||o.isCollapsed||!o.toString()){r=!1;return}if(r){r=!1;return}r=!1;let s=o.getRangeAt(0),c=o.toString(),l=t.querySelector(`.codemirror-renderer`)?.__cmView,u,d;if(!l||!l.posAtDOM){let t=Fq(e,c);if(!t)return;u=t.start,d=t.end}else u=l.posAtDOM(s.startContainer,s.startOffset),d=u+c.length;if(u>=0&&E){let t=Pq(e,c,u,d);if(!t)return;f?.client.mark.request(ur(n),t,E),o.removeAllRanges()}};return t.addEventListener(`mouseup`,a),t.addEventListener(`mousedown`,i),()=>{t.removeEventListener(`mouseup`,a),t.removeEventListener(`mousedown`,i)}},[E,e,n]);let te={...Wq,...g}[v];return te?(0,I.jsxs)(`div`,{className:`semiont-annotate-view`,"data-mime-type":v,ref:_,children:[h&&(0,I.jsx)(iU,{selectedMotivation:E,selectedClick:D,selectedShape:O,mediaType:t,annotateMode:d,annotators:ww,onModeChange:m,onClickActionChange:M,onSelectionChange:ee,onShapeChange:N}),(0,I.jsx)(`div`,{className:`semiont-annotate-view__content`,children:(0,I.jsx)(te,{content:e,mimeType:t,resourceUri:n,annotations:T,session:f,drawingMode:E?O:null,selectedMotivation:E,hoveredAnnotationId:k,hoverDelayMs:u,sparkleAnnotationIds:p,scrollToAnnotationId:A,showLineNumbers:l,enableWidgets:o,...s&&{getTargetResourceName:s},generatingReferenceId:c})})]}):(0,I.jsx)(`div`,{ref:_,className:`semiont-annotate-view semiont-annotate-view--unsupported`,"data-mime-type":`unsupported`,children:(0,I.jsxs)(`div`,{className:`semiont-annotate-view__empty`,children:[(0,I.jsxs)(`p`,{className:`semiont-annotate-view__empty-message`,children:[`Annotation not supported for `,t]}),(0,I.jsx)(Gq,{resourceUri:n,session:f})]})})}function qq(e){if(!e.startsWith(`did:`))return e;let t=e.match(/^did:web:system:(.+)$/);if(t){let e=t[1];return e.charAt(0).toUpperCase()+e.slice(1)}let n=e.match(/^did:web:[^:]+:users:(.+)$/);return n?decodeURIComponent(n[1]):e}function Jq(e,t,n){switch(e){case`yield:created`:return t(`resourceCreated`);case`yield:cloned`:return t(`resourceCloned`);case`mark:archived`:return t(`resourceArchived`);case`mark:unarchived`:return t(`resourceUnarchived`);case`mark:added`:{let e=n?.annotation?.motivation;return t(e===`highlighting`?`highlightAdded`:e===`linking`?`referenceCreated`:e===`assessing`?`assessmentAdded`:`annotationAdded`)}case`mark:removed`:return t(`annotationRemoved`);case`mark:body-updated`:return t(`annotationBodyUpdated`);case`mark:entity-tag-added`:return t(`entitytagAdded`);case`mark:entity-tag-removed`:return t(`entitytagRemoved`);case`job:completed`:case`job:started`:case`job:failed`:return t(`jobEvent`);case`yield:representation-added`:case`yield:representation-removed`:return t(`representationEvent`);default:return e}}function Yq(e,t){switch(e){case`yield:created`:case`yield:cloned`:case`mark:archived`:case`mark:unarchived`:return`📄`;case`mark:added`:{let e=t?.annotation?.motivation;return e===`highlighting`?ww.highlight.iconEmoji||`📝`:e===`linking`?ww.reference.iconEmoji||`📝`:e===`assessing`&&ww.assessment.iconEmoji||`📝`}case`mark:removed`:return`🗑️`;case`mark:body-updated`:return`✏️`;case`mark:entity-tag-added`:case`mark:entity-tag-removed`:return`🏷️`;case`job:completed`:return`🔗`;case`job:started`:return`⚙️`;case`job:failed`:return`❌`;case`yield:representation-added`:case`yield:representation-removed`:return`📄`;default:return`📝`}}function Xq(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?t(`justNow`):i<60?t(`minutesAgo`,{count:i}):a<24?t(`hoursAgo`,{count:a}):o<7?t(`daysAgo`,{count:o}):n.toLocaleDateString()}function Zq(e,t=50){let n=e.trim();return n.length>t?n.substring(0,t)+`...`:n}function Qq(e,t,n){let r=e,i=r.payload;switch(r.type){case`yield:created`:case`yield:cloned`:return{exact:i.name,isQuoted:!1,isTag:!1};case`mark:body-updated`:{let e=t.find(e=>e.id.endsWith(`/annotations/${i.annotationId}`));if(e?.target)try{let t=jr(Cr(e.target));if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}catch{}return null}case`mark:removed`:{let e=n.find(e=>e.type===`mark:added`&&e.payload.annotation.id.endsWith(`/annotations/${i.annotationId}`));if(e&&e.type===`mark:added`)try{let t=e.payload.annotation.target;if(typeof t!=`string`&&t.selector){let e=jr(t.selector);if(e)return{exact:Zq(e),isQuoted:!0,isTag:!1}}}catch{}return null}case`mark:added`:try{let e=i.annotation.target;if(typeof e!=`string`&&e.selector){let t=jr(e.selector);if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}}catch{}return null;case`mark:entity-tag-added`:case`mark:entity-tag-removed`:return{exact:i.entityType,isQuoted:!1,isTag:!0};case`job:completed`:if(i.annotationUri){let e=t.find(e=>e.id===i.annotationUri);if(e?.target)try{let t=jr(Cr(e.target));if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}catch{}}return null;case`job:started`:case`job:failed`:case`yield:representation-added`:case`yield:representation-removed`:return null;default:return null}}function $q(e){let t=e,n=t.payload;if(t.type===`mark:added`){let e=n.annotation.motivation,t=n.annotation.body;if(e===`linking`&&t&&`entityTypes`in t)return t.entityTypes??[]}return[]}function eJ(e){let t=e,n=t.payload;return t.type===`yield:created`?{type:`created`,userId:t.userId,metadata:void 0}:t.type===`yield:cloned`?{type:`cloned`,userId:t.userId,sourceDocId:n.parentResourceId,parentResourceId:n.parentResourceId,metadata:void 0}:null}function tJ({event:e,annotations:t,allEvents:n,isRelated:r,t:i,Link:a,routes:o,onEventRef:s,onEventClick:c,onEventHover:l}){let u=Qq(e,t,n),d=mr(e),f=eJ(e),p=$q(e),m=(0,y.useRef)(null),h=(0,y.useRef)(l);(0,y.useEffect)(()=>{h.current=l});let g=(0,y.useCallback)(()=>{!d||!h.current||(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{h.current?.(d)},300))},[d]),_=(0,y.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null),h.current&&h.current(null)},[]),v=d?`button`:`div`,b=d?{type:`button`,onClick:()=>c?.(d),"aria-label":i(`viewAnnotation`,{content:u?.exact||Jq(e.type,i)}),className:`semiont-history-event`,"data-related":r?`true`:`false`,"data-interactive":`true`}:{className:`semiont-history-event`,"data-related":r?`true`:`false`};return(0,I.jsxs)(v,{ref:e=>{s&&s(d,e)},...b,children:[(0,I.jsxs)(`div`,{className:`semiont-history-event__content`,children:[(0,I.jsx)(`span`,{className:`semiont-history-event__emoji`,onMouseEnter:g,onMouseLeave:_,children:Yq(e.type,e.payload)}),u?u.isTag?(0,I.jsx)(`span`,{className:`semiont-history-event__tag`,children:u.exact}):u.isQuoted?(0,I.jsxs)(`span`,{className:`semiont-history-event__text semiont-history-event__text--quoted`,children:[`“`,u.exact,`”`]}):(0,I.jsx)(`span`,{className:`semiont-history-event__text`,children:u.exact}):(0,I.jsx)(`span`,{className:`semiont-history-event__text`,children:Jq(e.type,i,e.payload)}),e.userId&&(0,I.jsx)(`span`,{className:`semiont-history-event__user`,children:qq(e.userId)}),(0,I.jsx)(`span`,{className:`semiont-history-event__timestamp`,children:Xq(e.timestamp,i)})]}),p.length>0&&(0,I.jsx)(`div`,{className:`semiont-history-event__entity-types`,children:p.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--small`,"data-variant":`blue`,children:e},e))}),f&&(0,I.jsxs)(`div`,{className:`semiont-history-event__details`,children:[(0,I.jsxs)(`span`,{className:`semiont-history-event__detail`,children:[i(`user`),`: `,(0,I.jsx)(`span`,{className:`semiont-history-event__detail-value`,children:f.userId?qq(f.userId):``})]}),f.type===`cloned`&&f.sourceDocId&&(0,I.jsx)(a,{href:o.resourceDetail(f.sourceDocId),className:`semiont-history-event__link`,onClick:e=>e.stopPropagation(),children:i(`viewOriginal`)})]})]})}function nJ({events:e,eventsLoading:t=!1,eventsError:n=null,onRetryEvents:r,annotations:i=[],hoveredAnnotationId:a,onEventHover:o,onEventClick:s,Link:c,routes:l}){let u=Em(`AnnotationHistory`),d=t,f=n,p=(0,y.useRef)(new Map),m=(0,y.useRef)(null),h=e.filter(e=>e.type!==`job:started`&&e.type!==`job:progress`&&e.type!==`job:completed`).sort((e,t)=>e.metadata.sequenceNumber-t.metadata.sequenceNumber);return(0,y.useEffect)(()=>{m.current&&h.length>0&&requestAnimationFrame(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)})},[h.length]),(0,y.useEffect)(()=>{if(!a)return;let e=p.current.get(a);e&&m.current&&(e.scrollIntoView({behavior:`smooth`,block:`nearest`}),e.classList.add(`bg-blue-100`,`dark:bg-blue-900/30`),setTimeout(()=>{e.classList.remove(`bg-blue-100`,`dark:bg-blue-900/30`)},1500))},[a]),f?(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsxs)(`p`,{className:`semiont-history-panel__error`,children:[u(`failed`),r&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:r,className:`semiont-panel__inline-action`,children:u(`retry`)})]})]})]}):d?(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsx)(`div`,{className:`semiont-history-panel__loading`,children:u(`loading`)})]}):h.length===0?null:(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsx)(`div`,{ref:m,className:`semiont-history-panel__list`,children:h.map(e=>{let t=a?(()=>{let t=mr(e);return t?t===a:!1})():!1;return(0,I.jsx)(tJ,{event:e,annotations:i,allEvents:h,isRelated:t,t:u,Link:c,routes:l,onEventRef:(e,t)=>{t&&e?p.current.set(e,t):!t&&e&&p.current.delete(e)},...s&&{onEventClick:s},...o&&{onEventHover:o}},e.id)})})]})}function rJ(){let e=Em(`PdfViewer`);return(0,I.jsx)(I.Fragment,{children:e(`viewerLoading`)})}var iJ=(0,y.lazy)(()=>s(()=>import(`./PdfAnnotationCanvas.client-LSH3PZPY-B8dnEIps.js`).then(e=>({default:e.PdfAnnotationCanvas})),__vite__mapDeps([4,2,3,1]))),aJ=(0,y.memo)(function({content:e}){return(0,I.jsx)(hx,{remarkPlugins:[yw],children:e})});function oJ({content:e}){return(0,I.jsx)(aJ,{content:e})}function sJ({content:e,resourceUri:t,annotations:n,session:r}){return(0,I.jsx)(kq,{imageUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:null,selectedMotivation:null,session:r})}function cJ({content:e,resourceUri:t,annotations:n,session:r}){return(0,I.jsx)(y.Suspense,{fallback:(0,I.jsx)(`div`,{className:`semiont-browse-view__loading`,children:(0,I.jsx)(rJ,{})}),children:(0,I.jsx)(iJ,{pdfUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:null,selectedMotivation:null,session:r,pageLayout:`scroll`})})}var lJ={text:oJ,image:sJ,pdf:cJ},uJ=(0,y.memo)(function({content:e,mimeType:t,resourceUri:n,annotations:r,selectedClick:i=`detail`,onModeChange:a,onClickActionChange:o,showToolbar:s=!0,annotateMode:c,hoverDelayMs:l=150,session:u,sparkleAnnotationIds:d,renderers:f,onLinkClick:p,onReferenceHover:m,inline:h=!1}){let g=(0,y.useRef)(null),_=h?` semiont-browse-view--inline`:``,v=Si(t)?.render??`none`,{highlights:b,references:x,assessments:S,comments:C,tags:w}=r,T=(0,y.useMemo)(()=>[...b,...x,...S,...C,...w],[b,x,S,C,w]),E=(0,y.useMemo)(()=>GP(T),[T]);(0,y.useEffect)(()=>{if(!g.current||E.length===0)return;let t=g.current,n=BP(e,t),r=VP(t);return UP(HP(E,n),r),()=>WP(t)},[e,E]),(0,y.useEffect)(()=>{if(!g.current||!u)return;let e=g.current,t=e=>{let t=e.target.closest(`[data-annotation-id]`);if(!t)return;let n=window.getSelection();if(n&&!n.isCollapsed)return;let r=t.getAttribute(`data-annotation-id`);if(r){let e=T.find(e=>e.id===r);e&&u.client.browse.click(e.id,t.getBoundingClientRect())}},n=null,r=null,i=!1,a=e=>{if(!m)return;let t=T.find(t=>t.id===e);if(!t||!Ar(t))return;let a=xr(t.body),o=n;!a||!o||(r?.unsubscribe(),r=u.client.browse.resource(ur(a)).subscribe({next:e=>{if(e.status!==`ready`)return;let n=e.value;r?.unsubscribe(),r=null,i=!0,m({annotation:t,referent:n,anchorRect:o.getBoundingClientRect()})},error:()=>{r=null}}))},o=()=>{r?.unsubscribe(),r=null,i&&(i=!1,m?.(null))},{handleMouseEnter:s,handleMouseLeave:c,cleanup:f}=_l(e=>{u.client.beckon.hover(e),e?a(e):o()},l),p=e=>{let t=e.target.closest(`[data-annotation-id]`),r=t?.getAttribute(`data-annotation-id`);r&&(n=t,s(dr(r)))},h=e=>{e.target.closest(`[data-annotation-id]`)&&c()};return d&&e.querySelectorAll(`[data-annotation-id]`).forEach(e=>{let t=e.getAttribute(`data-annotation-id`);t&&d.has(t)&&e.classList.add(`annotation-sparkle`)}),e.addEventListener(`click`,t),e.addEventListener(`mouseover`,p),e.addEventListener(`mouseout`,h),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`mouseover`,p),e.removeEventListener(`mouseout`,h),f(),r?.unsubscribe()}},[e,T,d,l,u,m]);let D=(0,y.useCallback)((e,t=!1)=>{g.current&&kH(e,g.current,{pulse:t})},[]);hF(u,{"beckon:hover":(0,y.useCallback)(({annotationId:e})=>{D(e)},[D]),"beckon:focus":(0,y.useCallback)(({annotationId:e,resourceId:t})=>{t&&t!==n||D(e??null,!0)},[D,n])});let O=(0,y.useCallback)(e=>{let t=e.target.closest(`a[href]`);if(!t)return;e.preventDefault();let n=t.getAttribute(`href`);n&&p?.({href:n,event:e})},[p]),k={...lJ,...f},A=v===`none`?void 0:k[v];return A?(0,I.jsxs)(`div`,{className:`semiont-browse-view${_}`,"data-mime-type":v,children:[s&&(0,I.jsx)(iU,{selectedMotivation:null,selectedClick:i,parts:[`clickAction`,`mode`],showDeleteButton:!1,annotateMode:c,annotators:ww,onModeChange:a,onClickActionChange:o,compact:h}),(0,I.jsx)(`div`,{ref:g,className:`semiont-browse-view__content`,onClick:O,children:(0,I.jsx)(A,{content:e,mimeType:t,resourceUri:n,annotations:T,session:u})})]}):(0,I.jsx)(`div`,{ref:g,className:`semiont-browse-view semiont-browse-view--unsupported${_}`,"data-mime-type":`unsupported`,children:(0,I.jsxs)(`div`,{className:`semiont-browse-view__empty`,children:[(0,I.jsxs)(`p`,{className:`semiont-browse-view__empty-message`,children:[`Preview not available for `,t]}),(0,I.jsx)(Gq,{resourceUri:n,session:u})]})})});function dJ({resource:e,annotations:t,session:n,onOpenResource:r,onOpenPanel:i,onLinkClick:a,onReferenceHover:o,inline:s=!1,sparkleAnnotationIds:c,generatingReferenceId:l,showLineNumbers:u=!1,hoverDelayMs:d,hoveredAnnotationId:f,annotateMode:p,onAnnotateModeChange:m,clickAction:h,onClickActionChange:g,selectionMotivation:_,onSelectionMotivationChange:v,shape:b,onShapeChange:x,showToolbar:S=!0,browseRenderers:C,annotateRenderers:w}){let T=Em(`ResourceViewer`),E=(0,y.useRef)(null),{highlights:D,references:O,assessments:k,comments:A,tags:j}=t;if(!e[`@id`])throw Error(`Resource has no @id`);let ee=e[`@id`],M=Wr(e)||`text/plain`,[N,te]=(0,y.useState)(!1),ne=p??N,re=(0,y.useCallback)(e=>{p===void 0&&te(e),m?.(e)},[p,m]),ie=ne?`annotate`:`browse`,[ae,oe]=(0,y.useState)(`linking`),se=_===void 0?ae:_,ce=(0,y.useCallback)(e=>{_===void 0&&oe(e),v?.(e)},[_,v]),[le,P]=(0,y.useState)(`detail`),F=h??le,ue=(0,y.useCallback)(e=>{h===void 0&&P(e),g?.(e)},[h,g]),[de,fe]=(0,y.useState)(`rectangle`),pe=b??de,me=(0,y.useCallback)(e=>{b===void 0&&fe(e),x?.(e)},[b,x]),[he,ge]=(0,y.useState)(!1),[_e,ve]=(0,y.useState)(null),[ye,be]=(0,y.useState)(null),xe=f??null,Se=()=>typeof window>`u`?{x:0,y:0}:{x:Math.max(0,(window.innerWidth-800)/2),y:Math.max(0,(window.innerHeight-700)/2)},Ce=(0,y.useCallback)(e=>{n?.client.mark.delete(ee,e)},[n,ee]),we=(0,y.useCallback)((e,t)=>{if(Object.values(ww).find(t=>t.matchesAnnotation(e))?.hasSidePanel&&F!==`deleting`&&F!==`jsonld`&&F!==`follow`)return;let n=wr(e)||Er(e)||Dr(e)||Tr(e)||Or(e);if(F===`follow`&&Tr(e)){let t=xr(e.body);t&&r?.(t);return}if(F===`jsonld`&&n){ve(e),ge(!0);return}if(ne&&F===`deleting`&&n){let n=t?{x:t.clientX,y:t.clientY+10}:{x:window.innerWidth/2-150,y:window.innerHeight/2-75};be({annotation:e,position:n});return}},[ne,F,r]);hF(n,{"browse:click":(0,y.useCallback)(({annotationId:e,anchorRect:t})=>{let n=[...D,...O,...k,...A,...j].find(t=>t.id===e);if(n){if(!Object.values(ww).find(e=>e.matchesAnnotation(n))?.hasSidePanel||F!==`detail`){we(n);return}i?.({panel:`annotations`,scrollToAnnotationId:e,motivation:n.motivation,...t?{anchorRect:t}:{}})}},[D,O,k,A,j,we,F,i])});let Te=(0,y.useMemo)(()=>({highlights:D,references:O,assessments:k,comments:A,tags:j}),[D,O,k,A,j]),L={selectedMotivation:se,selectedClick:F,selectedShape:pe,hoveredAnnotationId:xe},Ee=(0,y.useCallback)(e=>{let t=O.find(t=>xr(t.body)===e);return t?jr(Cr(t.target)):void 0},[O]);return(0,I.jsxs)(`div`,{ref:E,className:`semiont-resource-viewer${s?` semiont-resource-viewer--inline`:``}`,children:[ie===`annotate`?(0,I.jsx)(Kq,{content:e.content,mimeType:M,resourceUri:e[`@id`],annotations:Te,uiState:L,onUIStateChange:e=>{`selectedMotivation`in e&&ce(e.selectedMotivation??null),`selectedClick`in e&&ue(e.selectedClick),`selectedShape`in e&&me(e.selectedShape)},enableWidgets:!0,getTargetResourceName:Ee,...l!==void 0&&{generatingReferenceId:l},showLineNumbers:u,hoverDelayMs:d,annotateMode:ne,onModeChange:re,showToolbar:S,session:n,sparkleAnnotationIds:c,...w&&{renderers:w}}):(0,I.jsx)(uJ,{content:e.content,mimeType:M,resourceUri:e[`@id`],annotations:Te,selectedClick:F,hoverDelayMs:d,annotateMode:ne,onModeChange:re,onClickActionChange:ue,showToolbar:S,session:n,sparkleAnnotationIds:c,onLinkClick:a,onReferenceHover:o,inline:s,...C&&{renderers:C}}),_e&&(0,I.jsx)(wq,{isOpen:he,onClose:()=>ge(!1),position:Se(),wide:!0,children:(0,I.jsx)(EU,{annotation:_e,onBack:()=>{ge(!1),ve(null)}})}),ye&&(()=>{let e=ye.annotation,t=Object.values(ww).find(t=>t.matchesAnnotation(e)),n=jr(Cr(e.target)),r=t?.iconEmoji||`📝`;return(0,I.jsx)(wq,{isOpen:!!ye,onClose:()=>be(null),position:ye.position,children:(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation`,children:[(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation__header`,children:[(0,I.jsx)(`span`,{className:`semiont-delete-confirmation__icon`,children:r}),(0,I.jsx)(`h3`,{className:`semiont-delete-confirmation__title`,children:T(`deleteConfirmationTitle`)})]}),n&&(0,I.jsx)(`div`,{className:`semiont-delete-confirmation__quote`,children:(0,I.jsxs)(`p`,{className:`semiont-delete-confirmation__text`,children:[`"`,n.length>100?n.substring(0,100)+`...`:n,`"`]})}),(0,I.jsx)(`p`,{className:`semiont-delete-confirmation__message`,children:T(`deleteConfirmationMessage`)}),(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>be(null),className:`semiont-button semiont-button--secondary`,children:T(`deleteConfirmationCancel`)}),(0,I.jsx)(`button`,{onClick:()=>{Ce(ye.annotation.id),be(null)},className:`semiont-button semiont-button--danger`,children:T(`deleteConfirmationDelete`)})]})]})})})()]})}function fJ(e){if(e[`@type`]===`Software`){let t=e.provider,n=e.model;if(t&&n)return`${t} ${n}`;if(n)return n;if(t)return t}return e.name||e[`@id`]||`unknown`}function pJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function mJ(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`TextualBody`&&`value`in e&&typeof e.value==`string`}function hJ(e){return e.body?mJ(e.body)?e.body.value||null:Array.isArray(e.body)&&e.body.length>0&&e.body.find(mJ)?.value||null:null}function gJ({session:e,assessment:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t),s=hJ(t);return(0,I.jsxs)(`div`,{ref:i,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`assessment`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...a,children:[o&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`assessment`,children:[`"`,o.substring(0,100),o.length>100?`...`:``,`"`]}),s&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__body`,"data-type":`assessment`,children:s}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,pJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function _J(e){return t=>{switch(t.code){case`loading`:return e(`codeLoading`);case`analyzing`:return e(`codeAnalyzing`);case`analyzing-tags`:return e(`codeAnalyzingTags`);case`generating-resource`:return e(`codeGeneratingResource`);case`creating-resource`:return e(`codeCreatingResource`);case`complete-generated`:return t.truncated?e(`codeCompleteGeneratedTruncated`):e(`codeCompleteGenerated`);case`detecting-entities`:return e(`codeDetectingEntities`);case`creating-annotations`:return e(`codeCreatingAnnotations`,{count:t.count});case`creating-tag-annotations`:return e(`codeCreatingTagAnnotations`,{count:t.count});case`complete-created`:return e(`codeCompleteCreated`,{count:t.count,kind:e(vJ(t.kind))});default:return t}}}function vJ(e){return`kind${e.charAt(0).toUpperCase()}${e.slice(1)}`}function yJ(e){let t=bJ(e);return(n,r,i)=>r===void 0||i===void 0?e(`subject`,{kind:t(n.kind),label:n.value}):e(`subjectWithPosition`,{kind:t(n.kind),label:n.value,done:r+1,total:i})}function bJ(e){return t=>{switch(t){case`entity-type`:return e(`subjectKindEntityType`);case`category`:return e(`subjectKindCategory`);default:return t}}}function xJ(e){return t=>{switch(t){case`entity-types`:return e(`paramEntityTypes`);case`instructions`:return e(`paramInstructions`);case`tone`:return e(`paramTone`);case`density`:return e(`paramDensity`);default:return t}}}function SJ(e,t){return{cancel:e(`cancel`),close:e(`close`),inProgress:e(`inProgress`),message:_J(e),subject:yJ(e),paramLabel:xJ(e),...t?.found?{found:t.found}:{}}}function CJ({session:e,annotationType:t,isAssisting:n,locale:r,sourceLanguage:i,progress:a}){let o=Em(t===`highlight`?`HighlightPanel`:t===`assessment`?`AssessmentPanel`:`CommentsPanel`),s=Em(`AssistProgress`),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(t===`assessment`?4:5),[m,h]=(0,y.useState)(!0),g=(0,y.useCallback)(()=>{let n=t===`highlight`?`highlighting`:t===`assessment`?`assessing`:`commenting`;e?.client.mark.requestAssist(n,{instructions:c.trim()||void 0,tone:(t===`comment`||t===`assessment`)&&u?u:void 0,density:m?f:void 0,language:t===`comment`||t===`assessment`?r:void 0,sourceLanguage:i}),l(``),d(``)},[t,c,u,m,f,r,i,e]),_=(0,y.useCallback)(()=>{e?.client.mark.dismissProgress()},[e]);return(0,I.jsx)(YH,{assistType:t,title:o(t===`highlight`?`annotateHighlights`:t===`assessment`?`annotateAssessments`:`annotateComments`),isAssisting:n,progress:a,progressProps:{onDismiss:_,translations:{cancel:o(`cancel`),inProgress:o(`annotating`),close:s(`close`),message:_J(s),subject:yJ(s),paramLabel:xJ(s)}},form:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label`,children:[o(`instructions`),` `,o(`optional`)]}),(0,I.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),className:`semiont-textarea`,rows:3,placeholder:o(`instructionsPlaceholder`),maxLength:500}),(0,I.jsxs)(`div`,{className:`semiont-form-field__char-count`,children:[c.length,`/500`]})]}),(t===`comment`||t===`assessment`)&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label`,children:[o(`toneLabel`),` `,o(`toneOptional`)]}),(0,I.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:``,children:`Default`}),t===`comment`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`option`,{value:`scholarly`,children:o(`toneScholarly`)}),(0,I.jsx)(`option`,{value:`explanatory`,children:o(`toneExplanatory`)}),(0,I.jsx)(`option`,{value:`conversational`,children:o(`toneConversational`)}),(0,I.jsx)(`option`,{value:`technical`,children:o(`toneTechnical`)})]}),t===`assessment`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`option`,{value:`analytical`,children:o(`toneAnalytical`)}),(0,I.jsx)(`option`,{value:`critical`,children:o(`toneCritical`)}),(0,I.jsx)(`option`,{value:`balanced`,children:o(`toneBalanced`)}),(0,I.jsx)(`option`,{value:`constructive`,children:o(`toneConstructive`)})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`div`,{className:`semiont-form-field__header`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label semiont-form-field__label--with-checkbox`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`semiont-checkbox`,"data-variant":t}),(0,I.jsx)(`span`,{children:o(`densityLabel`)})]}),m&&(0,I.jsx)(`span`,{className:`semiont-form-field__info`,children:o(`densityPerWords`,{density:f})})]}),m&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`input`,{type:`range`,min:t===`comment`?`2`:`1`,max:t===`comment`?`12`:t===`assessment`?`10`:`15`,value:f,onChange:e=>p(Number(e.target.value)),className:`semiont-slider`}),(0,I.jsxs)(`div`,{className:`semiont-slider__labels`,children:[(0,I.jsx)(`span`,{children:o(`densitySparse`)}),(0,I.jsx)(`span`,{children:o(`densityDense`)})]})]})]}),(0,I.jsxs)(`button`,{onClick:g,className:`semiont-button`,"data-variant":`assist`,"data-type":t,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:o(`annotate`)})]})]})})}function wJ({count:e,title:t}){return(0,I.jsx)(`div`,{className:`semiont-panel-header`,children:(0,I.jsxs)(`h2`,{className:`semiont-panel-header__title`,children:[(0,I.jsx)(`span`,{className:`semiont-panel-header__text`,children:t}),(0,I.jsxs)(`span`,{className:`semiont-panel-header__count`,children:[`(`,e,`)`]})]})})}function TJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function EJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,isAssisting:i=!1,progress:a,locale:o,sourceLanguage:s,annotateMode:c=!0,scrollToAnnotationId:l,onScrollCompleted:u,hoveredAnnotationId:d}){let f=Em(`AssessmentPanel`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),_=(0,y.useRef)(null),v=(0,y.useRef)(new Map),b=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),x=(0,y.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!l)return;let e=v.current.get(l);if(e&&_.current){let t=e.offsetTop,n=_.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;_.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),u&&u()}},[l]),(0,y.useEffect)(()=>{if(!d)return;let e=v.current.get(d);if(!e||!_.current)return;let t=_.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[d]),(0,y.useEffect)(()=>{if(!r)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),m(``))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[r,e]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{g(e),setTimeout(()=>g(null),3e3)},[])}),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`assessment`,count:n.length,title:f(`title`)}),r&&r.motivation===`assessing`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`assessment`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=TJ(r.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()}),(0,I.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),className:`semiont-textarea`,rows:3,placeholder:f(`assessmentPlaceholder`),autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-prompt__char-count`,children:[p.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),m(``)},className:`semiont-button semiont-button--secondary`,"data-type":`assessment`,children:f(`cancel`)}),(0,I.jsx)(`button`,{onClick:()=>{if(r){let n=p.trim(),i=n?{type:`TextualBody`,value:n,purpose:`assessing`}:void 0;e?.client.mark.submit({source:t,motivation:`assessing`,selector:r.selector,...i===void 0?{}:{body:i}}),m(``)}},className:`semiont-button semiont-button--primary`,"data-type":`assessment`,children:f(`save`)})]})]})]}),(0,I.jsxs)(`div`,{ref:_,className:`semiont-panel__content`,children:[c&&(0,I.jsx)(CJ,{session:e,annotationType:`assessment`,isAssisting:i,locale:o,sourceLanguage:s,progress:a}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:b.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noAssessments`)}):b.map(t=>(0,I.jsx)(gJ,{session:e,assessment:t,isFocused:t.id===h,isHovered:t.id===d,ref:e=>x(t.id,e)},t.id))})]})]})}function DJ(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}if(e>=1e3){let t=e/1e3;return`${Number.isInteger(t)?t:t.toFixed(1)}K`}return String(e)}function OJ({state:e,eventCount:t,lastEventTimestamp:n,knowledgeBaseName:r,collaborators:i}){let a=Em(`CollaborationPanel`),o=(i??[]).filter(e=>e.agent[`@type`]===`Software`),s=e===`open`||e===`reconnecting`||e===`initial`||e===`connecting`,c;if(!n)c=a(`noActivity`);else{let e=new Date,t=new Date(n),r=e.getTime()-t.getTime(),i=Math.floor(r/1e3),o=Math.floor(i/60),s=Math.floor(o/60);c=i<10?a(`justNow`):i<60?a(`secondsAgo`,{count:i}):o===1?a(`minuteAgo`):o<60?a(`minutesAgo`,{count:o}):s===1?a(`hourAgo`):s<24?a(`hoursAgo`,{count:s}):t.toLocaleDateString()}return(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__title`,children:a(`title`)}),r&&(0,I.jsx)(`div`,{style:{padding:`0 0.75rem 0.5rem`,fontSize:`0.8rem`,color:`var(--semiont-color-neutral-400)`},children:r}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`connectionStatus`)}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__status`,children:[(0,I.jsxs)(`span`,{className:`semiont-collaboration-panel__indicator`,children:[(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__dot`,"data-connected":s?`true`:`false`}),(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__status-text`,"data-connected":s?`true`:`false`,children:a(s?`live`:`disconnected`)})]}),s&&t>0&&(0,I.jsxs)(`span`,{className:`semiont-collaboration-panel__event-count`,children:[`(`,a(`events`,{count:t}),`)`]})]}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__details`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__label`,children:a(`lastSync`)}),` `,c]}),(0,I.jsx)(`div`,{children:a(s?`realtimeActive`:`reconnecting`)})]})]}),o.length>0&&(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section semiont-collaboration-panel__section--bordered`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`collaborators`)}),o.map((e,t)=>{let n=e.agent,r=e.limits,i=r?r.maxOutputTokens===r.contextTokens?a(`sharedWindow`,{contextTokens:DJ(r.contextTokens)}):a(`ceilings`,{contextTokens:DJ(r.contextTokens),maxOutputTokens:DJ(r.maxOutputTokens)}):null;return(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__collaborator`,"data-testid":`semiont-collaborator-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__collaborator-id`,children:[n.provider&&(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__collaborator-provider`,children:n.provider}),(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__collaborator-model`,children:n.model??n.name})]}),e.servesJobTypes&&e.servesJobTypes.length>0&&(0,I.jsx)(`div`,{className:`semiont-collaboration-panel__collaborator-jobs`,children:e.servesJobTypes.join(`, `)}),i&&(0,I.jsx)(`div`,{className:`semiont-collaboration-panel__collaborator-limits`,children:i})]},n[`@id`]??`${n.provider}:${n.model}:${t}`)})]}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section semiont-collaboration-panel__section--bordered`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`sharing`)}),(0,I.jsx)(`p`,{className:`semiont-collaboration-panel__description`,children:a(`collaborationComingSoon`)})]})]})}function kJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function AJ({session:e,comment:t,isFocused:n,isHovered:r=!1,annotateMode:i=!0,ref:a}){let o=Em(`CommentsPanel`),s=tF(e,t.id),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),f=(0,y.useRef)(null);(0,y.useImperativeHandle)(a,()=>f.current);let p=kr(t)||``,m=Mr(t);(0,y.useEffect)(()=>{n&&f.current&&f.current.scrollIntoView({behavior:`smooth`,block:`center`})},[n]);let h=()=>{d(p),l(!0)},g=()=>{l(!1)},_=()=>{l(!1),d(``)};return(0,I.jsxs)(`div`,{ref:f,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`comment`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...s,children:[m&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`comment`,children:[`"`,m.substring(0,100),m.length>100?`...`:``,`"`]}),c?(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__edit`,onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),className:`semiont-textarea`,rows:3,autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__edit-footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-entry__char-count`,children:[u.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__button-group`,children:[(0,I.jsx)(`button`,{onClick:g,className:`semiont-button semiont-button--primary`,"data-type":`comment`,children:o(`save`)}),(0,I.jsx)(`button`,{onClick:_,className:`semiont-button semiont-button--secondary`,children:o(`cancel`)})]})]})]}):(0,I.jsx)(`div`,{className:`semiont-annotation-entry__body`,children:p}),!c&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__footer`,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,kJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]}),i&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__actions`,onClick:e=>e.stopPropagation(),children:(0,I.jsx)(`button`,{onClick:h,className:`semiont-text-button`,"data-variant":`comment`,children:o(`edit`)})})]})]})}function jJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function MJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,annotateMode:i=!0,isAssisting:a=!1,progress:o,locale:s,sourceLanguage:c,scrollToAnnotationId:l,onScrollCompleted:u,hoveredAnnotationId:d}){let f=Em(`CommentsPanel`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),_=(0,y.useRef)(null),v=(0,y.useRef)(new Map),b=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),x=(0,y.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!l)return;let e=v.current.get(l);if(e&&_.current){let t=e.offsetTop,n=_.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;_.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),u&&u()}},[l]),(0,y.useEffect)(()=>{if(!d)return;let e=v.current.get(d);if(!e||!_.current)return;let t=_.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[d]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{g(e),setTimeout(()=>g(null),3e3)},[])}),(0,y.useEffect)(()=>{if(!r)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),m(``))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[r,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`comment`,count:n.length,title:f(`title`)}),r&&r.motivation===`commenting`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`comment`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=jJ(r.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()}),(0,I.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),className:`semiont-textarea`,rows:3,placeholder:f(`commentPlaceholder`),autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-prompt__char-count`,children:[p.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),m(``)},className:`semiont-button semiont-button--secondary`,"data-type":`comment`,children:f(`cancel`)}),(0,I.jsx)(`button`,{onClick:()=>{p.trim()&&r&&(e?.client.mark.submit({source:t,motivation:`commenting`,selector:r.selector,body:[{type:`TextualBody`,value:p,purpose:`commenting`}]}),m(``))},disabled:!p.trim(),className:`semiont-button semiont-button--primary`,"data-type":`comment`,children:f(`save`)})]})]})]}),(0,I.jsxs)(`div`,{ref:_,className:`semiont-panel__content`,children:[i&&(0,I.jsx)(CJ,{session:e,annotationType:`comment`,isAssisting:a,locale:s,sourceLanguage:c,progress:o}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:b.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noComments`)}):b.map(t=>(0,I.jsx)(AJ,{session:e,comment:t,isFocused:t.id===h,isHovered:t.id===d,annotateMode:i,ref:e=>x(t.id,e)},t.id))})]})]})}function NJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function PJ({session:e,highlight:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t);return(0,I.jsxs)(`div`,{ref:i,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`highlight`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...a,children:[o&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`highlight`,children:[`"`,o.substring(0,200),o.length>200?`...`:``,`"`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,NJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function FJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,isAssisting:i=!1,progress:a,annotateMode:o=!0,scrollToAnnotationId:s,onScrollCompleted:c,hoveredAnnotationId:l,sourceLanguage:u}){let d=Em(`HighlightPanel`),[f,p]=(0,y.useState)(null),m=(0,y.useRef)(null),h=(0,y.useRef)(new Map),g=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),_=(0,y.useCallback)((e,t)=>{t?h.current.set(e,t):h.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!s)return;let e=h.current.get(s);if(e&&m.current){let t=e.offsetTop,n=m.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;m.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),c&&c()}},[s]),(0,y.useEffect)(()=>{if(!l)return;let e=h.current.get(l);if(!e||!m.current)return;let t=m.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[l]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{p(e),setTimeout(()=>p(null),3e3)},[])}),(0,y.useEffect)(()=>{r&&r.motivation===`highlighting`&&e?.client.mark.submit({source:t,motivation:`highlighting`,selector:r.selector})},[r,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`highlight`,count:n.length,title:d(`title`)}),(0,I.jsxs)(`div`,{ref:m,className:`semiont-panel__content`,children:[o&&(0,I.jsx)(CJ,{session:e,annotationType:`highlight`,isAssisting:i,progress:a,sourceLanguage:u}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:g.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:d(`noHighlights`)}):g.map(t=>(0,I.jsx)(PJ,{session:e,highlight:t,isFocused:t.id===f,isHovered:t.id===l,ref:e=>_(t.id,e)},t.id))})]})]})}function IJ(e){let t=Z(Up().activeSession$)?.client,[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!t||!e){a(!1);return}let n=!1;return a(!0),s(null),t.browse.resourceGraph(e).then(e=>{n||(r(e),a(!1))}).catch(e=>{n||(s(e instanceof Error?e:Error(String(e))),a(!1))}),()=>{n=!0}},[t,e]),{graph:n,loading:i,error:o}}function LJ({resourceId:e}){let t=(0,y.useRef)(null),n=(0,y.useRef)(null),{showLineNumbers:r}=zp(),{graph:i,loading:a,error:o}=IJ(e),s=i?JSON.stringify(i,null,2):``;return(0,y.useEffect)(()=>{if(!t.current||!s)return;let e=document.documentElement?.classList.contains(`dark`)??!1,i=[cU(),q.editable.of(!1),nE.readOnly.of(!0)];r&&i.push(_M()),e?i.push(TU):(i.push(AP),i.push(yP(jP)));let a=new q({state:nE.create({doc:s,extensions:i}),parent:t.current});return n.current=a,()=>{a.destroy(),n.current=null}},[s,r]),(0,I.jsxs)(`div`,{className:`semiont-jsonld-panel`,children:[(0,I.jsxs)(`div`,{className:`semiont-jsonld-panel__header`,children:[(0,I.jsx)(`h3`,{className:`semiont-jsonld-panel__title`,children:`JSON-LD`}),(0,I.jsx)(`button`,{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s)}catch(e){console.error(`Failed to copy JSON-LD:`,e)}},className:`semiont-button semiont-button--icon`,title:`Copy to clipboard`,disabled:!i,children:`📋 Copy`})]}),a&&(0,I.jsx)(`p`,{className:`semiont-jsonld-panel__status`,role:`status`,children:`Loading JSON-LD…`}),o&&!a&&(0,I.jsx)(`p`,{className:`semiont-jsonld-panel__status semiont-jsonld-panel__status--error`,role:`alert`,children:`Failed to load JSON-LD.`}),(0,I.jsx)(`div`,{ref:t,className:`semiont-jsonld-panel__editor`})]})}function RJ(e){if(Array.isArray(e.body)){let t=[];for(let n of e.body)if(typeof n==`object`&&n&&`type`in n&&`value`in n&&`purpose`in n){let e=n.type,r=n.value,i=n.purpose;e===`TextualBody`&&i===`tagging`&&typeof r==`string`&&r.length>0&&t.push(r)}return t}return[]}function zJ(e){return e.motivation===`tagging`}function BJ(e){if(!zJ(e))return;let t=(Array.isArray(e.body)?e.body:[e.body]).find(e=>typeof e==`object`&&!!e&&`purpose`in e&&e.purpose===`tagging`);if(t&&`value`in t)return t.value}function VJ(e){if(!zJ(e))return;let t=(Array.isArray(e.body)?e.body:[e.body]).find(e=>typeof e==`object`&&!!e&&`purpose`in e&&e.purpose===`classifying`);if(t&&`value`in t)return t.value}function HJ({session:e,reference:t,isFocused:n,isHovered:r=!1,onOpenResource:i,annotateMode:a=!0,isGenerating:o=!1,sparkle:s=!1,ref:c}){let l=Em(`ReferencesPanel`),u=e?.client,d=tF(e,t.id),f=Mr(t)||``,p=Sr(t.body),m=p?xr(t.body):null,h=RJ(t),g=Cr(t.target),_=br(g),v=yr(g),y=_?`Fragment annotation`:v?`Image annotation`:`Annotation`,b=t,x=b._resolvedDocumentName,S=b._resolvedDocumentMediaType,C=KP(S),w=()=>{m&&i?.(m)},T=typeof t.target==`object`&&`source`in t.target?t.target.source:``,E=()=>{T&&m&&u&&u.bind.body(ur(T),t.id,[{op:`remove`,item:{type:`SpecificResource`,source:m,purpose:`linking`}}]).catch(e=>{u.bind.reportBodyError({resourceId:T,message:e instanceof Error?e.message:String(e)})})},D=()=>{e?.client.bind.initiate({annotationId:t.id,resourceId:ur(T),defaultTitle:f,entityTypes:h})},O=e=>{e.stopPropagation(),p?w():a&&D()},k=p||a;return(0,I.jsxs)(`div`,{ref:c,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`reference`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...d,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__header`,children:[(0,I.jsxs)(`div`,{className:`semiont-reference-icon-group`,children:[(0,I.jsx)(`button`,{className:`semiont-reference-icon${k?` semiont-reference-icon--clickable`:``}${s?` annotation-sparkle`:``}`,title:l(p?`open`:a?`resolve`:`stub`),onClick:k?O:void 0,"data-generating":!p&&o?`true`:`false`,tabIndex:k?0:-1,children:p?`🔗`:`❓`}),a&&p&&(0,I.jsx)(`button`,{className:`semiont-reference-unlink`,title:l(`unlink`),onClick:e=>{e.stopPropagation(),E()},children:`⛓️‍💥`})]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__content`,children:[f&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`reference`,children:[`"`,f.substring(0,100),f.length>100?`...`:``,`"`]}),!f&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__meta`,children:!g&&x?l(`derived`):y}),x&&(0,I.jsx)(`div`,{className:`semiont-reference-link`,children:(0,I.jsxs)(`span`,{children:[`→ `,C,` `,x]})})]})]}),h.length>0&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__tags`,children:h.map((e,t)=>(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:e},t))}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function UJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function WJ({session:e,onOpenResource:t,resourceId:n,annotations:r=[],isAssisting:i,progress:a,annotateMode:o=!0,Link:s,routes:c,allEntityTypes:l,entityTypesError:u=null,generatingReferenceId:d,referencedBy:f=[],referencedByLoading:p=!1,referencedByError:m=null,onRetryReferencedBy:h,pendingAnnotation:g,scrollToAnnotationId:_,onScrollCompleted:v,hoveredAnnotationId:b,sparkleAnnotationIds:x,locale:S,sourceLanguage:C}){let w=Em(`ReferencesPanel`),T=Em(`AssistProgress`),[E,D]=(0,y.useState)([]),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)([]),[ee,M]=(0,y.useState)(!1),[N,te]=(0,y.useState)(null),ne=(0,y.useRef)(null),re=(0,y.useRef)(new Map),ie=(0,y.useMemo)(()=>[...r].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[r]),ae=(0,y.useCallback)((e,t)=>{t?re.current.set(e,t):re.current.delete(e)},[]);(0,y.useEffect)(()=>{if(!_)return;let e=re.current.get(_);if(e&&ne.current){let t=e.offsetTop,n=ne.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;ne.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),v&&v()}else console.warn(`[ReferencesPanel] Element not found for scrollToAnnotationId:`,_)},[_]),(0,y.useEffect)(()=>{if(!b)return;let e=re.current.get(b);if(!e||!ne.current)return;let t=ne.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[b]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{te(e),setTimeout(()=>te(null),3e3)},[])});let oe=()=>{k(null),e?.client.mark.requestAssist(`linking`,{entityTypes:E,includeDescriptiveReferences:ee,language:S,sourceLanguage:C})},se=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(i){se.current=!1;return}!se.current&&a?.completedItems&&(se.current=!0,k(a.completedItems),D([]))},[i,a?.completedItems]);let ce=e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,y.useEffect)(()=>{if(!g)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),j([]))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[g,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`reference`,count:r.length,title:w(`title`)}),g&&g.motivation===`linking`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`reference`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=UJ(g.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:w(`fragmentSelected`)})()}),l.length>0&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`p`,{className:`semiont-form-field__label`,children:w(`entityTypesOptional`)}),(0,I.jsx)(`div`,{className:`semiont-tag-selector`,children:l.map(e=>(0,I.jsx)(`button`,{onClick:()=>ce(e),className:`semiont-tag-selector__item`,"data-selected":A.includes(e)?`true`:`false`,children:e},e))})]}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__footer`,children:(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),j([])},className:`semiont-button semiont-button--secondary`,"data-type":`reference`,children:w(`cancel`)}),(0,I.jsxs)(`button`,{onClick:()=>{if(g){let t=A.join(`,`)||void 0;e?.client.mark.submit({source:n,motivation:`linking`,selector:g.selector,...t?{body:[{type:`TextualBody`,value:t,purpose:`tagging`}]}:{}}),j([])}},className:`semiont-button semiont-button--primary`,"data-type":`reference`,children:[`🔗 `,w(`createReference`)]})]})})]}),(0,I.jsxs)(`div`,{ref:ne,className:`semiont-panel__content`,children:[o&&(0,I.jsx)(YH,{assistType:`reference`,title:w(`annotateReferences`),isAssisting:i,progress:a,progressProps:{onCancel:()=>e?.client.job.cancelRequest(`annotation`),onDismiss:()=>e?.client.mark.dismissProgress(),translations:SJ(T,{found:e=>w(`found`,{count:e})})},form:(0,I.jsxs)(I.Fragment,{children:[O&&(0,I.jsx)(qH,{entries:O,formatFound:e=>w(`found`,{count:e})}),(0,I.jsxs)(`div`,{className:`semiont-assist-widget__entity-types`,children:[(0,I.jsx)(`p`,{className:`semiont-assist-widget__label`,children:w(`selectEntityTypes`)}),(0,I.jsx)(`div`,{className:`semiont-assist-widget__chips`,children:l.length>0?l.map(e=>(0,I.jsx)(`button`,{onClick:()=>{D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},"aria-pressed":E.includes(e),"aria-label":`${E.includes(e)?w(`deselect`):w(`select`)} ${e}`,className:`semiont-chip semiont-chip--selectable`,"data-selected":E.includes(e),children:e},e)):(0,I.jsx)(`p`,{className:`semiont-assist-widget__no-types`,children:w(u?`entityTypesFailed`:`noEntityTypes`)})})]}),E.length>0&&(0,I.jsx)(`p`,{className:`semiont-assist-widget__count`,children:w(`typesSelected`,{count:E.length})}),(0,I.jsxs)(`div`,{className:`semiont-assist-widget__checkbox-group`,children:[(0,I.jsxs)(`label`,{className:`semiont-assist-widget__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:e=>M(e.target.checked),className:`semiont-assist-widget__checkbox`}),(0,I.jsx)(`span`,{children:w(`includeDescriptiveReferences`)})]}),(0,I.jsx)(`p`,{className:`semiont-assist-widget__checkbox-hint`,children:w(`descriptiveReferencesTooltip`)})]}),(0,I.jsxs)(`button`,{onClick:oe,disabled:E.length===0,title:w(`annotate`),className:`semiont-button`,"data-variant":`assist`,"data-type":`reference`,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:w(`annotate`)})]})]})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-panel__divider`,children:(0,I.jsxs)(`h3`,{className:`semiont-panel__subtitle`,children:[w(`outgoingReferences`),` (`,ie.length,`)`]})}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:ie.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty-message`,children:w(`noReferences`)}):ie.map(n=>(0,I.jsx)(HJ,{session:e,reference:n,isFocused:n.id===N,isHovered:n.id===b,onOpenResource:t,annotateMode:o,isGenerating:n.id===d,sparkle:x?.has(n.id)??!1,ref:e=>ae(n.id,e)},n.id))})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-panel__divider`,children:(0,I.jsxs)(`h3`,{className:`semiont-panel__subtitle`,children:[w(`incomingReferences`),` (`,f.length,`)`,p&&!m&&(0,I.jsxs)(`span`,{className:`semiont-panel__loading-indicator`,children:[`(`,w(`loading`),`)`]})]})}),m?(0,I.jsxs)(`p`,{className:`semiont-panel__empty-message semiont-panel__empty-message--small`,children:[w(`incomingReferencesFailed`),h&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:h,className:`semiont-panel__inline-action`,children:w(`retry`)})]})]}):f.length>0?(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:f.map(e=>{let t=e.target.source;return(0,I.jsxs)(`div`,{className:`semiont-reference-item semiont-reference-item--incoming`,children:[(0,I.jsxs)(`div`,{className:`semiont-reference-item__header`,children:[(0,I.jsx)(`span`,{className:`semiont-reference-item__title`,children:e.resourceName||w(`untitledResource`)}),(0,I.jsx)(s,{href:c.resourceDetail(t),className:`semiont-reference-item__link`,title:w(`open`),children:`🔗`})]}),(0,I.jsxs)(`span`,{className:`semiont-reference-item__excerpt`,children:[`"`,e.target.selector?.exact||w(`noText`),`"`]})]},e.id)})}):(0,I.jsx)(`p`,{className:`semiont-panel__empty-message semiont-panel__empty-message--small`,children:w(p?`loadingEllipsis`:`noIncomingReferences`)})]})]})]})}function GJ({session:e,resourceId:t,documentEntityTypes:n,documentLocale:r,primaryMediaType:i,primaryByteSize:a,storageUri:o,isArchived:s=!1,dateCreated:c,dateModified:l,wasAttributedTo:u,wasDerivedFrom:d,generator:f,onGenerate:p,isGenerating:m=!1,generationProgress:h=null,generationOutcome:g=null,onDismissProgress:_}){let v=Em(`ResourceInfoPanel`),y=Em(`AssistProgress`),b=u?Array.isArray(u)?u:[u]:f?Array.isArray(f)?f:[f]:[];return(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__title`,children:v(`title`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`locale`)}),r?(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__value`,children:ai(r)}):(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__value semiont-resource-info-panel__value--empty`,children:v(`notSpecified`)})]}),(i||a!==void 0)&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`representation`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__field-group`,children:[i&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`mediaType`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:i})]}),a!==void 0&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`byteSize`)}),(0,I.jsxs)(`span`,{className:`semiont-resource-info-panel__value`,children:[a.toLocaleString(),` bytes`]})]}),o&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`storageUri`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:o})]})]})]}),(c||l||b.length>0||d)&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`provenance`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__field-group`,children:[c&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`createdAt`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:new Date(c).toLocaleString()})]}),l&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`modifiedAt`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:new Date(l).toLocaleString()})]}),b.length>0&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`attributedTo`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:b.map(fJ).join(`, `)})]}),d&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`derivedFrom`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:(Array.isArray(d)?d:[d]).map((t,n)=>(0,I.jsx)(KJ,{session:e,id:t,first:n===0},t))})]})]})]}),n.length>0&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`entityTypeTags`)}),(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__tag-list`,children:n.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:e},e))})]}),p&&(0,I.jsx)(YH,{assistType:`generation`,title:v(`generate`),isAssisting:m,progress:h,progressProps:{onCancel:()=>e?.client.job.cancelRequest(`generation`),..._?{onDismiss:_}:{},...g?{outcome:{label:g.resourceName,onOpen:()=>e?.client.browse.openResource(g.resourceId)},endedMessage:g.truncated?y(`codeCompleteGeneratedTruncated`):y(`codeCompleteGenerated`)}:{},translations:SJ(y)},form:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:p,className:`semiont-resource-button semiont-resource-button--secondary`,children:[`✨ `,v(`generate`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`generateDescription`)})]})}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__action-section`,children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.yield.clone(),className:`semiont-resource-button semiont-resource-button--secondary`,children:[`🔗 `,v(`clone`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`cloneDescription`)})]}),(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__action-section`,children:s?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.mark.unarchive(ur(t)),className:`semiont-resource-button semiont-resource-button--secondary`,children:[`📤 `,v(`unarchive`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`unarchiveDescription`)})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.mark.archive(ur(t)),className:`semiont-resource-button semiont-resource-button--archive`,children:[`📦 `,v(`archive`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`archiveDescription`)})]})})]})}function KJ({session:e,id:t,first:n}){let r=Z(e?e.client.browse.resource(ur(t)):null),i=r?fc(r)?.name:void 0;return(0,I.jsxs)(`button`,{className:`semiont-resource-info-panel__link`,onClick:()=>e?.client.browse.openResource(ur(t)),children:[!n&&`, `,i??t]})}function qJ({highlights:e,comments:t,assessments:n,references:r,tags:i}){let a=Em(`StatisticsPanel`),o=r.filter(e=>!Sr(e.body)).length,s=r.filter(e=>Sr(e.body)).length,c=new Map;r.forEach(e=>{RJ(e).forEach(e=>{c.set(e,(c.get(e)||0)+1)})});let l=Array.from(c.entries()).sort((e,t)=>t[1]-e[1]);return(0,I.jsx)(`div`,{className:`semiont-statistics-panel`,children:(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__content`,children:[(0,I.jsx)(`h2`,{className:`semiont-statistics-panel__title`,children:a(`title`)}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__list`,children:[(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`highlights`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:e.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`comments`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:t.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`assessments`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:n.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`tags`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:i.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`references`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:r.length}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitems`,children:[(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitem`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__sublabel`,children:a(`stub`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__subvalue`,children:o})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitem`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__sublabel`,children:a(`resolved`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__subvalue`,children:s})]})]})]}),l.length>0&&(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__entity-types`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`entityTypes`)}),(0,I.jsx)(`div`,{className:`semiont-statistics-panel__entity-list`,children:l.map(([e,t])=>(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__entity-item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__entity-name`,children:e}),(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:t})]},e))})]})]})]})})}function JJ({session:e,tag:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t),s=BJ(t),c=VJ(t),l=Z((0,y.useMemo)(()=>e?.client.browse.tagSchemas()??null,[e])),u=c&&l&&dc(l)?l.value.find(e=>e.id===c)??null:null;return(0,I.jsxs)(`div`,{ref:i,onClick:()=>{e?.client.browse.click(t.id)},...a,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`tag`,"data-focused":n?`true`:`false`,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__header`,children:[(0,I.jsx)(`span`,{className:`semiont-tag-badge`,"data-variant":`tag`,children:s}),u&&(0,I.jsx)(`span`,{className:`semiont-annotation-entry__meta`,children:u.name})]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`tag`,children:[`"`,o.substring(0,150),o.length>150?`...`:``,`"`]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function YJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function XJ({session:e,resourceId:t,annotations:n,annotateMode:r=!0,isAssisting:i=!1,progress:a,pendingAnnotation:o,scrollToAnnotationId:s,onScrollCompleted:c,hoveredAnnotationId:l,locale:u,sourceLanguage:d}){let f=Em(`TaggingPanel`),p=Em(`AssistProgress`),m=(0,y.useCallback)(()=>{e?.client.mark.dismissProgress()},[e]),h=Z((0,y.useMemo)(()=>e?.client.browse.tagSchemas()??null,[e])),g=h&&dc(h)?h.value:void 0,_=g??[],v=g!==void 0&&g.length===0,[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(new Set);(0,y.useEffect)(()=>{!b&&_.length>0&&x(_[0].id)},[_,b]);let[w,T]=(0,y.useState)(null),E=(0,y.useRef)(null);hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{T(e),setTimeout(()=>T(null),3e3)},[])});let D=(0,y.useRef)(new Map),O=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),k=(0,y.useCallback)((e,t)=>{t?D.current.set(e,t):D.current.delete(e)},[]);(0,y.useEffect)(()=>{if(!s)return;let e=D.current.get(s);if(e&&E.current){let t=e.offsetTop,n=E.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;E.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),c&&c()}},[s]),(0,y.useEffect)(()=>{if(!l)return;let e=D.current.get(l);if(!e||!E.current)return;let t=E.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[l]);let A=_.find(e=>e.id===b),j=e=>{x(e),C(new Set)},ee=e=>{let t=new Set(S);t.has(e)?t.delete(e):t.add(e),C(t)};return(0,y.useEffect)(()=>{if(!o)return;let t=t=>{t.key===`Escape`&&e?.client.mark.cancelPending()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[o,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`tag`,count:n.length,title:f(`title`)}),(0,I.jsxs)(`div`,{ref:E,className:`semiont-panel__content`,children:[o&&o.motivation===`tagging`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`tag`,children:[(0,I.jsx)(`h3`,{className:`semiont-annotation-prompt__title`,children:f(`createTagForSelection`)}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(0,I.jsx)(`p`,{className:`semiont-annotation-prompt__text`,children:(()=>{let e=YJ(o.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()})}),v&&(0,I.jsx)(`p`,{className:`semiont-form__help`,"data-type":`tag-no-schemas`,children:f(`noSchemas`)}),!v&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectSchema`)}),(0,I.jsx)(`select`,{value:b,onChange:e=>j(e.target.value),className:`semiont-select`,children:_.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),A&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectCategory`)}),(0,I.jsxs)(`select`,{className:`semiont-select`,onChange:n=>{n.target.value&&o&&e?.client.mark.submit({source:t,motivation:`tagging`,selector:o.selector,body:[{type:`TextualBody`,value:n.target.value,purpose:`tagging`},{type:`TextualBody`,value:b,purpose:`classifying`}]})},defaultValue:``,children:[(0,I.jsx)(`option`,{value:``,children:f(`chooseCategory`)}),A.tags.map(e=>(0,I.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__footer`,children:(0,I.jsx)(`button`,{onClick:()=>e?.client.mark.cancelPending(),className:`semiont-button semiont-button--secondary`,"data-type":`tag`,children:f(`cancel`)})})]}),r&&(0,I.jsx)(YH,{assistType:`tag`,title:f(`annotateTags`),isAssisting:i,progress:a,progressProps:{onDismiss:m,translations:SJ(p)},form:(0,I.jsxs)(I.Fragment,{children:[v&&(0,I.jsx)(`p`,{className:`semiont-form__help`,"data-type":`tag-no-schemas`,children:f(`noSchemas`)}),!v&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectSchema`)}),(0,I.jsx)(`select`,{value:b,onChange:e=>j(e.target.value),className:`semiont-select`,children:_.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))}),A&&(0,I.jsx)(`p`,{className:`semiont-form__help`,children:A.description})]}),A&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectCategories`)}),(0,I.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginBottom:`0.75rem`},children:[(0,I.jsx)(`button`,{onClick:()=>{A&&C(new Set(A.tags.map(e=>e.name)))},type:`button`,className:`semiont-button--secondary`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.25rem 0.5rem`},children:f(`selectAll`)}),(0,I.jsx)(`button`,{onClick:()=>{C(new Set)},type:`button`,className:`semiont-button--secondary`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.25rem 0.5rem`},children:f(`deselectAll`)})]}),(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.75rem`},children:A.tags.map(e=>(0,I.jsxs)(`div`,{className:`semiont-form__checkbox-field`,children:[(0,I.jsx)(`input`,{type:`checkbox`,id:`category-${e.name.replace(/\s+/g,`-`)}`,checked:S.has(e.name),onChange:()=>ee(e.name),className:`semiont-checkbox`}),(0,I.jsxs)(`label`,{htmlFor:`category-${e.name.replace(/\s+/g,`-`)}`,className:`semiont-form__checkbox-label`,style:{display:`flex`,flexDirection:`column`,gap:`0.25rem`},children:[(0,I.jsx)(`span`,{style:{fontWeight:500},children:e.name}),(0,I.jsx)(`span`,{style:{fontSize:`var(--semiont-text-xs)`,color:`var(--semiont-text-secondary)`},children:e.description})]})]},e.name))}),(0,I.jsx)(`p`,{className:`semiont-form__help`,children:f(`categoriesSelected`,{count:S.size})})]}),(0,I.jsxs)(`button`,{onClick:()=>{S.size>0&&(e?.client.mark.requestAssist(`tagging`,{schemaId:b,categories:Array.from(S),language:u,sourceLanguage:d}),C(new Set))},disabled:S.size===0||i,className:`semiont-button`,"data-variant":`assist`,"data-type":`tag`,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:f(`annotate`)})]})]})}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:O.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noTags`)}):O.map(t=>(0,I.jsx)(JJ,{session:e,tag:t,isFocused:t.id===w,isHovered:t.id===l,ref:e=>k(t.id,e)},t.id))})]})]})}var ZJ=[`statistics`,`reference`,`highlight`,`assessment`,`comment`,`tag`];function QJ(e){let t=Em(`UnifiedAnnotationsPanel`),n={highlight:[],comment:[],assessment:[],reference:[],tag:[]};for(let t of e.annotations){let r=Object.values(e.annotators).find(e=>e.matchesAnnotation(t));r&&(n[r.internalType]||(n[r.internalType]=[]),n[r.internalType].push(t))}let r=n,[i,a]=(0,y.useState)(()=>{if(typeof window>`u`)return e.initialTab||`statistics`;let t=e.resourceId?`annotations-tab-${e.resourceId}`:`annotations-tab-global`,n=localStorage.getItem(t);return n&&ZJ.includes(n)?n:e.initialTab||`statistics`});(0,y.useEffect)(()=>{if(typeof window>`u`)return;let t=e.resourceId?`annotations-tab-${e.resourceId}`:`annotations-tab-global`;localStorage.setItem(t,i)},[i,e.resourceId]),(0,y.useEffect)(()=>{e.initialTab&&e.initialTabGeneration!==void 0&&a(e.initialTab)},[e.initialTabGeneration]),(0,y.useEffect)(()=>{if(e.pendingAnnotation){let t=Tw(e.pendingAnnotation.motivation);t&&a(t)}},[e.pendingAnnotation]);let o=e=>{a(e)},s=e=>`semiont-unified-panel__tab-button${i===e?` semiont-unified-panel__tab-button--active`:``}`;return e.annotationsError?(0,I.jsxs)(`div`,{className:`semiont-unified-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-unified-panel__title`,children:t(`title`)}),(0,I.jsxs)(`p`,{className:`semiont-unified-panel__error`,children:[t(`annotationsFailed`),e.onRetryAnnotations&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:e.onRetryAnnotations,className:`semiont-panel__inline-action`,children:t(`retry`)})]})]})]}):(0,I.jsxs)(`div`,{className:`semiont-unified-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-unified-panel__title`,children:t(`title`)}),(0,I.jsx)(`div`,{className:`semiont-unified-panel__tabs`,children:ZJ.map(n=>{if(n===`statistics`)return(0,I.jsx)(`button`,{onClick:()=>o(n),className:s(n),title:t(n),"aria-pressed":i===n,children:(0,I.jsx)(`span`,{className:`semiont-unified-panel__tab-icon`,children:`📊`})},n);let r=e.annotators[n];return r?(0,I.jsx)(`button`,{onClick:()=>o(n),className:s(n),title:t(n),"aria-pressed":i===n,children:(0,I.jsx)(`span`,{className:`semiont-unified-panel__tab-icon`,children:r.iconEmoji})},n):null})}),(0,I.jsx)(`div`,{className:`semiont-unified-panel__content`,children:(()=>{if(i===`statistics`)return(0,I.jsx)(qJ,{highlights:r.highlight||[],comments:r.comment||[],assessments:r.assessment||[],references:r.reference||[],tags:r.tag||[]});let t=e.annotators[i];if(!t)return null;let n=r[i]||[],a=e.assistingMotivation===t.motivation,o=a?e.progress??null:null,s={session:e.session,resourceId:e.resourceId,annotations:n,pendingAnnotation:e.pendingAnnotation,isAssisting:a,progress:o,annotateMode:e.annotateMode,locale:e.locale,sourceLanguage:e.sourceLanguage,scrollToAnnotationId:e.scrollToAnnotationId,onScrollCompleted:e.onScrollCompleted,hoveredAnnotationId:e.hoveredAnnotationId};return i===`highlight`?(0,I.jsx)(FJ,{...s}):i===`reference`?(0,I.jsx)(WJ,{session:s.session,onOpenResource:e.onOpenResource,resourceId:s.resourceId,annotations:s.annotations,pendingAnnotation:s.pendingAnnotation,isAssisting:s.isAssisting,progress:s.progress,annotateMode:s.annotateMode,scrollToAnnotationId:s.scrollToAnnotationId,onScrollCompleted:s.onScrollCompleted,hoveredAnnotationId:s.hoveredAnnotationId,locale:s.locale,sourceLanguage:s.sourceLanguage,allEntityTypes:e.allEntityTypes||[],entityTypesError:e.entityTypesError,generatingReferenceId:e.generatingReferenceId,referencedBy:e.referencedBy,referencedByLoading:e.referencedByLoading,referencedByError:e.referencedByError,onRetryReferencedBy:e.onRetryReferencedBy,sparkleAnnotationIds:e.sparkleAnnotationIds,Link:e.Link,routes:e.routes}):i===`assessment`?(0,I.jsx)(EJ,{...s}):i===`comment`?(0,I.jsx)(MJ,{...s}):i===`tag`?(0,I.jsx)(XJ,{...s}):null})()})]})}function $J({Link:e,routes:t,t:n,CookiePreferences:r,onOpenKeyboardHelp:i,sourceCodeUrl:a=`https://github.com/The-AI-Alliance/semiont`,showPolicyLinks:o=!0}){let[s,c]=(0,y.useState)(!1);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`footer`,{role:`contentinfo`,className:`semiont-footer`,children:(0,I.jsx)(`div`,{className:`semiont-footer__container`,children:(0,I.jsxs)(`div`,{className:`semiont-footer__content`,children:[(0,I.jsx)(`div`,{className:`semiont-footer__copyright`,children:n(`copyright`,{year:new Date().getFullYear()})}),(0,I.jsxs)(`div`,{className:`semiont-footer__links`,children:[o&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(e,{href:t.about?.()||`/about`,className:`semiont-footer__link`,children:n(`about`)}),(0,I.jsx)(e,{href:t.privacy?.()||`/privacy`,className:`semiont-footer__link`,children:n(`privacyPolicy`)}),r&&(0,I.jsx)(`button`,{onClick:()=>c(!0),className:`semiont-footer__link`,children:n(`cookiePreferences`)}),(0,I.jsx)(e,{href:t.terms?.()||`/terms`,className:`semiont-footer__link`,children:n(`termsOfService`)})]}),i&&(0,I.jsxs)(`button`,{onClick:i,className:`semiont-footer__link semiont-footer__link--keyboard`,children:[n(`keyboardShortcuts`),(0,I.jsx)(`kbd`,{className:`semiont-footer__kbd`,children:`?`})]}),(0,I.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,className:`semiont-footer__link`,children:n(`sourceCode`)})]})]})})}),o&&r&&(0,I.jsx)(r,{isOpen:s,onClose:()=>c(!1)})]})}function eY({Link:e,routes:t,t:n,isAdmin:r=!1,isModerator:i=!1,onItemClick:a,className:o=``,currentPath:s}){let c=o?`semiont-navigation-menu ${o}`:`semiont-navigation-menu`,l=e=>s?s===e||s.startsWith(e+`/`):!1;return(0,I.jsxs)(`nav`,{className:c,"aria-label":`Main navigation`,children:[(0,I.jsx)(e,{href:t.knowledge?.()||`/know`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.knowledge?.()||`/know`)?`page`:void 0,children:n(`know`)}),(i||r)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`hr`,{className:`semiont-navigation-menu__divider`}),(0,I.jsx)(e,{href:t.moderate?.()||`/moderate`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.moderate?.()||`/moderate`)?`page`:void 0,children:n(`moderate`)})]}),r&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`hr`,{className:`semiont-navigation-menu__divider`}),(0,I.jsx)(e,{href:t.admin?.()||`/admin`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.admin?.()||`/admin`)?`page`:void 0,children:n(`administer`)})]})]})}function tY({title:e,items:t,currentPath:n,LinkComponent:r,dropdownContent:i,isCollapsed:a,icons:o,collapseSidebarLabel:s,expandSidebarLabel:c}){let l=o.chevronLeft,u=o.bars,[d,f]=(0,y.useState)(!1),p=(0,y.useRef)(null),m=Up(),h=()=>f(!d),g=()=>f(!1);return(0,y.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&g()};if(d)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,I.jsxs)(`div`,{className:`semiont-simple-nav`,children:[(0,I.jsxs)(`div`,{style:{position:`relative`},ref:i?p:void 0,children:[(0,I.jsxs)(`div`,{className:`semiont-nav-section__header`,children:[i?(0,I.jsx)(`button`,{onClick:h,className:`semiont-nav-section__header-button`,"aria-expanded":d,"aria-haspopup":`true`,type:`button`,children:!a&&(0,I.jsx)(`span`,{className:`semiont-nav-section__header-text`,children:e})}):!a&&(0,I.jsx)(`span`,{className:`semiont-nav-section__header-text`,children:e}),(0,I.jsx)(`button`,{onClick:()=>m.emit(`shell:sidebar-toggle`,void 0),className:`semiont-nav-section__header-icon`,title:a?c:s,"aria-label":a?c:s,type:`button`,children:a?(0,I.jsx)(u,{}):(0,I.jsx)(l,{})})]}),d&&i&&!a&&(0,I.jsx)(`div`,{className:`semiont-nav-section__dropdown`,children:i(g)})]}),!a&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:t.map(e=>{let t=n===e.href;return(0,I.jsxs)(r,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,children:[(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`semiont-nav-tab__text`,children:e.name})]},e.href)})}),a&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:t.map(e=>{let t=n===e.href;return(0,I.jsx)(r,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,"aria-label":e.name,children:(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`})},e.href)})})]})}function nY(){var e=[...arguments];return(0,y.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var rY=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function iY(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function aY(e){return`nodeType`in e}function oY(e){return e?iY(e)?e:aY(e)?e.ownerDocument?.defaultView??window:window:window}function sY(e){let{Document:t}=oY(e);return e instanceof t}function cY(e){return!iY(e)&&e instanceof oY(e).HTMLElement}function lY(e){return e instanceof oY(e).SVGElement}function uY(e){return e?iY(e)?e.document:aY(e)?sY(e)?e:cY(e)||lY(e)?e.ownerDocument:document:document:document}var dY=rY?y.useLayoutEffect:y.useEffect;function fY(e){let t=(0,y.useRef)(e);return dY(()=>{t.current=e}),(0,y.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function pY(){let e=(0,y.useRef)(null);return[(0,y.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,y.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function mY(e,t){t===void 0&&(t=[e]);let n=(0,y.useRef)(e);return dY(()=>{n.current!==e&&(n.current=e)},t),n}function hY(e,t){let n=(0,y.useRef)();return(0,y.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function gY(e){let t=fY(e),n=(0,y.useRef)(null);return[n,(0,y.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function _Y(e){let t=(0,y.useRef)();return(0,y.useEffect)(()=>{t.current=e},[e]),t.current}var vY={};function yY(e,t){return(0,y.useMemo)(()=>{if(t)return t;let n=vY[e]==null?0:vY[e]+1;return vY[e]=n,e+`-`+n},[e,t])}function bY(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var xY=bY(1),SY=bY(-1);function CY(e){return`clientX`in e&&`clientY`in e}function wY(e){if(!e)return!1;let{KeyboardEvent:t}=oY(e.target);return t&&e instanceof t}function TY(e){if(!e)return!1;let{TouchEvent:t}=oY(e.target);return t&&e instanceof t}function EY(e){if(TY(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return CY(e)?{x:e.clientX,y:e.clientY}:null}var DY=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[DY.Translate.toString(e),DY.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),OY=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function kY(e){return e.matches(OY)?e:e.querySelector(OY)}var AY={display:`none`};function jY(e){let{id:t,value:n}=e;return y.createElement(`div`,{id:t,style:AY},n)}function MY(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return y.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function NY(){let[e,t]=(0,y.useState)(``);return{announce:(0,y.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var PY=(0,y.createContext)(null);function FY(e){let t=(0,y.useContext)(PY);(0,y.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function IY(){let[e]=(0,y.useState)(()=>new Set),t=(0,y.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,y.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var LY={draggable:`
134
+ `)),[]});var HG=(e=>(e[e.None=0]=`None`,e[e.Closed=1]=`Closed`,e[e.Enter=2]=`Enter`,e[e.Leave=4]=`Leave`,e))(HG||{});function UG(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]=``);return t}function WG(e,t,n,r){let[i,a]=(0,y.useState)(n),{hasFlag:o,addFlag:s,removeFlag:c}=VG(e&&i?3:0),l=(0,y.useRef)(!1),u=(0,y.useRef)(!1);return RU(()=>{var i;if(e){if(n&&a(!0),!t){n&&s(3);return}return(i=r?.start)==null||i.call(r,n),GG(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(s(3),c(4)):(s(4),c(2)))},run(){u.current?n?(c(3),s(4)):(c(4),s(3)):n?c(1):s(1)},done(){var e;u.current&&JG(t)||(l.current=!1,c(7),n||a(!1),(e=r?.end)==null||e.call(r,n))}})}},[e,n,t,LU()]),e?[i,{closed:o(1),enter:o(2),leave:o(4),transition:o(2)||o(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function GG(e,{prepare:t,run:n,done:r,inFlight:i}){let a=IU();return qG(e,{prepare:t,inFlight:i}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(KG(e,r))})}),a.dispose}function KG(e,t){let n=IU();if(!e)return n.dispose;let r=!1;n.add(()=>{r=!0});let i=e.getAnimations?.call(e).filter(e=>e instanceof CSSTransition)??[];return i.length===0?(t(),n.dispose):(Promise.allSettled(i.map(e=>e.finished)).then(()=>{r||t()}),n.dispose)}function qG(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition=`none`,n(),e.offsetHeight,e.style.transition=r}function JG(e){return(e.getAnimations?.call(e)??[]).some(e=>e instanceof CSSTransition&&e.playState!==`finished`)}function YG(e,t){let n=(0,y.useRef)([]),r=BU(e);(0,y.useEffect)(()=>{let e=[...n.current];for(let[i,a]of t.entries())if(n.current[i]!==a){let i=r(t,e);return n.current=t,i}},[r,...t])}var XG=(0,y.createContext)(null);XG.displayName=`OpenClosedContext`;var ZG=(e=>(e[e.Open=1]=`Open`,e[e.Closed=2]=`Closed`,e[e.Closing=4]=`Closing`,e[e.Opening=8]=`Opening`,e))(ZG||{});function QG(){return(0,y.useContext)(XG)}function $G({value:e,children:t}){return y.createElement(XG.Provider,{value:e},t)}function eK({children:e}){return y.createElement(XG.Provider,{value:null},e)}function tK(e){function t(){document.readyState!==`loading`&&(e(),document.removeEventListener(`DOMContentLoaded`,t))}typeof window<`u`&&typeof document<`u`&&(document.addEventListener(`DOMContentLoaded`,t),t())}var nK=[];tK(()=>{function e(e){if(!mW(e.target)||e.target===document.body||nK[0]===e.target)return;let t=e.target;t=t.closest(cG),nK.unshift(t??e.target),nK=nK.filter(e=>e!=null&&e.isConnected),nK.splice(10)}window.addEventListener(`click`,e,{capture:!0}),window.addEventListener(`mousedown`,e,{capture:!0}),window.addEventListener(`focus`,e,{capture:!0}),document.body.addEventListener(`click`,e,{capture:!0}),document.body.addEventListener(`mousedown`,e,{capture:!0}),document.body.addEventListener(`focus`,e,{capture:!0})});function rK(e){let t=BU(e),n=(0,y.useRef)(!1);(0,y.useEffect)(()=>(n.current=!1,()=>{n.current=!0,FU(()=>{n.current&&t()})}),[t])}function iK(){let e=typeof document>`u`;return`useSyncExternalStore`in y&&(e=>e.useSyncExternalStore)(y)(()=>()=>{},()=>!1,()=>!e)}function aK(){let e=iK(),[t,n]=y.useState(AU.isHandoffComplete);return t&&AU.isHandoffComplete===!1&&n(!1),y.useEffect(()=>{t!==!0&&n(!0)},[t]),y.useEffect(()=>AU.handoff(),[]),!e&&t}var oK=(0,y.createContext)(!1);function sK(){return(0,y.useContext)(oK)}function cK(e){return y.createElement(oK.Provider,{value:e.force},e.children)}function lK(e){let t=sK(),n=(0,y.useContext)(mK),[r,i]=(0,y.useState)(()=>{if(!t&&n!==null)return n.current??null;if(AU.isServer)return null;let r=e?.getElementById(`headlessui-portal-root`);if(r)return r;if(e===null)return null;let i=e.createElement(`div`);return i.setAttribute(`id`,`headlessui-portal-root`),e.body.appendChild(i)});return(0,y.useEffect)(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),(0,y.useEffect)(()=>{t||n!==null&&i(n.current)},[n,i,t]),r}var uK=y.Fragment,dK=eW(function(e,t){let{ownerDocument:n=null,...r}=e,i=(0,y.useRef)(null),a=bW(yW(e=>{i.current=e}),t),o=AG(i.current),s=lK(n??o),c=(0,y.useContext)(gK),l=LU(),u=aK(),d=JU();return rK(()=>{var e;s&&s.childNodes.length<=0&&((e=s.parentElement)==null||e.removeChild(s))}),!s||!u?null:(0,jl.createPortal)(y.createElement(`div`,{"data-headlessui-portal":``,ref:e=>{l.dispose(),c&&e&&l.add(c.register(e))}},d({ourProps:{ref:a},theirProps:r,slot:{},defaultTag:uK,name:`Portal`})),s)});function fK(e,t){let n=bW(t),{enabled:r=!0,ownerDocument:i,...a}=e,o=JU();return r?y.createElement(dK,{...a,ownerDocument:i,ref:n}):o({ourProps:{ref:n},theirProps:a,slot:{},defaultTag:uK,name:`Portal`})}var pK=y.Fragment,mK=(0,y.createContext)(null);function hK(e,t){let{target:n,...r}=e,i={ref:bW(t)},a=JU();return y.createElement(mK.Provider,{value:n},a({ourProps:i,theirProps:r,defaultTag:pK,name:`Popover.Group`}))}var gK=(0,y.createContext)(null);function _K(){let e=(0,y.useContext)(gK),t=(0,y.useRef)([]),n=BU(n=>(t.current.push(n),e&&e.register(n),()=>r(n))),r=BU(n=>{let r=t.current.indexOf(n);r!==-1&&t.current.splice(r,1),e&&e.unregister(n)}),i=(0,y.useMemo)(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,(0,y.useMemo)(()=>function({children:e}){return y.createElement(gK.Provider,{value:i},e)},[i])]}var vK=eW(fK),yK=eW(hK),bK=Object.assign(vK,{Group:yK});function xK(e,t=typeof document<`u`?document.defaultView:null,n){let r=tG(e,`escape`);jG(t,`keydown`,e=>{r&&(e.defaultPrevented||e.key===OW.Escape&&n(e))})}function SK(){let[e]=(0,y.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null),[t,n]=(0,y.useState)(e?.matches??!1);return RU(()=>{if(!e)return;function t(e){n(e.matches)}return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[e]),t}function CK({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=BU(()=>{let r=jU(n),i=[];for(let t of e)t!==null&&(fW(t)?i.push(t):`current`in t&&fW(t.current)&&i.push(t.current));if(t!=null&&t.current)for(let e of t.current)i.push(e);for(let e of r?.querySelectorAll(`html > *, body > *`)??[])e!==document.body&&e!==document.head&&fW(e)&&e.id!==`headlessui-portal-root`&&(n&&(e.contains(n)||e.contains(n?.getRootNode()?.host))||i.some(t=>e.contains(t))||i.push(e));return i});return{resolveContainers:r,contains:BU(e=>r().some(t=>t.contains(e)))}}var wK=(0,y.createContext)(null);function TK({children:e,node:t}){let[n,r]=(0,y.useState)(null),i=EK(t??n);return y.createElement(wK.Provider,{value:i},e,i===null&&y.createElement(uW,{features:cW.Hidden,ref:e=>{if(e){for(let t of jU(e)?.querySelectorAll(`html > *, body > *`)??[])if(t!==document.body&&t!==document.head&&fW(t)&&t!=null&&t.contains(e)){r(t);break}}}}))}function EK(e=null){return(0,y.useContext)(wK)??e}function DK(){let e=(0,y.useRef)(!1);return RU(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var OK=(e=>(e[e.Forwards=0]=`Forwards`,e[e.Backwards=1]=`Backwards`,e))(OK||{});function kK(){let e=(0,y.useRef)(0);return DG(!0,`keydown`,t=>{t.key===`Tab`&&(e.current=+!!t.shiftKey)},!0),e}function AK(e){if(!e)return new Set;if(typeof e==`function`)return new Set(e());let t=new Set;for(let n of e.current)fW(n.current)&&t.add(n.current);return t}var jK=`div`,MK=(e=>(e[e.None=0]=`None`,e[e.InitialFocus=1]=`InitialFocus`,e[e.TabLock=2]=`TabLock`,e[e.FocusLock=4]=`FocusLock`,e[e.RestoreFocus=8]=`RestoreFocus`,e[e.AutoFocus=16]=`AutoFocus`,e))(MK||{});function NK(e,t){let n=(0,y.useRef)(null),r=bW(n,t),{initialFocus:i,initialFocusFallback:a,containers:o,features:s=15,...c}=e;aK()||(s=0);let l=AG(n.current);LK(s,{ownerDocument:l});let u=RK(s,{ownerDocument:l,container:n,initialFocus:i,initialFocusFallback:a});zK(s,{ownerDocument:l,container:n,containers:o,previousActiveElement:u});let d=kK(),f=BU(e=>{if(!pW(n.current))return;let t=n.current;(e=>e())(()=>{GU(d.current,{[OK.Forwards]:()=>{SG(t,uG.First,{skipElements:[e.relatedTarget,a]})},[OK.Backwards]:()=>{SG(t,uG.Last,{skipElements:[e.relatedTarget,a]})}})})}),p=tG(!!(s&2),`focus-trap#tab-lock`),m=LU(),h=(0,y.useRef)(!1),g={ref:r,onKeyDown(e){e.key==`Tab`&&(h.current=!0,m.requestAnimationFrame(()=>{h.current=!1}))},onBlur(e){if(!(s&4))return;let t=AK(o);pW(n.current)&&t.add(n.current);let r=e.relatedTarget;mW(r)&&r.dataset.headlessuiFocusGuard!==`true`&&(BK(t,r)||(h.current?SG(n.current,GU(d.current,{[OK.Forwards]:()=>uG.Next,[OK.Backwards]:()=>uG.Previous})|uG.WrapAround,{relativeTo:e.target}):mW(e.target)&&vG(e.target)))}},_=JU();return y.createElement(y.Fragment,null,p&&y.createElement(uW,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:f,features:cW.Focusable}),_({ourProps:g,theirProps:c,defaultTag:jK,name:`FocusTrap`}),p&&y.createElement(uW,{as:`button`,type:`button`,"data-headlessui-focus-guard":!0,onFocus:f,features:cW.Focusable}))}var PK=eW(NK),FK=Object.assign(PK,{features:MK});function IK(e=!0){let t=(0,y.useRef)(nK.slice());return YG(([e],[n])=>{n===!0&&e===!1&&FU(()=>{t.current.splice(0)}),n===!1&&e===!0&&(t.current=nK.slice())},[e,nK,t]),BU(()=>t.current.find(e=>e!=null&&e.isConnected)??null)}function LK(e,{ownerDocument:t}){let n=!!(e&8),r=IK(n);YG(()=>{n||PU(t?.body)&&vG(r())},[n]),rK(()=>{n&&vG(r())})}function RK(e,{ownerDocument:t,container:n,initialFocus:r,initialFocusFallback:i}){let a=(0,y.useRef)(null),o=tG(!!(e&1),`focus-trap#initial-focus`),s=DK();return YG(()=>{if(e===0)return;if(!o){i!=null&&i.current&&vG(i.current);return}let c=n.current;c&&FU(()=>{if(!s.current)return;let n=t?.activeElement;if(r!=null&&r.current){if(r?.current===n){a.current=n;return}}else if(c.contains(n)){a.current=n;return}if(r!=null&&r.current)vG(r.current);else{if(e&16){if(SG(c,uG.First|uG.AutoFocus)!==dG.Error)return}else if(SG(c,uG.First)!==dG.Error)return;if(i!=null&&i.current&&(vG(i.current),t?.activeElement===i.current))return;console.warn(`There are no focusable elements inside the <FocusTrap />`)}a.current=t?.activeElement})},[i,o,e]),a}function zK(e,{ownerDocument:t,container:n,containers:r,previousActiveElement:i}){let a=DK(),o=!!(e&4);jG(t?.defaultView,`focus`,e=>{if(!o||!a.current)return;let t=AK(r);pW(n.current)&&t.add(n.current);let s=i.current;if(!s)return;let c=e.target;pW(c)?BK(t,c)?(i.current=c,vG(c)):(e.preventDefault(),e.stopPropagation(),vG(s)):vG(i.current)},!0)}function BK(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function VK(e){return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!aW(e.as??YK)||y.Children.count(e.children)===1}var HK=(0,y.createContext)(null);HK.displayName=`TransitionContext`;var UK=(e=>(e.Visible=`visible`,e.Hidden=`hidden`,e))(UK||{});function WK(){let e=(0,y.useContext)(HK);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}function GK(){let e=(0,y.useContext)(KK);if(e===null)throw Error(`A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.`);return e}var KK=(0,y.createContext)(null);KK.displayName=`NestingContext`;function qK(e){return`children`in e?qK(e.children):e.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e===`visible`).length>0}function JK(e,t){let n=zU(e),r=(0,y.useRef)([]),i=DK(),a=LU(),o=BU((e,t=qU.Hidden)=>{let o=r.current.findIndex(({el:t})=>t===e);o!==-1&&(GU(t,{[qU.Unmount](){r.current.splice(o,1)},[qU.Hidden](){r.current[o].state=`hidden`}}),a.microTask(()=>{var e;!qK(r)&&i.current&&((e=n.current)==null||e.call(n))}))}),s=BU(e=>{let t=r.current.find(({el:t})=>t===e);return t?t.state!==`visible`&&(t.state=`visible`):r.current.push({el:e,state:`visible`}),()=>o(e,qU.Unmount)}),c=(0,y.useRef)([]),l=(0,y.useRef)(Promise.resolve()),u=(0,y.useRef)({enter:[],leave:[]}),d=BU((e,n,r)=>{c.current.splice(0),t&&(t.chains.current[n]=t.chains.current[n].filter(([t])=>t!==e)),t?.chains.current[n].push([e,new Promise(e=>{c.current.push(e)})]),t?.chains.current[n].push([e,new Promise(e=>{Promise.all(u.current[n].map(([e,t])=>t)).then(()=>e())})]),n===`enter`?l.current=l.current.then(()=>t?.wait.current).then(()=>r(n)):r(n)}),f=BU((e,t,n)=>{Promise.all(u.current[t].splice(0).map(([e,t])=>t)).then(()=>{var e;(e=c.current.shift())==null||e()}).then(()=>n(t))});return(0,y.useMemo)(()=>({children:r,register:s,unregister:o,onStart:d,onStop:f,wait:l,chains:u}),[s,o,r,d,f,u,l])}var YK=y.Fragment,XK=KU.RenderStrategy;function ZK(e,t){var n;let{transition:r=!0,beforeEnter:i,afterEnter:a,beforeLeave:o,afterLeave:s,enter:c,enterFrom:l,enterTo:u,entered:d,leave:f,leaveFrom:p,leaveTo:m,...h}=e,[g,_]=(0,y.useState)(null),v=(0,y.useRef)(null),b=VK(e),x=bW(...b?[v,t,_]:t===null?[]:[t]),S=(n=h.unmount)==null||n?qU.Unmount:qU.Hidden,{show:C,appear:w,initial:T}=WK(),[E,D]=(0,y.useState)(C?`visible`:`hidden`),O=GK(),{register:k,unregister:A}=O;RU(()=>k(v),[k,v]),RU(()=>{if(S===qU.Hidden&&v.current){if(C&&E!==`visible`){D(`visible`);return}return GU(E,{hidden:()=>A(v),visible:()=>k(v)})}},[E,v,k,A,C,S]);let j=aK();RU(()=>{if(b&&j&&E===`visible`&&v.current===null)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,E,j,b]);let ee=T&&!w,M=w&&C&&T,N=(0,y.useRef)(!1),te=JK(()=>{N.current||(D(`hidden`),A(v))},O),ne=BU(e=>{N.current=!0;let t=e?`enter`:`leave`;te.onStart(v,t,e=>{e===`enter`?i?.():e===`leave`&&o?.()})}),re=BU(e=>{let t=e?`enter`:`leave`;N.current=!1,te.onStop(v,t,e=>{e===`enter`?a?.():e===`leave`&&s?.()}),t===`leave`&&!qK(te)&&(D(`hidden`),A(v))});(0,y.useEffect)(()=>{b&&r||(ne(C),re(C))},[C,b,r]);let[,ie]=WG(!(!r||!b||!j||ee),g,C,{start:ne,end:re}),ae=tW({ref:x,className:WU(h.className,M&&c,M&&l,ie.enter&&c,ie.enter&&ie.closed&&l,ie.enter&&!ie.closed&&u,ie.leave&&f,ie.leave&&!ie.closed&&p,ie.leave&&ie.closed&&m,!ie.transition&&C&&d)?.trim()||void 0,...UG(ie)}),oe=0;E===`visible`&&(oe|=ZG.Open),E===`hidden`&&(oe|=ZG.Closed),C&&E===`hidden`&&(oe|=ZG.Opening),!C&&E===`visible`&&(oe|=ZG.Closing);let se=JU();return y.createElement(KK.Provider,{value:te},y.createElement($G,{value:oe},se({ourProps:ae,theirProps:h,defaultTag:YK,features:XK,visible:E===`visible`,name:`Transition.Child`})))}function QK(e,t){let{show:n,appear:r=!1,unmount:i=!0,...a}=e,o=(0,y.useRef)(null),s=bW(...VK(e)?[o,t]:t===null?[]:[t]);aK();let c=QG();if(n===void 0&&c!==null&&(n=(c&ZG.Open)===ZG.Open),n===void 0)throw Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,u]=(0,y.useState)(n?`visible`:`hidden`),d=JK(()=>{n||u(`hidden`)}),[f,p]=(0,y.useState)(!0),m=(0,y.useRef)([n]);RU(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),p(!1))},[m,n]);let h=(0,y.useMemo)(()=>({show:n,appear:r,initial:f}),[n,r,f]);RU(()=>{n?u(`visible`):!qK(d)&&o.current!==null&&u(`hidden`)},[n,d]);let g={unmount:i},_=BU(()=>{var t;f&&p(!1),(t=e.beforeEnter)==null||t.call(e)}),v=BU(()=>{var t;f&&p(!1),(t=e.beforeLeave)==null||t.call(e)}),b=JU();return y.createElement(KK.Provider,{value:d},y.createElement(HK.Provider,{value:h},b({ourProps:{...g,as:y.Fragment,children:y.createElement(tq,{ref:s,...g,...a,beforeEnter:_,beforeLeave:v})},theirProps:{},defaultTag:y.Fragment,features:XK,visible:l===`visible`,name:`Transition`})))}function $K(e,t){let n=(0,y.useContext)(HK)!==null,r=QG()!==null;return y.createElement(y.Fragment,null,!n&&r?y.createElement(eq,{ref:t,...e}):y.createElement(tq,{ref:t,...e}))}var eq=eW(QK),tq=eW(ZK),nq=eW($K),rq=Object.assign(eq,{Child:nq,Root:eq}),iq=(e=>(e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e))(iq||{}),aq=(e=>(e[e.SetTitleId=0]=`SetTitleId`,e))(aq||{}),oq={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},sq=(0,y.createContext)(null);sq.displayName=`DialogContext`;function cq(e){let t=(0,y.useContext)(sq);if(t===null){let t=Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,cq),t}return t}function lq(e,t){return GU(t.type,oq,e,t)}var uq=eW(function(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-${n}`,open:i,onClose:a,initialFocus:o,role:s=`dialog`,autoFocus:c=!0,__demoMode:l=!1,unmount:u=!1,...d}=e,f=(0,y.useRef)(!1);s=(function(){return s===`dialog`||s===`alertdialog`?s:(f.current||(f.current=!0,console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),`dialog`)})();let p=QG();i===void 0&&p!==null&&(i=(p&ZG.Open)===ZG.Open);let m=(0,y.useRef)(null),h=bW(m,t),g=AG(m.current),_=+!i,[v,b]=(0,y.useReducer)(lq,{titleId:null,descriptionId:null,panelRef:(0,y.createRef)()}),x=BU(()=>a(!1)),S=BU(e=>b({type:0,id:e})),C=aK()?_===0:!1,[w,T]=_K(),E={get current(){return v.panelRef.current??m.current}},D=EK(),{resolveContainers:O}=CK({mainTreeNode:D,portals:w,defaultContainers:[E]}),k=p!==null&&(p&ZG.Closing)===ZG.Closing;oG(l||k?!1:C,{allowed:BU(()=>[m.current?.closest(`[data-headlessui-portal]`)??null]),disallowed:BU(()=>[D?.closest(`body > *:not(#headlessui-portal-root)`)??null])});let A=QW.get(null);RU(()=>{if(C)return A.actions.push(r),()=>A.actions.pop(r)},[A,r,C]);let j=$W(A,(0,y.useCallback)(e=>A.selectors.isTop(e,r),[A,r]));kG(j,O,e=>{e.preventDefault(),x()}),xK(j,g?.defaultView,e=>{e.preventDefault(),e.stopPropagation(),document.activeElement&&`blur`in document.activeElement&&typeof document.activeElement.blur==`function`&&document.activeElement.blur(),x()}),BG(l||k?!1:C,g,O),sG(C,m,x);let[ee,M]=CW(),N=(0,y.useMemo)(()=>[{dialogState:_,close:x,setTitleId:S,unmount:u},v],[_,x,S,u,v]),te=VU({open:_===0}),ne={ref:h,id:r,role:s,tabIndex:-1,"aria-modal":l?void 0:_===0||void 0,"aria-labelledby":v.titleId,"aria-describedby":ee,unmount:u},re=!SK(),ie=MK.None;C&&!l&&(ie|=MK.RestoreFocus,ie|=MK.TabLock,c&&(ie|=MK.AutoFocus),re&&(ie|=MK.InitialFocus));let ae=JU();return y.createElement(eK,null,y.createElement(cK,{force:!0},y.createElement(bK,null,y.createElement(sq.Provider,{value:N},y.createElement(yK,{target:m},y.createElement(cK,{force:!1},y.createElement(M,{slot:te},y.createElement(T,null,y.createElement(FK,{initialFocus:o,initialFocusFallback:m,containers:O,features:ie},y.createElement(AW,{value:x},ae({ourProps:ne,theirProps:d,slot:te,defaultTag:dq,features:fq,visible:_===0,name:`Dialog`})))))))))))}),dq=`div`,fq=KU.RenderStrategy|KU.Static;function pq(e,t){let{transition:n=!1,open:r,...i}=e,a=QG(),o=e.hasOwnProperty(`open`)||a!==null,s=e.hasOwnProperty(`onClose`);if(!o&&!s)throw Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!s)throw Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!=`boolean`)throw Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!=`function`)throw Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(r!==void 0||n)&&!i.static?y.createElement(TK,null,y.createElement(rq,{show:r,transition:n,unmount:i.unmount},y.createElement(uq,{ref:t,...i}))):y.createElement(TK,null,y.createElement(uq,{ref:t,open:r,...i}))}var mq=`div`;function hq(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-panel-${n}`,transition:i=!1,...a}=e,[{dialogState:o,unmount:s},c]=cq(`Dialog.Panel`),l=bW(t,c.panelRef),u=VU({open:o===0}),d={ref:l,id:r,onClick:BU(e=>{e.stopPropagation()})},f=i?nq:y.Fragment,p=i?{unmount:s}:{},m=JU();return y.createElement(f,{...p},m({ourProps:d,theirProps:a,slot:u,defaultTag:mq,name:`Dialog.Panel`}))}var gq=`div`;function _q(e,t){let{transition:n=!1,...r}=e,[{dialogState:i,unmount:a}]=cq(`Dialog.Backdrop`),o=VU({open:i===0}),s={ref:t,"aria-hidden":!0},c=n?nq:y.Fragment,l=n?{unmount:a}:{},u=JU();return y.createElement(c,{...l},u({ourProps:s,theirProps:r,slot:o,defaultTag:gq,name:`Dialog.Backdrop`}))}var vq=`h2`;function yq(e,t){let n=(0,y.useId)(),{id:r=`headlessui-dialog-title-${n}`,...i}=e,[{dialogState:a,setTitleId:o}]=cq(`Dialog.Title`),s=bW(t);(0,y.useEffect)(()=>(o(r),()=>o(null)),[r,o]);let c=VU({open:a===0}),l={ref:s,id:r};return JU()({ourProps:l,theirProps:i,slot:c,defaultTag:vq,name:`Dialog.Title`})}var bq=eW(pq),xq=eW(hq);eW(_q);var Sq=eW(yq),Cq=Object.assign(bq,{Panel:xq,Title:Sq,Description:DW});function wq({children:e,position:t,onClose:n,isOpen:r,wide:i=!1}){let a=i?800:400,o=i?700:500,s={position:`fixed`,left:`${Math.min(t.x,typeof window<`u`?window.innerWidth-a:t.x)}px`,top:`${Math.min(t.y,typeof window<`u`?window.innerHeight-o:t.y)}px`};return(0,I.jsx)(rq,{appear:!0,show:r,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-popup-overlay`,onClose:n,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-popup-backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-popup-container`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsx)(xq,{className:`semiont-popup-panel`,style:s,"data-annotation-ui":!0,"data-wide":i?`true`:`false`,children:(0,I.jsx)(I.Fragment,{children:e})})})})]})})}function Tq(e){return wr(e)?{stroke:`rgb(250, 204, 21)`,fill:`rgba(250, 204, 21, 0.2)`}:Tr(e)?{stroke:`rgb(59, 130, 246)`,fill:`rgba(59, 130, 246, 0.2)`}:Er(e)?{stroke:`rgb(239, 68, 68)`,fill:`rgba(239, 68, 68, 0.2)`}:Dr(e)?{stroke:`rgb(255, 255, 255)`,fill:`rgba(255, 255, 255, 0.2)`}:Or(e)?{stroke:`rgb(234, 88, 12)`,fill:`rgba(234, 88, 12, 0.2)`}:{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`}}function Eq(e){return Dr(e)?`Comment`:wr(e)?`Highlight`:Er(e)?`Assessment`:Or(e)?`Tag`:Ar(e)?`Resolved Reference`:Tr(e)?`Unresolved Reference`:`Annotation`}function Dq({annotations:e,imageWidth:t,imageHeight:n,displayWidth:r,displayHeight:i,session:a,hoveredAnnotationId:o,selectedAnnotationId:s,hoverDelayMs:c}){let l=r/t,u=i/n,{handleMouseEnter:d,handleMouseLeave:f}=(0,y.useMemo)(()=>_l(e=>a?.client.beckon.hover(e),c),[a,c]);return(0,I.jsx)(`svg`,{className:`semiont-annotation-overlay`,style:{width:r,height:i},children:e.map(e=>{if(typeof e.target==`string`)return null;let t=yr(e.target.selector);if(!t)return null;let n=li(t.value);if(!n)return null;let r=e.id===o,i=e.id===s,c=Tq(e),p=Tr(e),m=p&&Sr(e.body),h=p?m?`🔗`:`❓`:null;switch(n.type){case`rect`:{let{x:t,y:o,width:s,height:p}=n.data,m=(t+s)*l+8,g=(o+p)*u+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`rect`,{x:t*l,y:o*u,width:s*l,height:p*u,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:m,y:g,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}case`circle`:{let{cx:t,cy:o,r:s}=n.data,p=s*Math.min(l,u),m=Math.PI/4,g=t*l+p*Math.cos(m)+8,_=o*u+p*Math.sin(m)+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`circle`,{cx:t*l,cy:o*u,r:p,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:g,y:_,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}case`polygon`:{let t=n.data.points.map(e=>`${e.x*l},${e.y*u}`).join(` `),o=[...n.data.points.map(e=>({x:e.x*l,y:e.y*u,sum:e.x*l+e.y*u}))].sort((e,t)=>t.sum-e.sum),s=o[0],p=o[1],m=(s.x+p.x)/2+8,g=(s.y+p.y)/2+4;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`title`,{children:Eq(e)}),(0,I.jsx)(`polygon`,{points:t,fill:r||i?c.fill:`transparent`,stroke:c.stroke,strokeWidth:r||i?3:2,opacity:r||i?1:.7,className:`semiont-annotation-overlay__shape`,"data-hovered":r?`true`:`false`,"data-selected":i?`true`:`false`,onClick:t=>a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect()),onMouseEnter:()=>d(e.id),onMouseLeave:f}),h&&(0,I.jsx)(`text`,{x:m,y:g,fontSize:`16`,className:`semiont-annotation-overlay__status-indicator`,style:{userSelect:`none`},onClick:t=>{t.stopPropagation(),a?.client.browse.click(e.id,t.currentTarget.getBoundingClientRect())},onMouseEnter:()=>d(e.id),onMouseLeave:f,children:h})]},e.id)}default:return null}})})}function Oq(e){if(!e)return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`};switch(e){case`highlighting`:return{stroke:`rgb(250, 204, 21)`,fill:`rgba(250, 204, 21, 0.2)`};case`linking`:return{stroke:`rgb(59, 130, 246)`,fill:`rgba(59, 130, 246, 0.2)`};case`assessing`:return{stroke:`rgb(239, 68, 68)`,fill:`rgba(239, 68, 68, 0.2)`};case`commenting`:return{stroke:`rgb(255, 255, 255)`,fill:`rgba(255, 255, 255, 0.2)`};default:return{stroke:`rgb(156, 163, 175)`,fill:`rgba(156, 163, 175, 0.2)`}}}function kq({imageUrl:e,resourceUri:t,existingAnnotations:n=[],drawingMode:r,selectedMotivation:i,session:a,hoveredAnnotationId:o,selectedAnnotationId:s}){let{hoverDelayMs:c}=nF(),l=(0,y.useRef)(null),u=(0,y.useRef)(null),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null);(0,y.useEffect)(()=>{let t=new Image;t.onload=()=>{f({width:t.naturalWidth,height:t.naturalHeight})},t.src=e},[e]),(0,y.useEffect)(()=>{let e=()=>{u.current&&m({width:u.current.clientWidth,height:u.current.clientHeight})};e();let t=null;try{t=new ResizeObserver(e),u.current&&t.observe(u.current)}catch{console.warn(`ResizeObserver not supported, falling back to window resize listener`),window.addEventListener(`resize`,e)}return()=>{t?t.disconnect():window.removeEventListener(`resize`,e)}},[]);let S=(0,y.useCallback)(e=>{if(!u.current)return null;let t=u.current.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},[]),C=(0,y.useCallback)(e=>{if(!r)return;let t=S(e);t&&(g(!0),v(t),x(t))},[r,S]),w=(0,y.useCallback)(e=>{if(!h||!_)return;let t=S(e);t&&x(t)},[h,_,S]),T=(0,y.useCallback)(e=>{if(!h||!_||!r)return;let o=S(e);if(!o||!p||!d)return;if(Math.sqrt((o.x-_.x)**2+(o.y-_.y)**2)<10){if(n.length>0){let e,t=n.find(t=>{if(typeof t.target==`string`)return!1;let n=t.target.selector;if(!n)return!1;let r=(Array.isArray(n)?n:[n]).find(e=>e.type===`SvgSelector`);if(!r||r.type!==`SvgSelector`)return!1;let i=li(r.value);if(!i)return!1;let a=p.width/d.width,s=p.height/d.height;if(i.type===`rect`){let{x:t,y:n,width:r,height:c}=i.data,l=t*a,d=n*s,f=r*a,p=c*s,m=o.x>=l&&o.x<=l+f&&o.y>=d&&o.y<=d+p;return m&&u.current&&(e=ve(u.current.getBoundingClientRect(),l,d,f,p)),m}return!1});if(t){a?.client.browse.click(t.id,e),g(!1),v(null),x(null);return}}g(!1),v(null),x(null);return}let s;switch(r){case`circle`:{let e=Math.sqrt((o.x-_.x)**2+(o.y-_.y)**2);s=ci(_,e);break}case`polygon`:{let e=(_.x+o.x)/2,t=(_.y+o.y)/2,n=Math.abs(o.x-_.x)/2,r=Math.abs(o.y-_.y)/2;s=si([{x:e,y:t-r},{x:e+n,y:t},{x:e,y:t+r},{x:e-n,y:t}]);break}default:s=oi(_,o)}let c=ui(s,p.width,p.height,d.width,d.height);a&&i&&a.client.mark.request(ur(t),{type:`SvgSelector`,value:c},i),g(!1),v(null),x(null)},[h,_,r,p,d,S,i,n]),E=(0,y.useCallback)(()=>{h&&(g(!1),v(null),x(null))},[h]);return(0,I.jsxs)(`div`,{ref:l,className:`semiont-svg-drawing-canvas`,onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:E,"data-drawing-mode":r||`none`,children:[(0,I.jsx)(`img`,{ref:u,src:e,alt:`Annotatable content`,className:`semiont-svg-drawing-canvas__image`,draggable:!1}),p&&d&&(0,I.jsx)(`div`,{className:`semiont-svg-drawing-canvas__overlay-container`,children:(0,I.jsxs)(`div`,{className:`semiont-svg-drawing-canvas__overlay`,style:{width:p.width,height:p.height},children:[(0,I.jsx)(Dq,{annotations:n,imageWidth:d.width,imageHeight:d.height,displayWidth:p.width,displayHeight:p.height,hoverDelayMs:c,...a&&{session:a},...o!==void 0&&{hoveredAnnotationId:o},...s!==void 0&&{selectedAnnotationId:s}}),h&&_&&b&&(()=>{let e=Oq(i||null);return(0,I.jsxs)(`svg`,{className:`semiont-svg-drawing-canvas__preview`,style:{width:p.width,height:p.height},children:[r===`circle`&&(()=>{let t=Math.sqrt((b.x-_.x)**2+(b.y-_.y)**2);return(0,I.jsx)(`circle`,{cx:_.x,cy:_.y,r:t,fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})})(),r===`polygon`&&(()=>{let t=(_.x+b.x)/2,n=(_.y+b.y)/2,r=Math.abs(b.x-_.x)/2,i=Math.abs(b.y-_.y)/2,a=[{x:t,y:n-i},{x:t+r,y:n},{x:t,y:n+i},{x:t-r,y:n}].map(e=>`${e.x},${e.y}`).join(` `);return(0,I.jsx)(`polygon`,{points:a,fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})})(),r===`rectangle`&&(0,I.jsx)(`rect`,{x:Math.min(_.x,b.x),y:Math.min(_.y,b.y),width:Math.abs(b.x-_.x),height:Math.abs(b.y-_.y),fill:e.fill,stroke:e.stroke,strokeWidth:`2`,strokeDasharray:`5,5`})]})})()]})})]})}var Aq=[{titleKey:`navigationTitle`,shortcuts:[{keys:[`⌘K`,`Ctrl K`],descriptionKey:`navOpenSearch`},{keys:[`/`],descriptionKey:`navOpenSearchAlt`},{keys:[`⌘N`,`Ctrl N`],descriptionKey:`navCreateResource`},{keys:[`Esc Esc`],descriptionKey:`navCloseOverlays`},{keys:[`?`],descriptionKey:`navShowHelp`}]},{titleKey:`sidebarTitle`,shortcuts:[{keys:[`Click <`],descriptionKey:`sidebarCollapse`},{keys:[`Click ☰`],descriptionKey:`sidebarExpand`},{keys:[`Space`],descriptionKey:`sidebarPickup`},{keys:[`↑`,`↓`],descriptionKey:`sidebarMove`},{keys:[`Space`],descriptionKey:`sidebarDrop`},{keys:[`Esc`],descriptionKey:`sidebarCancel`}]},{titleKey:`annotationsTitle`,shortcuts:[{keys:[`H`],descriptionKey:`annotHighlight`},{keys:[`R`],descriptionKey:`annotReference`},{keys:[`Delete`],descriptionKey:`annotDelete`},{keys:[`Tab`],descriptionKey:`annotNavigate`},{keys:[`Shift Tab`],descriptionKey:`annotNavigateBack`}]},{titleKey:`listsTitle`,shortcuts:[{keys:[`←`,`→`],descriptionKey:`listsFilterNav`},{keys:[`↑`,`↓`,`←`,`→`],descriptionKey:`listsGridNav`},{keys:[`Home`],descriptionKey:`listsJumpFirst`},{keys:[`End`],descriptionKey:`listsJumpLast`}]},{titleKey:`searchModalTitle`,shortcuts:[{keys:[`↑`,`↓`],descriptionKey:`searchNav`},{keys:[`Enter`],descriptionKey:`searchSelect`},{keys:[`Esc`],descriptionKey:`searchClose`}]},{titleKey:`modalTitle`,shortcuts:[{keys:[`Esc`],descriptionKey:`modalClose`},{keys:[`Tab`],descriptionKey:`modalNavForward`},{keys:[`Shift Tab`],descriptionKey:`modalNavBackward`},{keys:[`Enter`],descriptionKey:`modalActivate`},{keys:[`Space`],descriptionKey:`modalActivate`}]},{titleKey:`accessibilityTitle`,shortcuts:[{keys:[`Tab`],descriptionKey:`a11ySkipLinks`},{keys:[`Enter`],descriptionKey:`a11yFollowLink`}]}];function jq({isOpen:e,onClose:t}){let n=Em(`KeyboardShortcuts`),r=typeof window<`u`&&navigator.platform.toUpperCase().indexOf(`MAC`)>=0;return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:t,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--large`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__header`,children:(0,I.jsxs)(`div`,{className:`semiont-modal__header-content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title`,children:n(`title`)}),(0,I.jsx)(`button`,{onClick:t,"aria-label":n(`closeDialog`),className:`semiont-modal__close`,children:(0,I.jsx)(`svg`,{className:`semiont-modal__close-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})})]})}),(0,I.jsxs)(`div`,{className:`semiont-modal__body`,children:[(0,I.jsx)(`div`,{className:`semiont-shortcuts`,children:Aq.map(e=>(0,I.jsxs)(`div`,{className:`semiont-shortcuts__group`,children:[(0,I.jsx)(`h3`,{className:`semiont-shortcuts__group-title`,children:n(e.titleKey)}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__list`,children:e.shortcuts.map((e,t)=>(0,I.jsxs)(`div`,{className:`semiont-shortcuts__item`,children:[(0,I.jsx)(`span`,{className:`semiont-shortcuts__description`,children:n(e.descriptionKey)}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__keys`,children:e.keys.map((e,t)=>e.includes(`⌘`)&&!r||e.includes(`Ctrl`)&&r?null:(0,I.jsxs)(y.Fragment,{children:[t>0&&!e.includes(`⌘`)&&!e.includes(`Ctrl`)&&(0,I.jsx)(`span`,{className:`semiont-shortcuts__separator`,children:n(`or`)}),(0,I.jsx)(`kbd`,{className:`semiont-shortcuts__key`,children:e})]},t))})]},t))})]},e.titleKey))}),(0,I.jsx)(`div`,{className:`semiont-shortcuts__note`,children:(0,I.jsx)(`p`,{className:`semiont-shortcuts__note-text`,children:n(r?`macNote`:`windowsNote`)})})]}),(0,I.jsx)(`div`,{className:`semiont-modal__footer`,children:(0,I.jsxs)(`div`,{className:`semiont-modal__footer-content`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__hint`,children:n(`footerHint`,{key:`?`}).split(`?`).map((e,t,n)=>(0,I.jsxs)(y.Fragment,{children:[e,t<n.length-1&&(0,I.jsx)(`kbd`,{className:`semiont-modal__hint-key`,children:`?`})]},t))}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-button semiont-button--secondary`,children:n(`close`)})]})})]})})})})]})})}function Mq(){let e=Z(Up().activeSignals$),t=Z(e?.permissionDeniedAt$)??null,n=Z(e?.permissionDeniedMessage$)??null,r=()=>e?.acknowledgePermissionDenied(),i=t!==null,a=n??`You do not have permission to perform this action.`,o=()=>{r(),window.history.back()};return(0,I.jsx)(rq,{appear:!0,show:i,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:o,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--medium`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-modal__icon`,children:(0,I.jsx)(`svg`,{style:{width:`1.5rem`,height:`1.5rem`,color:`var(--semiont-color-amber-600, #d97706)`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})})})}),(0,I.jsxs)(`div`,{className:`semiont-modal__content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title semiont-modal__title--centered`,children:`Access Denied`}),(0,I.jsx)(`p`,{className:`semiont-modal__description`,children:a})]}),(0,I.jsxs)(`div`,{style:{padding:`0.75rem`,backgroundColor:`var(--semiont-bg-secondary)`,borderRadius:`var(--semiont-radius-md, 0.375rem)`,border:`1px solid var(--semiont-border-primary)`,fontSize:`var(--semiont-text-sm, 0.875rem)`,marginBottom:`1rem`},children:[(0,I.jsx)(`p`,{style:{color:`var(--semiont-text-secondary)`,marginBottom:`0.5rem`},children:`This could be because:`}),(0,I.jsxs)(`ul`,{style:{listStyle:`disc`,listStylePosition:`inside`,color:`var(--semiont-text-tertiary)`,display:`flex`,flexDirection:`column`,gap:`0.25rem`},children:[(0,I.jsx)(`li`,{children:`You don't have the required permissions`}),(0,I.jsx)(`li`,{children:`The resource is restricted to specific users or teams`}),(0,I.jsx)(`li`,{children:`Your account type doesn't include this feature`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-modal__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,className:`semiont-button--primary semiont-button--flex`,children:`Go Back`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{r(),window.location.href=`/`},className:`semiont-button--secondary semiont-button--flex`,children:`Go to Home`})]}),(0,I.jsx)(`div`,{className:`semiont-modal__actions`,style:{marginTop:`0.5rem`,paddingTop:`0.5rem`,borderTop:`1px solid var(--semiont-border-primary)`},children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>{r(),window.location.href=`/auth/connect?callbackUrl=${encodeURIComponent(window.location.pathname)}`},className:`semiont-button--secondary semiont-button--flex`,style:{fontSize:`var(--semiont-text-sm, 0.875rem)`},children:`Switch Account`})})]})})})})]})})}function Nq(){let e=Z(Up().activeSignals$),t=Z(e?.sessionExpiredAt$)??null,n=Z(e?.sessionExpiredMessage$)??null,r=()=>e?.acknowledgeSessionExpired(),i=t!==null,a=()=>{r(),window.location.href=`/auth/connect?callbackUrl=${encodeURIComponent(window.location.pathname)}`},o=()=>{r(),window.location.href=`/`};return(0,I.jsx)(rq,{appear:!0,show:i,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-modal`,onClose:o,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-modal__container`,children:(0,I.jsx)(`div`,{className:`semiont-modal__wrapper`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-modal__panel semiont-modal__panel--medium`,children:[(0,I.jsx)(`div`,{className:`semiont-modal__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-modal__icon`,style:{background:`linear-gradient(to bottom right, var(--semiont-color-red-100, #fee2e2), var(--semiont-color-red-300, #fca5a5))`},children:(0,I.jsx)(`svg`,{style:{width:`1.5rem`,height:`1.5rem`,color:`var(--semiont-color-red-600, #dc2626)`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})})})}),(0,I.jsxs)(`div`,{className:`semiont-modal__content`,children:[(0,I.jsx)(Sq,{className:`semiont-modal__title semiont-modal__title--centered`,children:`Session Expired`}),(0,I.jsx)(`p`,{className:`semiont-modal__description`,children:n??`Your session has expired for security reasons. Please sign in again to continue working.`})]}),(0,I.jsxs)(`div`,{className:`semiont-modal__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,className:`semiont-button--secondary semiont-button--flex`,children:`Go to Home`}),(0,I.jsx)(`button`,{type:`button`,onClick:a,className:`semiont-button--primary semiont-button--flex`,children:`Sign In Again`})]})]})})})})]})})}function Pq(e,t,n,r){if(!t||n<0||r<=n||r>e.length)return null;let i=pi(e,n,r);return[{type:`TextPositionSelector`,start:n,end:r},{type:`TextQuoteSelector`,exact:t,...i.prefix&&{prefix:i.prefix},...i.suffix&&{suffix:i.suffix}}]}function Fq(e,t){let n=e.indexOf(t);return n===-1?null:{start:n,end:n+t.length}}var Iq=new Set;function Lq(e,t){if(!e)return[{exact:``,start:0,end:0}];let n=t.map(t=>{let n=Cr(t.target),r=vr(n),i=n?Nr(n):null,a=Zr(e,{...r?{position:{start:r.start,end:r.end}}:{},...i?{quote:{exact:i.exact,...i.prefix===void 0?{}:{prefix:i.prefix},...i.suffix===void 0?{}:{suffix:i.suffix}}}:{}});return a&&a.confidence!==`high`&&Rq(t.id,a.strategy,a.confidence),{annotation:t,start:a?.start??0,end:a?.end??0,...a?.strategy?{strategy:a.strategy}:{},...a?.confidence?{confidence:a.confidence}:{}}}).filter(t=>t.start>=0&&t.end<=e.length&&t.start<t.end).sort((e,t)=>e.start-t.start);if(n.length===0)return[{exact:e,start:0,end:e.length}];let r=[],i=0;for(let{annotation:t,start:a,end:o,strategy:s,confidence:c}of n)a<i||(a>i&&r.push({exact:e.slice(i,a),start:i,end:a}),r.push({exact:e.slice(a,o),annotation:t,start:a,end:o,...s?{strategy:s}:{},...c?{confidence:c}:{}}),i=o);return i<e.length&&r.push({exact:e.slice(i),start:i,end:e.length}),r}function Rq(e,t,n){Iq.has(e)||(Iq.add(e),console.warn(`[segmentTextWithAnnotations] annotation anchored via degraded strategy`,{annotationId:e,strategy:t,confidence:n}))}function zq(){let e=Em(`PdfViewer`);return(0,I.jsx)(I.Fragment,{children:e(`viewerLoading`)})}var Bq=(0,y.lazy)(()=>s(()=>import(`./PdfAnnotationCanvas.client-LSH3PZPY-CcbBYgYn.js`).then(e=>({default:e.PdfAnnotationCanvas})),__vite__mapDeps([4,2,3,1])));function Vq({content:e,annotations:t,session:n,sparkleAnnotationIds:r,hoveredAnnotationId:i,scrollToAnnotationId:a,showLineNumbers:o=!1,hoverDelayMs:s=150,enableWidgets:c=!1,getTargetResourceName:l,generatingReferenceId:u}){let d=Lq(e,t);return(0,I.jsx)(KH,{content:e,segments:d,editable:!1,sparkleAnnotationIds:r,...i!==void 0&&{hoveredAnnotationId:i},...a!==void 0&&{scrollToAnnotationId:a},sourceView:!0,showLineNumbers:o,hoverDelayMs:s,enableWidgets:c,session:n,...l&&{getTargetResourceName:l},...u!==void 0&&{generatingReferenceId:u}})}function Hq({content:e,resourceUri:t,annotations:n,session:r,drawingMode:i,selectedMotivation:a,hoveredAnnotationId:o,hoverDelayMs:s=150}){return e?(0,I.jsx)(kq,{imageUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:i,selectedMotivation:a,session:r,hoveredAnnotationId:o||null,hoverDelayMs:s}):null}function Uq({content:e,resourceUri:t,annotations:n,session:r,drawingMode:i,selectedMotivation:a,hoveredAnnotationId:o,hoverDelayMs:s=150}){return e?(0,I.jsx)(y.Suspense,{fallback:(0,I.jsx)(`div`,{className:`semiont-annotate-view__loading`,children:(0,I.jsx)(zq,{})}),children:(0,I.jsx)(Bq,{pdfUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:i,selectedMotivation:a,session:r,hoveredAnnotationId:o||null,hoverDelayMs:s,pageLayout:`scroll`})}):null}var Wq={text:Vq,image:Hq,pdf:Uq};function Gq({resourceUri:e,session:t}){let n=t?.client??null,{token:r}=pF(n,ur(e)),i=zP(n,ur(e),r);return i?(0,I.jsx)(`a`,{href:i,download:!0,className:`semiont-button semiont-button--primary`,children:`Download File`}):(0,I.jsx)(`button`,{type:`button`,disabled:!0,className:`semiont-button semiont-button--primary semiont-button--disabled`,children:`Download File`})}function Kq({content:e,mimeType:t=`text/plain`,resourceUri:n,annotations:r,uiState:i,onUIStateChange:a,enableWidgets:o=!1,getTargetResourceName:s,generatingReferenceId:c,showLineNumbers:l=!1,hoverDelayMs:u=150,annotateMode:d,session:f,sparkleAnnotationIds:p,onModeChange:m,showToolbar:h=!0,renderers:g}){let _=(0,y.useRef)(null),v=Si(t)?.render??`none`,{highlights:b,references:x,assessments:S,comments:C,tags:w}=r,T=[...b,...x,...S,...C,...w],{selectedMotivation:E,selectedClick:D,selectedShape:O,hoveredAnnotationId:k,scrollToAnnotationId:A}=i,j=(0,y.useRef)(a);j.current=a;let ee=(0,y.useCallback)(e=>{j.current?.({selectedMotivation:e})},[]),M=(0,y.useCallback)(e=>{j.current?.({selectedClick:e})},[]),N=(0,y.useCallback)(e=>{j.current?.({selectedShape:e})},[]);hF(f,{"beckon:hover":(0,y.useCallback)(({annotationId:e})=>{j.current?.({hoveredAnnotationId:e})},[]),"beckon:focus":(0,y.useCallback)(({annotationId:e,resourceId:t})=>{t&&t!==n||_.current&&kH(e??null,_.current,{pulse:!0})},[n])}),(0,y.useEffect)(()=>{let t=_.current;if(!t)return;let r=!1,i=e=>{let t=e.target;r=!!t.closest(`[data-annotation-id]`),t.closest(`[data-annotation-ui]`)},a=i=>{let a=i.target;if(a.closest(`.semiont-pdf-annotation-canvas`)||a.closest(`.semiont-svg-drawing-canvas`))return;let o=window.getSelection();if(!o||o.isCollapsed||!o.toString()){r=!1;return}if(r){r=!1;return}r=!1;let s=o.getRangeAt(0),c=o.toString(),l=t.querySelector(`.codemirror-renderer`)?.__cmView,u,d;if(!l||!l.posAtDOM){let t=Fq(e,c);if(!t)return;u=t.start,d=t.end}else u=l.posAtDOM(s.startContainer,s.startOffset),d=u+c.length;if(u>=0&&E){let t=Pq(e,c,u,d);if(!t)return;f?.client.mark.request(ur(n),t,E),o.removeAllRanges()}};return t.addEventListener(`mouseup`,a),t.addEventListener(`mousedown`,i),()=>{t.removeEventListener(`mouseup`,a),t.removeEventListener(`mousedown`,i)}},[E,e,n]);let te={...Wq,...g}[v];return te?(0,I.jsxs)(`div`,{className:`semiont-annotate-view`,"data-mime-type":v,ref:_,children:[h&&(0,I.jsx)(iU,{selectedMotivation:E,selectedClick:D,selectedShape:O,mediaType:t,annotateMode:d,annotators:ww,onModeChange:m,onClickActionChange:M,onSelectionChange:ee,onShapeChange:N}),(0,I.jsx)(`div`,{className:`semiont-annotate-view__content`,children:(0,I.jsx)(te,{content:e,mimeType:t,resourceUri:n,annotations:T,session:f,drawingMode:E?O:null,selectedMotivation:E,hoveredAnnotationId:k,hoverDelayMs:u,sparkleAnnotationIds:p,scrollToAnnotationId:A,showLineNumbers:l,enableWidgets:o,...s&&{getTargetResourceName:s},generatingReferenceId:c})})]}):(0,I.jsx)(`div`,{ref:_,className:`semiont-annotate-view semiont-annotate-view--unsupported`,"data-mime-type":`unsupported`,children:(0,I.jsxs)(`div`,{className:`semiont-annotate-view__empty`,children:[(0,I.jsxs)(`p`,{className:`semiont-annotate-view__empty-message`,children:[`Annotation not supported for `,t]}),(0,I.jsx)(Gq,{resourceUri:n,session:f})]})})}function qq(e){if(!e.startsWith(`did:`))return e;let t=e.match(/^did:web:system:(.+)$/);if(t){let e=t[1];return e.charAt(0).toUpperCase()+e.slice(1)}let n=e.match(/^did:web:[^:]+:users:(.+)$/);return n?decodeURIComponent(n[1]):e}function Jq(e,t,n){switch(e){case`yield:created`:return t(`resourceCreated`);case`yield:cloned`:return t(`resourceCloned`);case`mark:archived`:return t(`resourceArchived`);case`mark:unarchived`:return t(`resourceUnarchived`);case`mark:added`:{let e=n?.annotation?.motivation;return t(e===`highlighting`?`highlightAdded`:e===`linking`?`referenceCreated`:e===`assessing`?`assessmentAdded`:`annotationAdded`)}case`mark:removed`:return t(`annotationRemoved`);case`mark:body-updated`:return t(`annotationBodyUpdated`);case`mark:entity-tag-added`:return t(`entitytagAdded`);case`mark:entity-tag-removed`:return t(`entitytagRemoved`);case`job:completed`:case`job:started`:case`job:failed`:return t(`jobEvent`);case`yield:representation-added`:case`yield:representation-removed`:return t(`representationEvent`);default:return e}}function Yq(e,t){switch(e){case`yield:created`:case`yield:cloned`:case`mark:archived`:case`mark:unarchived`:return`📄`;case`mark:added`:{let e=t?.annotation?.motivation;return e===`highlighting`?ww.highlight.iconEmoji||`📝`:e===`linking`?ww.reference.iconEmoji||`📝`:e===`assessing`&&ww.assessment.iconEmoji||`📝`}case`mark:removed`:return`🗑️`;case`mark:body-updated`:return`✏️`;case`mark:entity-tag-added`:case`mark:entity-tag-removed`:return`🏷️`;case`job:completed`:return`🔗`;case`job:started`:return`⚙️`;case`job:failed`:return`❌`;case`yield:representation-added`:case`yield:representation-removed`:return`📄`;default:return`📝`}}function Xq(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?t(`justNow`):i<60?t(`minutesAgo`,{count:i}):a<24?t(`hoursAgo`,{count:a}):o<7?t(`daysAgo`,{count:o}):n.toLocaleDateString()}function Zq(e,t=50){let n=e.trim();return n.length>t?n.substring(0,t)+`...`:n}function Qq(e,t,n){let r=e,i=r.payload;switch(r.type){case`yield:created`:case`yield:cloned`:return{exact:i.name,isQuoted:!1,isTag:!1};case`mark:body-updated`:{let e=t.find(e=>e.id.endsWith(`/annotations/${i.annotationId}`));if(e?.target)try{let t=jr(Cr(e.target));if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}catch{}return null}case`mark:removed`:{let e=n.find(e=>e.type===`mark:added`&&e.payload.annotation.id.endsWith(`/annotations/${i.annotationId}`));if(e&&e.type===`mark:added`)try{let t=e.payload.annotation.target;if(typeof t!=`string`&&t.selector){let e=jr(t.selector);if(e)return{exact:Zq(e),isQuoted:!0,isTag:!1}}}catch{}return null}case`mark:added`:try{let e=i.annotation.target;if(typeof e!=`string`&&e.selector){let t=jr(e.selector);if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}}catch{}return null;case`mark:entity-tag-added`:case`mark:entity-tag-removed`:return{exact:i.entityType,isQuoted:!1,isTag:!0};case`job:completed`:if(i.annotationUri){let e=t.find(e=>e.id===i.annotationUri);if(e?.target)try{let t=jr(Cr(e.target));if(t)return{exact:Zq(t),isQuoted:!0,isTag:!1}}catch{}}return null;case`job:started`:case`job:failed`:case`yield:representation-added`:case`yield:representation-removed`:return null;default:return null}}function $q(e){let t=e,n=t.payload;if(t.type===`mark:added`){let e=n.annotation.motivation,t=n.annotation.body;if(e===`linking`&&t&&`entityTypes`in t)return t.entityTypes??[]}return[]}function eJ(e){let t=e,n=t.payload;return t.type===`yield:created`?{type:`created`,userId:t.userId,metadata:void 0}:t.type===`yield:cloned`?{type:`cloned`,userId:t.userId,sourceDocId:n.parentResourceId,parentResourceId:n.parentResourceId,metadata:void 0}:null}function tJ({event:e,annotations:t,allEvents:n,isRelated:r,t:i,Link:a,routes:o,onEventRef:s,onEventClick:c,onEventHover:l}){let u=Qq(e,t,n),d=mr(e),f=eJ(e),p=$q(e),m=(0,y.useRef)(null),h=(0,y.useRef)(l);(0,y.useEffect)(()=>{h.current=l});let g=(0,y.useCallback)(()=>{!d||!h.current||(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{h.current?.(d)},300))},[d]),_=(0,y.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null),h.current&&h.current(null)},[]),v=d?`button`:`div`,b=d?{type:`button`,onClick:()=>c?.(d),"aria-label":i(`viewAnnotation`,{content:u?.exact||Jq(e.type,i)}),className:`semiont-history-event`,"data-related":r?`true`:`false`,"data-interactive":`true`}:{className:`semiont-history-event`,"data-related":r?`true`:`false`};return(0,I.jsxs)(v,{ref:e=>{s&&s(d,e)},...b,children:[(0,I.jsxs)(`div`,{className:`semiont-history-event__content`,children:[(0,I.jsx)(`span`,{className:`semiont-history-event__emoji`,onMouseEnter:g,onMouseLeave:_,children:Yq(e.type,e.payload)}),u?u.isTag?(0,I.jsx)(`span`,{className:`semiont-history-event__tag`,children:u.exact}):u.isQuoted?(0,I.jsxs)(`span`,{className:`semiont-history-event__text semiont-history-event__text--quoted`,children:[`“`,u.exact,`”`]}):(0,I.jsx)(`span`,{className:`semiont-history-event__text`,children:u.exact}):(0,I.jsx)(`span`,{className:`semiont-history-event__text`,children:Jq(e.type,i,e.payload)}),e.userId&&(0,I.jsx)(`span`,{className:`semiont-history-event__user`,children:qq(e.userId)}),(0,I.jsx)(`span`,{className:`semiont-history-event__timestamp`,children:Xq(e.timestamp,i)})]}),p.length>0&&(0,I.jsx)(`div`,{className:`semiont-history-event__entity-types`,children:p.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--small`,"data-variant":`blue`,children:e},e))}),f&&(0,I.jsxs)(`div`,{className:`semiont-history-event__details`,children:[(0,I.jsxs)(`span`,{className:`semiont-history-event__detail`,children:[i(`user`),`: `,(0,I.jsx)(`span`,{className:`semiont-history-event__detail-value`,children:f.userId?qq(f.userId):``})]}),f.type===`cloned`&&f.sourceDocId&&(0,I.jsx)(a,{href:o.resourceDetail(f.sourceDocId),className:`semiont-history-event__link`,onClick:e=>e.stopPropagation(),children:i(`viewOriginal`)})]})]})}function nJ({events:e,eventsLoading:t=!1,eventsError:n=null,onRetryEvents:r,annotations:i=[],hoveredAnnotationId:a,onEventHover:o,onEventClick:s,Link:c,routes:l}){let u=Em(`AnnotationHistory`),d=t,f=n,p=(0,y.useRef)(new Map),m=(0,y.useRef)(null),h=e.filter(e=>e.type!==`job:started`&&e.type!==`job:progress`&&e.type!==`job:completed`).sort((e,t)=>e.metadata.sequenceNumber-t.metadata.sequenceNumber);return(0,y.useEffect)(()=>{m.current&&h.length>0&&requestAnimationFrame(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)})},[h.length]),(0,y.useEffect)(()=>{if(!a)return;let e=p.current.get(a);e&&m.current&&(e.scrollIntoView({behavior:`smooth`,block:`nearest`}),e.classList.add(`bg-blue-100`,`dark:bg-blue-900/30`),setTimeout(()=>{e.classList.remove(`bg-blue-100`,`dark:bg-blue-900/30`)},1500))},[a]),f?(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsxs)(`p`,{className:`semiont-history-panel__error`,children:[u(`failed`),r&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:r,className:`semiont-panel__inline-action`,children:u(`retry`)})]})]})]}):d?(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsx)(`div`,{className:`semiont-history-panel__loading`,children:u(`loading`)})]}):h.length===0?null:(0,I.jsxs)(`div`,{className:`semiont-history-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-history-panel__title`,children:u(`history`)}),(0,I.jsx)(`div`,{ref:m,className:`semiont-history-panel__list`,children:h.map(e=>{let t=a?(()=>{let t=mr(e);return t?t===a:!1})():!1;return(0,I.jsx)(tJ,{event:e,annotations:i,allEvents:h,isRelated:t,t:u,Link:c,routes:l,onEventRef:(e,t)=>{t&&e?p.current.set(e,t):!t&&e&&p.current.delete(e)},...s&&{onEventClick:s},...o&&{onEventHover:o}},e.id)})})]})}function rJ(){let e=Em(`PdfViewer`);return(0,I.jsx)(I.Fragment,{children:e(`viewerLoading`)})}var iJ=(0,y.lazy)(()=>s(()=>import(`./PdfAnnotationCanvas.client-LSH3PZPY-CcbBYgYn.js`).then(e=>({default:e.PdfAnnotationCanvas})),__vite__mapDeps([4,2,3,1]))),aJ=(0,y.memo)(function({content:e}){return(0,I.jsx)(hx,{remarkPlugins:[yw],children:e})});function oJ({content:e}){return(0,I.jsx)(aJ,{content:e})}function sJ({content:e,resourceUri:t,annotations:n,session:r}){return(0,I.jsx)(kq,{imageUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:null,selectedMotivation:null,session:r})}function cJ({content:e,resourceUri:t,annotations:n,session:r}){return(0,I.jsx)(y.Suspense,{fallback:(0,I.jsx)(`div`,{className:`semiont-browse-view__loading`,children:(0,I.jsx)(rJ,{})}),children:(0,I.jsx)(iJ,{pdfUrl:e,resourceUri:t,existingAnnotations:n,drawingMode:null,selectedMotivation:null,session:r,pageLayout:`scroll`})})}var lJ={text:oJ,image:sJ,pdf:cJ},uJ=(0,y.memo)(function({content:e,mimeType:t,resourceUri:n,annotations:r,selectedClick:i=`detail`,onModeChange:a,onClickActionChange:o,showToolbar:s=!0,annotateMode:c,hoverDelayMs:l=150,session:u,sparkleAnnotationIds:d,renderers:f,onLinkClick:p,onReferenceHover:m,inline:h=!1}){let g=(0,y.useRef)(null),_=h?` semiont-browse-view--inline`:``,v=Si(t)?.render??`none`,{highlights:b,references:x,assessments:S,comments:C,tags:w}=r,T=(0,y.useMemo)(()=>[...b,...x,...S,...C,...w],[b,x,S,C,w]),E=(0,y.useMemo)(()=>GP(T),[T]);(0,y.useEffect)(()=>{if(!g.current||E.length===0)return;let t=g.current,n=BP(e,t),r=VP(t);return UP(HP(E,n),r),()=>WP(t)},[e,E]),(0,y.useEffect)(()=>{if(!g.current||!u)return;let e=g.current,t=e=>{let t=e.target.closest(`[data-annotation-id]`);if(!t)return;let n=window.getSelection();if(n&&!n.isCollapsed)return;let r=t.getAttribute(`data-annotation-id`);if(r){let e=T.find(e=>e.id===r);e&&u.client.browse.click(e.id,t.getBoundingClientRect())}},n=null,r=null,i=!1,a=e=>{if(!m)return;let t=T.find(t=>t.id===e);if(!t||!Ar(t))return;let a=xr(t.body),o=n;!a||!o||(r?.unsubscribe(),r=u.client.browse.resource(ur(a)).subscribe({next:e=>{if(e.status!==`ready`)return;let n=e.value;r?.unsubscribe(),r=null,i=!0,m({annotation:t,referent:n,anchorRect:o.getBoundingClientRect()})},error:()=>{r=null}}))},o=()=>{r?.unsubscribe(),r=null,i&&(i=!1,m?.(null))},{handleMouseEnter:s,handleMouseLeave:c,cleanup:f}=_l(e=>{u.client.beckon.hover(e),e?a(e):o()},l),p=e=>{let t=e.target.closest(`[data-annotation-id]`),r=t?.getAttribute(`data-annotation-id`);r&&(n=t,s(dr(r)))},h=e=>{e.target.closest(`[data-annotation-id]`)&&c()};return d&&e.querySelectorAll(`[data-annotation-id]`).forEach(e=>{let t=e.getAttribute(`data-annotation-id`);t&&d.has(t)&&e.classList.add(`annotation-sparkle`)}),e.addEventListener(`click`,t),e.addEventListener(`mouseover`,p),e.addEventListener(`mouseout`,h),()=>{e.removeEventListener(`click`,t),e.removeEventListener(`mouseover`,p),e.removeEventListener(`mouseout`,h),f(),r?.unsubscribe()}},[e,T,d,l,u,m]);let D=(0,y.useCallback)((e,t=!1)=>{g.current&&kH(e,g.current,{pulse:t})},[]);hF(u,{"beckon:hover":(0,y.useCallback)(({annotationId:e})=>{D(e)},[D]),"beckon:focus":(0,y.useCallback)(({annotationId:e,resourceId:t})=>{t&&t!==n||D(e??null,!0)},[D,n])});let O=(0,y.useCallback)(e=>{let t=e.target.closest(`a[href]`);if(!t)return;e.preventDefault();let n=t.getAttribute(`href`);n&&p?.({href:n,event:e})},[p]),k={...lJ,...f},A=v===`none`?void 0:k[v];return A?(0,I.jsxs)(`div`,{className:`semiont-browse-view${_}`,"data-mime-type":v,children:[s&&(0,I.jsx)(iU,{selectedMotivation:null,selectedClick:i,parts:[`clickAction`,`mode`],showDeleteButton:!1,annotateMode:c,annotators:ww,onModeChange:a,onClickActionChange:o,compact:h}),(0,I.jsx)(`div`,{ref:g,className:`semiont-browse-view__content`,onClick:O,children:(0,I.jsx)(A,{content:e,mimeType:t,resourceUri:n,annotations:T,session:u})})]}):(0,I.jsx)(`div`,{ref:g,className:`semiont-browse-view semiont-browse-view--unsupported${_}`,"data-mime-type":`unsupported`,children:(0,I.jsxs)(`div`,{className:`semiont-browse-view__empty`,children:[(0,I.jsxs)(`p`,{className:`semiont-browse-view__empty-message`,children:[`Preview not available for `,t]}),(0,I.jsx)(Gq,{resourceUri:n,session:u})]})})});function dJ({resource:e,annotations:t,session:n,onOpenResource:r,onOpenPanel:i,onLinkClick:a,onReferenceHover:o,inline:s=!1,sparkleAnnotationIds:c,generatingReferenceId:l,showLineNumbers:u=!1,hoverDelayMs:d,hoveredAnnotationId:f,annotateMode:p,onAnnotateModeChange:m,clickAction:h,onClickActionChange:g,selectionMotivation:_,onSelectionMotivationChange:v,shape:b,onShapeChange:x,showToolbar:S=!0,browseRenderers:C,annotateRenderers:w}){let T=Em(`ResourceViewer`),E=(0,y.useRef)(null),{highlights:D,references:O,assessments:k,comments:A,tags:j}=t;if(!e[`@id`])throw Error(`Resource has no @id`);let ee=e[`@id`],M=Wr(e)||`text/plain`,[N,te]=(0,y.useState)(!1),ne=p??N,re=(0,y.useCallback)(e=>{p===void 0&&te(e),m?.(e)},[p,m]),ie=ne?`annotate`:`browse`,[ae,oe]=(0,y.useState)(`linking`),se=_===void 0?ae:_,ce=(0,y.useCallback)(e=>{_===void 0&&oe(e),v?.(e)},[_,v]),[le,P]=(0,y.useState)(`detail`),F=h??le,ue=(0,y.useCallback)(e=>{h===void 0&&P(e),g?.(e)},[h,g]),[de,fe]=(0,y.useState)(`rectangle`),pe=b??de,me=(0,y.useCallback)(e=>{b===void 0&&fe(e),x?.(e)},[b,x]),[he,ge]=(0,y.useState)(!1),[_e,ve]=(0,y.useState)(null),[ye,be]=(0,y.useState)(null),xe=f??null,Se=()=>typeof window>`u`?{x:0,y:0}:{x:Math.max(0,(window.innerWidth-800)/2),y:Math.max(0,(window.innerHeight-700)/2)},Ce=(0,y.useCallback)(e=>{n?.client.mark.delete(ee,e)},[n,ee]),we=(0,y.useCallback)((e,t)=>{if(Object.values(ww).find(t=>t.matchesAnnotation(e))?.hasSidePanel&&F!==`deleting`&&F!==`jsonld`&&F!==`follow`)return;let n=wr(e)||Er(e)||Dr(e)||Tr(e)||Or(e);if(F===`follow`&&Tr(e)){let t=xr(e.body);t&&r?.(t);return}if(F===`jsonld`&&n){ve(e),ge(!0);return}if(ne&&F===`deleting`&&n){let n=t?{x:t.clientX,y:t.clientY+10}:{x:window.innerWidth/2-150,y:window.innerHeight/2-75};be({annotation:e,position:n});return}},[ne,F,r]);hF(n,{"browse:click":(0,y.useCallback)(({annotationId:e,anchorRect:t})=>{let n=[...D,...O,...k,...A,...j].find(t=>t.id===e);if(n){if(!Object.values(ww).find(e=>e.matchesAnnotation(n))?.hasSidePanel||F!==`detail`){we(n);return}i?.({panel:`annotations`,scrollToAnnotationId:e,motivation:n.motivation,...t?{anchorRect:t}:{}})}},[D,O,k,A,j,we,F,i])});let Te=(0,y.useMemo)(()=>({highlights:D,references:O,assessments:k,comments:A,tags:j}),[D,O,k,A,j]),L={selectedMotivation:se,selectedClick:F,selectedShape:pe,hoveredAnnotationId:xe},Ee=(0,y.useCallback)(e=>{let t=O.find(t=>xr(t.body)===e);return t?jr(Cr(t.target)):void 0},[O]);return(0,I.jsxs)(`div`,{ref:E,className:`semiont-resource-viewer${s?` semiont-resource-viewer--inline`:``}`,children:[ie===`annotate`?(0,I.jsx)(Kq,{content:e.content,mimeType:M,resourceUri:e[`@id`],annotations:Te,uiState:L,onUIStateChange:e=>{`selectedMotivation`in e&&ce(e.selectedMotivation??null),`selectedClick`in e&&ue(e.selectedClick),`selectedShape`in e&&me(e.selectedShape)},enableWidgets:!0,getTargetResourceName:Ee,...l!==void 0&&{generatingReferenceId:l},showLineNumbers:u,hoverDelayMs:d,annotateMode:ne,onModeChange:re,showToolbar:S,session:n,sparkleAnnotationIds:c,...w&&{renderers:w}}):(0,I.jsx)(uJ,{content:e.content,mimeType:M,resourceUri:e[`@id`],annotations:Te,selectedClick:F,hoverDelayMs:d,annotateMode:ne,onModeChange:re,onClickActionChange:ue,showToolbar:S,session:n,sparkleAnnotationIds:c,onLinkClick:a,onReferenceHover:o,inline:s,...C&&{renderers:C}}),_e&&(0,I.jsx)(wq,{isOpen:he,onClose:()=>ge(!1),position:Se(),wide:!0,children:(0,I.jsx)(EU,{annotation:_e,onBack:()=>{ge(!1),ve(null)}})}),ye&&(()=>{let e=ye.annotation,t=Object.values(ww).find(t=>t.matchesAnnotation(e)),n=jr(Cr(e.target)),r=t?.iconEmoji||`📝`;return(0,I.jsx)(wq,{isOpen:!!ye,onClose:()=>be(null),position:ye.position,children:(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation`,children:[(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation__header`,children:[(0,I.jsx)(`span`,{className:`semiont-delete-confirmation__icon`,children:r}),(0,I.jsx)(`h3`,{className:`semiont-delete-confirmation__title`,children:T(`deleteConfirmationTitle`)})]}),n&&(0,I.jsx)(`div`,{className:`semiont-delete-confirmation__quote`,children:(0,I.jsxs)(`p`,{className:`semiont-delete-confirmation__text`,children:[`"`,n.length>100?n.substring(0,100)+`...`:n,`"`]})}),(0,I.jsx)(`p`,{className:`semiont-delete-confirmation__message`,children:T(`deleteConfirmationMessage`)}),(0,I.jsxs)(`div`,{className:`semiont-delete-confirmation__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>be(null),className:`semiont-button semiont-button--secondary`,children:T(`deleteConfirmationCancel`)}),(0,I.jsx)(`button`,{onClick:()=>{Ce(ye.annotation.id),be(null)},className:`semiont-button semiont-button--danger`,children:T(`deleteConfirmationDelete`)})]})]})})})()]})}function fJ(e){if(e[`@type`]===`Software`){let t=e.provider,n=e.model;if(t&&n)return`${t} ${n}`;if(n)return n;if(t)return t}return e.name||e[`@id`]||`unknown`}function pJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function mJ(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`TextualBody`&&`value`in e&&typeof e.value==`string`}function hJ(e){return e.body?mJ(e.body)?e.body.value||null:Array.isArray(e.body)&&e.body.length>0&&e.body.find(mJ)?.value||null:null}function gJ({session:e,assessment:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t),s=hJ(t);return(0,I.jsxs)(`div`,{ref:i,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`assessment`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...a,children:[o&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`assessment`,children:[`"`,o.substring(0,100),o.length>100?`...`:``,`"`]}),s&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__body`,"data-type":`assessment`,children:s}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,pJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function _J(e){return t=>{switch(t.code){case`loading`:return e(`codeLoading`);case`analyzing`:return e(`codeAnalyzing`);case`analyzing-tags`:return e(`codeAnalyzingTags`);case`generating-resource`:return e(`codeGeneratingResource`);case`creating-resource`:return e(`codeCreatingResource`);case`complete-generated`:return t.truncated?e(`codeCompleteGeneratedTruncated`):e(`codeCompleteGenerated`);case`detecting-entities`:return e(`codeDetectingEntities`);case`creating-annotations`:return e(`codeCreatingAnnotations`,{count:t.count});case`creating-tag-annotations`:return e(`codeCreatingTagAnnotations`,{count:t.count});case`complete-created`:return e(`codeCompleteCreated`,{count:t.count,kind:e(vJ(t.kind))});default:return t}}}function vJ(e){return`kind${e.charAt(0).toUpperCase()}${e.slice(1)}`}function yJ(e){let t=bJ(e);return(n,r,i)=>r===void 0||i===void 0?e(`subject`,{kind:t(n.kind),label:n.value}):e(`subjectWithPosition`,{kind:t(n.kind),label:n.value,done:r+1,total:i})}function bJ(e){return t=>{switch(t){case`entity-type`:return e(`subjectKindEntityType`);case`category`:return e(`subjectKindCategory`);default:return t}}}function xJ(e){return t=>{switch(t){case`entity-types`:return e(`paramEntityTypes`);case`instructions`:return e(`paramInstructions`);case`tone`:return e(`paramTone`);case`density`:return e(`paramDensity`);default:return t}}}function SJ(e,t){return{cancel:e(`cancel`),close:e(`close`),inProgress:e(`inProgress`),message:_J(e),subject:yJ(e),paramLabel:xJ(e),...t?.found?{found:t.found}:{}}}function CJ({session:e,annotationType:t,isAssisting:n,locale:r,sourceLanguage:i,progress:a}){let o=Em(t===`highlight`?`HighlightPanel`:t===`assessment`?`AssessmentPanel`:`CommentsPanel`),s=Em(`AssistProgress`),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(t===`assessment`?4:5),[m,h]=(0,y.useState)(!0),g=(0,y.useCallback)(()=>{let n=t===`highlight`?`highlighting`:t===`assessment`?`assessing`:`commenting`;e?.client.mark.requestAssist(n,{instructions:c.trim()||void 0,tone:(t===`comment`||t===`assessment`)&&u?u:void 0,density:m?f:void 0,language:t===`comment`||t===`assessment`?r:void 0,sourceLanguage:i}),l(``),d(``)},[t,c,u,m,f,r,i,e]),_=(0,y.useCallback)(()=>{e?.client.mark.dismissProgress()},[e]);return(0,I.jsx)(YH,{assistType:t,title:o(t===`highlight`?`annotateHighlights`:t===`assessment`?`annotateAssessments`:`annotateComments`),isAssisting:n,progress:a,progressProps:{onDismiss:_,translations:{cancel:o(`cancel`),inProgress:o(`annotating`),close:s(`close`),message:_J(s),subject:yJ(s),paramLabel:xJ(s)}},form:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label`,children:[o(`instructions`),` `,o(`optional`)]}),(0,I.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),className:`semiont-textarea`,rows:3,placeholder:o(`instructionsPlaceholder`),maxLength:500}),(0,I.jsxs)(`div`,{className:`semiont-form-field__char-count`,children:[c.length,`/500`]})]}),(t===`comment`||t===`assessment`)&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label`,children:[o(`toneLabel`),` `,o(`toneOptional`)]}),(0,I.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:``,children:`Default`}),t===`comment`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`option`,{value:`scholarly`,children:o(`toneScholarly`)}),(0,I.jsx)(`option`,{value:`explanatory`,children:o(`toneExplanatory`)}),(0,I.jsx)(`option`,{value:`conversational`,children:o(`toneConversational`)}),(0,I.jsx)(`option`,{value:`technical`,children:o(`toneTechnical`)})]}),t===`assessment`&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`option`,{value:`analytical`,children:o(`toneAnalytical`)}),(0,I.jsx)(`option`,{value:`critical`,children:o(`toneCritical`)}),(0,I.jsx)(`option`,{value:`balanced`,children:o(`toneBalanced`)}),(0,I.jsx)(`option`,{value:`constructive`,children:o(`toneConstructive`)})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsxs)(`div`,{className:`semiont-form-field__header`,children:[(0,I.jsxs)(`label`,{className:`semiont-form-field__label semiont-form-field__label--with-checkbox`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked),className:`semiont-checkbox`,"data-variant":t}),(0,I.jsx)(`span`,{children:o(`densityLabel`)})]}),m&&(0,I.jsx)(`span`,{className:`semiont-form-field__info`,children:o(`densityPerWords`,{density:f})})]}),m&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`input`,{type:`range`,min:t===`comment`?`2`:`1`,max:t===`comment`?`12`:t===`assessment`?`10`:`15`,value:f,onChange:e=>p(Number(e.target.value)),className:`semiont-slider`}),(0,I.jsxs)(`div`,{className:`semiont-slider__labels`,children:[(0,I.jsx)(`span`,{children:o(`densitySparse`)}),(0,I.jsx)(`span`,{children:o(`densityDense`)})]})]})]}),(0,I.jsxs)(`button`,{onClick:g,className:`semiont-button`,"data-variant":`assist`,"data-type":t,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:o(`annotate`)})]})]})})}function wJ({count:e,title:t}){return(0,I.jsx)(`div`,{className:`semiont-panel-header`,children:(0,I.jsxs)(`h2`,{className:`semiont-panel-header__title`,children:[(0,I.jsx)(`span`,{className:`semiont-panel-header__text`,children:t}),(0,I.jsxs)(`span`,{className:`semiont-panel-header__count`,children:[`(`,e,`)`]})]})})}function TJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function EJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,isAssisting:i=!1,progress:a,locale:o,sourceLanguage:s,annotateMode:c=!0,scrollToAnnotationId:l,onScrollCompleted:u,hoveredAnnotationId:d}){let f=Em(`AssessmentPanel`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),_=(0,y.useRef)(null),v=(0,y.useRef)(new Map),b=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),x=(0,y.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!l)return;let e=v.current.get(l);if(e&&_.current){let t=e.offsetTop,n=_.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;_.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),u&&u()}},[l]),(0,y.useEffect)(()=>{if(!d)return;let e=v.current.get(d);if(!e||!_.current)return;let t=_.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[d]),(0,y.useEffect)(()=>{if(!r)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),m(``))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[r,e]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{g(e),setTimeout(()=>g(null),3e3)},[])}),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`assessment`,count:n.length,title:f(`title`)}),r&&r.motivation===`assessing`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`assessment`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=TJ(r.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()}),(0,I.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),className:`semiont-textarea`,rows:3,placeholder:f(`assessmentPlaceholder`),autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-prompt__char-count`,children:[p.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),m(``)},className:`semiont-button semiont-button--secondary`,"data-type":`assessment`,children:f(`cancel`)}),(0,I.jsx)(`button`,{onClick:()=>{if(r){let n=p.trim(),i=n?{type:`TextualBody`,value:n,purpose:`assessing`}:void 0;e?.client.mark.submit({source:t,motivation:`assessing`,selector:r.selector,...i===void 0?{}:{body:i}}),m(``)}},className:`semiont-button semiont-button--primary`,"data-type":`assessment`,children:f(`save`)})]})]})]}),(0,I.jsxs)(`div`,{ref:_,className:`semiont-panel__content`,children:[c&&(0,I.jsx)(CJ,{session:e,annotationType:`assessment`,isAssisting:i,locale:o,sourceLanguage:s,progress:a}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:b.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noAssessments`)}):b.map(t=>(0,I.jsx)(gJ,{session:e,assessment:t,isFocused:t.id===h,isHovered:t.id===d,ref:e=>x(t.id,e)},t.id))})]})]})}function DJ(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}if(e>=1e3){let t=e/1e3;return`${Number.isInteger(t)?t:t.toFixed(1)}K`}return String(e)}function OJ({state:e,eventCount:t,lastEventTimestamp:n,knowledgeBaseName:r,collaborators:i}){let a=Em(`CollaborationPanel`),o=(i??[]).filter(e=>e.agent[`@type`]===`Software`),s=e===`open`||e===`reconnecting`||e===`initial`||e===`connecting`,c;if(!n)c=a(`noActivity`);else{let e=new Date,t=new Date(n),r=e.getTime()-t.getTime(),i=Math.floor(r/1e3),o=Math.floor(i/60),s=Math.floor(o/60);c=i<10?a(`justNow`):i<60?a(`secondsAgo`,{count:i}):o===1?a(`minuteAgo`):o<60?a(`minutesAgo`,{count:o}):s===1?a(`hourAgo`):s<24?a(`hoursAgo`,{count:s}):t.toLocaleDateString()}return(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__title`,children:a(`title`)}),r&&(0,I.jsx)(`div`,{style:{padding:`0 0.75rem 0.5rem`,fontSize:`0.8rem`,color:`var(--semiont-color-neutral-400)`},children:r}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`connectionStatus`)}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__status`,children:[(0,I.jsxs)(`span`,{className:`semiont-collaboration-panel__indicator`,children:[(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__dot`,"data-connected":s?`true`:`false`}),(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__status-text`,"data-connected":s?`true`:`false`,children:a(s?`live`:`disconnected`)})]}),s&&t>0&&(0,I.jsxs)(`span`,{className:`semiont-collaboration-panel__event-count`,children:[`(`,a(`events`,{count:t}),`)`]})]}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__details`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__label`,children:a(`lastSync`)}),` `,c]}),(0,I.jsx)(`div`,{children:a(s?`realtimeActive`:`reconnecting`)})]})]}),o.length>0&&(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section semiont-collaboration-panel__section--bordered`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`collaborators`)}),o.map((e,t)=>{let n=e.agent,r=e.limits,i=r?r.maxOutputTokens===r.contextTokens?a(`sharedWindow`,{contextTokens:DJ(r.contextTokens)}):a(`ceilings`,{contextTokens:DJ(r.contextTokens),maxOutputTokens:DJ(r.maxOutputTokens)}):null;return(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__collaborator`,"data-testid":`semiont-collaborator-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__collaborator-id`,children:[n.provider&&(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__collaborator-provider`,children:n.provider}),(0,I.jsx)(`span`,{className:`semiont-collaboration-panel__collaborator-model`,children:n.model??n.name})]}),e.servesJobTypes&&e.servesJobTypes.length>0&&(0,I.jsx)(`div`,{className:`semiont-collaboration-panel__collaborator-jobs`,children:e.servesJobTypes.join(`, `)}),i&&(0,I.jsx)(`div`,{className:`semiont-collaboration-panel__collaborator-limits`,children:i})]},n[`@id`]??`${n.provider}:${n.model}:${t}`)})]}),(0,I.jsxs)(`div`,{className:`semiont-collaboration-panel__section semiont-collaboration-panel__section--bordered`,children:[(0,I.jsx)(`h3`,{className:`semiont-collaboration-panel__heading`,children:a(`sharing`)}),(0,I.jsx)(`p`,{className:`semiont-collaboration-panel__description`,children:a(`collaborationComingSoon`)})]})]})}function kJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function AJ({session:e,comment:t,isFocused:n,isHovered:r=!1,annotateMode:i=!0,ref:a}){let o=Em(`CommentsPanel`),s=tF(e,t.id),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),f=(0,y.useRef)(null);(0,y.useImperativeHandle)(a,()=>f.current);let p=kr(t)||``,m=Mr(t);(0,y.useEffect)(()=>{n&&f.current&&f.current.scrollIntoView({behavior:`smooth`,block:`center`})},[n]);let h=()=>{d(p),l(!0)},g=()=>{l(!1)},_=()=>{l(!1),d(``)};return(0,I.jsxs)(`div`,{ref:f,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`comment`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...s,children:[m&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`comment`,children:[`"`,m.substring(0,100),m.length>100?`...`:``,`"`]}),c?(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__edit`,onClick:e=>e.stopPropagation(),children:[(0,I.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),className:`semiont-textarea`,rows:3,autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__edit-footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-entry__char-count`,children:[u.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__button-group`,children:[(0,I.jsx)(`button`,{onClick:g,className:`semiont-button semiont-button--primary`,"data-type":`comment`,children:o(`save`)}),(0,I.jsx)(`button`,{onClick:_,className:`semiont-button semiont-button--secondary`,children:o(`cancel`)})]})]})]}):(0,I.jsx)(`div`,{className:`semiont-annotation-entry__body`,children:p}),!c&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__footer`,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,kJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]}),i&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__actions`,onClick:e=>e.stopPropagation(),children:(0,I.jsx)(`button`,{onClick:h,className:`semiont-text-button`,"data-variant":`comment`,children:o(`edit`)})})]})]})}function jJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function MJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,annotateMode:i=!0,isAssisting:a=!1,progress:o,locale:s,sourceLanguage:c,scrollToAnnotationId:l,onScrollCompleted:u,hoveredAnnotationId:d}){let f=Em(`CommentsPanel`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),_=(0,y.useRef)(null),v=(0,y.useRef)(new Map),b=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),x=(0,y.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!l)return;let e=v.current.get(l);if(e&&_.current){let t=e.offsetTop,n=_.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;_.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),u&&u()}},[l]),(0,y.useEffect)(()=>{if(!d)return;let e=v.current.get(d);if(!e||!_.current)return;let t=_.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[d]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{g(e),setTimeout(()=>g(null),3e3)},[])}),(0,y.useEffect)(()=>{if(!r)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),m(``))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[r,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`comment`,count:n.length,title:f(`title`)}),r&&r.motivation===`commenting`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`comment`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=jJ(r.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()}),(0,I.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),className:`semiont-textarea`,rows:3,placeholder:f(`commentPlaceholder`),autoFocus:!0,maxLength:2e3}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__footer`,children:[(0,I.jsxs)(`span`,{className:`semiont-annotation-prompt__char-count`,children:[p.length,`/2000`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),m(``)},className:`semiont-button semiont-button--secondary`,"data-type":`comment`,children:f(`cancel`)}),(0,I.jsx)(`button`,{onClick:()=>{p.trim()&&r&&(e?.client.mark.submit({source:t,motivation:`commenting`,selector:r.selector,body:[{type:`TextualBody`,value:p,purpose:`commenting`}]}),m(``))},disabled:!p.trim(),className:`semiont-button semiont-button--primary`,"data-type":`comment`,children:f(`save`)})]})]})]}),(0,I.jsxs)(`div`,{ref:_,className:`semiont-panel__content`,children:[i&&(0,I.jsx)(CJ,{session:e,annotationType:`comment`,isAssisting:a,locale:s,sourceLanguage:c,progress:o}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:b.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noComments`)}):b.map(t=>(0,I.jsx)(AJ,{session:e,comment:t,isFocused:t.id===h,isHovered:t.id===d,annotateMode:i,ref:e=>x(t.id,e)},t.id))})]})]})}function NJ(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i} minute${i>1?`s`:``} ago`:a<24?`${a} hour${a>1?`s`:``} ago`:o<7?`${o} day${o>1?`s`:``} ago`:t.toLocaleDateString()}function PJ({session:e,highlight:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t);return(0,I.jsxs)(`div`,{ref:i,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`highlight`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...a,children:[o&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`highlight`,children:[`"`,o.substring(0,200),o.length>200?`...`:``,`"`]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`By `,typeof t.creator==`string`?t.creator:t.creator?.name||`Unknown`,` • `,NJ(t.created||new Date().toISOString())]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function FJ({session:e,resourceId:t,annotations:n,pendingAnnotation:r,isAssisting:i=!1,progress:a,annotateMode:o=!0,scrollToAnnotationId:s,onScrollCompleted:c,hoveredAnnotationId:l,sourceLanguage:u}){let d=Em(`HighlightPanel`),[f,p]=(0,y.useState)(null),m=(0,y.useRef)(null),h=(0,y.useRef)(new Map),g=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),_=(0,y.useCallback)((e,t)=>{t?h.current.set(e,t):h.current.delete(e)},[]);return(0,y.useEffect)(()=>{if(!s)return;let e=h.current.get(s);if(e&&m.current){let t=e.offsetTop,n=m.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;m.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),c&&c()}},[s]),(0,y.useEffect)(()=>{if(!l)return;let e=h.current.get(l);if(!e||!m.current)return;let t=m.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[l]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{p(e),setTimeout(()=>p(null),3e3)},[])}),(0,y.useEffect)(()=>{r&&r.motivation===`highlighting`&&e?.client.mark.submit({source:t,motivation:`highlighting`,selector:r.selector})},[r,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`highlight`,count:n.length,title:d(`title`)}),(0,I.jsxs)(`div`,{ref:m,className:`semiont-panel__content`,children:[o&&(0,I.jsx)(CJ,{session:e,annotationType:`highlight`,isAssisting:i,progress:a,sourceLanguage:u}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:g.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:d(`noHighlights`)}):g.map(t=>(0,I.jsx)(PJ,{session:e,highlight:t,isFocused:t.id===f,isHovered:t.id===l,ref:e=>_(t.id,e)},t.id))})]})]})}function IJ(e){let t=Z(Up().activeSession$)?.client,[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!t||!e){a(!1);return}let n=!1;return a(!0),s(null),t.browse.resourceGraph(e).then(e=>{n||(r(e),a(!1))}).catch(e=>{n||(s(e instanceof Error?e:Error(String(e))),a(!1))}),()=>{n=!0}},[t,e]),{graph:n,loading:i,error:o}}function LJ({resourceId:e}){let t=(0,y.useRef)(null),n=(0,y.useRef)(null),{showLineNumbers:r}=zp(),{graph:i,loading:a,error:o}=IJ(e),s=i?JSON.stringify(i,null,2):``;return(0,y.useEffect)(()=>{if(!t.current||!s)return;let e=document.documentElement?.classList.contains(`dark`)??!1,i=[cU(),q.editable.of(!1),nE.readOnly.of(!0)];r&&i.push(_M()),e?i.push(TU):(i.push(AP),i.push(yP(jP)));let a=new q({state:nE.create({doc:s,extensions:i}),parent:t.current});return n.current=a,()=>{a.destroy(),n.current=null}},[s,r]),(0,I.jsxs)(`div`,{className:`semiont-jsonld-panel`,children:[(0,I.jsxs)(`div`,{className:`semiont-jsonld-panel__header`,children:[(0,I.jsx)(`h3`,{className:`semiont-jsonld-panel__title`,children:`JSON-LD`}),(0,I.jsx)(`button`,{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s)}catch(e){console.error(`Failed to copy JSON-LD:`,e)}},className:`semiont-button semiont-button--icon`,title:`Copy to clipboard`,disabled:!i,children:`📋 Copy`})]}),a&&(0,I.jsx)(`p`,{className:`semiont-jsonld-panel__status`,role:`status`,children:`Loading JSON-LD…`}),o&&!a&&(0,I.jsx)(`p`,{className:`semiont-jsonld-panel__status semiont-jsonld-panel__status--error`,role:`alert`,children:`Failed to load JSON-LD.`}),(0,I.jsx)(`div`,{ref:t,className:`semiont-jsonld-panel__editor`})]})}function RJ(e){if(Array.isArray(e.body)){let t=[];for(let n of e.body)if(typeof n==`object`&&n&&`type`in n&&`value`in n&&`purpose`in n){let e=n.type,r=n.value,i=n.purpose;e===`TextualBody`&&i===`tagging`&&typeof r==`string`&&r.length>0&&t.push(r)}return t}return[]}function zJ(e){return e.motivation===`tagging`}function BJ(e){if(!zJ(e))return;let t=(Array.isArray(e.body)?e.body:[e.body]).find(e=>typeof e==`object`&&!!e&&`purpose`in e&&e.purpose===`tagging`);if(t&&`value`in t)return t.value}function VJ(e){if(!zJ(e))return;let t=(Array.isArray(e.body)?e.body:[e.body]).find(e=>typeof e==`object`&&!!e&&`purpose`in e&&e.purpose===`classifying`);if(t&&`value`in t)return t.value}function HJ({session:e,reference:t,isFocused:n,isHovered:r=!1,onOpenResource:i,annotateMode:a=!0,isGenerating:o=!1,sparkle:s=!1,ref:c}){let l=Em(`ReferencesPanel`),u=e?.client,d=tF(e,t.id),f=Mr(t)||``,p=Sr(t.body),m=p?xr(t.body):null,h=RJ(t),g=Cr(t.target),_=br(g),v=yr(g),y=_?`Fragment annotation`:v?`Image annotation`:`Annotation`,b=t,x=b._resolvedDocumentName,S=b._resolvedDocumentMediaType,C=KP(S),w=()=>{m&&i?.(m)},T=typeof t.target==`object`&&`source`in t.target?t.target.source:``,E=()=>{T&&m&&u&&u.bind.body(ur(T),t.id,[{op:`remove`,item:{type:`SpecificResource`,source:m,purpose:`linking`}}]).catch(e=>{u.bind.reportBodyError({resourceId:T,message:e instanceof Error?e.message:String(e)})})},D=()=>{e?.client.bind.initiate({annotationId:t.id,resourceId:ur(T),defaultTitle:f,entityTypes:h})},O=e=>{e.stopPropagation(),p?w():a&&D()},k=p||a;return(0,I.jsxs)(`div`,{ref:c,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`reference`,"data-focused":n?`true`:`false`,onClick:()=>{e?.client.browse.click(t.id)},...d,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__header`,children:[(0,I.jsxs)(`div`,{className:`semiont-reference-icon-group`,children:[(0,I.jsx)(`button`,{className:`semiont-reference-icon${k?` semiont-reference-icon--clickable`:``}${s?` annotation-sparkle`:``}`,title:l(p?`open`:a?`resolve`:`stub`),onClick:k?O:void 0,"data-generating":!p&&o?`true`:`false`,tabIndex:k?0:-1,children:p?`🔗`:`❓`}),a&&p&&(0,I.jsx)(`button`,{className:`semiont-reference-unlink`,title:l(`unlink`),onClick:e=>{e.stopPropagation(),E()},children:`⛓️‍💥`})]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__content`,children:[f&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`reference`,children:[`"`,f.substring(0,100),f.length>100?`...`:``,`"`]}),!f&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__meta`,children:!g&&x?l(`derived`):y}),x&&(0,I.jsx)(`div`,{className:`semiont-reference-link`,children:(0,I.jsxs)(`span`,{children:[`→ `,C,` `,x]})})]})]}),h.length>0&&(0,I.jsx)(`div`,{className:`semiont-annotation-entry__tags`,children:h.map((e,t)=>(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:e},t))}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function UJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function WJ({session:e,onOpenResource:t,resourceId:n,annotations:r=[],isAssisting:i,progress:a,annotateMode:o=!0,Link:s,routes:c,allEntityTypes:l,entityTypesError:u=null,generatingReferenceId:d,referencedBy:f=[],referencedByLoading:p=!1,referencedByError:m=null,onRetryReferencedBy:h,pendingAnnotation:g,scrollToAnnotationId:_,onScrollCompleted:v,hoveredAnnotationId:b,sparkleAnnotationIds:x,locale:S,sourceLanguage:C}){let w=Em(`ReferencesPanel`),T=Em(`AssistProgress`),[E,D]=(0,y.useState)([]),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)([]),[ee,M]=(0,y.useState)(!1),[N,te]=(0,y.useState)(null),ne=(0,y.useRef)(null),re=(0,y.useRef)(new Map),ie=(0,y.useMemo)(()=>[...r].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[r]),ae=(0,y.useCallback)((e,t)=>{t?re.current.set(e,t):re.current.delete(e)},[]);(0,y.useEffect)(()=>{if(!_)return;let e=re.current.get(_);if(e&&ne.current){let t=e.offsetTop,n=ne.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;ne.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),v&&v()}else console.warn(`[ReferencesPanel] Element not found for scrollToAnnotationId:`,_)},[_]),(0,y.useEffect)(()=>{if(!b)return;let e=re.current.get(b);if(!e||!ne.current)return;let t=ne.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[b]),hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{te(e),setTimeout(()=>te(null),3e3)},[])});let oe=()=>{k(null),e?.client.mark.requestAssist(`linking`,{entityTypes:E,includeDescriptiveReferences:ee,language:S,sourceLanguage:C})},se=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(i){se.current=!1;return}!se.current&&a?.completedItems&&(se.current=!0,k(a.completedItems),D([]))},[i,a?.completedItems]);let ce=e=>{j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,y.useEffect)(()=>{if(!g)return;let t=t=>{t.key===`Escape`&&(e?.client.mark.cancelPending(),j([]))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[g,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`reference`,count:r.length,title:w(`title`)}),g&&g.motivation===`linking`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`reference`,children:[(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(()=>{let e=UJ(g.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:w(`fragmentSelected`)})()}),l.length>0&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`p`,{className:`semiont-form-field__label`,children:w(`entityTypesOptional`)}),(0,I.jsx)(`div`,{className:`semiont-tag-selector`,children:l.map(e=>(0,I.jsx)(`button`,{onClick:()=>ce(e),className:`semiont-tag-selector__item`,"data-selected":A.includes(e)?`true`:`false`,children:e},e))})]}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__footer`,children:(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>{e?.client.mark.cancelPending(),j([])},className:`semiont-button semiont-button--secondary`,"data-type":`reference`,children:w(`cancel`)}),(0,I.jsxs)(`button`,{onClick:()=>{if(g){let t=A.join(`,`)||void 0;e?.client.mark.submit({source:n,motivation:`linking`,selector:g.selector,...t?{body:[{type:`TextualBody`,value:t,purpose:`tagging`}]}:{}}),j([])}},className:`semiont-button semiont-button--primary`,"data-type":`reference`,children:[`🔗 `,w(`createReference`)]})]})})]}),(0,I.jsxs)(`div`,{ref:ne,className:`semiont-panel__content`,children:[o&&(0,I.jsx)(YH,{assistType:`reference`,title:w(`annotateReferences`),isAssisting:i,progress:a,progressProps:{onCancel:()=>e?.client.job.cancelRequest(`annotation`),onDismiss:()=>e?.client.mark.dismissProgress(),translations:SJ(T,{found:e=>w(`found`,{count:e})})},form:(0,I.jsxs)(I.Fragment,{children:[O&&(0,I.jsx)(qH,{entries:O,formatFound:e=>w(`found`,{count:e})}),(0,I.jsxs)(`div`,{className:`semiont-assist-widget__entity-types`,children:[(0,I.jsx)(`p`,{className:`semiont-assist-widget__label`,children:w(`selectEntityTypes`)}),(0,I.jsx)(`div`,{className:`semiont-assist-widget__chips`,children:l.length>0?l.map(e=>(0,I.jsx)(`button`,{onClick:()=>{D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},"aria-pressed":E.includes(e),"aria-label":`${E.includes(e)?w(`deselect`):w(`select`)} ${e}`,className:`semiont-chip semiont-chip--selectable`,"data-selected":E.includes(e),children:e},e)):(0,I.jsx)(`p`,{className:`semiont-assist-widget__no-types`,children:w(u?`entityTypesFailed`:`noEntityTypes`)})})]}),E.length>0&&(0,I.jsx)(`p`,{className:`semiont-assist-widget__count`,children:w(`typesSelected`,{count:E.length})}),(0,I.jsxs)(`div`,{className:`semiont-assist-widget__checkbox-group`,children:[(0,I.jsxs)(`label`,{className:`semiont-assist-widget__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:e=>M(e.target.checked),className:`semiont-assist-widget__checkbox`}),(0,I.jsx)(`span`,{children:w(`includeDescriptiveReferences`)})]}),(0,I.jsx)(`p`,{className:`semiont-assist-widget__checkbox-hint`,children:w(`descriptiveReferencesTooltip`)})]}),(0,I.jsxs)(`button`,{onClick:oe,disabled:E.length===0,title:w(`annotate`),className:`semiont-button`,"data-variant":`assist`,"data-type":`reference`,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:w(`annotate`)})]})]})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-panel__divider`,children:(0,I.jsxs)(`h3`,{className:`semiont-panel__subtitle`,children:[w(`outgoingReferences`),` (`,ie.length,`)`]})}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:ie.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty-message`,children:w(`noReferences`)}):ie.map(n=>(0,I.jsx)(HJ,{session:e,reference:n,isFocused:n.id===N,isHovered:n.id===b,onOpenResource:t,annotateMode:o,isGenerating:n.id===d,sparkle:x?.has(n.id)??!1,ref:e=>ae(n.id,e)},n.id))})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-panel__divider`,children:(0,I.jsxs)(`h3`,{className:`semiont-panel__subtitle`,children:[w(`incomingReferences`),` (`,f.length,`)`,p&&!m&&(0,I.jsxs)(`span`,{className:`semiont-panel__loading-indicator`,children:[`(`,w(`loading`),`)`]})]})}),m?(0,I.jsxs)(`p`,{className:`semiont-panel__empty-message semiont-panel__empty-message--small`,children:[w(`incomingReferencesFailed`),h&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:h,className:`semiont-panel__inline-action`,children:w(`retry`)})]})]}):f.length>0?(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:f.map(e=>{let t=e.target.source;return(0,I.jsxs)(`div`,{className:`semiont-reference-item semiont-reference-item--incoming`,children:[(0,I.jsxs)(`div`,{className:`semiont-reference-item__header`,children:[(0,I.jsx)(`span`,{className:`semiont-reference-item__title`,children:e.resourceName||w(`untitledResource`)}),(0,I.jsx)(s,{href:c.resourceDetail(t),className:`semiont-reference-item__link`,title:w(`open`),children:`🔗`})]}),(0,I.jsxs)(`span`,{className:`semiont-reference-item__excerpt`,children:[`"`,e.target.selector?.exact||w(`noText`),`"`]})]},e.id)})}):(0,I.jsx)(`p`,{className:`semiont-panel__empty-message semiont-panel__empty-message--small`,children:w(p?`loadingEllipsis`:`noIncomingReferences`)})]})]})]})}function GJ({session:e,resourceId:t,documentEntityTypes:n,documentLocale:r,primaryMediaType:i,primaryByteSize:a,storageUri:o,isArchived:s=!1,dateCreated:c,dateModified:l,wasAttributedTo:u,wasDerivedFrom:d,generator:f,onGenerate:p,isGenerating:m=!1,generationProgress:h=null,generationOutcome:g=null,onDismissProgress:_}){let v=Em(`ResourceInfoPanel`),y=Em(`AssistProgress`),b=u?Array.isArray(u)?u:[u]:f?Array.isArray(f)?f:[f]:[];return(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__title`,children:v(`title`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`locale`)}),r?(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__value`,children:ai(r)}):(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__value semiont-resource-info-panel__value--empty`,children:v(`notSpecified`)})]}),(i||a!==void 0)&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`representation`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__field-group`,children:[i&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`mediaType`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:i})]}),a!==void 0&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`byteSize`)}),(0,I.jsxs)(`span`,{className:`semiont-resource-info-panel__value`,children:[a.toLocaleString(),` bytes`]})]}),o&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`storageUri`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:o})]})]})]}),(c||l||b.length>0||d)&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`provenance`)}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__field-group`,children:[c&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`createdAt`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:new Date(c).toLocaleString()})]}),l&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`modifiedAt`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:new Date(l).toLocaleString()})]}),b.length>0&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`attributedTo`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:b.map(fJ).join(`, `)})]}),d&&(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__label`,children:v(`derivedFrom`)}),(0,I.jsx)(`span`,{className:`semiont-resource-info-panel__value`,children:(Array.isArray(d)?d:[d]).map((t,n)=>(0,I.jsx)(KJ,{session:e,id:t,first:n===0},t))})]})]})]}),n.length>0&&(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__section`,children:[(0,I.jsx)(`h3`,{className:`semiont-resource-info-panel__heading`,children:v(`entityTypeTags`)}),(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__tag-list`,children:n.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:e},e))})]}),p&&(0,I.jsx)(YH,{assistType:`generation`,title:v(`generate`),isAssisting:m,progress:h,progressProps:{onCancel:()=>e?.client.job.cancelRequest(`generation`),..._?{onDismiss:_}:{},...g?{outcome:{label:g.resourceName,onOpen:()=>e?.client.browse.openResource(g.resourceId)},endedMessage:g.truncated?y(`codeCompleteGeneratedTruncated`):y(`codeCompleteGenerated`)}:{},translations:SJ(y)},form:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:p,className:`semiont-resource-button semiont-resource-button--secondary`,children:[`✨ `,v(`generate`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`generateDescription`)})]})}),(0,I.jsxs)(`div`,{className:`semiont-resource-info-panel__action-section`,children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.yield.clone(),className:`semiont-resource-button semiont-resource-button--secondary`,children:[`🔗 `,v(`clone`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`cloneDescription`)})]}),(0,I.jsx)(`div`,{className:`semiont-resource-info-panel__action-section`,children:s?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.mark.unarchive(ur(t)),className:`semiont-resource-button semiont-resource-button--secondary`,children:[`📤 `,v(`unarchive`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`unarchiveDescription`)})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{onClick:()=>e?.client.mark.archive(ur(t)),className:`semiont-resource-button semiont-resource-button--archive`,children:[`📦 `,v(`archive`)]}),(0,I.jsx)(`p`,{className:`semiont-resource-info-panel__description`,children:v(`archiveDescription`)})]})})]})}function KJ({session:e,id:t,first:n}){let r=Z(e?e.client.browse.resource(ur(t)):null),i=r?fc(r)?.name:void 0;return(0,I.jsxs)(`button`,{className:`semiont-resource-info-panel__link`,onClick:()=>e?.client.browse.openResource(ur(t)),children:[!n&&`, `,i??t]})}function qJ({highlights:e,comments:t,assessments:n,references:r,tags:i}){let a=Em(`StatisticsPanel`),o=r.filter(e=>!Sr(e.body)).length,s=r.filter(e=>Sr(e.body)).length,c=new Map;r.forEach(e=>{RJ(e).forEach(e=>{c.set(e,(c.get(e)||0)+1)})});let l=Array.from(c.entries()).sort((e,t)=>t[1]-e[1]);return(0,I.jsx)(`div`,{className:`semiont-statistics-panel`,children:(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__content`,children:[(0,I.jsx)(`h2`,{className:`semiont-statistics-panel__title`,children:a(`title`)}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__list`,children:[(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`highlights`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:e.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`comments`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:t.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`assessments`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:n.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`tags`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:i.length})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`references`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__value`,children:r.length}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitems`,children:[(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitem`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__sublabel`,children:a(`stub`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__subvalue`,children:o})]}),(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__subitem`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__sublabel`,children:a(`resolved`)}),(0,I.jsx)(`span`,{className:`semiont-statistics-panel__subvalue`,children:s})]})]})]}),l.length>0&&(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__entity-types`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__label`,children:a(`entityTypes`)}),(0,I.jsx)(`div`,{className:`semiont-statistics-panel__entity-list`,children:l.map(([e,t])=>(0,I.jsxs)(`div`,{className:`semiont-statistics-panel__entity-item`,children:[(0,I.jsx)(`span`,{className:`semiont-statistics-panel__entity-name`,children:e}),(0,I.jsx)(`span`,{className:`semiont-tag`,"data-variant":`blue`,children:t})]},e))})]})]})]})})}function JJ({session:e,tag:t,isFocused:n,isHovered:r=!1,ref:i}){let a=tF(e,t.id),o=Mr(t),s=BJ(t),c=VJ(t),l=Z((0,y.useMemo)(()=>e?.client.browse.tagSchemas()??null,[e])),u=c&&l&&dc(l)?l.value.find(e=>e.id===c)??null:null;return(0,I.jsxs)(`div`,{ref:i,onClick:()=>{e?.client.browse.click(t.id)},...a,className:`semiont-annotation-entry${r?` semiont-annotation-pulse`:``}`,"data-type":`tag`,"data-focused":n?`true`:`false`,children:[(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__header`,children:[(0,I.jsx)(`span`,{className:`semiont-tag-badge`,"data-variant":`tag`,children:s}),u&&(0,I.jsx)(`span`,{className:`semiont-annotation-entry__meta`,children:u.name})]}),(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__quote`,"data-type":`tag`,children:[`"`,o.substring(0,150),o.length>150?`...`:``,`"`]}),t.generator&&(0,I.jsxs)(`div`,{className:`semiont-annotation-entry__metadata`,children:[`Via `,Array.isArray(t.generator)?t.generator.map(fJ).join(`, `):fJ(t.generator)]})]})}function YJ(e){if(Array.isArray(e)){let t=e.find(e=>e.type===`TextQuoteSelector`);if(t&&`exact`in t)return t.exact}else if(e.type===`TextQuoteSelector`&&`exact`in e)return e.exact;return null}function XJ({session:e,resourceId:t,annotations:n,annotateMode:r=!0,isAssisting:i=!1,progress:a,pendingAnnotation:o,scrollToAnnotationId:s,onScrollCompleted:c,hoveredAnnotationId:l,locale:u,sourceLanguage:d}){let f=Em(`TaggingPanel`),p=Em(`AssistProgress`),m=(0,y.useCallback)(()=>{e?.client.mark.dismissProgress()},[e]),h=Z((0,y.useMemo)(()=>e?.client.browse.tagSchemas()??null,[e])),g=h&&dc(h)?h.value:void 0,_=g??[],v=g!==void 0&&g.length===0,[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(new Set);(0,y.useEffect)(()=>{!b&&_.length>0&&x(_[0].id)},[_,b]);let[w,T]=(0,y.useState)(null),E=(0,y.useRef)(null);hF(e,{"browse:click":(0,y.useCallback)(({annotationId:e})=>{T(e),setTimeout(()=>T(null),3e3)},[])});let D=(0,y.useRef)(new Map),O=(0,y.useMemo)(()=>[...n].sort((e,t)=>{let n=vr(Cr(e.target)),r=vr(Cr(t.target));return!n||!r?0:n.start-r.start}),[n]),k=(0,y.useCallback)((e,t)=>{t?D.current.set(e,t):D.current.delete(e)},[]);(0,y.useEffect)(()=>{if(!s)return;let e=D.current.get(s);if(e&&E.current){let t=e.offsetTop,n=E.current.clientHeight,r=e.offsetHeight,i=t-n/2+r/2;E.current.scrollTo({top:i,behavior:`smooth`}),e.classList.remove(`semiont-annotation-pulse`),e.offsetWidth,e.classList.add(`semiont-annotation-pulse`),c&&c()}},[s]),(0,y.useEffect)(()=>{if(!l)return;let e=D.current.get(l);if(!e||!E.current)return;let t=E.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(!(n.top>=r.top&&n.bottom<=r.bottom)){let n=e.offsetTop,r=t.clientHeight,i=e.offsetHeight,a=n-r/2+i/2;t.scrollTo({top:a,behavior:`smooth`})}},[l]);let A=_.find(e=>e.id===b),j=e=>{x(e),C(new Set)},ee=e=>{let t=new Set(S);t.has(e)?t.delete(e):t.add(e),C(t)};return(0,y.useEffect)(()=>{if(!o)return;let t=t=>{t.key===`Escape`&&e?.client.mark.cancelPending()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[o,e]),(0,I.jsxs)(`div`,{className:`semiont-panel`,children:[(0,I.jsx)(wJ,{annotationType:`tag`,count:n.length,title:f(`title`)}),(0,I.jsxs)(`div`,{ref:E,className:`semiont-panel__content`,children:[o&&o.motivation===`tagging`&&(0,I.jsxs)(`div`,{className:`semiont-annotation-prompt`,"data-type":`tag`,children:[(0,I.jsx)(`h3`,{className:`semiont-annotation-prompt__title`,children:f(`createTagForSelection`)}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__quote`,children:(0,I.jsx)(`p`,{className:`semiont-annotation-prompt__text`,children:(()=>{let e=YJ(o.selector);return e?`"${e.substring(0,100)}${e.length>100?`...`:``}"`:f(`fragmentSelected`)})()})}),v&&(0,I.jsx)(`p`,{className:`semiont-form__help`,"data-type":`tag-no-schemas`,children:f(`noSchemas`)}),!v&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectSchema`)}),(0,I.jsx)(`select`,{value:b,onChange:e=>j(e.target.value),className:`semiont-select`,children:_.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),A&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectCategory`)}),(0,I.jsxs)(`select`,{className:`semiont-select`,onChange:n=>{n.target.value&&o&&e?.client.mark.submit({source:t,motivation:`tagging`,selector:o.selector,body:[{type:`TextualBody`,value:n.target.value,purpose:`tagging`},{type:`TextualBody`,value:b,purpose:`classifying`}]})},defaultValue:``,children:[(0,I.jsx)(`option`,{value:``,children:f(`chooseCategory`)}),A.tags.map(e=>(0,I.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,I.jsx)(`div`,{className:`semiont-annotation-prompt__footer`,children:(0,I.jsx)(`button`,{onClick:()=>e?.client.mark.cancelPending(),className:`semiont-button semiont-button--secondary`,"data-type":`tag`,children:f(`cancel`)})})]}),r&&(0,I.jsx)(YH,{assistType:`tag`,title:f(`annotateTags`),isAssisting:i,progress:a,progressProps:{onDismiss:m,translations:SJ(p)},form:(0,I.jsxs)(I.Fragment,{children:[v&&(0,I.jsx)(`p`,{className:`semiont-form__help`,"data-type":`tag-no-schemas`,children:f(`noSchemas`)}),!v&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectSchema`)}),(0,I.jsx)(`select`,{value:b,onChange:e=>j(e.target.value),className:`semiont-select`,children:_.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))}),A&&(0,I.jsx)(`p`,{className:`semiont-form__help`,children:A.description})]}),A&&(0,I.jsxs)(`div`,{className:`semiont-form-field`,children:[(0,I.jsx)(`label`,{className:`semiont-form-field__label`,children:f(`selectCategories`)}),(0,I.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginBottom:`0.75rem`},children:[(0,I.jsx)(`button`,{onClick:()=>{A&&C(new Set(A.tags.map(e=>e.name)))},type:`button`,className:`semiont-button--secondary`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.25rem 0.5rem`},children:f(`selectAll`)}),(0,I.jsx)(`button`,{onClick:()=>{C(new Set)},type:`button`,className:`semiont-button--secondary`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.25rem 0.5rem`},children:f(`deselectAll`)})]}),(0,I.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.75rem`},children:A.tags.map(e=>(0,I.jsxs)(`div`,{className:`semiont-form__checkbox-field`,children:[(0,I.jsx)(`input`,{type:`checkbox`,id:`category-${e.name.replace(/\s+/g,`-`)}`,checked:S.has(e.name),onChange:()=>ee(e.name),className:`semiont-checkbox`}),(0,I.jsxs)(`label`,{htmlFor:`category-${e.name.replace(/\s+/g,`-`)}`,className:`semiont-form__checkbox-label`,style:{display:`flex`,flexDirection:`column`,gap:`0.25rem`},children:[(0,I.jsx)(`span`,{style:{fontWeight:500},children:e.name}),(0,I.jsx)(`span`,{style:{fontSize:`var(--semiont-text-xs)`,color:`var(--semiont-text-secondary)`},children:e.description})]})]},e.name))}),(0,I.jsx)(`p`,{className:`semiont-form__help`,children:f(`categoriesSelected`,{count:S.size})})]}),(0,I.jsxs)(`button`,{onClick:()=>{S.size>0&&(e?.client.mark.requestAssist(`tagging`,{schemaId:b,categories:Array.from(S),language:u,sourceLanguage:d}),C(new Set))},disabled:S.size===0||i,className:`semiont-button`,"data-variant":`assist`,"data-type":`tag`,children:[(0,I.jsx)(`span`,{className:`semiont-button-icon`,children:`✨`}),(0,I.jsx)(`span`,{children:f(`annotate`)})]})]})}),(0,I.jsx)(`div`,{className:`semiont-panel__list`,children:O.length===0?(0,I.jsx)(`p`,{className:`semiont-panel__empty`,children:f(`noTags`)}):O.map(t=>(0,I.jsx)(JJ,{session:e,tag:t,isFocused:t.id===w,isHovered:t.id===l,ref:e=>k(t.id,e)},t.id))})]})]})}var ZJ=[`statistics`,`reference`,`highlight`,`assessment`,`comment`,`tag`];function QJ(e){let t=Em(`UnifiedAnnotationsPanel`),n={highlight:[],comment:[],assessment:[],reference:[],tag:[]};for(let t of e.annotations){let r=Object.values(e.annotators).find(e=>e.matchesAnnotation(t));r&&(n[r.internalType]||(n[r.internalType]=[]),n[r.internalType].push(t))}let r=n,[i,a]=(0,y.useState)(()=>{if(typeof window>`u`)return e.initialTab||`statistics`;let t=e.resourceId?`annotations-tab-${e.resourceId}`:`annotations-tab-global`,n=localStorage.getItem(t);return n&&ZJ.includes(n)?n:e.initialTab||`statistics`});(0,y.useEffect)(()=>{if(typeof window>`u`)return;let t=e.resourceId?`annotations-tab-${e.resourceId}`:`annotations-tab-global`;localStorage.setItem(t,i)},[i,e.resourceId]),(0,y.useEffect)(()=>{e.initialTab&&e.initialTabGeneration!==void 0&&a(e.initialTab)},[e.initialTabGeneration]),(0,y.useEffect)(()=>{if(e.pendingAnnotation){let t=Tw(e.pendingAnnotation.motivation);t&&a(t)}},[e.pendingAnnotation]);let o=e=>{a(e)},s=e=>`semiont-unified-panel__tab-button${i===e?` semiont-unified-panel__tab-button--active`:``}`;return e.annotationsError?(0,I.jsxs)(`div`,{className:`semiont-unified-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-unified-panel__title`,children:t(`title`)}),(0,I.jsxs)(`p`,{className:`semiont-unified-panel__error`,children:[t(`annotationsFailed`),e.onRetryAnnotations&&(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`button`,{type:`button`,onClick:e.onRetryAnnotations,className:`semiont-panel__inline-action`,children:t(`retry`)})]})]})]}):(0,I.jsxs)(`div`,{className:`semiont-unified-panel`,children:[(0,I.jsx)(`h3`,{className:`semiont-unified-panel__title`,children:t(`title`)}),(0,I.jsx)(`div`,{className:`semiont-unified-panel__tabs`,children:ZJ.map(n=>{if(n===`statistics`)return(0,I.jsx)(`button`,{onClick:()=>o(n),className:s(n),title:t(n),"aria-pressed":i===n,children:(0,I.jsx)(`span`,{className:`semiont-unified-panel__tab-icon`,children:`📊`})},n);let r=e.annotators[n];return r?(0,I.jsx)(`button`,{onClick:()=>o(n),className:s(n),title:t(n),"aria-pressed":i===n,children:(0,I.jsx)(`span`,{className:`semiont-unified-panel__tab-icon`,children:r.iconEmoji})},n):null})}),(0,I.jsx)(`div`,{className:`semiont-unified-panel__content`,children:(()=>{if(i===`statistics`)return(0,I.jsx)(qJ,{highlights:r.highlight||[],comments:r.comment||[],assessments:r.assessment||[],references:r.reference||[],tags:r.tag||[]});let t=e.annotators[i];if(!t)return null;let n=r[i]||[],a=e.assistingMotivation===t.motivation,o=a?e.progress??null:null,s={session:e.session,resourceId:e.resourceId,annotations:n,pendingAnnotation:e.pendingAnnotation,isAssisting:a,progress:o,annotateMode:e.annotateMode,locale:e.locale,sourceLanguage:e.sourceLanguage,scrollToAnnotationId:e.scrollToAnnotationId,onScrollCompleted:e.onScrollCompleted,hoveredAnnotationId:e.hoveredAnnotationId};return i===`highlight`?(0,I.jsx)(FJ,{...s}):i===`reference`?(0,I.jsx)(WJ,{session:s.session,onOpenResource:e.onOpenResource,resourceId:s.resourceId,annotations:s.annotations,pendingAnnotation:s.pendingAnnotation,isAssisting:s.isAssisting,progress:s.progress,annotateMode:s.annotateMode,scrollToAnnotationId:s.scrollToAnnotationId,onScrollCompleted:s.onScrollCompleted,hoveredAnnotationId:s.hoveredAnnotationId,locale:s.locale,sourceLanguage:s.sourceLanguage,allEntityTypes:e.allEntityTypes||[],entityTypesError:e.entityTypesError,generatingReferenceId:e.generatingReferenceId,referencedBy:e.referencedBy,referencedByLoading:e.referencedByLoading,referencedByError:e.referencedByError,onRetryReferencedBy:e.onRetryReferencedBy,sparkleAnnotationIds:e.sparkleAnnotationIds,Link:e.Link,routes:e.routes}):i===`assessment`?(0,I.jsx)(EJ,{...s}):i===`comment`?(0,I.jsx)(MJ,{...s}):i===`tag`?(0,I.jsx)(XJ,{...s}):null})()})]})}function $J({Link:e,routes:t,t:n,CookiePreferences:r,onOpenKeyboardHelp:i,sourceCodeUrl:a=`https://github.com/The-AI-Alliance/semiont`,showPolicyLinks:o=!0}){let[s,c]=(0,y.useState)(!1);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`footer`,{role:`contentinfo`,className:`semiont-footer`,children:(0,I.jsx)(`div`,{className:`semiont-footer__container`,children:(0,I.jsxs)(`div`,{className:`semiont-footer__content`,children:[(0,I.jsx)(`div`,{className:`semiont-footer__copyright`,children:n(`copyright`,{year:new Date().getFullYear()})}),(0,I.jsxs)(`div`,{className:`semiont-footer__links`,children:[o&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(e,{href:t.about?.()||`/about`,className:`semiont-footer__link`,children:n(`about`)}),(0,I.jsx)(e,{href:t.privacy?.()||`/privacy`,className:`semiont-footer__link`,children:n(`privacyPolicy`)}),r&&(0,I.jsx)(`button`,{onClick:()=>c(!0),className:`semiont-footer__link`,children:n(`cookiePreferences`)}),(0,I.jsx)(e,{href:t.terms?.()||`/terms`,className:`semiont-footer__link`,children:n(`termsOfService`)})]}),i&&(0,I.jsxs)(`button`,{onClick:i,className:`semiont-footer__link semiont-footer__link--keyboard`,children:[n(`keyboardShortcuts`),(0,I.jsx)(`kbd`,{className:`semiont-footer__kbd`,children:`?`})]}),(0,I.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,className:`semiont-footer__link`,children:n(`sourceCode`)})]})]})})}),o&&r&&(0,I.jsx)(r,{isOpen:s,onClose:()=>c(!1)})]})}function eY({Link:e,routes:t,t:n,isAdmin:r=!1,isModerator:i=!1,onItemClick:a,className:o=``,currentPath:s}){let c=o?`semiont-navigation-menu ${o}`:`semiont-navigation-menu`,l=e=>s?s===e||s.startsWith(e+`/`):!1;return(0,I.jsxs)(`nav`,{className:c,"aria-label":`Main navigation`,children:[(0,I.jsx)(e,{href:t.knowledge?.()||`/know`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.knowledge?.()||`/know`)?`page`:void 0,children:n(`know`)}),(i||r)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`hr`,{className:`semiont-navigation-menu__divider`}),(0,I.jsx)(e,{href:t.moderate?.()||`/moderate`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.moderate?.()||`/moderate`)?`page`:void 0,children:n(`moderate`)})]}),r&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`hr`,{className:`semiont-navigation-menu__divider`}),(0,I.jsx)(e,{href:t.admin?.()||`/admin`,...a&&{onClick:a},className:`semiont-navigation-menu__link`,"aria-current":l(t.admin?.()||`/admin`)?`page`:void 0,children:n(`administer`)})]})]})}function tY({title:e,items:t,currentPath:n,LinkComponent:r,dropdownContent:i,isCollapsed:a,icons:o,collapseSidebarLabel:s,expandSidebarLabel:c}){let l=o.chevronLeft,u=o.bars,[d,f]=(0,y.useState)(!1),p=(0,y.useRef)(null),m=Up(),h=()=>f(!d),g=()=>f(!1);return(0,y.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&g()};if(d)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,I.jsxs)(`div`,{className:`semiont-simple-nav`,children:[(0,I.jsxs)(`div`,{style:{position:`relative`},ref:i?p:void 0,children:[(0,I.jsxs)(`div`,{className:`semiont-nav-section__header`,children:[i?(0,I.jsx)(`button`,{onClick:h,className:`semiont-nav-section__header-button`,"aria-expanded":d,"aria-haspopup":`true`,type:`button`,children:!a&&(0,I.jsx)(`span`,{className:`semiont-nav-section__header-text`,children:e})}):!a&&(0,I.jsx)(`span`,{className:`semiont-nav-section__header-text`,children:e}),(0,I.jsx)(`button`,{onClick:()=>m.emit(`shell:sidebar-toggle`,void 0),className:`semiont-nav-section__header-icon`,title:a?c:s,"aria-label":a?c:s,type:`button`,children:a?(0,I.jsx)(u,{}):(0,I.jsx)(l,{})})]}),d&&i&&!a&&(0,I.jsx)(`div`,{className:`semiont-nav-section__dropdown`,children:i(g)})]}),!a&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:t.map(e=>{let t=n===e.href;return(0,I.jsxs)(r,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,children:[(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`semiont-nav-tab__text`,children:e.name})]},e.href)})}),a&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:t.map(e=>{let t=n===e.href;return(0,I.jsx)(r,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,"aria-label":e.name,children:(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`})},e.href)})})]})}function nY(){var e=[...arguments];return(0,y.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var rY=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function iY(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function aY(e){return`nodeType`in e}function oY(e){return e?iY(e)?e:aY(e)?e.ownerDocument?.defaultView??window:window:window}function sY(e){let{Document:t}=oY(e);return e instanceof t}function cY(e){return!iY(e)&&e instanceof oY(e).HTMLElement}function lY(e){return e instanceof oY(e).SVGElement}function uY(e){return e?iY(e)?e.document:aY(e)?sY(e)?e:cY(e)||lY(e)?e.ownerDocument:document:document:document}var dY=rY?y.useLayoutEffect:y.useEffect;function fY(e){let t=(0,y.useRef)(e);return dY(()=>{t.current=e}),(0,y.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function pY(){let e=(0,y.useRef)(null);return[(0,y.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,y.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function mY(e,t){t===void 0&&(t=[e]);let n=(0,y.useRef)(e);return dY(()=>{n.current!==e&&(n.current=e)},t),n}function hY(e,t){let n=(0,y.useRef)();return(0,y.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function gY(e){let t=fY(e),n=(0,y.useRef)(null);return[n,(0,y.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function _Y(e){let t=(0,y.useRef)();return(0,y.useEffect)(()=>{t.current=e},[e]),t.current}var vY={};function yY(e,t){return(0,y.useMemo)(()=>{if(t)return t;let n=vY[e]==null?0:vY[e]+1;return vY[e]=n,e+`-`+n},[e,t])}function bY(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var xY=bY(1),SY=bY(-1);function CY(e){return`clientX`in e&&`clientY`in e}function wY(e){if(!e)return!1;let{KeyboardEvent:t}=oY(e.target);return t&&e instanceof t}function TY(e){if(!e)return!1;let{TouchEvent:t}=oY(e.target);return t&&e instanceof t}function EY(e){if(TY(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return CY(e)?{x:e.clientX,y:e.clientY}:null}var DY=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[DY.Translate.toString(e),DY.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),OY=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function kY(e){return e.matches(OY)?e:e.querySelector(OY)}var AY={display:`none`};function jY(e){let{id:t,value:n}=e;return y.createElement(`div`,{id:t,style:AY},n)}function MY(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return y.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function NY(){let[e,t]=(0,y.useState)(``);return{announce:(0,y.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var PY=(0,y.createContext)(null);function FY(e){let t=(0,y.useContext)(PY);(0,y.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function IY(){let[e]=(0,y.useState)(()=>new Set),t=(0,y.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,y.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var LY={draggable:`
135
135
  To pick up a draggable item, press the space bar.
136
136
  While dragging, use the arrow keys to move the item.
137
137
  Press space again to drop the item in its new position, or press escape to cancel.
138
138
  `},RY={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function zY(e){let{announcements:t=RY,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=LY}=e,{announce:a,announcement:o}=NY(),s=yY(`DndLiveRegion`),[c,l]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{l(!0)},[]),FY((0,y.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=y.createElement(y.Fragment,null,y.createElement(jY,{id:r,value:i.draggable}),y.createElement(MY,{id:s,announcement:o}));return n?(0,jl.createPortal)(u,n):u}var BY;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(BY||={});function VY(){}function HY(e,t){return(0,y.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function UY(){var e=[...arguments];return(0,y.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var WY=Object.freeze({x:0,y:0});function GY(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function KY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function JY(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function YY(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function XY(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ZY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=XY(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=GY(XY(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(KY)},QY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=JY(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=JY(r),o=i.reduce((e,t,r)=>e+GY(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(KY)};function $Y(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var eX=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$Y(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(qY)};function tX(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nX(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:WY}function rX(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var iX=rX(1);function aX(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function oX(e,t,n){let r=aX(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var sX={ignoreTransform:!1};function cX(e,t){t===void 0&&(t=sX);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=oY(e).getComputedStyle(e);t&&(n=oX(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function lX(e){return cX(e,{ignoreTransform:!0})}function uX(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function dX(e,t){return t===void 0&&(t=oY(e).getComputedStyle(e)),t.position===`fixed`}function fX(e,t){t===void 0&&(t=oY(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function pX(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(sY(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!cY(i)||lY(i)||n.includes(i))return n;let a=oY(e).getComputedStyle(i);return i!==e&&fX(i,a)&&n.push(i),dX(i,a)?n:r(i.parentNode)}return e?r(e):n}function mX(e){let[t]=pX(e,1);return t??null}function hX(e){return!rY||!e?null:iY(e)?e:aY(e)?sY(e)||e===uY(e).scrollingElement?window:cY(e)?e:null:null}function gX(e){return iY(e)?e.scrollX:e.scrollLeft}function _X(e){return iY(e)?e.scrollY:e.scrollTop}function vX(e){return{x:gX(e),y:_X(e)}}var yX;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(yX||={});function bX(e){return!rY||!e?!1:e===document.scrollingElement}function xX(e){let t={x:0,y:0},n=bX(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var SX={x:.2,y:.2};function CX(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=SX);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=xX(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=yX.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=yX.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=yX.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=yX.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function wX(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function TX(e){return e.reduce((e,t)=>xY(e,vX(t)),WY)}function EX(e){return e.reduce((e,t)=>e+gX(t),0)}function DX(e){return e.reduce((e,t)=>e+_X(t),0)}function OX(e,t){if(t===void 0&&(t=cX),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);mX(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var kX=[[`x`,[`left`,`right`],EX],[`y`,[`top`,`bottom`],DX]],AX=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=pX(t),r=TX(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of kX)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},jX=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function MX(e){let{EventTarget:t}=oY(e);return e instanceof t?e:uY(e)}function NX(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var PX;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(PX||={});function FX(e){e.preventDefault()}function IX(e){e.stopPropagation()}var LX;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(LX||={});var RX={start:[LX.Space,LX.Enter],cancel:[LX.Esc],end:[LX.Space,LX.Enter,LX.Tab]},zX=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case LX.Right:return{...n,x:n.x+25};case LX.Left:return{...n,x:n.x-25};case LX.Down:return{...n,y:n.y+25};case LX.Up:return{...n,y:n.y-25}}},BX=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new jX(uY(t)),this.windowListeners=new jX(oY(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(PX.Resize,this.handleCancel),this.windowListeners.add(PX.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(PX.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&OX(n),t(WY)}handleKeyDown(e){if(wY(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=RX,coordinateGetter:a=zX,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:WY;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=SY(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=xX(n),p=wX(n),m={x:Math.min(i===LX.Right?p.right-p.width/2:p.right,Math.max(i===LX.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===LX.Down?p.bottom-p.height/2:p.bottom,Math.max(i===LX.Down?p.top:p.top+p.height/2,u.y))},h=i===LX.Right&&!s||i===LX.Left&&!c,g=i===LX.Down&&!l||i===LX.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===LX.Right&&e<=d.x||i===LX.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===LX.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===LX.Down&&e<=d.y||i===LX.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===LX.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,xY(SY(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};BX.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=RX,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function VX(e){return!!(e&&`distance`in e)}function HX(e){return!!(e&&`delay`in e)}var UX=class{constructor(e,t,n){n===void 0&&(n=MX(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=uY(i),this.documentListeners=new jX(this.document),this.listeners=new jX(n),this.windowListeners=new jX(oY(i)),this.initialCoordinates=EY(r)??WY,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(PX.Resize,this.handleCancel),this.windowListeners.add(PX.DragStart,FX),this.windowListeners.add(PX.VisibilityChange,this.handleCancel),this.windowListeners.add(PX.ContextMenu,FX),this.documentListeners.add(PX.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(HX(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(VX(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(PX.Click,IX,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(PX.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=EY(e)??WY,s=SY(n,o);if(!t&&a){if(VX(a)){if(a.tolerance!=null&&NX(s,a.tolerance))return this.handleCancel();if(NX(s,a.distance))return this.handleStart()}if(HX(a)&&NX(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===LX.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},WX={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},GX=class extends UX{constructor(e){let{event:t}=e,n=uY(t.target);super(e,WX,n)}};GX.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var KX={move:{name:`mousemove`},end:{name:`mouseup`}},qX;(function(e){e[e.RightClick=2]=`RightClick`})(qX||={});var JX=class extends UX{constructor(e){super(e,KX,uY(e.event.target))}};JX.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==qX.RightClick&&(r?.({event:n}),!0)}}];var YX={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},XX=class extends UX{constructor(e){super(e,YX)}static setup(){return window.addEventListener(YX.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(YX.move.name,e)};function e(){}}};XX.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var ZX;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(ZX||={});var QX;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(QX||={});function $X(e){let{acceleration:t,activator:n=ZX.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=QX.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=tZ({delta:d,disabled:!a}),[m,h]=pY(),g=(0,y.useRef)({x:0,y:0}),_=(0,y.useRef)({x:0,y:0}),v=(0,y.useMemo)(()=>{switch(n){case ZX.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ZX.DraggableRect:return i}},[n,i,c]),b=(0,y.useRef)(null),x=(0,y.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,y.useMemo)(()=>s===QX.TreeOrder?[...l].reverse():l,[s,l]);(0,y.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=CX(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),b.current=e,m(x,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var eZ={x:{[yX.Backward]:!1,[yX.Forward]:!1},y:{[yX.Backward]:!1,[yX.Forward]:!1}};function tZ(e){let{delta:t,disabled:n}=e,r=_Y(t);return hY(e=>{if(n||!r||!e)return eZ;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[yX.Backward]:e.x[yX.Backward]||i.x===-1,[yX.Forward]:e.x[yX.Forward]||i.x===1},y:{[yX.Backward]:e.y[yX.Backward]||i.y===-1,[yX.Forward]:e.y[yX.Forward]||i.y===1}}},[n,t,r])}function nZ(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return hY(e=>t==null?null:r??e??null,[r,t])}function rZ(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var iZ;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(iZ||={});var aZ;(function(e){e.Optimized=`optimized`})(aZ||={});var oZ=new Map;function sZ(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,y.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,y.useRef)(e),d=g(),f=mY(d),p=(0,y.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,y.useRef)(null),h=hY(t=>{if(d&&!n)return oZ;if(!t||t===oZ||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new AX(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,y.useEffect)(()=>{u.current=e},[e]),(0,y.useEffect)(()=>{d||p()},[n,d]),(0,y.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,y.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case iZ.Always:return!1;case iZ.BeforeDragging:return n;default:return!n}}}function cZ(e,t){return hY(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function lZ(e,t){return cZ(e,t)}function uZ(e){let{callback:t,disabled:n}=e,r=fY(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function dZ(e){let{callback:t,disabled:n}=e,r=fY(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function fZ(e){return new AX(cX(e),e)}function pZ(e,t,n){t===void 0&&(t=fZ);let[r,i]=(0,y.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=uZ({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=dZ({callback:a});return dY(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function mZ(e){return nX(e,cZ(e))}var hZ=[];function gZ(e){let t=(0,y.useRef)(e),n=hY(n=>e?n&&n!==hZ&&e&&t.current&&e.parentNode===t.current.parentNode?n:pX(e):hZ,[e]);return(0,y.useEffect)(()=>{t.current=e},[e]),n}function _Z(e){let[t,n]=(0,y.useState)(null),r=(0,y.useRef)(e),i=(0,y.useCallback)(e=>{let t=hX(e.target);t&&n(e=>e?(e.set(t,vX(t)),new Map(e)):null)},[]);return(0,y.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=hX(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,vX(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{hX(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,y.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>xY(e,t),WY):TX(e):WY,[e,t])}function vZ(e,t){t===void 0&&(t=[]);let n=(0,y.useRef)(null);return(0,y.useEffect)(()=>{n.current=null},t),(0,y.useEffect)(()=>{let t=e!==WY;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?SY(e,n.current):WY}function yZ(e){(0,y.useEffect)(()=>{if(!rY)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function bZ(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function xZ(e){return(0,y.useMemo)(()=>e?uX(e):null,[e])}var SZ=[];function CZ(e,t){t===void 0&&(t=cX);let[n]=e,r=xZ(n?oY(n):null),[i,a]=(0,y.useState)(SZ);function o(){a(()=>e.length?e.map(e=>bX(e)?r:new AX(t(e),e)):SZ)}let s=dZ({callback:o});return dY(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function wZ(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return cY(t)?t:e}function TZ(e){let{measure:t}=e,[n,r]=(0,y.useState)(null),i=dZ({callback:(0,y.useCallback)(e=>{for(let{target:n}of e)if(cY(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=gY((0,y.useCallback)(e=>{let n=wZ(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,y.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var EZ=[{sensor:GX,options:{}},{sensor:BX,options:{}}],DZ={current:{}},OZ={draggable:{measure:lX},droppable:{measure:lX,strategy:iZ.WhileDragging,frequency:aZ.Optimized},dragOverlay:{measure:cX}},kZ=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},AZ={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new kZ,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:VY},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:OZ,measureDroppableContainers:VY,windowRect:null,measuringScheduled:!1},jZ=(0,y.createContext)({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:VY,draggableNodes:new Map,over:null,measureDroppableContainers:VY}),MZ=(0,y.createContext)(AZ);function NZ(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new kZ}}}function PZ(e,t){switch(t.type){case BY.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case BY.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case BY.DragEnd:case BY.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case BY.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new kZ(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case BY.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new kZ(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case BY.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new kZ(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function FZ(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,y.useContext)(jZ),a=_Y(r),o=_Y(n?.id);return(0,y.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!wY(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=kY(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function IZ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function LZ(e){return(0,y.useMemo)(()=>({draggable:{...OZ.draggable,...e?.draggable},droppable:{...OZ.droppable,...e?.droppable},dragOverlay:{...OZ.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function RZ(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,y.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;dY(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=nX(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=mX(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var zZ=(0,y.createContext)({...WY,scaleX:1,scaleY:1}),BZ;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(BZ||={});var VZ=(0,y.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=EZ,collisionDetection:o=eX,measuring:s,modifiers:c,...l}=e,[u,d]=(0,y.useReducer)(PZ,void 0,NZ),[f,p]=IY(),[m,h]=(0,y.useState)(BZ.Uninitialized),g=m===BZ.Initialized,{draggable:{active:_,nodes:v,translate:b},droppable:{containers:x}}=u,S=_==null?null:v.get(_),C=(0,y.useRef)({initial:null,translated:null}),w=(0,y.useMemo)(()=>_==null?null:{id:_,data:S?.data??DZ,rect:C},[_,S]),T=(0,y.useRef)(null),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),A=mY(l,Object.values(l)),j=yY(`DndDescribedBy`,t),ee=(0,y.useMemo)(()=>x.getEnabled(),[x]),M=LZ(s),{droppableRects:N,measureDroppableContainers:te,measuringScheduled:ne}=sZ(ee,{dragging:g,dependencies:[b.x,b.y],config:M.droppable}),re=nZ(v,_),ie=(0,y.useMemo)(()=>O?EY(O):null,[O]),ae=Me(),oe=lZ(re,M.draggable.measure);RZ({activeNode:_==null?null:v.get(_),config:ae.layoutShiftCompensation,initialRect:oe,measure:M.draggable.measure});let se=pZ(re,M.draggable.measure,oe),ce=pZ(re?re.parentElement:null),le=(0,y.useRef)({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),P=x.getNodeFor(le.current.over?.id),F=TZ({measure:M.dragOverlay.measure}),ue=F.nodeRef.current??re,de=g?F.rect??se:null,I=!!(F.nodeRef.current&&F.rect),fe=mZ(I?null:se),pe=xZ(ue?oY(ue):null),me=gZ(g?P??re:null),he=CZ(me),ge=IZ(c,{transform:{x:b.x-fe.x,y:b.y-fe.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:se,containerNodeRect:ce,draggingNodeRect:de,over:le.current.over,overlayNodeRect:F.rect,scrollableAncestors:me,scrollableAncestorRects:he,windowRect:pe}),_e=ie?xY(ie,b):null,ve=_Z(me),ye=vZ(ve),be=vZ(ve,[se]),xe=xY(ge,ye),Se=de?iX(de,ge):null,Ce=w&&Se?o({active:w,collisionRect:Se,droppableRects:N,droppableContainers:ee,pointerCoordinates:_e}):null,we=YY(Ce,`id`),[Te,L]=(0,y.useState)(null),Ee=tX(I?ge:xY(ge,be),Te?.rect??null,se),De=(0,y.useRef)(null),Oe=(0,y.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent,o=new n({active:T.current,activeNode:i,event:a,options:r,context:le,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,jl.unstable_batchedUpdates)(()=>{r?.(i),h(BZ.Initializing),d({type:BY.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(De.current),k(a)})},onMove(e){d({type:BY.DragMove,coordinates:e})},onEnd:s(BY.DragEnd),onCancel:s(BY.DragCancel)});De.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=le.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===BY.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=BY.DragCancel)}T.current=null,(0,jl.unstable_batchedUpdates)(()=>{d({type:e}),h(BZ.Uninitialized),L(null),D(null),k(null),De.current=null;let t=e===BY.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ke=rZ(a,(0,y.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Oe(n,t))},[v,Oe]));yZ(a),dY(()=>{se&&m===BZ.Initializing&&h(BZ.Initialized)},[se,m]),(0,y.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=le.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:xe.x,y:xe.y},over:i};(0,jl.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[xe.x,xe.y]),(0,y.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=le.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(we),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,jl.unstable_batchedUpdates)(()=>{L(s),a?.(c),f({type:`onDragOver`,event:c})})},[we]),dY(()=>{le.current={activatorEvent:O,active:w,activeNode:re,collisionRect:Se,collisions:Ce,droppableRects:N,draggableNodes:v,draggingNode:ue,draggingNodeRect:de,droppableContainers:x,over:Te,scrollableAncestors:me,scrollAdjustedTranslate:xe},C.current={initial:de,translated:Se}},[w,re,Ce,Se,v,ue,de,N,x,Te,me,xe]),$X({...ae,delta:b,draggingRect:Se,pointerCoordinates:_e,scrollableAncestors:me,scrollableAncestorRects:he});let Ae=(0,y.useMemo)(()=>({active:w,activeNode:re,activeNodeRect:se,activatorEvent:O,collisions:Ce,containerNodeRect:ce,dragOverlay:F,draggableNodes:v,droppableContainers:x,droppableRects:N,over:Te,measureDroppableContainers:te,scrollableAncestors:me,scrollableAncestorRects:he,measuringConfiguration:M,measuringScheduled:ne,windowRect:pe}),[w,re,se,O,Ce,ce,F,v,x,N,Te,te,me,he,M,ne,pe]),je=(0,y.useMemo)(()=>({activatorEvent:O,activators:ke,active:w,activeNodeRect:se,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:Te,measureDroppableContainers:te}),[O,ke,w,se,d,j,v,Te,te]);return y.createElement(PY.Provider,{value:p},y.createElement(jZ.Provider,{value:je},y.createElement(MZ.Provider,{value:Ae},y.createElement(zZ.Provider,{value:Ee},i)),y.createElement(FZ,{disabled:n?.restoreFocus===!1})),y.createElement(zY,{...n,hiddenTextDescribedById:j}));function Me(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),HZ=(0,y.createContext)(null),UZ=`button`,WZ=`Draggable`;function GZ(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=yY(WZ),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,y.useContext)(jZ),{role:p=UZ,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,y.useContext)(g?zZ:HZ),[v,b]=gY(),[x,S]=gY(),C=bZ(o,t),w=mY(n);return dY(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,y.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===UZ?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function KZ(){return(0,y.useContext)(MZ)}var qZ=`Droppable`,JZ={timeout:25};function YZ(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=yY(qZ),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,y.useContext)(jZ),u=(0,y.useRef)({disabled:n}),d=(0,y.useRef)(!1),f=(0,y.useRef)(null),p=(0,y.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...JZ,...i},_=mY(h??r),v=dZ({callback:(0,y.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=gY((0,y.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=mY(t);return(0,y.useEffect)(()=>{!v||!b.current||(v.disconnect(),d.current=!1,v.observe(b.current))},[b,v]),(0,y.useEffect)(()=>(s({type:BY.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:BY.UnregisterDroppable,key:a,id:r})),[r]),(0,y.useEffect)(()=>{n!==u.current.disabled&&(s({type:BY.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function XZ(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ZZ(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function QZ(e){return e!==null&&e>=0}function $Z(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function eQ(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var tQ=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=XZ(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},nQ={scaleX:1,scaleY:1},rQ=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...nQ}:null}let s=iQ(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...nQ}:r<t&&r>=a?{x:0,y:o.height+s,...nQ}:{x:0,y:0,...nQ}};function iQ(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var aQ=`Sortable`,oQ=y.createContext({activeIndex:-1,containerId:aQ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tQ,disabled:{draggable:!1,droppable:!1}});function sQ(e){let{children:t,id:n,items:r,strategy:i=tQ,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=KZ(),d=yY(aQ,n),f=s.rect!==null,p=(0,y.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,y.useRef)(p),v=!$Z(p,_.current),b=g!==-1&&h===-1||v,x=eQ(a);dY(()=>{v&&m&&u(p)},[v,p,m,u]),(0,y.useEffect)(()=>{_.current=p},[p]);let S=(0,y.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:ZZ(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return y.createElement(oQ.Provider,{value:S},t)}var cQ=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return XZ(n,r,i).indexOf(t)},lQ=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},uQ={duration:200,easing:`ease`},dQ=`transform`,fQ=DY.Transition.toString({property:dQ,duration:0,easing:`linear`}),pQ={roleDescription:`sortable`};function mQ(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,y.useState)(null),s=(0,y.useRef)(n);return dY(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=cX(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,y.useEffect)(()=>{a&&o(null)},[a]),a}function hQ(e){let{animateLayoutChanges:t=lQ,attributes:n,disabled:r,data:i,getNewIndex:a=cQ,id:o,strategy:s,resizeObserverConfig:c,transition:l=uQ}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,y.useContext)(oQ),b=gQ(r,p),x=u.indexOf(o),S=(0,y.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,y.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=YZ({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:ee,listeners:M,isDragging:N,over:te,setActivatorNodeRef:ne,transform:re}=GZ({id:o,data:S,attributes:{...pQ,...n},disabled:b.draggable}),ie=nY(D,ee),ae=!!O,oe=ae&&!m&&QZ(f)&&QZ(g),se=!_&&N,ce=oe?(se&&oe?re:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,le=QZ(f)&&QZ(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,P=O?.id,F=(0,y.useRef)({activeId:P,items:u,newIndex:le,containerId:d}),ue=u!==F.current.items,de=t({active:O,containerId:d,isDragging:N,isSorting:ae,id:o,index:x,items:u,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:l,wasDragging:F.current.activeId!=null}),I=mQ({disabled:!de,index:x,node:T,rect:w});return(0,y.useEffect)(()=>{ae&&F.current.newIndex!==le&&(F.current.newIndex=le),d!==F.current.containerId&&(F.current.containerId=d),u!==F.current.items&&(F.current.items=u)},[ae,le,d,u]),(0,y.useEffect)(()=>{if(P===F.current.activeId)return;if(P!=null&&F.current.activeId==null){F.current.activeId=P;return}let e=setTimeout(()=>{F.current.activeId=P},50);return()=>clearTimeout(e)},[P]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:le,items:u,isOver:E,isSorting:ae,isDragging:N,listeners:M,node:T,overIndex:g,over:te,setNodeRef:ie,setActivatorNodeRef:ne,setDroppableNodeRef:D,setDraggableNodeRef:ee,transform:I??ce,transition:fe()};function fe(){if(I||ue&&F.current.newIndex===x)return fQ;if(!(se&&!wY(k)||!l)&&(ae||de))return DY.Transition.toString({...l,property:dQ})}}function gQ(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function _Q(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var vQ=[LX.Down,LX.Right,LX.Up,LX.Left],yQ=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(vQ.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case LX.Down:r.top<a.top&&t.push(n);break;case LX.Up:r.top>a.top&&t.push(n);break;case LX.Left:r.left>a.left&&t.push(n);break;case LX.Right:r.left<a.left&&t.push(n)}});let c=QY({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=YY(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=pX(c).some((e,t)=>s[t]!==e),i=bQ(e,t),a=xQ(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:SY(u,l)}}}};function bQ(e,t){return!_Q(e)||!_Q(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function xQ(e,t){return!_Q(e)||!_Q(t)||!bQ(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function SQ({resource:e,isCollapsed:t,isActive:n,href:r,onClose:i,onReorder:a,index:o,totalCount:s,LinkComponent:c,translations:l={},isDragging:u=!1}){let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=hQ({id:e.id}),_=(0,y.useRef)(a);(0,y.useEffect)(()=>{_.current=a});let v={transform:DY.Transform.toString(m),transition:h,opacity:g||u?.5:1},b=KP(e.mediaType),x=g||u,S=e.storageUri?e.storageUri.replace(/^file:\/\//,``):e.name,C=(0,y.useCallback)(t=>{_.current&&t.altKey&&(t.key===`ArrowUp`?(t.preventDefault(),_.current(e.id,`up`)):t.key===`ArrowDown`&&(t.preventDefault(),_.current(e.id,`down`)))},[e.id]);return(0,I.jsxs)(`div`,{ref:p,style:v,...d,...f,"aria-selected":n,onKeyDown:C,"aria-label":`${e.name}, position ${o===void 0?``:o+1} of ${s||``}`,className:`semiont-resource-tab ${n?`semiont-resource-tab--active`:``} ${x?`semiont-resource-tab--dragging`:``}`,role:`tab`,children:[(0,I.jsxs)(c,{href:r,className:`semiont-resource-tab__link`,title:S,children:[(0,I.jsx)(`span`,{className:`semiont-resource-tab__icon`,"aria-hidden":`true`,children:b}),!t&&(0,I.jsx)(`span`,{className:`semiont-resource-tab__text`,children:e.name})]}),!t&&(0,I.jsx)(`button`,{onClick:t=>i(e.id,t),className:`semiont-resource-tab__close`,title:l.closeResource||`Close resource`,"aria-label":`Close ${e.name}`,type:`button`,children:(0,I.jsx)(`svg`,{fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,width:`16`,height:`16`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})})]})}function CQ(){let{announce:e}=wF();return{announceReorder:(0,y.useCallback)(t=>{e(t,`assertive`)},[e]),announcePickup:(0,y.useCallback)((t,n,r)=>{e(`Picked up ${t}. Position ${n} of ${r}. Use arrow keys to move, space to drop.`,`assertive`)},[e]),announceDrop:(0,y.useCallback)((t,n,r)=>{e(`Dropped ${t} at position ${n} of ${r}.`,`assertive`)},[e]),announceMove:(0,y.useCallback)((t,n,r,i)=>{e(`Moved ${t} ${n} to position ${r} of ${i}.`,`polite`)},[e]),announceKeyboardReorder:(0,y.useCallback)((t,n,r,i)=>{e(`${t} moved ${n} to position ${r} of ${i}.`,`assertive`)},[e]),announceCannotMove:(0,y.useCallback)(t=>{e(`Cannot move ${t}. Already at the ${t===`up`?`top`:`bottom`} of the list.`,`polite`)},[e])}}function wQ({fixedItems:e,resources:t,isCollapsed:n,currentPath:r,LinkComponent:i,onNavigate:a,getResourceHref:o,className:s=``,translations:c={},icons:l,navigationMenu:u}){let d=l.chevronLeft,f=l.bars,[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(null),{announcePickup:g,announceDrop:_,announceKeyboardReorder:v,announceCannotMove:b}=CQ(),x=Em(`CollapsibleResourceNavigation`),S=Up(),C={title:c?.title||x(`title`),collapseSidebar:c?.collapseSidebar||x(`collapseSidebar`),expandSidebar:c?.expandSidebar||x(`expandSidebar`),dragToReorder:c?.dragToReorder||x(`dragToReorder`),dragToReorderDoc:c?.dragToReorderDoc||x(`dragToReorderDoc`),closeResource:c?.closeResource||x(`closeResource`),dragInstructions:c?.dragInstructions||x(`dragInstructions`)},w=()=>m(!p),T=()=>m(!1);(0,y.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&T()};if(p)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]);let E=UY(HY(GX,{activationConstraint:{distance:8}}),HY(BX,{coordinateGetter:yQ})),D=(0,y.useCallback)((e,n)=>{let r=t.findIndex(t=>t.id===e);if(r===-1)return;let i=n===`up`?r-1:r+1;if(i<0||i>=t.length){b(n);return}S.emit(`tabs:reorder`,{oldIndex:r,newIndex:i});let a=t[r];v(a.name,n,i+1,t.length)},[t,S]),O=(t,n)=>{n.preventDefault(),n.stopPropagation(),S.emit(`tabs:close`,{resourceId:t}),r===o(t)&&a&&e.length>0&&a(e[0].href)};return(0,I.jsxs)(`div`,{className:`semiont-collapsible-nav ${s}`,children:[(0,I.jsx)(`div`,{id:`drag-instructions`,className:`sr-only`,"aria-live":`polite`,children:C.dragInstructions}),(0,I.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-atomic":`true`,children:`Resources can be reordered using Alt+Up or Alt+Down arrow keys.`}),(0,I.jsxs)(`div`,{className:`semiont-collapsible-nav__container`,children:[(0,I.jsxs)(`div`,{style:{position:`relative`},ref:u?h:void 0,children:[(0,I.jsxs)(`div`,{className:`semiont-nav-section__header`,children:[!n&&u&&(0,I.jsx)(`button`,{onClick:w,className:`semiont-nav-section__header-text`,"aria-expanded":p,"aria-haspopup":`true`,type:`button`,children:C.title}),!n&&!u&&(0,I.jsx)(`span`,{className:`semiont-nav-section__header-text`,children:C.title}),(0,I.jsx)(`button`,{onClick:()=>S.emit(`shell:sidebar-toggle`,void 0),className:`semiont-nav-section__header-icon`,title:n?C.expandSidebar:C.collapseSidebar,"aria-label":n?C.expandSidebar:C.collapseSidebar,type:`button`,children:n?(0,I.jsx)(f,{}):(0,I.jsx)(d,{})})]}),p&&u&&!n&&(0,I.jsx)(`div`,{className:`semiont-nav-section__dropdown`,children:u(T)})]}),!n&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:e.map(e=>{let t=r===e.href;return(0,I.jsxs)(i,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,children:[(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`semiont-nav-tab__text`,children:e.name})]},e.href)})}),n&&(0,I.jsx)(`nav`,{className:`semiont-nav-tabs`,children:e.map(e=>{let t=r===e.href;return(0,I.jsx)(i,{href:e.href,className:`semiont-nav-tab ${t?`semiont-nav-tab--active`:``}`,title:e.description||e.name,"aria-current":t?`page`:void 0,"aria-label":e.name,children:(0,I.jsx)(e.icon,{className:`semiont-nav-tab__icon`,"aria-hidden":`true`})},e.href)})}),(0,I.jsx)(`div`,{className:`semiont-resource-tabs`,role:`tablist`,"aria-label":`Open resources`,children:n?t.map(e=>{let t=o(e.id);return(0,I.jsx)(SQ,{resource:e,isCollapsed:n,isActive:r===t,href:t,onClose:O,LinkComponent:i,translations:{dragToReorder:C.dragToReorder,dragToReorderDoc:C.dragToReorderDoc,closeResource:C.closeResource}},e.id)}):(0,I.jsx)(VZ,{sensors:E,collisionDetection:ZY,onDragStart:e=>{let{active:n}=e,r=t.find(e=>e.id===n.id);if(r){let e=t.indexOf(r);g(r.name,e+1,t.length)}},onDragEnd:e=>{let{active:n,over:r}=e;if(r&&n.id!==r.id){let e=t.findIndex(e=>e.id===n.id),i=t.findIndex(e=>e.id===r.id);if(e!==-1&&i!==-1){S.emit(`tabs:reorder`,{oldIndex:e,newIndex:i});let n=t[e];_(n.name,i+1,t.length)}}},children:(0,I.jsx)(sQ,{items:t.map(e=>e.id),strategy:rQ,children:t.map((e,a)=>{let s=o(e.id);return(0,I.jsx)(SQ,{resource:e,isCollapsed:n,isActive:r===s,href:s,onClose:O,onReorder:D,index:a,totalCount:t.length,LinkComponent:i,translations:{dragToReorder:C.dragToReorder,dragToReorderDoc:C.dragToReorderDoc,closeResource:C.closeResource}},e.id)})})})})]})]})}function TQ({context:e,translations:t}){let n=e.focus.kind===`annotation`?e.focus.sourceResource[`@id`]:e.focus.resource[`@id`],r=e.focus.kind===`annotation`?e.focus.annotation.id:void 0,{connections:i,citedBy:a}=Bi(e.graph,n,r),o=new Map;for(let t of e.graph.edges)t.type===`annotation-of`&&o.set(t.source,t.target);let s=e.graph.nodes.filter(e=>e.type===`annotation`&&e.id!==r&&o.get(e.id)===n),c=e.metadata?.entityTypeFrequencies??{},l=e=>[...e].sort((e,t)=>(c[e]??0)-(c[t]??0)),u=e=>{for(let t of Array.isArray(e)?e:[e])if(t&&typeof t==`object`&&`value`in t&&t.purpose!==`tagging`)return t.value},d=e=>8+e*216,f=e.graph.nodes.find(e=>e.id===n)?.label??(e.focus.kind===`annotation`?e.focus.sourceResource.name:e.focus.resource.name)??n,p=[],m=[],h=a.length>0,g=i.length>0,_=Math.max(1,Math.min(3-!!h-!!g,s.length)),v=+!!h,y=+!!h+_+ +!!g,b={id:n,label:f,kind:`focal`,hover:f,x:d(v),y:8};p.push(b),a.forEach((e,n)=>{let r={id:e.resourceId,label:e.resourceName,kind:`resource`,hover:`${e.resourceName}
139
139
  ${t.citedByLabel}`,x:d(0),y:8+n*52};p.push(r),m.push({key:`cites-${e.resourceId}`,kind:`cites`,hover:`cites`,x1:r.x+180,y1:r.y+17,x2:b.x,y2:b.y+17})}),i.forEach((e,n)=>{let r=l(e.entityTypes),i={id:e.resourceId,label:e.resourceName,kind:`resource`,hover:r.length?`${e.resourceName}
140
140
  ${r.join(`, `)}`:e.resourceName,x:d(v+_),y:8+n*52};p.push(i),m.push({key:`peer-${e.resourceId}`,kind:`peer`,hover:e.bidirectional?`${t.connectionsLabel} \xB7 mutual`:t.connectionsLabel,x1:b.x+180,y1:b.y+17,x2:i.x,y2:i.y+17})}),s.forEach((n,r)=>{let i=n.type===`annotation`?n.annotation:void 0,a=i?jr(Cr(i.target)):``,o=i?.motivation??n.label,s=i?u(i.body):void 0,c=l(n.entityTypes??[]),f=!a&&i?xr(i.body):null,h=f?e.graph.nodes.find(e=>e.id===f)?.label:void 0,g=a||(h?`\u2192 ${h}`:void 0)||(f?t.resourceLinkLabel:void 0)||s||n.label,y=Array.from(new Set([g,o,s,c.length?c.join(`, `):void 0].filter(Boolean))).join(`
141
- `),x={id:n.id,label:g,kind:`annotation`,hover:y,x:d(v+r%_),y:8+(1+Math.floor(r/_))*52};p.push(x),m.push({key:`annof-${n.id}`,kind:`annotation-of`,hover:`annotation-of`,x1:b.x+90,y1:b.y+34,x2:x.x+90,y2:x.y})});let x=Math.max(a.length,1+Math.ceil(s.length/_),i.length),S=y*216-20,C=8+x*52+8,w=e=>e.length>22?`${e.slice(0,21)}\u2026`:e,T=i.length>0||a.length>0||s.length>0;return(0,I.jsxs)(`div`,{className:`semiont-gather-pane semiont-gather-pane--graph`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:t.graphPaneTitle}),e.inferredRelationshipSummary&&(0,I.jsx)(`p`,{className:`semiont-gather-pane__summary`,children:e.inferredRelationshipSummary}),!T&&(0,I.jsx)(`p`,{className:`semiont-gather-pane__empty`,children:t.graphEmpty}),T&&(0,I.jsxs)(`svg`,{className:`semiont-graph`,viewBox:`0 0 ${S} ${C}`,style:{maxWidth:`${S}px`},role:`img`,"aria-label":t.graphPaneTitle,children:[m.map(e=>(0,I.jsxs)(`g`,{className:`semiont-graph__edge semiont-graph__edge--${e.kind}`,children:[(0,I.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}),(0,I.jsx)(`title`,{children:e.hover})]},e.key)),p.map(e=>(0,I.jsxs)(`g`,{className:`semiont-graph__node semiont-graph__node--${e.kind}`,"data-node-id":e.id,children:[(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:180,height:34,rx:6}),(0,I.jsx)(`text`,{x:e.x+10,y:e.y+22,children:w(e.label)}),(0,I.jsx)(`title`,{children:e.hover})]},e.id))]})]})}function EQ({semanticContext:e,translations:t}){let n=[...e?.similar??[]].sort((e,t)=>t.score-e.score),r=e?.excludedEntityTypes??[];return(0,I.jsxs)(`div`,{className:`semiont-gather-pane semiont-gather-pane--corpus`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:t.corpusPaneTitle}),n.length===0?(0,I.jsx)(`p`,{className:`semiont-gather-pane__empty`,children:t.corpusEmpty}):(0,I.jsx)(`ul`,{className:`semiont-corpus__list`,children:n.map((e,n)=>(0,I.jsxs)(`li`,{className:`semiont-corpus__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-corpus__card-head`,children:[(0,I.jsx)(`span`,{className:`semiont-corpus__source`,children:e.resourceName}),(e.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e)),e.machineRead&&(0,I.jsx)(`span`,{className:`semiont-chip semiont-corpus__trust`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:t.machineRead}),(0,I.jsxs)(`span`,{className:`semiont-corpus__score`,children:[t.score,`: `,e.score.toFixed(2)]})]}),(0,I.jsx)(`p`,{className:`semiont-corpus__snippet`,children:e.text})]},`${e.resourceId}-${n}`))}),r.length>0&&(0,I.jsx)(`p`,{className:`semiont-corpus__receipt`,children:t.excludedReceipt.replace(`{{types}}`,r.join(`, `))})]})}function DQ({context:e,contextLoading:t,contextError:n,pending:r,annotate:i,chosenStrategy:a,translations:o}){let[s,c]=(0,y.useState)(!1),l=!t&&!n&&!!e,u=e?.focus.kind===`annotation`?e.focus:null,d=e?.focus.kind===`resource`?e.focus:null,f=u?.annotation.motivation?Tw(u.annotation.motivation):void 0,p=f?ww[f].className:void 0,m=(0,y.useRef)(null);(0,y.useEffect)(()=>{m.current&&m.current.scrollIntoView({block:`center`,behavior:`instant`})},[e]);let h=i&&(0,I.jsx)(`div`,{className:`semiont-gather__hint-row`,children:(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,children:[i.translations.userHintLabel,(0,I.jsxs)(`span`,{className:`semiont-gather__hint-effect`,children:[` — `,i.translations.userHintEffect]})]}),(0,I.jsx)(`textarea`,{value:i.userHint,onChange:e=>i.onUserHintChange(e.target.value),placeholder:i.translations.userHintPlaceholder,className:`semiont-search-modal__search-input semiont-gather__hint-textarea`,style:{resize:`vertical`,fontFamily:`inherit`}})]})}),g=i&&(0,I.jsxs)(`div`,{className:`semiont-gather__footer`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__footer-label`,children:i.translations.resolutionStrategyLabel}),(0,I.jsxs)(`div`,{className:`semiont-gather__actions`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:i.onBind,disabled:!l,className:`semiont-button--primary semiont-button--flex`,children:[`🔍 `,i.translations.search,`…`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:i.onGenerate,disabled:!l,className:`semiont-button--primary semiont-button--flex`,children:[`✨ `,i.translations.generate,`…`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:i.onCompose,disabled:!l,className:`semiont-button--secondary semiont-button--flex`,children:[`✍️ `,i.translations.compose]})]})]});return(0,I.jsxs)(`div`,{className:`semiont-gather__outer`,children:[t&&r&&(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton`,role:`status`,children:[(0,I.jsx)(`span`,{className:`semiont-sr-only`,children:o.loadingContext}),r.resourceName&&(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-source`,children:[o.sourceContextLabel,` "${r.resourceName}"`]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-header`,children:[(0,I.jsxs)(`span`,{className:`semiont-gather__skeleton-exact`,children:[`"`,r.exact,`"`]}),r.entityTypes.length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:r.entityTypes.map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-panes`,children:[(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-pane`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:o.graphPaneTitle}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-pane`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:o.corpusPaneTitle}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]})]})]}),h,g]}),t&&!r&&(0,I.jsxs)(`div`,{className:`semiont-gather__loading`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-text`,children:o.loadingContext})]}),!!n&&(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:`1rem 0`,color:`var(--semiont-color-red-600)`},children:o.failedContext}),e&&(0,I.jsxs)(I.Fragment,{children:[u?.selected&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-strip`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,gap:`0.5rem`,marginBottom:`0.375rem`},children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,style:{marginBottom:0},children:[o.sourceContextLabel,u.sourceResource.name?` "${u.sourceResource.name}"`:``]}),(e.metadata?.entityTypes??[]).length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:(e.metadata?.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__source-box${s?` semiont-gather__source-box--expanded`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__source-context`,children:(0,I.jsxs)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,whiteSpace:`pre-wrap`,color:`var(--semiont-text-secondary)`},children:[u.selected.before&&(0,I.jsx)(`span`,{children:u.selected.before}),(0,I.jsx)(`span`,{ref:m,...p?{className:p}:{},children:u.selected.text}),u.selected.after&&(0,I.jsx)(`span`,{children:u.selected.after})]})}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-gather__expand-btn`,onClick:()=>c(e=>!e),children:s?`▲ less`:`▼ more`})]})]}),d&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-strip`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,gap:`0.5rem`,marginBottom:`0.375rem`},children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,style:{marginBottom:0},children:[o.sourceContextLabel,d.resource.name?` "${d.resource.name}"`:``]}),(e.metadata?.entityTypes??[]).length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:(e.metadata?.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(d.summary||d.content?.main)&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-box${s?` semiont-gather__source-box--expanded`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__source-context`,children:(0,I.jsx)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,whiteSpace:`pre-wrap`,color:`var(--semiont-text-secondary)`},children:d.summary??d.content?.main})}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-gather__expand-btn`,onClick:()=>c(e=>!e),children:s?`▲ less`:`▼ more`})]}),d.suggestedReferences&&d.suggestedReferences.length>0&&(0,I.jsx)(`ul`,{className:`semiont-gather__suggested`,children:d.suggestedReferences.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__body`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__left`,children:(0,I.jsx)(TQ,{context:e,translations:o})}),(0,I.jsx)(`div`,{className:`semiont-gather__right`,children:(0,I.jsx)(EQ,{semanticContext:e.semanticContext,translations:o})})]}),u&&h,u&&g,!i&&a&&(0,I.jsxs)(`div`,{className:`semiont-gather__footer semiont-gather__footer--echo`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__footer-label`,children:a.label}),(0,I.jsx)(`span`,{className:`semiont-gather__chosen-strategy`,children:a.value})]})]})]})}function OQ({backLabel:e,onBack:t,primary:n}){let r=n?.pending??!1;return(0,I.jsxs)(`div`,{className:`semiont-modal__actions semiont-modal__actions--wizard`,children:[t&&e&&(0,I.jsxs)(`button`,{type:`button`,onClick:t,className:`semiont-button--secondary semiont-wizard-footer__back`,disabled:r,children:[`◀ `,e]}),n&&(0,I.jsx)(`button`,{type:n.type,...n.onClick?{onClick:n.onClick}:{},className:`semiont-button--primary`,disabled:r||(n.disabled??!1),"data-pending":r?`true`:`false`,children:r?n.pendingLabel??n.label:n.label})]})}var kQ=100,AQ=4e3,jQ=e=>Si(e)?.extension??``,MQ=(e,t)=>({title:e,storagePath:``,prompt:``,language:t,temperature:.7,maxTokensText:`500`,outputMediaType:`text/markdown`});function NQ({context:e,hintEcho:t,config:n,onConfigChange:r,onBack:i,onGenerate:a,defaultFolder:o=``,translations:s,generationAgent:c}){let{title:l,storagePath:u,prompt:d,language:f,temperature:p,maxTokensText:m,outputMediaType:h}=n,g=e=>r({...n,...e}),_=u!==``,v=Fi(o,l,h),b=_?u:v,x=jQ(h),S=b!==``&&!b.toLowerCase().endsWith(x.toLowerCase()),C=c?.limits?.maxOutputTokens??AQ,w=(e=>Math.min(Math.max(Number.isFinite(e)?e:kQ,kQ),C))(parseInt(m,10));return(0,y.useEffect)(()=>{let e=parseInt(m,10);Number.isFinite(e)&&e>C&&g({maxTokensText:String(C)})},[C]),(0,I.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),S)return;let n=d.trim();a({title:l,storageUri:`file://${b}`,...n?{prompt:n}:{},language:f,temperature:p,maxTokens:w,outputMediaType:h,context:e})},className:`semiont-form`,children:[t&&(0,I.jsxs)(`p`,{className:`semiont-wizard__hint-echo`,children:[t.label,`: `,t.value]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-title`,className:`semiont-form__label`,children:s.resourceTitle}),(0,I.jsx)(`input`,{id:`wizard-title`,type:`text`,value:l,onChange:e=>g({title:e.target.value}),required:!0,className:`semiont-input`,placeholder:s.resourceTitlePlaceholder})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-storagePath`,className:`semiont-form__label`,children:s.saveLocation}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`wizard-storagePath`,type:`text`,value:b,onChange:e=>g({storagePath:e.target.value}),required:!0,"aria-invalid":S,...S?{"aria-describedby":`wizard-format-mismatch`}:{},className:`semiont-input semiont-input--addon`,placeholder:`generated/my-resource.md`})]}),S&&(0,I.jsx)(`p`,{id:`wizard-format-mismatch`,className:`semiont-form__error`,role:`alert`,children:s.formatExtensionMismatch.replace(`{{extension}}`,x)})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-outputFormat`,className:`semiont-form__label`,children:s.outputFormat}),(0,I.jsx)(`select`,{id:`wizard-outputFormat`,value:h,onChange:e=>g({outputMediaType:e.target.value}),className:`semiont-select`,children:ji.map(e=>(0,I.jsx)(`option`,{value:e,children:Si(e)?.label??e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-prompt`,className:`semiont-form__label`,children:s.additionalInstructions}),(0,I.jsx)(`textarea`,{id:`wizard-prompt`,value:d,onChange:e=>g({prompt:e.target.value}),rows:2,className:`semiont-textarea`,placeholder:s.additionalInstructionsPlaceholder})]}),(0,I.jsxs)(`div`,{className:`semiont-form__inline-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-language`,className:`semiont-form__label`,children:s.language}),(0,I.jsx)(`select`,{id:`wizard-language`,value:f,onChange:e=>g({language:e.target.value}),className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--slider`,children:[(0,I.jsxs)(`label`,{htmlFor:`wizard-temperature`,className:`semiont-form__label`,children:[s.creativity,` (`,p.toFixed(1),`)`]}),(0,I.jsx)(`input`,{id:`wizard-temperature`,type:`range`,min:`0`,max:`1`,step:`0.1`,value:p,onChange:e=>g({temperature:parseFloat(e.target.value)}),className:`semiont-slider`}),(0,I.jsxs)(`div`,{className:`semiont-slider__labels semiont-slider__labels--small`,children:[(0,I.jsx)(`span`,{children:s.creativityFocused}),(0,I.jsx)(`span`,{children:s.creativityCreative})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow semiont-form__field--end`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-maxTokens`,className:`semiont-form__label`,children:s.maxLength}),(0,I.jsx)(`input`,{id:`wizard-maxTokens`,type:`number`,min:kQ,max:C,step:`100`,value:m,onChange:e=>{let t=e.target.value;if(t===``){g({maxTokensText:``});return}let n=parseInt(t,10);Number.isFinite(n)&&g({maxTokensText:String(Math.min(n,C))})},className:`semiont-input`})]})]}),(0,I.jsx)(`p`,{className:`semiont-form__help semiont-form__help--row`,children:c?.limits?s.maxLengthCeiling.replace(`{{maxOutputTokens}}`,String(C)).replace(`{{model}}`,c.agent.model??c.agent.name):s.maxLengthHelp}),(0,I.jsx)(OQ,{...i&&s.back?{backLabel:s.back,onBack:i}:{},primary:{label:s.generate,type:`submit`,disabled:S}})]})}function PQ({config:e,hintEcho:t,onConfigChange:n,isSearching:r=!1,searchError:i=null,onBack:a,onSearch:o,translations:s}){return(0,I.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),o(e)},className:`semiont-form`,children:[t&&(0,I.jsxs)(`p`,{className:`semiont-wizard__hint-echo`,children:[t.label,`: `,t.value]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-limit`,className:`semiont-form__label`,children:s.maxResults}),(0,I.jsxs)(`select`,{id:`wizard-limit`,value:e.limit,onChange:t=>n({...e,limit:parseInt(t.target.value)}),className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:1,children:`1`}),(0,I.jsx)(`option`,{value:5,children:`5`}),(0,I.jsx)(`option`,{value:10,children:`10`}),(0,I.jsx)(`option`,{value:20,children:`20`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form__label semiont-form__label--inline`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:e.useSemanticScoring,onChange:t=>n({...e,useSemanticScoring:t.target.checked})}),s.semanticScoring]}),(0,I.jsx)(`p`,{className:`semiont-form__help`,children:s.semanticScoringHelp})]}),i&&(0,I.jsxs)(`div`,{role:`alert`,style:{textAlign:`center`,padding:`0.5rem 0`,color:`var(--semiont-color-red-600)`},children:[s.searchFailed,`: `,i]}),(0,I.jsx)(OQ,{backLabel:s.back,onBack:a,primary:{label:s.search,pendingLabel:s.searching,pending:r,type:`submit`}})]})}function FQ({results:e,onLink:t,onBack:n,translations:r}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`semiont-search-results`,children:e.length===0?(0,I.jsx)(`div`,{className:`semiont-modal__empty-state`,style:{textAlign:`center`,padding:`2rem 0`},children:r.noResults}):e.map(e=>{let n=e[`@id`];return(0,I.jsxs)(`div`,{style:{padding:`0.75rem`,borderBottom:`1px solid var(--semiont-border-primary)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`},children:[(0,I.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,I.jsx)(`div`,{style:{fontWeight:500,color:`var(--semiont-text-primary)`},children:e.name}),e.description&&(0,I.jsx)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,color:`var(--semiont-text-secondary)`,marginTop:`0.25rem`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description}),(0,I.jsxs)(`div`,{style:{fontSize:`var(--semiont-text-xs)`,color:`var(--semiont-text-tertiary)`,marginTop:`0.25rem`,display:`flex`,gap:`0.5rem`},children:[e.score!==void 0&&(0,I.jsxs)(`span`,{children:[r.score,`: `,e.score]}),e.matchReason&&(0,I.jsx)(`span`,{children:e.matchReason})]})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:`semiont-button--primary`,style:{flexShrink:0},children:[`🔗 `,r.link]})]},n)})}),(0,I.jsx)(OQ,{backLabel:r.back,onBack:n})]})}function IQ({draft:e,onDraftChange:t,defaultFolder:n=``,referenceEntityTypes:r,entityTypeOptions:i,showLineNumbers:a,hoverDelayMs:o,onBack:s,onCompose:c,translations:l}){let u=e.storagePath===``?Fi(n,e.name,`text/markdown`):e.storagePath,[d,f]=(0,y.useState)(!1),p=r.length>0;return(0,I.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!(!e.name.trim()||!u.trim())){f(!0);try{await c({name:e.name,storagePath:`file://${u}`,content:e.content,entityTypes:p?r:e.entityTypes,language:e.language})}catch{}finally{f(!1)}}},className:`semiont-form`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-name`,className:`semiont-form__label`,children:l.resourceTitle}),(0,I.jsx)(`input`,{id:`compose-name`,type:`text`,value:e.name,onChange:e=>t({name:e.target.value}),placeholder:l.resourceTitlePlaceholder,required:!0,className:`semiont-input`,disabled:d})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-storagePath`,className:`semiont-form__label`,children:l.saveLocation}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`compose-storagePath`,type:`text`,value:u,onChange:e=>t({storagePath:e.target.value}),placeholder:`people/my-resource.md`,required:!0,className:`semiont-input semiont-input--addon`,disabled:d})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`div`,{className:`semiont-form__label`,children:l.entityTypes}),p?(0,I.jsx)(`div`,{className:`semiont-form__entity-type-tags`,role:`list`,children:r.map(e=>(0,I.jsx)(`span`,{role:`listitem`,className:`semiont-form__entity-type-tag`,children:e},e))}):(0,I.jsx)(`div`,{className:`semiont-form__entity-type-buttons`,role:`group`,children:i.map(n=>{let r=e.entityTypes.includes(n);return(0,I.jsx)(`button`,{type:`button`,onClick:()=>t({entityTypes:r?e.entityTypes.filter(e=>e!==n):[...e.entityTypes,n]}),className:`semiont-form__entity-type-button`,"data-selected":r,"aria-pressed":r,disabled:d,children:n},n)})})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-language`,className:`semiont-form__label`,children:l.language}),(0,I.jsx)(`select`,{id:`compose-language`,value:e.language,onChange:e=>t({language:e.target.value}),disabled:d,className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__editor`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:l.contentLabel}),(0,I.jsx)(`div`,{className:`semiont-form__editor-wrapper`,lang:e.language,children:(0,I.jsx)(KH,{content:e.content,editable:!d,sourceView:!0,showLineNumbers:a,hoverDelayMs:o,onChange:e=>t({content:e})})})]}),(0,I.jsx)(OQ,{backLabel:l.back,onBack:s,primary:{label:l.createAndLink,pendingLabel:l.creatingAndLinking,pending:d,type:`submit`}})]})}function LQ({prompt:e,discardLabel:t,keepLabel:n,onDiscard:r,onKeepEditing:i}){return(0,I.jsxs)(`div`,{className:`semiont-wizard__discard-prompt`,role:`alert`,children:[(0,I.jsx)(`span`,{className:`semiont-wizard__discard-prompt-text`,children:e}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-button--danger`,onClick:r,children:t}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-button--secondary`,onClick:i,children:n})]})}function RQ({isOpen:e,onClose:t,annotationId:n,resourceId:r,defaultTitle:i,defaultFolder:a,entityTypes:o,resourceName:s,locale:c,context:l,contextLoading:u,contextError:d,onGenerateSubmit:f,onLinkResource:p,onComposeSubmit:m,entityTypeOptions:h=[],hoverDelayMs:g=300,translations:_,generationAgent:v}){let b=Z(Up().activeSession$),[x,S]=(0,y.useState)({step:`gather`}),[C,w]=(0,y.useState)({limit:10,useSemanticScoring:!0}),[T,E]=(0,y.useState)(()=>MQ(i,c)),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(null),[j,ee]=(0,y.useState)(``),M=()=>({name:i,storagePath:``,content:``,entityTypes:[],language:c}),[N,te]=(0,y.useState)(M),[ne,re]=(0,y.useState)(!1),{showLineNumbers:ie}=zp(),ae=(0,y.useRef)(i);(0,y.useEffect)(()=>{e&&(ae.current=i,S({step:`gather`}),w({limit:10,useSemanticScoring:!0}),E(MQ(i,c)),O(!1),A(null),ee(``),te(M()),re(!1))},[e]),xF(`match:search-results`,t=>{e&&n&&t.referenceId===n&&(O(!1),S({step:`search-results`,results:t.response}))}),xF(`match:search-failed`,t=>{e&&n&&t.referenceId===n&&(O(!1),A(t.error))});let oe=(0,y.useCallback)(()=>{S({step:`configure-search`})},[]),se=l?j?{...l,focus:{...l.focus,userHint:j}}:l:null,ce=(0,y.useCallback)(()=>{S({step:`configure-generation`})},[]),le=(0,y.useCallback)(()=>{!l||!n||!r||S({step:`compose`})},[l,n,r]),P=(0,y.useCallback)(async e=>{n&&(await m(n,e),t())},[n,m,t]),F=N.content.trim()!==``||N.storagePath.trim()!==``||N.name!==ae.current||T.title!==ae.current||T.storagePath.trim()!==``||T.prompt.trim()!==``,ue=(0,y.useCallback)(()=>{if(F){re(!0);return}t()},[F,t]),de=(0,y.useCallback)(()=>{S({step:`gather`})},[]),fe=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=fe.current;e&&(e.scrollTop=e.scrollHeight)},[x.step]);let pe=(0,y.useCallback)(e=>{!n||!se||!r||(O(!0),A(null),b?.client.match.requestSearch({correlationId:_r(),resourceId:r,referenceId:n,context:se,limit:e.limit,useSemanticScoring:e.useSemanticScoring}))},[n,r,se,b]),me=(0,y.useCallback)(e=>{n&&(f(n,e),t())},[n,f,t]),he=(0,y.useCallback)(e=>{n&&(p(n,e),t())},[n,p,t]),ge={loadingContext:_.loadingContext,failedContext:_.failedContext,sourceContextLabel:_.sourceContextLabel,connectionsLabel:_.connectionsLabel,citedByLabel:_.citedByLabel,graphPaneTitle:_.graphPaneTitle,graphEmpty:_.graphEmpty,resourceLinkLabel:_.resourceLinkLabel,corpusPaneTitle:_.corpusPaneTitle,corpusEmpty:_.corpusEmpty,excludedReceipt:_.excludedReceipt,machineRead:_.machineRead,score:_.score};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:ue,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering semiont-search-modal__centering--center`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel semiont-search-modal__panel--with-border semiont-search-modal__panel--gather semiont-search-modal__panel--wide`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__header`,children:[(0,I.jsx)(Sq,{className:`semiont-search-modal__title`,children:_.resolveTitle}),(0,I.jsx)(`button`,{onClick:ue,className:`semiont-search-modal__close-button`,"aria-label":`Close`,children:`✕`})]}),ne&&(0,I.jsx)(LQ,{prompt:_.discardDraftPrompt,discardLabel:_.discardDraft,keepLabel:_.keepEditing,onDiscard:()=>{re(!1),t()},onKeepEditing:()=>re(!1)}),x.step===`gather`&&(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,pending:{exact:i,entityTypes:o,...s?{resourceName:s}:{}},annotate:{userHint:j,onUserHintChange:ee,onBind:oe,onGenerate:ce,onCompose:le,translations:{search:_.search,generate:_.generate,compose:_.compose,resolutionStrategyLabel:_.resolutionStrategyLabel,userHintLabel:_.userHintLabel,userHintEffect:_.userHintEffect,userHintPlaceholder:_.userHintPlaceholder}},translations:ge}),x.step===`compose`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u270D\uFE0F ${_.compose}`},translations:ge}),(0,I.jsx)(IQ,{draft:N,onDraftChange:e=>te(t=>({...t,...e})),defaultFolder:a,referenceEntityTypes:o,entityTypeOptions:h,showLineNumbers:ie,hoverDelayMs:g,onBack:de,onCompose:P,translations:{resourceTitle:_.resourceTitle,resourceTitlePlaceholder:_.resourceTitlePlaceholder,saveLocation:_.saveLocation,entityTypes:_.entityTypes,language:_.language,contentLabel:_.contentLabel,back:_.back,createAndLink:_.createAndLink,creatingAndLinking:_.creatingAndLinking}})]}),x.step===`configure-generation`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u2728 ${_.generate}`},translations:ge}),(0,I.jsx)(NQ,{...v?{generationAgent:v}:{},...j?{hintEcho:{label:_.userHintLabel,value:j}}:{},context:se??l,config:T,onConfigChange:E,defaultFolder:a,onBack:de,onGenerate:me,translations:{resourceTitle:_.resourceTitle,resourceTitlePlaceholder:_.resourceTitlePlaceholder,saveLocation:_.saveLocation,additionalInstructions:_.additionalInstructions,additionalInstructionsPlaceholder:_.additionalInstructionsPlaceholder,language:_.language,languageHelp:_.languageHelp,creativity:_.creativity,creativityFocused:_.creativityFocused,creativityCreative:_.creativityCreative,maxLength:_.maxLength,maxLengthHelp:_.maxLengthHelp,maxLengthCeiling:_.maxLengthCeiling,outputFormat:_.outputFormat,formatExtensionMismatch:_.formatExtensionMismatch,back:_.back,generate:_.generate}})]}),x.step===`configure-search`&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u{1F50D} ${_.search}`},translations:ge}),(0,I.jsx)(PQ,{config:C,...j?{hintEcho:{label:_.userHintLabel,value:j}}:{},onConfigChange:w,isSearching:D,searchError:k,onBack:de,onSearch:pe,translations:{maxResults:_.maxResults,semanticScoring:_.semanticScoring,semanticScoringHelp:_.semanticScoringHelp,back:_.back,search:_.search,searching:_.searching,searchFailed:_.searchFailed}})]}),x.step===`search-results`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u{1F50D} ${_.search}`},translations:ge}),(0,I.jsx)(FQ,{results:x.results,onLink:he,onBack:de,translations:{noResults:_.noResults,link:_.link,back:_.back,score:_.score}})]})]})})})})]})})}function zQ({onGather:e,translations:t,children:n}){let[r,i]=(0,y.useState)(!0),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(2),[l,u]=(0,y.useState)(10);return(0,I.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e({includeContent:r,includeSummary:a,depth:s,maxResources:l})},className:`semiont-form`,children:[(0,I.jsx)(`p`,{className:`semiont-form__helper-text`,children:t.intro}),(0,I.jsx)(`div`,{className:`semiont-form__checkbox-field`,children:(0,I.jsxs)(`label`,{className:`semiont-form__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),t.includeContent]})}),(0,I.jsx)(`div`,{className:`semiont-form__checkbox-field`,children:(0,I.jsxs)(`label`,{className:`semiont-form__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),t.includeSummary]})}),(0,I.jsxs)(`div`,{className:`semiont-form__inline-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow`,children:[(0,I.jsx)(`label`,{htmlFor:`gather-depth`,className:`semiont-form__label`,children:t.depth}),(0,I.jsx)(`input`,{id:`gather-depth`,type:`number`,min:`1`,max:`5`,value:s,onChange:e=>c(parseInt(e.target.value)),className:`semiont-input`})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow`,children:[(0,I.jsx)(`label`,{htmlFor:`gather-max`,className:`semiont-form__label`,children:t.maxResources}),(0,I.jsx)(`input`,{id:`gather-max`,type:`number`,min:`1`,max:`50`,value:l,onChange:e=>u(parseInt(e.target.value)),className:`semiont-input`})]})]}),n,(0,I.jsx)(OQ,{primary:{label:t.gather,type:`submit`}})]})}function BQ({isOpen:e,onClose:t,resourceId:n,defaultTitle:r,defaultFolder:i,locale:a,entityTypeOptions:o=[],onGenerateSubmit:s,gatherContext:c,gatherLoading:l,gatherError:u,onGather:d,translations:f,generationAgent:p}){let m=()=>MQ(r,a),[h,g]=(0,y.useState)(m),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)([]),O=(0,y.useRef)(!1),k=(0,y.useRef)(r);(0,y.useEffect)(()=>{e&&!O.current&&(v(!1),x(null),C(!1),D([]),g(m()),T(!1),k.current=r),O.current=e},[e]);let A=(0,y.useCallback)(e=>{v(!0),x({...e,excludeEntityTypes:E}),C(!1),d({...e,...E.length?{excludeEntityTypes:E}:{}})},[d,E]),j=(0,y.useCallback)(e=>{s(n,e),t()},[s,n,t]),ee=h.title!==k.current||h.storagePath.trim()!==``||h.prompt.trim()!==``,M=(0,y.useCallback)(()=>{if(ee){T(!0);return}t()},[ee,t]),N=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=N.current;e&&c&&(e.scrollTop=e.scrollHeight)},[c]);let te={loadingContext:f.loadingContext,failedContext:f.failedContext,sourceContextLabel:f.sourceContextLabel,connectionsLabel:f.connectionsLabel,citedByLabel:f.citedByLabel,graphPaneTitle:f.graphPaneTitle,graphEmpty:f.graphEmpty,resourceLinkLabel:f.resourceLinkLabel,corpusPaneTitle:f.corpusPaneTitle,corpusEmpty:f.corpusEmpty,excludedReceipt:f.excludedReceipt,machineRead:f.machineRead,score:f.score};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:M,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering semiont-search-modal__centering--center`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel semiont-search-modal__panel--with-border semiont-search-modal__panel--gather semiont-search-modal__panel--wide`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__header`,children:[(0,I.jsx)(Sq,{className:`semiont-search-modal__title`,children:f.title}),(0,I.jsx)(`button`,{onClick:M,className:`semiont-search-modal__close-button`,"aria-label":`Close`,children:`✕`})]}),w&&(0,I.jsx)(LQ,{prompt:f.discardDraftPrompt,discardLabel:f.discardDraft,keepLabel:f.keepEditing,onDiscard:()=>{T(!1),t()},onKeepEditing:()=>T(!1)}),(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:N,children:[_&&!S&&b&&(0,I.jsxs)(`button`,{type:`button`,className:`semiont-gather-receipt`,title:f.editGather,onClick:()=>C(!0),children:[[`${f.gatherDepth} ${b.depth}`,`${f.gatherMaxResources} ${b.maxResources}`,...b.includeContent?[f.includeContent]:[],...b.includeSummary?[f.includeSummary]:[],...b.excludeEntityTypes.length?[f.excludedReceipt.replace(`{{types}}`,b.excludeEntityTypes.join(`, `))]:[]].join(` · `),(0,I.jsx)(`span`,{"aria-hidden":`true`,children:` ✎`})]}),(0,I.jsx)(`div`,{hidden:_&&!S,children:(0,I.jsx)(zQ,{onGather:A,translations:{intro:f.gatherIntro,includeContent:f.includeContent,includeSummary:f.includeSummary,depth:f.gatherDepth,maxResources:f.gatherMaxResources,gather:f.gatherButton},children:o.length>0&&(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__entity-types`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:f.recallLabel}),(0,I.jsx)(`div`,{className:`semiont-form__recall-chips`,children:o.map(e=>{let t=!E.includes(e);return(0,I.jsx)(`button`,{type:`button`,className:`semiont-form__recall-chip`,"data-included":t,"aria-pressed":t,onClick:()=>D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:e},e)})})]})})}),_&&(0,I.jsx)(DQ,{context:c,contextLoading:l,contextError:u,translations:te}),_&&c&&(0,I.jsx)(NQ,{...p?{generationAgent:p}:{},context:c,config:h,onConfigChange:g,defaultFolder:i,onGenerate:j,translations:{resourceTitle:f.resourceTitle,resourceTitlePlaceholder:f.resourceTitlePlaceholder,saveLocation:f.saveLocation,additionalInstructions:f.additionalInstructions,additionalInstructionsPlaceholder:f.additionalInstructionsPlaceholder,language:f.language,languageHelp:f.languageHelp,creativity:f.creativity,creativityFocused:f.creativityFocused,creativityCreative:f.creativityCreative,maxLength:f.maxLength,maxLengthHelp:f.maxLengthHelp,maxLengthCeiling:f.maxLengthCeiling,outputFormat:f.outputFormat,formatExtensionMismatch:f.formatExtensionMismatch,generate:f.generate}})]})]})})})})]})})}var VQ=De(Cw(),1);function HQ(){let{announce:e}=wF();return{announceSearching:(0,y.useCallback)(()=>{e(`Searching...`,`polite`)},[e]),announceSearchResults:(0,y.useCallback)((t,n)=>{e(t===0?`No results found for ${n}`:t===1?`1 result found for ${n}`:`${t} results found for ${n}`,`polite`)},[e]),announceSelection:(0,y.useCallback)((t,n)=>{e(`Selected ${n}: ${t}. Press Enter to navigate.`,`polite`)},[e]),announceNavigation:(0,y.useCallback)((t,n)=>{e(`Navigating to ${n}: ${t}`,`assertive`)},[e])}}var UQ=300,WQ=5;function GQ({isOpen:e,onClose:t,onNavigate:n,translations:r={}}){let{announceSearchResults:i,announceSearching:a}=HQ(),o=Z(Up().activeSession$)?.client,s=(0,y.useRef)(o);s.current=o;let[c,l]=(0,y.useState)(0),u={placeholder:r.placeholder||`Search resources, entities...`,searching:r.searching||`Searching...`,noResults:r.noResults||`No results found for`,startTyping:r.startTyping||`Start typing to search...`,navigate:r.navigate||`Navigate`,select:r.select||`Select`,close:r.close||`Close`,enter:r.enter||`Enter`,esc:r.esc||`ESC`},[d]=(0,y.useState)(()=>hl(e=>s.current.browse.resources({search:e,limit:WQ}).pipe((0,VQ.map)(e=>{let t=fc(e)?.resources;if(t!==void 0)return t.map(e=>{let t=Hr(e);return t?{type:`resource`,id:t,name:e.name,content:e.content?.substring(0,150)}:null}).filter(e=>e!==null)})),{debounceMs:UQ}));(0,y.useEffect)(()=>()=>d.dispose(),[d]);let f=Z(d.query$)??``,p=Z(d.state$),m=p?.results??[],h=p?.isSearching??!1;(0,y.useEffect)(()=>{e&&(d.setQuery(``),l(0))},[e,d]),(0,y.useEffect)(()=>{l(0)},[m.length]),(0,y.useEffect)(()=>{f.trim()&&(h?a():i(m.length,f))},[h,m.length]);let g=e=>{e.key===`ArrowDown`?(e.preventDefault(),l(e=>(e+1)%Math.max(1,m.length))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>(e-1+Math.max(1,m.length))%Math.max(1,m.length))):e.key===`Enter`&&m[c]&&(e.preventDefault(),_(m[c]))},_=e=>{t(),n(e.type,e.id)};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:t,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__input-container`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__search-icon-wrapper`,children:(0,I.jsx)(`svg`,{className:`semiont-search-modal__search-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})}),(0,I.jsx)(`input`,{type:`text`,value:f,onChange:e=>d.setQuery(e.target.value),onKeyDown:g,placeholder:u.placeholder,className:`semiont-search-modal__input`,autoFocus:!0}),(0,I.jsx)(`div`,{className:`semiont-search-modal__esc-wrapper`,children:(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd`,children:u.esc})})]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__results`,children:[h&&(0,I.jsx)(`div`,{className:`semiont-search-modal__empty`,children:u.searching}),!h&&f&&m.length===0&&(0,I.jsxs)(`div`,{className:`semiont-search-modal__empty`,children:[u.noResults,` "`,f,`"`]}),!h&&m.length>0&&(0,I.jsx)(`div`,{className:`semiont-search-modal__results-list`,children:m.map((e,t)=>(0,I.jsxs)(`button`,{onClick:()=>_(e),onMouseEnter:()=>l(t),className:`semiont-search-modal__result ${t===c?`semiont-search-modal__result--selected`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__result-icon-wrapper`,children:e.type===`resource`?(0,I.jsx)(`svg`,{className:`semiont-search-modal__result-icon semiont-search-modal__result-icon--resource`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}):(0,I.jsx)(`svg`,{className:`semiont-search-modal__result-icon semiont-search-modal__result-icon--entity`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z`})})}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__result-content`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__result-header`,children:[(0,I.jsx)(`span`,{className:`semiont-search-modal__result-name`,children:e.name}),e.type===`entity`&&e.entityType&&(0,I.jsx)(`span`,{className:`semiont-search-modal__result-badge`,children:e.entityType})]}),e.content&&(0,I.jsx)(`p`,{className:`semiont-search-modal__result-description`,children:e.content})]}),t===c&&(0,I.jsx)(`div`,{className:`semiont-search-modal__result-action`,children:(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd`,children:u.enter})})]},`${e.type}-${e.id}`))}),!h&&!f&&(0,I.jsxs)(`div`,{className:`semiont-search-modal__help`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__help-text`,children:u.startTyping}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcuts`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:`↑↓`}),u.navigate]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:u.enter}),u.select]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:`Esc`}),u.close]})]})]})]})]})})})})]})})}function KQ(){return(0,I.jsx)(`div`,{className:`semiont-skip-links`,children:(0,I.jsxs)(`div`,{className:`semiont-skip-links-container`,children:[(0,I.jsx)(`a`,{href:`#main-content`,className:`semiont-skip-link semiont-skip-link-first`,children:`Skip to main content`}),(0,I.jsx)(`a`,{href:`#main-navigation`,className:`semiont-skip-link`,children:`Skip to navigation`}),(0,I.jsx)(`a`,{href:`#search`,className:`semiont-skip-link semiont-skip-link-last`,children:`Skip to search`})]})})}function qQ({isFullyAuthenticated:e=!1,isAuthenticated:t=!1,hasValidGatewayToken:n=!1}){let r=Z(Up().activeSession$)?.client,[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!r){s(!1);return}let e=()=>{r.admin.status().then(e=>{a(e),l(null),s(!1)}).catch(e=>{l(e instanceof Error?e:Error(String(e))),s(!1)})};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[r]),(0,I.jsxs)(`section`,{className:`semiont-status-display`,"data-status":t&&!n?`warning`:e?i?`success`:o?`loading`:`error`:`info`,role:`status`,"aria-live":`polite`,"aria-label":`System status information`,children:[(0,I.jsxs)(`p`,{className:`semiont-status-message`,children:[(0,I.jsx)(`span`,{className:`sr-only`,children:`System status: `}),(()=>{if(t&&!n)return`🚀 Frontend Status: Ready • Gateway: Please sign out and sign in again to reconnect`;if(!e)return`🚀 Frontend Status: Ready • Gateway: Authentication required`;if(i)return`\u{1F680} Frontend Status: Ready \u2022 Gateway: ${i.status} (v${i.version})`;if(o)return`🚀 Frontend Status: Ready • Gateway: Connecting...`;if(c){let e=c.message;return e.includes(`401`)||e.includes(`Unauthorized`)?`🚀 Frontend Status: Ready • Gateway: Please sign out and sign in again`:`🚀 Frontend Status: Ready • Gateway: Connection failed`}return`🚀 Frontend Status: Ready • Gateway: Unknown`})()]}),e?c?(0,I.jsxs)(`p`,{className:`semiont-status-hint semiont-status-error-hint`,role:`alert`,children:[(0,I.jsx)(`span`,{className:`sr-only`,children:`Error: `}),`Check that the gateway server is running and accessible`]}):null:(0,I.jsx)(`p`,{className:`semiont-status-hint`,children:`Sign in to view gateway status`})]})}function JQ({t:e,className:t=``,size:n=`lg`,showTagline:r=!0,animated:i=!0,compactTagline:a=!1}){return(0,I.jsxs)(`div`,{className:`semiont-branding ${t}`,"data-size":n,"data-animated":i,"data-compact-tagline":a,children:[(0,I.jsx)(`h1`,{className:`semiont-branding-title`,children:(0,I.jsx)(`span`,{className:`semiont-branding-text`,children:`Semiont`})}),r&&(0,I.jsx)(`h2`,{className:`semiont-branding-tagline`,children:e(`tagline`)})]})}function YQ({Link:e,routes:t,t:n,tHome:r,showBranding:i=!0,brandingLink:a=`/`,variant:o=`standalone`,isAuthenticated:s=!1,isAdmin:c=!1,isModerator:l=!1,currentPath:u}){let{isOpen:d,toggle:f,close:p,dropdownRef:m}=uF();if(o===`floating`&&i)return(0,I.jsxs)(`div`,{className:`semiont-unified-header semiont-unified-header--floating`,"data-variant":`floating`,ref:m,children:[(0,I.jsx)(`button`,{onClick:f,className:`semiont-unified-header__branding-button`,"aria-label":`Navigation menu`,"aria-expanded":d,"aria-controls":`nav-menu-dropdown-1`,"aria-haspopup":`true`,id:`nav-menu-button-1`,children:(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!0,animated:!1,compactTagline:!0,className:`semiont-unified-header__branding`})}),d&&s&&(0,I.jsx)(`div`,{id:`nav-menu-dropdown-1`,className:`semiont-unified-header__dropdown`,role:`menu`,"aria-orientation":`vertical`,"aria-labelledby":`nav-menu-button-1`,children:(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:p,currentPath:u})})]});let h=(0,I.jsxs)(`div`,{className:`semiont-unified-header__content`,"data-variant":o,children:[i?(0,I.jsxs)(`div`,{className:`semiont-unified-header__branding-wrapper`,ref:m,children:[(0,I.jsx)(`button`,{onClick:f,className:`semiont-unified-header__branding-button`,"aria-label":`Navigation menu`,"aria-expanded":d,"aria-controls":`nav-menu-dropdown-2`,"aria-haspopup":`true`,id:`nav-menu-button-2`,children:(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!0,animated:!1,compactTagline:!0,className:`semiont-unified-header__branding`})}),d&&s&&(0,I.jsx)(`div`,{id:`nav-menu-dropdown-2`,className:`semiont-unified-header__dropdown`,role:`menu`,"aria-orientation":`vertical`,"aria-labelledby":`nav-menu-button-2`,children:(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:p,currentPath:u})})]}):(0,I.jsx)(`div`,{}),(0,I.jsx)(`div`,{className:`semiont-unified-header__actions`,"data-variant":o})]});return o===`standalone`?(0,I.jsx)(`header`,{className:`semiont-unified-header semiont-unified-header--standalone`,"data-variant":`standalone`,children:(0,I.jsx)(`div`,{className:`semiont-unified-header__container`,children:h})}):h}function XQ({Link:e,routes:t,t:n,tHome:r,children:i,brandingLink:a=`/`,collapsible:o=!1,storageKey:s=`leftSidebarCollapsed`,isAdmin:c=!1,isModerator:l=!1,currentPath:u}){let[d,f]=(0,y.useState)(!1),{width:p,setWidth:m,minWidth:h,maxWidth:g}=iF({defaultWidth:256,minWidth:192,maxWidth:400,storageKey:`semiont-left-sidebar-width`});return(0,y.useEffect)(()=>{o&&localStorage.getItem(s)===`true`&&f(!0)},[o,s]),(0,I.jsxs)(`aside`,{className:`semiont-left-sidebar`,"data-collapsed":d,style:d?void 0:{width:`${p}px`,position:`relative`},children:[!d&&(0,I.jsx)(eU,{onResize:m,minWidth:h,maxWidth:g,position:`right`,ariaLabel:`Resize left sidebar`}),(0,I.jsx)(`div`,{className:`semiont-left-sidebar__header`,"data-collapsed":d,children:(0,I.jsx)(e,{href:a,className:`semiont-left-sidebar__branding-button`,"aria-label":`Go to home page`,children:d?(0,I.jsx)(`div`,{className:`semiont-left-sidebar__logo-collapsed`,children:(0,I.jsx)(`span`,{className:`semiont-left-sidebar__logo-text`,children:`S`})}):(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!1,animated:!1,className:``})})}),(0,I.jsx)(`nav`,{role:`navigation`,"aria-label":`Main navigation`,id:`main-navigation`,className:`semiont-left-sidebar__content`,children:typeof i==`function`?i(d,()=>{if(!o)return;let e=!d;f(e),localStorage.setItem(s,e.toString())},r=>(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:r,currentPath:u})):i})]})}function ZQ({Link:e,routes:t,t:n,tNav:r,tHome:i,children:a,className:o=``,showAuthLinks:s=!0,CookiePreferences:c,onOpenKeyboardHelp:l}){return(0,I.jsxs)(`div`,{className:`semiont-page-layout`,children:[(0,I.jsx)(KQ,{}),(0,I.jsx)(`header`,{role:`banner`,className:`semiont-page-layout__header`,children:(0,I.jsx)(`div`,{className:`semiont-page-layout__header-container`,children:(0,I.jsx)(YQ,{Link:e,routes:t,t:r,tHome:i,showAuthLinks:s,brandingLink:`/`,variant:`embedded`})})}),(0,I.jsx)(`main`,{role:`main`,id:`main-content`,tabIndex:-1,className:`semiont-page-layout__main ${o}`,children:a}),(0,I.jsx)($J,{Link:e,routes:t,t:n,...c&&{CookiePreferences:c},...l&&{onOpenKeyboardHelp:l}})]})}function QQ({message:e}){return(0,I.jsx)(`div`,{className:`semiont-loading-state-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-loading-state semiont-loading-state-compose`,children:(0,I.jsx)(`p`,{className:`semiont-loading-message`,children:e})})})}function $Q(){return(0,I.jsx)(`div`,{className:`semiont-loading-state semiont-loading-state-resource`,children:(0,I.jsx)(`p`,{className:`semiont-loading-message`,children:`Loading resource...`})})}function e$({error:e,onRetry:t}){return(0,I.jsxs)(`div`,{className:`semiont-error-state semiont-error-state-resource`,children:[(0,I.jsx)(`p`,{className:`semiont-error-message`,children:e instanceof Error?e.message:`Failed to load resource`}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-button`,"data-variant":`secondary`,children:`Try Again`})]})}function t$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4.26 10.147a60.438 60.438 0 0 0-.491 6.347A48.62 48.62 0 0 1 12 20.904a48.62 48.62 0 0 1 8.232-4.41 60.46 60.46 0 0 0-.491-6.347m-15.482 0a50.636 50.636 0 0 0-2.658-.813A59.906 59.906 0 0 1 12 3.493a59.903 59.903 0 0 1 10.399 5.84c-.896.248-1.783.52-2.658.814m-15.482 0A50.717 50.717 0 0 1 12 13.489a50.702 50.702 0 0 1 7.74-3.342M6.75 15a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm0 0v-3.675A55.378 55.378 0 0 1 12 8.443m-7.007 11.55A5.981 5.981 0 0 0 6.75 15.75v-1.5`}))}var n$=y.forwardRef(t$);function r$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`}))}var i$=y.forwardRef(r$);function a$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`}))}var o$=y.forwardRef(a$);function s$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z`}))}var c$=y.forwardRef(s$);function l$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z`}))}var u$=y.forwardRef(l$);function d$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z`}))}var f$=y.forwardRef(d$);function p$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418`}))}var m$=y.forwardRef(p$);function h$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z`}))}var g$=y.forwardRef(h$);function _$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18`}))}var v$=y.forwardRef(_$);function y$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z`}))}var b$=y.forwardRef(y$);function x$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125`}))}var S$=y.forwardRef(x$);function C$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 4.5v15m7.5-7.5h-15`}))}var w$=y.forwardRef(C$);function T$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 3v17.25m0 0c-1.472 0-2.882.265-4.185.75M12 20.25c1.472 0 2.882.265 4.185.75M18.75 4.97A48.416 48.416 0 0 0 12 4.5c-2.291 0-4.545.16-6.75.47m13.5 0c1.01.143 2.01.317 3 .52m-3-.52 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.988 5.988 0 0 1-2.031.352 5.988 5.988 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L18.75 4.971Zm-16.5.52c.99-.203 1.99-.377 3-.52m0 0 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.989 5.989 0 0 1-2.031.352 5.989 5.989 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L5.25 4.971Z`}))}var E$=y.forwardRef(T$);function D$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z`}))}var O$=y.forwardRef(D$);function k$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z`}),y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 6h.008v.008H6V6Z`}))}var A$=y.forwardRef(k$);function j$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0`}))}var M$=y.forwardRef(j$);function N$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`}))}var P$=y.forwardRef(N$),F$=De(Ip(),1),I$=[`knowledge-base`,`user`,`settings`];function L$(e,t){let n=[],r=new F$.BehaviorSubject(t?.initialPanel??null),i=new F$.BehaviorSubject(null),a=new F$.BehaviorSubject(null),o=0;if(t?.onPanelChange){let e=t.onPanelChange;n.push(r.subscribe(e))}return n.push(e.stream(`panel:toggle`).subscribe(({panel:e})=>{let t=r.getValue();r.next(t===e?null:e)})),n.push(e.stream(`panel:open`).subscribe(({panel:e,scrollToAnnotationId:t,motivation:n})=>{if(t&&i.next(t),n){let e=Tw(n)??`highlight`;a.next({tab:e,generation:++o})}r.next(e)})),n.push(e.stream(`panel:close`).subscribe(()=>{r.next(null)})),{activePanel$:r.asObservable(),scrollToAnnotationId$:i.asObservable(),panelInitialTab$:a.asObservable(),openPanel:t=>e.emit(`panel:open`,{panel:t}),closePanel:()=>e.emit(`panel:close`,void 0),togglePanel:t=>e.emit(`panel:toggle`,{panel:t}),onScrollCompleted:()=>i.next(null),dispose(){n.forEach(e=>e.unsubscribe()),r.complete(),i.complete(),a.complete()}}}function R$({suggestedFeatures:e,theme:t,activePanel:n,translations:r,StatusDisplay:i,ToolbarPanels:a,Toolbar:o}){return(0,I.jsxs)(`div`,{className:`semiont-page${n&&I$.includes(n)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:r.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:r.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__section`,children:[(0,I.jsx)(`h2`,{className:`semiont-admin__section-title`,children:r.systemStatus}),(0,I.jsx)(i,{})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__section`,children:[(0,I.jsx)(`h2`,{className:`semiont-admin__section-title`,children:r.cliOperations}),(0,I.jsx)(`p`,{className:`semiont-admin__section-description`,children:r.cliOperationsDescription}),(0,I.jsx)(`div`,{className:`semiont-admin__features-grid`,children:e.map(e=>(0,I.jsx)(`div`,{className:`semiont-devops-feature`,children:(0,I.jsxs)(`div`,{className:`semiont-devops-feature__header`,children:[(0,I.jsx)(`div`,{className:`semiont-devops-feature__icon-box`,children:(0,I.jsx)(e.icon,{className:`semiont-devops-feature__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-devops-feature__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-devops-feature__title`,children:e.title}),(0,I.jsx)(`p`,{className:`semiont-devops-feature__description`,children:e.description}),(0,I.jsx)(`p`,{className:`semiont-devops-feature__available`,children:e.available})]})]})},e.title))})]}),(0,I.jsx)(`div`,{className:`semiont-admin__info-box`,children:(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-content`,children:[(0,I.jsx)(`div`,{className:`semiont-admin__info-box-icon`,children:(0,I.jsx)(c$,{className:`semiont-icon semiont-icon--info`})}),(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-text`,children:[(0,I.jsx)(`h3`,{className:`semiont-admin__info-box-title`,children:r.cliTitle}),(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-description`,children:[(0,I.jsx)(`p`,{children:r.cliDescription}),(0,I.jsx)(`code`,{className:`semiont-admin__info-box-code`,children:`semiont --help`})]})]})]})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(a,{activePanel:n,theme:t}),(0,I.jsx)(o,{context:`simple`,activePanel:n})]})]})}function z$({providers:e,allowedDomains:t,isLoading:n,theme:r,activePanel:i,translations:a,ToolbarPanels:o,Toolbar:s}){return(0,I.jsxs)(`div`,{className:`semiont-page${i&&I$.includes(i)?` semiont-page--panel-open`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-page__content`,children:(0,I.jsxs)(`div`,{className:`semiont-page__sections`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:a.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:a.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-admin__card-header`,children:[(0,I.jsx)(O$,{className:`semiont-admin__card-icon semiont-admin__card-icon--primary`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`semiont-admin__card-title`,children:a.oauthProviders}),(0,I.jsx)(`p`,{className:`semiont-admin__card-description`,children:a.oauthProvidersDescription})]})]}),n?(0,I.jsx)(`div`,{className:`semiont-skeleton-group`,children:(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--bar`})}):e.length>0?(0,I.jsx)(`div`,{className:`semiont-provider-list`,children:e.map(e=>(0,I.jsxs)(`div`,{className:`semiont-provider-item`,children:[(0,I.jsxs)(`div`,{className:`semiont-provider-item__info`,children:[(0,I.jsx)(i$,{className:`semiont-provider-item__icon semiont-provider-item__icon--success`}),(0,I.jsx)(`span`,{className:`semiont-provider-item__name`,children:e.name}),e.clientId&&(0,I.jsxs)(`span`,{className:`semiont-provider-item__client-id`,children:[a.clientId,`: `,e.clientId]})]}),(0,I.jsx)(`span`,{className:`semiont-badge semiont-badge--success`,children:a.configured})]},e.name))}):(0,I.jsx)(`div`,{className:`semiont-empty-message`,children:a.noProvidersConfigured})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-admin__card-header`,children:[(0,I.jsx)(m$,{className:`semiont-admin__card-icon semiont-admin__card-icon--primary`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`semiont-admin__card-title`,children:a.allowedDomains}),(0,I.jsx)(`p`,{className:`semiont-admin__card-description`,children:a.allowedDomainsDescription})]})]}),n?(0,I.jsxs)(`div`,{className:`semiont-skeleton-group`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--chip`}),(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--chip semiont-skeleton--chip-lg`})]}):t.length>0?(0,I.jsx)(`div`,{className:`semiont-domain-list`,children:t.map(e=>(0,I.jsxs)(`div`,{className:`semiont-chip semiont-chip--primary`,children:[`@`,e]},e))}):(0,I.jsx)(`div`,{className:`semiont-empty-message`,children:a.noDomainsConfigured})]}),(0,I.jsx)(`div`,{className:`semiont-admin__info-box`,children:(0,I.jsxs)(`div`,{className:`semiont-info-box__content`,children:[(0,I.jsx)(g$,{className:`semiont-info-box__icon`}),(0,I.jsxs)(`div`,{className:`semiont-info-box__text`,children:[(0,I.jsx)(`p`,{className:`semiont-info-box__title`,children:a.configManagementTitle}),(0,I.jsx)(`p`,{className:`semiont-info-box__description`,children:a.configManagementDescription}),(0,I.jsxs)(`ul`,{className:`semiont-info-box__list`,children:[(0,I.jsx)(`li`,{children:a.configLocalDev}),(0,I.jsxs)(`li`,{children:[a.configCloudDeploy,` `,(0,I.jsx)(`code`,{className:`semiont-code-inline`,children:a.configCloudDeployCommand}),` `,a.configCloudDeployEnd]}),(0,I.jsx)(`li`,{children:a.configAWS})]})]})]})})]})}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(o,{activePanel:i,theme:r}),(0,I.jsx)(s,{context:`simple`,activePanel:i})]})]})}function B$({user:e,onUpdate:t,onDelete:n,translations:r}){let i={admin:`semiont-badge semiont-badge--danger`,user:`semiont-badge semiont-badge--default`},a={active:`semiont-badge semiont-badge--success`,inactive:`semiont-badge semiont-badge--default`},o=e.isAdmin?`admin`:`user`,s=e.isActive?`active`:`inactive`;return(0,I.jsxs)(`tr`,{className:`semiont-table__row`,children:[(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsxs)(`div`,{className:`semiont-user-info`,children:[(0,I.jsx)(P$,{className:`semiont-user-info__avatar`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-user-info__name`,children:e.name||r.noName}),(0,I.jsx)(`div`,{className:`semiont-user-info__email`,children:e.email})]})]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsxs)(`span`,{className:`semiont-table__text--secondary`,children:[`@`,e.domain]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsx)(`span`,{className:i[o],children:r[o]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsx)(`span`,{className:a[s],children:r[s]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__text--secondary`,children:e.lastLogin?new Date(e.lastLogin).toLocaleDateString():r.never}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__text--secondary`,children:new Date(e.created).toLocaleDateString()}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__cell--actions`,children:(0,I.jsxs)(`div`,{className:`semiont-table__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>t(e.id,{isAdmin:!e.isAdmin}),className:`semiont-action-button semiont-action-button--info`,title:e.isAdmin?r.removeAdmin:r.makeAdmin,children:(0,I.jsx)(O$,{className:`semiont-action-button__icon`})}),(0,I.jsx)(`button`,{onClick:()=>t(e.id,{isActive:!e.isActive}),className:`semiont-action-button semiont-action-button--warning`,title:e.isActive?r.deactivateUser:r.activateUser,children:(0,I.jsx)(S$,{className:`semiont-action-button__icon`})}),(0,I.jsx)(`button`,{onClick:()=>n(e.id),className:`semiont-action-button semiont-action-button--danger`,title:r.deleteUser,children:(0,I.jsx)(M$,{className:`semiont-action-button__icon`})})]})})]})}function V$({users:e,userStats:t,isLoadingUsers:n,isLoadingStats:r,onUpdateUser:i,onDeleteUser:a,onAddUser:o,onExportUsers:s,theme:c,activePanel:l,translations:u,ToolbarPanels:d,Toolbar:f,buttonStyles:p}){let[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(`all`),[v,b]=(0,y.useState)(`all`),x=e.filter(e=>{let t=(e.name||``).toLowerCase().includes(m.toLowerCase())||e.email.toLowerCase().includes(m.toLowerCase()),n=e.isAdmin?`admin`:`user`,r=e.isActive?`active`:`inactive`;return t&&(g===`all`||n===g)&&(v===`all`||r===v)});return(0,I.jsxs)(`div`,{className:`semiont-page${l&&I$.includes(l)?` semiont-page--panel-open`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-page__content`,children:(0,I.jsxs)(`div`,{className:`semiont-page__sections`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header-with-action`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:u.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:u.subtitle})]}),(0,I.jsxs)(`button`,{onClick:o,className:p.primary.base,children:[(0,I.jsx)(w$,{className:`semiont-button__icon`}),u.addUser]})]}),(0,I.jsx)(`div`,{className:`semiont-admin__stats-grid`,children:r?[,,,,].fill(0).map((e,t)=>(0,I.jsx)(`div`,{className:`semiont-stat-card semiont-stat-card--loading`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--icon`}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--text`}),(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--number`})]})]})},t)):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(P$,{className:`semiont-stat-card__icon semiont-stat-card__icon--primary`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.totalUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.totalUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-stat-card__status-indicator semiont-stat-card__status-indicator--active`,children:(0,I.jsx)(`div`,{className:`semiont-stat-card__status-dot`})})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.activeUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.activeUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(O$,{className:`semiont-stat-card__icon semiont-stat-card__icon--danger`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.administrators}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.adminUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(f$,{className:`semiont-stat-card__icon semiont-stat-card__icon--warning`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.recentUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.recentSignups?.length??0})]})]})})]})}),(0,I.jsx)(`div`,{className:`semiont-admin__filters-card`,children:(0,I.jsxs)(`div`,{className:`semiont-admin__filters-grid`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`search`,className:`semiont-form__label`,children:u.searchUsers}),(0,I.jsxs)(`div`,{className:`semiont-search-input`,children:[(0,I.jsx)(`div`,{className:`semiont-search-input__icon`,children:(0,I.jsx)(b$,{className:`semiont-icon semiont-icon--small`})}),(0,I.jsx)(`input`,{type:`text`,id:`search`,className:`semiont-search-input__field`,placeholder:u.searchPlaceholder,value:m,onChange:e=>h(e.target.value)})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`role`,className:`semiont-form__label`,children:u.role}),(0,I.jsxs)(`select`,{id:`role`,className:`semiont-select`,value:g,onChange:e=>_(e.target.value),children:[(0,I.jsx)(`option`,{value:`all`,children:u.allRoles}),(0,I.jsx)(`option`,{value:`admin`,children:u.admin}),(0,I.jsx)(`option`,{value:`user`,children:u.user})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`status`,className:`semiont-form__label`,children:u.status}),(0,I.jsxs)(`select`,{id:`status`,className:`semiont-select`,value:v,onChange:e=>b(e.target.value),children:[(0,I.jsx)(`option`,{value:`all`,children:u.allStatus}),(0,I.jsx)(`option`,{value:`active`,children:u.active}),(0,I.jsx)(`option`,{value:`inactive`,children:u.inactive})]})]}),(0,I.jsx)(`div`,{className:`semiont-form__field semiont-form__field--align-end`,children:(0,I.jsx)(`button`,{onClick:s,className:`${p.secondary.base} semiont-button--full-width`,children:u.exportUsers})})]})}),(0,I.jsxs)(`div`,{className:`semiont-admin__table-card`,children:[(0,I.jsx)(`div`,{className:`semiont-table-container`,children:n?(0,I.jsxs)(`div`,{className:`semiont-loading-state`,children:[(0,I.jsx)(`div`,{className:`semiont-spinner`}),(0,I.jsx)(`p`,{className:`semiont-loading-state__text`,children:u.loadingUsers})]}):(0,I.jsxs)(`table`,{className:`semiont-table`,children:[(0,I.jsx)(`thead`,{className:`semiont-table__head`,children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.userColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.domainColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.roleColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.statusColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.lastLoginColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.joinedColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header semiont-table__header--actions`,children:u.actionsColumn})]})}),(0,I.jsx)(`tbody`,{className:`semiont-table__body`,children:x.map(e=>(0,I.jsx)(B$,{user:e,onUpdate:i,onDelete:a,translations:u},e.id))})]})}),!n&&x.length===0&&(0,I.jsxs)(`div`,{className:`semiont-empty-state`,children:[(0,I.jsx)(P$,{className:`semiont-empty-state__icon`}),(0,I.jsx)(`h3`,{className:`semiont-empty-state__title`,children:u.noUsersFound}),(0,I.jsx)(`p`,{className:`semiont-empty-state__description`,children:u.noUsersFoundDescription})]})]})]})}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(d,{activePanel:l,theme:c}),(0,I.jsx)(f,{context:`simple`,activePanel:l})]})]})}function H$(){return(0,I.jsxs)(`svg`,{className:`semiont-icon semiont-icon--small semiont-icon--inline`,viewBox:`0 0 24 24`,children:[(0,I.jsx)(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]})}function U$({onSignUp:e,Link:t,translations:n}){let[r,i]=(0,y.useState)(!1);return(0,I.jsx)(`main`,{className:`semiont-auth__main`,role:`main`,children:(0,I.jsx)(`div`,{className:`semiont-auth__container`,children:(0,I.jsxs)(`div`,{className:`semiont-auth__content`,children:[(0,I.jsxs)(`section`,{"aria-labelledby":`signup-heading`,className:`semiont-auth__branding`,children:[(0,I.jsx)(`h1`,{id:`signup-heading`,className:`sr-only`,children:n.pageTitle}),(0,I.jsx)(JQ,{t:e=>n[e]||e,size:`xl`,animated:!0,className:`semiont-auth__logo`}),(0,I.jsx)(`p`,{className:`semiont-auth__welcome`,children:n.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-auth__subtitle`,children:n.signUpPrompt})]}),(0,I.jsxs)(`div`,{className:`semiont-auth__forms`,children:[(0,I.jsxs)(`button`,{onClick:async()=>{i(!0);try{await e()}catch(e){console.error(`Failed to initiate Google sign-up:`,e),i(!1)}},disabled:r,className:`${Ew.primary.base} semiont-button--full-width`,children:[r?(0,I.jsx)(`div`,{className:`semiont-auth__spinner`}):(0,I.jsx)(H$,{}),r?n.creatingAccount:n.signUpWithGoogle]}),(0,I.jsxs)(`div`,{className:`semiont-auth__info`,children:[n.approvedDomainsInfo,(0,I.jsx)(`br`,{}),n.termsAgreement]})]}),(0,I.jsxs)(`div`,{className:`semiont-auth__links`,children:[(0,I.jsx)(t,{href:`/`,className:Ew.secondary.base,children:n.backToHome}),(0,I.jsx)(t,{href:`/auth/signin`,className:Ew.primary.base,children:n.alreadyHaveAccount})]})]})})})}function W$(e,t){switch(e){case`Configuration`:return t.errorConfiguration;case`AccessDenied`:return t.errorAccessDenied;case`Verification`:return t.errorVerification;default:return t.errorGeneric}}function G$({errorType:e,Link:t,translations:n}){let r=W$(e,n);return(0,I.jsx)(`div`,{className:`semiont-auth-error-display`,children:(0,I.jsxs)(`div`,{className:`semiont-auth-error-display__container`,children:[(0,I.jsx)(`div`,{children:(0,I.jsx)(`h2`,{className:`semiont-auth-error-display__title`,children:n.pageTitle})}),(0,I.jsx)(`div`,{className:`semiont-auth-error-display__error-box`,children:(0,I.jsx)(`div`,{className:`semiont-auth-error-display__error-message`,children:r})}),(0,I.jsx)(`div`,{className:`semiont-auth-error-display__actions`,children:(0,I.jsx)(t,{href:`/auth/signin`,className:`semiont-auth-error-display__link`,children:n.tryAgain})})]})})}function K$({userName:e,status:t,isProcessing:n,onAccept:r,onDecline:i,translations:a,PageLayout:o,Link:s}){return t===`loading`?(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__loading`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__loading-content`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__spinner`}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__loading-text`,children:a.loading})]})})}):t===`accepted`?(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__accepted`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__accepted-content`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__accepted-icon`,children:(0,I.jsx)(`svg`,{className:`semiont-welcome-page__accepted-checkmark`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`semiont-welcome-page__accepted-title`,children:a.welcomeTitle}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__accepted-subtitle`,children:a.thanksForAccepting})]})]})})}):(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__form-wrapper`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__form`,children:[(0,I.jsxs)(`div`,{className:`semiont-welcome-page__form-header`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__form-icon`,children:(0,I.jsx)(`svg`,{className:`semiont-welcome-page__form-icon-svg`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,I.jsx)(`h1`,{className:`semiont-welcome-page__form-title`,children:a.welcomeUser.replace(`{firstName}`,e||``)}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__form-subtitle`,children:a.reviewTermsPrompt})]}),(0,I.jsx)(`div`,{className:`semiont-welcome-page__terms-content`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__prose`,children:[(0,I.jsx)(`h3`,{children:a.termsSummaryTitle}),(0,I.jsx)(`p`,{children:a.termsSummaryIntro}),(0,I.jsx)(`h4`,{children:a.acceptableUseTitle}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.acceptableUseResponsible}),(0,I.jsx)(`li`,{children:a.acceptableUseRespect}),(0,I.jsx)(`li`,{children:a.acceptableUseConduct})]}),(0,I.jsx)(`h4`,{children:a.prohibitedContentTitle}),(0,I.jsx)(`p`,{children:a.prohibitedContentIntro}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.prohibitedIllegal}),(0,I.jsx)(`li`,{children:a.prohibitedAdult}),(0,I.jsx)(`li`,{children:a.prohibitedHate}),(0,I.jsx)(`li`,{children:a.prohibitedViolence}),(0,I.jsx)(`li`,{children:a.prohibitedMisinformation}),(0,I.jsx)(`li`,{children:a.prohibitedPrivacy}),(0,I.jsx)(`li`,{children:a.prohibitedCopyright}),(0,I.jsx)(`li`,{children:a.prohibitedMalware}),(0,I.jsx)(`li`,{children:a.prohibitedSpam})]}),(0,I.jsx)(`h4`,{children:a.conductTitle}),(0,I.jsxs)(`p`,{children:[a.conductDescription,` `,(0,I.jsx)(`a`,{href:`https://ai-alliance.cdn.prismic.io/ai-alliance/Zl-MG5m069VX1dgH_AIAllianceCodeofConduct.pdf`,target:`_blank`,rel:`noopener noreferrer`,className:`semiont-link`,children:a.conductLink}),a.conductPromotion]}),(0,I.jsx)(`h4`,{children:a.responsibilitiesTitle}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.responsibilitiesSecure}),(0,I.jsx)(`li`,{children:a.responsibilitiesReport}),(0,I.jsx)(`li`,{children:a.responsibilitiesAccurate}),(0,I.jsx)(`li`,{children:a.responsibilitiesComply})]}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__warning`,children:a.violationsWarning})]})}),(0,I.jsxs)(`div`,{className:`semiont-welcome-page__actions`,children:[(0,I.jsxs)(`p`,{className:`semiont-welcome-page__legal-links`,children:[a.readFullTerms,` `,(0,I.jsx)(s,{href:`/terms`,target:`_blank`,className:`semiont-welcome-page__link`,children:a.termsOfService}),` `,a.and,` `,(0,I.jsx)(s,{href:`/privacy`,target:`_blank`,className:`semiont-welcome-page__link`,children:a.privacyPolicy})]}),(0,I.jsxs)(`div`,{className:`semiont-welcome-page__buttons`,children:[(0,I.jsx)(`button`,{onClick:i,disabled:n,className:`semiont-welcome-page__button semiont-welcome-page__button--secondary`,children:a.declineAndSignOut}),(0,I.jsx)(`button`,{onClick:r,disabled:n,className:`semiont-welcome-page__button semiont-welcome-page__button--primary`,children:n?a.processing:a.acceptAndContinue})]}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__legal-notice`,children:a.legallyBound})]})]})})})}function q$({entityTypes:e,error:t,newTag:n,onNewTagChange:r,onAddTag:i,isAddingTag:a,theme:o,activePanel:s,translations:c,ToolbarPanels:l,Toolbar:u}){return(0,I.jsxs)(`div`,{className:`semiont-page${s&&I$.includes(s)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:c.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:c.pageDescription})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-entity-tags__header`,children:[(0,I.jsx)(`div`,{className:`semiont-entity-tags__icon-box`,children:(0,I.jsx)(A$,{className:`semiont-entity-tags__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-entity-tags__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-entity-tags__title`,children:c.sectionTitle}),(0,I.jsx)(`p`,{className:`semiont-entity-tags__description`,children:c.sectionDescription})]})]}),(0,I.jsx)(`div`,{className:`semiont-entity-tags__tags-section`,children:(0,I.jsx)(`div`,{className:`semiont-tags`,children:e.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--info semiont-tag--rounded-md`,children:e},e))})}),(0,I.jsxs)(`div`,{className:`semiont-entity-tags__input-group`,children:[(0,I.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i()},placeholder:c.inputPlaceholder,className:`semiont-entity-tags__input`,disabled:a}),(0,I.jsx)(`button`,{onClick:i,disabled:a||!n.trim(),className:`semiont-button semiont-button--primary`,children:a?c.adding:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(w$,{className:`semiont-icon semiont-icon--small semiont-icon--inline`}),c.addTag]})})]}),t&&(0,I.jsxs)(`div`,{className:`semiont-entity-tags__error`,children:[(0,I.jsx)(u$,{className:`semiont-entity-tags__error-icon`}),t]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(l,{activePanel:s,theme:o}),(0,I.jsx)(u,{context:`simple`,activePanel:s})]})]})}function J$({isLoading:e,theme:t,activePanel:n,translations:r,ToolbarPanels:i,Toolbar:a}){return e?(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:r.loading})}):(0,I.jsxs)(`div`,{className:`semiont-page${n&&I$.includes(n)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:r.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:r.pageDescription})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-recent-docs__header`,children:[(0,I.jsx)(`div`,{className:`semiont-recent-docs__icon-box`,children:(0,I.jsx)(o$,{className:`semiont-recent-docs__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-recent-docs__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-recent-docs__title`,children:r.sectionTitle}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__description`,children:r.sectionDescription})]})]}),(0,I.jsxs)(`div`,{className:`semiont-recent-docs__empty-state`,children:[(0,I.jsx)(`svg`,{className:`semiont-recent-docs__empty-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__empty-message`,children:r.noDocuments}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__empty-hint`,children:r.activityWillAppear})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(i,{activePanel:n,theme:t}),(0,I.jsx)(a,{context:`simple`,activePanel:n})]})]})}var Y$={legal:E$,scientific:n$,general:v$},X$={legal:`semiont-schema-domain--legal`,scientific:`semiont-schema-domain--scientific`,general:`semiont-schema-domain--general`};function Z$({schemas:e,isLoading:t,theme:n,activePanel:r,translations:i,ToolbarPanels:a,Toolbar:o}){return t?(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:i.loading})}):(0,I.jsxs)(`div`,{className:`semiont-page${r&&I$.includes(r)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:i.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:i.pageDescription})]}),(0,I.jsx)(`div`,{className:`semiont-card-grid semiont-card-grid--two-columns`,children:e.map(e=>{let t=Y$[e.domain]||v$,n=X$[e.domain]||X$.general;return(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-schema__header`,children:[(0,I.jsx)(`div`,{className:`semiont-schema__icon-wrapper ${n}`,children:t&&(0,I.jsx)(t,{className:`semiont-schema__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-schema__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-schema__title`,children:e.name}),(0,I.jsx)(`p`,{className:`semiont-schema__description`,children:e.description}),(0,I.jsx)(`span`,{className:`semiont-schema__badge ${n}`,children:e.domain})]})]}),(0,I.jsxs)(`div`,{className:`semiont-schema__categories`,children:[(0,I.jsx)(`h4`,{className:`semiont-schema__categories-title`,children:i.categories}),e.tags.map(e=>(0,I.jsxs)(`div`,{className:`semiont-schema__category`,children:[(0,I.jsx)(`div`,{className:`semiont-schema__category-name`,children:e.name}),(0,I.jsx)(`div`,{className:`semiont-schema__category-description`,children:e.description}),(0,I.jsxs)(`div`,{className:`semiont-schema__examples`,children:[e.examples.slice(0,2).map((e,t)=>(0,I.jsx)(`span`,{className:`semiont-schema__example`,children:e},t)),e.examples.length>2&&(0,I.jsxs)(`span`,{className:`semiont-schema__example-more`,children:[`+`,e.examples.length-2,` more`]})]})]},e.name))]})]},e.id)})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(a,{activePanel:r,theme:n}),(0,I.jsx)(o,{context:`simple`,activePanel:r})]})]})}function Q$(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function $$({progress:e,label:t=`Upload`}){if(!e)return null;if(e.phase===`started`)return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:(0,I.jsxs)(`span`,{children:[t,`: starting…`]})}),(0,I.jsx)(`div`,{className:`semiont-progress semiont-progress--indeterminate`,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill`})})]});if(e.phase===`progress`){let n=e.totalBytes<=0,r=n?0:Math.min(100,Math.round(e.bytesUploaded/e.totalBytes*100));return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:n?(0,I.jsxs)(`span`,{children:[t,`: `,Q$(e.bytesUploaded),`…`]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{children:[t,`: `,r,`%`]}),(0,I.jsxs)(`span`,{children:[Q$(e.bytesUploaded),` / `,Q$(e.totalBytes)]})]})}),(0,I.jsx)(`div`,{className:`semiont-progress${n?` semiont-progress--indeterminate`:``}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":n?void 0:100,"aria-valuenow":n?void 0:r,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill`,style:n?void 0:{width:`${r}%`}})})]})}return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:(0,I.jsxs)(`span`,{children:[t,`: uploaded`]})}),(0,I.jsx)(`div`,{className:`semiont-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":100,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill semiont-progress__fill--success`,style:{width:`100%`}})})]})}var e1=Object.values(vi).map(e=>e.extension).join(`,`);function t1(e){if(e.type&&xi(e.type))return e.type;if(e.name.includes(`.`)){let t=Di(e.name.slice(e.name.lastIndexOf(`.`)));if(t)return t}return`application/octet-stream`}function n1({mode:e,cloneData:t,availableEntityTypes:n,initialLocale:r,theme:i,hoverDelayMs:a,activePanel:o,onSaveResource:s,onCancel:c,uploadProgress:l=null,translations:u,ToolbarPanels:d,Toolbar:f}){let{announceFormSubmitting:p,announceFormSuccess:m,announceFormError:h}=DF(),{showLineNumbers:g}=zp(),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)([]),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)(`write`),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)(`text/markdown`),[ee,M]=(0,y.useState)(null),[N,te]=(0,y.useState)(!1),[ne,re]=(0,y.useState)(`text/markdown`),[ie,ae]=(0,y.useState)(r),[oe,se]=(0,y.useState)(``),[ce,le]=(0,y.useState)(``),[P,F]=(0,y.useState)(!0),ue=xi(ne)?ne:`text/markdown`,de=ce===``?Fi(e===`clone`&&t?Pi(Kr(t.sourceResource)):``,_,ue):ce;(0,y.useEffect)(()=>{e===`clone`&&t&&(v(t.sourceResource.name),x(t.sourceContent))},[e,t]);let fe=e=>{let t=e.target.files?.[0];t&&pe(t)},pe=e=>{let t=t1(e);if(k(e),j(t),D(`upload`),!_){let t=e.name.replace(/\.[^/.]+$/,``);v(t)}let n=Si(t)?.render;if(n===`image`||n===`pdf`){let t=URL.createObjectURL(e);M(t)}else{let t=new FileReader;t.onload=e=>{let t=e.target?.result;x(t)},t.readAsText(e)}};(0,y.useEffect)(()=>()=>{ee&&URL.revokeObjectURL(ee)},[ee]);let me=async t=>{if(t.preventDefault(),_.trim()){T(!0),p();try{let t={mode:e,name:_,storageUri:`file://${de}`,content:b,format:O?A:ne,entityTypes:S,language:ie};O&&(t.file=O),oe&&(t.charset=oe),e===`clone`&&(t.archiveOriginal=P),await s(t),m(e===`clone`?`Resource cloned successfully`:`Resource created successfully`)}catch(e){throw h(`Failed to save resource. Please try again.`),e}finally{T(!1)}}},he=e===`clone`;return(0,I.jsxs)(`div`,{className:`semiont-page${o&&I$.includes(o)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content semiont-page__compose`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:he?u.titleEditClone:u.title}),he&&(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:u.subtitleClone})]}),(0,I.jsx)(`div`,{className:`semiont-form`,children:(0,I.jsxs)(`form`,{onSubmit:me,className:`semiont-form__fields semiont-compose-grid`,children:[(0,I.jsxs)(`div`,{className:`semiont-compose-grid__meta`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`docName`,className:`semiont-form__label`,children:u.resourceName}),(0,I.jsx)(`input`,{id:`docName`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:u.resourceNamePlaceholder,className:`semiont-input`,required:!0,disabled:w})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`storagePath`,className:`semiont-form__label`,children:`Save location`}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`storagePath`,type:`text`,value:de,onChange:e=>le(e.target.value),placeholder:`docs/my-resource.md`,required:!0,className:`semiont-input semiont-input--addon`,disabled:w})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__entity-types`,children:[(0,I.jsx)(`div`,{className:`semiont-form__label`,children:u.entityTypes}),(0,I.jsx)(`div`,{className:`semiont-form__entity-type-buttons`,role:`group`,"aria-describedby":`entity-types-description`,children:n.map(e=>{let t=S.includes(e);return(0,I.jsx)(`button`,{type:`button`,onClick:()=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:`semiont-form__entity-type-button`,"data-selected":t,disabled:w,"aria-pressed":t,"aria-label":`${e} entity type, ${t?`selected`:`not selected`}`,children:e},e)})}),S.length>0&&(0,I.jsxs)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:[S.length,` entity type`,S.length===1?``:`s`,` selected: `,S.join(`, `)]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`language-select`,className:`semiont-form__label`,children:u.language}),(0,I.jsx)(`select`,{id:`language-select`,value:ie,onChange:e=>ae(e.target.value),disabled:w,className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]})]}),(0,I.jsxs)(`div`,{className:`semiont-compose-grid__content`,children:[!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:u.contentSource}),(0,I.jsxs)(`div`,{className:`semiont-form__content-source-toggle`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>D(`upload`),disabled:w,className:`semiont-form__content-source-button`,"data-active":E===`upload`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__content-source-icon-wrapper`,children:[(0,I.jsx)(`span`,{className:`semiont-form__content-source-icon`,children:`📎`}),(0,I.jsx)(`span`,{className:`semiont-form__content-source-label`,children:u.uploadFile})]}),(0,I.jsx)(`div`,{className:`semiont-form__content-source-description`,children:u.uploadFileDescription})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>D(`write`),disabled:w,className:`semiont-form__content-source-button`,"data-active":E===`write`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__content-source-icon-wrapper`,children:[(0,I.jsx)(`span`,{className:`semiont-form__content-source-icon`,children:`✍️`}),(0,I.jsx)(`span`,{className:`semiont-form__content-source-label`,children:u.writeContent})]}),(0,I.jsx)(`div`,{className:`semiont-form__content-source-description`,children:u.writeContentDescription})]})]})]}),!he&&E===`upload`&&(0,I.jsxs)(`div`,{className:`semiont-form__upload-section`,children:[(0,I.jsx)(`div`,{children:(0,I.jsxs)(`div`,{className:`semiont-form__upload-container`,children:[(0,I.jsx)(`label`,{className:`semiont-form__upload-dropzone`,"data-drag-over":N?`true`:`false`,onDragOver:e=>{e.preventDefault(),te(!0)},onDragLeave:()=>te(!1),onDrop:e=>{e.preventDefault(),te(!1);let t=e.dataTransfer.files?.[0];t&&!w&&pe(t)},children:(0,I.jsxs)(`div`,{className:`semiont-form__upload-area`,children:[(0,I.jsx)(`input`,{type:`file`,accept:e1,onChange:fe,className:`semiont-form__upload-input`,disabled:w}),(0,I.jsx)(`p`,{className:`semiont-form__upload-text`,children:O?O.name:u.dropFileOrClick}),(0,I.jsx)(`p`,{className:`semiont-form__upload-hint`,children:u.supportedFormats})]})}),O&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{k(null),M(null),j(`text/markdown`)},className:`semiont-button semiont-button--danger semiont-button--small`,disabled:w,children:`Clear`})]})}),O&&(0,I.jsxs)(`div`,{className:`semiont-form__media-type`,children:[(0,I.jsxs)(`span`,{className:`semiont-form__media-type-label`,children:[u.mediaType,`:`]}),(0,I.jsx)(`code`,{className:`semiont-form__media-type-value`,children:A}),(0,I.jsx)(`span`,{className:`semiont-form__media-type-lock`,title:u.autoDetected,children:`🔒`})]}),O&&ee&&Si(A)?.render===`image`&&(0,I.jsxs)(`div`,{className:`semiont-form__image-preview`,children:[(0,I.jsx)(`p`,{className:`semiont-form__image-preview-label`,children:`Preview:`}),(0,I.jsx)(`div`,{className:`semiont-form__image-preview-container`,children:(0,I.jsx)(`img`,{src:ee,alt:`Upload preview`,className:`semiont-form__image-preview-img`})})]})]}),(he||E===`write`)&&(0,I.jsxs)(`div`,{className:`semiont-form__write-section`,children:[!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`format-select`,className:`semiont-form__label`,children:u.format}),(0,I.jsx)(`select`,{id:`format-select`,value:ne,onChange:e=>re(e.target.value),disabled:w,className:`semiont-select`,children:Ai.map(e=>(0,I.jsxs)(`option`,{value:e,children:[Si(e)?.label??e,` (`,e,`)`]},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__editor`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:he?u.resourceContent:u.content}),(0,I.jsx)(`div`,{className:`semiont-form__editor-wrapper`,lang:ie,children:(0,I.jsx)(KH,{content:b,editable:!w,sourceView:!0,showLineNumbers:g,hoverDelayMs:a,onChange:e=>x(e)})})]}),!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`charset-select`,className:`semiont-form__label`,children:u.encoding}),(0,I.jsxs)(`select`,{id:`charset-select`,value:oe,onChange:e=>se(e.target.value),disabled:w,className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:``,children:`UTF-8 (default)`}),(0,I.jsx)(`option`,{value:`iso-8859-1`,children:`ISO-8859-1 (Latin-1)`}),(0,I.jsx)(`option`,{value:`windows-1252`,children:`Windows-1252`}),(0,I.jsx)(`option`,{value:`ascii`,children:`ASCII`}),(0,I.jsx)(`option`,{value:`utf-16le`,children:`UTF-16LE`})]})]})]}),he&&(0,I.jsxs)(`div`,{className:`semiont-form__checkbox-field`,children:[(0,I.jsx)(`input`,{id:`archiveOriginal`,type:`checkbox`,checked:P,onChange:e=>F(e.target.checked),className:`semiont-checkbox`,disabled:w}),(0,I.jsx)(`label`,{htmlFor:`archiveOriginal`,className:`semiont-form__checkbox-label`,children:u.archiveOriginal})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:c,disabled:w||l!==null,className:Ew.tertiary.base,children:u.cancel}),(0,I.jsx)(`button`,{type:`submit`,disabled:w||l!==null||!_.trim(),className:Ew.primary.base,children:w?he?u.saving:u.creating:he?u.saveClonedResource:u.createResource})]}),(0,I.jsx)($$,{progress:l})]})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(d,{activePanel:o,theme:i}),(0,I.jsx)(f,{context:`simple`,activePanel:o})]})]})}var r1=y.memo(({resource:e,onOpen:t,tabIndex:n=0,archivedLabel:r,createdLabel:i})=>(0,I.jsxs)(`div`,{onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))},role:`button`,tabIndex:n,"aria-label":`Open resource: ${e.name}`,className:`semiont-resource-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-resource-card__header`,children:[(0,I.jsx)(`h4`,{className:`semiont-resource-card__title`,children:e.name}),e.archived&&(0,I.jsx)(`span`,{className:`semiont-resource-card__badge`,"data-type":`archived`,children:r})]}),(0,I.jsxs)(`div`,{className:`semiont-resource-card__metadata`,children:[(0,I.jsxs)(`span`,{className:`semiont-resource-card__date`,children:[i,` `,e.dateCreated?new Date(e.dateCreated).toLocaleDateString():`N/A`]}),e.entityTypes&&e.entityTypes.length>0&&(0,I.jsxs)(`div`,{className:`semiont-tags`,children:[e.entityTypes.slice(0,2).map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--secondary semiont-tag--compact semiont-tag--rounded-sm`,children:e},e)),e.entityTypes.length>2&&(0,I.jsxs)(`span`,{className:`semiont-tag semiont-tag--secondary semiont-tag--compact semiont-tag--rounded-sm`,children:[`+`,e.entityTypes.length-2]})]})]})]}));r1.displayName=`ResourceCard`;function i1({recentDocuments:e,searchDocuments:t,entityTypes:n,isLoadingRecent:r,recentError:i=null,onRetryRecent:a,isSearching:o,searchMatchKind:s,searchQuery:c,onSearchQueryChange:l,selectedEntityType:u,onSelectedEntityTypeChange:d,theme:f,activePanel:p,onNavigateToResource:m,onNavigateToCompose:h,translations:g,ToolbarPanels:_}){let v=c.trim()!==``,b=v?t:e,x=aF(n.length+1,{orientation:`horizontal`}),S=aF(b.length,{orientation:`grid`,cols:2}),C=(0,y.useRef)(m);C.current=m;let w=(0,y.useCallback)(e=>{d(e)},[d]),T=(0,y.useCallback)(e=>{let t=Hr(e);t&&C.current(t)},[]);if(i)return(0,I.jsxs)(`div`,{className:`semiont-page__loading`,children:[(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:g.recentFailed}),a&&(0,I.jsx)(`button`,{type:`button`,onClick:a,className:`semiont-button`,"data-variant":`secondary`,children:g.retry})]});if(r)return(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:g.loadingKnowledgeBase})});let E=v&&t.length===0&&!o;return(0,I.jsxs)(`div`,{className:`semiont-page${p&&I$.includes(p)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:g.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:g.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsx)(`div`,{className:`semiont-card__search-form`,children:(0,I.jsxs)(`div`,{className:`semiont-card__search-wrapper`,children:[(0,I.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:g.searchPlaceholder,className:`semiont-card__search-input`,"aria-label":g.searchPlaceholder}),o&&(0,I.jsx)(`span`,{className:`semiont-card__search-status`,"aria-live":`polite`,children:g.searching})]})}),n.length>0&&(0,I.jsxs)(`div`,{className:`semiont-card__filters`,children:[(0,I.jsx)(`h3`,{className:`semiont-card__filters-label`,children:g.filterByEntityType}),(0,I.jsxs)(`div`,{ref:x.containerRef,onKeyDown:x.handleKeyDown,className:`semiont-card__filter-buttons`,role:`group`,"aria-label":`Entity type filters`,children:[(0,I.jsx)(`button`,{onClick:()=>w(``),tabIndex:0,"aria-pressed":u===``,className:`semiont-card__filter-button`,"data-active":u===``,children:g.all}),n.map(e=>(0,I.jsx)(`button`,{onClick:()=>w(e),tabIndex:-1,"aria-pressed":u===e,className:`semiont-card__filter-button`,"data-active":u===e,children:e},e))]})]}),(0,I.jsxs)(`div`,{className:`semiont-card__documents`,children:[(0,I.jsx)(`h3`,{className:`semiont-card__documents-label`,children:v&&t.length>0?g.searchResults(t.length):u?g.documentsTaggedWith(u):g.recentResources}),v&&s===`semantic`&&t.length>0&&(0,I.jsx)(`p`,{className:`semiont-card__documents-note`,"data-testid":`semiont-semantic-match-notice`,"aria-live":`polite`,children:g.semanticFallbackNotice}),E&&(0,I.jsx)(`div`,{className:`semiont-card__warning`,children:(0,I.jsx)(`p`,{className:`semiont-card__warning-text`,children:g.noResultsFound(c)})}),b.length>0?(0,I.jsx)(`div`,{ref:S.containerRef,onKeyDown:S.handleKeyDown,className:`semiont-card-grid`,role:`group`,"aria-label":`Document grid`,children:b.map((e,t)=>(0,I.jsx)(r1,{resource:e,onOpen:T,tabIndex:t===0?0:-1,archivedLabel:g.archived,createdLabel:g.created},Hr(e)))}):(0,I.jsxs)(`div`,{className:`semiont-card__empty`,children:[(0,I.jsx)(`p`,{className:`semiont-card__empty-text`,children:g.noResourcesAvailable}),!v&&(0,I.jsx)(`button`,{onClick:h,className:`semiont-card__empty-button`,children:g.composeFirstResource})]})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(_,{activePanel:p,theme:f}),(0,I.jsx)(tU,{context:`simple`,activePanel:p})]})]})}function a1(e,t){let n=Z(Up().activeSession$),r=(0,y.useRef)(null);(0,y.useEffect)(()=>{!t||!n||r.current!==e&&(r.current=e,n.client.browse.resourceViewed(e))},[e,t,n])}var o1=[`no-text-layer`,`encrypted`,`corrupt`,`too-large`,`empty`];function s1(e){return!Ri(e)||e.declined!==!0||!Ii(e.reason)?null:o1.includes(e.reason)?e.reason:null}function c1(e){let t=Em(`OutcomeToasts`),{showError:n,showSuccess:r,showInfo:i}=Yp();SF({"mark:create-error":r=>{r.resourceId===e&&n(t(`createFailed`,{detail:r.message||t(`unknownError`)}))},"mark:delete-error":r=>{r.resourceId===e&&n(t(`deleteFailed`,{detail:r.message||t(`unknownError`)}))},"bind:body-error":r=>{r.resourceId===e&&n(t(`referenceUpdateFailed`,{detail:r.message||t(`unknownError`)}))},"mark:assist-timeout":n=>{n.resourceId===e&&i(t(`assistQuiet`))},"job:complete":n=>{if(n.resourceId!==e)return;if(n.result?.kind===`generation`){r(n.result.resourceName?t(`resourceCreatedNamed`,{name:n.result.resourceName}):t(`resourceCreated`));return}let a=s1(n.result);a?i(t(`decline_${a}`)):r(t(`annotationComplete`))},"job:fail":r=>{r.resourceId===e&&(r.jobType===`generation`?n(t(`generationFailed`,{detail:r.error})):n(r.error||t(`annotationFailed`)))}})}function l1(e,t,n){let r=(0,y.useRef)(e),i=(0,y.useRef)(null),a=(0,y.useRef)(n);(0,y.useEffect)(()=>{a.current=n}),(0,y.useEffect)(()=>{if(e&&e!==r.current&&(r.current=e,i.current=e),!i.current)return;let n=String(i.current.resourceId),o=t.find(e=>e.motivation===`linking`&&String(xr(e.body)??``)===n);o&&(i.current=null,a.current(o.id))},[e,t])}var u1=De(Ip(),1),d1=De(Ip(),1);function f1(e,t){let n=new d1.BehaviorSubject(t),r=new d1.BehaviorSubject(!0),i=new d1.BehaviorSubject(!1),a=new d1.BehaviorSubject(null),o=!1,s=null,c=!1,l=()=>{c||(s?.unsubscribe(),s=e().subscribe(e=>{switch(e.status){case`pending`:o&&!i.getValue()&&i.next(!0);return;case`ready`:a.getValue()!==null&&a.next(null),o=!0,n.next(e.value),r.getValue()&&r.next(!1),i.getValue()&&i.next(!1);return;case`failed`:a.next(e.error),r.getValue()&&r.next(!1),i.getValue()&&i.next(!1);return}}))};return l(),{state:{value$:n.asObservable(),loading$:r.asObservable(),revalidating$:i.asObservable(),error$:a.asObservable(),retry:()=>{c||(a.next(null),o?i.next(!0):r.next(!0),l())}},dispose:()=>{c||(c=!0,s?.unsubscribe(),s=null,n.complete(),r.complete(),i.complete(),a.complete())}}}var p1={open:!1,annotationId:null,resourceId:null,defaultTitle:``,entityTypes:[]};function m1(e,t,n,r,i){let{client:a}=e,o=ml(),s=gl(a),c=Cl(a,t),l=vl(a,t),u=yl(a,t),d=bl(a,n);o.add(s),o.add(c),o.add(l),o.add(u),o.add(d);let f=f1(()=>a.browse.annotations(t),[]),p=f1(()=>a.browse.entityTypes(),[]),m=f1(()=>a.browse.events(t),[]),h=f1(()=>a.browse.referencedBy(t),[]);o.add(f.dispose),o.add(p.dispose),o.add(m.dispose),o.add(h.dispose);let g=f.state.value$.pipe((0,u1.map)(fF)),_=new u1.BehaviorSubject(``),v=new u1.BehaviorSubject(!1),y=new u1.BehaviorSubject(null),b=i?.mediaType||`text/plain`,x=Oi(b)!==`decode`;!x&&b&&(v.next(!0),a.browse.resourceRepresentation(t).then(({data:e,contentType:t})=>{_.next(hi(e,t)),v.next(!1)}).catch(()=>{v.next(!1)})),x&&a.auth.mediaToken(t).then(({token:e})=>y.next(e)).catch(()=>{});let S=new u1.BehaviorSubject(p1),C=a.bus.get(`bind:initiate`).subscribe(e=>{S.next({open:!0,annotationId:e.annotationId,resourceId:e.resourceId,defaultTitle:e.defaultTitle,entityTypes:e.entityTypes}),a.bus.get(`gather:requested`).next({correlationId:_r(),annotationId:e.annotationId,resourceId:e.resourceId,options:{contextWindow:2e3}})});return o.add(()=>C.unsubscribe()),{beckon:s,browse:r,mark:c,gather:l,yield:d,annotations:f.state,entityTypes:p.state,events:m.state,referencedBy:h.state,annotationGroups$:g,content$:_.asObservable(),contentLoading$:v.asObservable(),mediaToken$:y.asObservable(),wizard$:S.asObservable(),closeWizard:()=>S.next(p1),dispose:()=>{S.complete(),_.complete(),v.complete(),y.complete(),o.dispose()}}}function h1(){return typeof window>`u`?null:localStorage.getItem(`activeToolbarPanel`)||`knowledge-base`}function g1(e){typeof window>`u`||(e?localStorage.setItem(`activeToolbarPanel`,e):localStorage.removeItem(`activeToolbarPanel`))}function _1(){let e=Up();return YP(()=>L$(e,{initialPanel:h1(),onPanelChange:g1}))}function v1(e,t){let{context:n,...r}=e;return{...r,...t?{sourceLanguage:t}:{}}}function y1({resource:e,rUri:t,locale:n,Link:r,routes:i,ToolbarPanels:a,refetchDocument:o,streamStatus:s,knowledgeBaseName:c,browseRenderers:l,annotateRenderers:u}){let d=Em(`ReferenceWizard`),f=Em(`ResourceGenerate`),p=Up(),m=Z(p.activeSession$),h=m?.client,g=rF(),{collaborators:_}=mF(h??null),v=_.find(e=>e.servesJobTypes?.includes(`generation`)),b=(0,y.useCallback)(e=>{g(`/know/resource/${e}`,{resourceId:e})},[g]),x=(0,y.useCallback)(e=>{p.emit(`panel:open`,e)},[p]),{showError:S,showSuccess:C}=Yp(),{theme:w}=lF(),{showLineNumbers:T}=zp(),{hoverDelayMs:E}=nF(),{triggerSparkleAnimation:D,clearSparkle:O,sparkleAnnotationIds:k}=jF(),A=Wr(e)||`text/plain`,j=yF(IP(A)),ee=j.annotateMode,M=Si(A)?.render,N=M===`image`||M===`pdf`,{content:te,loading:ne,error:re}=dF(h??null,t,e,!N);(0,y.useEffect)(()=>{re&&S(`Failed to load resource representation`)},[re,S]);let{token:ie,loading:ae}=pF(h??null,t),oe=(N?zP(h,t,ie):void 0)??``,se=N?oe:te,ce=N?ae:ne,le=_1(),P=XP(m??void 0,e=>m1(e,t,n,le)),F=Z(P?.annotations.value$)??[],ue=Z(P?.annotations.error$)??null,de=Z(P?.annotationGroups$),fe=Z(P?.entityTypes.value$)??[],pe=Z(P?.entityTypes.error$)??null,me=Z(P?.referencedBy.value$)??[],he=Z(P?.referencedBy.loading$)??!0,ge=Z(P?.referencedBy.error$)??null,_e=Z(P?.events.value$)??[],ve=Z(P?.events.loading$)??!0,ye=Z(P?.events.error$)??null,be=Z(P?.beckon.hoveredAnnotationId$)??null,xe=Z(P?.mark.pendingAnnotation$)??null,Se=Z(P?.mark.assistingMotivation$)??null,Ce=Z(P?.mark.progress$)??null,we=Z(P?.browse.activePanel$)??null,Te=Z(P?.browse.scrollToAnnotationId$)??null,L=Z(P?.browse.panelInitialTab$)??null,Ee=P?.browse.onScrollCompleted,De=Z(P?.yield.progress$)??null,Oe=Z(P?.yield.isGenerating$)??!1,ke=Z(P?.yield.outcome$)??null;l1(ke,F,(0,y.useCallback)(e=>{p.emit(`panel:open`,{panel:`annotations`,scrollToAnnotationId:e,motivation:`linking`}),D(e)},[p,D]));let Ae=Z(P?.gather.context$)??null,je=Z(P?.gather.loading$)??!1,Me=Z(P?.gather.error$)??null,Ne=Z(P?.gather.resourceContext$)??null,Pe=Z(P?.gather.resourceLoading$)??!1,Fe=Z(P?.gather.resourceError$)??null,Ie=Z(P?.wizard$),Le=Ie?.open??!1,Re=Ie?.annotationId??null,ze=Ie?.resourceId??null,Be=Ie?.defaultTitle??``,Ve=Ie?.entityTypes??[],[He,Ue]=(0,y.useState)(!1),We=(0,y.useCallback)(()=>{P?.closeWizard()},[P]),Ge=(0,y.useCallback)((t,n)=>{O(dr(t)),P?.yield.generate(n.context,v1(n,Gr(e)))},[P,O,e]),Ke=(0,y.useCallback)((t,n)=>{P?.yield.generate(n.context,v1(n,Gr(e)))},[P,e]),qe=(0,y.useCallback)(async(e,n)=>{if(h)try{await h.bind.body(t,dr(e),[{op:`add`,item:{type:`SpecificResource`,source:n,purpose:`linking`}}]),C(`Reference linked successfully`)}catch(e){S(`Failed to link reference: ${e instanceof Error?e.message:String(e)}`)}},[t,h,C,S]),Je=(0,y.useCallback)(async(e,n)=>{if(!h)throw Error(`No active session`);try{let r=`text/markdown`,i=new File([new Blob([n.content],{type:r})],n.name+wi(r),{type:r}),a=await new Promise((e,t)=>{h.yield.resource({name:n.name,file:i,format:r,entityTypes:n.entityTypes,language:n.language,storageUri:n.storagePath}).subscribe({next:t=>{t.phase===`finished`&&e(t.resourceId)},error:t})});await h.bind.body(t,dr(e),[{op:`add`,item:{type:`SpecificResource`,source:a,purpose:`linking`}}]),C(`Reference successfully linked to the new resource`)}catch(e){throw S(`Failed to compose resource: ${e instanceof Error?e.message:String(e)}`),e}},[h,t,C,S]);(0,y.useEffect)(()=>{if(e&&t){let n=Wr(e);p.addOpenResource(t,e.name,n||void 0,Kr(e)),p.setLastViewedResource(t)}},[e,t,p]),(0,y.useEffect)(()=>{xe&&p.emit(`panel:open`,{panel:`annotations`})},[xe,p]);let Ye=(0,y.useCallback)(async()=>{if(h)try{await h.mark.archive(t),await o()}catch(e){console.error(`Failed to archive document:`,e),S(`Failed to archive document`)}},[h,t,o,S]),Xe=(0,y.useCallback)(async()=>{if(h)try{await h.mark.unarchive(t),await o()}catch(e){console.error(`Failed to unarchive document:`,e),S(`Failed to unarchive document`)}},[h,t,o,S]),Ze=(0,y.useCallback)(async()=>{if(h)try{let e=(await h.yield.cloneToken(t)).token;p.emit(`nav:push`,{path:`/know/compose?mode=clone&token=${e}`,reason:`clone`})}catch(e){console.error(`Failed to generate clone token:`,e),S(`Failed to generate clone link`)}},[h,t,S,p]),Qe=(0,y.useCallback)(({annotationId:e})=>{D(e)},[D]),$e=(0,y.useCallback)(e=>{D(e.payload.annotation.id)},[D]),et=(0,y.useCallback)(e=>{e.payload.operations.some(e=>e.op===`add`&&e.item.type===`SpecificResource`&&e.item.purpose===`linking`)&&D(e.payload.annotationId)},[D]),tt=(0,y.useCallback)(({resourceId:e})=>{if(i.resourceDetail){let t=i.resourceDetail(e);p.emit(`nav:push`,{path:t,reason:`reference-link`})}},[i.resourceDetail,p]),nt=(0,y.useCallback)(({entityType:e})=>{if(i.know){let t=`${i.know}?entityType=${encodeURIComponent(e)}`;p.emit(`nav:push`,{path:t,reason:`entity-type-filter`})}},[i.know,p]);c1(t),SF({"mark:archive":Ye,"mark:unarchive":Xe,"yield:clone":Ze,"beckon:sparkle":Qe,"mark:added":$e,"mark:body-updated":et,"browse:resource-open":tt,"browse:entity-type-clicked":nt});let{announceResourceLoading:rt,announceResourceLoaded:it}=EF();(0,y.useEffect)(()=>{ce?rt(e.name):se&&it(e.name)},[ce,se,e.name,rt,it]),a1(t,!ce&&!!se);let at=e.entityTypes||[],ot=Ur(e),st=ot?.mediaType,ct=ot?.byteSize,lt={...e,content:se},ut=(0,y.useCallback)(e=>{e&&m?.client.beckon.sparkle(dr(e))},[m]),dt=(0,y.useCallback)(e=>{e&&P?.beckon.focus(dr(e))},[P]);return(0,I.jsxs)(`div`,{className:`semiont-document-viewer${we?` semiont-document-viewer--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-document-viewer__main`,children:[(0,I.jsxs)(`div`,{className:`semiont-document-viewer__content`,children:[(0,I.jsx)(`div`,{className:`semiont-document-viewer__header`,children:(0,I.jsx)(`div`,{className:`semiont-document-viewer__header-inner`,children:(0,I.jsx)(`h2`,{className:`semiont-document-viewer__title`,children:e.name})})}),(0,I.jsx)(`div`,{className:`semiont-document-viewer__scrollable-body`,lang:Gr(e)||void 0,children:(0,I.jsx)(XH,{fallback:(e,t)=>(0,I.jsxs)(`div`,{className:`semiont-document-viewer__error`,children:[(0,I.jsx)(`h3`,{className:`semiont-document-viewer__error-title`,children:`Error loading document viewer`}),(0,I.jsx)(`p`,{className:`semiont-document-viewer__error-message`,children:e.message}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-document-viewer__error-button`,children:`Try again`})]}),children:ce?(0,I.jsx)(`div`,{className:`semiont-document-viewer__loading`,children:`Loading document content...`}):(0,I.jsx)(dJ,{resource:lt,annotations:de??{highlights:[],comments:[],assessments:[],references:[],tags:[]},session:m??null,onOpenResource:b,onOpenPanel:x,annotateMode:j.annotateMode,onAnnotateModeChange:j.setAnnotateMode,clickAction:j.clickAction,onClickActionChange:j.setClickAction,selectionMotivation:j.selectionMotivation,onSelectionMotivationChange:j.setSelectionMotivation,shape:j.shape,onShapeChange:j.setShape,sparkleAnnotationIds:k,generatingReferenceId:De?.annotationId??null,showLineNumbers:T,hoverDelayMs:E,hoveredAnnotationId:be,...l&&{browseRenderers:l},...u&&{annotateRenderers:u}})})})]}),(0,I.jsxs)(`div`,{className:`semiont-document-viewer__sidebar`,children:[(0,I.jsxs)(a,{activePanel:we,theme:w,width:we===`jsonld`?`w-[600px]`:we===`annotations`?`w-[400px]`:`w-64`,children:[ee&&e.archived&&(0,I.jsx)(`div`,{className:`semiont-document-viewer__archived-status`,children:(0,I.jsx)(`div`,{className:`semiont-document-viewer__archived-text`,children:`📦 Archived`})}),we===`annotations`&&!e.archived&&(0,I.jsx)(QJ,{session:m??null,onOpenResource:b,annotations:F,annotators:ww,annotateMode:ee,assistingMotivation:Se,progress:Ce,pendingAnnotation:xe,allEntityTypes:fe,annotationsError:ue,onRetryAnnotations:P?.annotations.retry,entityTypesError:pe,generatingReferenceId:De?.annotationId??null,sparkleAnnotationIds:k,referencedBy:me,referencedByLoading:he,referencedByError:ge,onRetryReferencedBy:P?.referencedBy.retry,resourceId:t,locale:n,sourceLanguage:Gr(e),scrollToAnnotationId:Te,hoveredAnnotationId:be,onScrollCompleted:Ee,initialTab:L?.tab,initialTabGeneration:L?.generation,Link:r,routes:i}),we===`history`&&(0,I.jsx)(nJ,{events:_e,eventsLoading:ve,eventsError:ye,onRetryEvents:P?.events.retry,annotations:F,hoveredAnnotationId:be,onEventHover:ut,onEventClick:dt,Link:r,routes:i}),we===`info`&&(0,I.jsx)(GJ,{session:m??null,resourceId:t,documentEntityTypes:at,documentLocale:Gr(e),primaryMediaType:st,primaryByteSize:ct,storageUri:Kr(e),isArchived:e.archived??!1,dateCreated:e.dateCreated,dateModified:e.dateModified,wasAttributedTo:e.wasAttributedTo,wasDerivedFrom:e.wasDerivedFrom,generator:e.generator,onGenerate:()=>Ue(!0),isGenerating:Oe,generationProgress:De&&!De.annotationId?De:null,generationOutcome:ke,onDismissProgress:()=>P?.yield.dismissProgress()}),we===`collaboration`&&(0,I.jsx)(OJ,{state:s,eventCount:0,knowledgeBaseName:c,collaborators:_}),we===`jsonld`&&(0,I.jsx)(LJ,{resourceId:t})]}),(0,I.jsx)(tU,{context:`document`,activePanel:we,isArchived:e.archived??!1})]})]}),(0,I.jsx)(RQ,{...v?{generationAgent:v}:{},isOpen:Le,onClose:We,annotationId:Re,resourceId:ze,defaultTitle:Be,defaultFolder:Pi(Kr(e)),entityTypes:Ve,resourceName:e.name,locale:n,context:Ae,contextLoading:je,contextError:Me,onGenerateSubmit:Ge,onLinkResource:qe,onComposeSubmit:Je,entityTypeOptions:fe,hoverDelayMs:E,translations:{resolveTitle:d(`resolveTitle`),sourceContextLabel:d(`sourceContextLabel`),connectionsLabel:d(`connectionsLabel`),citedByLabel:d(`citedByLabel`),userHintLabel:d(`userHintLabel`),userHintEffect:d(`userHintEffect`),userHintPlaceholder:d(`userHintPlaceholder`),graphPaneTitle:d(`graphPaneTitle`),graphEmpty:d(`graphEmpty`),resourceLinkLabel:d(`resourceLinkLabel`),corpusPaneTitle:d(`corpusPaneTitle`),corpusEmpty:d(`corpusEmpty`),excludedReceipt:d(`excludedReceipt`),machineRead:d(`machineRead`),loadingContext:d(`loadingContext`),failedContext:d(`failedContext`),search:d(`search`),searching:d(`searching`),generate:d(`generate`),compose:d(`compose`),resolutionStrategyLabel:d(`resolutionStrategyLabel`),back:d(`back`),link:d(`link`),score:d(`score`),noResults:d(`noResults`),resourceTitle:d(`resourceTitle`),resourceTitlePlaceholder:d(`resourceTitlePlaceholder`),saveLocation:d(`saveLocation`),additionalInstructions:d(`additionalInstructions`),additionalInstructionsPlaceholder:d(`additionalInstructionsPlaceholder`),language:d(`language`),languageHelp:d(`languageHelp`),creativity:d(`creativity`),creativityFocused:d(`creativityFocused`),creativityCreative:d(`creativityCreative`),maxLength:d(`maxLength`),maxLengthHelp:d(`maxLengthHelp`),maxLengthCeiling:d(`maxLengthCeiling`),outputFormat:d(`outputFormat`),formatExtensionMismatch:d(`formatExtensionMismatch`),maxResults:d(`maxResults`),semanticScoring:d(`semanticScoring`),semanticScoringHelp:d(`semanticScoringHelp`),searchFailed:d(`searchFailed`),entityTypes:d(`entityTypes`),contentLabel:d(`contentLabel`),createAndLink:d(`createAndLink`),creatingAndLinking:d(`creatingAndLinking`),discardDraftPrompt:d(`discardDraftPrompt`),discardDraft:d(`discardDraft`),keepEditing:d(`keepEditing`)}}),(0,I.jsx)(BQ,{...v?{generationAgent:v}:{},isOpen:He,onClose:()=>Ue(!1),resourceId:t,defaultTitle:e.name,defaultFolder:Pi(Kr(e)),locale:n,entityTypeOptions:fe,onGenerateSubmit:Ke,gatherContext:Ne,gatherLoading:Pe,gatherError:Fe,onGather:e=>P?.gather.gatherResource(t,e),translations:{title:f(`title`),gatherIntro:f(`gatherIntro`),includeContent:f(`includeContent`),includeSummary:f(`includeSummary`),gatherDepth:f(`gatherDepth`),gatherMaxResources:f(`gatherMaxResources`),gatherButton:f(`gatherButton`),editGather:f(`editGather`),recallLabel:f(`recallLabel`),loadingContext:f(`loadingContext`),failedContext:f(`failedContext`),sourceContextLabel:f(`sourceContextLabel`),connectionsLabel:f(`connectionsLabel`),citedByLabel:f(`citedByLabel`),graphPaneTitle:f(`graphPaneTitle`),graphEmpty:f(`graphEmpty`),resourceLinkLabel:f(`resourceLinkLabel`),corpusPaneTitle:f(`corpusPaneTitle`),corpusEmpty:f(`corpusEmpty`),excludedReceipt:f(`excludedReceipt`),machineRead:f(`machineRead`),score:f(`score`),resourceTitle:f(`resourceTitle`),resourceTitlePlaceholder:f(`resourceTitlePlaceholder`),saveLocation:f(`saveLocation`),additionalInstructions:f(`additionalInstructions`),additionalInstructionsPlaceholder:f(`additionalInstructionsPlaceholder`),language:f(`language`),languageHelp:f(`languageHelp`),creativity:f(`creativity`),creativityFocused:f(`creativityFocused`),creativityCreative:f(`creativityCreative`),maxLength:f(`maxLength`),maxLengthHelp:f(`maxLengthHelp`),maxLengthCeiling:f(`maxLengthCeiling`),outputFormat:f(`outputFormat`),formatExtensionMismatch:f(`formatExtensionMismatch`),generate:f(`generate`),discardDraftPrompt:f(`discardDraftPrompt`),discardDraft:f(`discardDraft`),keepEditing:f(`keepEditing`)}})]})}var b1=De(Ip(),1);function x1(e){let{client:t}=e,n=new b1.BehaviorSubject(!1);return{isLoggingOut$:n.asObservable(),logout:async()=>{n.next(!0);try{await t.auth.logout()}catch{}finally{n.next(!1)}},dispose:()=>{n.complete()}}}var S1=De(Ip(),1);function C1(e,t,n,r){let{client:i}=e,a=ml(),o=n.mode===`clone`&&!!n.token,s=o?`clone`:`new`,c=new S1.BehaviorSubject(s),l=new S1.BehaviorSubject(!0),u=new S1.BehaviorSubject(null),d=new S1.BehaviorSubject(null),f=f1(()=>i.browse.entityTypes(),[]);return a.add(f.dispose),o?(async()=>{try{let e=await i.yield.fromToken(n.token);if(e&&r){let t=ur(e[`@id`]),{data:n,contentType:r}=await i.browse.resourceRepresentation(t),a=hi(n,r);u.next({sourceResource:e,sourceContent:a})}}catch{}l.next(!1)})():l.next(!1),{browse:t,mode$:c.asObservable(),loading$:l.asObservable(),cloneData$:u.asObservable(),entityTypes:f.state,uploadProgress$:d.asObservable(),save:async e=>{if(e.mode===`clone`)return(await i.yield.createFromToken({token:n.token,name:e.name,content:e.content,archiveOriginal:e.archiveOriginal??!0})).resourceId;let t,r;if(e.file)t=e.file,r=e.format??`application/octet-stream`;else{let n=new Blob([e.content||``],{type:e.format??`application/octet-stream`}),i=wi(e.format??`application/octet-stream`);t=new File([n],e.name+i,{type:e.format??`application/octet-stream`}),r=e.format??`application/octet-stream`}let a=e.charset&&!e.file?`${r}; charset=${e.charset}`:r;return await new Promise((n,r)=>{i.yield.resource({name:e.name,file:t,format:a,entityTypes:e.entityTypes||[],language:e.language,storageUri:e.storageUri}).subscribe({next:e=>{d.next(e),e.phase===`finished`&&n(e.resourceId)},error:e=>{d.next(null),r(e)},complete:()=>d.next(null)})})},dispose:()=>{c.complete(),l.complete(),u.complete(),d.complete(),a.dispose()}}}var w1=De(Ip(),1);function T1(e,t){let{client:n}=e,r=new w1.BehaviorSubject(void 0),i=new w1.BehaviorSubject(null),a=null,o=!1,s=()=>{o||(a?.unsubscribe(),a=n.browse.resource(t).subscribe(e=>{if(e.status===`failed`){i.next(e.error);return}e.status===`ready`&&i.getValue()!==null&&i.next(null),r.next(fc(e))}))};s();let c=(0,w1.combineLatest)([r,i]).pipe((0,w1.map)(([e,t])=>e===void 0&&t===null),(0,w1.distinctUntilChanged)());return{resource$:r.asObservable(),isLoading$:c,error$:i.asObservable(),invalidate:()=>{o||(i.next(null),n.browse.invalidateResourceDetail(t),s())},dispose:()=>{o||(o=!0,a?.unsubscribe(),a=null,r.complete(),i.complete())}}}var E1=De(Ip(),1);function D1(e,t){let{client:n}=e,r=ml(),i=new E1.BehaviorSubject([]),a=new E1.BehaviorSubject(null),o=new E1.BehaviorSubject(!0),s=new E1.BehaviorSubject(!0),c=()=>{o.next(!0),n.admin.users().then(e=>{i.next(e.users??[]),o.next(!1)}).catch(()=>o.next(!1))},l=()=>{s.next(!0),n.admin.userStats().then(e=>{a.next(e.stats??null),s.next(!1)}).catch(()=>s.next(!1))};return c(),l(),{browse:t,users$:i.asObservable(),stats$:a.asObservable(),usersLoading$:o.asObservable(),statsLoading$:s.asObservable(),updateUser:async(e,t)=>{await n.admin.updateUser(qn(e),t),c(),l()},dispose:()=>{i.complete(),a.complete(),o.complete(),s.complete(),r.dispose()}}}var O1=De(Ip(),1);function k1(e,t){let{client:n}=e,r=ml(),i=new O1.BehaviorSubject([]),a=new O1.BehaviorSubject([]),o=new O1.BehaviorSubject(!0);return n.admin.oauthConfig().then(e=>{let t=e;i.next(t.providers??[]),a.next(t.allowedDomains??[]),o.next(!1)}).catch(()=>o.next(!1)),{browse:t,providers$:i.asObservable(),allowedDomains$:a.asObservable(),isLoading$:o.asObservable(),dispose:()=>{i.complete(),a.complete(),o.complete(),r.dispose()}}}var A1=De(Ip(),1);function j1(e){let{client:t}=e,n=ml(),r=new A1.BehaviorSubject(null),i=new A1.BehaviorSubject(!1);return t.auth.me().then(e=>r.next(e)).catch(()=>{}),{userData$:r.asObservable(),isProcessing$:i.asObservable(),acceptTerms:async()=>{i.next(!0);try{await t.auth.acceptTerms(),r.next({...r.getValue(),termsAcceptedAt:new Date().toISOString()})}finally{i.next(!1)}},dispose:()=>{r.complete(),i.complete(),n.dispose()}}}var M1=De(Ip(),1),N1=De(Cw(),1),P1=10,F1=20,I1=250;function L1(e,t){let{client:n}=e,r=ml(),i=new M1.BehaviorSubject(``);r.add(()=>i.complete());let a=new M1.Subject;r.add(()=>a.complete());let o=f1(()=>i.pipe((0,N1.switchMap)(e=>n.browse.resources({limit:P1,archived:!1,...e?{entityType:e}:{}}).pipe((0,N1.map)(e=>e.status===`ready`?{status:`ready`,value:e.value.resources}:e)))),[]);r.add(o.dispose);let s=f1(()=>n.browse.entityTypes(),[]);r.add(s.dispose);let c=a.pipe((0,N1.startWith)(``),(0,N1.debounceTime)(I1),(0,N1.distinctUntilChanged)()),l=(0,M1.combineLatest)([c,i]).pipe((0,N1.switchMap)(([e,t])=>{let r=e.trim();return r?n.browse.resources({search:r,limit:F1,...t?{entityType:t}:{}}).pipe((0,N1.map)(e=>{let t=fc(e);return{results:t?.resources??[],isSearching:e.status===`pending`,...t?{matchKind:t.matchKind}:{}}}),(0,N1.startWith)({results:[],isSearching:!0})):(0,M1.of)({results:[],isSearching:!1})}),(0,N1.shareReplay)({bufferSize:1,refCount:!0}));return{browse:t,search:{query$:a.pipe((0,N1.startWith)(``)),state$:l,setQuery:e=>a.next(e)},recent:o.state,entityTypes:s.state,selectedEntityType$:i.asObservable(),setSelectedEntityType:e=>i.next(e),dispose:()=>r.dispose()}}var R1=De(Ip(),1);function z1(e,t){let{client:n}=e,r=ml(),i=new R1.BehaviorSubject(``),a=new R1.BehaviorSubject(``),o=new R1.BehaviorSubject(!1),s=f1(()=>n.browse.entityTypes(),[]);return r.add(s.dispose),{browse:t,entityTypes:s.state,newTag$:i.asObservable(),error$:a.asObservable(),isAdding$:o.asObservable(),setNewTag:e=>i.next(e),addTag:async()=>{let e=i.getValue().trim();if(e){a.next(``),o.next(!0);try{await n.frame.addEntityType(e),i.next(``)}catch(e){a.next(e instanceof Error?e.message:`Failed to add entity type`)}finally{o.next(!1)}}},dispose:()=>{i.complete(),a.complete(),o.complete(),r.dispose()}}}function B1({children:e}){let t=v();return(0,I.jsxs)(QH,{resetKeys:[t.pathname],children:[(0,I.jsx)(Nq,{}),(0,I.jsx)(Mq,{}),e]})}var V1=y.lazy(()=>s(()=>import(`./layout-ChREg3PD.js`),__vite__mapDeps([5,2,3,1,6,7]))),H1=y.lazy(()=>s(()=>import(`./page-C76A3Tvm.js`),__vite__mapDeps([8,2,3,1,7]))),U1=y.lazy(()=>s(()=>import(`./page-BiEYKai0.js`),__vite__mapDeps([9,2,3,1,6,7,10,11,12]))),W1=y.lazy(()=>s(()=>import(`./page-DL5wQ3pG.js`),__vite__mapDeps([13,2,3,1,6,7,10,11,12]))),G1=y.lazy(()=>s(()=>import(`./page-ZPLCKgGQ.js`),__vite__mapDeps([14,2,3,1,6,7,10,11,12]))),K1=y.lazy(()=>s(()=>import(`./page-BOgSgEl-.js`),__vite__mapDeps([15,2,3,7,1]))),q1=y.lazy(()=>s(()=>import(`./page-CQJx-JXR.js`),__vite__mapDeps([16,2,3,1,6,7,10,11,12]))),J1=y.lazy(()=>s(()=>import(`./page-CgiAumZ6.js`),__vite__mapDeps([17,2,3,1,6,7,10,11,12]))),Y1=y.lazy(()=>s(()=>import(`./page-CrXiz4-J.js`),__vite__mapDeps([18,2,3,1,7]))),X1=y.lazy(()=>s(()=>import(`./layout-xM3HYPpK.js`),__vite__mapDeps([19,2,3,1,6,7,10,11,20,21,12]))),Z1=y.lazy(()=>s(()=>import(`./page-_daGpD2K.js`),__vite__mapDeps([22,2,3,1,7]))),Q1=y.lazy(()=>s(()=>import(`./page-DGXyF1RD.js`),__vite__mapDeps([23,3,2,1,20,11,7]))),$1=y.lazy(()=>s(()=>import(`./page-B2tTEfKp.js`),__vite__mapDeps([24,2,3,1,20,11,7]))),e0=y.lazy(()=>s(()=>import(`./page-C45jnN3u.js`),__vite__mapDeps([25,2,3,1,20,11,7,12,26]))),t0=y.lazy(()=>s(()=>import(`./layout-5m7ZN_sv.js`),__vite__mapDeps([27,2,3,1,6,7,10,11,21,28,12]))),n0=y.lazy(()=>s(()=>import(`./page-De2leEHb.js`),__vite__mapDeps([29,1,2,3,7]))),r0=y.lazy(()=>s(()=>import(`./client-kvvQzQsd.js`),__vite__mapDeps([30,2,3,1,20,11,7]))),i0=y.lazy(()=>s(()=>import(`./client-B2rbsRTh.js`),__vite__mapDeps([31,3,2,1,20,11,7]))),a0=y.lazy(()=>s(()=>import(`./page-zpMXForS.js`),__vite__mapDeps([32,2,3,1,20,11,7,28]))),o0=y.lazy(()=>s(()=>import(`./layout-DmBlX8Wv.js`),__vite__mapDeps([33,2,3,1,6,7,10,11,21,12]))),s0=y.lazy(()=>s(()=>import(`./page-DXZrFCmr.js`),__vite__mapDeps([34,2,3,1,7]))),c0=y.lazy(()=>s(()=>import(`./page-C7fj48Yd.js`),__vite__mapDeps([35,3,2,1,20,11,7]))),l0=y.lazy(()=>s(()=>import(`./page-Bfk44QuW.js`),__vite__mapDeps([36,3,2,1,20,11,7]))),u0=y.lazy(()=>s(()=>import(`./page-KrH4sIjg.js`),__vite__mapDeps([37,2,3,1,20,11,7]))),d0=y.lazy(()=>s(()=>import(`./not-found-BOkh1PJR.js`),__vite__mapDeps([26,3,2,1,7])));function f0({children:e}){let{locale:t}=u(),{i18n:n}=o();return(0,y.useEffect)(()=>{if(!t)return;let e=de(t)?t:`en`;n.language!==e&&n.changeLanguage(e)},[t,n]),!t||!de(t)?(0,I.jsx)(m,{to:`/en`,replace:!0}):(0,I.jsx)(I.Fragment,{children:e})}function p0(){return(0,I.jsx)(B1,{children:(0,I.jsx)(g,{})})}function m0(){let e=l();return(0,y.useEffect)(()=>{let t=navigator.language.split(`-`)[0]??`en`,n=de(t)?t:`en`;e(`/${n}`,{replace:!0})},[e]),null}function h0(){return(0,I.jsx)(y.Suspense,{fallback:null,children:(0,I.jsxs)(d,{children:[(0,I.jsx)(c,{path:`/`,element:(0,I.jsx)(m0,{})}),(0,I.jsxs)(c,{path:`/:locale`,element:(0,I.jsx)(f0,{children:(0,I.jsx)(V1,{})}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(H1,{})}),(0,I.jsx)(c,{path:`about`,element:(0,I.jsx)(U1,{})}),(0,I.jsx)(c,{path:`privacy`,element:(0,I.jsx)(W1,{})}),(0,I.jsx)(c,{path:`terms`,element:(0,I.jsx)(G1,{})}),(0,I.jsx)(c,{path:`auth/connect`,element:(0,I.jsx)(K1,{})}),(0,I.jsx)(c,{path:`auth/signup`,element:(0,I.jsx)(q1,{})}),(0,I.jsx)(c,{path:`auth/error`,element:(0,I.jsx)(J1,{})}),(0,I.jsxs)(c,{element:(0,I.jsx)(p0,{}),children:[(0,I.jsx)(c,{path:`auth/welcome`,element:(0,I.jsx)(Y1,{})}),(0,I.jsxs)(c,{path:`know`,element:(0,I.jsx)(X1,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(Z1,{})}),(0,I.jsx)(c,{path:`discover`,element:(0,I.jsx)(Q1,{})}),(0,I.jsx)(c,{path:`compose`,element:(0,I.jsx)($1,{})}),(0,I.jsx)(c,{path:`resource/:id`,element:(0,I.jsx)(e0,{})})]}),(0,I.jsxs)(c,{path:`admin`,element:(0,I.jsx)(t0,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(n0,{})}),(0,I.jsx)(c,{path:`users`,element:(0,I.jsx)(r0,{})}),(0,I.jsx)(c,{path:`security`,element:(0,I.jsx)(i0,{})}),(0,I.jsx)(c,{path:`devops`,element:(0,I.jsx)(a0,{})})]}),(0,I.jsxs)(c,{path:`moderate`,element:(0,I.jsx)(o0,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(s0,{})}),(0,I.jsx)(c,{path:`recent`,element:(0,I.jsx)(c0,{})}),(0,I.jsx)(c,{path:`entity-tags`,element:(0,I.jsx)(l0,{})}),(0,I.jsx)(c,{path:`tag-schemas`,element:(0,I.jsx)(u0,{})})]})]}),(0,I.jsx)(c,{path:`*`,element:(0,I.jsx)(d0,{})})]}),(0,I.jsx)(c,{path:`*`,element:(0,I.jsx)(m,{to:`/en`,replace:!0})})]})})}pe(`/assets/pdf.worker.min-CHFwMXne.mjs`);var g0={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_OTEL_OTLP_ENDPOINT;g0&&s(async()=>{let{initObservabilityWeb:e}=await import(`./web-D6kqUluK.js`);return{initObservabilityWeb:e}},[]).then(({initObservabilityWeb:e})=>{e({serviceName:`semiont-browser`,otlpEndpoint:g0})});var _0=document.getElementById(`root`);if(!_0)throw Error(`Root element not found`);b.createRoot(_0).render((0,I.jsx)(y.StrictMode,{children:(0,I.jsx)(p,{children:(0,I.jsx)(h0,{})})}));export{_1 as $,Lr as $t,cF as A,Up as At,x1 as B,Fs as Bt,JQ as C,Qp as Ct,KQ as D,Hp as Dt,tY as E,Rp as Et,D1 as F,dc as Ft,SF as G,us as Gt,ZP as H,Ss as Ht,C1 as I,el as It,$P as J,Go as Jt,nF as K,$o as Kt,L1 as L,ic as Lt,K$ as M,_l as Mt,Ew as N,Ic as Nt,qQ as O,Jp as Ot,k1 as P,Qc as Pt,XP as Q,yo as Qt,z1 as R,rc as Rt,GQ as S,am as St,U$ as T,vm as Tt,JP as U,xs as Ut,j1 as V,Cs as Vt,eF as W,fs as Wt,iF as X,To as Xt,Z as Y,Eo as Yt,oF as Z,wo as Zt,n1 as _,hm as _t,I$ as a,Rr as an,tm as at,$Q as b,pm as bt,q$ as c,Et as cn,em as ct,XQ as d,ve as dn,rm as dt,Pr as en,lF as et,TF as f,de as fn,lm as ft,AF as g,cm as gt,eU as h,gm as ht,G$ as i,ur as in,mm as it,tU as j,Yp as jt,Z$ as k,zp as kt,$J as l,ge as ln,dm as lt,J$ as m,Zp as mt,z$ as n,Ir as nn,Em as nt,wQ as o,Gn as on,im as ot,ZQ as p,_m as pt,bF as q,Qo as qt,V$ as r,Fr as rn,um as rt,QQ as s,Yn as sn,Xp as st,R$ as t,Cr as tn,Tm as tt,jq as u,_e as un,nm as ut,i1 as v,$p as vt,nU as w,om as wt,y1 as x,sm as xt,e$ as y,fm as yt,T1 as z,Ls as zt};
142
- //# sourceMappingURL=index-BkTRe71w.js.map
141
+ `),x={id:n.id,label:g,kind:`annotation`,hover:y,x:d(v+r%_),y:8+(1+Math.floor(r/_))*52};p.push(x),m.push({key:`annof-${n.id}`,kind:`annotation-of`,hover:`annotation-of`,x1:b.x+90,y1:b.y+34,x2:x.x+90,y2:x.y})});let x=Math.max(a.length,1+Math.ceil(s.length/_),i.length),S=y*216-20,C=8+x*52+8,w=e=>e.length>22?`${e.slice(0,21)}\u2026`:e,T=i.length>0||a.length>0||s.length>0;return(0,I.jsxs)(`div`,{className:`semiont-gather-pane semiont-gather-pane--graph`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:t.graphPaneTitle}),e.inferredRelationshipSummary&&(0,I.jsx)(`p`,{className:`semiont-gather-pane__summary`,children:e.inferredRelationshipSummary}),!T&&(0,I.jsx)(`p`,{className:`semiont-gather-pane__empty`,children:t.graphEmpty}),T&&(0,I.jsxs)(`svg`,{className:`semiont-graph`,viewBox:`0 0 ${S} ${C}`,style:{maxWidth:`${S}px`},role:`img`,"aria-label":t.graphPaneTitle,children:[m.map(e=>(0,I.jsxs)(`g`,{className:`semiont-graph__edge semiont-graph__edge--${e.kind}`,children:[(0,I.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}),(0,I.jsx)(`title`,{children:e.hover})]},e.key)),p.map(e=>(0,I.jsxs)(`g`,{className:`semiont-graph__node semiont-graph__node--${e.kind}`,"data-node-id":e.id,children:[(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:180,height:34,rx:6}),(0,I.jsx)(`text`,{x:e.x+10,y:e.y+22,children:w(e.label)}),(0,I.jsx)(`title`,{children:e.hover})]},e.id))]})]})}function EQ({semanticContext:e,translations:t}){let n=[...e?.similar??[]].sort((e,t)=>t.score-e.score),r=e?.excludedEntityTypes??[];return(0,I.jsxs)(`div`,{className:`semiont-gather-pane semiont-gather-pane--corpus`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:t.corpusPaneTitle}),n.length===0?(0,I.jsx)(`p`,{className:`semiont-gather-pane__empty`,children:t.corpusEmpty}):(0,I.jsx)(`ul`,{className:`semiont-corpus__list`,children:n.map((e,n)=>(0,I.jsxs)(`li`,{className:`semiont-corpus__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-corpus__card-head`,children:[(0,I.jsx)(`span`,{className:`semiont-corpus__source`,children:e.resourceName}),(e.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e)),e.machineRead&&(0,I.jsx)(`span`,{className:`semiont-chip semiont-corpus__trust`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:t.machineRead}),(0,I.jsxs)(`span`,{className:`semiont-corpus__score`,children:[t.score,`: `,e.score.toFixed(2)]})]}),(0,I.jsx)(`p`,{className:`semiont-corpus__snippet`,children:e.text})]},`${e.resourceId}-${n}`))}),r.length>0&&(0,I.jsx)(`p`,{className:`semiont-corpus__receipt`,children:t.excludedReceipt.replace(`{{types}}`,r.join(`, `))})]})}function DQ({context:e,contextLoading:t,contextError:n,pending:r,annotate:i,chosenStrategy:a,translations:o}){let[s,c]=(0,y.useState)(!1),l=!t&&!n&&!!e,u=e?.focus.kind===`annotation`?e.focus:null,d=e?.focus.kind===`resource`?e.focus:null,f=u?.annotation.motivation?Tw(u.annotation.motivation):void 0,p=f?ww[f].className:void 0,m=(0,y.useRef)(null);(0,y.useEffect)(()=>{m.current&&m.current.scrollIntoView({block:`center`,behavior:`instant`})},[e]);let h=i&&(0,I.jsx)(`div`,{className:`semiont-gather__hint-row`,children:(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,children:[i.translations.userHintLabel,(0,I.jsxs)(`span`,{className:`semiont-gather__hint-effect`,children:[` — `,i.translations.userHintEffect]})]}),(0,I.jsx)(`textarea`,{value:i.userHint,onChange:e=>i.onUserHintChange(e.target.value),placeholder:i.translations.userHintPlaceholder,className:`semiont-search-modal__search-input semiont-gather__hint-textarea`,style:{resize:`vertical`,fontFamily:`inherit`}})]})}),g=i&&(0,I.jsxs)(`div`,{className:`semiont-gather__footer`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__footer-label`,children:i.translations.resolutionStrategyLabel}),(0,I.jsxs)(`div`,{className:`semiont-gather__actions`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:i.onBind,disabled:!l,className:`semiont-button--primary semiont-button--flex`,children:[`🔍 `,i.translations.search,`…`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:i.onGenerate,disabled:!l,className:`semiont-button--primary semiont-button--flex`,children:[`✨ `,i.translations.generate,`…`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:i.onCompose,disabled:!l,className:`semiont-button--secondary semiont-button--flex`,children:[`✍️ `,i.translations.compose]})]})]});return(0,I.jsxs)(`div`,{className:`semiont-gather__outer`,children:[t&&r&&(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton`,role:`status`,children:[(0,I.jsx)(`span`,{className:`semiont-sr-only`,children:o.loadingContext}),r.resourceName&&(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-source`,children:[o.sourceContextLabel,` "${r.resourceName}"`]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-header`,children:[(0,I.jsxs)(`span`,{className:`semiont-gather__skeleton-exact`,children:[`"`,r.exact,`"`]}),r.entityTypes.length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:r.entityTypes.map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-panes`,children:[(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-pane`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:o.graphPaneTitle}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-pane`,children:[(0,I.jsx)(`div`,{className:`semiont-gather-pane__title`,children:o.corpusPaneTitle}),(0,I.jsxs)(`div`,{className:`semiont-gather__skeleton-dots`,"aria-hidden":`true`,children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]})]})]}),h,g]}),t&&!r&&(0,I.jsxs)(`div`,{className:`semiont-gather__loading`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-dot`})]}),(0,I.jsx)(`span`,{className:`semiont-gather__loading-text`,children:o.loadingContext})]}),!!n&&(0,I.jsx)(`div`,{style:{textAlign:`center`,padding:`1rem 0`,color:`var(--semiont-color-red-600)`},children:o.failedContext}),e&&(0,I.jsxs)(I.Fragment,{children:[u?.selected&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-strip`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,gap:`0.5rem`,marginBottom:`0.375rem`},children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,style:{marginBottom:0},children:[o.sourceContextLabel,u.sourceResource.name?` "${u.sourceResource.name}"`:``]}),(e.metadata?.entityTypes??[]).length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:(e.metadata?.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__source-box${s?` semiont-gather__source-box--expanded`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__source-context`,children:(0,I.jsxs)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,whiteSpace:`pre-wrap`,color:`var(--semiont-text-secondary)`},children:[u.selected.before&&(0,I.jsx)(`span`,{children:u.selected.before}),(0,I.jsx)(`span`,{ref:m,...p?{className:p}:{},children:u.selected.text}),u.selected.after&&(0,I.jsx)(`span`,{children:u.selected.after})]})}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-gather__expand-btn`,onClick:()=>c(e=>!e),children:s?`▲ less`:`▼ more`})]})]}),d&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-strip`,children:[(0,I.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,gap:`0.5rem`,marginBottom:`0.375rem`},children:[(0,I.jsxs)(`label`,{className:`semiont-form__label`,style:{marginBottom:0},children:[o.sourceContextLabel,d.resource.name?` "${d.resource.name}"`:``]}),(e.metadata?.entityTypes??[]).length>0&&(0,I.jsx)(`span`,{style:{display:`flex`,gap:`0.25rem`,flexWrap:`wrap`},children:(e.metadata?.entityTypes??[]).map(e=>(0,I.jsx)(`span`,{className:`semiont-chip`,style:{fontSize:`var(--semiont-text-xs)`,padding:`0.125rem 0.375rem`,fontWeight:400},children:e},e))})]}),(d.summary||d.content?.main)&&(0,I.jsxs)(`div`,{className:`semiont-gather__source-box${s?` semiont-gather__source-box--expanded`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__source-context`,children:(0,I.jsx)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,whiteSpace:`pre-wrap`,color:`var(--semiont-text-secondary)`},children:d.summary??d.content?.main})}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-gather__expand-btn`,onClick:()=>c(e=>!e),children:s?`▲ less`:`▼ more`})]}),d.suggestedReferences&&d.suggestedReferences.length>0&&(0,I.jsx)(`ul`,{className:`semiont-gather__suggested`,children:d.suggestedReferences.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-gather__body`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__left`,children:(0,I.jsx)(TQ,{context:e,translations:o})}),(0,I.jsx)(`div`,{className:`semiont-gather__right`,children:(0,I.jsx)(EQ,{semanticContext:e.semanticContext,translations:o})})]}),u&&h,u&&g,!i&&a&&(0,I.jsxs)(`div`,{className:`semiont-gather__footer semiont-gather__footer--echo`,children:[(0,I.jsx)(`div`,{className:`semiont-gather__footer-label`,children:a.label}),(0,I.jsx)(`span`,{className:`semiont-gather__chosen-strategy`,children:a.value})]})]})]})}function OQ({backLabel:e,onBack:t,primary:n}){let r=n?.pending??!1;return(0,I.jsxs)(`div`,{className:`semiont-modal__actions semiont-modal__actions--wizard`,children:[t&&e&&(0,I.jsxs)(`button`,{type:`button`,onClick:t,className:`semiont-button--secondary semiont-wizard-footer__back`,disabled:r,children:[`◀ `,e]}),n&&(0,I.jsx)(`button`,{type:n.type,...n.onClick?{onClick:n.onClick}:{},className:`semiont-button--primary`,disabled:r||(n.disabled??!1),"data-pending":r?`true`:`false`,children:r?n.pendingLabel??n.label:n.label})]})}var kQ=100,AQ=4e3,jQ=e=>Si(e)?.extension??``,MQ=(e,t)=>({title:e,storagePath:``,prompt:``,language:t,temperature:.7,maxTokensText:`500`,outputMediaType:`text/markdown`});function NQ({context:e,hintEcho:t,config:n,onConfigChange:r,onBack:i,onGenerate:a,defaultFolder:o=``,translations:s,generationAgent:c}){let{title:l,storagePath:u,prompt:d,language:f,temperature:p,maxTokensText:m,outputMediaType:h}=n,g=e=>r({...n,...e}),_=u!==``,v=Fi(o,l,h),b=_?u:v,x=jQ(h),S=b!==``&&!b.toLowerCase().endsWith(x.toLowerCase()),C=c?.limits?.maxOutputTokens??AQ,w=(e=>Math.min(Math.max(Number.isFinite(e)?e:kQ,kQ),C))(parseInt(m,10));return(0,y.useEffect)(()=>{let e=parseInt(m,10);Number.isFinite(e)&&e>C&&g({maxTokensText:String(C)})},[C]),(0,I.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),S)return;let n=d.trim();a({title:l,storageUri:`file://${b}`,...n?{prompt:n}:{},language:f,temperature:p,maxTokens:w,outputMediaType:h,context:e})},className:`semiont-form`,children:[t&&(0,I.jsxs)(`p`,{className:`semiont-wizard__hint-echo`,children:[t.label,`: `,t.value]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-title`,className:`semiont-form__label`,children:s.resourceTitle}),(0,I.jsx)(`input`,{id:`wizard-title`,type:`text`,value:l,onChange:e=>g({title:e.target.value}),required:!0,className:`semiont-input`,placeholder:s.resourceTitlePlaceholder})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-storagePath`,className:`semiont-form__label`,children:s.saveLocation}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`wizard-storagePath`,type:`text`,value:b,onChange:e=>g({storagePath:e.target.value}),required:!0,"aria-invalid":S,...S?{"aria-describedby":`wizard-format-mismatch`}:{},className:`semiont-input semiont-input--addon`,placeholder:`generated/my-resource.md`})]}),S&&(0,I.jsx)(`p`,{id:`wizard-format-mismatch`,className:`semiont-form__error`,role:`alert`,children:s.formatExtensionMismatch.replace(`{{extension}}`,x)})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-outputFormat`,className:`semiont-form__label`,children:s.outputFormat}),(0,I.jsx)(`select`,{id:`wizard-outputFormat`,value:h,onChange:e=>g({outputMediaType:e.target.value}),className:`semiont-select`,children:ji.map(e=>(0,I.jsx)(`option`,{value:e,children:Si(e)?.label??e},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-prompt`,className:`semiont-form__label`,children:s.additionalInstructions}),(0,I.jsx)(`textarea`,{id:`wizard-prompt`,value:d,onChange:e=>g({prompt:e.target.value}),rows:2,className:`semiont-textarea`,placeholder:s.additionalInstructionsPlaceholder})]}),(0,I.jsxs)(`div`,{className:`semiont-form__inline-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-language`,className:`semiont-form__label`,children:s.language}),(0,I.jsx)(`select`,{id:`wizard-language`,value:f,onChange:e=>g({language:e.target.value}),className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--slider`,children:[(0,I.jsxs)(`label`,{htmlFor:`wizard-temperature`,className:`semiont-form__label`,children:[s.creativity,` (`,p.toFixed(1),`)`]}),(0,I.jsx)(`input`,{id:`wizard-temperature`,type:`range`,min:`0`,max:`1`,step:`0.1`,value:p,onChange:e=>g({temperature:parseFloat(e.target.value)}),className:`semiont-slider`}),(0,I.jsxs)(`div`,{className:`semiont-slider__labels semiont-slider__labels--small`,children:[(0,I.jsx)(`span`,{children:s.creativityFocused}),(0,I.jsx)(`span`,{children:s.creativityCreative})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow semiont-form__field--end`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-maxTokens`,className:`semiont-form__label`,children:s.maxLength}),(0,I.jsx)(`input`,{id:`wizard-maxTokens`,type:`number`,min:kQ,max:C,step:`100`,value:m,onChange:e=>{let t=e.target.value;if(t===``){g({maxTokensText:``});return}let n=parseInt(t,10);Number.isFinite(n)&&g({maxTokensText:String(Math.min(n,C))})},className:`semiont-input`})]})]}),(0,I.jsx)(`p`,{className:`semiont-form__help semiont-form__help--row`,children:c?.limits?s.maxLengthCeiling.replace(`{{maxOutputTokens}}`,String(C)).replace(`{{model}}`,c.agent.model??c.agent.name):s.maxLengthHelp}),(0,I.jsx)(OQ,{...i&&s.back?{backLabel:s.back,onBack:i}:{},primary:{label:s.generate,type:`submit`,disabled:S}})]})}function PQ({config:e,hintEcho:t,onConfigChange:n,isSearching:r=!1,searchError:i=null,onBack:a,onSearch:o,translations:s}){return(0,I.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),o(e)},className:`semiont-form`,children:[t&&(0,I.jsxs)(`p`,{className:`semiont-wizard__hint-echo`,children:[t.label,`: `,t.value]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`wizard-limit`,className:`semiont-form__label`,children:s.maxResults}),(0,I.jsxs)(`select`,{id:`wizard-limit`,value:e.limit,onChange:t=>n({...e,limit:parseInt(t.target.value)}),className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:1,children:`1`}),(0,I.jsx)(`option`,{value:5,children:`5`}),(0,I.jsx)(`option`,{value:10,children:`10`}),(0,I.jsx)(`option`,{value:20,children:`20`})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsxs)(`label`,{className:`semiont-form__label semiont-form__label--inline`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:e.useSemanticScoring,onChange:t=>n({...e,useSemanticScoring:t.target.checked})}),s.semanticScoring]}),(0,I.jsx)(`p`,{className:`semiont-form__help`,children:s.semanticScoringHelp})]}),i&&(0,I.jsxs)(`div`,{role:`alert`,style:{textAlign:`center`,padding:`0.5rem 0`,color:`var(--semiont-color-red-600)`},children:[s.searchFailed,`: `,i]}),(0,I.jsx)(OQ,{backLabel:s.back,onBack:a,primary:{label:s.search,pendingLabel:s.searching,pending:r,type:`submit`}})]})}function FQ({results:e,onLink:t,onBack:n,translations:r}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`semiont-search-results`,children:e.length===0?(0,I.jsx)(`div`,{className:`semiont-modal__empty-state`,style:{textAlign:`center`,padding:`2rem 0`},children:r.noResults}):e.map(e=>{let n=e[`@id`];return(0,I.jsxs)(`div`,{style:{padding:`0.75rem`,borderBottom:`1px solid var(--semiont-border-primary)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`},children:[(0,I.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,I.jsx)(`div`,{style:{fontWeight:500,color:`var(--semiont-text-primary)`},children:e.name}),e.description&&(0,I.jsx)(`div`,{style:{fontSize:`var(--semiont-text-sm)`,color:`var(--semiont-text-secondary)`,marginTop:`0.25rem`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description}),(0,I.jsxs)(`div`,{style:{fontSize:`var(--semiont-text-xs)`,color:`var(--semiont-text-tertiary)`,marginTop:`0.25rem`,display:`flex`,gap:`0.5rem`},children:[e.score!==void 0&&(0,I.jsxs)(`span`,{children:[r.score,`: `,e.score]}),e.matchReason&&(0,I.jsx)(`span`,{children:e.matchReason})]})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:`semiont-button--primary`,style:{flexShrink:0},children:[`🔗 `,r.link]})]},n)})}),(0,I.jsx)(OQ,{backLabel:r.back,onBack:n})]})}function IQ({draft:e,onDraftChange:t,defaultFolder:n=``,referenceEntityTypes:r,entityTypeOptions:i,showLineNumbers:a,hoverDelayMs:o,onBack:s,onCompose:c,translations:l}){let u=e.storagePath===``?Fi(n,e.name,`text/markdown`):e.storagePath,[d,f]=(0,y.useState)(!1),p=r.length>0;return(0,I.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!(!e.name.trim()||!u.trim())){f(!0);try{await c({name:e.name,storagePath:`file://${u}`,content:e.content,entityTypes:p?r:e.entityTypes,language:e.language})}catch{}finally{f(!1)}}},className:`semiont-form`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-name`,className:`semiont-form__label`,children:l.resourceTitle}),(0,I.jsx)(`input`,{id:`compose-name`,type:`text`,value:e.name,onChange:e=>t({name:e.target.value}),placeholder:l.resourceTitlePlaceholder,required:!0,className:`semiont-input`,disabled:d})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-storagePath`,className:`semiont-form__label`,children:l.saveLocation}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`compose-storagePath`,type:`text`,value:u,onChange:e=>t({storagePath:e.target.value}),placeholder:`people/my-resource.md`,required:!0,className:`semiont-input semiont-input--addon`,disabled:d})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`div`,{className:`semiont-form__label`,children:l.entityTypes}),p?(0,I.jsx)(`div`,{className:`semiont-form__entity-type-tags`,role:`list`,children:r.map(e=>(0,I.jsx)(`span`,{role:`listitem`,className:`semiont-form__entity-type-tag`,children:e},e))}):(0,I.jsx)(`div`,{className:`semiont-form__entity-type-buttons`,role:`group`,children:i.map(n=>{let r=e.entityTypes.includes(n);return(0,I.jsx)(`button`,{type:`button`,onClick:()=>t({entityTypes:r?e.entityTypes.filter(e=>e!==n):[...e.entityTypes,n]}),className:`semiont-form__entity-type-button`,"data-selected":r,"aria-pressed":r,disabled:d,children:n},n)})})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`compose-language`,className:`semiont-form__label`,children:l.language}),(0,I.jsx)(`select`,{id:`compose-language`,value:e.language,onChange:e=>t({language:e.target.value}),disabled:d,className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__editor`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:l.contentLabel}),(0,I.jsx)(`div`,{className:`semiont-form__editor-wrapper`,lang:e.language,children:(0,I.jsx)(KH,{content:e.content,editable:!d,sourceView:!0,showLineNumbers:a,hoverDelayMs:o,onChange:e=>t({content:e})})})]}),(0,I.jsx)(OQ,{backLabel:l.back,onBack:s,primary:{label:l.createAndLink,pendingLabel:l.creatingAndLinking,pending:d,type:`submit`}})]})}function LQ({prompt:e,discardLabel:t,keepLabel:n,onDiscard:r,onKeepEditing:i}){return(0,I.jsxs)(`div`,{className:`semiont-wizard__discard-prompt`,role:`alert`,children:[(0,I.jsx)(`span`,{className:`semiont-wizard__discard-prompt-text`,children:e}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-button--danger`,onClick:r,children:t}),(0,I.jsx)(`button`,{type:`button`,className:`semiont-button--secondary`,onClick:i,children:n})]})}function RQ({isOpen:e,onClose:t,annotationId:n,resourceId:r,defaultTitle:i,defaultFolder:a,entityTypes:o,resourceName:s,locale:c,context:l,contextLoading:u,contextError:d,onGenerateSubmit:f,onLinkResource:p,onComposeSubmit:m,entityTypeOptions:h=[],hoverDelayMs:g=300,translations:_,generationAgent:v}){let b=Z(Up().activeSession$),[x,S]=(0,y.useState)({step:`gather`}),[C,w]=(0,y.useState)({limit:10,useSemanticScoring:!0}),[T,E]=(0,y.useState)(()=>MQ(i,c)),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(null),[j,ee]=(0,y.useState)(``),M=()=>({name:i,storagePath:``,content:``,entityTypes:[],language:c}),[N,te]=(0,y.useState)(M),[ne,re]=(0,y.useState)(!1),{showLineNumbers:ie}=zp(),ae=(0,y.useRef)(i);(0,y.useEffect)(()=>{e&&(ae.current=i,S({step:`gather`}),w({limit:10,useSemanticScoring:!0}),E(MQ(i,c)),O(!1),A(null),ee(``),te(M()),re(!1))},[e]),xF(`match:search-results`,t=>{e&&n&&t.referenceId===n&&(O(!1),S({step:`search-results`,results:t.response}))}),xF(`match:search-failed`,t=>{e&&n&&t.referenceId===n&&(O(!1),A(t.error))});let oe=(0,y.useCallback)(()=>{S({step:`configure-search`})},[]),se=l?j?{...l,focus:{...l.focus,userHint:j}}:l:null,ce=(0,y.useCallback)(()=>{S({step:`configure-generation`})},[]),le=(0,y.useCallback)(()=>{!l||!n||!r||S({step:`compose`})},[l,n,r]),P=(0,y.useCallback)(async e=>{n&&(await m(n,e),t())},[n,m,t]),F=N.content.trim()!==``||N.storagePath.trim()!==``||N.name!==ae.current||T.title!==ae.current||T.storagePath.trim()!==``||T.prompt.trim()!==``,ue=(0,y.useCallback)(()=>{if(F){re(!0);return}t()},[F,t]),de=(0,y.useCallback)(()=>{S({step:`gather`})},[]),fe=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=fe.current;e&&(e.scrollTop=e.scrollHeight)},[x.step]);let pe=(0,y.useCallback)(e=>{!n||!se||!r||(O(!0),A(null),b?.client.match.requestSearch({correlationId:_r(),resourceId:r,referenceId:n,context:se,limit:e.limit,useSemanticScoring:e.useSemanticScoring}))},[n,r,se,b]),me=(0,y.useCallback)(e=>{n&&(f(n,e),t())},[n,f,t]),he=(0,y.useCallback)(e=>{n&&(p(n,e),t())},[n,p,t]),ge={loadingContext:_.loadingContext,failedContext:_.failedContext,sourceContextLabel:_.sourceContextLabel,connectionsLabel:_.connectionsLabel,citedByLabel:_.citedByLabel,graphPaneTitle:_.graphPaneTitle,graphEmpty:_.graphEmpty,resourceLinkLabel:_.resourceLinkLabel,corpusPaneTitle:_.corpusPaneTitle,corpusEmpty:_.corpusEmpty,excludedReceipt:_.excludedReceipt,machineRead:_.machineRead,score:_.score};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:ue,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering semiont-search-modal__centering--center`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel semiont-search-modal__panel--with-border semiont-search-modal__panel--gather semiont-search-modal__panel--wide`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__header`,children:[(0,I.jsx)(Sq,{className:`semiont-search-modal__title`,children:_.resolveTitle}),(0,I.jsx)(`button`,{onClick:ue,className:`semiont-search-modal__close-button`,"aria-label":`Close`,children:`✕`})]}),ne&&(0,I.jsx)(LQ,{prompt:_.discardDraftPrompt,discardLabel:_.discardDraft,keepLabel:_.keepEditing,onDiscard:()=>{re(!1),t()},onKeepEditing:()=>re(!1)}),x.step===`gather`&&(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,pending:{exact:i,entityTypes:o,...s?{resourceName:s}:{}},annotate:{userHint:j,onUserHintChange:ee,onBind:oe,onGenerate:ce,onCompose:le,translations:{search:_.search,generate:_.generate,compose:_.compose,resolutionStrategyLabel:_.resolutionStrategyLabel,userHintLabel:_.userHintLabel,userHintEffect:_.userHintEffect,userHintPlaceholder:_.userHintPlaceholder}},translations:ge}),x.step===`compose`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u270D\uFE0F ${_.compose}`},translations:ge}),(0,I.jsx)(IQ,{draft:N,onDraftChange:e=>te(t=>({...t,...e})),defaultFolder:a,referenceEntityTypes:o,entityTypeOptions:h,showLineNumbers:ie,hoverDelayMs:g,onBack:de,onCompose:P,translations:{resourceTitle:_.resourceTitle,resourceTitlePlaceholder:_.resourceTitlePlaceholder,saveLocation:_.saveLocation,entityTypes:_.entityTypes,language:_.language,contentLabel:_.contentLabel,back:_.back,createAndLink:_.createAndLink,creatingAndLinking:_.creatingAndLinking}})]}),x.step===`configure-generation`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u2728 ${_.generate}`},translations:ge}),(0,I.jsx)(NQ,{...v?{generationAgent:v}:{},...j?{hintEcho:{label:_.userHintLabel,value:j}}:{},context:se??l,config:T,onConfigChange:E,defaultFolder:a,onBack:de,onGenerate:me,translations:{resourceTitle:_.resourceTitle,resourceTitlePlaceholder:_.resourceTitlePlaceholder,saveLocation:_.saveLocation,additionalInstructions:_.additionalInstructions,additionalInstructionsPlaceholder:_.additionalInstructionsPlaceholder,language:_.language,languageHelp:_.languageHelp,creativity:_.creativity,creativityFocused:_.creativityFocused,creativityCreative:_.creativityCreative,maxLength:_.maxLength,maxLengthHelp:_.maxLengthHelp,maxLengthCeiling:_.maxLengthCeiling,outputFormat:_.outputFormat,formatExtensionMismatch:_.formatExtensionMismatch,back:_.back,generate:_.generate}})]}),x.step===`configure-search`&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u{1F50D} ${_.search}`},translations:ge}),(0,I.jsx)(PQ,{config:C,...j?{hintEcho:{label:_.userHintLabel,value:j}}:{},onConfigChange:w,isSearching:D,searchError:k,onBack:de,onSearch:pe,translations:{maxResults:_.maxResults,semanticScoring:_.semanticScoring,semanticScoringHelp:_.semanticScoringHelp,back:_.back,search:_.search,searching:_.searching,searchFailed:_.searchFailed}})]}),x.step===`search-results`&&l&&(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:fe,children:[(0,I.jsx)(DQ,{context:l,contextLoading:u,contextError:d,chosenStrategy:{label:_.resolutionStrategyLabel,value:`\u{1F50D} ${_.search}`},translations:ge}),(0,I.jsx)(FQ,{results:x.results,onLink:he,onBack:de,translations:{noResults:_.noResults,link:_.link,back:_.back,score:_.score}})]})]})})})})]})})}function zQ({onGather:e,translations:t,children:n}){let[r,i]=(0,y.useState)(!0),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(2),[l,u]=(0,y.useState)(10);return(0,I.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e({includeContent:r,includeSummary:a,depth:s,maxResources:l})},className:`semiont-form`,children:[(0,I.jsx)(`p`,{className:`semiont-form__helper-text`,children:t.intro}),(0,I.jsx)(`div`,{className:`semiont-form__checkbox-field`,children:(0,I.jsxs)(`label`,{className:`semiont-form__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),t.includeContent]})}),(0,I.jsx)(`div`,{className:`semiont-form__checkbox-field`,children:(0,I.jsxs)(`label`,{className:`semiont-form__checkbox-label`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),t.includeSummary]})}),(0,I.jsxs)(`div`,{className:`semiont-form__inline-row`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow`,children:[(0,I.jsx)(`label`,{htmlFor:`gather-depth`,className:`semiont-form__label`,children:t.depth}),(0,I.jsx)(`input`,{id:`gather-depth`,type:`number`,min:`1`,max:`5`,value:s,onChange:e=>c(parseInt(e.target.value)),className:`semiont-input`})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__field--inline semiont-form__field--narrow`,children:[(0,I.jsx)(`label`,{htmlFor:`gather-max`,className:`semiont-form__label`,children:t.maxResources}),(0,I.jsx)(`input`,{id:`gather-max`,type:`number`,min:`1`,max:`50`,value:l,onChange:e=>u(parseInt(e.target.value)),className:`semiont-input`})]})]}),n,(0,I.jsx)(OQ,{primary:{label:t.gather,type:`submit`}})]})}function BQ({isOpen:e,onClose:t,resourceId:n,defaultTitle:r,defaultFolder:i,locale:a,entityTypeOptions:o=[],onGenerateSubmit:s,gatherContext:c,gatherLoading:l,gatherError:u,onGather:d,translations:f,generationAgent:p}){let m=()=>MQ(r,a),[h,g]=(0,y.useState)(m),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)([]),O=(0,y.useRef)(!1),k=(0,y.useRef)(r);(0,y.useEffect)(()=>{e&&!O.current&&(v(!1),x(null),C(!1),D([]),g(m()),T(!1),k.current=r),O.current=e},[e]);let A=(0,y.useCallback)(e=>{v(!0),x({...e,excludeEntityTypes:E}),C(!1),d({...e,...E.length?{excludeEntityTypes:E}:{}})},[d,E]),j=(0,y.useCallback)(e=>{s(n,e),t()},[s,n,t]),ee=h.title!==k.current||h.storagePath.trim()!==``||h.prompt.trim()!==``,M=(0,y.useCallback)(()=>{if(ee){T(!0);return}t()},[ee,t]),N=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=N.current;e&&c&&(e.scrollTop=e.scrollHeight)},[c]);let te={loadingContext:f.loadingContext,failedContext:f.failedContext,sourceContextLabel:f.sourceContextLabel,connectionsLabel:f.connectionsLabel,citedByLabel:f.citedByLabel,graphPaneTitle:f.graphPaneTitle,graphEmpty:f.graphEmpty,resourceLinkLabel:f.resourceLinkLabel,corpusPaneTitle:f.corpusPaneTitle,corpusEmpty:f.corpusEmpty,excludedReceipt:f.excludedReceipt,machineRead:f.machineRead,score:f.score};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:M,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering semiont-search-modal__centering--center`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel semiont-search-modal__panel--with-border semiont-search-modal__panel--gather semiont-search-modal__panel--wide`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__header`,children:[(0,I.jsx)(Sq,{className:`semiont-search-modal__title`,children:f.title}),(0,I.jsx)(`button`,{onClick:M,className:`semiont-search-modal__close-button`,"aria-label":`Close`,children:`✕`})]}),w&&(0,I.jsx)(LQ,{prompt:f.discardDraftPrompt,discardLabel:f.discardDraft,keepLabel:f.keepEditing,onDiscard:()=>{T(!1),t()},onKeepEditing:()=>T(!1)}),(0,I.jsxs)(`div`,{className:`semiont-wizard__step-scroll`,ref:N,children:[_&&!S&&b&&(0,I.jsxs)(`button`,{type:`button`,className:`semiont-gather-receipt`,title:f.editGather,onClick:()=>C(!0),children:[[`${f.gatherDepth} ${b.depth}`,`${f.gatherMaxResources} ${b.maxResources}`,...b.includeContent?[f.includeContent]:[],...b.includeSummary?[f.includeSummary]:[],...b.excludeEntityTypes.length?[f.excludedReceipt.replace(`{{types}}`,b.excludeEntityTypes.join(`, `))]:[]].join(` · `),(0,I.jsx)(`span`,{"aria-hidden":`true`,children:` ✎`})]}),(0,I.jsx)(`div`,{hidden:_&&!S,children:(0,I.jsx)(zQ,{onGather:A,translations:{intro:f.gatherIntro,includeContent:f.includeContent,includeSummary:f.includeSummary,depth:f.gatherDepth,maxResources:f.gatherMaxResources,gather:f.gatherButton},children:o.length>0&&(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__entity-types`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:f.recallLabel}),(0,I.jsx)(`div`,{className:`semiont-form__recall-chips`,children:o.map(e=>{let t=!E.includes(e);return(0,I.jsx)(`button`,{type:`button`,className:`semiont-form__recall-chip`,"data-included":t,"aria-pressed":t,onClick:()=>D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:e},e)})})]})})}),_&&(0,I.jsx)(DQ,{context:c,contextLoading:l,contextError:u,translations:te}),_&&c&&(0,I.jsx)(NQ,{...p?{generationAgent:p}:{},context:c,config:h,onConfigChange:g,defaultFolder:i,onGenerate:j,translations:{resourceTitle:f.resourceTitle,resourceTitlePlaceholder:f.resourceTitlePlaceholder,saveLocation:f.saveLocation,additionalInstructions:f.additionalInstructions,additionalInstructionsPlaceholder:f.additionalInstructionsPlaceholder,language:f.language,languageHelp:f.languageHelp,creativity:f.creativity,creativityFocused:f.creativityFocused,creativityCreative:f.creativityCreative,maxLength:f.maxLength,maxLengthHelp:f.maxLengthHelp,maxLengthCeiling:f.maxLengthCeiling,outputFormat:f.outputFormat,formatExtensionMismatch:f.formatExtensionMismatch,generate:f.generate}})]})]})})})})]})})}var VQ=De(Cw(),1);function HQ(){let{announce:e}=wF();return{announceSearching:(0,y.useCallback)(()=>{e(`Searching...`,`polite`)},[e]),announceSearchResults:(0,y.useCallback)((t,n)=>{e(t===0?`No results found for ${n}`:t===1?`1 result found for ${n}`:`${t} results found for ${n}`,`polite`)},[e]),announceSelection:(0,y.useCallback)((t,n)=>{e(`Selected ${n}: ${t}. Press Enter to navigate.`,`polite`)},[e]),announceNavigation:(0,y.useCallback)((t,n)=>{e(`Navigating to ${n}: ${t}`,`assertive`)},[e])}}var UQ=300,WQ=5;function GQ({isOpen:e,onClose:t,onNavigate:n,translations:r={}}){let{announceSearchResults:i,announceSearching:a}=HQ(),o=Z(Up().activeSession$)?.client,s=(0,y.useRef)(o);s.current=o;let[c,l]=(0,y.useState)(0),u={placeholder:r.placeholder||`Search resources, entities...`,searching:r.searching||`Searching...`,noResults:r.noResults||`No results found for`,startTyping:r.startTyping||`Start typing to search...`,navigate:r.navigate||`Navigate`,select:r.select||`Select`,close:r.close||`Close`,enter:r.enter||`Enter`,esc:r.esc||`ESC`},[d]=(0,y.useState)(()=>hl(e=>s.current.browse.resources({search:e,limit:WQ}).pipe((0,VQ.map)(e=>{let t=fc(e)?.resources;if(t!==void 0)return t.map(e=>{let t=Hr(e);return t?{type:`resource`,id:t,name:e.name,content:e.content?.substring(0,150)}:null}).filter(e=>e!==null)})),{debounceMs:UQ}));(0,y.useEffect)(()=>()=>d.dispose(),[d]);let f=Z(d.query$)??``,p=Z(d.state$),m=p?.results??[],h=p?.isSearching??!1;(0,y.useEffect)(()=>{e&&(d.setQuery(``),l(0))},[e,d]),(0,y.useEffect)(()=>{l(0)},[m.length]),(0,y.useEffect)(()=>{f.trim()&&(h?a():i(m.length,f))},[h,m.length]);let g=e=>{e.key===`ArrowDown`?(e.preventDefault(),l(e=>(e+1)%Math.max(1,m.length))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>(e-1+Math.max(1,m.length))%Math.max(1,m.length))):e.key===`Enter`&&m[c]&&(e.preventDefault(),_(m[c]))},_=e=>{t(),n(e.type,e.id)};return(0,I.jsx)(rq,{appear:!0,show:e,children:(0,I.jsxs)(Cq,{as:`div`,className:`semiont-search-modal`,onClose:t,children:[(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0`,enterTo:`opacity-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100`,leaveTo:`opacity-0`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__backdrop`})}),(0,I.jsx)(`div`,{className:`semiont-search-modal__wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-search-modal__centering`,children:(0,I.jsx)(nq,{enter:`ease-out duration-200`,enterFrom:`opacity-0 scale-95`,enterTo:`opacity-100 scale-100`,leave:`ease-in duration-150`,leaveFrom:`opacity-100 scale-100`,leaveTo:`opacity-0 scale-95`,children:(0,I.jsxs)(xq,{className:`semiont-search-modal__panel`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__input-container`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__search-icon-wrapper`,children:(0,I.jsx)(`svg`,{className:`semiont-search-modal__search-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})}),(0,I.jsx)(`input`,{type:`text`,value:f,onChange:e=>d.setQuery(e.target.value),onKeyDown:g,placeholder:u.placeholder,className:`semiont-search-modal__input`,autoFocus:!0}),(0,I.jsx)(`div`,{className:`semiont-search-modal__esc-wrapper`,children:(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd`,children:u.esc})})]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__results`,children:[h&&(0,I.jsx)(`div`,{className:`semiont-search-modal__empty`,children:u.searching}),!h&&f&&m.length===0&&(0,I.jsxs)(`div`,{className:`semiont-search-modal__empty`,children:[u.noResults,` "`,f,`"`]}),!h&&m.length>0&&(0,I.jsx)(`div`,{className:`semiont-search-modal__results-list`,children:m.map((e,t)=>(0,I.jsxs)(`button`,{onClick:()=>_(e),onMouseEnter:()=>l(t),className:`semiont-search-modal__result ${t===c?`semiont-search-modal__result--selected`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__result-icon-wrapper`,children:e.type===`resource`?(0,I.jsx)(`svg`,{className:`semiont-search-modal__result-icon semiont-search-modal__result-icon--resource`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}):(0,I.jsx)(`svg`,{className:`semiont-search-modal__result-icon semiont-search-modal__result-icon--entity`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z`})})}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__result-content`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__result-header`,children:[(0,I.jsx)(`span`,{className:`semiont-search-modal__result-name`,children:e.name}),e.type===`entity`&&e.entityType&&(0,I.jsx)(`span`,{className:`semiont-search-modal__result-badge`,children:e.entityType})]}),e.content&&(0,I.jsx)(`p`,{className:`semiont-search-modal__result-description`,children:e.content})]}),t===c&&(0,I.jsx)(`div`,{className:`semiont-search-modal__result-action`,children:(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd`,children:u.enter})})]},`${e.type}-${e.id}`))}),!h&&!f&&(0,I.jsxs)(`div`,{className:`semiont-search-modal__help`,children:[(0,I.jsx)(`div`,{className:`semiont-search-modal__help-text`,children:u.startTyping}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcuts`,children:[(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:`↑↓`}),u.navigate]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:u.enter}),u.select]}),(0,I.jsxs)(`div`,{className:`semiont-search-modal__shortcut`,children:[(0,I.jsx)(`kbd`,{className:`semiont-search-modal__kbd semiont-search-modal__kbd--small`,children:`Esc`}),u.close]})]})]})]})]})})})})]})})}function KQ(){return(0,I.jsx)(`div`,{className:`semiont-skip-links`,children:(0,I.jsxs)(`div`,{className:`semiont-skip-links-container`,children:[(0,I.jsx)(`a`,{href:`#main-content`,className:`semiont-skip-link semiont-skip-link-first`,children:`Skip to main content`}),(0,I.jsx)(`a`,{href:`#main-navigation`,className:`semiont-skip-link`,children:`Skip to navigation`}),(0,I.jsx)(`a`,{href:`#search`,className:`semiont-skip-link semiont-skip-link-last`,children:`Skip to search`})]})})}function qQ({isFullyAuthenticated:e=!1,isAuthenticated:t=!1,hasValidGatewayToken:n=!1}){let r=Z(Up().activeSession$)?.client,[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!r){s(!1);return}let e=()=>{r.admin.status().then(e=>{a(e),l(null),s(!1)}).catch(e=>{l(e instanceof Error?e:Error(String(e))),s(!1)})};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[r]),(0,I.jsxs)(`section`,{className:`semiont-status-display`,"data-status":t&&!n?`warning`:e?i?`success`:o?`loading`:`error`:`info`,role:`status`,"aria-live":`polite`,"aria-label":`System status information`,children:[(0,I.jsxs)(`p`,{className:`semiont-status-message`,children:[(0,I.jsx)(`span`,{className:`sr-only`,children:`System status: `}),(()=>{if(t&&!n)return`🚀 Frontend Status: Ready • Gateway: Please sign out and sign in again to reconnect`;if(!e)return`🚀 Frontend Status: Ready • Gateway: Authentication required`;if(i)return`\u{1F680} Frontend Status: Ready \u2022 Gateway: ${i.status} (v${i.version})`;if(o)return`🚀 Frontend Status: Ready • Gateway: Connecting...`;if(c){let e=c.message;return e.includes(`401`)||e.includes(`Unauthorized`)?`🚀 Frontend Status: Ready • Gateway: Please sign out and sign in again`:`🚀 Frontend Status: Ready • Gateway: Connection failed`}return`🚀 Frontend Status: Ready • Gateway: Unknown`})()]}),e?c?(0,I.jsxs)(`p`,{className:`semiont-status-hint semiont-status-error-hint`,role:`alert`,children:[(0,I.jsx)(`span`,{className:`sr-only`,children:`Error: `}),`Check that the gateway server is running and accessible`]}):null:(0,I.jsx)(`p`,{className:`semiont-status-hint`,children:`Sign in to view gateway status`})]})}function JQ({t:e,className:t=``,size:n=`lg`,showTagline:r=!0,animated:i=!0,compactTagline:a=!1}){return(0,I.jsxs)(`div`,{className:`semiont-branding ${t}`,"data-size":n,"data-animated":i,"data-compact-tagline":a,children:[(0,I.jsx)(`h1`,{className:`semiont-branding-title`,children:(0,I.jsx)(`span`,{className:`semiont-branding-text`,children:`Semiont`})}),r&&(0,I.jsx)(`h2`,{className:`semiont-branding-tagline`,children:e(`tagline`)})]})}function YQ({Link:e,routes:t,t:n,tHome:r,showBranding:i=!0,brandingLink:a=`/`,variant:o=`standalone`,isAuthenticated:s=!1,isAdmin:c=!1,isModerator:l=!1,currentPath:u}){let{isOpen:d,toggle:f,close:p,dropdownRef:m}=uF();if(o===`floating`&&i)return(0,I.jsxs)(`div`,{className:`semiont-unified-header semiont-unified-header--floating`,"data-variant":`floating`,ref:m,children:[(0,I.jsx)(`button`,{onClick:f,className:`semiont-unified-header__branding-button`,"aria-label":`Navigation menu`,"aria-expanded":d,"aria-controls":`nav-menu-dropdown-1`,"aria-haspopup":`true`,id:`nav-menu-button-1`,children:(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!0,animated:!1,compactTagline:!0,className:`semiont-unified-header__branding`})}),d&&s&&(0,I.jsx)(`div`,{id:`nav-menu-dropdown-1`,className:`semiont-unified-header__dropdown`,role:`menu`,"aria-orientation":`vertical`,"aria-labelledby":`nav-menu-button-1`,children:(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:p,currentPath:u})})]});let h=(0,I.jsxs)(`div`,{className:`semiont-unified-header__content`,"data-variant":o,children:[i?(0,I.jsxs)(`div`,{className:`semiont-unified-header__branding-wrapper`,ref:m,children:[(0,I.jsx)(`button`,{onClick:f,className:`semiont-unified-header__branding-button`,"aria-label":`Navigation menu`,"aria-expanded":d,"aria-controls":`nav-menu-dropdown-2`,"aria-haspopup":`true`,id:`nav-menu-button-2`,children:(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!0,animated:!1,compactTagline:!0,className:`semiont-unified-header__branding`})}),d&&s&&(0,I.jsx)(`div`,{id:`nav-menu-dropdown-2`,className:`semiont-unified-header__dropdown`,role:`menu`,"aria-orientation":`vertical`,"aria-labelledby":`nav-menu-button-2`,children:(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:p,currentPath:u})})]}):(0,I.jsx)(`div`,{}),(0,I.jsx)(`div`,{className:`semiont-unified-header__actions`,"data-variant":o})]});return o===`standalone`?(0,I.jsx)(`header`,{className:`semiont-unified-header semiont-unified-header--standalone`,"data-variant":`standalone`,children:(0,I.jsx)(`div`,{className:`semiont-unified-header__container`,children:h})}):h}function XQ({Link:e,routes:t,t:n,tHome:r,children:i,brandingLink:a=`/`,collapsible:o=!1,storageKey:s=`leftSidebarCollapsed`,isAdmin:c=!1,isModerator:l=!1,currentPath:u}){let[d,f]=(0,y.useState)(!1),{width:p,setWidth:m,minWidth:h,maxWidth:g}=iF({defaultWidth:256,minWidth:192,maxWidth:400,storageKey:`semiont-left-sidebar-width`});return(0,y.useEffect)(()=>{o&&localStorage.getItem(s)===`true`&&f(!0)},[o,s]),(0,I.jsxs)(`aside`,{className:`semiont-left-sidebar`,"data-collapsed":d,style:d?void 0:{width:`${p}px`,position:`relative`},children:[!d&&(0,I.jsx)(eU,{onResize:m,minWidth:h,maxWidth:g,position:`right`,ariaLabel:`Resize left sidebar`}),(0,I.jsx)(`div`,{className:`semiont-left-sidebar__header`,"data-collapsed":d,children:(0,I.jsx)(e,{href:a,className:`semiont-left-sidebar__branding-button`,"aria-label":`Go to home page`,children:d?(0,I.jsx)(`div`,{className:`semiont-left-sidebar__logo-collapsed`,children:(0,I.jsx)(`span`,{className:`semiont-left-sidebar__logo-text`,children:`S`})}):(0,I.jsx)(JQ,{t:r,size:`sm`,showTagline:!1,animated:!1,className:``})})}),(0,I.jsx)(`nav`,{role:`navigation`,"aria-label":`Main navigation`,id:`main-navigation`,className:`semiont-left-sidebar__content`,children:typeof i==`function`?i(d,()=>{if(!o)return;let e=!d;f(e),localStorage.setItem(s,e.toString())},r=>(0,I.jsx)(eY,{Link:e,routes:t,t:n,isAdmin:c,isModerator:l,brandingLink:a,onItemClick:r,currentPath:u})):i})]})}function ZQ({Link:e,routes:t,t:n,tNav:r,tHome:i,children:a,className:o=``,showAuthLinks:s=!0,CookiePreferences:c,onOpenKeyboardHelp:l}){return(0,I.jsxs)(`div`,{className:`semiont-page-layout`,children:[(0,I.jsx)(KQ,{}),(0,I.jsx)(`header`,{role:`banner`,className:`semiont-page-layout__header`,children:(0,I.jsx)(`div`,{className:`semiont-page-layout__header-container`,children:(0,I.jsx)(YQ,{Link:e,routes:t,t:r,tHome:i,showAuthLinks:s,brandingLink:`/`,variant:`embedded`})})}),(0,I.jsx)(`main`,{role:`main`,id:`main-content`,tabIndex:-1,className:`semiont-page-layout__main ${o}`,children:a}),(0,I.jsx)($J,{Link:e,routes:t,t:n,...c&&{CookiePreferences:c},...l&&{onOpenKeyboardHelp:l}})]})}function QQ({message:e}){return(0,I.jsx)(`div`,{className:`semiont-loading-state-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-loading-state semiont-loading-state-compose`,children:(0,I.jsx)(`p`,{className:`semiont-loading-message`,children:e})})})}function $Q(){return(0,I.jsx)(`div`,{className:`semiont-loading-state semiont-loading-state-resource`,children:(0,I.jsx)(`p`,{className:`semiont-loading-message`,children:`Loading resource...`})})}function e$({error:e,onRetry:t}){return(0,I.jsxs)(`div`,{className:`semiont-error-state semiont-error-state-resource`,children:[(0,I.jsx)(`p`,{className:`semiont-error-message`,children:e instanceof Error?e.message:`Failed to load resource`}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-button`,"data-variant":`secondary`,children:`Try Again`})]})}function t$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4.26 10.147a60.438 60.438 0 0 0-.491 6.347A48.62 48.62 0 0 1 12 20.904a48.62 48.62 0 0 1 8.232-4.41 60.46 60.46 0 0 0-.491-6.347m-15.482 0a50.636 50.636 0 0 0-2.658-.813A59.906 59.906 0 0 1 12 3.493a59.903 59.903 0 0 1 10.399 5.84c-.896.248-1.783.52-2.658.814m-15.482 0A50.717 50.717 0 0 1 12 13.489a50.702 50.702 0 0 1 7.74-3.342M6.75 15a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm0 0v-3.675A55.378 55.378 0 0 1 12 8.443m-7.007 11.55A5.981 5.981 0 0 0 6.75 15.75v-1.5`}))}var n$=y.forwardRef(t$);function r$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`}))}var i$=y.forwardRef(r$);function a$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`}))}var o$=y.forwardRef(a$);function s$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z`}))}var c$=y.forwardRef(s$);function l$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z`}))}var u$=y.forwardRef(l$);function d$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z`}))}var f$=y.forwardRef(d$);function p$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418`}))}var m$=y.forwardRef(p$);function h$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z`}))}var g$=y.forwardRef(h$);function _$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18`}))}var v$=y.forwardRef(_$);function y$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z`}))}var b$=y.forwardRef(y$);function x$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125`}))}var S$=y.forwardRef(x$);function C$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 4.5v15m7.5-7.5h-15`}))}var w$=y.forwardRef(C$);function T$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 3v17.25m0 0c-1.472 0-2.882.265-4.185.75M12 20.25c1.472 0 2.882.265 4.185.75M18.75 4.97A48.416 48.416 0 0 0 12 4.5c-2.291 0-4.545.16-6.75.47m13.5 0c1.01.143 2.01.317 3 .52m-3-.52 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.988 5.988 0 0 1-2.031.352 5.988 5.988 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L18.75 4.971Zm-16.5.52c.99-.203 1.99-.377 3-.52m0 0 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.989 5.989 0 0 1-2.031.352 5.989 5.989 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L5.25 4.971Z`}))}var E$=y.forwardRef(T$);function D$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z`}))}var O$=y.forwardRef(D$);function k$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z`}),y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 6h.008v.008H6V6Z`}))}var A$=y.forwardRef(k$);function j$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0`}))}var M$=y.forwardRef(j$);function N$({title:e,titleId:t,...n},r){return y.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?y.createElement(`title`,{id:t},e):null,y.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`}))}var P$=y.forwardRef(N$),F$=De(Ip(),1),I$=[`knowledge-base`,`user`,`settings`];function L$(e,t){let n=[],r=new F$.BehaviorSubject(t?.initialPanel??null),i=new F$.BehaviorSubject(null),a=new F$.BehaviorSubject(null),o=0;if(t?.onPanelChange){let e=t.onPanelChange;n.push(r.subscribe(e))}return n.push(e.stream(`panel:toggle`).subscribe(({panel:e})=>{let t=r.getValue();r.next(t===e?null:e)})),n.push(e.stream(`panel:open`).subscribe(({panel:e,scrollToAnnotationId:t,motivation:n})=>{if(t&&i.next(t),n){let e=Tw(n)??`highlight`;a.next({tab:e,generation:++o})}r.next(e)})),n.push(e.stream(`panel:close`).subscribe(()=>{r.next(null)})),{activePanel$:r.asObservable(),scrollToAnnotationId$:i.asObservable(),panelInitialTab$:a.asObservable(),openPanel:t=>e.emit(`panel:open`,{panel:t}),closePanel:()=>e.emit(`panel:close`,void 0),togglePanel:t=>e.emit(`panel:toggle`,{panel:t}),onScrollCompleted:()=>i.next(null),dispose(){n.forEach(e=>e.unsubscribe()),r.complete(),i.complete(),a.complete()}}}function R$({suggestedFeatures:e,theme:t,activePanel:n,translations:r,StatusDisplay:i,ToolbarPanels:a,Toolbar:o}){return(0,I.jsxs)(`div`,{className:`semiont-page${n&&I$.includes(n)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:r.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:r.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__section`,children:[(0,I.jsx)(`h2`,{className:`semiont-admin__section-title`,children:r.systemStatus}),(0,I.jsx)(i,{})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__section`,children:[(0,I.jsx)(`h2`,{className:`semiont-admin__section-title`,children:r.cliOperations}),(0,I.jsx)(`p`,{className:`semiont-admin__section-description`,children:r.cliOperationsDescription}),(0,I.jsx)(`div`,{className:`semiont-admin__features-grid`,children:e.map(e=>(0,I.jsx)(`div`,{className:`semiont-devops-feature`,children:(0,I.jsxs)(`div`,{className:`semiont-devops-feature__header`,children:[(0,I.jsx)(`div`,{className:`semiont-devops-feature__icon-box`,children:(0,I.jsx)(e.icon,{className:`semiont-devops-feature__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-devops-feature__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-devops-feature__title`,children:e.title}),(0,I.jsx)(`p`,{className:`semiont-devops-feature__description`,children:e.description}),(0,I.jsx)(`p`,{className:`semiont-devops-feature__available`,children:e.available})]})]})},e.title))})]}),(0,I.jsx)(`div`,{className:`semiont-admin__info-box`,children:(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-content`,children:[(0,I.jsx)(`div`,{className:`semiont-admin__info-box-icon`,children:(0,I.jsx)(c$,{className:`semiont-icon semiont-icon--info`})}),(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-text`,children:[(0,I.jsx)(`h3`,{className:`semiont-admin__info-box-title`,children:r.cliTitle}),(0,I.jsxs)(`div`,{className:`semiont-admin__info-box-description`,children:[(0,I.jsx)(`p`,{children:r.cliDescription}),(0,I.jsx)(`code`,{className:`semiont-admin__info-box-code`,children:`semiont --help`})]})]})]})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(a,{activePanel:n,theme:t}),(0,I.jsx)(o,{context:`simple`,activePanel:n})]})]})}function z$({providers:e,allowedDomains:t,isLoading:n,theme:r,activePanel:i,translations:a,ToolbarPanels:o,Toolbar:s}){return(0,I.jsxs)(`div`,{className:`semiont-page${i&&I$.includes(i)?` semiont-page--panel-open`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-page__content`,children:(0,I.jsxs)(`div`,{className:`semiont-page__sections`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:a.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:a.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-admin__card-header`,children:[(0,I.jsx)(O$,{className:`semiont-admin__card-icon semiont-admin__card-icon--primary`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`semiont-admin__card-title`,children:a.oauthProviders}),(0,I.jsx)(`p`,{className:`semiont-admin__card-description`,children:a.oauthProvidersDescription})]})]}),n?(0,I.jsx)(`div`,{className:`semiont-skeleton-group`,children:(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--bar`})}):e.length>0?(0,I.jsx)(`div`,{className:`semiont-provider-list`,children:e.map(e=>(0,I.jsxs)(`div`,{className:`semiont-provider-item`,children:[(0,I.jsxs)(`div`,{className:`semiont-provider-item__info`,children:[(0,I.jsx)(i$,{className:`semiont-provider-item__icon semiont-provider-item__icon--success`}),(0,I.jsx)(`span`,{className:`semiont-provider-item__name`,children:e.name}),e.clientId&&(0,I.jsxs)(`span`,{className:`semiont-provider-item__client-id`,children:[a.clientId,`: `,e.clientId]})]}),(0,I.jsx)(`span`,{className:`semiont-badge semiont-badge--success`,children:a.configured})]},e.name))}):(0,I.jsx)(`div`,{className:`semiont-empty-message`,children:a.noProvidersConfigured})]}),(0,I.jsxs)(`div`,{className:`semiont-admin__card`,children:[(0,I.jsxs)(`div`,{className:`semiont-admin__card-header`,children:[(0,I.jsx)(m$,{className:`semiont-admin__card-icon semiont-admin__card-icon--primary`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`semiont-admin__card-title`,children:a.allowedDomains}),(0,I.jsx)(`p`,{className:`semiont-admin__card-description`,children:a.allowedDomainsDescription})]})]}),n?(0,I.jsxs)(`div`,{className:`semiont-skeleton-group`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--chip`}),(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--chip semiont-skeleton--chip-lg`})]}):t.length>0?(0,I.jsx)(`div`,{className:`semiont-domain-list`,children:t.map(e=>(0,I.jsxs)(`div`,{className:`semiont-chip semiont-chip--primary`,children:[`@`,e]},e))}):(0,I.jsx)(`div`,{className:`semiont-empty-message`,children:a.noDomainsConfigured})]}),(0,I.jsx)(`div`,{className:`semiont-admin__info-box`,children:(0,I.jsxs)(`div`,{className:`semiont-info-box__content`,children:[(0,I.jsx)(g$,{className:`semiont-info-box__icon`}),(0,I.jsxs)(`div`,{className:`semiont-info-box__text`,children:[(0,I.jsx)(`p`,{className:`semiont-info-box__title`,children:a.configManagementTitle}),(0,I.jsx)(`p`,{className:`semiont-info-box__description`,children:a.configManagementDescription}),(0,I.jsxs)(`ul`,{className:`semiont-info-box__list`,children:[(0,I.jsx)(`li`,{children:a.configLocalDev}),(0,I.jsxs)(`li`,{children:[a.configCloudDeploy,` `,(0,I.jsx)(`code`,{className:`semiont-code-inline`,children:a.configCloudDeployCommand}),` `,a.configCloudDeployEnd]}),(0,I.jsx)(`li`,{children:a.configAWS})]})]})]})})]})}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(o,{activePanel:i,theme:r}),(0,I.jsx)(s,{context:`simple`,activePanel:i})]})]})}function B$({user:e,onUpdate:t,onDelete:n,translations:r}){let i={admin:`semiont-badge semiont-badge--danger`,user:`semiont-badge semiont-badge--default`},a={active:`semiont-badge semiont-badge--success`,inactive:`semiont-badge semiont-badge--default`},o=e.isAdmin?`admin`:`user`,s=e.isActive?`active`:`inactive`;return(0,I.jsxs)(`tr`,{className:`semiont-table__row`,children:[(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsxs)(`div`,{className:`semiont-user-info`,children:[(0,I.jsx)(P$,{className:`semiont-user-info__avatar`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`semiont-user-info__name`,children:e.name||r.noName}),(0,I.jsx)(`div`,{className:`semiont-user-info__email`,children:e.email})]})]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsxs)(`span`,{className:`semiont-table__text--secondary`,children:[`@`,e.domain]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsx)(`span`,{className:i[o],children:r[o]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell`,children:(0,I.jsx)(`span`,{className:a[s],children:r[s]})}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__text--secondary`,children:e.lastLogin?new Date(e.lastLogin).toLocaleDateString():r.never}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__text--secondary`,children:new Date(e.created).toLocaleDateString()}),(0,I.jsx)(`td`,{className:`semiont-table__cell semiont-table__cell--actions`,children:(0,I.jsxs)(`div`,{className:`semiont-table__actions`,children:[(0,I.jsx)(`button`,{onClick:()=>t(e.id,{isAdmin:!e.isAdmin}),className:`semiont-action-button semiont-action-button--info`,title:e.isAdmin?r.removeAdmin:r.makeAdmin,children:(0,I.jsx)(O$,{className:`semiont-action-button__icon`})}),(0,I.jsx)(`button`,{onClick:()=>t(e.id,{isActive:!e.isActive}),className:`semiont-action-button semiont-action-button--warning`,title:e.isActive?r.deactivateUser:r.activateUser,children:(0,I.jsx)(S$,{className:`semiont-action-button__icon`})}),(0,I.jsx)(`button`,{onClick:()=>n(e.id),className:`semiont-action-button semiont-action-button--danger`,title:r.deleteUser,children:(0,I.jsx)(M$,{className:`semiont-action-button__icon`})})]})})]})}function V$({users:e,userStats:t,isLoadingUsers:n,isLoadingStats:r,onUpdateUser:i,onDeleteUser:a,onAddUser:o,onExportUsers:s,theme:c,activePanel:l,translations:u,ToolbarPanels:d,Toolbar:f,buttonStyles:p}){let[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(`all`),[v,b]=(0,y.useState)(`all`),x=e.filter(e=>{let t=(e.name||``).toLowerCase().includes(m.toLowerCase())||e.email.toLowerCase().includes(m.toLowerCase()),n=e.isAdmin?`admin`:`user`,r=e.isActive?`active`:`inactive`;return t&&(g===`all`||n===g)&&(v===`all`||r===v)});return(0,I.jsxs)(`div`,{className:`semiont-page${l&&I$.includes(l)?` semiont-page--panel-open`:``}`,children:[(0,I.jsx)(`div`,{className:`semiont-page__content`,children:(0,I.jsxs)(`div`,{className:`semiont-page__sections`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header-with-action`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:u.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:u.subtitle})]}),(0,I.jsxs)(`button`,{onClick:o,className:p.primary.base,children:[(0,I.jsx)(w$,{className:`semiont-button__icon`}),u.addUser]})]}),(0,I.jsx)(`div`,{className:`semiont-admin__stats-grid`,children:r?[,,,,].fill(0).map((e,t)=>(0,I.jsx)(`div`,{className:`semiont-stat-card semiont-stat-card--loading`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--icon`}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--text`}),(0,I.jsx)(`div`,{className:`semiont-skeleton semiont-skeleton--number`})]})]})},t)):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(P$,{className:`semiont-stat-card__icon semiont-stat-card__icon--primary`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.totalUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.totalUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(`div`,{className:`semiont-stat-card__status-indicator semiont-stat-card__status-indicator--active`,children:(0,I.jsx)(`div`,{className:`semiont-stat-card__status-dot`})})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.activeUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.activeUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(O$,{className:`semiont-stat-card__icon semiont-stat-card__icon--danger`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.administrators}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.adminUsers??0})]})]})}),(0,I.jsx)(`div`,{className:`semiont-stat-card`,children:(0,I.jsxs)(`div`,{className:`semiont-stat-card__content`,children:[(0,I.jsx)(`div`,{className:`semiont-stat-card__icon-wrapper`,children:(0,I.jsx)(f$,{className:`semiont-stat-card__icon semiont-stat-card__icon--warning`})}),(0,I.jsxs)(`div`,{className:`semiont-stat-card__text`,children:[(0,I.jsx)(`p`,{className:`semiont-stat-card__label`,children:u.recentUsers}),(0,I.jsx)(`p`,{className:`semiont-stat-card__value`,children:t?.recentSignups?.length??0})]})]})})]})}),(0,I.jsx)(`div`,{className:`semiont-admin__filters-card`,children:(0,I.jsxs)(`div`,{className:`semiont-admin__filters-grid`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`search`,className:`semiont-form__label`,children:u.searchUsers}),(0,I.jsxs)(`div`,{className:`semiont-search-input`,children:[(0,I.jsx)(`div`,{className:`semiont-search-input__icon`,children:(0,I.jsx)(b$,{className:`semiont-icon semiont-icon--small`})}),(0,I.jsx)(`input`,{type:`text`,id:`search`,className:`semiont-search-input__field`,placeholder:u.searchPlaceholder,value:m,onChange:e=>h(e.target.value)})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`role`,className:`semiont-form__label`,children:u.role}),(0,I.jsxs)(`select`,{id:`role`,className:`semiont-select`,value:g,onChange:e=>_(e.target.value),children:[(0,I.jsx)(`option`,{value:`all`,children:u.allRoles}),(0,I.jsx)(`option`,{value:`admin`,children:u.admin}),(0,I.jsx)(`option`,{value:`user`,children:u.user})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`status`,className:`semiont-form__label`,children:u.status}),(0,I.jsxs)(`select`,{id:`status`,className:`semiont-select`,value:v,onChange:e=>b(e.target.value),children:[(0,I.jsx)(`option`,{value:`all`,children:u.allStatus}),(0,I.jsx)(`option`,{value:`active`,children:u.active}),(0,I.jsx)(`option`,{value:`inactive`,children:u.inactive})]})]}),(0,I.jsx)(`div`,{className:`semiont-form__field semiont-form__field--align-end`,children:(0,I.jsx)(`button`,{onClick:s,className:`${p.secondary.base} semiont-button--full-width`,children:u.exportUsers})})]})}),(0,I.jsxs)(`div`,{className:`semiont-admin__table-card`,children:[(0,I.jsx)(`div`,{className:`semiont-table-container`,children:n?(0,I.jsxs)(`div`,{className:`semiont-loading-state`,children:[(0,I.jsx)(`div`,{className:`semiont-spinner`}),(0,I.jsx)(`p`,{className:`semiont-loading-state__text`,children:u.loadingUsers})]}):(0,I.jsxs)(`table`,{className:`semiont-table`,children:[(0,I.jsx)(`thead`,{className:`semiont-table__head`,children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.userColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.domainColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.roleColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.statusColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.lastLoginColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header`,children:u.joinedColumn}),(0,I.jsx)(`th`,{className:`semiont-table__header semiont-table__header--actions`,children:u.actionsColumn})]})}),(0,I.jsx)(`tbody`,{className:`semiont-table__body`,children:x.map(e=>(0,I.jsx)(B$,{user:e,onUpdate:i,onDelete:a,translations:u},e.id))})]})}),!n&&x.length===0&&(0,I.jsxs)(`div`,{className:`semiont-empty-state`,children:[(0,I.jsx)(P$,{className:`semiont-empty-state__icon`}),(0,I.jsx)(`h3`,{className:`semiont-empty-state__title`,children:u.noUsersFound}),(0,I.jsx)(`p`,{className:`semiont-empty-state__description`,children:u.noUsersFoundDescription})]})]})]})}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(d,{activePanel:l,theme:c}),(0,I.jsx)(f,{context:`simple`,activePanel:l})]})]})}function H$(){return(0,I.jsxs)(`svg`,{className:`semiont-icon semiont-icon--small semiont-icon--inline`,viewBox:`0 0 24 24`,children:[(0,I.jsx)(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),(0,I.jsx)(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]})}function U$({onSignUp:e,Link:t,translations:n}){let[r,i]=(0,y.useState)(!1);return(0,I.jsx)(`main`,{className:`semiont-auth__main`,role:`main`,children:(0,I.jsx)(`div`,{className:`semiont-auth__container`,children:(0,I.jsxs)(`div`,{className:`semiont-auth__content`,children:[(0,I.jsxs)(`section`,{"aria-labelledby":`signup-heading`,className:`semiont-auth__branding`,children:[(0,I.jsx)(`h1`,{id:`signup-heading`,className:`sr-only`,children:n.pageTitle}),(0,I.jsx)(JQ,{t:e=>n[e]||e,size:`xl`,animated:!0,className:`semiont-auth__logo`}),(0,I.jsx)(`p`,{className:`semiont-auth__welcome`,children:n.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-auth__subtitle`,children:n.signUpPrompt})]}),(0,I.jsxs)(`div`,{className:`semiont-auth__forms`,children:[(0,I.jsxs)(`button`,{onClick:async()=>{i(!0);try{await e()}catch(e){console.error(`Failed to initiate Google sign-up:`,e),i(!1)}},disabled:r,className:`${Ew.primary.base} semiont-button--full-width`,children:[r?(0,I.jsx)(`div`,{className:`semiont-auth__spinner`}):(0,I.jsx)(H$,{}),r?n.creatingAccount:n.signUpWithGoogle]}),(0,I.jsxs)(`div`,{className:`semiont-auth__info`,children:[n.approvedDomainsInfo,(0,I.jsx)(`br`,{}),n.termsAgreement]})]}),(0,I.jsxs)(`div`,{className:`semiont-auth__links`,children:[(0,I.jsx)(t,{href:`/`,className:Ew.secondary.base,children:n.backToHome}),(0,I.jsx)(t,{href:`/auth/signin`,className:Ew.primary.base,children:n.alreadyHaveAccount})]})]})})})}function W$(e,t){switch(e){case`Configuration`:return t.errorConfiguration;case`AccessDenied`:return t.errorAccessDenied;case`Verification`:return t.errorVerification;default:return t.errorGeneric}}function G$({errorType:e,Link:t,translations:n}){let r=W$(e,n);return(0,I.jsx)(`div`,{className:`semiont-auth-error-display`,children:(0,I.jsxs)(`div`,{className:`semiont-auth-error-display__container`,children:[(0,I.jsx)(`div`,{children:(0,I.jsx)(`h2`,{className:`semiont-auth-error-display__title`,children:n.pageTitle})}),(0,I.jsx)(`div`,{className:`semiont-auth-error-display__error-box`,children:(0,I.jsx)(`div`,{className:`semiont-auth-error-display__error-message`,children:r})}),(0,I.jsx)(`div`,{className:`semiont-auth-error-display__actions`,children:(0,I.jsx)(t,{href:`/auth/signin`,className:`semiont-auth-error-display__link`,children:n.tryAgain})})]})})}function K$({userName:e,status:t,isProcessing:n,onAccept:r,onDecline:i,translations:a,PageLayout:o,Link:s}){return t===`loading`?(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__loading`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__loading-content`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__spinner`}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__loading-text`,children:a.loading})]})})}):t===`accepted`?(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__accepted`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__accepted-content`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__accepted-icon`,children:(0,I.jsx)(`svg`,{className:`semiont-welcome-page__accepted-checkmark`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`semiont-welcome-page__accepted-title`,children:a.welcomeTitle}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__accepted-subtitle`,children:a.thanksForAccepting})]})]})})}):(0,I.jsx)(o,{className:`semiont-welcome-page__layout`,children:(0,I.jsx)(`div`,{className:`semiont-welcome-page__form-wrapper`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__form`,children:[(0,I.jsxs)(`div`,{className:`semiont-welcome-page__form-header`,children:[(0,I.jsx)(`div`,{className:`semiont-welcome-page__form-icon`,children:(0,I.jsx)(`svg`,{className:`semiont-welcome-page__form-icon-svg`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,I.jsx)(`h1`,{className:`semiont-welcome-page__form-title`,children:a.welcomeUser.replace(`{firstName}`,e||``)}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__form-subtitle`,children:a.reviewTermsPrompt})]}),(0,I.jsx)(`div`,{className:`semiont-welcome-page__terms-content`,children:(0,I.jsxs)(`div`,{className:`semiont-welcome-page__prose`,children:[(0,I.jsx)(`h3`,{children:a.termsSummaryTitle}),(0,I.jsx)(`p`,{children:a.termsSummaryIntro}),(0,I.jsx)(`h4`,{children:a.acceptableUseTitle}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.acceptableUseResponsible}),(0,I.jsx)(`li`,{children:a.acceptableUseRespect}),(0,I.jsx)(`li`,{children:a.acceptableUseConduct})]}),(0,I.jsx)(`h4`,{children:a.prohibitedContentTitle}),(0,I.jsx)(`p`,{children:a.prohibitedContentIntro}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.prohibitedIllegal}),(0,I.jsx)(`li`,{children:a.prohibitedAdult}),(0,I.jsx)(`li`,{children:a.prohibitedHate}),(0,I.jsx)(`li`,{children:a.prohibitedViolence}),(0,I.jsx)(`li`,{children:a.prohibitedMisinformation}),(0,I.jsx)(`li`,{children:a.prohibitedPrivacy}),(0,I.jsx)(`li`,{children:a.prohibitedCopyright}),(0,I.jsx)(`li`,{children:a.prohibitedMalware}),(0,I.jsx)(`li`,{children:a.prohibitedSpam})]}),(0,I.jsx)(`h4`,{children:a.conductTitle}),(0,I.jsxs)(`p`,{children:[a.conductDescription,` `,(0,I.jsx)(`a`,{href:`https://ai-alliance.cdn.prismic.io/ai-alliance/Zl-MG5m069VX1dgH_AIAllianceCodeofConduct.pdf`,target:`_blank`,rel:`noopener noreferrer`,className:`semiont-link`,children:a.conductLink}),a.conductPromotion]}),(0,I.jsx)(`h4`,{children:a.responsibilitiesTitle}),(0,I.jsxs)(`ul`,{children:[(0,I.jsx)(`li`,{children:a.responsibilitiesSecure}),(0,I.jsx)(`li`,{children:a.responsibilitiesReport}),(0,I.jsx)(`li`,{children:a.responsibilitiesAccurate}),(0,I.jsx)(`li`,{children:a.responsibilitiesComply})]}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__warning`,children:a.violationsWarning})]})}),(0,I.jsxs)(`div`,{className:`semiont-welcome-page__actions`,children:[(0,I.jsxs)(`p`,{className:`semiont-welcome-page__legal-links`,children:[a.readFullTerms,` `,(0,I.jsx)(s,{href:`/terms`,target:`_blank`,className:`semiont-welcome-page__link`,children:a.termsOfService}),` `,a.and,` `,(0,I.jsx)(s,{href:`/privacy`,target:`_blank`,className:`semiont-welcome-page__link`,children:a.privacyPolicy})]}),(0,I.jsxs)(`div`,{className:`semiont-welcome-page__buttons`,children:[(0,I.jsx)(`button`,{onClick:i,disabled:n,className:`semiont-welcome-page__button semiont-welcome-page__button--secondary`,children:a.declineAndSignOut}),(0,I.jsx)(`button`,{onClick:r,disabled:n,className:`semiont-welcome-page__button semiont-welcome-page__button--primary`,children:n?a.processing:a.acceptAndContinue})]}),(0,I.jsx)(`p`,{className:`semiont-welcome-page__legal-notice`,children:a.legallyBound})]})]})})})}function q$({entityTypes:e,error:t,newTag:n,onNewTagChange:r,onAddTag:i,isAddingTag:a,theme:o,activePanel:s,translations:c,ToolbarPanels:l,Toolbar:u}){return(0,I.jsxs)(`div`,{className:`semiont-page${s&&I$.includes(s)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:c.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:c.pageDescription})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-entity-tags__header`,children:[(0,I.jsx)(`div`,{className:`semiont-entity-tags__icon-box`,children:(0,I.jsx)(A$,{className:`semiont-entity-tags__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-entity-tags__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-entity-tags__title`,children:c.sectionTitle}),(0,I.jsx)(`p`,{className:`semiont-entity-tags__description`,children:c.sectionDescription})]})]}),(0,I.jsx)(`div`,{className:`semiont-entity-tags__tags-section`,children:(0,I.jsx)(`div`,{className:`semiont-tags`,children:e.map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--info semiont-tag--rounded-md`,children:e},e))})}),(0,I.jsxs)(`div`,{className:`semiont-entity-tags__input-group`,children:[(0,I.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i()},placeholder:c.inputPlaceholder,className:`semiont-entity-tags__input`,disabled:a}),(0,I.jsx)(`button`,{onClick:i,disabled:a||!n.trim(),className:`semiont-button semiont-button--primary`,children:a?c.adding:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(w$,{className:`semiont-icon semiont-icon--small semiont-icon--inline`}),c.addTag]})})]}),t&&(0,I.jsxs)(`div`,{className:`semiont-entity-tags__error`,children:[(0,I.jsx)(u$,{className:`semiont-entity-tags__error-icon`}),t]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(l,{activePanel:s,theme:o}),(0,I.jsx)(u,{context:`simple`,activePanel:s})]})]})}function J$({isLoading:e,theme:t,activePanel:n,translations:r,ToolbarPanels:i,Toolbar:a}){return e?(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:r.loading})}):(0,I.jsxs)(`div`,{className:`semiont-page${n&&I$.includes(n)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:r.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:r.pageDescription})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-recent-docs__header`,children:[(0,I.jsx)(`div`,{className:`semiont-recent-docs__icon-box`,children:(0,I.jsx)(o$,{className:`semiont-recent-docs__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-recent-docs__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-recent-docs__title`,children:r.sectionTitle}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__description`,children:r.sectionDescription})]})]}),(0,I.jsxs)(`div`,{className:`semiont-recent-docs__empty-state`,children:[(0,I.jsx)(`svg`,{className:`semiont-recent-docs__empty-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,I.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__empty-message`,children:r.noDocuments}),(0,I.jsx)(`p`,{className:`semiont-recent-docs__empty-hint`,children:r.activityWillAppear})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(i,{activePanel:n,theme:t}),(0,I.jsx)(a,{context:`simple`,activePanel:n})]})]})}var Y$={legal:E$,scientific:n$,general:v$},X$={legal:`semiont-schema-domain--legal`,scientific:`semiont-schema-domain--scientific`,general:`semiont-schema-domain--general`};function Z$({schemas:e,isLoading:t,theme:n,activePanel:r,translations:i,ToolbarPanels:a,Toolbar:o}){return t?(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:i.loading})}):(0,I.jsxs)(`div`,{className:`semiont-page${r&&I$.includes(r)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:i.pageTitle}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:i.pageDescription})]}),(0,I.jsx)(`div`,{className:`semiont-card-grid semiont-card-grid--two-columns`,children:e.map(e=>{let t=Y$[e.domain]||v$,n=X$[e.domain]||X$.general;return(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-schema__header`,children:[(0,I.jsx)(`div`,{className:`semiont-schema__icon-wrapper ${n}`,children:t&&(0,I.jsx)(t,{className:`semiont-schema__icon`})}),(0,I.jsxs)(`div`,{className:`semiont-schema__content`,children:[(0,I.jsx)(`h3`,{className:`semiont-schema__title`,children:e.name}),(0,I.jsx)(`p`,{className:`semiont-schema__description`,children:e.description}),(0,I.jsx)(`span`,{className:`semiont-schema__badge ${n}`,children:e.domain})]})]}),(0,I.jsxs)(`div`,{className:`semiont-schema__categories`,children:[(0,I.jsx)(`h4`,{className:`semiont-schema__categories-title`,children:i.categories}),e.tags.map(e=>(0,I.jsxs)(`div`,{className:`semiont-schema__category`,children:[(0,I.jsx)(`div`,{className:`semiont-schema__category-name`,children:e.name}),(0,I.jsx)(`div`,{className:`semiont-schema__category-description`,children:e.description}),(0,I.jsxs)(`div`,{className:`semiont-schema__examples`,children:[e.examples.slice(0,2).map((e,t)=>(0,I.jsx)(`span`,{className:`semiont-schema__example`,children:e},t)),e.examples.length>2&&(0,I.jsxs)(`span`,{className:`semiont-schema__example-more`,children:[`+`,e.examples.length-2,` more`]})]})]},e.name))]})]},e.id)})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(a,{activePanel:r,theme:n}),(0,I.jsx)(o,{context:`simple`,activePanel:r})]})]})}function Q$(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function $$({progress:e,label:t=`Upload`}){if(!e)return null;if(e.phase===`started`)return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:(0,I.jsxs)(`span`,{children:[t,`: starting…`]})}),(0,I.jsx)(`div`,{className:`semiont-progress semiont-progress--indeterminate`,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill`})})]});if(e.phase===`progress`){let n=e.totalBytes<=0,r=n?0:Math.min(100,Math.round(e.bytesUploaded/e.totalBytes*100));return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:n?(0,I.jsxs)(`span`,{children:[t,`: `,Q$(e.bytesUploaded),`…`]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{children:[t,`: `,r,`%`]}),(0,I.jsxs)(`span`,{children:[Q$(e.bytesUploaded),` / `,Q$(e.totalBytes)]})]})}),(0,I.jsx)(`div`,{className:`semiont-progress${n?` semiont-progress--indeterminate`:``}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":n?void 0:100,"aria-valuenow":n?void 0:r,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill`,style:n?void 0:{width:`${r}%`}})})]})}return(0,I.jsxs)(`div`,{className:`semiont-progress-wrapper`,role:`status`,"aria-live":`polite`,children:[(0,I.jsx)(`div`,{className:`semiont-progress__label`,children:(0,I.jsxs)(`span`,{children:[t,`: uploaded`]})}),(0,I.jsx)(`div`,{className:`semiont-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":100,children:(0,I.jsx)(`div`,{className:`semiont-progress__fill semiont-progress__fill--success`,style:{width:`100%`}})})]})}var e1=Object.values(vi).map(e=>e.extension).join(`,`);function t1(e){if(e.type&&xi(e.type))return e.type;if(e.name.includes(`.`)){let t=Di(e.name.slice(e.name.lastIndexOf(`.`)));if(t)return t}return`application/octet-stream`}function n1({mode:e,cloneData:t,availableEntityTypes:n,initialLocale:r,theme:i,hoverDelayMs:a,activePanel:o,onSaveResource:s,onCancel:c,uploadProgress:l=null,translations:u,ToolbarPanels:d,Toolbar:f}){let{announceFormSubmitting:p,announceFormSuccess:m,announceFormError:h}=DF(),{showLineNumbers:g}=zp(),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)([]),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)(`write`),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)(`text/markdown`),[ee,M]=(0,y.useState)(null),[N,te]=(0,y.useState)(!1),[ne,re]=(0,y.useState)(`text/markdown`),[ie,ae]=(0,y.useState)(r),[oe,se]=(0,y.useState)(``),[ce,le]=(0,y.useState)(``),[P,F]=(0,y.useState)(!0),ue=xi(ne)?ne:`text/markdown`,de=ce===``?Fi(e===`clone`&&t?Pi(Kr(t.sourceResource)):``,_,ue):ce;(0,y.useEffect)(()=>{e===`clone`&&t&&(v(t.sourceResource.name),x(t.sourceContent))},[e,t]);let fe=e=>{let t=e.target.files?.[0];t&&pe(t)},pe=e=>{let t=t1(e);if(k(e),j(t),D(`upload`),!_){let t=e.name.replace(/\.[^/.]+$/,``);v(t)}let n=Si(t)?.render;if(n===`image`||n===`pdf`){let t=URL.createObjectURL(e);M(t)}else{let t=new FileReader;t.onload=e=>{let t=e.target?.result;x(t)},t.readAsText(e)}};(0,y.useEffect)(()=>()=>{ee&&URL.revokeObjectURL(ee)},[ee]);let me=async t=>{if(t.preventDefault(),_.trim()){T(!0),p();try{let t={mode:e,name:_,storageUri:`file://${de}`,content:b,format:O?A:ne,entityTypes:S,language:ie};O&&(t.file=O),oe&&(t.charset=oe),e===`clone`&&(t.archiveOriginal=P),await s(t),m(e===`clone`?`Resource cloned successfully`:`Resource created successfully`)}catch(e){throw h(`Failed to save resource. Please try again.`),e}finally{T(!1)}}},he=e===`clone`;return(0,I.jsxs)(`div`,{className:`semiont-page${o&&I$.includes(o)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content semiont-page__compose`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:he?u.titleEditClone:u.title}),he&&(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:u.subtitleClone})]}),(0,I.jsx)(`div`,{className:`semiont-form`,children:(0,I.jsxs)(`form`,{onSubmit:me,className:`semiont-form__fields semiont-compose-grid`,children:[(0,I.jsxs)(`div`,{className:`semiont-compose-grid__meta`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`docName`,className:`semiont-form__label`,children:u.resourceName}),(0,I.jsx)(`input`,{id:`docName`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:u.resourceNamePlaceholder,className:`semiont-input`,required:!0,disabled:w})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`storagePath`,className:`semiont-form__label`,children:`Save location`}),(0,I.jsxs)(`div`,{className:`semiont-input-addon`,children:[(0,I.jsx)(`span`,{className:`semiont-input-addon__prefix`,children:`file://`}),(0,I.jsx)(`input`,{id:`storagePath`,type:`text`,value:de,onChange:e=>le(e.target.value),placeholder:`docs/my-resource.md`,required:!0,className:`semiont-input semiont-input--addon`,disabled:w})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__entity-types`,children:[(0,I.jsx)(`div`,{className:`semiont-form__label`,children:u.entityTypes}),(0,I.jsx)(`div`,{className:`semiont-form__entity-type-buttons`,role:`group`,"aria-describedby":`entity-types-description`,children:n.map(e=>{let t=S.includes(e);return(0,I.jsx)(`button`,{type:`button`,onClick:()=>{C(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:`semiont-form__entity-type-button`,"data-selected":t,disabled:w,"aria-pressed":t,"aria-label":`${e} entity type, ${t?`selected`:`not selected`}`,children:e},e)})}),S.length>0&&(0,I.jsxs)(`div`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:[S.length,` entity type`,S.length===1?``:`s`,` selected: `,S.join(`, `)]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`language-select`,className:`semiont-form__label`,children:u.language}),(0,I.jsx)(`select`,{id:`language-select`,value:ie,onChange:e=>ae(e.target.value),disabled:w,className:`semiont-select`,children:ni.map(e=>(0,I.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]})]}),(0,I.jsxs)(`div`,{className:`semiont-compose-grid__content`,children:[!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:u.contentSource}),(0,I.jsxs)(`div`,{className:`semiont-form__content-source-toggle`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>D(`upload`),disabled:w,className:`semiont-form__content-source-button`,"data-active":E===`upload`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__content-source-icon-wrapper`,children:[(0,I.jsx)(`span`,{className:`semiont-form__content-source-icon`,children:`📎`}),(0,I.jsx)(`span`,{className:`semiont-form__content-source-label`,children:u.uploadFile})]}),(0,I.jsx)(`div`,{className:`semiont-form__content-source-description`,children:u.uploadFileDescription})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>D(`write`),disabled:w,className:`semiont-form__content-source-button`,"data-active":E===`write`,children:[(0,I.jsxs)(`div`,{className:`semiont-form__content-source-icon-wrapper`,children:[(0,I.jsx)(`span`,{className:`semiont-form__content-source-icon`,children:`✍️`}),(0,I.jsx)(`span`,{className:`semiont-form__content-source-label`,children:u.writeContent})]}),(0,I.jsx)(`div`,{className:`semiont-form__content-source-description`,children:u.writeContentDescription})]})]})]}),!he&&E===`upload`&&(0,I.jsxs)(`div`,{className:`semiont-form__upload-section`,children:[(0,I.jsx)(`div`,{children:(0,I.jsxs)(`div`,{className:`semiont-form__upload-container`,children:[(0,I.jsx)(`label`,{className:`semiont-form__upload-dropzone`,"data-drag-over":N?`true`:`false`,onDragOver:e=>{e.preventDefault(),te(!0)},onDragLeave:()=>te(!1),onDrop:e=>{e.preventDefault(),te(!1);let t=e.dataTransfer.files?.[0];t&&!w&&pe(t)},children:(0,I.jsxs)(`div`,{className:`semiont-form__upload-area`,children:[(0,I.jsx)(`input`,{type:`file`,accept:e1,onChange:fe,className:`semiont-form__upload-input`,disabled:w}),(0,I.jsx)(`p`,{className:`semiont-form__upload-text`,children:O?O.name:u.dropFileOrClick}),(0,I.jsx)(`p`,{className:`semiont-form__upload-hint`,children:u.supportedFormats})]})}),O&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{k(null),M(null),j(`text/markdown`)},className:`semiont-button semiont-button--danger semiont-button--small`,disabled:w,children:`Clear`})]})}),O&&(0,I.jsxs)(`div`,{className:`semiont-form__media-type`,children:[(0,I.jsxs)(`span`,{className:`semiont-form__media-type-label`,children:[u.mediaType,`:`]}),(0,I.jsx)(`code`,{className:`semiont-form__media-type-value`,children:A}),(0,I.jsx)(`span`,{className:`semiont-form__media-type-lock`,title:u.autoDetected,children:`🔒`})]}),O&&ee&&Si(A)?.render===`image`&&(0,I.jsxs)(`div`,{className:`semiont-form__image-preview`,children:[(0,I.jsx)(`p`,{className:`semiont-form__image-preview-label`,children:`Preview:`}),(0,I.jsx)(`div`,{className:`semiont-form__image-preview-container`,children:(0,I.jsx)(`img`,{src:ee,alt:`Upload preview`,className:`semiont-form__image-preview-img`})})]})]}),(he||E===`write`)&&(0,I.jsxs)(`div`,{className:`semiont-form__write-section`,children:[!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`format-select`,className:`semiont-form__label`,children:u.format}),(0,I.jsx)(`select`,{id:`format-select`,value:ne,onChange:e=>re(e.target.value),disabled:w,className:`semiont-select`,children:Ai.map(e=>(0,I.jsxs)(`option`,{value:e,children:[Si(e)?.label??e,` (`,e,`)`]},e))})]}),(0,I.jsxs)(`div`,{className:`semiont-form__field semiont-form__editor`,children:[(0,I.jsx)(`label`,{className:`semiont-form__label`,children:he?u.resourceContent:u.content}),(0,I.jsx)(`div`,{className:`semiont-form__editor-wrapper`,lang:ie,children:(0,I.jsx)(KH,{content:b,editable:!w,sourceView:!0,showLineNumbers:g,hoverDelayMs:a,onChange:e=>x(e)})})]}),!he&&(0,I.jsxs)(`div`,{className:`semiont-form__field`,children:[(0,I.jsx)(`label`,{htmlFor:`charset-select`,className:`semiont-form__label`,children:u.encoding}),(0,I.jsxs)(`select`,{id:`charset-select`,value:oe,onChange:e=>se(e.target.value),disabled:w,className:`semiont-select`,children:[(0,I.jsx)(`option`,{value:``,children:`UTF-8 (default)`}),(0,I.jsx)(`option`,{value:`iso-8859-1`,children:`ISO-8859-1 (Latin-1)`}),(0,I.jsx)(`option`,{value:`windows-1252`,children:`Windows-1252`}),(0,I.jsx)(`option`,{value:`ascii`,children:`ASCII`}),(0,I.jsx)(`option`,{value:`utf-16le`,children:`UTF-16LE`})]})]})]}),he&&(0,I.jsxs)(`div`,{className:`semiont-form__checkbox-field`,children:[(0,I.jsx)(`input`,{id:`archiveOriginal`,type:`checkbox`,checked:P,onChange:e=>F(e.target.checked),className:`semiont-checkbox`,disabled:w}),(0,I.jsx)(`label`,{htmlFor:`archiveOriginal`,className:`semiont-form__checkbox-label`,children:u.archiveOriginal})]})]}),(0,I.jsxs)(`div`,{className:`semiont-form__actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:c,disabled:w||l!==null,className:Ew.tertiary.base,children:u.cancel}),(0,I.jsx)(`button`,{type:`submit`,disabled:w||l!==null||!_.trim(),className:Ew.primary.base,children:w?he?u.saving:u.creating:he?u.saveClonedResource:u.createResource})]}),(0,I.jsx)($$,{progress:l})]})})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(d,{activePanel:o,theme:i}),(0,I.jsx)(f,{context:`simple`,activePanel:o})]})]})}var r1=y.memo(({resource:e,onOpen:t,tabIndex:n=0,archivedLabel:r,createdLabel:i})=>(0,I.jsxs)(`div`,{onClick:()=>t(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))},role:`button`,tabIndex:n,"aria-label":`Open resource: ${e.name}`,className:`semiont-resource-card`,children:[(0,I.jsxs)(`div`,{className:`semiont-resource-card__header`,children:[(0,I.jsx)(`h4`,{className:`semiont-resource-card__title`,children:e.name}),e.archived&&(0,I.jsx)(`span`,{className:`semiont-resource-card__badge`,"data-type":`archived`,children:r})]}),(0,I.jsxs)(`div`,{className:`semiont-resource-card__metadata`,children:[(0,I.jsxs)(`span`,{className:`semiont-resource-card__date`,children:[i,` `,e.dateCreated?new Date(e.dateCreated).toLocaleDateString():`N/A`]}),e.entityTypes&&e.entityTypes.length>0&&(0,I.jsxs)(`div`,{className:`semiont-tags`,children:[e.entityTypes.slice(0,2).map(e=>(0,I.jsx)(`span`,{className:`semiont-tag semiont-tag--secondary semiont-tag--compact semiont-tag--rounded-sm`,children:e},e)),e.entityTypes.length>2&&(0,I.jsxs)(`span`,{className:`semiont-tag semiont-tag--secondary semiont-tag--compact semiont-tag--rounded-sm`,children:[`+`,e.entityTypes.length-2]})]})]})]}));r1.displayName=`ResourceCard`;function i1({recentDocuments:e,searchDocuments:t,entityTypes:n,isLoadingRecent:r,recentError:i=null,onRetryRecent:a,isSearching:o,searchMatchKind:s,searchQuery:c,onSearchQueryChange:l,selectedEntityType:u,onSelectedEntityTypeChange:d,theme:f,activePanel:p,onNavigateToResource:m,onNavigateToCompose:h,translations:g,ToolbarPanels:_}){let v=c.trim()!==``,b=v?t:e,x=aF(n.length+1,{orientation:`horizontal`}),S=aF(b.length,{orientation:`grid`,cols:2}),C=(0,y.useRef)(m);C.current=m;let w=(0,y.useCallback)(e=>{d(e)},[d]),T=(0,y.useCallback)(e=>{let t=Hr(e);t&&C.current(t)},[]);if(i)return(0,I.jsxs)(`div`,{className:`semiont-page__loading`,children:[(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:g.recentFailed}),a&&(0,I.jsx)(`button`,{type:`button`,onClick:a,className:`semiont-button`,"data-variant":`secondary`,children:g.retry})]});if(r)return(0,I.jsx)(`div`,{className:`semiont-page__loading`,children:(0,I.jsx)(`p`,{className:`semiont-page__loading-text`,children:g.loadingKnowledgeBase})});let E=v&&t.length===0&&!o;return(0,I.jsxs)(`div`,{className:`semiont-page${p&&I$.includes(p)?` semiont-page--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__content`,children:[(0,I.jsxs)(`div`,{className:`semiont-page__header`,children:[(0,I.jsx)(`h1`,{className:`semiont-page__title`,children:g.title}),(0,I.jsx)(`p`,{className:`semiont-page__subtitle`,children:g.subtitle})]}),(0,I.jsxs)(`div`,{className:`semiont-card`,children:[(0,I.jsx)(`div`,{className:`semiont-card__search-form`,children:(0,I.jsxs)(`div`,{className:`semiont-card__search-wrapper`,children:[(0,I.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:g.searchPlaceholder,className:`semiont-card__search-input`,"aria-label":g.searchPlaceholder}),o&&(0,I.jsx)(`span`,{className:`semiont-card__search-status`,"aria-live":`polite`,children:g.searching})]})}),n.length>0&&(0,I.jsxs)(`div`,{className:`semiont-card__filters`,children:[(0,I.jsx)(`h3`,{className:`semiont-card__filters-label`,children:g.filterByEntityType}),(0,I.jsxs)(`div`,{ref:x.containerRef,onKeyDown:x.handleKeyDown,className:`semiont-card__filter-buttons`,role:`group`,"aria-label":`Entity type filters`,children:[(0,I.jsx)(`button`,{onClick:()=>w(``),tabIndex:0,"aria-pressed":u===``,className:`semiont-card__filter-button`,"data-active":u===``,children:g.all}),n.map(e=>(0,I.jsx)(`button`,{onClick:()=>w(e),tabIndex:-1,"aria-pressed":u===e,className:`semiont-card__filter-button`,"data-active":u===e,children:e},e))]})]}),(0,I.jsxs)(`div`,{className:`semiont-card__documents`,children:[(0,I.jsx)(`h3`,{className:`semiont-card__documents-label`,children:v&&t.length>0?g.searchResults(t.length):u?g.documentsTaggedWith(u):g.recentResources}),v&&s===`semantic`&&t.length>0&&(0,I.jsx)(`p`,{className:`semiont-card__documents-note`,"data-testid":`semiont-semantic-match-notice`,"aria-live":`polite`,children:g.semanticFallbackNotice}),E&&(0,I.jsx)(`div`,{className:`semiont-card__warning`,children:(0,I.jsx)(`p`,{className:`semiont-card__warning-text`,children:g.noResultsFound(c)})}),b.length>0?(0,I.jsx)(`div`,{ref:S.containerRef,onKeyDown:S.handleKeyDown,className:`semiont-card-grid`,role:`group`,"aria-label":`Document grid`,children:b.map((e,t)=>(0,I.jsx)(r1,{resource:e,onOpen:T,tabIndex:t===0?0:-1,archivedLabel:g.archived,createdLabel:g.created},Hr(e)))}):(0,I.jsxs)(`div`,{className:`semiont-card__empty`,children:[(0,I.jsx)(`p`,{className:`semiont-card__empty-text`,children:g.noResourcesAvailable}),!v&&(0,I.jsx)(`button`,{onClick:h,className:`semiont-card__empty-button`,children:g.composeFirstResource})]})]})]})]}),(0,I.jsxs)(`div`,{className:`semiont-page__sidebar`,children:[(0,I.jsx)(_,{activePanel:p,theme:f}),(0,I.jsx)(tU,{context:`simple`,activePanel:p})]})]})}function a1(e,t){let n=Z(Up().activeSession$),r=(0,y.useRef)(null);(0,y.useEffect)(()=>{!t||!n||r.current!==e&&(r.current=e,n.client.browse.resourceViewed(e))},[e,t,n])}var o1=[`no-text-layer`,`encrypted`,`corrupt`,`too-large`,`empty`];function s1(e){return!Ri(e)||e.declined!==!0||!Ii(e.reason)?null:o1.includes(e.reason)?e.reason:null}function c1(e){let t=Em(`OutcomeToasts`),{showError:n,showSuccess:r,showInfo:i}=Yp();SF({"mark:create-error":r=>{r.resourceId===e&&n(t(`createFailed`,{detail:r.message||t(`unknownError`)}))},"mark:delete-error":r=>{r.resourceId===e&&n(t(`deleteFailed`,{detail:r.message||t(`unknownError`)}))},"bind:body-error":r=>{r.resourceId===e&&n(t(`referenceUpdateFailed`,{detail:r.message||t(`unknownError`)}))},"mark:assist-timeout":n=>{n.resourceId===e&&i(t(`assistQuiet`))},"job:complete":n=>{if(n.resourceId!==e)return;if(n.result?.kind===`generation`){r(n.result.resourceName?t(`resourceCreatedNamed`,{name:n.result.resourceName}):t(`resourceCreated`));return}let a=s1(n.result);a?i(t(`decline_${a}`)):r(t(`annotationComplete`))},"job:fail":r=>{r.resourceId===e&&(r.jobType===`generation`?n(t(`generationFailed`,{detail:r.error})):n(r.error||t(`annotationFailed`)))}})}function l1(e,t,n){let r=(0,y.useRef)(e),i=(0,y.useRef)(null),a=(0,y.useRef)(n);(0,y.useEffect)(()=>{a.current=n}),(0,y.useEffect)(()=>{if(e&&e!==r.current&&(r.current=e,i.current=e),!i.current)return;let n=String(i.current.resourceId),o=t.find(e=>e.motivation===`linking`&&String(xr(e.body)??``)===n);o&&(i.current=null,a.current(o.id))},[e,t])}var u1=De(Ip(),1),d1=De(Ip(),1);function f1(e,t){let n=new d1.BehaviorSubject(t),r=new d1.BehaviorSubject(!0),i=new d1.BehaviorSubject(!1),a=new d1.BehaviorSubject(null),o=!1,s=null,c=!1,l=()=>{c||(s?.unsubscribe(),s=e().subscribe(e=>{switch(e.status){case`pending`:o&&!i.getValue()&&i.next(!0);return;case`ready`:a.getValue()!==null&&a.next(null),o=!0,n.next(e.value),r.getValue()&&r.next(!1),i.getValue()&&i.next(!1);return;case`failed`:a.next(e.error),r.getValue()&&r.next(!1),i.getValue()&&i.next(!1);return}}))};return l(),{state:{value$:n.asObservable(),loading$:r.asObservable(),revalidating$:i.asObservable(),error$:a.asObservable(),retry:()=>{c||(a.next(null),o?i.next(!0):r.next(!0),l())}},dispose:()=>{c||(c=!0,s?.unsubscribe(),s=null,n.complete(),r.complete(),i.complete(),a.complete())}}}var p1={open:!1,annotationId:null,resourceId:null,defaultTitle:``,entityTypes:[]};function m1(e,t,n,r,i){let{client:a}=e,o=ml(),s=gl(a),c=Cl(a,t),l=vl(a,t),u=yl(a,t),d=bl(a,n);o.add(s),o.add(c),o.add(l),o.add(u),o.add(d);let f=f1(()=>a.browse.annotations(t),[]),p=f1(()=>a.browse.entityTypes(),[]),m=f1(()=>a.browse.events(t),[]),h=f1(()=>a.browse.referencedBy(t),[]);o.add(f.dispose),o.add(p.dispose),o.add(m.dispose),o.add(h.dispose);let g=f.state.value$.pipe((0,u1.map)(fF)),_=new u1.BehaviorSubject(``),v=new u1.BehaviorSubject(!1),y=new u1.BehaviorSubject(null),b=i?.mediaType||`text/plain`,x=Oi(b)!==`decode`;!x&&b&&(v.next(!0),a.browse.resourceRepresentation(t).then(({data:e,contentType:t})=>{_.next(hi(e,t)),v.next(!1)}).catch(()=>{v.next(!1)})),x&&a.auth.mediaToken(t).then(({token:e})=>y.next(e)).catch(()=>{});let S=new u1.BehaviorSubject(p1),C=a.bus.get(`bind:initiate`).subscribe(e=>{S.next({open:!0,annotationId:e.annotationId,resourceId:e.resourceId,defaultTitle:e.defaultTitle,entityTypes:e.entityTypes}),a.bus.get(`gather:requested`).next({correlationId:_r(),annotationId:e.annotationId,resourceId:e.resourceId,options:{contextWindow:2e3}})});return o.add(()=>C.unsubscribe()),{beckon:s,browse:r,mark:c,gather:l,yield:d,annotations:f.state,entityTypes:p.state,events:m.state,referencedBy:h.state,annotationGroups$:g,content$:_.asObservable(),contentLoading$:v.asObservable(),mediaToken$:y.asObservable(),wizard$:S.asObservable(),closeWizard:()=>S.next(p1),dispose:()=>{S.complete(),_.complete(),v.complete(),y.complete(),o.dispose()}}}function h1(){return typeof window>`u`?null:localStorage.getItem(`activeToolbarPanel`)||`knowledge-base`}function g1(e){typeof window>`u`||(e?localStorage.setItem(`activeToolbarPanel`,e):localStorage.removeItem(`activeToolbarPanel`))}function _1(){let e=Up();return YP(()=>L$(e,{initialPanel:h1(),onPanelChange:g1}))}function v1(e,t){let{context:n,...r}=e;return{...r,...t?{sourceLanguage:t}:{}}}function y1({resource:e,rUri:t,locale:n,Link:r,routes:i,ToolbarPanels:a,refetchDocument:o,streamStatus:s,knowledgeBaseName:c,browseRenderers:l,annotateRenderers:u}){let d=Em(`ReferenceWizard`),f=Em(`ResourceGenerate`),p=Up(),m=Z(p.activeSession$),h=m?.client,g=rF(),{collaborators:_}=mF(h??null),v=_.find(e=>e.servesJobTypes?.includes(`generation`)),b=(0,y.useCallback)(e=>{g(`/know/resource/${e}`,{resourceId:e})},[g]),x=(0,y.useCallback)(e=>{p.emit(`panel:open`,e)},[p]),{showError:S,showSuccess:C}=Yp(),{theme:w}=lF(),{showLineNumbers:T}=zp(),{hoverDelayMs:E}=nF(),{triggerSparkleAnimation:D,clearSparkle:O,sparkleAnnotationIds:k}=jF(),A=Wr(e)||`text/plain`,j=yF(IP(A)),ee=j.annotateMode,M=Si(A)?.render,N=M===`image`||M===`pdf`,{content:te,loading:ne,error:re}=dF(h??null,t,e,!N);(0,y.useEffect)(()=>{re&&S(`Failed to load resource representation`)},[re,S]);let{token:ie,loading:ae}=pF(h??null,t),oe=(N?zP(h,t,ie):void 0)??``,se=N?oe:te,ce=N?ae:ne,le=_1(),P=XP(m??void 0,e=>m1(e,t,n,le)),F=Z(P?.annotations.value$)??[],ue=Z(P?.annotations.error$)??null,de=Z(P?.annotationGroups$),fe=Z(P?.entityTypes.value$)??[],pe=Z(P?.entityTypes.error$)??null,me=Z(P?.referencedBy.value$)??[],he=Z(P?.referencedBy.loading$)??!0,ge=Z(P?.referencedBy.error$)??null,_e=Z(P?.events.value$)??[],ve=Z(P?.events.loading$)??!0,ye=Z(P?.events.error$)??null,be=Z(P?.beckon.hoveredAnnotationId$)??null,xe=Z(P?.mark.pendingAnnotation$)??null,Se=Z(P?.mark.assistingMotivation$)??null,Ce=Z(P?.mark.progress$)??null,we=Z(P?.browse.activePanel$)??null,Te=Z(P?.browse.scrollToAnnotationId$)??null,L=Z(P?.browse.panelInitialTab$)??null,Ee=P?.browse.onScrollCompleted,De=Z(P?.yield.progress$)??null,Oe=Z(P?.yield.isGenerating$)??!1,ke=Z(P?.yield.outcome$)??null;l1(ke,F,(0,y.useCallback)(e=>{p.emit(`panel:open`,{panel:`annotations`,scrollToAnnotationId:e,motivation:`linking`}),D(e)},[p,D]));let Ae=Z(P?.gather.context$)??null,je=Z(P?.gather.loading$)??!1,Me=Z(P?.gather.error$)??null,Ne=Z(P?.gather.resourceContext$)??null,Pe=Z(P?.gather.resourceLoading$)??!1,Fe=Z(P?.gather.resourceError$)??null,Ie=Z(P?.wizard$),Le=Ie?.open??!1,Re=Ie?.annotationId??null,ze=Ie?.resourceId??null,Be=Ie?.defaultTitle??``,Ve=Ie?.entityTypes??[],[He,Ue]=(0,y.useState)(!1),We=(0,y.useCallback)(()=>{P?.closeWizard()},[P]),Ge=(0,y.useCallback)((t,n)=>{O(dr(t)),P?.yield.generate(n.context,v1(n,Gr(e)))},[P,O,e]),Ke=(0,y.useCallback)((t,n)=>{P?.yield.generate(n.context,v1(n,Gr(e)))},[P,e]),qe=(0,y.useCallback)(async(e,n)=>{if(h)try{await h.bind.body(t,dr(e),[{op:`add`,item:{type:`SpecificResource`,source:n,purpose:`linking`}}]),C(`Reference linked successfully`)}catch(e){S(`Failed to link reference: ${e instanceof Error?e.message:String(e)}`)}},[t,h,C,S]),Je=(0,y.useCallback)(async(e,n)=>{if(!h)throw Error(`No active session`);try{let r=`text/markdown`,i=new File([new Blob([n.content],{type:r})],n.name+wi(r),{type:r}),a=await new Promise((e,t)=>{h.yield.resource({name:n.name,file:i,format:r,entityTypes:n.entityTypes,language:n.language,storageUri:n.storagePath}).subscribe({next:t=>{t.phase===`finished`&&e(t.resourceId)},error:t})});await h.bind.body(t,dr(e),[{op:`add`,item:{type:`SpecificResource`,source:a,purpose:`linking`}}]),C(`Reference successfully linked to the new resource`)}catch(e){throw S(`Failed to compose resource: ${e instanceof Error?e.message:String(e)}`),e}},[h,t,C,S]);(0,y.useEffect)(()=>{if(e&&t){let n=Wr(e);p.addOpenResource(t,e.name,n||void 0,Kr(e)),p.setLastViewedResource(t)}},[e,t,p]),(0,y.useEffect)(()=>{xe&&p.emit(`panel:open`,{panel:`annotations`})},[xe,p]);let Ye=(0,y.useCallback)(async()=>{if(h)try{await h.mark.archive(t),await o()}catch(e){console.error(`Failed to archive document:`,e),S(`Failed to archive document`)}},[h,t,o,S]),Xe=(0,y.useCallback)(async()=>{if(h)try{await h.mark.unarchive(t),await o()}catch(e){console.error(`Failed to unarchive document:`,e),S(`Failed to unarchive document`)}},[h,t,o,S]),Ze=(0,y.useCallback)(async()=>{if(h)try{let e=(await h.yield.cloneToken(t)).token;p.emit(`nav:push`,{path:`/know/compose?mode=clone&token=${e}`,reason:`clone`})}catch(e){console.error(`Failed to generate clone token:`,e),S(`Failed to generate clone link`)}},[h,t,S,p]),Qe=(0,y.useCallback)(({annotationId:e})=>{D(e)},[D]),$e=(0,y.useCallback)(e=>{D(e.payload.annotation.id)},[D]),et=(0,y.useCallback)(e=>{e.payload.operations.some(e=>e.op===`add`&&e.item.type===`SpecificResource`&&e.item.purpose===`linking`)&&D(e.payload.annotationId)},[D]),tt=(0,y.useCallback)(({resourceId:e})=>{if(i.resourceDetail){let t=i.resourceDetail(e);p.emit(`nav:push`,{path:t,reason:`reference-link`})}},[i.resourceDetail,p]),nt=(0,y.useCallback)(({entityType:e})=>{if(i.know){let t=`${i.know}?entityType=${encodeURIComponent(e)}`;p.emit(`nav:push`,{path:t,reason:`entity-type-filter`})}},[i.know,p]);c1(t),SF({"mark:archive":Ye,"mark:unarchive":Xe,"yield:clone":Ze,"beckon:sparkle":Qe,"mark:added":$e,"mark:body-updated":et,"browse:resource-open":tt,"browse:entity-type-clicked":nt});let{announceResourceLoading:rt,announceResourceLoaded:it}=EF();(0,y.useEffect)(()=>{ce?rt(e.name):se&&it(e.name)},[ce,se,e.name,rt,it]),a1(t,!ce&&!!se);let at=e.entityTypes||[],ot=Ur(e),st=ot?.mediaType,ct=ot?.byteSize,lt={...e,content:se},ut=(0,y.useCallback)(e=>{e&&m?.client.beckon.sparkle(dr(e))},[m]),dt=(0,y.useCallback)(e=>{e&&P?.beckon.focus(dr(e))},[P]);return(0,I.jsxs)(`div`,{className:`semiont-document-viewer${we?` semiont-document-viewer--panel-open`:``}`,children:[(0,I.jsxs)(`div`,{className:`semiont-document-viewer__main`,children:[(0,I.jsxs)(`div`,{className:`semiont-document-viewer__content`,children:[(0,I.jsx)(`div`,{className:`semiont-document-viewer__header`,children:(0,I.jsx)(`div`,{className:`semiont-document-viewer__header-inner`,children:(0,I.jsx)(`h2`,{className:`semiont-document-viewer__title`,children:e.name})})}),(0,I.jsx)(`div`,{className:`semiont-document-viewer__scrollable-body`,lang:Gr(e)||void 0,children:(0,I.jsx)(XH,{fallback:(e,t)=>(0,I.jsxs)(`div`,{className:`semiont-document-viewer__error`,children:[(0,I.jsx)(`h3`,{className:`semiont-document-viewer__error-title`,children:`Error loading document viewer`}),(0,I.jsx)(`p`,{className:`semiont-document-viewer__error-message`,children:e.message}),(0,I.jsx)(`button`,{onClick:t,className:`semiont-document-viewer__error-button`,children:`Try again`})]}),children:ce?(0,I.jsx)(`div`,{className:`semiont-document-viewer__loading`,children:`Loading document content...`}):(0,I.jsx)(dJ,{resource:lt,annotations:de??{highlights:[],comments:[],assessments:[],references:[],tags:[]},session:m??null,onOpenResource:b,onOpenPanel:x,annotateMode:j.annotateMode,onAnnotateModeChange:j.setAnnotateMode,clickAction:j.clickAction,onClickActionChange:j.setClickAction,selectionMotivation:j.selectionMotivation,onSelectionMotivationChange:j.setSelectionMotivation,shape:j.shape,onShapeChange:j.setShape,sparkleAnnotationIds:k,generatingReferenceId:De?.annotationId??null,showLineNumbers:T,hoverDelayMs:E,hoveredAnnotationId:be,...l&&{browseRenderers:l},...u&&{annotateRenderers:u}})})})]}),(0,I.jsxs)(`div`,{className:`semiont-document-viewer__sidebar`,children:[(0,I.jsxs)(a,{activePanel:we,theme:w,width:we===`jsonld`?`w-[600px]`:we===`annotations`?`w-[400px]`:`w-64`,children:[ee&&e.archived&&(0,I.jsx)(`div`,{className:`semiont-document-viewer__archived-status`,children:(0,I.jsx)(`div`,{className:`semiont-document-viewer__archived-text`,children:`📦 Archived`})}),we===`annotations`&&!e.archived&&(0,I.jsx)(QJ,{session:m??null,onOpenResource:b,annotations:F,annotators:ww,annotateMode:ee,assistingMotivation:Se,progress:Ce,pendingAnnotation:xe,allEntityTypes:fe,annotationsError:ue,onRetryAnnotations:P?.annotations.retry,entityTypesError:pe,generatingReferenceId:De?.annotationId??null,sparkleAnnotationIds:k,referencedBy:me,referencedByLoading:he,referencedByError:ge,onRetryReferencedBy:P?.referencedBy.retry,resourceId:t,locale:n,sourceLanguage:Gr(e),scrollToAnnotationId:Te,hoveredAnnotationId:be,onScrollCompleted:Ee,initialTab:L?.tab,initialTabGeneration:L?.generation,Link:r,routes:i}),we===`history`&&(0,I.jsx)(nJ,{events:_e,eventsLoading:ve,eventsError:ye,onRetryEvents:P?.events.retry,annotations:F,hoveredAnnotationId:be,onEventHover:ut,onEventClick:dt,Link:r,routes:i}),we===`info`&&(0,I.jsx)(GJ,{session:m??null,resourceId:t,documentEntityTypes:at,documentLocale:Gr(e),primaryMediaType:st,primaryByteSize:ct,storageUri:Kr(e),isArchived:e.archived??!1,dateCreated:e.dateCreated,dateModified:e.dateModified,wasAttributedTo:e.wasAttributedTo,wasDerivedFrom:e.wasDerivedFrom,generator:e.generator,onGenerate:()=>Ue(!0),isGenerating:Oe,generationProgress:De&&!De.annotationId?De:null,generationOutcome:ke,onDismissProgress:()=>P?.yield.dismissProgress()}),we===`collaboration`&&(0,I.jsx)(OJ,{state:s,eventCount:0,knowledgeBaseName:c,collaborators:_}),we===`jsonld`&&(0,I.jsx)(LJ,{resourceId:t})]}),(0,I.jsx)(tU,{context:`document`,activePanel:we,isArchived:e.archived??!1})]})]}),(0,I.jsx)(RQ,{...v?{generationAgent:v}:{},isOpen:Le,onClose:We,annotationId:Re,resourceId:ze,defaultTitle:Be,defaultFolder:Pi(Kr(e)),entityTypes:Ve,resourceName:e.name,locale:n,context:Ae,contextLoading:je,contextError:Me,onGenerateSubmit:Ge,onLinkResource:qe,onComposeSubmit:Je,entityTypeOptions:fe,hoverDelayMs:E,translations:{resolveTitle:d(`resolveTitle`),sourceContextLabel:d(`sourceContextLabel`),connectionsLabel:d(`connectionsLabel`),citedByLabel:d(`citedByLabel`),userHintLabel:d(`userHintLabel`),userHintEffect:d(`userHintEffect`),userHintPlaceholder:d(`userHintPlaceholder`),graphPaneTitle:d(`graphPaneTitle`),graphEmpty:d(`graphEmpty`),resourceLinkLabel:d(`resourceLinkLabel`),corpusPaneTitle:d(`corpusPaneTitle`),corpusEmpty:d(`corpusEmpty`),excludedReceipt:d(`excludedReceipt`),machineRead:d(`machineRead`),loadingContext:d(`loadingContext`),failedContext:d(`failedContext`),search:d(`search`),searching:d(`searching`),generate:d(`generate`),compose:d(`compose`),resolutionStrategyLabel:d(`resolutionStrategyLabel`),back:d(`back`),link:d(`link`),score:d(`score`),noResults:d(`noResults`),resourceTitle:d(`resourceTitle`),resourceTitlePlaceholder:d(`resourceTitlePlaceholder`),saveLocation:d(`saveLocation`),additionalInstructions:d(`additionalInstructions`),additionalInstructionsPlaceholder:d(`additionalInstructionsPlaceholder`),language:d(`language`),languageHelp:d(`languageHelp`),creativity:d(`creativity`),creativityFocused:d(`creativityFocused`),creativityCreative:d(`creativityCreative`),maxLength:d(`maxLength`),maxLengthHelp:d(`maxLengthHelp`),maxLengthCeiling:d(`maxLengthCeiling`),outputFormat:d(`outputFormat`),formatExtensionMismatch:d(`formatExtensionMismatch`),maxResults:d(`maxResults`),semanticScoring:d(`semanticScoring`),semanticScoringHelp:d(`semanticScoringHelp`),searchFailed:d(`searchFailed`),entityTypes:d(`entityTypes`),contentLabel:d(`contentLabel`),createAndLink:d(`createAndLink`),creatingAndLinking:d(`creatingAndLinking`),discardDraftPrompt:d(`discardDraftPrompt`),discardDraft:d(`discardDraft`),keepEditing:d(`keepEditing`)}}),(0,I.jsx)(BQ,{...v?{generationAgent:v}:{},isOpen:He,onClose:()=>Ue(!1),resourceId:t,defaultTitle:e.name,defaultFolder:Pi(Kr(e)),locale:n,entityTypeOptions:fe,onGenerateSubmit:Ke,gatherContext:Ne,gatherLoading:Pe,gatherError:Fe,onGather:e=>P?.gather.gatherResource(t,e),translations:{title:f(`title`),gatherIntro:f(`gatherIntro`),includeContent:f(`includeContent`),includeSummary:f(`includeSummary`),gatherDepth:f(`gatherDepth`),gatherMaxResources:f(`gatherMaxResources`),gatherButton:f(`gatherButton`),editGather:f(`editGather`),recallLabel:f(`recallLabel`),loadingContext:f(`loadingContext`),failedContext:f(`failedContext`),sourceContextLabel:f(`sourceContextLabel`),connectionsLabel:f(`connectionsLabel`),citedByLabel:f(`citedByLabel`),graphPaneTitle:f(`graphPaneTitle`),graphEmpty:f(`graphEmpty`),resourceLinkLabel:f(`resourceLinkLabel`),corpusPaneTitle:f(`corpusPaneTitle`),corpusEmpty:f(`corpusEmpty`),excludedReceipt:f(`excludedReceipt`),machineRead:f(`machineRead`),score:f(`score`),resourceTitle:f(`resourceTitle`),resourceTitlePlaceholder:f(`resourceTitlePlaceholder`),saveLocation:f(`saveLocation`),additionalInstructions:f(`additionalInstructions`),additionalInstructionsPlaceholder:f(`additionalInstructionsPlaceholder`),language:f(`language`),languageHelp:f(`languageHelp`),creativity:f(`creativity`),creativityFocused:f(`creativityFocused`),creativityCreative:f(`creativityCreative`),maxLength:f(`maxLength`),maxLengthHelp:f(`maxLengthHelp`),maxLengthCeiling:f(`maxLengthCeiling`),outputFormat:f(`outputFormat`),formatExtensionMismatch:f(`formatExtensionMismatch`),generate:f(`generate`),discardDraftPrompt:f(`discardDraftPrompt`),discardDraft:f(`discardDraft`),keepEditing:f(`keepEditing`)}})]})}var b1=De(Ip(),1);function x1(e){let{client:t}=e,n=new b1.BehaviorSubject(!1);return{isLoggingOut$:n.asObservable(),logout:async()=>{n.next(!0);try{await t.auth.logout()}catch{}finally{n.next(!1)}},dispose:()=>{n.complete()}}}var S1=De(Ip(),1);function C1(e,t,n,r){let{client:i}=e,a=ml(),o=n.mode===`clone`&&!!n.token,s=o?`clone`:`new`,c=new S1.BehaviorSubject(s),l=new S1.BehaviorSubject(!0),u=new S1.BehaviorSubject(null),d=new S1.BehaviorSubject(null),f=f1(()=>i.browse.entityTypes(),[]);return a.add(f.dispose),o?(async()=>{try{let e=await i.yield.fromToken(n.token);if(e&&r){let t=ur(e[`@id`]),{data:n,contentType:r}=await i.browse.resourceRepresentation(t),a=hi(n,r);u.next({sourceResource:e,sourceContent:a})}}catch{}l.next(!1)})():l.next(!1),{browse:t,mode$:c.asObservable(),loading$:l.asObservable(),cloneData$:u.asObservable(),entityTypes:f.state,uploadProgress$:d.asObservable(),save:async e=>{if(e.mode===`clone`)return(await i.yield.createFromToken({token:n.token,name:e.name,content:e.content,archiveOriginal:e.archiveOriginal??!0})).resourceId;let t,r;if(e.file)t=e.file,r=e.format??`application/octet-stream`;else{let n=new Blob([e.content||``],{type:e.format??`application/octet-stream`}),i=wi(e.format??`application/octet-stream`);t=new File([n],e.name+i,{type:e.format??`application/octet-stream`}),r=e.format??`application/octet-stream`}let a=e.charset&&!e.file?`${r}; charset=${e.charset}`:r;return await new Promise((n,r)=>{i.yield.resource({name:e.name,file:t,format:a,entityTypes:e.entityTypes||[],language:e.language,storageUri:e.storageUri}).subscribe({next:e=>{d.next(e),e.phase===`finished`&&n(e.resourceId)},error:e=>{d.next(null),r(e)},complete:()=>d.next(null)})})},dispose:()=>{c.complete(),l.complete(),u.complete(),d.complete(),a.dispose()}}}var w1=De(Ip(),1);function T1(e,t){let{client:n}=e,r=new w1.BehaviorSubject(void 0),i=new w1.BehaviorSubject(null),a=null,o=!1,s=()=>{o||(a?.unsubscribe(),a=n.browse.resource(t).subscribe(e=>{if(e.status===`failed`){i.next(e.error);return}e.status===`ready`&&i.getValue()!==null&&i.next(null),r.next(fc(e))}))};s();let c=(0,w1.combineLatest)([r,i]).pipe((0,w1.map)(([e,t])=>e===void 0&&t===null),(0,w1.distinctUntilChanged)());return{resource$:r.asObservable(),isLoading$:c,error$:i.asObservable(),invalidate:()=>{o||(i.next(null),n.browse.invalidateResourceDetail(t),s())},dispose:()=>{o||(o=!0,a?.unsubscribe(),a=null,r.complete(),i.complete())}}}var E1=De(Ip(),1);function D1(e,t){let{client:n}=e,r=ml(),i=new E1.BehaviorSubject([]),a=new E1.BehaviorSubject(null),o=new E1.BehaviorSubject(!0),s=new E1.BehaviorSubject(!0),c=()=>{o.next(!0),n.admin.users().then(e=>{i.next(e.users??[]),o.next(!1)}).catch(()=>o.next(!1))},l=()=>{s.next(!0),n.admin.userStats().then(e=>{a.next(e.stats??null),s.next(!1)}).catch(()=>s.next(!1))};return c(),l(),{browse:t,users$:i.asObservable(),stats$:a.asObservable(),usersLoading$:o.asObservable(),statsLoading$:s.asObservable(),updateUser:async(e,t)=>{await n.admin.updateUser(qn(e),t),c(),l()},dispose:()=>{i.complete(),a.complete(),o.complete(),s.complete(),r.dispose()}}}var O1=De(Ip(),1);function k1(e,t){let{client:n}=e,r=ml(),i=new O1.BehaviorSubject([]),a=new O1.BehaviorSubject([]),o=new O1.BehaviorSubject(!0);return n.admin.oauthConfig().then(e=>{let t=e;i.next(t.providers??[]),a.next(t.allowedDomains??[]),o.next(!1)}).catch(()=>o.next(!1)),{browse:t,providers$:i.asObservable(),allowedDomains$:a.asObservable(),isLoading$:o.asObservable(),dispose:()=>{i.complete(),a.complete(),o.complete(),r.dispose()}}}var A1=De(Ip(),1);function j1(e){let{client:t}=e,n=ml(),r=new A1.BehaviorSubject(null),i=new A1.BehaviorSubject(!1);return t.auth.me().then(e=>r.next(e)).catch(()=>{}),{userData$:r.asObservable(),isProcessing$:i.asObservable(),acceptTerms:async()=>{i.next(!0);try{await t.auth.acceptTerms(),r.next({...r.getValue(),termsAcceptedAt:new Date().toISOString()})}finally{i.next(!1)}},dispose:()=>{r.complete(),i.complete(),n.dispose()}}}var M1=De(Ip(),1),N1=De(Cw(),1),P1=10,F1=20,I1=250;function L1(e,t){let{client:n}=e,r=ml(),i=new M1.BehaviorSubject(``);r.add(()=>i.complete());let a=new M1.Subject;r.add(()=>a.complete());let o=f1(()=>i.pipe((0,N1.switchMap)(e=>n.browse.resources({limit:P1,archived:!1,...e?{entityType:e}:{}}).pipe((0,N1.map)(e=>e.status===`ready`?{status:`ready`,value:e.value.resources}:e)))),[]);r.add(o.dispose);let s=f1(()=>n.browse.entityTypes(),[]);r.add(s.dispose);let c=a.pipe((0,N1.startWith)(``),(0,N1.debounceTime)(I1),(0,N1.distinctUntilChanged)()),l=(0,M1.combineLatest)([c,i]).pipe((0,N1.switchMap)(([e,t])=>{let r=e.trim();return r?n.browse.resources({search:r,limit:F1,...t?{entityType:t}:{}}).pipe((0,N1.map)(e=>{let t=fc(e);return{results:t?.resources??[],isSearching:e.status===`pending`,...t?{matchKind:t.matchKind}:{}}}),(0,N1.startWith)({results:[],isSearching:!0})):(0,M1.of)({results:[],isSearching:!1})}),(0,N1.shareReplay)({bufferSize:1,refCount:!0}));return{browse:t,search:{query$:a.pipe((0,N1.startWith)(``)),state$:l,setQuery:e=>a.next(e)},recent:o.state,entityTypes:s.state,selectedEntityType$:i.asObservable(),setSelectedEntityType:e=>i.next(e),dispose:()=>r.dispose()}}var R1=De(Ip(),1);function z1(e,t){let{client:n}=e,r=ml(),i=new R1.BehaviorSubject(``),a=new R1.BehaviorSubject(``),o=new R1.BehaviorSubject(!1),s=f1(()=>n.browse.entityTypes(),[]);return r.add(s.dispose),{browse:t,entityTypes:s.state,newTag$:i.asObservable(),error$:a.asObservable(),isAdding$:o.asObservable(),setNewTag:e=>i.next(e),addTag:async()=>{let e=i.getValue().trim();if(e){a.next(``),o.next(!0);try{await n.frame.addEntityType(e),i.next(``)}catch(e){a.next(e instanceof Error?e.message:`Failed to add entity type`)}finally{o.next(!1)}}},dispose:()=>{i.complete(),a.complete(),o.complete(),r.dispose()}}}function B1({children:e}){let t=v();return(0,I.jsxs)(QH,{resetKeys:[t.pathname],children:[(0,I.jsx)(Nq,{}),(0,I.jsx)(Mq,{}),e]})}var V1=y.lazy(()=>s(()=>import(`./layout-9e1YcaDw.js`),__vite__mapDeps([5,2,3,1,6,7]))),H1=y.lazy(()=>s(()=>import(`./page-Ek9VUv2q.js`),__vite__mapDeps([8,2,3,1,7]))),U1=y.lazy(()=>s(()=>import(`./page-Cykwm5Xf.js`),__vite__mapDeps([9,2,3,1,6,7,10,11,12]))),W1=y.lazy(()=>s(()=>import(`./page-D1Ih1hX6.js`),__vite__mapDeps([13,2,3,1,6,7,10,11,12]))),G1=y.lazy(()=>s(()=>import(`./page-Dc5_AoKR.js`),__vite__mapDeps([14,2,3,1,6,7,10,11,12]))),K1=y.lazy(()=>s(()=>import(`./page-CcV8oPXf.js`),__vite__mapDeps([15,2,3,7,1]))),q1=y.lazy(()=>s(()=>import(`./page-zWVJIy5v.js`),__vite__mapDeps([16,2,3,1,6,7,10,11,12]))),J1=y.lazy(()=>s(()=>import(`./page-Dyw4kLBQ.js`),__vite__mapDeps([17,2,3,1,6,7,10,11,12]))),Y1=y.lazy(()=>s(()=>import(`./page-CEOfOFJn.js`),__vite__mapDeps([18,2,3,1,7]))),X1=y.lazy(()=>s(()=>import(`./layout-ITFI0_HA.js`),__vite__mapDeps([19,2,3,1,6,7,10,11,20,21,12]))),Z1=y.lazy(()=>s(()=>import(`./page-CBZ9-Qv0.js`),__vite__mapDeps([22,2,3,1,7]))),Q1=y.lazy(()=>s(()=>import(`./page-OcQ2uaAq.js`),__vite__mapDeps([23,3,2,1,20,11,7]))),$1=y.lazy(()=>s(()=>import(`./page-D3YhksUZ.js`),__vite__mapDeps([24,2,3,1,20,11,7]))),e0=y.lazy(()=>s(()=>import(`./page-Cc3JDJuA.js`),__vite__mapDeps([25,2,3,1,20,11,7,12,26]))),t0=y.lazy(()=>s(()=>import(`./layout-GLK_QIQs.js`),__vite__mapDeps([27,2,3,1,6,7,10,11,21,28,12]))),n0=y.lazy(()=>s(()=>import(`./page-Kb_PxACs.js`),__vite__mapDeps([29,1,2,3,7]))),r0=y.lazy(()=>s(()=>import(`./client-DQkvuP6s.js`),__vite__mapDeps([30,2,3,1,20,11,7]))),i0=y.lazy(()=>s(()=>import(`./client--3y6Y86L.js`),__vite__mapDeps([31,3,2,1,20,11,7]))),a0=y.lazy(()=>s(()=>import(`./page-ZW2LvDvY.js`),__vite__mapDeps([32,2,3,1,20,11,7,28]))),o0=y.lazy(()=>s(()=>import(`./layout-CO_NB7xj.js`),__vite__mapDeps([33,2,3,1,6,7,10,11,21,12]))),s0=y.lazy(()=>s(()=>import(`./page-BS3gQcjY.js`),__vite__mapDeps([34,2,3,1,7]))),c0=y.lazy(()=>s(()=>import(`./page-DLvE0SQg.js`),__vite__mapDeps([35,3,2,1,20,11,7]))),l0=y.lazy(()=>s(()=>import(`./page-C5nD_mRH.js`),__vite__mapDeps([36,3,2,1,20,11,7]))),u0=y.lazy(()=>s(()=>import(`./page-Dgd7xLD8.js`),__vite__mapDeps([37,2,3,1,20,11,7]))),d0=y.lazy(()=>s(()=>import(`./not-found-CSMLdCX4.js`),__vite__mapDeps([26,3,2,1,7])));function f0({children:e}){let{locale:t}=u(),{i18n:n}=o();return(0,y.useEffect)(()=>{if(!t)return;let e=de(t)?t:`en`;n.language!==e&&n.changeLanguage(e)},[t,n]),!t||!de(t)?(0,I.jsx)(m,{to:`/en`,replace:!0}):(0,I.jsx)(I.Fragment,{children:e})}function p0(){return(0,I.jsx)(B1,{children:(0,I.jsx)(g,{})})}function m0(){let e=l();return(0,y.useEffect)(()=>{let t=navigator.language.split(`-`)[0]??`en`,n=de(t)?t:`en`;e(`/${n}`,{replace:!0})},[e]),null}function h0(){return(0,I.jsx)(y.Suspense,{fallback:null,children:(0,I.jsxs)(d,{children:[(0,I.jsx)(c,{path:`/`,element:(0,I.jsx)(m0,{})}),(0,I.jsxs)(c,{path:`/:locale`,element:(0,I.jsx)(f0,{children:(0,I.jsx)(V1,{})}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(H1,{})}),(0,I.jsx)(c,{path:`about`,element:(0,I.jsx)(U1,{})}),(0,I.jsx)(c,{path:`privacy`,element:(0,I.jsx)(W1,{})}),(0,I.jsx)(c,{path:`terms`,element:(0,I.jsx)(G1,{})}),(0,I.jsx)(c,{path:`auth/connect`,element:(0,I.jsx)(K1,{})}),(0,I.jsx)(c,{path:`auth/signup`,element:(0,I.jsx)(q1,{})}),(0,I.jsx)(c,{path:`auth/error`,element:(0,I.jsx)(J1,{})}),(0,I.jsxs)(c,{element:(0,I.jsx)(p0,{}),children:[(0,I.jsx)(c,{path:`auth/welcome`,element:(0,I.jsx)(Y1,{})}),(0,I.jsxs)(c,{path:`know`,element:(0,I.jsx)(X1,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(Z1,{})}),(0,I.jsx)(c,{path:`discover`,element:(0,I.jsx)(Q1,{})}),(0,I.jsx)(c,{path:`compose`,element:(0,I.jsx)($1,{})}),(0,I.jsx)(c,{path:`resource/:id`,element:(0,I.jsx)(e0,{})})]}),(0,I.jsxs)(c,{path:`admin`,element:(0,I.jsx)(t0,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(n0,{})}),(0,I.jsx)(c,{path:`users`,element:(0,I.jsx)(r0,{})}),(0,I.jsx)(c,{path:`security`,element:(0,I.jsx)(i0,{})}),(0,I.jsx)(c,{path:`devops`,element:(0,I.jsx)(a0,{})})]}),(0,I.jsxs)(c,{path:`moderate`,element:(0,I.jsx)(o0,{}),children:[(0,I.jsx)(c,{index:!0,element:(0,I.jsx)(s0,{})}),(0,I.jsx)(c,{path:`recent`,element:(0,I.jsx)(c0,{})}),(0,I.jsx)(c,{path:`entity-tags`,element:(0,I.jsx)(l0,{})}),(0,I.jsx)(c,{path:`tag-schemas`,element:(0,I.jsx)(u0,{})})]})]}),(0,I.jsx)(c,{path:`*`,element:(0,I.jsx)(d0,{})})]}),(0,I.jsx)(c,{path:`*`,element:(0,I.jsx)(m,{to:`/en`,replace:!0})})]})})}pe(`/assets/pdf.worker.min-CHFwMXne.mjs`);var g0={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_OTEL_OTLP_ENDPOINT;g0&&s(async()=>{let{initObservabilityWeb:e}=await import(`./web-D1HVvdzi.js`);return{initObservabilityWeb:e}},[]).then(({initObservabilityWeb:e})=>{e({serviceName:`semiont-browser`,otlpEndpoint:g0})});var _0=document.getElementById(`root`);if(!_0)throw Error(`Root element not found`);b.createRoot(_0).render((0,I.jsx)(y.StrictMode,{children:(0,I.jsx)(p,{children:(0,I.jsx)(h0,{})})}));export{_1 as $,Lr as $t,cF as A,Up as At,x1 as B,Fs as Bt,JQ as C,Qp as Ct,KQ as D,Hp as Dt,tY as E,Rp as Et,D1 as F,dc as Ft,SF as G,us as Gt,ZP as H,Ss as Ht,C1 as I,el as It,$P as J,Go as Jt,nF as K,$o as Kt,L1 as L,ic as Lt,K$ as M,_l as Mt,Ew as N,Ic as Nt,qQ as O,Jp as Ot,k1 as P,Qc as Pt,XP as Q,yo as Qt,z1 as R,rc as Rt,GQ as S,am as St,U$ as T,vm as Tt,JP as U,xs as Ut,j1 as V,Cs as Vt,eF as W,fs as Wt,iF as X,To as Xt,Z as Y,Eo as Yt,oF as Z,wo as Zt,n1 as _,hm as _t,I$ as a,Rr as an,tm as at,$Q as b,pm as bt,q$ as c,Et as cn,em as ct,XQ as d,ve as dn,rm as dt,Pr as en,lF as et,TF as f,de as fn,lm as ft,AF as g,cm as gt,eU as h,gm as ht,G$ as i,ur as in,mm as it,tU as j,Yp as jt,Z$ as k,zp as kt,$J as l,ge as ln,dm as lt,J$ as m,Zp as mt,z$ as n,Ir as nn,Em as nt,wQ as o,Gn as on,im as ot,ZQ as p,_m as pt,bF as q,Qo as qt,V$ as r,Fr as rn,um as rt,QQ as s,Yn as sn,Xp as st,R$ as t,Cr as tn,Tm as tt,jq as u,_e as un,nm as ut,i1 as v,$p as vt,nU as w,om as wt,y1 as x,sm as xt,e$ as y,fm as yt,T1 as z,Ls as zt};
142
+ //# sourceMappingURL=index-vecxWX4w.js.map