@vue-skuilder/common-ui 0.1.18 → 0.1.20

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.
@@ -1,2 +1,2 @@
1
- var e=Object.defineProperty,t=(t,n,s)=>((t,n,s)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s)(t,"symbol"!=typeof n?n+"":n,s);import{defineComponent as n,createElementBlock as s,openBlock as r,createCommentVNode as i,Fragment as a,renderList as o,normalizeStyle as l,toDisplayString as c,resolveComponent as d,createBlock as u,withCtx as h,createVNode as p,createTextVNode as g,createElementVNode as m,mergeProps as f,ref as b,computed as y,watch as k,onMounted as w,onBeforeUnmount as v,normalizeClass as x,renderSlot as _,Transition as S,withKeys as C,resolveDynamicComponent as E,onUnmounted as T,markRaw as R,defineAsyncComponent as I,withDirectives as A,vModelText as M,getCurrentInstance as N,h as $,inject as D,withModifiers as L,vShow as O,createSlots as P}from"vue";import B from"moment";import{Status as z,FieldType as U,toCourseElo as j,log as F,displayableDataToViewData as q,emptyTagFilter as V,hasActiveFilter as H}from"@vue-skuilder/common";import{getCardHistoryID as Z,docIsDeleted as K,isReview as G,getStudySource as W,SessionController as Q,getDataLayer as Y,GuestUsername as J}from"@vue-skuilder/db";import{defineStore as X,setActivePinia as ee}from"pinia";import{useRouter as te,useRoute as ne}from"vue-router";import{VueTagsInput as se}from"@vojtechlanka/vue-tags-input";const re=n({name:"HeatMap",props:{activityRecords:{type:Array,default:()=>[]},activityRecordsGetter:{type:Function,default:null},inactiveColor:{type:Object,default:()=>({h:0,s:0,l:.9})},activeColor:{type:Object,default:()=>({h:155,s:1,l:.5})},cellSize:{type:Number,default:12},cellMargin:{type:Number,default:3},enableSeasonalColors:{type:Boolean,default:!0}},data:()=>({isLoading:!1,localActivityRecords:[],heatmapData:{},weeks:[],tooltipData:null,tooltipStyle:{},maxInRange:0}),computed:{width(){return 53*(this.cellSize+this.cellMargin)},height(){return 7*(this.cellSize+this.cellMargin)},effectiveActivityRecords(){const e=Array.isArray(this.localActivityRecords)&&this.localActivityRecords.length>0,t=e?this.localActivityRecords:this.activityRecords||[];return console.log("Using effectiveActivityRecords, count:",t.length,"source:",e?"local":"prop"),t}},watch:{activityRecords:{handler(){this.processRecords(),this.createWeeksData()},immediate:!0}},async created(){if(this.activityRecordsGetter)try{this.isLoading=!0,console.log("Fetching activity records using getter...");let e=await this.activityRecordsGetter();Array.isArray(e)?(this.localActivityRecords=e.filter((e=>{if(!e||!e.timeStamp)return!1;try{const t=B(e.timeStamp);return t.isValid()&&t.year()>2e3&&t.year()<2100}catch(t){return!1}})),console.log(`Received ${e.length} records, ${this.localActivityRecords.length} valid after filtering`),this.processRecords(),this.createWeeksData()):(console.error("Activity records getter did not return an array:",e),this.localActivityRecords=[])}catch(e){console.error("Error fetching activity records:",e),this.localActivityRecords=[]}finally{this.isLoading=!1}else console.log("No activityRecordsGetter provided, using direct activityRecords prop")},methods:{toDateString(e){const t=B(e);return B.months()[t.month()]+" "+t.date()},processRecords(){const e=this.effectiveActivityRecords||[];console.log(`Processing ${e.length} records`);const t={};if(0===e.length)return console.log("No records to process"),void(this.heatmapData=t);const n=/* @__PURE__ */new Set,s={};let r=0,i=0;for(let o=0;o<e.length;o++){const l=e[o];if(l&&"object"==typeof l&&l.timeStamp)try{let e;if("string"==typeof l.timeStamp)e=B(l.timeStamp).format("YYYY-MM-DD");else if("number"==typeof l.timeStamp)e=B(new Date(l.timeStamp)).format("YYYY-MM-DD");else{if("object"!=typeof l.timeStamp){i++;continue}e="function"==typeof l.timeStamp.format?l.timeStamp.format("YYYY-MM-DD"):l.timeStamp instanceof Date?B(l.timeStamp).format("YYYY-MM-DD"):B(String(l.timeStamp)).format("YYYY-MM-DD")}if(B(e,"YYYY-MM-DD",!0).isValid()){t[e]=(t[e]||0)+1,n.add(e);const i=e.substring(0,7);s[i]=(s[i]||0)+1,r++}else i++}catch(a){i++}else i++}console.log(`Processed ${r} valid dates, ${i} invalid dates`),console.log(`Found ${n.size} unique dates`),console.log("Date distribution by month:",s),this.heatmapData=t},createWeeksData(){this.weeks=[],this.maxInRange=0;const e=B(),t=e.clone().subtract(52,"weeks"),n=t.clone().startOf("week");console.log("Creating weeks data from",t.format("YYYY-MM-DD"),"to",e.format("YYYY-MM-DD")),0===Object.keys(this.heatmapData).length&&console.log("No heatmap data available to display");const s=Object.keys(this.heatmapData).slice(0,5);for(console.log("Sample dates in heatmap data:",s);n.isSameOrBefore(e);){const e=[];for(let t=0;t<7;t++){const t=n.format("YYYY-MM-DD"),s={date:t,count:this.heatmapData[t]||0};e.push(s),s.count>this.maxInRange&&(this.maxInRange=s.count),n.add(1,"day")}this.weeks.push(e)}console.log("Weeks data created, maxInRange:",this.maxInRange);let r=0,i=0;Object.values(this.heatmapData).forEach((e=>{r++,i+=e})),console.log(`Activity summary: ${i} activities across ${r} days`)},getColor(e){if(0===this.maxInRange)return this.hslToString(this.inactiveColor);const t=0===e?0:Math.min(2*e/this.maxInRange,1);let n=this.activeColor;if(this.enableSeasonalColors){const e=B();11===e.month()&&e.date()>=5?n=Math.random()>.5?{h:350,s:.8,l:.5}:{h:135,s:.8,l:.4}:9===e.month()&&e.date()>=25&&(n=Math.random()>.5?{h:0,s:0,l:0}:Math.random()>.5?{h:30,s:1,l:.5}:{h:270,s:1,l:.5})}const s=n.h,r=this.interpolate(this.inactiveColor.s,n.s,t),i=this.interpolate(this.inactiveColor.l,n.l,t);return this.hslToString({h:s,s:r,l:i})},interpolate:(e,t,n)=>e+(t-e)*n,hslToString:e=>`hsl(${e.h}, ${100*e.s}%, ${100*e.l}%)`,showTooltip(e,t){this.tooltipData=e,this.tooltipStyle={position:"absolute",left:`${t.pageX+10}px`,top:`${t.pageY+10}px`}},hideTooltip(){this.tooltipData=null}}}),ie=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},ae=["width","height"],oe=["transform"],le=["y","width","height","fill","onMouseover"];const ce=/* @__PURE__ */ie(re,[["render",function(e,t,n,d,u,h){return r(),s("div",null,[(r(),s("svg",{width:e.width,height:e.height},[(r(!0),s(a,null,o(e.weeks,((n,i)=>(r(),s("g",{key:i,transform:`translate(${i*(e.cellSize+e.cellMargin)}, 0)`},[(r(!0),s(a,null,o(n,((n,i)=>(r(),s("rect",{key:n.date,x:0,y:i*(e.cellSize+e.cellMargin),width:e.cellSize,height:e.cellSize,fill:e.getColor(n.count),onMouseover:t=>e.showTooltip(n,t),onMouseout:t[0]||(t[0]=(...t)=>e.hideTooltip&&e.hideTooltip(...t))},null,40,le)))),128))],8,oe)))),128))],8,ae)),e.tooltipData?(r(),s("div",{key:0,class:"tooltip",style:l(e.tooltipStyle)},c(e.tooltipData.count)+" review"+c(1!==e.tooltipData.count?"s":"")+" on "+c(e.toDateString(e.tooltipData.date)),5)):i("",!0)])}],["__scopeId","data-v-ca46239a"]]);function de(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ue,he,pe={exports:{}};const ge=/* @__PURE__ */de((ue||(ue=1,he=pe,function(e,t){if(e){for(var n,s={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},i={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},a={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},o=1;o<20;++o)s[111+o]="f"+o;for(o=0;o<=9;++o)s[o+96]=o.toString();g.prototype.bind=function(e,t,n){var s=this;return e=e instanceof Array?e:[e],s._bindMultiple.call(s,e,t,n),s},g.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},g.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},g.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},g.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(p(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},g.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},g.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);n=null},g.init=function(){var e=g(t);for(var n in e)"_"!==n.charAt(0)&&(g[n]=/* @__PURE__ */function(t){return function(){return e[t].apply(e,arguments)}}(n))},g.init(),e.Mousetrap=g,he.exports&&(he.exports=g)}function l(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function c(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return s[e.which]?s[e.which]:r[e.which]?r[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function u(e,t,r){return r||(r=function(){if(!n)for(var e in n={},s)e>95&&e<112||s.hasOwnProperty(e)&&(n[s[e]]=e);return n}()[e]?"keydown":"keypress"),"keypress"==r&&t.length&&(r="keydown"),r}function h(e,t){var n,s,r,o=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),r=0;r<n.length;++r)s=n[r],a[s]&&(s=a[s]),t&&"keypress"!=t&&i[s]&&(s=i[s],o.push("shift")),d(s)&&o.push(s);return{key:s,modifiers:o,action:t=u(s,o,t)}}function p(e,n){return null!==e&&e!==t&&(e===n||p(e.parentNode,n))}function g(e){var n=this;if(e=e||t,!(n instanceof g))return new g(e);n.target=e,n._callbacks={},n._directMap={};var s,r={},i=!1,a=!1,o=!1;function u(e){e=e||{};var t,n=!1;for(t in r)e[t]?n=!0:r[t]=0;n||(o=!1)}function p(e,t,s,i,a,o){var l,c,u,h,p=[],g=s.type;if(!n._callbacks[e])return[];for("keyup"==g&&d(e)&&(t=[e]),l=0;l<n._callbacks[e].length;++l)if(c=n._callbacks[e][l],(i||!c.seq||r[c.seq]==c.level)&&g==c.action&&("keypress"==g&&!s.metaKey&&!s.ctrlKey||(u=t,h=c.modifiers,u.sort().join(",")===h.sort().join(",")))){var m=!i&&c.combo==a,f=i&&c.seq==i&&c.level==o;(m||f)&&n._callbacks[e].splice(l,1),p.push(c)}return p}function m(e,t,s,r){n.stopCallback(t,t.target||t.srcElement,s,r)||!1===e(t,s)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(t),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(t))}function f(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t=c(e);t&&("keyup"!=e.type||i!==t?n.handleKey(t,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):i=!1)}function b(e,t,n,a){function l(t){return function(){o=t,++r[e],clearTimeout(s),s=setTimeout(u,1e3)}}function d(t){m(n,t,e),"keyup"!==a&&(i=c(t)),setTimeout(u,10)}r[e]=0;for(var p=0;p<t.length;++p){var g=p+1===t.length?d:l(a||h(t[p+1]).action);y(t[p],g,a,e,p)}}function y(e,t,s,r,i){n._directMap[e+":"+s]=t;var a,o=(e=e.replace(/\s+/g," ")).split(" ");o.length>1?b(e,o,t,s):(a=h(e,s),n._callbacks[a.key]=n._callbacks[a.key]||[],p(a.key,a.modifiers,{type:a.action},r,e,i),n._callbacks[a.key][r?"unshift":"push"]({callback:t,modifiers:a.modifiers,action:a.action,seq:r,level:i,combo:e}))}n._handleKey=function(e,t,n){var s,r=p(e,t,n),i={},l=0,c=!1;for(s=0;s<r.length;++s)r[s].seq&&(l=Math.max(l,r[s].level));for(s=0;s<r.length;++s)if(r[s].seq){if(r[s].level!=l)continue;c=!0,i[r[s].seq]=1,m(r[s].callback,n,r[s].combo,r[s].seq)}else c||m(r[s].callback,n,r[s].combo);var h="keypress"==n.type&&a;n.type!=o||d(e)||h||u(i),a=c&&"keydown"==n.type},n._bindMultiple=function(e,t,n){for(var s=0;s<e.length;++s)y(e[s],t,n)},l(e,"keypress",f),l(e,"keydown",f),l(e,"keyup",f)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)),pe.exports));var me;me||(me=1,function(e){if(e){var t={},n=e.prototype.stopCallback;e.prototype.stopCallback=function(e,s,r,i){return!!this.paused||!t[r]&&!t[i]&&n.call(this,e,s,r)},e.prototype.bindGlobal=function(e,n,s){if(this.bind(e,n,s),e instanceof Array)for(var r=0;r<e.length;r++)t[e[r]]=!0;else t[e]=!0},e.init()}}("undefined"!=typeof Mousetrap?Mousetrap:void 0));const fe=class _SkldrMouseTrap{constructor(){t(this,"mouseTrap"),t(this,"hotkeys"),this.mouseTrap=new ge,this.hotkeys=[]}static get commands(){return _SkldrMouseTrap.instance().hotkeys.map((e=>({command:e.command,hotkey:e.hotkey})))}static addBinding(e){const t=Array.isArray(e)?e:[e],n=_SkldrMouseTrap.instance();n.hotkeys=[...n.hotkeys,...t],t.forEach((e=>{ge.bindGlobal(e.hotkey,((t,n)=>{!function(){const e=document.activeElement;return(!(e instanceof HTMLInputElement)||"checkbox"!==e.type&&"radio"!==e.type)&&e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||e.isContentEditable)}()?e.callback(t,n):console.log(`Ignoring hotkey ${e.hotkey} while input element is focused`)}))}))}static removeBinding(e){const t=_SkldrMouseTrap.instance(),n=[...t.hotkeys];Array.isArray(e)&&!e.every((e=>"string"==typeof e||"number"==typeof e))?e.forEach((e=>{t.hotkeys=t.hotkeys.filter((t=>JSON.stringify(t.hotkey)!==JSON.stringify(e))),ge.unbind(e)})):(t.hotkeys=n.filter((t=>JSON.stringify(t.hotkey)!==JSON.stringify(e))),ge.unbind(e))}static reset(){console.warn("SkldrMouseTrap.reset() may affect hotkeys registered by other components. Consider using removeBinding() with specific hotkeys for better component isolation."),ge.reset(),_SkldrMouseTrap.instance().mouseTrap.reset(),_SkldrMouseTrap.instance().hotkeys=[]}static instance(){return _SkldrMouseTrap._instance||(_SkldrMouseTrap._instance=new _SkldrMouseTrap),_SkldrMouseTrap._instance}};t(fe,"_instance");let be=fe;const ye=n({name:"SkMouseTrap",props:{refreshInterval:{type:Number,default:500}},data:()=>({commands:[],display:!1,intervalId:null}),created(){this.intervalId=window.setInterval(this.refreshState,this.refreshInterval)},beforeUnmount(){null!==this.intervalId&&clearInterval(this.intervalId)},methods:{refreshState(){this.commands=be.commands,this.display=this.commands.length>0}}}),ke={class:"text-caption ml-2"};const we=/* @__PURE__ */ie(ye,[["render",function(e,t,n,l,b,y){const k=d("v-icon"),w=d("v-btn"),v=d("v-toolbar-title"),x=d("v-toolbar"),_=d("v-spacer"),S=d("v-list-item"),C=d("v-list"),E=d("v-card"),T=d("v-dialog");return e.display?(r(),u(T,{key:0,"max-width":"500px",transition:"dialog-transition"},{activator:h((({props:e})=>[p(w,f({icon:"",color:"primary"},e),{default:h((()=>[p(k,null,{default:h((()=>t[0]||(t[0]=[g("mdi-keyboard")]))),_:1})])),_:2},1040)])),default:h((()=>[p(E,null,{default:h((()=>[p(x,{color:"secondary",dark:"",dense:""},{default:h((()=>[p(v,{class:"text-subtitle-1"},{default:h((()=>t[1]||(t[1]=[g("Shortcut keys:")]))),_:1})])),_:1}),p(C,{dense:""},{default:h((()=>[(r(!0),s(a,null,o(e.commands,(e=>(r(),u(S,{key:Array.isArray(e.hotkey)?e.hotkey.join(","):e.hotkey,class:"py-1"},{default:h((()=>[p(w,{variant:"outlined",color:"primary",class:"text-white",size:"small"},{default:h((()=>[g(c(Array.isArray(e.hotkey)?e.hotkey[0]:e.hotkey),1)])),_:2},1024),p(_),m("span",ke,c(e.command),1)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1})):i("",!0)}]]);const ve=/* @__PURE__ */ie(n({name:"SkMouseTrapToolTip",props:{hotkey:{type:[String,Array],required:!0},command:{type:String,required:!0},disabled:{type:Boolean,default:!1},position:{type:String,default:"top"},showTooltip:{type:Boolean,default:!0},highlightEffect:{type:String,default:"glow"}},emits:["hotkey-triggered"],setup(e,{emit:t}){const n=b(null),s=b(!1);b(`hotkey-${Math.random().toString(36).substring(2,15)}`);const r=y((()=>{const t=Array.isArray(e.hotkey)?e.hotkey[0]:e.hotkey;return t.includes(" ")?t.toLowerCase().split(" ").map((e=>e.charAt(0)+e.slice(1))).join(", "):t.toLowerCase().split("+").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" + ")}));k((()=>s.value),(t=>{if(!n.value||e.disabled)return;const s=n.value.querySelector('button, a, input[type="button"], [role="button"]');s&&(s.style.transition="all 250ms ease",t&&"none"!==e.highlightEffect?s.style.filter="brightness(1.1)":s.style.filter="")}));const i=e=>{"Control"===e.key&&(s.value=!0)},a=e=>{"Control"===e.key&&(s.value=!1)},o=()=>{if(e.disabled||!n.value)return;let s=n.value.querySelector('button, a, input[type="button"], [role="button"]');if(s||(s=n.value.querySelector("v-list-item, .v-list-item, router-link, .router-link, a, [to]")),s||!n.value.hasAttribute("to")&&"A"!==n.value.tagName&&!n.value.classList.contains("v-list-item")||(s=n.value),!s){const e=n.value.closest("v-list-item, .v-list-item, a, [to]");e&&(s=e)}if(s)if(s.hasAttribute("to")){const n=s.getAttribute("to");if(n&&window.location.pathname!==n){const e=window.$nuxt?.$router||window.$router;e&&"function"==typeof e.push?e.push(n):window.location.pathname=n}t("hotkey-triggered",e.hotkey)}else s.click(),t("hotkey-triggered",e.hotkey);else console.log("No clickable element found for hotkey",e.hotkey),t("hotkey-triggered",e.hotkey)},l=()=>{e.disabled||be.addBinding({hotkey:e.hotkey,command:e.command,callback:o})},c=()=>{e.disabled||be.removeBinding(e.hotkey)};return k((()=>e.disabled),(e=>{e?c():l()})),w((()=>{document.addEventListener("keydown",i),document.addEventListener("keyup",a),l()})),v((()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",a),c()})),{wrapperElement:n,isControlKeyPressed:s,formattedHotkey:r}}}),[["render",function(e,t,n,a,o,l){return r(),s("div",{class:x(["sk-mousetrap-tooltip-wrapper",[e.isControlKeyPressed&&!e.disabled&&"none"!==e.highlightEffect?`sk-mousetrap-highlight-${e.highlightEffect}`:""]]),ref:"wrapperElement"},[_(e.$slots,"default",{},void 0,!0),p(S,{name:"fade"},{default:h((()=>[e.showTooltip&&e.isControlKeyPressed&&!e.disabled?(r(),s("div",{key:0,class:x(["sk-mousetrap-tooltip",{"sk-mt-tooltip-top":"top"===e.position,"sk-mt-tooltip-bottom":"bottom"===e.position,"sk-mt-tooltip-left":"left"===e.position,"sk-mt-tooltip-right":"right"===e.position}])},c(e.formattedHotkey),3)):i("",!0)])),_:1})],2)}],["__scopeId","data-v-5d6fb09c"]]),xe=/* @__PURE__ */(()=>{let e=null;return{setInstance(t){e=t},getInstance:()=>e,alertUser(t){e?e.addSnack(t):console.error("SnackbarService not found")}}})(),{setInstance:_e,alertUser:Se}=xe,Ce=n({name:"SnackbarService",data:()=>({snacks:[],show:[]}),mounted(){_e(this)},methods:{addSnack(e){this.snacks.push(e),this.show.push(!0)},close(){this.show.pop(),this.show.push(!1)},getColor:e=>e.status===z.ok?"success":e.status===z.error?"error":e.status===z.warning?"yellow":void 0}}),Ee={class:"d-flex align-center justify-space-between w-100"};const Te=/* @__PURE__ */ie(Ce,[["render",function(e,t,n,i,l,f){const b=d("v-icon"),y=d("v-btn"),k=d("v-snackbar");return r(),s("div",null,[(r(!0),s(a,null,o(e.snacks,(n=>(r(),u(k,{key:e.snacks.indexOf(n),modelValue:e.show[e.snacks.indexOf(n)],"onUpdate:modelValue":t=>e.show[e.snacks.indexOf(n)]=t,timeout:n.timeout,location:"bottom right",color:e.getColor(n)},{default:h((()=>[m("div",Ee,[m("span",null,c(n.text),1),p(y,{icon:"",variant:"text",onClick:t[0]||(t[0]=t=>e.close())},{default:h((()=>[p(b,null,{default:h((()=>t[1]||(t[1]=[g("mdi-close")]))),_:1})])),_:1})])])),_:2},1032,["modelValue","onUpdate:modelValue","timeout","color"])))),128))])}]]),Re=n({name:"PaginatingToolbar",props:{pages:{type:Array,required:!0},page:{type:Number,required:!0},title:{type:String,required:!1,default:""},subtitle:{type:String,required:!1,default:""}},emits:["first","prev","next","last","set-page"]}),Ie={key:0,class:"ms-2 text-subtitle-2","data-cy":"paginating-toolbar-subtitle"};const Ae=/* @__PURE__ */ie(Re,[["render",function(e,t,n,a,o,l){const f=d("v-toolbar-title"),b=d("v-spacer"),y=d("v-icon"),k=d("v-btn"),w=d("v-select"),v=d("v-toolbar");return r(),u(v,{density:"compact"},{default:h((()=>[p(f,null,{default:h((()=>[m("span",null,c(e.title),1),e.subtitle?(r(),s("span",Ie,c(e.subtitle),1)):i("",!0)])),_:1}),p(b),p(k,{variant:"text",icon:"",color:"secondary",disabled:1==e.page,onClick:t[0]||(t[0]=t=>e.$emit("first"))},{default:h((()=>[p(y,null,{default:h((()=>t[5]||(t[5]=[g("mdi-page-first")]))),_:1})])),_:1},8,["disabled"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:1==e.page,onClick:t[1]||(t[1]=t=>e.$emit("prev"))},{default:h((()=>[p(y,null,{default:h((()=>t[6]||(t[6]=[g("mdi-chevron-left")]))),_:1})])),_:1},8,["disabled"]),p(w,{"model-value":e.page,items:e.pages,class:"pageSelect",density:"compact","hide-details":"","return-object":!1,variant:"outlined","onUpdate:modelValue":t[2]||(t[2]=t=>e.$emit("set-page",t))},{selection:h((({item:e})=>[g(c(e.value),1)])),_:1},8,["model-value","items"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:e.page==e.pages.length,onClick:t[3]||(t[3]=t=>e.$emit("next"))},{default:h((()=>[p(y,null,{default:h((()=>t[7]||(t[7]=[g("mdi-chevron-right")]))),_:1})])),_:1},8,["disabled"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:e.page==e.pages.length,onClick:t[4]||(t[4]=t=>e.$emit("last"))},{default:h((()=>[p(y,null,{default:h((()=>t[8]||(t[8]=[g("mdi-page-last")]))),_:1})])),_:1},8,["disabled"])])),_:1})}],["__scopeId","data-v-a75fea7e"]]),Me=n({name:"CardSearch",emits:{search:e=>"string"==typeof e},data:()=>({query:""}),methods:{search(){this.$emit("search",this.query)}}}),Ne={class:"card-search"};const $e=/* @__PURE__ */ie(Me,[["render",function(e,t,n,i,a,o){const l=d("v-text-field");return r(),s("div",Ne,[p(l,{modelValue:e.query,"onUpdate:modelValue":t[0]||(t[0]=t=>e.query=t),label:"Search for cards...","append-icon":"mdi-magnify","onClick:append":e.search,onKeydown:C(e.search,["enter"])},null,8,["modelValue","onClick:append","onKeydown"])])}]]),De=n({name:"CardSearchResults",emits:{"card-selected":e=>"string"==typeof e.cardId&&"string"==typeof e.courseId},props:{query:{type:String,required:!0},dataLayer:{type:Object,required:!0},courseFilter:{type:String,default:null}},data:()=>({cards:[],loading:!1,error:null,selectedCardId:null}),watch:{query:{immediate:!0,handler(e){e&&this.fetchResults(e)}}},methods:{async fetchResults(e){this.loading=!0,this.error=null;try{let t=[];if(this.courseFilter)t=[this.courseFilter],console.log(`Filtering search to course: ${this.courseFilter}`);else{const{CourseLookup:e}=await import("@vue-skuilder/db");t=(await e.allCourseWare()).map((e=>e._id)).filter(Boolean),console.log(`Searching across all ${t.length} courses`)}const n=[];for(const s of t){const t=this.dataLayer.getCourseDB(s),r=await t.searchCards(e);for(const e of r)n.push({...e,courseId:s})}this.cards=n,console.log(`Search completed: found ${n.length} cards across ${t.length} courses`)}catch(t){this.error="Error fetching search results.",console.error("Search error:",t)}finally{this.loading=!1}},selectCard(e){this.selectedCardId=e._id,this.$emit("card-selected",{cardId:e._id,courseId:e.courseId})}}}),Le={class:"card-search-results"},Oe={key:0},Pe={key:1},Be={key:2};const ze=/* @__PURE__ */ie(De,[["render",function(e,t,n,i,l,m){const f=d("v-list-item-title"),b=d("v-list-item-subtitle"),y=d("v-list-item"),k=d("v-list");return r(),s("div",Le,[e.loading?(r(),s("div",Oe,"Loading...")):e.error?(r(),s("div",Pe,c(e.error),1)):(r(),s("div",Be,[p(k,null,{default:h((()=>[(r(!0),s(a,null,o(e.cards,(t=>(r(),u(y,{key:t._id,onClick:n=>e.selectCard(t),class:x([{"selected-card":t._id===e.selectedCardId},"cursor-pointer"])},{default:h((()=>[p(f,null,{default:h((()=>[g(c(t._id),1)])),_:2},1024),p(b,null,{default:h((()=>[g("Course: "+c(t.courseId),1)])),_:2},1024)])),_:2},1032,["onClick","class"])))),128))])),_:1})]))])}],["__scopeId","data-v-285e13bd"]]),Ue=n({name:"CardHistoryViewer",props:{cardId:{type:String,required:!0},courseId:{type:String,required:!0},userId:{type:String,required:!0},userDB:{type:Object,required:!0}},data:()=>({history:[],cardHistory:null,bestIntervalHumanized:"",loading:!1,error:null,headers:[{title:"Timestamp",key:"formattedTimeStamp"},{title:"Interval",key:"userFriendlyInterval"},{title:"Time Spent (s)",key:"timeSpentSeconds"},{title:"Correct?",key:"isCorrect"},{title:"Performance",key:"performance"},{title:"Prior Attempts",key:"priorAttemps"},{title:"User Answer",key:"userAnswer"}]}),watch:{cardId:{immediate:!0,handler(e){e&&this.userDB&&this.fetchHistory()}},userDB:{handler(e){e&&this.cardId&&this.fetchHistory()}}},methods:{async fetchHistory(){this.loading=!0,this.error=null;try{const e=Z(this.courseId,this.cardId),t=await this.userDB.get(e);this.cardHistory=t,this.bestIntervalHumanized=B.duration(t.bestInterval,"seconds").humanize();const n=[...t.records].sort(((e,t)=>B(e.timeStamp).valueOf()-B(t.timeStamp).valueOf()));this.history=n.map(((e,t)=>{const s=B(e.timeStamp),r={...e,formattedTimeStamp:s.format("YYYY-MM-DD HH:mm:ss"),timeSpentSeconds:Math.round(e.timeSpent/1e3),isCorrect:e.isCorrect,performance:e.performance,priorAttemps:e.priorAttemps,userAnswer:e.userAnswer};if(t>0){const e=B(n[t-1].timeStamp),i=s.diff(e,"seconds",!0);r.intervalFromPrevious=Math.round(100*i)/100,r.userFriendlyInterval=`${r.intervalFromPrevious} sec (${B.duration(i,"seconds").humanize()})`}return r}))}catch(e){this.error="Error fetching card history.",console.error(e)}finally{this.loading=!1}}}}),je={class:"card-history-viewer"},Fe={key:0},qe={key:1},Ve={key:2,class:"error-message"},He={key:3};const Ze=/* @__PURE__ */ie(Ue,[["render",function(e,t,n,a,o,l){const u=d("v-card-title"),m=d("v-list-item-title"),f=d("v-list-item-subtitle"),b=d("v-list-item-content"),y=d("v-list-item"),k=d("v-card"),w=d("v-data-table");return r(),s("div",je,[e.userId?(r(),s("h3",Fe,"Card History for User: "+c(e.userId),1)):i("",!0),e.loading?(r(),s("div",qe,"Loading...")):e.error?(r(),s("div",Ve,c(e.error),1)):e.cardHistory?(r(),s("div",He,[p(k,{class:"mb-4"},{default:h((()=>[p(u,null,{default:h((()=>t[0]||(t[0]=[g("Summary")]))),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Best Interval: "+c(e.cardHistory.bestInterval)+" seconds ("+c(e.bestIntervalHumanized)+")",1)])),_:1}),p(f,null,{default:h((()=>t[1]||(t[1]=[g("The to-date largest interval between successful card reviews.")]))),_:1})])),_:1})])),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Lapses: "+c(e.cardHistory.lapses),1)])),_:1}),p(f,null,{default:h((()=>t[2]||(t[2]=[g("The number of times that a card has been failed in review.")]))),_:1})])),_:1})])),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Streak: "+c(e.cardHistory.streak),1)])),_:1}),p(f,null,{default:h((()=>t[3]||(t[3]=[g("The number of consecutive successful impressions on this card.")]))),_:1})])),_:1})])),_:1})])),_:1}),p(w,{headers:e.headers,items:e.history,class:"elevation-1"},null,8,["headers","items"])])):i("",!0)])}],["__scopeId","data-v-a4bdfdfb"]]);function Ke(e,t,n){const s=b(B.utc()),r=b([]),i={log:(e,...t)=>console.log(`[${n}]: `,e,...t),error:(e,...t)=>console.error(`[${n}]: `,e,...t),warn:(e,...t)=>console.warn(`[${n}]: `,e,...t)},a=y((()=>Math.abs(B.utc().diff(s.value,"milliseconds"))));return{startTime:s,hotKeys:r,timeSpent:a,logger:i,getURL:(t,n=0)=>{try{if(e.data[n]?.[t])return URL.createObjectURL(e.data[n][t])}catch(s){i.error("Error creating URL for item:",t,s)}return""},emitResponse:e=>{t("emitResponse",e)}}}function Ge(e){const t=b(0),n=b(0),s=b([]),r=b(3),i=b(2),a=b();return{priorSessionViews:t,priorAttempts:n,priorAnswers:s,maxAttemptsPerView:r,maxSessionViews:i,question:a,submitAnswer:(t,r)=>{if(e.logger.log("submitAnswer called..."),!a.value)throw new Error("Question not initialized");s.value.push([t,r??""]);const i=a.value.evaluate(t,e.timeSpent.value);e.logger.log(`evaluation of answer ${t}:`,i);const o={...i,priorAttemps:n.value,courseID:"",cardID:"",timeSpent:e.timeSpent.value,timeStamp:e.startTime.value,userAnswer:t};return i.isCorrect||n.value++,e.emitResponse(o),o}}}function We(e){return"object"==typeof e&&null!==e&&"submitAnswer"in e&&"priorAttempts"in e}function Qe(e){return void 0!==e.__isFragment}class Displayable{constructor(e){if(0===e.length)throw new Error("\nDisplayable Constructor was called with no view Data.\n ");!function(e,t){for(let n=0;n<e.length;n++)e[n].fields.forEach(((e,s)=>{console.log(`[Displayable] shape[${n}].field[${s}]:\n ${JSON.stringify(e)}`),void 0===t[n][e.name]&&e.type!==U.MEDIA_UPLOADS&&console.warn("[Displayable] missing data")}))}(this.dataShapes(),e)}}t(Displayable,"dataShapes"),t(Displayable,"views"),t(Displayable,"seedData"),t(Displayable,"acceptsUserData",!0);class Question extends Displayable{displayedSkill(e,t){console.warn("Question is running the reference implementation of displayedSkill.\n Consider overriding!");const n=5e3,s=Math.min(t,5e4),r=s/n,i=s>n?Math.pow(.8,r):1;let a=this.isCorrect(e)?1:0;return a*=i,Math.min(a,1)}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}}const Ye=()=>{let e="fallback (empty string)",t="";if(!t&&"undefined"!=typeof window&&window.__SKUILDER_CONFIG__?.apiBase){const n=window.__SKUILDER_CONFIG__.apiBase.replace(/\/$/,"");t=n.startsWith("/")?n:`/${n}`,e="window.__SKUILDER_CONFIG__.apiBase"}return console.log("[authAPI] getApiBase() called"),console.log("[authAPI] source:",e),console.log("[authAPI] result:",t),t};async function Je(e,t,n){try{const s={username:e,email:t};n&&(s.origin=n);const r=await fetch(`${Ye()}/auth/send-verification`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(s)});if(!r.ok){const e=await r.text();return console.error("Send verification email error:",e),{ok:!1,error:`HTTP ${r.status}: ${r.statusText}`}}return await r.json()}catch(s){return console.error("Send verification email fetch error:",s),{ok:!1,error:s instanceof Error?s.message:"Network error"}}}async function Xe(e){try{const t=await fetch(`${Ye()}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:e})});return t.ok?await t.json():{ok:!1,error:`HTTP ${t.status}: ${t.statusText}`}}catch(t){return{ok:!1,error:t instanceof Error?t.message:"Network error"}}}async function et(){try{const e=await fetch(`${Ye()}/auth/status`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});return e.ok?await e.json():{ok:!1,error:`HTTP ${e.status}: ${e.statusText}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Network error"}}}async function tt(e,t){try{const n={email:e};t&&(n.origin=t);const s=await fetch(`${Ye()}/auth/request-reset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)});return s.ok?await s.json():{ok:!1,error:`HTTP ${s.status}: ${s.statusText}`}}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Network error"}}}async function nt(e,t){try{const n=await fetch(`${Ye()}/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:e,newPassword:t})});return n.ok?await n.json():{ok:!1,error:`HTTP ${n.status}: ${n.statusText}`}}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Network error"}}}function st(e){const t=b({}),n=b(!1),s=b(null),r=y((()=>{const n=t.value[e];if(!n)return{isActive:!1,isPaid:!1,daysRemaining:null,expiresDate:null};if("paid"===n.status)return{isActive:!0,isPaid:!0,daysRemaining:null,expiresDate:null};const s=n.expires;if(!s)return{isActive:!0,isPaid:!1,daysRemaining:null,expiresDate:null};const r=new Date(s),i=/* @__PURE__ */new Date,a=Math.ceil((r.getTime()-i.getTime())/864e5);return{isActive:a>0,isPaid:!1,daysRemaining:Math.max(0,a),expiresDate:s}})),i=y((()=>r.value.isPaid));return{entitlements:t,trialStatus:r,hasPremiumAccess:i,loading:n,error:s,fetchEntitlements:async function(){n.value=!0,s.value=null;try{const e=await et();e.ok?t.value=e.entitlements||{}:(s.value=e.error||"Failed to fetch entitlements",console.error("[useEntitlements] Error:",s.value))}catch(e){s.value=e instanceof Error?e.message:"Unknown error",console.error("[useEntitlements] Exception:",e)}finally{n.value=!1}}}}const rt=/* @__PURE__ */ie(n({name:"StudySessionTimer",props:{timeRemaining:{type:Number,required:!0},sessionTimeLimit:{type:Number,required:!0,default:5}},emits:["add-time"],setup:(e,{emit:t})=>({hovered:b(!1),formattedTimeRemaining:y((()=>{let t="";const n=e.timeRemaining;n>60&&(t=Math.floor(n/60).toString()+":");const s=n%60;return t+=s>=10?s:"0"+s,n<=60&&(t+=" seconds"),t+=" left!",t})),percentageRemaining:y((()=>e.timeRemaining>60?e.timeRemaining/(60*e.sessionTimeLimit)*100:e.timeRemaining/60*100)),timerColor:y((()=>e.timeRemaining>60?"primary":"orange darken-3")),addSessionTime:()=>{t("add-time")}})}),[["render",function(e,t,n,s,a,o){const l=d("v-icon"),b=d("v-btn"),y=d("v-progress-circular"),k=d("v-tooltip");return r(),u(k,{location:"right","open-delay":0,"close-delay":200,color:"secondary",class:"text-subtitle-1"},{activator:h((({props:n})=>[m("div",f({class:"timer-container"},n,{onMouseenter:t[0]||(t[0]=t=>e.hovered=!0),onMouseleave:t[1]||(t[1]=t=>e.hovered=!1)}),[p(y,{alt:"Time remaining in study session",size:"64",width:"8",rotate:"0",color:e.timerColor,"model-value":e.percentageRemaining},{default:h((()=>[e.timeRemaining>0&&e.hovered?(r(),u(b,{key:0,icon:"",color:"transparent",location:"bottom left",onClick:e.addSessionTime},{default:h((()=>[p(l,{size:"large"},{default:h((()=>t[2]||(t[2]=[g("mdi-plus")]))),_:1})])),_:1},8,["onClick"])):i("",!0)])),_:1},8,["color","model-value"])],16)])),default:h((()=>[g(" "+c(e.formattedTimeRemaining),1)])),_:1})}],["__scopeId","data-v-5960940a"]]);const it=/* @__PURE__ */ie(n({name:"CardViewer",ref:{},props:{sessionOrder:{type:Number,required:!1,default:0},card_id:{type:String,required:!0,default:""},course_id:{type:String,required:!0,default:""},view:{type:[Function,Object],required:!0},data:{type:Array,required:!0},user_elo:{type:Object,default:()=>({global:{score:1e3,count:0},tags:{},misc:{}})},card_elo:{type:Number,default:1e3}},emits:["emitResponse"],methods:{processResponse(e){console.log(`\n Card was displayed at ${e.timeStamp}\n User spent ${e.timeSpent} milliseconds with the card.\n `),this.$emit("emitResponse",e)}}}),[["render",function(e,t,n,s,i,a){const o=d("v-card");return r(),u(o,{elevation:"12"},{default:h((()=>[(r(),u(E(e.view),{ref:"activeView",key:e.course_id+"-"+e.card_id+"-"+e.sessionOrder,data:e.data,"modify-difficulty":e.user_elo.global.score-e.card_elo,class:"cardView ma-2 pa-2",onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,40,["data","modify-difficulty"]))])),_:1})}],["__scopeId","data-v-318fb94f"]]),at=n({name:"SessionControllerDebug",props:{sessionController:{type:Object,required:!0}},setup(e){const t=b(0);let n=null;w((()=>{n=setInterval((()=>{t.value++}),500)})),T((()=>{n&&clearInterval(n)}));return{debugInfo:y((()=>(t.value,e.sessionController?e.sessionController.getDebugInfo():{reviewQueue:{length:0,dequeueCount:0,items:[]},newQueue:{length:0,dequeueCount:0,items:[]},failedQueue:{length:0,dequeueCount:0,items:[]},hydratedCache:{count:0,failedCacheSize:0,items:[]}})))}}}),ot={class:"debug-section"},lt={class:"debug-header"},ct={class:"debug-stats"},dt={class:"text-caption"},ut={class:"text-caption ml-2"},ht={key:0,class:"debug-items"},pt={class:"text-caption"},gt={class:"text-caption text-grey ml-1"},mt={key:0,class:"text-caption text-grey"},ft={key:1,class:"text-caption text-grey"},bt={class:"debug-section"},yt={class:"debug-header"},kt={class:"debug-stats"},wt={class:"text-caption"},vt={class:"text-caption ml-2"},xt={key:0,class:"debug-items"},_t={class:"text-caption"},St={class:"text-caption text-grey ml-1"},Ct={key:0,class:"text-caption text-grey"},Et={key:1,class:"text-caption text-grey"},Tt={class:"debug-section"},Rt={class:"debug-header"},It={class:"debug-stats"},At={class:"text-caption"},Mt={class:"text-caption ml-2"},Nt={key:0,class:"debug-items"},$t={class:"text-caption"},Dt={class:"text-caption text-grey ml-1"},Lt={key:0,class:"text-caption text-grey"},Ot={key:1,class:"text-caption text-grey"},Pt={class:"debug-section"},Bt={class:"debug-header"},zt={class:"debug-stats"},Ut={class:"text-caption"},jt={class:"text-caption ml-2"},Ft={key:0,class:"debug-items"},qt={class:"text-caption"},Vt={key:0,class:"text-caption text-grey"},Ht={key:1,class:"text-caption text-grey"};const Zt=/* @__PURE__ */ie(at,[["render",function(e,t,n,l,f,b){const y=d("v-spacer"),k=d("v-icon"),w=d("v-card-title"),v=d("v-col"),x=d("v-row"),_=d("v-divider"),S=d("v-card-text"),C=d("v-card");return e.sessionController?(r(),u(C,{key:0,class:"session-debug ma-2",elevation:"2"},{default:h((()=>[p(w,{class:"text-caption bg-grey-darken-3"},{default:h((()=>[t[1]||(t[1]=g(" Session Controller Debug ")),p(y),p(k,{size:"small"},{default:h((()=>t[0]||(t[0]=[g("mdi-bug")]))),_:1})])),_:1}),p(S,{class:"pa-2"},{default:h((()=>[p(x,{dense:""},{default:h((()=>[p(v,{cols:"12",md:"4"},{default:h((()=>[m("div",ot,[m("div",lt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[2]||(t[2]=[g("mdi-calendar-check")]))),_:1}),t[3]||(t[3]=m("strong",null,"Review Queue",-1))]),m("div",ct,[m("span",dt,"Length: "+c(e.debugInfo.reviewQueue.length),1),m("span",ut,"Dequeued: "+c(e.debugInfo.reviewQueue.dequeueCount),1)]),e.debugInfo.reviewQueue.items.length>0?(r(),s("div",ht,[(r(!0),s(a,null,o(e.debugInfo.reviewQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",pt,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",gt,"("+c(e.status)+")",1)])))),128)),e.debugInfo.reviewQueue.items.length>5?(r(),s("div",mt," ... +"+c(e.debugInfo.reviewQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",ft," (empty) "))])])),_:1}),p(v,{cols:"12",md:"4"},{default:h((()=>[m("div",bt,[m("div",yt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[4]||(t[4]=[g("mdi-file-document-plus")]))),_:1}),t[5]||(t[5]=m("strong",null,"New Cards Queue",-1))]),m("div",kt,[m("span",wt,"Length: "+c(e.debugInfo.newQueue.length),1),m("span",vt,"Dequeued: "+c(e.debugInfo.newQueue.dequeueCount),1)]),e.debugInfo.newQueue.items.length>0?(r(),s("div",xt,[(r(!0),s(a,null,o(e.debugInfo.newQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",_t,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",St,"("+c(e.status)+")",1)])))),128)),e.debugInfo.newQueue.items.length>5?(r(),s("div",Ct," ... +"+c(e.debugInfo.newQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",Et," (empty) "))])])),_:1}),p(v,{cols:"12",md:"4"},{default:h((()=>[m("div",Tt,[m("div",Rt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[6]||(t[6]=[g("mdi-alert-circle")]))),_:1}),t[7]||(t[7]=m("strong",null,"Failed Cards Queue",-1))]),m("div",It,[m("span",At,"Length: "+c(e.debugInfo.failedQueue.length),1),m("span",Mt,"Dequeued: "+c(e.debugInfo.failedQueue.dequeueCount),1)]),e.debugInfo.failedQueue.items.length>0?(r(),s("div",Nt,[(r(!0),s(a,null,o(e.debugInfo.failedQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",$t,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",Dt,"("+c(e.status)+")",1)])))),128)),e.debugInfo.failedQueue.items.length>5?(r(),s("div",Lt," ... +"+c(e.debugInfo.failedQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",Ot," (empty) "))])])),_:1})])),_:1}),p(x,{dense:""},{default:h((()=>[p(v,{cols:"12"},{default:h((()=>[p(_,{class:"my-2"}),m("div",Pt,[m("div",Bt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[8]||(t[8]=[g("mdi-database")]))),_:1}),t[9]||(t[9]=m("strong",null,"Hydrated Cards Cache",-1))]),m("div",zt,[m("span",Ut,"Cached: "+c(e.debugInfo.hydratedCache.count),1),m("span",jt,"Failed Cache: "+c(e.debugInfo.hydratedCache.failedCacheSize),1)]),e.debugInfo.hydratedCache.items.length>0?(r(),s("div",Ft,[(r(!0),s(a,null,o(e.debugInfo.hydratedCache.items.slice(0,8),((e,t)=>(r(),s("div",{key:t,class:"debug-item d-inline-block mr-3"},[m("span",qt,c(e.courseID)+"::"+c(e.cardID),1)])))),128)),e.debugInfo.hydratedCache.items.length>8?(r(),s("div",Vt," ... +"+c(e.debugInfo.hydratedCache.items.length-8)+" more ",1)):i("",!0)])):(r(),s("div",Ht," (empty) "))])])),_:1})])),_:1})])),_:1})])),_:1})):i("",!0)}],["__scopeId","data-v-1a6ac7a1"]]);var Kt={};!function e(t,n,s,r){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),a="function"==typeof Path2D&&"function"==typeof DOMMatrix;function o(){}function l(e){var s=n.exports.Promise,r=void 0!==s?s:t.Promise;return"function"==typeof r?new r(e):(e(o,o),null)}var c,d,u,h,p,g,m=/* @__PURE__ */function(e,t){return{transform:function(n){if(e)return n;if(t.has(n))return t.get(n);var s=new OffscreenCanvas(n.width,n.height);return s.getContext("2d").drawImage(n,0,0),t.set(n,s),s},clear:function(){t.clear()}}}(function(){if(!t.OffscreenCanvas)return!1;var e=new OffscreenCanvas(1,1),n=e.getContext("2d");n.fillRect(0,0,1,1);var s=e.transferToImageBitmap();try{n.createPattern(s,"no-repeat")}catch(r){return!1}return!0}(),/* @__PURE__ */new Map),f=(u=Math.floor(1e3/60),h={},p=0,"function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame?(c=function(e){var t=Math.random();return h[t]=requestAnimationFrame((function n(s){p===s||p+u-1<s?(p=s,delete h[t],e()):h[t]=requestAnimationFrame(n)})),t},d=function(e){h[e]&&cancelAnimationFrame(h[e])}):(c=function(e){return setTimeout(e,u)},d=function(e){return clearTimeout(e)}),{frame:c,cancel:d}),b=/* @__PURE__ */function(){var t,n,r={};return function(){if(t)return t;if(!s&&i){var a=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join("\n");try{t=new Worker(URL.createObjectURL(new Blob([a])))}catch(o){return void 0!==typeof console&&"function"==typeof console.warn&&console.warn("🎊 Could not load worker",o),null}!function(e){function t(t,n){e.postMessage({options:t||{},callback:n})}e.init=function(t){var n=t.transferControlToOffscreen();e.postMessage({canvas:n},[n])},e.fire=function(s,i,a){if(n)return t(s,null),n;var o=Math.random().toString(36).slice(2);return n=l((function(i){function l(t){t.data.callback===o&&(delete r[o],e.removeEventListener("message",l),n=null,m.clear(),a(),i())}e.addEventListener("message",l),t(s,o),r[o]=l.bind(null,{data:{callback:o}})}))},e.reset=function(){for(var t in e.postMessage({reset:!0}),r)r[t](),delete r[t]}}(t)}return t}}(),y={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function k(e,t,n){return function(e,t){return t?t(e):e}(e&&null!=e[t]?e[t]:y[t],n)}function w(e){return e<0?0:Math.floor(e)}function v(e){return parseInt(e,16)}function x(e){return e.map(_)}function _(e){var t=String(e).replace(/[^0-9a-f]/gi,"");return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:v(t.substring(0,2)),g:v(t.substring(2,4)),b:v(t.substring(4,6))}}function S(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function C(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function E(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,s=t.x+t.random*t.tiltCos,r=t.y+t.random*t.tiltSin,i=t.wobbleX+t.random*t.tiltCos,o=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+(1-n)+")",e.beginPath(),a&&"path"===t.shape.type&&"string"==typeof t.shape.path&&Array.isArray(t.shape.matrix))e.fill(function(e,t,n,s,r,i,a){var o=new Path2D(e),l=new Path2D;l.addPath(o,new DOMMatrix(t));var c=new Path2D;return c.addPath(l,new DOMMatrix([Math.cos(a)*r,Math.sin(a)*r,-Math.sin(a)*i,Math.cos(a)*i,n,s])),c}(t.shape.path,t.shape.matrix,t.x,t.y,.1*Math.abs(i-s),.1*Math.abs(o-r),Math.PI/10*t.wobble));else if("bitmap"===t.shape.type){var l=Math.PI/10*t.wobble,c=.1*Math.abs(i-s),d=.1*Math.abs(o-r),u=t.shape.bitmap.width*t.scalar,h=t.shape.bitmap.height*t.scalar,p=new DOMMatrix([Math.cos(l)*c,Math.sin(l)*c,-Math.sin(l)*d,Math.cos(l)*d,t.x,t.y]);p.multiplySelf(new DOMMatrix(t.shape.matrix));var g=e.createPattern(m.transform(t.shape.bitmap),"no-repeat");g.setTransform(p),e.globalAlpha=1-n,e.fillStyle=g,e.fillRect(t.x-u/2,t.y-h/2,u,h),e.globalAlpha=1}else if("circle"===t.shape)e.ellipse?e.ellipse(t.x,t.y,Math.abs(i-s)*t.ovalScalar,Math.abs(o-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):function(e,t,n,s,r,i,a,o,l){e.save(),e.translate(t,n),e.rotate(i),e.scale(s,r),e.arc(0,0,1,a,o,l),e.restore()}(e,t.x,t.y,Math.abs(i-s)*t.ovalScalar,Math.abs(o-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if("star"===t.shape)for(var f=Math.PI/2*3,b=4*t.scalar,y=8*t.scalar,k=t.x,w=t.y,v=5,x=Math.PI/v;v--;)k=t.x+Math.cos(f)*y,w=t.y+Math.sin(f)*y,e.lineTo(k,w),f+=x,k=t.x+Math.cos(f)*b,w=t.y+Math.sin(f)*b,e.lineTo(k,w),f+=x;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(r)),e.lineTo(Math.floor(i),Math.floor(o)),e.lineTo(Math.floor(s),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function T(e,n){var a,o=!e,c=!!k(n||{},"resize"),d=!1,u=k(n,"disableForReducedMotion",Boolean),h=i&&!!k(n||{},"useWorker")?b():null,p=o?S:C,g=!(!e||!h)&&!!e.__confetti_initialized,y="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion)").matches;function v(t,n,i){for(var o,c,d,u,h,g=k(t,"particleCount",w),b=k(t,"angle",Number),y=k(t,"spread",Number),v=k(t,"startVelocity",Number),_=k(t,"decay",Number),S=k(t,"gravity",Number),C=k(t,"drift",Number),T=k(t,"colors",x),R=k(t,"ticks",Number),I=k(t,"shapes"),A=k(t,"scalar"),M=!!k(t,"flat"),N=function(e){var t=k(e,"origin",Object);return t.x=k(t,"x",Number),t.y=k(t,"y",Number),t}(t),$=g,D=[],L=e.width*N.x,O=e.height*N.y;$--;)D.push((o={x:L,y:O,angle:b,spread:y,startVelocity:v,color:T[$%T.length],shape:I[(u=0,h=I.length,Math.floor(Math.random()*(h-u))+u)],ticks:R,decay:_,gravity:S,drift:C,scalar:A,flat:M},c=void 0,d=void 0,c=o.angle*(Math.PI/180),d=o.spread*(Math.PI/180),{x:o.x,y:o.y,wobble:10*Math.random(),wobbleSpeed:Math.min(.11,.1*Math.random()+.05),velocity:.5*o.startVelocity+Math.random()*o.startVelocity,angle2D:-c+(.5*d-Math.random()*d),tiltAngle:(.5*Math.random()+.25)*Math.PI,color:o.color,shape:o.shape,tick:0,totalTicks:o.ticks,decay:o.decay,drift:o.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:3*o.gravity,ovalScalar:.6,scalar:o.scalar,flat:o.flat}));return a?a.addFettis(D):(a=function(e,t,n,i,a){var o,c,d=t.slice(),u=e.getContext("2d"),h=l((function(t){function l(){o=c=null,u.clearRect(0,0,i.width,i.height),m.clear(),a(),t()}o=f.frame((function t(){!s||i.width===r.width&&i.height===r.height||(i.width=e.width=r.width,i.height=e.height=r.height),i.width||i.height||(n(e),i.width=e.width,i.height=e.height),u.clearRect(0,0,i.width,i.height),(d=d.filter((function(e){return E(u,e)}))).length?o=f.frame(t):l()})),c=l}));return{addFettis:function(e){return d=d.concat(e),h},canvas:e,promise:h,reset:function(){o&&f.cancel(o),c&&c()}}}(e,D,p,n,i),a.promise)}function _(n){var s=u||k(n,"disableForReducedMotion",Boolean),r=k(n,"zIndex",Number);if(s&&y)return l((function(e){e()}));o&&a?e=a.canvas:o&&!e&&(e=function(e){var t=document.createElement("canvas");return t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.pointerEvents="none",t.style.zIndex=e,t}(r),document.body.appendChild(e)),c&&!g&&p(e);var i={width:e.width,height:e.height};function m(){if(h){var t={getBoundingClientRect:function(){if(!o)return e.getBoundingClientRect()}};return p(t),void h.postMessage({resize:{width:t.width,height:t.height}})}i.width=i.height=null}function f(){a=null,c&&(d=!1,t.removeEventListener("resize",m)),o&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,g=!1)}return h&&!g&&h.init(e),g=!0,h&&(e.__confetti_initialized=!0),c&&!d&&(d=!0,t.addEventListener("resize",m,!1)),h?h.fire(n,i,f):v(n,i,f)}return _.reset=function(){h&&h.reset(),a&&a.reset()},_}function R(){return g||(g=T(null,{useWorker:!0,resize:!0})),g}n.exports=function(){return R().apply(this,arguments)},n.exports.reset=function(){R().reset()},n.exports.create=T,n.exports.shapeFromPath=function(e){if(!a)throw new Error("path confetti are not supported in this browser");var t,n;"string"==typeof e?t=e:(t=e.path,n=e.matrix);var s=new Path2D(t),r=document.createElement("canvas").getContext("2d");if(!n){for(var i,o,l=1e3,c=l,d=l,u=0,h=0,p=0;p<l;p+=2)for(var g=0;g<l;g+=2)r.isPointInPath(s,p,g,"nonzero")&&(c=Math.min(c,p),d=Math.min(d,g),u=Math.max(u,p),h=Math.max(h,g));i=u-c,o=h-d;var m=Math.min(10/i,10/o);n=[m,0,0,m,-Math.round(i/2+c)*m,-Math.round(o/2+d)*m]}return{type:"path",path:t,matrix:n}},n.exports.shapeFromText=function(e){var t,n=1,s="#000000",r='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';"string"==typeof e?t=e:(t=e.text,n="scalar"in e?e.scalar:n,r="fontFamily"in e?e.fontFamily:r,s="color"in e?e.color:s);var i=10*n,a=i+"px "+r,o=new OffscreenCanvas(i,i),l=o.getContext("2d");l.font=a;var c=l.measureText(t),d=Math.ceil(c.actualBoundingBoxRight+c.actualBoundingBoxLeft),u=Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent),h=c.actualBoundingBoxLeft+2,p=c.actualBoundingBoxAscent+2;d+=4,u+=4,(l=(o=new OffscreenCanvas(d,u)).getContext("2d")).font=a,l.fillStyle=s,l.fillText(t,h,p);var g=1/n;return{type:"bitmap",bitmap:o.transferToImageBitmap(),matrix:[g,0,0,g,-d*g/2,-u*g/2]}}}(function(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:this||{}}(),Kt,!1);const Gt=Kt.exports;Kt.exports.create;const Wt=n({name:"StudySession",ref:{},components:{CardViewer:it,StudySessionTimer:rt,SkMouseTrap:we,HeatMap:ce,SessionControllerDebug:Zt},props:{sessionTimeLimit:{type:Number,required:!0},contentSources:{type:Array,required:!0},user:{type:Object,required:!0},dataLayer:{type:Object,required:!0},sessionConfig:{type:Object,default:()=>({likesConfetti:!1})},getViewComponent:{type:Function,required:!0}},emits:["session-finished","session-started","card-loaded","card-response","time-changed","session-prepared","session-error"],data:()=>({cardID:"",view:null,data:[],courseID:"",card_elo:1e3,courseNames:{},cardCount:1,sessionController:null,sessionPrepared:!1,sessionFinished:!1,sessionRecord:[],percentageRemaining:100,timerIsActive:!0,loading:!1,userCourseRegDoc:null,sessionContentSources:[],timeRemaining:300,intervalHandler:null,cardType:"",debugMode:!0===window.debugMode}),computed:{currentCard(){return this.sessionRecord[this.sessionRecord.length-1]}},async created(){this.userCourseRegDoc=await this.user.getCourseRegistrationsDoc(),console.log("[StudySession] Created lifecycle hook - starting initSession"),await this.initSession(),console.log("[StudySession] InitSession completed in created hook")},methods:{user_elo(e){const t=this.userCourseRegDoc.courses.find((t=>t.courseID===e));return j(t?t.elo:void 0)},handleClassroomMessage(){return e=>(Se({text:this.user?.getUsername()||"[Unknown user]",status:z.ok}),console.log("[StudySession] There was a change in the classroom DB:"),console.log(`[StudySession] change: ${e}`),console.log(`[StudySession] Stringified change: ${JSON.stringify(e)}`),{})},incrementSessionClock(){const e=60*this.sessionTimeLimit-this.timeRemaining;this.sessionController.addTime(Math.min(e,60)),this.tick()},tick(){this.timeRemaining=this.sessionController.secondsRemaining,this.percentageRemaining=this.timeRemaining>60?this.timeRemaining/(60*this.sessionTimeLimit)*100:this.timeRemaining/60*100,this.$emit("time-changed",this.timeRemaining),0===this.timeRemaining&&clearInterval(this.intervalHandler)},async initSession(){let e=[];try{console.log(`[StudySession] starting study session w/ sources: ${JSON.stringify(this.contentSources)}`),console.log("[StudySession] Beginning preparation process"),this.sessionContentSources=R((await Promise.all(this.contentSources.map((async e=>{try{return await W(e,this.user)}catch(t){return console.error(`Failed to load study source: ${e.type}/${e.id}`,t),null}})))).filter((e=>null!==e))),this.timeRemaining=60*this.sessionTimeLimit,e=await Promise.all(this.contentSources.filter((e=>"classroom"===e.type)).map((async e=>await this.dataLayer.getClassroomDB(e.id,"student")))),e.forEach((e=>{})),this.sessionController=R(new Q(this.sessionContentSources,60*this.sessionTimeLimit,this.dataLayer,this.getViewComponent)),this.sessionController.sessionRecord=this.sessionRecord,await this.sessionController.prepareSession(),this.intervalHandler=setInterval(this.tick,1e3),this.sessionPrepared=!0,console.log("[StudySession] Session preparation complete, emitting session-prepared event"),this.$emit("session-prepared"),console.log("[StudySession] Event emission completed")}catch(t){console.error("[StudySession] Error during session preparation:",t),this.$emit("session-error",{message:"Failed to prepare study session",error:t})}try{this.contentSources.filter((e=>"course"===e.type)).forEach((async e=>this.courseNames[e.id]=(await this.dataLayer.getCoursesDB().getCourseConfig(e.id)).name)),console.log(`[StudySession] Session created:\n ${this.sessionController?.toString()||"Session controller not initialized"}\n User courses: ${this.contentSources.filter((e=>"course"===e.type)).map((e=>e.id)).toString()}\n User classrooms: ${e.map((e=>e._id)).toString()||"No classrooms"}\n `)}catch(t){console.error("[StudySession] Error during final session setup:",t)}if(this.sessionController)try{this.$emit("session-started"),this.loadCard(await this.sessionController.nextCard())}catch(t){console.error("[StudySession] Error loading next card:",t),this.$emit("session-error",{message:"Failed to load study card",error:t})}else console.error("[StudySession] Cannot load card: session controller not initialized"),this.$emit("session-error",{message:"Study session initialization failed"})},countCardViews(e,t){return this.sessionRecord.filter((n=>n.card.course_id===e&&n.card.card_id===t)).length},async processResponse(e){let t;this.$emit("card-response",e),this.timerIsActive=!0,e.cardID=this.cardID,e.courseID=this.courseID,this.currentCard.records.push(e),console.log("[StudySession] StudySession.processResponse is running...");try{t=this.logCardRecord(e)}catch(a){console.log(`Caught ${a} during putCardHistory...`)}let n=1,s=1;if(We(this.$refs.cardViewer?.$refs.activeView)){const e=this.$refs.cardViewer.$refs.activeView;n=e.maxAttemptsPerView,s=e.maxSessionViews}const r=this.countCardViews(this.courseID,this.cardID),i=await this.sessionController.submitResponse(e,t,this.userCourseRegDoc,this.currentCard,this.courseID,this.cardID,n,s,r);try{this.handleUIFeedback(i)}catch(o){console.error(`[StudySession] Error handling UI feedback: ${o}.\n\nResult: ${JSON.stringify(i)}`)}i.shouldLoadNextCard&&this.loadCard(await this.sessionController.nextCard(i.nextCardAction)),i.shouldClearFeedbackShadow&&this.clearFeedbackShadow()},handleUIFeedback(e){if(e.isCorrect){try{this.$refs.shadowWrapper&&void 0!==e.performanceScore&&(this.$refs.shadowWrapper.setAttribute("style",`--r: ${255*(1-e.performanceScore)}; --g:255`),this.$refs.shadowWrapper.classList.add("correct"))}catch(t){console.warn(`[StudySession] Error setting shadowWrapper style: ${t}`)}this.sessionConfig.likesConfetti&&Gt({origin:{y:1,x:.25+.5*Math.random()},disableForReducedMotion:!0,angle:60+60*Math.random()})}else try{this.$refs.shadowWrapper&&this.$refs.shadowWrapper.classList.add("incorrect")}catch(t){console.warn(`[StudySession] Error setting shadowWrapper style: ${t}`)}},clearFeedbackShadow(){setTimeout((()=>{try{this.$refs.shadowWrapper&&this.$refs.shadowWrapper.classList.remove("correct","incorrect")}catch(e){console.warn(`[StudySession] Error clearing shadowWrapper style: ${e}`)}}),1250)},async logCardRecord(e){console.log("[StudySession] About to call user.putCardRecord...");const t=await this.user.putCardRecord(e);return console.log("[StudySession] user.putCardRecord completed"),t},async loadCard(e){if(this.loading)console.warn("Attempted to load card while loading another...");else{if(console.log(`[StudySession] loading: ${JSON.stringify(e)}`),null===e)return this.sessionFinished=!0,void this.$emit("session-finished",this.sessionRecord);this.cardType=e.item.status,this.loading=!0;try{this.cardCount++,this.data=e.data,this.view=R(e.view),this.cardID=e.item.cardID,this.courseID=e.item.courseID,this.card_elo=e.item.elo||1e3,this.sessionRecord.push({card:{course_id:e.item.courseID,card_id:e.item.cardID,card_elo:this.card_elo},item:e.item,records:[]}),this.$emit("card-loaded",{courseID:e.item.courseID,cardID:e.item.cardID,cardCount:this.cardCount})}catch(t){console.warn(`[StudySession] Error loading card ${JSON.stringify(e)}:\n\t${JSON.stringify(t)}, ${t}`),this.loading=!1;K(t)&&G(e.item)&&(console.warn(`Card was deleted: ${e.item.courseID}::${e.item.cardID}`),this.user.removeScheduledCardReview(e.item.reviewID)),this.loadCard(await this.sessionController.nextCard("dismiss-error"))}finally{this.loading=!1}}}}}),Qt={key:0,class:"StudySession"},Yt={key:1,class:"text-h4"},Jt={key:0},Xt={key:2,ref:"shadowWrapper"},en={key:3};const tn=/* @__PURE__ */ie(Wt,[["render",function(e,t,n,l,g,f){const b=d("v-spacer"),y=d("v-progress-circular"),k=d("v-row"),w=d("session-controller-debug"),v=d("heat-map"),_=d("card-viewer"),C=d("StudySessionTimer"),E=d("v-col"),T=d("SkMouseTrap");return e.sessionPrepared?(r(),s("div",Qt,[p(k,{align:"center"},{default:h((()=>[p(b),e.loading?(r(),u(y,{key:0,color:"primary",indeterminate:"",size:"32",width:"4"})):i("",!0)])),_:1}),e.debugMode?(r(),u(w,{key:0,"session-controller":e.sessionController},null,8,["session-controller"])):i("",!0),t[2]||(t[2]=m("br",null,null,-1)),e.sessionFinished?(r(),s("div",Yt,[t[1]||(t[1]=m("p",null,"Study session finished! Great job!",-1)),e.sessionController?(r(),s("p",Jt,c(e.sessionController.report),1)):i("",!0),p(v,{"activity-records-getter":()=>e.user.getActivityRecords()},null,8,["activity-records-getter"])])):(r(),s("div",Xt,[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[(r(),u(_,{ref:"cardViewer",key:e.cardID,class:x(e.loading?"muted":""),view:e.view,data:e.data,card_id:e.cardID,course_id:e.courseID,"session-order":e.cardCount,user_elo:e.user_elo(e.courseID),card_elo:e.card_elo,onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,8,["class","view","data","card_id","course_id","session-order","user_elo","card_elo"]))])),_:1})],512)),t[3]||(t[3]=m("br",null,null,-1)),e.sessionController?(r(),s("div",en,[(r(!0),s(a,null,o(e.sessionController.failedCount,(e=>(r(),s("span",{key:e,class:"text-h5"},"•")))),128))])):i("",!0),p(k,{align:"center",class:"footer-controls pa-5"},{default:h((()=>[p(E,{cols:"auto",class:"d-flex flex-grow-0 mr-auto"},{default:h((()=>[p(C,{"time-remaining":e.timeRemaining,"session-time-limit":e.sessionTimeLimit,onAddTime:e.incrementSessionClock},null,8,["time-remaining","session-time-limit","onAddTime"])])),_:1}),p(b),p(E,{cols:"auto",class:"footer-right"},{default:h((()=>[p(T)])),_:1})])),_:1})])):i("",!0)}],["__scopeId","data-v-dc537be7"]]);let nn=null;const sn=()=>nn,rn={install(e,t){const n=t?.pinia;n&&(e=>{nn=e})(n)}},an=()=>{const e=sn();return e&&ee(e),X("previewMode",{state:()=>({previewMode:!1}),actions:{setPreviewMode(e){this.previewMode=e}},getters:{isPreviewMode(){return this.previewMode}}})()},on=n({name:"UserInput",data:()=>({answer:"",previewModeStore:null}),mounted(){this.previewModeStore=an()},computed:{autofocus(){return!this.previewModeStore?.previewMode},autoFocus(){return this.autofocus}},methods:{submitAnswer(e){return this.submit(e)},submit(e){return this.getQuestionViewAncestor().submitAnswer(e,this.$options.name??"UserInput")},getQuestionViewAncestor(){let e=this.$parent,t=0;for(;e&&!We(e);){const n=e.$parent;if(!n){const e="\nUserInput.submit() has failed.\nThe input element has no QuestionView ancestor element.";throw F(e),new Error(e)}if(e=n,t++,t>100){const e="\nUserInput.submit() has failed.\nExceeded maximum ancestor lookup depth.";throw F(e),new Error(e)}}if(!e)throw new Error("No QuestionView ancestor found");return e}}});const ln=/* @__PURE__ */ie(n({name:"MultipleChoiceOption",components:{MarkdownRenderer:I((()=>Promise.resolve().then((()=>ti))))},props:{content:{type:String,required:!0},selected:{type:Boolean,required:!0},number:{type:Number,required:!0},setSelection:{type:Function,required:!0},submit:{type:Function,required:!0},markedWrong:{type:Boolean,required:!0}},computed:{className(){let e;switch(this.number){case 0:e="bg-red";break;case 1:e="bg-purple";break;case 2:e="bg-indigo";break;case 3:e="bg-light-blue";break;case 4:e="bg-teal";break;case 5:e="bg-deep-orange";break;default:e="bg-grey"}if(this.selected&&!this.markedWrong)return`choice selected ${e} lighten-3 elevation-8`;if(this.selected||this.markedWrong){if(this.selected&&this.markedWrong)return"choice selected grey lighten-2 elevation-8";if(!this.selected&&this.markedWrong)return"choice not-selected grey lighten-2 elevation-0";throw new Error("'selected' and 'markedWrong' props in MultipleChoiceOption are in an impossible configuration.")}return`choice not-selected ${e} lighten-4 elevation-1`}},methods:{select(){this.setSelection(this.number)},submitThisOption(){this.markedWrong||(this.select(),this.submit())}}}),[["render",function(e,t,n,s,i,a){const o=d("markdown-renderer"),l=d("v-card");return r(),u(l,{class:x(`${e.className}`),onMouseover:e.select,onClick:e.submitThisOption},{default:h((()=>[p(o,{md:e.content},null,8,["md"])])),_:1},8,["class","onMouseover","onClick"])}],["__scopeId","data-v-96de7172"]]),cn=n({name:"RadioMultipleChoice",components:{MultipleChoiceOption:ln},extends:on,props:{choiceList:{type:Array,required:!0}},data:()=>({currentSelection:-1,incorrectSelections:[],containerRef:null,_registeredHotkeys:[]}),watch:{choiceList:{immediate:!0,handler(e){e?.length&&this.bindKeys()}}},mounted(){this.containerRef&&this.containerRef.focus()},unmounted(){this.unbindKeys()},methods:{forwardSelection(){if(!this.choiceIsWrong(this.choiceList[this.currentSelection])&&-1!==this.currentSelection){const e={choiceList:this.choiceList,selection:this.currentSelection};this.submitAnswer(e).isCorrect||this.incorrectSelections.push(this.currentSelection)}},setSelection(e){e<this.choiceList.length&&(this.currentSelection=e)},incrementSelection(){-1===this.currentSelection?this.currentSelection=Math.ceil(this.choiceList.length/2):this.currentSelection=Math.min(this.choiceList.length-1,this.currentSelection+1)},decrementSelection(){-1===this.currentSelection?this.currentSelection=Math.floor(this.choiceList.length/2-1):this.currentSelection=Math.max(0,this.currentSelection-1)},choiceIsWrong(e){let t=!1;return this.incorrectSelections.forEach((n=>{this.choiceList[n]===e&&(t=!0)})),t},bindKeys(){const e=[{hotkey:"left",callback:this.decrementSelection,command:"Move selection left"},{hotkey:"right",callback:this.incrementSelection,command:"Move selection right"},{hotkey:"enter",callback:this.forwardSelection,command:"Submit selection"},...Array.from({length:this.choiceList.length},((e,t)=>({hotkey:(t+1).toString(),callback:()=>this.setSelection(t),command:`Select ${(e=>{switch(e){case 0:return"first";case 1:return"second";case 2:return"third";case 3:return"fourth";case 4:return"fifth";case 5:return"sixth";default:return`${e+1}th`}})(t)} option`})))];be.addBinding(e),this._registeredHotkeys=e.map((e=>e.hotkey))},unbindKeys(){this._registeredHotkeys&&this._registeredHotkeys.forEach((e=>{be.removeBinding(e)}))}}}),dn={ref:"containerRef",class:"multipleChoice"};const un=/* @__PURE__ */ie(cn,[["render",function(e,t,n,i,l,c){const h=d("MultipleChoiceOption");return r(),s("div",dn,[(r(!0),s(a,null,o(e.choiceList,((t,n)=>(r(),u(h,{key:n,content:t,selected:e.choiceList.indexOf(t)===e.currentSelection,number:e.choiceList.indexOf(t),"set-selection":e.setSelection,submit:e.forwardSelection,"marked-wrong":e.choiceIsWrong(t)},null,8,["content","selected","number","set-selection","submit","marked-wrong"])))),128))],512)}]]),hn=n({name:"TrueFalse",components:{RadioMultipleChoice:un},props:{MouseTrap:{type:Object,required:!0},submit:{type:Function,required:!0}}}),pn={"data-viewable":"TrueFalse"};const gn=/* @__PURE__ */ie(hn,[["render",function(e,t,n,i,a,o){const l=d("RadioMultipleChoice");return r(),s("div",pn,[p(l,{"choice-list":["True","False"],MouseTrap:e.MouseTrap,submit:e.submit},null,8,["MouseTrap","submit"])])}]]);const mn=/* @__PURE__ */ie(n({name:"UserInputNumber",ref:{},extends:on,methods:{mounted(){this.$refs.input.focus()},isNumeric:e=>!isNaN(Number.parseFloat(e)),makeNumeric(e){if("string"==typeof e)return Number.parseFloat(e);throw new Error("Expected a string, got "+typeof e)}}}),[["render",function(e,t,n,s,i,a){const o=d("v-text-field"),l=d("v-container");return r(),u(l,{class:"pa-0"},{default:h((()=>[p(o,{ref:"input",modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t),"prepend-icon":"edit",autofocus:e.autofocus,"row-height":"24","toggle-keys":"[13,32]",class:"text-h5",rules:[e.isNumeric],onKeyup:t[1]||(t[1]=C((t=>e.submitAnswer(e.makeNumeric(e.answer))),["enter"]))},null,8,["modelValue","autofocus","rules"])])),_:1})}],["__scopeId","data-v-a56dcd1c"]]),fn=n({name:"UserInputString",extends:on,props:{icon:{type:Boolean,required:!1}},computed:{prependIcon(){return this.icon?"edit":""}},mounted(){this.$refs.input?.focus()},methods:{}}),bn={class:"user-input-container"},yn=["autofocus"];const kn=/* @__PURE__ */ie(fn,[["render",function(e,t,n,i,a,o){return r(),s("span",bn,[A(m("input",{"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t),autofocus:e.autofocus,type:"text",class:"user-input-string",ref:"input",onKeyup:t[1]||(t[1]=C((t=>e.submitAnswer(e.answer)),["enter"]))},null,40,yn),[[M,e.answer]])])}],["__scopeId","data-v-aa14961f"]]),wn=n({name:"FillInInput",components:{UserInputString:kn},props:{text:{type:String,required:!0}},setup(e){const t=b("text"),n=b(""),s=y((()=>e.text.split("||").length>1));return w((()=>{console.log(`fillinCreated w/ text: ${e.text}`),n.value=e.text.substring(2,e.text.length-2),console.log(`fillin text trimmed to: ${n.value}`);n.value.split("||").length>1&&(t.value="radio")})),{inputType:t,radioType:s,processedText:n}}}),vn={key:0,class:"text-h5 underline"};const xn=/* @__PURE__ */ie(wn,[["render",function(e,t,n,i,a,o){const l=d("user-input-string");return e.radioType?(r(),s("span",vn,"             ")):(r(),u(l,{key:1,id:"input",icon:!1,type:"text",value:e.processedText},null,8,["value"]))}],["__scopeId","data-v-486ac035"]]);const _n=/* @__PURE__ */ie(n({name:"CardLoader",components:{CardViewer:it},props:{sessionOrder:{type:Number,required:!1,default:0},qualified_id:{type:Object,required:!0},viewLookup:{type:Function,required:!0}},data:()=>({loading:!0,view:null,data:[],courseID:"",cardID:""}),created(){this.loadCard()},watch:{qualified_id:{immediate:!0,handler(){this.loadCard()}}},methods:{processResponse(e){F(`\n Card was displayed at ${e.timeStamp}\n User spent ${e.timeSpent} milliseconds with the card.\n `),this.$emit("emitResponse",e)},async loadCard(){const e=this.qualified_id;console.log(`Card Loader displaying: ${e.courseID}::${e.cardID}`),this.loading=!0;const t=e.courseID,n=e.cardID,s=Y().getCourseDB(t);try{const e=await s.getCourseDoc(n),r=this.viewLookup(e.id_view),i=e.id_displayable_data.map((e=>s.getCourseDoc(e,{attachments:!0,binary:!0}))),a=[];for(const t of i){const e=await t;a.unshift(q(e))}this.data=a,this.view=R(r),this.cardID=n,this.courseID=t}catch(r){throw new Error(`[CardLoader] Error loading card: ${JSON.stringify(r)}, ${r}`)}finally{this.loading=!1,this.$emit("card-loaded")}}}}),[["render",function(e,t,n,s,a,o){const l=d("card-viewer");return e.loading?i("",!0):(r(),u(l,{key:0,class:x(["ma-2",e.loading?"muted":""]),view:e.view,data:e.data,card_id:e.cardID,course_id:e.courseID,"session-order":e.sessionOrder,onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,8,["class","view","data","card_id","course_id","session-order"]))}],["__scopeId","data-v-93f758b5"]]);function Sn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Cn={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function En(e){Cn=e}const Tn={exec:()=>null};function Rn(e,t=""){let n="string"==typeof e?e:e.source;const s={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(In.caret,"$1"),n=n.replace(e,r),s},getRegex:()=>new RegExp(n,t)};return s}const In={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},An=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mn=/(?:[*+-]|\d{1,9}[.)])/,Nn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$n=Rn(Nn).replace(/bull/g,Mn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Dn=Rn(Nn).replace(/bull/g,Mn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ln=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,On=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Pn=Rn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",On).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bn=Rn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mn).getRegex(),zn="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Un=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jn=Rn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Un).replace("tag",zn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Fn=Rn(Ln).replace("hr",An).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zn).getRegex(),qn={blockquote:Rn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Fn).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Pn,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:An,html:jn,lheading:$n,list:Bn,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Fn,table:Tn,text:/^[^\n]+/},Vn=Rn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",An).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zn).getRegex(),Hn={...qn,lheading:Dn,table:Vn,paragraph:Rn(Ln).replace("hr",An).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vn).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zn).getRegex()},Zn={...qn,html:Rn("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Un).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Rn(Ln).replace("hr",An).replace("heading"," *#{1,6} *[^\n]").replace("lheading",$n).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Kn=/^( {2,}|\\)\n(?!\s*$)/,Gn=/[\p{P}\p{S}]/u,Wn=/[\s\p{P}\p{S}]/u,Qn=/[^\s\p{P}\p{S}]/u,Yn=Rn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Wn).getRegex(),Jn=/(?!~)[\p{P}\p{S}]/u,Xn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,es=Rn(Xn,"u").replace(/punct/g,Gn).getRegex(),ts=Rn(Xn,"u").replace(/punct/g,Jn).getRegex(),ns="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ss=Rn(ns,"gu").replace(/notPunctSpace/g,Qn).replace(/punctSpace/g,Wn).replace(/punct/g,Gn).getRegex(),rs=Rn(ns,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Jn).getRegex(),is=Rn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Qn).replace(/punctSpace/g,Wn).replace(/punct/g,Gn).getRegex(),as=Rn(/\\(punct)/,"gu").replace(/punct/g,Gn).getRegex(),os=Rn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[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])?)+(?![-_])/).getRegex(),ls=Rn(Un).replace("(?:--\x3e|$)","--\x3e").getRegex(),cs=Rn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ls).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ds=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,us=Rn(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ds).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),hs=Rn(/^!?\[(label)\]\[(ref)\]/).replace("label",ds).replace("ref",On).getRegex(),ps=Rn(/^!?\[(ref)\](?:\[\])?/).replace("ref",On).getRegex(),gs={_backpedal:Tn,anyPunctuation:as,autolink:os,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:Kn,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Tn,emStrongLDelim:es,emStrongRDelimAst:ss,emStrongRDelimUnd:is,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:us,nolink:ps,punctuation:Yn,reflink:hs,reflinkSearch:Rn("reflink|nolink(?!\\()","g").replace("reflink",hs).replace("nolink",ps).getRegex(),tag:cs,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Tn},ms={...gs,link:Rn(/^!?\[(label)\]\((.*?)\)/).replace("label",ds).getRegex(),reflink:Rn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ds).getRegex()},fs={...gs,emStrongRDelimAst:rs,emStrongLDelim:ts,url:Rn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},bs={...fs,br:Rn(Kn).replace("{2,}","*").getRegex(),text:Rn(fs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ys={normal:qn,gfm:Hn,pedantic:Zn},ks={normal:gs,gfm:fs,breaks:bs,pedantic:ms},ws={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vs=e=>ws[e];function xs(e,t){if(t){if(In.escapeTest.test(e))return e.replace(In.escapeReplace,vs)}else if(In.escapeTestNoEncode.test(e))return e.replace(In.escapeReplaceNoEncode,vs);return e}function _s(e){try{e=encodeURI(e).replace(In.percentDecode,"%")}catch{return null}return e}function Ss(e,t){const n=e.replace(In.findPipe,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(In.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(In.slashPipe,"|");return n}function Cs(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){if(e.charAt(s-r-1)!==t)break;r++}return e.slice(0,s-r)}function Es(e,t,n,s,r){const i=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,e}return{type:"image",raw:n,href:i,title:a,text:o}}class _Tokenizer{constructor(e){t(this,"options"),t(this,"rules"),t(this,"lexer"),this.options=e||Cn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Cs(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(null===s)return t;const r=s[1];return t.split("\n").map((e=>{const t=e.match(n.other.beginningSpace);if(null===t)return e;const[s]=t;return s.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=Cs(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Cs(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=Cs(t[0],"\n").split("\n"),n="",s="";const r=[];for(;e.length>0;){let t=!1;const i=[];let a;for(a=0;a<e.length;a++)if(this.rules.other.blockquoteStart.test(e[a]))i.push(e[a]),t=!0;else{if(t)break;i.push(e[a])}e=e.slice(a);const o=i.join("\n"),l=o.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${o}`:o,s=s?`${s}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,r,!0),this.lexer.state.top=c,0===e.length)break;const d=r.at(-1);if("code"===d?.type)break;if("blockquote"===d?.type){const t=d,i=t.raw+"\n"+e.join("\n"),a=this.blockquote(i);r[r.length-1]=a,n=n.substring(0,n.length-t.raw.length)+a.raw,s=s.substring(0,s.length-t.text.length)+a.text;break}if("list"!==d?.type);else{const t=d,i=t.raw+"\n"+e.join("\n"),a=this.list(i);r[r.length-1]=a,n=n.substring(0,n.length-d.raw.length)+a.raw,s=s.substring(0,s.length-t.raw.length)+a.raw,e=i.substring(r.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let a=!1;for(;e;){let n=!1,s="",o="";if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=!l.trim(),u=0;if(this.options.pedantic?(u=2,o=l.trimStart()):d?u=t[1].length+1:(u=t[2].search(this.rules.other.nonSpaceChar),u=u>4?1:u,o=l.slice(u),u+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(s+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=this.rules.other.nextBulletRegex(u),n=this.rules.other.hrRegex(u),r=this.rules.other.fencesBeginRegex(u),i=this.rules.other.headingBeginRegex(u),a=this.rules.other.htmlBeginRegex(u);for(;e;){const h=e.split("\n",1)[0];let p;if(c=h,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),p=c):p=c.replace(this.rules.other.tabCharGlobal," "),r.test(c))break;if(i.test(c))break;if(a.test(c))break;if(t.test(c))break;if(n.test(c))break;if(p.search(this.rules.other.nonSpaceChar)>=u||!c.trim())o+="\n"+p.slice(u);else{if(d)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(r.test(l))break;if(i.test(l))break;if(n.test(l))break;o+="\n"+c}d||c.trim()||(d=!0),s+=h+"\n",e=e.substring(h.length+1),l=p.slice(u)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(s)&&(a=!0));let h,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(o),p&&(h="[ ] "!==p[0],o=o.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:s,task:!!p,checked:h,loose:!1,text:o,tokens:[]}),r.raw+=s}const o=r.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!this.rules.other.tableDelimiter.test(t[2]))return;const n=Ss(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const e of s)this.rules.other.tableAlignRight.test(e)?i.align.push("right"):this.rules.other.tableAlignCenter.test(e)?i.align.push("center"):this.rules.other.tableAlignLeft.test(e)?i.align.push("left"):i.align.push(null);for(let e=0;e<n.length;e++)i.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:i.align[e]});for(const e of r)i.rows.push(Ss(e,i.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=Cs(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Es(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Es(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,a=n,o=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=l.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){a+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+o);const t=[...s[0]][0].length,l=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(e),s=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&s&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class _Lexer{constructor(e){t(this,"tokens"),t(this,"options"),t(this,"state"),t(this,"tokenizer"),t(this,"inlineQueue"),this.tokens=[],this.tokens.links=/* @__PURE__ */Object.create(null),this.options=e||Cn,this.options.tokenizer=this.options.tokenizer||new _Tokenizer,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:In,block:ys.normal,inline:ks.normal};this.options.pedantic?(n.block=ys.pedantic,n.inline=ks.pedantic):this.options.gfm&&(n.block=ys.gfm,this.options.breaks?n.inline=ks.breaks:n.inline=ks.gfm),this.tokenizer.rules=n}static get rules(){return{block:ys,inline:ks}}static lex(e,t){return new _Lexer(t).lex(e)}static lexInline(e,t){return new _Lexer(t).inlineTokens(e)}lex(e){e=e.replace(In.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(In.tabCharGlobal," ").replace(In.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const n=t.at(-1);1===s.raw.length&&void 0!==n?n.raw+="\n":t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.at(-1).src=n.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let r=e;if(this.options.extensions?.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){const i=t.at(-1);n&&"paragraph"===i?.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length)}else if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r=!1,i="";for(;e;){let s;if(r||(i=""),r=!1,this.options.extensions?.inline?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===s.type&&"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,n,i)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(a)){e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(i=s.raw.slice(-1)),r=!0;const n=t.at(-1);"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class _Renderer{constructor(e){t(this,"options"),t(this,"parser"),this.options=e||Cn}space(e){return""}code({text:e,lang:t,escaped:n}){const s=(t||"").match(In.notSpaceStart)?.[0],r=e.replace(In.endingNewline,"")+"\n";return s?'<pre><code class="language-'+xs(s)+'">'+(n?r:xs(r,!0))+"</code></pre>\n":"<pre><code>"+(n?r:xs(r,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,n=e.start;let s="";for(let i=0;i<e.items.length;i++){const t=e.items[i];s+=this.listitem(t)}const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+s+"</"+r+">\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+xs(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let s="";for(let r=0;r<e.rows.length;r++){const t=e.rows[r];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+s+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${xs(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),r=_s(e);if(null===r)return s;let i='<a href="'+(e=r)+'"';return t&&(i+=' title="'+xs(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:n}){const s=_s(e);if(null===s)return xs(n);let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${xs(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:xs(e.text)}}class _TextRenderer{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class _Parser{constructor(e){t(this,"options"),t(this,"renderer"),t(this,"textRenderer"),this.options=e||Cn,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,t){return new _Parser(t).parse(e)}static parseInline(e,t){return new _Parser(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions?.renderers?.[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}const i=r;switch(i.type){case"space":n+=this.renderer.space(i);continue;case"hr":n+=this.renderer.hr(i);continue;case"heading":n+=this.renderer.heading(i);continue;case"code":n+=this.renderer.code(i);continue;case"table":n+=this.renderer.table(i);continue;case"blockquote":n+=this.renderer.blockquote(i);continue;case"list":n+=this.renderer.list(i);continue;case"html":n+=this.renderer.html(i);continue;case"paragraph":n+=this.renderer.paragraph(i);continue;case"text":{let r=i,a=this.renderer.text(r);for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],a+="\n"+this.renderer.text(r);n+=t?this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a,escaped:!0}]}):a;continue}default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions?.renderers?.[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}const i=r;switch(i.type){case"escape":case"text":n+=t.text(i);break;case"html":n+=t.html(i);break;case"link":n+=t.link(i);break;case"image":n+=t.image(i);break;case"strong":n+=t.strong(i);break;case"em":n+=t.em(i);break;case"codespan":n+=t.codespan(i);break;case"br":n+=t.br(i);break;case"del":n+=t.del(i);break;default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class _Hooks{constructor(e){t(this,"options"),t(this,"block"),this.options=e||Cn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}}t(_Hooks,"passThroughHooks",/* @__PURE__ */new Set(["preprocess","postprocess","processAllTokens"]));const Ts=new class Marked{constructor(...e){t(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),t(this,"options",this.setOptions),t(this,"parse",this.parseMarkdown(!0)),t(this,"parseInline",this.parseMarkdown(!1)),t(this,"Parser",_Parser),t(this,"Renderer",_Renderer),t(this,"TextRenderer",_TextRenderer),t(this,"Lexer",_Lexer),t(this,"Tokenizer",_Tokenizer),t(this,"Hooks",_Hooks),this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)n=n.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const r=e[s].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new _Renderer(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const s=n,r=e.renderer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,r=e.tokenizer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new _Hooks;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const s=n,r=e.hooks[s],i=t[s];_Hooks.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>i.call(t,e)));const n=r.call(t,e);return i.call(t,n)}:t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _Lexer.lex(e,t??this.defaults)}parser(e,t){return _Parser.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{const s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(!0===this.defaults.async&&!1===s.async)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return i(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const a=r.hooks?r.hooks.provideLexer():e?_Lexer.lex:_Lexer.lexInline,o=r.hooks?r.hooks.provideParser():e?_Parser.parse:_Parser.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then((e=>a(e,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>o(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let e=a(t,r);r.hooks&&(e=r.hooks.processAllTokens(e)),r.walkTokens&&this.walkTokens(e,r.walkTokens);let n=o(e,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(l){return i(l)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+xs(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Rs(e,t){return Ts.parse(e,t)}Rs.options=Rs.setOptions=function(e){return Ts.setOptions(e),Rs.defaults=Ts.defaults,En(Rs.defaults),Rs},Rs.getDefaults=Sn,Rs.defaults=Cn,Rs.use=function(...e){return Ts.use(...e),Rs.defaults=Ts.defaults,En(Rs.defaults),Rs},Rs.walkTokens=function(e,t){return Ts.walkTokens(e,t)},Rs.parseInline=Ts.parseInline,Rs.Parser=_Parser,Rs.parser=_Parser.parse,Rs.Renderer=_Renderer,Rs.TextRenderer=_TextRenderer,Rs.Lexer=_Lexer,Rs.lexer=_Lexer.lex,Rs.Tokenizer=_Tokenizer,Rs.Hooks=_Hooks,Rs.parse=Rs,Rs.options,Rs.setOptions,Rs.use,Rs.walkTokens,Rs.parseInline,_Parser.parse;const Is=_Lexer.lex;function As(e,t,n){if(0===e.length)return[];let s=[];const r=e.indexOf(t),i=e.indexOf(n,r);return r>=0&&i>r?(s.push(e.substring(0,r)),s.push(e.substring(r,i+n.length)),s=s.concat(As(e.substring(i+n.length),t,n)),s):[e]}function Ms(e){if($s(e)){const t=As(e.text,"{{","}}"),n=As(e.raw,"{{","}}");if(t.length===n.length)return t.map(((e,s)=>({type:"text",text:t[s],raw:n[s]})));throw new Error("Error parsing markdown")}return[e]}function Ns(e){let t=[];if($s(e)){const n=As(e.text,"{{","}}"),s=As(e.raw,"{{","}}");if(n.length===s.length){for(let e=0;e<n.length;e++){const r={type:"text",text:n[e],raw:s[e]};Ds(r)?t.push(r):Is(s[e]).forEach((e=>{"paragraph"===e.type?t=t.concat(e.tokens):t.push(e)}))}return t}throw new Error("Error parsing Markdown")}return t.push(e),t}function $s(e){if("text"===e.type||"paragraph"===e.type){const t=e.raw.indexOf("{{"),n=e.raw.indexOf("}}");return-1!==t&&-1!==n&&n>t}return!1}function Ds(e){return"text"===e.type&&e.text.startsWith("{{")&&e.text.endsWith("}}")}function Ls(e){if(e.length>1e4)return null;const t=e.match(/^\{\{\s*<([\w-]+)((?:\s+[\w-]+="[^"]*")*)\s*\/>\s*\}\}$/);if(!t)return null;const n=t[1],s=t[2],r={};if(s){const e=/\s+([\w-]+)="([^"]*)"/g;let t;for(;null!==(t=e.exec(s));)r[t[1]]=t[2]}return{componentName:n,props:r}}function Os(e){if(e.length>1e4)return!1;const t=e.trim();return/^<[\w-]+(?:\s+[\w-]+="[^"]*")*\s*\/?>$/.test(t)}function Ps(e){return Ls("text"in e?e.text:"raw"in e?e.raw:"")}const Bs=/* @__PURE__ */ie(/* @__PURE__ */n({__name:"AudioAutoPlayer",props:{src:{}},setup(e){const t=e,n=b([]),s=b([]),i=b(!1);let a=null;const o=e=>{if((e=>{try{return!isNaN(n.value[e].duration)}catch(t){throw new Error("AudioPlayer does not have an element at this index:",t)}})(e))if(n.value[e].play(),e+1<n.value.length){const t=1e3*(n.value[e].duration+.7);s.value.push(setTimeout((()=>{i.value&&o(e+1)}),t))}else setTimeout((()=>{i.value=!1}),1e3*n.value[e].duration),setTimeout((()=>{a=null}),1e3*n.value[e].duration+500);else setTimeout(o,100,e)},l=()=>{null===a||a===N()?(a=N(),i.value=!0,o(0)):setTimeout(l,100)};return w((()=>{a=null,"string"==typeof t.src?n.value.push(new Audio(t.src)):t.src.forEach((e=>{n.value.push(new Audio(e))}));const e=[{hotkey:"up",callback:l,command:"Replay Audio"}];be.addBinding(e),l()})),v((()=>{be.removeBinding("up"),i.value=!1,setTimeout((()=>{a=null}),500),s.value.forEach(clearTimeout),console.log("Audio stopping..."),n.value.forEach((e=>{e.paused||(e.pause(),e.currentTime=0)}))})),(e,t)=>{const n=d("v-icon"),s=d("v-btn");return r(),u(s,{size:"large",icon:"",color:i.value?"primary lighten-3":"primary",class:x({playing:i.value}),onClick:l},{default:h((()=>[p(n,null,{default:h((()=>t[0]||(t[0]=[g("mdi-volume-high")]))),_:1})])),_:1},8,["color","class"])}}}),[["__scopeId","data-v-e1a0f62c"]]);var zs,Us;function js(){if(Us)return zs;function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{const s=t[n],r=typeof s;"object"!==r&&"function"!==r||Object.isFrozen(s)||e(s)})),t}Us=1;class Response{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function n(e,...t){const n=/* @__PURE__ */Object.create(null);for(const s in e)n[s]=e[s];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope;class HTMLRenderer{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const r=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class TokenTree{constructor(){this.rootNode=r(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=r({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{TokenTree._collapse(e)})))}}class TokenTreeEmitter extends TokenTree{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new HTMLRenderer(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function i(e){return e?"string"==typeof e?e:e.source:null}function a(e){return c("(?=",e,")")}function o(e){return c("(?:",e,")*")}function l(e){return c("(?:",e,")?")}function c(...e){return e.map((e=>i(e))).join("")}function d(...e){const t=function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e);return"("+(t.capture?"":"?:")+e.map((e=>i(e))).join("|")+")"}function u(e){return new RegExp(e.toString()+"|").exec("").length-1}const h=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function p(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let s=i(e),r="";for(;s.length>0;){const e=h.exec(s);if(!e){r+=s;break}r+=s.substring(0,e.index),s=s.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+String(Number(e[1])+t):(r+=e[0],"("===e[0]&&n++)}return r})).map((e=>`(${e})`)).join(t)}const g="[a-zA-Z]\\w*",m="[a-zA-Z_]\\w*",f="\\b\\d+(\\.\\d+)?",b="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",y="\\b(0b[01]+)",k={begin:"\\\\[\\s\\S]",relevance:0},w={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[k]},v={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[k]},x=function(e,t,s={}){const r=n({scope:"comment",begin:e,end:t,contains:[]},s);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=d("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:c(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},_=x("//","$"),S=x("/\\*","\\*/"),C=x("#","$"),E={scope:"number",begin:f,relevance:0},T={scope:"number",begin:b,relevance:0},R={scope:"number",begin:y,relevance:0},I={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[k,{begin:/\[/,end:/\]/,relevance:0,contains:[k]}]},A={scope:"title",begin:g,relevance:0},M={scope:"title",begin:m,relevance:0},N={begin:"\\.\\s*"+m,relevance:0};var $=/* @__PURE__ */Object.freeze({__proto__:null,APOS_STRING_MODE:w,BACKSLASH_ESCAPE:k,BINARY_NUMBER_MODE:R,BINARY_NUMBER_RE:y,COMMENT:x,C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:_,C_NUMBER_MODE:T,C_NUMBER_RE:b,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:C,IDENT_RE:g,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:N,NUMBER_MODE:E,NUMBER_RE:f,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:v,REGEXP_MODE:I,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=c(t,/.*\b/,e.binary,/\b.*/)),n({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:A,UNDERSCORE_IDENT_RE:m,UNDERSCORE_TITLE_MODE:M});function D(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function L(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function O(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=D,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function P(e,t){Array.isArray(e.illegal)&&(e.illegal=d(...e.illegal))}function B(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function z(e,t){void 0===e.relevance&&(e.relevance=1)}const U=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]})),e.keywords=n.keywords,e.begin=c(n.beforeMatch,a(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},j=["of","and","for","in","not","or","if","then","parent","list","value"];function F(e,t,n="keyword"){const s=/* @__PURE__ */Object.create(null);return"string"==typeof e?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach((function(n){Object.assign(s,F(e[n],t,n))})),s;function r(e,n){t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((function(t){const n=t.split("|");s[n[0]]=[e,q(n[0],n[1])]}))}}function q(e,t){return t?Number(t):function(e){return j.includes(e.toLowerCase())}(e)?0:1}const V={},H=e=>{console.error(e)},Z=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K=(e,t)=>{V[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),V[`${e}/${t}`]=!0)},G=new Error;function W(e,t,{key:n}){let s=0;const r=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+s]=r[o],i[o+s]=!0,s+=u(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw H("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),G;if("object"!=typeof e.beginScope||null===e.beginScope)throw H("beginScope must be object"),G;W(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw H("skip, excludeEnd, returnEnd not compatible with endScope: {}"),G;if("object"!=typeof e.endScope||null===e.endScope)throw H("endScope must be object"),G;W(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}}(e)}function Y(e){function t(t,n){return new RegExp(i(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class MultiRegex{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=u(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=t(p(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),s=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,s)}}class ResumableMultiRegex{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new MultiRegex;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=n(e.classNameAliases||{}),function s(r,a){const o=r;if(r.isCompiled)return o;[L,B,Q,U].forEach((e=>e(r,a))),e.compilerExtensions.forEach((e=>e(r,a))),r.__beforeBegin=null,[O,P,z].forEach((e=>e(r,a))),r.isCompiled=!0;let l=null;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords),l=r.keywords.$pattern,delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=F(r.keywords,e.case_insensitive)),o.keywordPatternRe=t(l,!0),a&&(r.begin||(r.begin=/\B|\b/),o.beginRe=t(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),r.end&&(o.endRe=t(o.end)),o.terminatorEnd=i(o.end)||"",r.endsWithParent&&a.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+a.terminatorEnd)),r.illegal&&(o.illegalRe=t(r.illegal)),r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return n(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(J(e))return n(e,{starts:e.starts?n(e.starts):null});if(Object.isFrozen(e))return n(e);return e}("self"===e?r:e)}))),r.contains.forEach((function(e){s(e,o)})),r.starts&&s(r.starts,a),o.matcher=function(e){const t=new ResumableMultiRegex;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(o),o}(e)}function J(e){return!!e&&(e.endsWithParent||J(e.starts))}class HTMLInjectionError extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const X=t,ee=n,te=Symbol("nomatch"),ne=function(t){const n=/* @__PURE__ */Object.create(null),s=/* @__PURE__ */Object.create(null),r=[];let i=!0;const u="Could not find the language '{}', did you forget to load/include a language module?",h={disableAutodetect:!0,name:"Plain text",contains:[]};let p={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:TokenTreeEmitter};function g(e){return p.noHighlightRe.test(e)}function m(e,t,n){let s="",r="";"object"==typeof t?(s=e,n=t.ignoreIllegals,r=t.language):(K("10.7.0","highlight(lang, code, ...args) has been deprecated."),K("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),r=e,s=t),void 0===n&&(n=!0);const i={code:s,language:r};S("before:highlight",i);const a=i.result?i.result:f(i.language,i.code,n);return a.code=i.code,S("after:highlight",a),a}function f(e,t,s,r){const a=/* @__PURE__ */Object.create(null);function o(){if(!C.keywords)return void T.addText(R);let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(R),n="";for(;t;){n+=R.substring(e,t.index);const r=x.case_insensitive?t[0].toLowerCase():t[0],i=(s=r,C.keywords[s]);if(i){const[e,s]=i;if(T.addText(n),n="",a[r]=(a[r]||0)+1,a[r]<=7&&(I+=s),e.startsWith("_"))n+=t[0];else{const n=x.classNameAliases[e]||e;c(t[0],n)}}else n+=t[0];e=C.keywordPatternRe.lastIndex,t=C.keywordPatternRe.exec(R)}var s;n+=R.substring(e),T.addText(n)}function l(){null!=C.subLanguage?function(){if(""===R)return;let e=null;if("string"==typeof C.subLanguage){if(!n[C.subLanguage])return void T.addText(R);e=f(C.subLanguage,R,!0,E[C.subLanguage]),E[C.subLanguage]=e._top}else e=b(R,C.subLanguage.length?C.subLanguage:null);C.relevance>0&&(I+=e.relevance),T.__addSublanguage(e._emitter,e.language)}():o(),R=""}function c(e,t){""!==e&&(T.startScope(t),T.addText(e),T.endScope())}function d(e,t){let n=1;const s=t.length-1;for(;n<=s;){if(!e._emit[n]){n++;continue}const s=x.classNameAliases[e[n]]||e[n],r=t[n];s?c(r,s):(R=r,o(),R=""),n++}}function h(e,t){return e.scope&&"string"==typeof e.scope&&T.openNode(x.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(c(R,x.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),C=Object.create(e,{parent:{value:C}}),C}function g(e,t,n){let s=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(s){if(e["on:end"]){const n=new Response(e);e["on:end"](t,n),n.isMatchIgnored&&(s=!1)}if(s){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return g(e.parent,t,n)}function m(e){return 0===C.matcher.regexIndex?(R+=e[0],1):(N=!0,0)}function y(e){const n=e[0],s=t.substring(e.index),r=g(C,e,s);if(!r)return te;const i=C;C.endScope&&C.endScope._wrap?(l(),c(n,C.endScope._wrap)):C.endScope&&C.endScope._multi?(l(),d(C.endScope,e)):i.skip?R+=n:(i.returnEnd||i.excludeEnd||(R+=n),l(),i.excludeEnd&&(R=n));do{C.scope&&T.closeNode(),C.skip||C.subLanguage||(I+=C.relevance),C=C.parent}while(C!==r.parent);return r.starts&&h(r.starts,e),i.returnEnd?0:n.length}let k={};function w(n,r){const a=r&&r[0];if(R+=n,null==a)return l(),0;if("begin"===k.type&&"end"===r.type&&k.index===r.index&&""===a){if(R+=t.slice(r.index,r.index+1),!i){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=k.rule,t}return 1}if(k=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,s=new Response(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,s),s.isMatchIgnored))return m(t);return n.skip?R+=t:(n.excludeBegin&&(R+=t),l(),n.returnBegin||n.excludeBegin||(R=t)),h(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!s){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(C.scope||"<unnamed>")+'"');throw e.mode=C,e}if("end"===r.type){const e=y(r);if(e!==te)return e}if("illegal"===r.type&&""===a)return R+="\n",1;if(M>1e5&&M>3*r.index){throw new Error("potential infinite loop, way more iterations than matches")}return R+=a,a.length}const x=v(e);if(!x)throw H(u.replace("{}",e)),new Error('Unknown language: "'+e+'"');const _=Y(x);let S="",C=r||_;const E={},T=new p.__emitter(p);!function(){const e=[];for(let t=C;t!==x;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach((e=>T.openNode(e)))}();let R="",I=0,A=0,M=0,N=!1;try{if(x.__emitTokens)x.__emitTokens(t,T);else{for(C.matcher.considerAll();;){M++,N?N=!1:C.matcher.considerAll(),C.matcher.lastIndex=A;const e=C.matcher.exec(t);if(!e)break;const n=w(t.substring(A,e.index),e);A=e.index+n}w(t.substring(A))}return T.finalize(),S=T.toHTML(),{language:e,value:S,relevance:I,illegal:!1,_emitter:T,_top:C}}catch($){if($.message&&$.message.includes("Illegal"))return{language:e,value:X(t),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:A,context:t.slice(A-100,A+100),mode:$.mode,resultSoFar:S},_emitter:T};if(i)return{language:e,value:X(t),illegal:!1,relevance:0,errorRaised:$,_emitter:T,_top:C};throw $}}function b(e,t){t=t||p.languages||Object.keys(n);const s=function(e){const t={value:X(e),illegal:!1,relevance:0,_top:h,_emitter:new p.__emitter(p)};return t._emitter.addText(e),t}(e),r=t.filter(v).filter(_).map((t=>f(t,e,!1)));r.unshift(s);const i=r.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(v(e.language).supersetOf===t.language)return 1;if(v(t.language).supersetOf===e.language)return-1}return 0})),[a,o]=i,l=a;return l.secondBest=o,l}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=p.languageDetectRe.exec(t);if(n){const t=v(n[1]);return t||(Z(u.replace("{}",n[1])),Z("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>g(e)||v(e)))}(e);if(g(n))return;if(S("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),p.throwUnescapedHTML)){throw new HTMLInjectionError("One of your code blocks includes unescaped HTML.",e.innerHTML)}t=e;const r=t.textContent,i=n?m(r,{language:n,ignoreIllegals:!0}):b(r);e.innerHTML=i.value,e.dataset.highlighted="yes",function(e,t,n){const r=t&&s[t]||n;e.classList.add("hljs"),e.classList.add(`language-${r}`)}(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),S("after:highlightElement",{el:e,result:i,text:r})}let k=!1;function w(){if("loading"===document.readyState)return k||window.addEventListener("DOMContentLoaded",(function(){w()}),!1),void(k=!0);document.querySelectorAll(p.cssSelector).forEach(y)}function v(e){return e=(e||"").toLowerCase(),n[e]||n[s[e]]}function x(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{s[e.toLowerCase()]=t}))}function _(e){const t=v(e);return t&&!t.disableAutodetect}function S(e,t){const n=e;r.forEach((function(e){e[n]&&e[n](t)}))}Object.assign(t,{highlight:m,highlightAuto:b,highlightAll:w,highlightElement:y,highlightBlock:function(e){return K("10.7.0","highlightBlock will be removed entirely in v12.0"),K("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){p=ee(p,e)},initHighlighting:()=>{w(),K("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){w(),K("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(e,s){let r=null;try{r=s(t)}catch(a){if(H("Language definition for '{}' could not be registered.".replace("{}",e)),!i)throw a;H(a),r=h}r.name||(r.name=e),n[e]=r,r.rawDefinition=s.bind(null,t),r.aliases&&x(r.aliases,{languageName:e})},unregisterLanguage:function(e){delete n[e];for(const t of Object.keys(s))s[t]===e&&delete s[t]},listLanguages:function(){return Object.keys(n)},getLanguage:v,registerAliases:x,autoDetection:_,inherit:ee,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString="11.11.1",t.regex={concat:c,lookahead:a,either:d,optional:l,anyNumberOfTimes:o};for(const a in $)"object"==typeof $[a]&&e($[a]);return Object.assign(t,$),t},se=ne({});return se.newInstance=()=>ne({}),zs=se,se.HighlightJS=se,se.default=se,zs}const Fs=/* @__PURE__ */de(/* @__PURE__ */js());var qs={component:n({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(e){var t=b(e.language);k((function(){return e.language}),(function(e){t.value=e}));var n=y((function(){return e.autodetect||!t.value})),s=y((function(){return!n.value&&!Fs.getLanguage(t.value)}));return{className:y((function(){return s.value?"":"hljs "+t.value})),highlightedCode:y((function(){var r;if(s.value)return console.warn('The language "'+t.value+'" you specified could not be found.'),e.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;");if(n.value){var i=Fs.highlightAuto(e.code);return t.value=null!==(r=i.language)&&void 0!==r?r:"",i.value}return(i=Fs.highlight(e.code,{language:t.value,ignoreIllegals:e.ignoreIllegals})).value}))}},render:function(){return $("pre",{},[$("code",{class:this.className,innerHTML:this.highlightedCode,tabindex:"0"})])}})};const Vs="[A-Za-z$_][0-9A-Za-z$_]*",Hs=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Zs=["true","false","null","undefined","NaN","Infinity"],Ks=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Gs=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ws=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Qs=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ys=[].concat(Ws,Ks,Gs);function Js(e){const t=e.regex,n=Vs,s="<>",r="</>",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,s=e.input[n];if("<"===s||","===s)return void t.ignoreMatch();let r;">"===s&&(((e,{after:t})=>{const n="</"+e[0].slice(1);return-1!==e.input.indexOf(n,t)})(e,{after:n})||t.ignoreMatch());const i=e.input.substring(n);((r=i.match(/^\s*=/))||(r=i.match(/^\s+extends\s+/))&&0===r.index)&&t.ignoreMatch()}},a={$pattern:Vs,keyword:Hs,literal:Zs,built_in:Ys,"variable.language":Qs},o="[0-9](_?[0-9])*",l=`\\.(${o})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},f={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];u.contains=b.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(b)});const y=[].concat(f,u.contains),k=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(y)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},x={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ks,...Gs]}},_={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/};const S={match:t.concat(/\b/,(C=[...Ws,"super","import"].map((e=>`${e}\\s*\\(`)),t.concat("(?!",C.join("|"),")")),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var C;const E={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,f,{match:/\$\d+/},d,x,{scope:"attr",match:n+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s,end:r},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},E,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},S,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},v,T,{match:/\$[(.]/}]}}const Xs="[A-Za-z$_][0-9A-Za-z$_]*",er=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],tr=["true","false","null","undefined","NaN","Infinity"],nr=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],sr=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rr=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ir=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ar=[].concat(rr,nr,sr);function or(e){const t=e.regex,n=function(e){const t=e.regex,n=Xs,s="<>",r="</>",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,s=e.input[n];if("<"===s||","===s)return void t.ignoreMatch();let r;">"===s&&(((e,{after:t})=>{const n="</"+e[0].slice(1);return-1!==e.input.indexOf(n,t)})(e,{after:n})||t.ignoreMatch());const i=e.input.substring(n);((r=i.match(/^\s*=/))||(r=i.match(/^\s+extends\s+/))&&0===r.index)&&t.ignoreMatch()}},a={$pattern:Xs,keyword:er,literal:tr,built_in:ar,"variable.language":ir},o="[0-9](_?[0-9])*",l=`\\.(${o})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},f={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];u.contains=b.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(b)});const y=[].concat(f,u.contains),k=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(y)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},v={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},x={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...nr,...sr]}},_={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},S={match:t.concat(/\b/,(C=[...rr,"super","import"].map((e=>`${e}\\s*\\(`)),t.concat("(?!",C.join("|"),")")),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var C;const E={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,f,{match:/\$\d+/},d,x,{scope:"attr",match:n+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s,end:r},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},E,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},S,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},v,T,{match:/\$[(.]/}]}}(e),s=Xs,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},o={$pattern:Xs,keyword:er.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:tr,built_in:ar.concat(r),"variable.language":ir},l={className:"meta",begin:"@"+s},c=(e,t,n)=>{const s=e.contains.findIndex((e=>e.label===t));if(-1===s)throw new Error("can not find mode to replace");e.contains.splice(s,1,n)};Object.assign(n.keywords,o),n.exports.PARAMS_CONTAINS.push(l);const d=n.contains.find((e=>"attr"===e.scope)),u=Object.assign({},d,{match:t.concat(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,u]),n.contains=n.contains.concat([l,i,a,u]),c(n,"shebang",e.SHEBANG()),c(n,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/});return n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const lr=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],cr=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),dr=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ur=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),hr=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function pr(e){const t=e.regex,n=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}))(e),s=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+dr.join("|")+")"},{begin:":(:)?("+ur.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+hr.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:cr.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+lr.join("|")+")\\b"}]}}function gr(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(r,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[r,o,a,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[r,i,o,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function mr(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(o);const l={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},c=e.SHEBANG({binary:`(${["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"].join("|")})`,relevance:10}),d={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[c,e.SHEBANG(),d,l,i,a,{match:/(\/[a-z._-]+)+/},o,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}}function fr(e){const t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function br(e){const t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function yr(e){const t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],r={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},i={className:"meta",begin:/^(>>>|\.\.\.) /},a={className:"subst",begin:/\{/,end:/\}/,keywords:r,illegal:/#/},o={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i,o,a]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i,o,a]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,o,a]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,o,a]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u=`\\b|${s.join("|")}`,h={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},p={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:r,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:["self",i,h,l,e.HASH_COMMENT_MODE]}]};return a.contains=[l,h,i],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:r,illegal:/(<\/|\?)|=>/,contains:[i,h,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},l,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[h,g,l]}]}}const kr={class:"code-block-wrapper pa-2"},wr={key:0,class:"language-indicator"},vr=/* @__PURE__ */n({__name:"CodeBlockRenderer",props:{code:{type:String,required:!0},language:{type:String,default:""}},setup(e){Fs.registerLanguage("js",Js),Fs.registerLanguage("javascript",Js),Fs.registerLanguage("ts",or),Fs.registerLanguage("typescript",or),Fs.registerLanguage("css",pr),Fs.registerLanguage("html",gr),Fs.registerLanguage("bash",mr),Fs.registerLanguage("sh",mr),Fs.registerLanguage("json",fr),Fs.registerLanguage("go",br),Fs.registerLanguage("golang",br),Fs.registerLanguage("python",yr);const t=N();return t&&t.appContext.app.component("highlightjs",qs.component),(t,n)=>{const a=d("highlightjs");return r(),s("div",kr,[e.language?(r(),s("div",wr,c(e.language),1)):i("",!0),p(a,{language:e.language,code:e.code},null,8,["language","code"])])}}}),xr={key:0},_r={key:0},Sr={key:0},Cr={key:1,class:"error--text"},Er={key:1},Tr={key:2},Rr={key:1},Ir={key:1},Ar={key:0,class:"text-h2"},Mr={key:1,class:"text-h3"},Nr={key:2,class:"text-h4"},$r={key:3},Dr={key:4},Lr={key:5},Or={key:2},Pr={key:3,class:"text-h5"},Br={key:0},zr=["href","title"],Ur={key:5},jr={key:6},Fr={key:7},qr=["src","alt"],Vr={key:9},Hr={key:10},Zr={key:11},Kr=["align"],Gr=["innerHTML"],Wr=["innerHTML"],Qr={key:16},Yr={key:17},Jr={key:18},Xr=/* @__PURE__ */ie(/* @__PURE__ */n({__name:"MdTokenRenderer",props:{token:{type:Object,required:!0},last:{type:Boolean,required:!1,default:!1}},setup(e,{expose:t}){const n=D("markdownComponents",{}),l={fillIn:R(xn),...n};function h(e){return Ds(e)}function p(e){return $s(e)}function g(e){return Ms(e)}function b(e){return Ns(e)}function y(e){let t="";"text"in e&&"string"==typeof e.text?t=e.text:"raw"in e&&"string"==typeof e.raw&&(t=e.raw);const n=Ls(t);return n?{is:n.componentName,text:"",props:n.props}:{is:"fillIn",text:t,props:{}}}function k(e){const t=l[e];return t||(console.warn(`[MarkdownRenderer] Unknown component: "${e}". Available components: ${Object.keys(l).join(", ")}`),null)}function w(e){return e.replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}function v(e){return void 0===e.inLink&&"text"===e.type}return t({isComponent:h,containsComponent:p,splitTextToken:g,splitParagraphToken:b,parsedComponent:y,decodeBasicEntities:w,isText:v,components:l,getComponent:k}),(t,n)=>{const l=d("md-token-renderer",!0);return v(e.token)?(r(),s("span",xr,[e.token.tokens&&0!==e.token.tokens.length?e.token.tokens&&0!==e.token.tokens.length?(r(),s("span",Rr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0):(r(),s("span",_r,[h(e.token)?(r(),s("span",Sr,[!e.last&&k(y(e.token).is)?(r(),u(E(k(y(e.token).is)),f({key:0,text:y(e.token).text},y(e.token).props),null,16,["text"])):e.last||k(y(e.token).is)?i("",!0):(r(),s("span",Cr," [Unknown component: "+c(y(e.token).is)+"] ",1))])):p(e.token)?(r(),s("span",Er,[(r(!0),s(a,null,o(g(e.token),((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):(r(),s("span",Tr,c(w(e.token.text)),1))]))])):"heading"===e.token.type?(r(),s("span",Ir,[1===e.token.depth?(r(),s("h1",Ar,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):2===e.token.depth?(r(),s("h2",Mr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):3===e.token.depth?(r(),s("h3",Nr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):4===e.token.depth?(r(),s("h4",$r,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):5===e.token.depth?(r(),s("h5",Dr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):6===e.token.depth?(r(),s("h6",Lr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0)])):"strong"===e.token.type?(r(),s("strong",Or,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"paragraph"===e.token.type?(r(),s("p",Pr,[p(e.token)?(r(),s("span",Br,[(r(!0),s(a,null,o(b(e.token),((t,n)=>(r(),u(l,{key:n,token:t,last:e.last&&1===e.token.tokens.length&&n===b(e.token).length-1},null,8,["token","last"])))),128))])):(r(!0),s(a,{key:1},o(e.token.tokens,((t,n)=>(r(),u(l,{key:n,token:t,last:e.last&&1===e.token.tokens.length},null,8,["token","last"])))),128))])):"link"===e.token.type?(r(),s("a",{key:4,href:e.token.href,title:e.token.title},[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))],8,zr)):"list"===e.token.type&&!1===e.token.ordered?(r(),s("ul",Ur,[(r(!0),s(a,null,o(e.token.items,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"list"===e.token.type&&!0===e.token.ordered?(r(),s("ol",jr,[(r(!0),s(a,null,o(e.token.items,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"list_item"===e.token.type?(r(),s("li",Fr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"image"===e.token.type?(r(),s("img",{key:8,src:e.token.href,alt:e.token.title},null,8,qr)):"hr"===e.token.type?(r(),s("hr",Vr)):"br"===e.token.type?(r(),s("br",Hr)):"del"===e.token.type?(r(),s("del",Zr)):"table"===e.token.type?(r(),s("table",{key:12,align:e.token.align},[m("thead",null,[(r(!0),s(a,null,o(e.token.header,((e,t)=>(r(),s("th",{key:t},c(e.text),1)))),128))]),m("tbody",null,[(r(!0),s(a,null,o(e.token.rows,((e,t)=>(r(),s("tr",{key:t},[(r(!0),s(a,null,o(e,((e,t)=>(r(),s("td",{key:t},c(e.text),1)))),128))])))),128))])],8,Kr)):"html"===e.token.type?(r(),s("span",{key:13,innerHTML:e.token.raw},null,8,Gr)):"code"===e.token.type?(r(),u(vr,{key:14,code:e.token.text,language:e.token.lang},null,8,["code","language"])):"codespan"===e.token.type?(r(),s("code",{key:15,class:"codespan",innerHTML:e.token.text},null,8,Wr)):"blockquote"===e.token.type?(r(),s("blockquote",Qr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"escape"===e.token.type?(r(),s("span",Yr,c(e.token.text),1)):"em"===e.token.type?(r(),s("em",Jr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0)}}}),[["__scopeId","data-v-de3eebd6"]]);const ei=/* @__PURE__ */ie(n({name:"MarkdownRenderer",components:{MdTokenRenderer:Xr,AudioAutoPlayer:Bs},props:{md:{type:String,required:!0}},computed:{tokens(){return Is(this.md)}}}),[["render",function(e,t,n,l,c,h){const p=d("md-token-renderer"),g=d("audio-auto-player");return r(),s("div",null,[(r(!0),s(a,null,o(e.tokens,((t,n)=>(r(),s("span",{key:n},[t.type?(r(),u(p,{key:0,token:t,last:n===e.tokens.length-1},null,8,["token","last"])):t.audio?(r(),u(g,{key:1,src:t.audio},null,8,["src"])):i("",!0)])))),128))])}]]),ti=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ei},Symbol.toStringTag,{value:"Module"}));async function ni(){const e=si();if(!e.onLoadComplete){let t=200;const n=50;for(;!e.onLoadComplete&&t>0;)await new Promise((e=>setTimeout(e,n))),t--;if(!e.onLoadComplete)throw new Error("User initialization timed out")}return Y().getUserDB()}const si=()=>{const e=sn();return e&&ee(e),X("auth",{state:()=>({_user:void 0,loginAndRegistration:{init:!1,loggedIn:!1,regDialogOpen:!1,loginDialogOpen:!1},onLoadComplete:!1}),actions:{async init(){try{this._user=Y().getUserDB(),this.loginAndRegistration.loggedIn=!!this._user&&this._user.isLoggedIn(),this.onLoadComplete=!0,this.loginAndRegistration.init=!0}catch(e){console.error("Failed to initialize auth store:",e),this.loginAndRegistration.loggedIn=!1,this.onLoadComplete=!0,this.loginAndRegistration.init=!0}},setLoginDialog(e){this.loginAndRegistration.loginDialogOpen=e},setRegDialog(e){this.loginAndRegistration.regDialogOpen=e},async resetUserData(){try{if(!this._user)throw new Error("No user available for data reset");const e=await this._user.resetUserData();if("ok"!==e.status)throw new Error(e.error||"Reset failed");return console.log("User data reset successfully"),e}catch(e){throw console.error("Failed to reset user data:",e),e}}},getters:{currentUser:async()=>ni(),isLoggedIn:e=>e.loginAndRegistration.loggedIn,isInitialized:e=>e.loginAndRegistration.init,status:e=>({loggedIn:e.loginAndRegistration.loggedIn,init:e.loginAndRegistration.init,user:e._user})}})()},ri=()=>{const e=sn();return e&&ee(e),X("config",{state:()=>({config:{darkMode:!1,likesConfetti:!1,sessionTimeLimit:5}}),actions:{updateConfig(e){this.config=e},async updateDarkMode(e){this.config.darkMode=e;const t=await ni();t&&await t.setConfig({darkMode:e})},async updateLikesConfetti(e){this.config.likesConfetti=e;const t=await ni();t&&await t.setConfig({likesConfetti:e})},async updateSessionTimeLimit(e){this.config.sessionTimeLimit=e;const t=await ni();t&&await t.setConfig({sessionTimeLimit:e})},async hydrate(){try{const e=await ni();if(e){const t=await e.getConfig();console.log(`user config: ${JSON.stringify(t)}`),this.updateConfig(t)}else console.log("No user logged in, using default config")}catch(e){console.warn("Failed to hydrate config store, using defaults:",e)}},async init(){await this.hydrate()},resetDefaults(){this.config={darkMode:!1,likesConfetti:!1,sessionTimeLimit:5}}}})()};function ii(){const e=b(!0),t=b(!1),n=b(!1);return{config:y((()=>n.value?{showLoginRegistration:!1,showLogout:!1,showResetData:!0,logoutLabel:"",resetLabel:"Reset User Data"}:{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""})),isLoading:e,syncStrategyDetected:t,isLocalOnlyMode:n,detectSyncStrategy:async()=>{try{e.value=!0;const s=await ni(),r=s.syncStrategy?.canCreateAccount?.();n.value=!r,t.value=!0}catch(s){console.error("Failed to detect sync strategy:",s),n.value=!1,t.value=!0}finally{e.value=!1}}}}const ai=/* @__PURE__ */ie(/* @__PURE__ */n({__name:"UserChip",props:{showLoginButton:{type:Boolean},redirectToPath:{}},setup(e){const t=te(),n=si(),l=ri(),k=ii(),v=b(""),x=b([]),_=b(!1),S=b(""),E=y((()=>"reset"===S.value)),T=()=>{S.value="",_.value=!1},R=y((()=>x.value.length>0)),I=y((()=>k.config.value||{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""}));w((async()=>{const e=await ni();v.value=e.getUsername(),await k.detectSyncStrategy()}));const A=async()=>{t.push(`/u/${(await ni()).getUsername()}`)},M=async()=>{t.push(`/u/${(await ni()).getUsername()}/stats`)},N=async()=>{(await n._user.logout()).ok&&(n.loginAndRegistration={init:!0,loggedIn:!1,regDialogOpen:!1,loginDialogOpen:!1},l.resetDefaults(),t.push("/home"))},$=async()=>{try{await n.resetUserData(),l.resetDefaults(),T(),t.push("/home")}catch(e){console.error("Failed to reset user data:",e)}};return(e,t)=>{const n=d("v-icon"),l=d("v-avatar"),b=d("v-chip"),y=d("v-list-item-title"),k=d("v-list-item"),w=d("v-divider"),D=d("v-list"),L=d("v-menu"),O=d("v-badge"),P=d("v-card-title"),B=d("v-text-field"),z=d("v-card-text"),U=d("v-spacer"),j=d("v-btn"),F=d("v-card-actions"),q=d("v-card"),V=d("v-dialog");return r(),s(a,null,[p(O,{content:x.value.length,"model-value":R.value,color:"accent",location:"end top"},{default:h((()=>[p(L,{location:"bottom end",transition:"scale-transition"},{activator:h((({props:e})=>[p(b,f(e,{class:"ma-2"}),{default:h((()=>[p(l,{start:"",class:"bg-primary"},{default:h((()=>[p(n,null,{default:h((()=>t[4]||(t[4]=[g("mdi-school")]))),_:1})])),_:1}),g(" "+c(v.value),1)])),_:2},1040)])),default:h((()=>[p(D,null,{default:h((()=>[(r(!0),s(a,null,o(x.value,(e=>(r(),u(k,{key:e,onClick:t=>(e=>{const t=x.value.indexOf(e);x.value.splice(t,1)})(e)},{default:h((()=>[p(y,null,{default:h((()=>[g(c(e),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),x.value.length?(r(),u(w,{key:0})):i("",!0),p(k,{onClick:M},{prepend:h((()=>[p(n,null,{default:h((()=>t[5]||(t[5]=[g("mdi-trending-up")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>t[6]||(t[6]=[g("Stats")]))),_:1})])),_:1}),p(k,{onClick:A},{prepend:h((()=>[p(n,null,{default:h((()=>t[7]||(t[7]=[g("mdi-cog")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>t[8]||(t[8]=[g("Settings")]))),_:1})])),_:1}),I.value.showLogout?(r(),u(k,{key:1,onClick:N},{prepend:h((()=>[p(n,null,{default:h((()=>t[9]||(t[9]=[g("mdi-logout")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>[g(c(I.value.logoutLabel),1)])),_:1})])),_:1})):i("",!0),I.value.showResetData?(r(),u(k,{key:2,onClick:t[0]||(t[0]=e=>_.value=!0)},{prepend:h((()=>[p(n,null,{default:h((()=>t[10]||(t[10]=[g("mdi-delete-sweep")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>[g(c(I.value.resetLabel),1)])),_:1})])),_:1})):i("",!0)])),_:1})])),_:1})])),_:1},8,["content","model-value"]),p(V,{modelValue:_.value,"onUpdate:modelValue":t[3]||(t[3]=e=>_.value=e),"max-width":"500px",persistent:""},{default:h((()=>[p(q,null,{default:h((()=>[p(P,{class:"text-h5 d-flex align-center"},{default:h((()=>[p(n,{color:"warning",class:"mr-3"},{default:h((()=>t[11]||(t[11]=[g("mdi-alert-circle")]))),_:1}),t[12]||(t[12]=g(" Reset All User Data "))])),_:1}),p(z,null,{default:h((()=>[t[13]||(t[13]=m("p",{class:"mb-4"},"This will permanently delete:",-1)),t[14]||(t[14]=m("ul",{class:"mb-4"},[m("li",null,"All course progress and history"),m("li",null,"Scheduled card reviews"),m("li",null,"Course registrations"),m("li",null,"User preferences")],-1)),t[15]||(t[15]=m("p",{class:"mb-4 text-error font-weight-bold"},"This cannot be undone.",-1)),p(B,{modelValue:S.value,"onUpdate:modelValue":t[1]||(t[1]=e=>S.value=e),label:'Type "reset" to confirm',outlined:"",dense:"",onKeyup:t[2]||(t[2]=C((e=>E.value&&$()),["enter"]))},null,8,["modelValue"])])),_:1}),p(F,null,{default:h((()=>[p(U),p(j,{text:"",onClick:T},{default:h((()=>t[16]||(t[16]=[g("Cancel")]))),_:1}),p(j,{color:"error",disabled:!E.value,onClick:$},{default:h((()=>t[17]||(t[17]=[g(" Reset All Data ")]))),_:1},8,["disabled"])])),_:1})])),_:1})])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-9a38a213"]]),oi={class:"d-flex flex-column align-start"},li={class:"mb-2"},ci=/* @__PURE__ */ie(/* @__PURE__ */n({__name:"UserLogin",props:{redirectTo:{default:"/study"}},emits:["toggle","loginSuccess","forgotPassword"],setup(e,{emit:t}){const n=e,s=t,a=te(),o=ne(),l=si(),c=ri(),f=b(""),k=b(""),w=b(!1),v=b(!1),x=b(!1),S=b(7e3),C=b(void 0),E=y((()=>"login"===o.name)),T=y((()=>({color:x.value?"error":"success",text:x.value?"Try again":"Log In"}))),R=async()=>{v.value=!0,F("Starting login attempt"),F(`Login attempt for username: ${f.value}`);try{F("Attempting to get User instance"),C.value=await ni(),F("Got User instance, attempting login"),await C.value.login(f.value,k.value),F("Login successful"),F("Initializing user config"),c.init(),F("User config initialized"),F("Setting authentication state"),l.loginAndRegistration.loggedIn=!0,F(`Authentication state set, redirecting to: ${n.redirectTo}`),s("loginSuccess",n.redirectTo),a.push(n.redirectTo),F("Login and redirect complete")}catch(e){F("Login attempt failed"),F(`Login error details: ${JSON.stringify(e)}`),console.log(`login error: ${JSON.stringify(e)}`),F("Initiating bad login feedback"),x.value=!0,Se({text:"Username or password was incorrect.",status:z.error,timeout:S.value}),setTimeout((()=>{x.value=!1}),S.value)}F("Resetting awaiting response state"),v.value=!1},I=()=>{F("Toggling registration / login forms."),s("toggle")},A=()=>{F("Forgot password clicked"),E.value?a.push("/request-reset"):s("forgotPassword")};return(e,t)=>{const n=d("v-card-title"),s=d("v-text-field"),a=d("v-btn"),o=d("v-snackbar"),l=d("v-icon"),c=d("router-link"),b=d("v-form"),y=d("v-card-text"),C=d("v-card");return r(),u(C,null,{default:h((()=>[E.value?i("",!0):(r(),u(n,{key:0,class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[5]||(t[5]=[g("Log In")]))),_:1})),p(y,null,{default:h((()=>[p(b,{onsubmit:"return false;",onSubmit:L(R,["prevent"])},{default:h((()=>[p(s,{id:"",modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=e=>f.value=e),autofocus:"",name:"username",label:"Username","prepend-icon":"mdi-account-circle"},null,8,["modelValue"]),p(s,{modelValue:k.value,"onUpdate:modelValue":t[1]||(t[1]=e=>k.value=e),"prepend-icon":"mdi-lock",name:"password",hover:"Show password input",label:"Enter your password",hint:"",min:"0","append-icon":w.value?"mdi-eye-off":"mdi-eye",type:w.value?"text":"password","onClick:append":t[2]||(t[2]=()=>w.value=!w.value)},null,8,["modelValue","append-icon","type"]),p(o,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=e=>x.value=e),location:"bottom right",timeout:S.value},{default:h((()=>[t[7]||(t[7]=g(" Username or password was incorrect. ")),p(a,{color:"pink",variant:"text",onClick:t[3]||(t[3]=e=>x.value=!1)},{default:h((()=>t[6]||(t[6]=[g("Close")]))),_:1})])),_:1},8,["modelValue","timeout"]),m("div",oi,[m("div",li,[p(a,{class:"mr-2",type:"submit",loading:v.value,color:T.value.color},{default:h((()=>[p(l,{start:""},{default:h((()=>t[8]||(t[8]=[g("mdi-lock-open")]))),_:1}),t[9]||(t[9]=g(" Log In "))])),_:1},8,["loading","color"]),E.value?(r(),u(c,{key:0,to:"signup"},{default:h((()=>[p(a,{variant:"text"},{default:h((()=>t[10]||(t[10]=[g("Create New Account")]))),_:1})])),_:1})):(r(),u(a,{key:1,variant:"text",onClick:I},{default:h((()=>t[11]||(t[11]=[g("Create New Account")]))),_:1}))]),_(e.$slots,"forgot-password",{},(()=>[m("a",{href:"#",class:"text-caption text-decoration-none",onClick:L(A,["prevent"])}," Forgot password? ")]),!0)])])),_:3})])),_:3})])),_:3})}}}),[["__scopeId","data-v-563b0048"]]);function di(e){if(!e)return"";if(e.length<6)return"Password must be at least 6 characters";return new Set(e).size<2?"Password must contain at least 2 different characters":""}function ui(e){return""===di(e)}const hi=/* @__PURE__ */ie(n({name:"UserRegistration",props:{onSignupSuccess:{type:Function,required:!1}},emits:["toggle","signup-success"],data:()=>({email:"",username:"",password:"",retypedPassword:"",passwordVisible:!1,emailError:!1,emailHint:"",usernameValidationInProgress:!1,usernameError:!1,usernameHint:"",awaitingResponse:!1,badLoginAttempt:!1,userSecret:"",secret:"goons",user:null,roles:["Student","Teacher","Author"],student:!0,teacher:!1,author:!1,authStore:si()}),computed:{registrationRoute(){return"string"==typeof this.$route.name&&"signup"===this.$route.name.toLowerCase()},buttonStatus(){return{color:this.badLoginAttempt?"error":"success",text:this.badLoginAttempt?"Try again":"Log In"}},passwordError(){return di(this.password)},passwordRetypeError(){return console.log("[RTE]"),this.password!==this.retypedPassword?"Passwords must match.":""}},async created(){this.user=await ni()},methods:{toggle(){F("Toggling registration / login forms."),this.$emit("toggle")},validateEmail(){this.emailError=!1;this.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email)?(this.emailError=!0,this.emailHint="Please enter a valid email address"):this.emailHint=""},validateUsername(){this.usernameError=!1},async createUser(){if(this.awaitingResponse=!0,this.passwordError)return Se({text:this.passwordError,status:z.error}),void(this.awaitingResponse=!1);if(F(`\nUser creation\n-------------\n\nName: ${this.username}\nStudent: ${this.student}\nTeacher: ${this.teacher}\nAuthor: ${this.author}\n`),this.password===this.retypedPassword){if(!this.user)return void console.error("ERROR: No user object available");this.user.createAccount(this.username,this.password).then((async e=>{if(e.status===z.ok){if(this.authStore.loginAndRegistration.loggedIn=!0,this.authStore.loginAndRegistration.init=!1,this.authStore.loginAndRegistration.init=!0,this.email)try{const e=await ni();await e.setConfig({email:this.email});const t="undefined"!=typeof window?window.location.origin:void 0,n=await Je(this.username,this.email,t);n.ok?Se({text:"Account created! Please check your email to verify your account.",status:z.ok}):F(`Warning: Failed to send verification email: ${n.error}`)}catch(t){console.error("Email save/send error:",t),F(`Warning: Failed to save email or send verification: ${t}`)}this.onSignupSuccess&&(console.log("[UserRegistration] Calling onSignupSuccess callback"),this.onSignupSuccess({username:this.username})),this.$emit("signup-success",{username:this.username})}else"This username is taken!"===e.error?(this.usernameError=!0,this.usernameHint="Try a different name.",this.$refs.userNameTextField.focus(),Se({text:`The name ${this.username} is taken!`,status:e.status})):Se({text:e.error,status:e.status})})).catch((e=>{if(console.error("[UserRegistration] .catch() called with error:",e),e){const t=e?.message||e?.error||e?.toString()||"Account creation failed";Se({text:t,status:z.error})}})),this.awaitingResponse=!1}else Se({text:"Passwords do not match.",status:z.error}),this.awaitingResponse=!1}}}),[["render",function(e,t,n,s,i,a){const o=d("v-card-title"),l=d("v-text-field"),c=d("v-btn"),m=d("v-snackbar"),f=d("v-icon"),b=d("router-link"),y=d("v-form"),k=d("v-card-text"),w=d("v-card");return r(),u(w,null,{default:h((()=>[p(o,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[7]||(t[7]=[g(" Create an Account ")]))),_:1}),p(k,null,{default:h((()=>[p(y,{onSubmit:L(e.createUser,["prevent"])},{default:h((()=>[p(l,{modelValue:e.email,"onUpdate:modelValue":t[0]||(t[0]=t=>e.email=t),name:"email",label:"Email address",type:"email","prepend-icon":"mdi-email",error:e.emailError,hint:e.emailHint,onBlur:e.validateEmail},null,8,["modelValue","error","hint","onBlur"]),p(l,{id:"",ref:"userNameTextField",modelValue:e.username,"onUpdate:modelValue":t[1]||(t[1]=t=>e.username=t),name:"username",label:"Choose a Username","prepend-icon":"mdi-account-circle",error:e.usernameError,hint:e.usernameHint,onBlur:e.validateUsername},null,8,["modelValue","error","hint","onBlur"]),p(l,{modelValue:e.password,"onUpdate:modelValue":t[2]||(t[2]=t=>e.password=t),"prepend-icon":"mdi-lock",name:"password",hover:"Show password",label:"Create a password",hint:e.passwordError,error:!!e.passwordError,min:"4","append-icon":e.passwordVisible?"mdi-eye-off":"mdi-eye",type:e.passwordVisible?"text":"password","onClick:append":t[3]||(t[3]=()=>e.passwordVisible=!e.passwordVisible)},null,8,["modelValue","hint","error","append-icon","type"]),p(l,{modelValue:e.retypedPassword,"onUpdate:modelValue":t[4]||(t[4]=t=>e.retypedPassword=t),"prepend-icon":"mdi-lock",name:"retypedPassword",hover:"Show password",label:"Retype your password",disabled:""===e.password||!!e.passwordError,hint:e.passwordRetypeError,min:"4",type:e.passwordVisible?"text":"password"},null,8,["modelValue","disabled","hint","type"]),p(m,{modelValue:e.badLoginAttempt,"onUpdate:modelValue":t[6]||(t[6]=t=>e.badLoginAttempt=t),location:"bottom right",timeout:5e3},{default:h((()=>[t[9]||(t[9]=g(" Username or password was incorrect. ")),p(c,{color:"pink",variant:"text",onClick:t[5]||(t[5]=t=>e.badLoginAttempt=!1)},{default:h((()=>t[8]||(t[8]=[g(" Close ")]))),_:1})])),_:1},8,["modelValue"]),p(c,{class:"mr-2 my-2",type:"submit",loading:e.awaitingResponse,color:e.buttonStatus.color,disabled:!!e.passwordError||e.password!==e.retypedPassword},{default:h((()=>[p(f,{start:""},{default:h((()=>t[10]||(t[10]=[g("mdi-lock-open")]))),_:1}),t[11]||(t[11]=g(" Create Account "))])),_:1},8,["loading","color","disabled"]),e.registrationRoute?(r(),u(b,{key:0,to:"login"},{default:h((()=>[p(c,{variant:"text"},{default:h((()=>t[12]||(t[12]=[g("Log In")]))),_:1})])),_:1})):(r(),u(c,{key:1,variant:"text",onClick:e.toggle},{default:h((()=>t[13]||(t[13]=[g(" Log In ")]))),_:1},8,["onClick"]))])),_:1},8,["onSubmit"])])),_:1})])),_:1})}]]),pi=n({name:"RequestPasswordReset",emits:["cancel","success"],data:()=>({email:"",emailError:!1,emailHint:"",isSubmitting:!1,requestSent:!1}),methods:{validateEmail(){if(this.emailError=!1,this.emailHint="",!this.email)return;/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email)||(this.emailError=!0,this.emailHint="Please enter a valid email address")},async handleSubmit(){if(this.validateEmail(),!this.emailError&&this.email){this.isSubmitting=!0;try{const e="undefined"!=typeof window?window.location.origin:void 0,t=await tt(this.email,e);t.ok?(this.requestSent=!0,this.$emit("success",this.email)):Se({text:t.error||"Failed to send reset email",status:z.error})}catch(e){Se({text:"An unexpected error occurred",status:z.error})}finally{this.isSubmitting=!1}}}}}),gi={key:1,class:"text-center"};const mi=/* @__PURE__ */ie(pi,[["render",function(e,t,n,a,o,l){const f=d("v-card-title"),b=d("v-text-field"),y=d("v-icon"),k=d("v-btn"),w=d("v-form"),v=d("v-card-text"),x=d("v-spacer"),S=d("v-card-actions"),C=d("v-card");return r(),u(C,null,{default:h((()=>[p(f,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[2]||(t[2]=[g(" Reset Password ")]))),_:1}),p(v,{class:"pa-6"},{default:h((()=>[e.requestSent?(r(),s("div",gi,[p(y,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[6]||(t[6]=[g("mdi-email-check")]))),_:1}),t[9]||(t[9]=m("h3",{class:"mb-2"},"Check Your Email",-1)),m("p",null,[t[7]||(t[7]=g(" If an account exists with ")),m("strong",null,c(e.email),1),t[8]||(t[8]=g(", you will receive a password reset link shortly. "))]),t[10]||(t[10]=m("p",{class:"text-caption mt-4"},"Didn't receive an email? Check your spam folder.",-1))])):(r(),u(w,{key:0,onSubmit:L(e.handleSubmit,["prevent"])},{default:h((()=>[t[5]||(t[5]=m("p",{class:"mb-4"}," Enter your email address and we'll send you a link to reset your password. ",-1)),p(b,{modelValue:e.email,"onUpdate:modelValue":t[0]||(t[0]=t=>e.email=t),name:"email",label:"Email address",type:"email","prepend-icon":"mdi-email",error:e.emailError,hint:e.emailHint,disabled:e.isSubmitting,onBlur:e.validateEmail},null,8,["modelValue","error","hint","disabled","onBlur"]),p(k,{type:"submit",color:"primary",class:"mt-4",loading:e.isSubmitting,disabled:!e.email||e.emailError,block:""},{default:h((()=>[p(y,{start:""},{default:h((()=>t[3]||(t[3]=[g("mdi-email-send")]))),_:1}),t[4]||(t[4]=g(" Send Reset Link "))])),_:1},8,["loading","disabled"])])),_:1},8,["onSubmit"]))])),_:1}),e.requestSent?i("",!0):(r(),u(S,{key:0},{default:h((()=>[_(e.$slots,"back-action",{},(()=>[p(k,{variant:"text",onClick:t[1]||(t[1]=t=>e.$emit("cancel"))},{default:h((()=>t[11]||(t[11]=[g(" Cancel ")]))),_:1})])),p(x)])),_:3}))])),_:3})}]]),fi={key:0},bi={key:"login-buttons"},yi={key:"user-chip"},ki=/* @__PURE__ */ie(/* @__PURE__ */n({__name:"UserLoginAndRegistrationContainer",props:{showLoginButton:{type:Boolean},redirectToPath:{},showRegistration:{type:Boolean},onSignupSuccess:{type:Function}},emits:["signup-success"],setup(e,{emit:t}){const n=e,a=t,o=ne(),l=si(),c=ii();w((async()=>{await c.detectSyncStrategy()}));const m=y((()=>{if(!o.name||"string"!=typeof o.name)return!0;const e=o.name.toLowerCase();return!("login"===e||"signup"===e)})),k=y((()=>l.onLoadComplete)),v=y((()=>l._user?l._user.getUsername().startsWith(J):!l.loginAndRegistration.loggedIn)),x=y((()=>({...c.config.value||{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""},...void 0!==n.showRegistration&&{showLoginRegistration:n.showRegistration}}))),_=y({get:()=>l.loginAndRegistration.regDialogOpen,set:e=>{l.loginAndRegistration.regDialogOpen=e}}),C=y({get:()=>l.loginAndRegistration.loginDialogOpen,set:e=>{l.loginAndRegistration.loginDialogOpen=e}}),E=b(!1),T=()=>{if(_.value&&C.value)throw new Error("Registration / Login dialogs both activated.");if(_.value===C.value)throw new Error("Registration / Login dialogs toggled while both were dormant.");_.value=!_.value,C.value=!C.value},R=()=>{C.value=!1,E.value=!0},I=()=>{E.value=!1},A=e=>{_.value=!1,n.onSignupSuccess&&n.onSignupSuccess(e),a("signup-success",e)};return(e,t)=>{const n=d("v-btn"),a=d("v-dialog");return k.value&&m.value?(r(),s("div",fi,[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[v.value?(r(),s("div",bi,[x.value.showLoginRegistration?(r(),u(a,{key:0,modelValue:_.value,"onUpdate:modelValue":t[0]||(t[0]=e=>_.value=e),width:"500px"},{activator:h((({props:e})=>[p(n,f({class:"mr-2",size:"small",color:"success"},e),{default:h((()=>t[3]||(t[3]=[g("Sign Up")]))),_:2},1040)])),default:h((()=>[p(hi,{onToggle:T,onSignupSuccess:A,"on-signup-success":A})])),_:1},8,["modelValue"])):i("",!0),p(a,{modelValue:C.value,"onUpdate:modelValue":t[1]||(t[1]=e=>C.value=e),width:"500px"},{activator:h((({props:e})=>[p(n,f({size:"small",color:"success"},e),{default:h((()=>t[4]||(t[4]=[g("Log In")]))),_:2},1040)])),default:h((()=>[p(ci,{onToggle:T,onForgotPassword:R})])),_:1},8,["modelValue"]),p(a,{modelValue:E.value,"onUpdate:modelValue":t[2]||(t[2]=e=>E.value=e),width:"500px"},{default:h((()=>[p(mi,{onCancel:I,onSuccess:I})])),_:1},8,["modelValue"])])):(r(),s("div",yi,[p(ai)]))])),_:1})])):i("",!0)}}}),[["__scopeId","data-v-5a55bdf0"]]),wi=n({name:"VerifyEmail",emits:["verified","error"],props:{token:{type:String,default:null}},data:()=>({isVerifying:!1,verificationStatus:null,errorMessage:"",username:""}),async mounted(){await this.performVerification()},methods:{async performVerification(){const e=this.token||this.getTokenFromURL();if(!e)return this.verificationStatus="error",void(this.errorMessage="No verification token provided");this.isVerifying=!0;try{const t=await Xe(e);t.ok?(this.verificationStatus="success",this.username=t.username||"",Se({text:"Email verified successfully!",status:z.ok})):(this.verificationStatus="error",this.errorMessage=t.error||"Verification failed",Se({text:t.error||"Verification failed",status:z.error}))}catch(t){this.verificationStatus="error",this.errorMessage="An unexpected error occurred",Se({text:"An unexpected error occurred",status:z.error})}finally{this.isVerifying=!1}},getTokenFromURL(){if("undefined"==typeof window)return null;return new URLSearchParams(window.location.search).get("token")}}}),vi={key:0,class:"text-center"},xi={key:1,class:"text-center"},_i={key:0},Si={key:2,class:"text-center"},Ci={key:3,class:"text-center"};const Ei=/* @__PURE__ */ie(wi,[["render",function(e,t,n,a,o,l){const f=d("v-card-title"),b=d("v-progress-circular"),y=d("v-icon"),k=d("v-card-text"),w=d("v-spacer"),v=d("v-btn"),x=d("v-card-actions"),S=d("v-card"),C=d("v-col"),E=d("v-row"),T=d("v-container");return r(),u(T,{class:"fill-height",fluid:""},{default:h((()=>[p(E,{align:"center",justify:"center"},{default:h((()=>[p(C,{cols:"12",sm:"8",md:"6"},{default:h((()=>[p(S,null,{default:h((()=>[p(f,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[2]||(t[2]=[g(" Email Verification ")]))),_:1}),p(k,{class:"pa-6"},{default:h((()=>[e.isVerifying?(r(),s("div",vi,[p(b,{indeterminate:"",color:"primary",size:"64",class:"mb-4"}),t[3]||(t[3]=m("p",null,"Verifying your email...",-1))])):"success"===e.verificationStatus?(r(),s("div",xi,[p(y,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[4]||(t[4]=[g("mdi-check-circle")]))),_:1}),t[5]||(t[5]=m("h3",{class:"mb-2"},"Email Verified!",-1)),t[6]||(t[6]=m("p",null,"Your account has been successfully verified.",-1)),e.username?(r(),s("p",_i,"Welcome, "+c(e.username)+"!",1)):i("",!0)])):"error"===e.verificationStatus?(r(),s("div",Si,[p(y,{color:"error",size:"64",class:"mb-4"},{default:h((()=>t[7]||(t[7]=[g("mdi-alert-circle")]))),_:1}),t[8]||(t[8]=m("h3",{class:"mb-2"},"Verification Failed",-1)),m("p",null,c(e.errorMessage),1)])):(r(),s("div",Ci,[p(y,{color:"warning",size:"64",class:"mb-4"},{default:h((()=>t[9]||(t[9]=[g("mdi-help-circle")]))),_:1}),t[10]||(t[10]=m("h3",{class:"mb-2"},"No Verification Token",-1)),t[11]||(t[11]=m("p",null,"Please use the link from your verification email.",-1))]))])),_:1}),p(x,null,{default:h((()=>[p(w),_(e.$slots,"actions",{status:e.verificationStatus,username:e.username},(()=>["success"===e.verificationStatus?(r(),u(v,{key:0,color:"primary",onClick:t[0]||(t[0]=t=>e.$emit("verified",e.username))},{default:h((()=>t[12]||(t[12]=[g(" Continue ")]))),_:1})):"error"===e.verificationStatus?(r(),u(v,{key:1,variant:"text",onClick:t[1]||(t[1]=t=>e.$emit("error",e.errorMessage))},{default:h((()=>t[13]||(t[13]=[g(" Close ")]))),_:1})):i("",!0)]))])),_:3})])),_:3})])),_:3})])),_:3})])),_:3})}]]),Ti=n({name:"ResetPassword",emits:["complete","error"],props:{token:{type:String,default:null}},data:()=>({password:"",confirmPassword:"",passwordVisible:!1,confirmPasswordError:!1,confirmPasswordHint:"",isSubmitting:!1,isComplete:!1}),computed:{canSubmit(){return this.password.length>=4&&this.confirmPassword.length>=4&&this.password===this.confirmPassword&&!this.confirmPasswordError}},methods:{validateConfirmPassword(){this.confirmPasswordError=!1,this.confirmPasswordHint="",this.confirmPassword&&this.password!==this.confirmPassword&&(this.confirmPasswordError=!0,this.confirmPasswordHint="Passwords do not match")},async handleSubmit(){if(this.validateConfirmPassword(),!this.canSubmit)return;const e=this.token||this.getTokenFromURL();if(!e)return Se({text:"No reset token provided. Please use the link from your email.",status:z.error}),void this.$emit("error","No token");this.isSubmitting=!0;try{const t=await nt(e,this.password);t.ok?(this.isComplete=!0,Se({text:"Password reset successfully!",status:z.ok})):(Se({text:t.error||"Failed to reset password",status:z.error}),this.$emit("error",t.error))}catch(t){Se({text:"An unexpected error occurred",status:z.error}),this.$emit("error","Unexpected error")}finally{this.isSubmitting=!1}},getTokenFromURL(){if("undefined"==typeof window)return null;return new URLSearchParams(window.location.search).get("token")}}}),Ri={key:1,class:"text-center"};const Ii=/* @__PURE__ */ie(Ti,[["render",function(e,t,n,a,o,l){const c=d("v-card-title"),f=d("v-text-field"),b=d("v-icon"),y=d("v-btn"),k=d("v-form"),w=d("v-card-text"),v=d("v-spacer"),x=d("v-card-actions"),S=d("v-card"),C=d("v-col"),E=d("v-row"),T=d("v-container");return r(),u(T,{class:"fill-height",fluid:""},{default:h((()=>[p(E,{align:"center",justify:"center"},{default:h((()=>[p(C,{cols:"12",sm:"8",md:"6"},{default:h((()=>[p(S,null,{default:h((()=>[p(c,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[4]||(t[4]=[g(" Set New Password ")]))),_:1}),p(w,{class:"pa-6"},{default:h((()=>[e.isComplete?(r(),s("div",Ri,[p(b,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[8]||(t[8]=[g("mdi-check-circle")]))),_:1}),t[9]||(t[9]=m("h3",{class:"mb-2"},"Password Reset Successful!",-1)),t[10]||(t[10]=m("p",null,"Your password has been updated. You can now log in with your new password.",-1))])):(r(),u(k,{key:0,onSubmit:L(e.handleSubmit,["prevent"])},{default:h((()=>[t[7]||(t[7]=m("p",{class:"mb-4"},"Enter your new password below.",-1)),p(f,{modelValue:e.password,"onUpdate:modelValue":t[0]||(t[0]=t=>e.password=t),"prepend-icon":"mdi-lock",name:"password",label:"New password",min:"4","append-icon":e.passwordVisible?"mdi-eye-off":"mdi-eye",type:e.passwordVisible?"text":"password",disabled:e.isSubmitting,"onClick:append":t[1]||(t[1]=()=>e.passwordVisible=!e.passwordVisible)},null,8,["modelValue","append-icon","type","disabled"]),p(f,{modelValue:e.confirmPassword,"onUpdate:modelValue":t[2]||(t[2]=t=>e.confirmPassword=t),"prepend-icon":"mdi-lock",name:"confirmPassword",label:"Confirm new password",min:"4",type:e.passwordVisible?"text":"password",error:e.confirmPasswordError,hint:e.confirmPasswordHint,disabled:e.isSubmitting,onBlur:e.validateConfirmPassword},null,8,["modelValue","type","error","hint","disabled","onBlur"]),p(y,{type:"submit",color:"primary",class:"mt-4",loading:e.isSubmitting,disabled:!e.canSubmit,block:""},{default:h((()=>[p(b,{start:""},{default:h((()=>t[5]||(t[5]=[g("mdi-lock-reset")]))),_:1}),t[6]||(t[6]=g(" Reset Password "))])),_:1},8,["loading","disabled"])])),_:1},8,["onSubmit"]))])),_:1}),e.isComplete?(r(),u(x,{key:0},{default:h((()=>[p(v),_(e.$slots,"success-action",{},(()=>[p(y,{color:"primary",onClick:t[3]||(t[3]=t=>e.$emit("complete"))},{default:h((()=>t[11]||(t[11]=[g(" Continue to Login ")]))),_:1})]))])),_:3})):i("",!0)])),_:3})])),_:3})])),_:3})])),_:3})}]]),Ai=n({name:"SkTagsInput",components:{VueTagsInput:se},props:{courseID:{type:String,required:!0,default:""},cardID:{type:String,required:!1,default:""},hideSubmit:{type:Boolean,required:!1,default:!1}},data:()=>({loading:!0,tag:"",tags:[],initialTags:[],availableCourseTags:[],separators:[";",","," "],courseDB:null}),computed:{autoCompleteSuggestions(){return this.availableCourseTags.filter((e=>-1!==e.name.toLowerCase().indexOf(this.tag.toLowerCase()))).map((e=>({text:e.name,data:{snippet:e.snippet}})))}},watch:{async cardID(){await this.getAppliedTags()},async courseID(){this.courseDB=Y().getCourseDB(this.courseID),await this.updateAvailableCourseTags()}},async created(){this.courseDB=Y().getCourseDB(this.courseID),await this.updateAvailableCourseTags(),await this.getAppliedTags()},methods:{tagsChanged(e){console.log(`[TagsInput] Tags changing: ${JSON.stringify(e)}`),this.tags=e},async getAppliedTags(){this.initialTags=[],this.tags=[];try{(await this.courseDB.getAppliedTags(this.cardID)).rows.forEach((e=>{console.log(`[TagsInput] The following tag is applied:\n\t${JSON.stringify(e)}`),this.tags.push({text:e.value.name,style:"",classes:""})})),this.initialTags=this.tags.map((e=>e.text))}catch(e){console.error(`Error in init-getAppliedTags: ${JSON.stringify(e)}, ${e}`)}finally{this.loading=!1}},async updateAvailableCourseTags(){try{this.availableCourseTags=(await this.courseDB.getCourseTagStubs()).rows.map((e=>e.doc))}catch(e){console.error(`Error in init-availableCourseTags: ${JSON.stringify(e)}`)}},async submit(){console.log("[TagsInput] tagsInput is submitting..."),this.loading=!0;try{await Promise.all(this.tags.map((async e=>{if(!this.initialTags.includes(e.text))try{await this.courseDB.addTagToCard(this.cardID,e.text),console.log(`[TagsInput] Successfully added tag: ${e.text}`)}catch(t){console.error(`Failed to add tag ${e.text}:`,t)}})))}catch(e){console.error(`Exception adding tags: ${JSON.stringify(e)}`)}try{await Promise.all(this.initialTags.map((async e=>{if(0===this.tags.filter((t=>t.text===e)).length)try{await this.courseDB.removeTagFromCard(this.cardID,e),console.log(`[TagsInput] Successfully removed tag: ${e}`)}catch(t){console.error(`Failed to remove tag ${e}:`,t)}})))}catch(e){console.error(`Exception removing tags: ${JSON.stringify(e)}`)}this.loading=!1}}}),Mi={"data-cy":"tags-input"},Ni={class:"tag-name"},$i={key:0,class:"tag-snippet"};const Di=/* @__PURE__ */ie(Ai,[["render",function(e,t,n,a,o,l){const f=d("vue-tags-input"),b=d("v-btn");return r(),s("div",Mi,[p(f,{modelValue:e.tag,"onUpdate:modelValue":t[0]||(t[0]=t=>e.tag=t),tags:e.tags,"autocomplete-items":e.autoCompleteSuggestions,separators:e.separators,"add-on-key":e.separators,onTagsChanged:e.tagsChanged},{"autocomplete-item":h((e=>[m("div",{class:x(["autocomplete-item",{"is-active":e.selected}])},[m("span",Ni,c(e.item.text),1),e.item.data&&e.item.data.snippet?(r(),s("span",$i," - "+c(e.item.data.snippet),1)):i("",!0)],2)])),_:1},8,["modelValue","tags","autocomplete-items","separators","add-on-key","onTagsChanged"]),e.hideSubmit?i("",!0):(r(),u(b,{key:0,color:"success",loading:e.loading,onClick:e.submit},{default:h((()=>t[1]||(t[1]=[g("Save Changes")]))),_:1},8,["loading","onClick"]))])}],["__scopeId","data-v-f7373dc0"]]),Li=n({name:"CourseCardBrowser",components:{CardLoader:_n,TagsInput:Di,PaginatingToolbar:Ae},props:{courseId:{type:String,required:!0},tagId:{type:String,required:!1,default:""},viewLookupFunction:{type:Function,required:!0,default:()=>(console.warn("No viewLookupFunction provided to CourseCardBrowser"),null)},editMode:{type:String,required:!1,default:"full"}},data(){return{courseDB:null,page:1,pages:[],cards:[],cardData:{},cardPreview:{},cardElos:{},cardTags:{},internalEditMode:"none",delBtn:!1,updatePending:!0,userIsRegistered:!1,questionCount:0,tags:[],viewLookup:this.viewLookupFunction}},async created(){try{this.courseDB=Y().getCourseDB(this.courseId),this.tagId?this.questionCount=(await this.courseDB.getTag(this.tagId)).taggedCards.length:this.questionCount=(await this.courseDB.getCourseInfo()).cardCount;for(let e=1;25*(e-1)<this.questionCount;e++)this.pages.push(e);await this.populateTableData()}catch(e){console.error("Error initializing CourseCardBrowser:",e)}finally{this.updatePending=!1}},methods:{idQualify(e){return e.includes("-")?e:`${this.courseId}-${e}`},idToQualifiedObject(e){if(e.includes("-")){const t=e.split("-");return{courseID:t[0],cardID:t[1]}}return{courseID:this.courseId,cardID:e}},first(){this.page=1,this.populateTableData()},prev(){this.page--,this.populateTableData()},next(){this.page++,this.populateTableData()},last(){this.page=this.pages.length,this.populateTableData()},setPage(e){this.page=e,this.populateTableData()},async loadCardTags(e){try{await Promise.all(e.map((async e=>{const t=await this.courseDB.getAppliedTags(e);this.cardTags[e]=t.rows.map((e=>({name:e.value.name,snippet:e.value.snippet,count:e.value.count})))})))}catch(t){console.error("Error loading card tags:",t)}},clearSelections(e=""){this.cards.forEach((t=>{t.card.cardID!==e&&(t.isOpen=!1)})),this.internalEditMode="none",this.delBtn=!1},async deleteCard(e){console.log(`Deleting card ${e}`);const t=await this.courseDB.removeCard(e);t.ok?(this.cards=this.cards.filter((t=>t.card.cardID!=e)),this.clearSelections()):(console.error(`Failed to delete card:\n\n${JSON.stringify(t)}`),Se({text:"Failed to delete card",status:z.error}))},async populateTableData(){if(this.updatePending=!0,this.tagId){const e=await this.courseDB.getTag(this.tagId);this.cards=e.taggedCards.map((e=>({card:{cardID:e,courseID:this.courseId},isOpen:!1,delBtn:!1})))}else this.cards=(await this.courseDB.getCardsByELO(0,25)).map((e=>({card:e,isOpen:!1,delBtn:!1})));const e=[],t=(await this.courseDB.getCourseDocs(this.cards.map((e=>e.card.cardID)),{include_docs:!0})).rows.filter((e=>!!e.doc||(console.error(`Card ${e.id}.doc not found.\ncard: ${JSON.stringify(e)}`),!1))).map((e=>e.doc));this.cards=this.cards.filter((t=>!e.includes(t.card.cardID))),t.forEach((e=>{e&&e.id_displayable_data&&(this.cardData[e._id]=e.id_displayable_data)}));try{await Promise.all(this.cards.map((async e=>{const n=e.card.cardID,s=t.find((e=>e._id==n));if(!s||!s.id_displayable_data)return void console.error(`No valid data found for card ${n}`);const r=this.viewLookupFunction(s.id_view||"default.question.BlanksCard.FillInView"),i=s.id_displayable_data.map((e=>this.courseDB.getCourseDoc(e,{attachments:!1,binary:!0}))),a=await Promise.all(i);await Promise.all(a.map((t=>{[].unshift(q(t)),this.cardPreview[e.card.cardID]=r.name?r.name:"Unknown"})))})));const e=this.cards.map((e=>e.card.cardID)),n=await this.courseDB.getCardEloData(e);e.forEach(((e,t)=>{this.cardElos[e]=n[t]})),await this.loadCardTags(e)}catch(n){console.error("Error populating table data:",n)}finally{this.updatePending=!1,this.$forceUpdate()}}}}),Oi={key:0,class:"d-flex justify-center align-center pa-6"},Pi={key:1},Bi={key:0,class:"px-4 py-2 bg-blue-grey-lighten-5"},zi={key:0,class:"mt-4"},Ui={class:"mt-4"},ji={key:0,class:"ml-4"};const Fi=/* @__PURE__ */ie(Li,[["render",function(e,t,n,l,b,y){const k=d("v-progress-circular"),w=d("paginating-toolbar"),v=d("v-list-item-title"),_=d("v-list-item-subtitle"),S=d("v-btn"),C=d("v-icon"),E=d("v-speed-dial"),T=d("v-list-item"),R=d("card-loader"),I=d("v-chip"),M=d("v-chip-group"),N=d("tags-input"),$=d("v-list"),D=d("v-card");return r(),u(D,null,{default:h((()=>[e.updatePending?(r(),s("div",Oi,[p(k,{indeterminate:"",color:"primary"})])):(r(),s("div",Pi,[p(w,{title:"Exercises",page:e.page,pages:e.pages,subtitle:`(${e.questionCount})`,onFirst:e.first,onPrev:e.prev,onNext:e.next,onLast:e.last,onSetPage:t[0]||(t[0]=t=>e.setPage(t))},null,8,["page","pages","subtitle","onFirst","onPrev","onNext","onLast"]),p($,null,{default:h((()=>[(r(!0),s(a,null,o(e.cards,(n=>(r(),s(a,{key:n.card.cardID},[p(T,{class:x({"bg-blue-grey-lighten-5":n.isOpen,"elevation-4":n.isOpen}),density:"compact","data-cy":"course-card"},{prepend:h((()=>[m("div",null,[p(v,{class:x([{"text-blue-grey-darken-1":n.isOpen},"font-weight-medium"])},{default:h((()=>[g(c(e.cardPreview[n.card.cardID]),1)])),_:2},1032,["class"]),p(_,null,{default:h((()=>[g(" ELO: "+c(e.cardElos[n.card.cardID]?.global?.score||"(unknown)"),1)])),_:2},1024)])])),append:h((()=>[p(E,{modelValue:n.isOpen,"onUpdate:modelValue":e=>n.isOpen=e,location:"left center",transition:"slide-x-transition",style:{display:"flex","flex-direction":"row-reverse"},persistent:""},{activator:h((({props:t})=>[p(S,f({ref_for:!0},t,{icon:n.isOpen?"mdi-close":"mdi-plus",size:"small",variant:"text",onClick:t=>e.clearSelections(n.card.cardID)}),null,16,["icon","onClick"])])),default:h((()=>["full"===e.editMode?(r(),u(S,{key:"tags",icon:"",size:"small",variant:"tags"!==e.internalEditMode?"outlined":"elevated",color:"tags"===e.internalEditMode?"teal":"teal-darken-3",onClick:t[1]||(t[1]=L((t=>e.internalEditMode="tags"),["stop"]))},{default:h((()=>[p(C,null,{default:h((()=>t[4]||(t[4]=[g("mdi-bookmark")]))),_:1})])),_:1},8,["variant","color"])):i("",!0),"full"===e.editMode?(r(),u(S,{key:"flag",icon:"",size:"small",variant:"flag"!==e.internalEditMode?"outlined":"elevated",color:"flag"===e.internalEditMode?"error":"error-darken-3",onClick:t[2]||(t[2]=L((t=>e.internalEditMode="flag"),["stop"]))},{default:h((()=>[p(C,null,{default:h((()=>t[5]||(t[5]=[g("mdi-flag")]))),_:1})])),_:1},8,["variant","color"])):i("",!0)])),_:2},1032,["modelValue","onUpdate:modelValue"])])),_:2},1032,["class"]),n.isOpen?(r(),s("div",Bi,[p(R,{qualified_id:n.card,"view-lookup":e.viewLookup,class:"elevation-1"},null,8,["qualified_id","view-lookup"]),"readonly"===e.editMode&&e.cardTags[n.card.cardID]?(r(),s("div",zi,[p(M,null,{default:h((()=>[(r(!0),s(a,null,o(e.cardTags[n.card.cardID],(e=>(r(),u(I,{key:e.name,size:"small",color:"primary",variant:"outlined"},{default:h((()=>[g(c(e.name),1)])),_:2},1024)))),128))])),_:2},1024)])):i("",!0),A(p(N,{"course-i-d":e.courseId,"card-i-d":n.card.cardID,class:"mt-4"},null,8,["course-i-d","card-i-d"]),[[O,"tags"===e.internalEditMode&&"full"===e.editMode]]),A(m("div",Ui,[p(S,{color:"error",variant:"outlined",onClick:e=>n.delBtn=!0},{default:h((()=>t[6]||(t[6]=[g(" Delete this card ")]))),_:2},1032,["onClick"]),n.delBtn?(r(),s("span",ji,[t[8]||(t[8]=m("span",{class:"mr-2"},"Are you sure?",-1)),p(S,{color:"error",variant:"elevated",onClick:t=>e.deleteCard(n.card.cardID)},{default:h((()=>t[7]||(t[7]=[g(" Confirm ")]))),_:2},1032,["onClick"])])):i("",!0)],512),[[O,"flag"===e.internalEditMode&&"full"===e.editMode]])])):i("",!0)],64)))),128))])),_:1}),p(w,{class:"elevation-0",page:e.page,pages:e.pages,onFirst:e.first,onPrev:e.prev,onNext:e.next,onLast:e.last,onSetPage:t[3]||(t[3]=t=>e.setPage(t))},null,8,["page","pages","onFirst","onPrev","onNext","onLast"])]))])),_:1})}],["__scopeId","data-v-5ecc9d21"]]),qi=n({name:"CourseInformation",components:{CourseCardBrowser:Fi},props:{courseId:{type:String,required:!0},viewLookupFunction:{type:Function,required:!1,default:e=>(console.warn("No viewLookupFunction provided to CourseInformation"),null)},editMode:{type:String,required:!1,default:"full"}},data:()=>({courseDB:null,nameRules:[e=>!(e.length>30)||"Course name must be 30 characters or less"],updatePending:!0,courseConfig:{},userIsRegistered:!1,tags:[],user:null}),computed:{},async created(){this.courseDB=Y().getCourseDB(this.courseId),this.user=await ni();const e=await this.user.getCourseRegistrationsDoc();"admin"===this.user.getUsername()?this.userIsRegistered=!0:this.userIsRegistered=1===e.courses.filter((e=>e.courseID===this.courseId&&("active"===e.status||void 0===e.status))).length,this.courseConfig=await this.courseDB.getCourseConfig(),this.tags=(await this.courseDB.getCourseTagStubs()).rows.map((e=>e.doc)),this.updatePending=!1},methods:{async register(){F(`Registering for ${this.courseId}`);(await this.user.registerForCourse(this.courseId)).ok&&(this.userIsRegistered=!0)},async drop(){F(`Dropping course ${this.courseId}`);(await this.user.dropCourse(this.courseId)).ok&&(this.userIsRegistered=!1)}}}),Vi={key:0},Hi={class:"text-h4 mb-2"},Zi={class:"text-body-2"},Ki={key:0},Gi={key:1};const Wi=/* @__PURE__ */ie(qi,[["render",function(e,t,n,l,f,b){const y=d("v-btn"),k=d("v-icon"),w=d("v-toolbar-title"),v=d("v-toolbar-items"),x=d("v-toolbar"),C=d("v-chip"),E=d("v-card-text"),T=d("v-card"),R=d("course-card-browser");return e.updatePending?i("",!0):(r(),s("div",Vi,[_(e.$slots,"header",{courseConfig:e.courseConfig,courseId:e.courseId},(()=>[m("h1",Hi,c(e.courseConfig.name),1)]),!0),m("p",Zi,c(e.courseConfig.description),1),_(e.$slots,"actions",{userIsRegistered:e.userIsRegistered,courseId:e.courseId,editMode:e.editMode,register:e.register,drop:e.drop},(()=>[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[e.userIsRegistered?(r(),s("div",Ki,[p(y,{color:"success","data-cy":"focused-study-session-btn",class:"me-2"},{default:h((()=>t[0]||(t[0]=[g("Start ad study session")]))),_:1}),"full"===e.editMode?(r(),u(y,{key:0,"data-cy":"add-content-btn",color:"indigo-lighten-1",class:"me-2"},{default:h((()=>[p(k,{start:""},{default:h((()=>t[1]||(t[1]=[g("mdi-plus")]))),_:1}),t[2]||(t[2]=g(" Add content "))])),_:1})):i("",!0),"full"===e.editMode?(r(),u(y,{key:1,color:"green-darken-2",title:"Rank course content for difficulty",class:"me-2"},{default:h((()=>[p(k,{start:""},{default:h((()=>t[3]||(t[3]=[g("mdi-format-list-numbered")]))),_:1}),t[4]||(t[4]=g(" Arrange "))])),_:1})):i("",!0),"full"===e.editMode?(r(),u(y,{key:2,color:"error",size:"small",variant:"outlined",onClick:e.drop},{default:h((()=>t[5]||(t[5]=[g(" Drop this course ")]))),_:1},8,["onClick"])):i("",!0)])):(r(),s("div",Gi,[p(y,{"data-cy":"register-btn",color:"primary",class:"me-2",onClick:e.register},{default:h((()=>t[6]||(t[6]=[g("Register")]))),_:1},8,["onClick"]),p(y,{variant:"outlined",color:"primary",class:"me-2"},{default:h((()=>t[7]||(t[7]=[g("Start a trial study session")]))),_:1})]))])),_:1})]),!0),_(e.$slots,"additional-content",{},void 0,!0),p(T,{class:"my-2"},{default:h((()=>[p(x,{density:"compact"},{default:h((()=>[p(w,null,{default:h((()=>t[8]||(t[8]=[g("Tags")]))),_:1}),p(v,null,{default:h((()=>[p(y,{variant:"text"},{default:h((()=>[g("("+c(e.tags.length)+")",1)])),_:1})])),_:1})])),_:1}),p(E,null,{default:h((()=>[(r(!0),s(a,null,o(e.tags,((t,n)=>(r(),s("span",{key:n},[_(e.$slots,"tag-link",{tag:t,courseId:e.courseId},(()=>[p(C,{variant:"tonal",class:"me-2 mb-2"},{default:h((()=>[g(c(t.name),1)])),_:2},1024)]),!0)])))),128))])),_:3})])),_:3}),p(R,{class:"my-3","course-id":e.courseId,"view-lookup-function":e.viewLookupFunction,"edit-mode":e.editMode},null,8,["course-id","view-lookup-function","edit-mode"])]))}],["__scopeId","data-v-38e9efe1"]]),Qi=n({name:"CardBrowser",components:{CardViewer:it},props:{views:{type:Array,required:!0},data:{type:Array,required:!0},suppressSpinner:{type:Boolean,default:!1}},data:()=>({viewIndex:0,previewMode:an()}),computed:{spinner(){return this.views.length>1}},created(){console.log("[CardBrowser] Card browser created. Cards now in 'prewviewMode'"),this.previewMode.setPreviewMode(!0)},unmounted(){console.log("[CardBrowser] Card browser unmounted. Cards no longer in 'prewviewMode'"),this.previewMode.setPreviewMode(!1)},methods:{incrementView(){this.viewIndex++,this.viewIndex=(this.viewIndex+this.views.length)%this.views.length},decrementView(){this.viewIndex--,this.viewIndex=(this.viewIndex+this.views.length)%this.views.length}}}),Yi={key:0,class:"text-subtitle-1 pa-2"};const Ji=/* @__PURE__ */ie(Qi,[["render",function(e,t,n,a,o,l){const f=d("CardViewer"),b=d("v-icon"),y=d("v-btn"),k=d("v-row");return r(),u(k,{column:"",align:"center",justify:"center"},{default:h((()=>[p(f,{view:e.views[e.viewIndex],data:e.data,course_id:"[browsing]",card_id:"[browsing]"},null,8,["view","data"]),t[2]||(t[2]=m("br",null,null,-1)),t[3]||(t[3]=m("br",null,null,-1)),e.suppressSpinner?i("",!0):(r(),s("div",Yi,[e.spinner?(r(),u(y,{key:0,icon:"",variant:"outlined",color:"primary",onClick:e.decrementView},{default:h((()=>[p(b,null,{default:h((()=>t[0]||(t[0]=[g("mdi-chevron-left")]))),_:1})])),_:1},8,["onClick"])):i("",!0),g(" "+c(e.views[e.viewIndex].name)+" ",1),e.spinner?(r(),u(y,{key:1,icon:"",variant:"outlined",color:"primary",onClick:e.incrementView},{default:h((()=>[p(b,null,{default:h((()=>t[1]||(t[1]=[g("mdi-chevron-right")]))),_:1})])),_:1},8,["onClick"])):i("",!0)]))])),_:1})}]]),Xi=n({name:"CourseTagFilterWidget",props:{courseId:{type:String,required:!0},modelValue:{type:Object,default:void 0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=b(!0),s=b([]),r=b({}),i=b(e.modelValue?{...e.modelValue}:V()),a=y((()=>s.value.filter((e=>!i.value.include.includes(e))))),o=y((()=>H(i.value)));async function l(){n.value=!0;try{const t=Y().getCourseDB(e.courseId),n=await t.getCourseTagStubs();s.value=[],r.value={};for(const e of n.rows)if(e.doc){const t=e.doc;s.value.push(t.name),t.snippet&&(r.value[t.name]=t.snippet)}s.value.sort(((e,t)=>e.localeCompare(t)))}catch(t){console.error("[CourseTagFilterWidget] Failed to load tags:",t),s.value=[],r.value={}}finally{n.value=!1}}return k((()=>e.modelValue),(e=>{i.value=e?{...e}:V()}),{deep:!0}),k(i,(e=>{t("update:modelValue",{...e})}),{deep:!0}),k((()=>e.courseId),(async e=>{e&&await l()})),w((()=>{e.courseId&&l()})),{loading:n,availableTags:s,availableTagsForExclude:a,tagSnippets:r,localFilter:i,hasActiveFilter:o,fuzzyFilter:(e,t)=>{if(!t)return!0;const n=t.toLowerCase(),s=e.toLowerCase();let r=0;for(let i=0;i<s.length&&r<n.length;i++)s[i]===n[r]&&r++;return r===n.length}}}}),ea={class:"course-tag-filter-widget"},ta={key:0,class:"filter-summary text-caption mt-2"},na={key:0},sa={key:1},ra={key:2};const ia=/* @__PURE__ */ie(Xi,[["render",function(e,t,n,a,o,l){const u=d("v-chip"),m=d("v-list-item"),b=d("v-autocomplete"),y=d("v-icon");return r(),s("div",ea,[p(b,{modelValue:e.localFilter.include,"onUpdate:modelValue":t[0]||(t[0]=t=>e.localFilter.include=t),items:e.availableTags,loading:e.loading,disabled:e.loading,label:"Include tags",placeholder:"Type to search tags...",hint:"Cards must have at least one of these tags","persistent-hint":"",multiple:"",chips:"","closable-chips":"",clearable:"",density:"compact",variant:"outlined",class:"mb-2","custom-filter":e.fuzzyFilter,"no-data-text":"No matching tags found"},{chip:h((({props:e,item:t})=>[p(u,f(e,{color:"primary",variant:"tonal",size:"small"}),{default:h((()=>[g(c(t.raw),1)])),_:2},1040)])),item:h((({props:t,item:n})=>[p(m,f(t,{title:n.raw}),P({_:2},[e.tagSnippets[n.raw]?{name:"subtitle",fn:h((()=>[g(c(e.tagSnippets[n.raw]),1)])),key:"0"}:void 0]),1040,["title"])])),_:1},8,["modelValue","items","loading","disabled","custom-filter"]),p(b,{modelValue:e.localFilter.exclude,"onUpdate:modelValue":t[1]||(t[1]=t=>e.localFilter.exclude=t),items:e.availableTagsForExclude,loading:e.loading,disabled:e.loading,label:"Exclude tags",placeholder:"Type to search tags...",hint:"Cards with these tags will be excluded","persistent-hint":"",multiple:"",chips:"","closable-chips":"",clearable:"",density:"compact",variant:"outlined","custom-filter":e.fuzzyFilter,"no-data-text":"No matching tags found"},{chip:h((({props:e,item:t})=>[p(u,f(e,{color:"error",variant:"tonal",size:"small"}),{default:h((()=>[g(c(t.raw),1)])),_:2},1040)])),item:h((({props:t,item:n})=>[p(m,f(t,{title:n.raw}),P({_:2},[e.tagSnippets[n.raw]?{name:"subtitle",fn:h((()=>[g(c(e.tagSnippets[n.raw]),1)])),key:"0"}:void 0]),1040,["title"])])),_:1},8,["modelValue","items","loading","disabled","custom-filter"]),e.hasActiveFilter?(r(),s("div",ta,[p(y,{size:"small",color:"info",class:"mr-1"},{default:h((()=>t[2]||(t[2]=[g("mdi-filter")]))),_:1}),e.localFilter.include.length?(r(),s("span",na," Including: "+c(e.localFilter.include.join(", ")),1)):i("",!0),e.localFilter.include.length&&e.localFilter.exclude.length?(r(),s("span",sa," · ")):i("",!0),e.localFilter.exclude.length?(r(),s("span",ra," Excluding: "+c(e.localFilter.exclude.join(", ")),1)):i("",!0)])):i("",!0)])}],["__scopeId","data-v-e1ba963b"]]);export{Bs as AudioAutoPlayer,Ji as CardBrowser,Ze as CardHistoryViewer,_n as CardLoader,$e as CardSearch,ze as CardSearchResults,it as CardViewer,vr as CodeBlockRenderer,Fi as CourseCardBrowser,Wi as CourseInformation,ia as CourseTagFilterWidget,Displayable,xn as FillInInput,ce as HeatMap,ei as MarkdownRenderer,Xr as MdTokenRenderer,ln as MultipleChoiceOption,Ae as PaginatingToolbar,Question,un as RadioMultipleChoice,mi as RequestPasswordReset,Ii as ResetPassword,Zt as SessionControllerDebug,we as SkMouseTrap,ve as SkMouseTrapToolTip,be as SkldrMouseTrap,Te as SnackbarService,tn as StudySession,rt as StudySessionTimer,gn as TFSelect,Di as TagsInput,ai as UserChip,mn as UserInputNumber,kn as UserInputString,ci as UserLogin,ki as UserLoginAndRegistrationContainer,hi as UserRegistration,Ei as VerifyEmail,Se as alertUser,$s as containsComponent,ni as getCurrentUser,et as getUserStatus,Ds as isComponent,Qe as isDefineComponent,Os as isInlineComponent,ui as isPasswordValid,We as isQuestionView,Ls as parseComponentSyntax,Ps as parseComponentToken,rn as piniaPlugin,tt as requestPasswordReset,nt as resetPassword,Je as sendVerificationEmail,As as splitByDelimiters,Ns as splitParagraphToken,Ms as splitTextToken,si as useAuthStore,an as useCardPreviewModeStore,ri as useConfigStore,st as useEntitlements,Ge as useQuestionView,Ke as useViewable,di as validatePassword,Xe as verifyEmail};
1
+ var e=Object.defineProperty,t=(t,n,s)=>((t,n,s)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s)(t,"symbol"!=typeof n?n+"":n,s);import{defineComponent as n,createElementBlock as s,openBlock as r,createCommentVNode as i,Fragment as a,renderList as o,normalizeStyle as l,toDisplayString as c,resolveComponent as d,createBlock as u,withCtx as h,createVNode as p,createTextVNode as g,createElementVNode as m,mergeProps as f,ref as b,computed as y,watch as k,onMounted as v,onBeforeUnmount as w,normalizeClass as x,renderSlot as _,Transition as S,withKeys as C,resolveDynamicComponent as E,onUnmounted as T,markRaw as R,defineAsyncComponent as I,withDirectives as A,vModelText as M,getCurrentInstance as N,h as $,inject as D,withModifiers as O,vShow as L,createSlots as P,normalizeProps as B,guardReactiveProps as z}from"vue";import j from"moment";import{Status as U,FieldType as F,toCourseElo as q,log as V,displayableDataToViewData as H,emptyTagFilter as Z,hasActiveFilter as K}from"@vue-skuilder/common";import{getCardHistoryID as G,docIsDeleted as W,isReview as Q,getStudySource as Y,SessionController as J,getDataLayer as X,GuestUsername as ee}from"@vue-skuilder/db";import{defineStore as te,setActivePinia as ne}from"pinia";import{useRouter as se,useRoute as re}from"vue-router";import{VueTagsInput as ie}from"@vojtechlanka/vue-tags-input";const ae=n({name:"HeatMap",props:{activityRecords:{type:Array,default:()=>[]},activityRecordsGetter:{type:Function,default:null},inactiveColor:{type:Object,default:()=>({h:0,s:0,l:.9})},activeColor:{type:Object,default:()=>({h:155,s:1,l:.5})},cellSize:{type:Number,default:12},cellMargin:{type:Number,default:3},enableSeasonalColors:{type:Boolean,default:!0}},data:()=>({isLoading:!1,localActivityRecords:[],heatmapData:{},weeks:[],tooltipData:null,tooltipStyle:{},maxInRange:0}),computed:{width(){return 53*(this.cellSize+this.cellMargin)},height(){return 7*(this.cellSize+this.cellMargin)},effectiveActivityRecords(){const e=Array.isArray(this.localActivityRecords)&&this.localActivityRecords.length>0,t=e?this.localActivityRecords:this.activityRecords||[];return console.log("Using effectiveActivityRecords, count:",t.length,"source:",e?"local":"prop"),t}},watch:{activityRecords:{handler(){this.processRecords(),this.createWeeksData()},immediate:!0}},async created(){if(this.activityRecordsGetter)try{this.isLoading=!0,console.log("Fetching activity records using getter...");let e=await this.activityRecordsGetter();Array.isArray(e)?(this.localActivityRecords=e.filter((e=>{if(!e||!e.timeStamp)return!1;try{const t=j(e.timeStamp);return t.isValid()&&t.year()>2e3&&t.year()<2100}catch(t){return!1}})),console.log(`Received ${e.length} records, ${this.localActivityRecords.length} valid after filtering`),this.processRecords(),this.createWeeksData()):(console.error("Activity records getter did not return an array:",e),this.localActivityRecords=[])}catch(e){console.error("Error fetching activity records:",e),this.localActivityRecords=[]}finally{this.isLoading=!1}else console.log("No activityRecordsGetter provided, using direct activityRecords prop")},methods:{toDateString(e){const t=j(e);return j.months()[t.month()]+" "+t.date()},processRecords(){const e=this.effectiveActivityRecords||[];console.log(`Processing ${e.length} records`);const t={};if(0===e.length)return console.log("No records to process"),void(this.heatmapData=t);const n=/* @__PURE__ */new Set,s={};let r=0,i=0;for(let o=0;o<e.length;o++){const l=e[o];if(l&&"object"==typeof l&&l.timeStamp)try{let e;if("string"==typeof l.timeStamp)e=j(l.timeStamp).format("YYYY-MM-DD");else if("number"==typeof l.timeStamp)e=j(new Date(l.timeStamp)).format("YYYY-MM-DD");else{if("object"!=typeof l.timeStamp){i++;continue}e="function"==typeof l.timeStamp.format?l.timeStamp.format("YYYY-MM-DD"):l.timeStamp instanceof Date?j(l.timeStamp).format("YYYY-MM-DD"):j(String(l.timeStamp)).format("YYYY-MM-DD")}if(j(e,"YYYY-MM-DD",!0).isValid()){t[e]=(t[e]||0)+1,n.add(e);const i=e.substring(0,7);s[i]=(s[i]||0)+1,r++}else i++}catch(a){i++}else i++}console.log(`Processed ${r} valid dates, ${i} invalid dates`),console.log(`Found ${n.size} unique dates`),console.log("Date distribution by month:",s),this.heatmapData=t},createWeeksData(){this.weeks=[],this.maxInRange=0;const e=j(),t=e.clone().subtract(52,"weeks"),n=t.clone().startOf("week");console.log("Creating weeks data from",t.format("YYYY-MM-DD"),"to",e.format("YYYY-MM-DD")),0===Object.keys(this.heatmapData).length&&console.log("No heatmap data available to display");const s=Object.keys(this.heatmapData).slice(0,5);for(console.log("Sample dates in heatmap data:",s);n.isSameOrBefore(e);){const e=[];for(let t=0;t<7;t++){const t=n.format("YYYY-MM-DD"),s={date:t,count:this.heatmapData[t]||0};e.push(s),s.count>this.maxInRange&&(this.maxInRange=s.count),n.add(1,"day")}this.weeks.push(e)}console.log("Weeks data created, maxInRange:",this.maxInRange);let r=0,i=0;Object.values(this.heatmapData).forEach((e=>{r++,i+=e})),console.log(`Activity summary: ${i} activities across ${r} days`)},getColor(e){if(0===this.maxInRange)return this.hslToString(this.inactiveColor);const t=0===e?0:Math.min(2*e/this.maxInRange,1);let n=this.activeColor;if(this.enableSeasonalColors){const e=j();11===e.month()&&e.date()>=5?n=Math.random()>.5?{h:350,s:.8,l:.5}:{h:135,s:.8,l:.4}:9===e.month()&&e.date()>=25&&(n=Math.random()>.5?{h:0,s:0,l:0}:Math.random()>.5?{h:30,s:1,l:.5}:{h:270,s:1,l:.5})}const s=n.h,r=this.interpolate(this.inactiveColor.s,n.s,t),i=this.interpolate(this.inactiveColor.l,n.l,t);return this.hslToString({h:s,s:r,l:i})},interpolate:(e,t,n)=>e+(t-e)*n,hslToString:e=>`hsl(${e.h}, ${100*e.s}%, ${100*e.l}%)`,showTooltip(e,t){this.tooltipData=e,this.tooltipStyle={position:"absolute",left:`${t.pageX+10}px`,top:`${t.pageY+10}px`}},hideTooltip(){this.tooltipData=null}}}),oe=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},le=["width","height"],ce=["transform"],de=["y","width","height","fill","onMouseover"];const ue=/* @__PURE__ */oe(ae,[["render",function(e,t,n,d,u,h){return r(),s("div",null,[(r(),s("svg",{width:e.width,height:e.height},[(r(!0),s(a,null,o(e.weeks,((n,i)=>(r(),s("g",{key:i,transform:`translate(${i*(e.cellSize+e.cellMargin)}, 0)`},[(r(!0),s(a,null,o(n,((n,i)=>(r(),s("rect",{key:n.date,x:0,y:i*(e.cellSize+e.cellMargin),width:e.cellSize,height:e.cellSize,fill:e.getColor(n.count),onMouseover:t=>e.showTooltip(n,t),onMouseout:t[0]||(t[0]=(...t)=>e.hideTooltip&&e.hideTooltip(...t))},null,40,de)))),128))],8,ce)))),128))],8,le)),e.tooltipData?(r(),s("div",{key:0,class:"tooltip",style:l(e.tooltipStyle)},c(e.tooltipData.count)+" review"+c(1!==e.tooltipData.count?"s":"")+" on "+c(e.toDateString(e.tooltipData.date)),5)):i("",!0)])}],["__scopeId","data-v-ca46239a"]]);function he(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pe,ge,me={exports:{}};const fe=/* @__PURE__ */he((pe||(pe=1,ge=me,function(e,t){if(e){for(var n,s={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},i={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},a={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},o=1;o<20;++o)s[111+o]="f"+o;for(o=0;o<=9;++o)s[o+96]=o.toString();g.prototype.bind=function(e,t,n){var s=this;return e=e instanceof Array?e:[e],s._bindMultiple.call(s,e,t,n),s},g.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},g.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},g.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},g.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(p(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},g.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},g.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);n=null},g.init=function(){var e=g(t);for(var n in e)"_"!==n.charAt(0)&&(g[n]=/* @__PURE__ */function(t){return function(){return e[t].apply(e,arguments)}}(n))},g.init(),e.Mousetrap=g,ge.exports&&(ge.exports=g)}function l(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function c(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return s[e.which]?s[e.which]:r[e.which]?r[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function u(e,t,r){return r||(r=function(){if(!n)for(var e in n={},s)e>95&&e<112||s.hasOwnProperty(e)&&(n[s[e]]=e);return n}()[e]?"keydown":"keypress"),"keypress"==r&&t.length&&(r="keydown"),r}function h(e,t){var n,s,r,o=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),r=0;r<n.length;++r)s=n[r],a[s]&&(s=a[s]),t&&"keypress"!=t&&i[s]&&(s=i[s],o.push("shift")),d(s)&&o.push(s);return{key:s,modifiers:o,action:t=u(s,o,t)}}function p(e,n){return null!==e&&e!==t&&(e===n||p(e.parentNode,n))}function g(e){var n=this;if(e=e||t,!(n instanceof g))return new g(e);n.target=e,n._callbacks={},n._directMap={};var s,r={},i=!1,a=!1,o=!1;function u(e){e=e||{};var t,n=!1;for(t in r)e[t]?n=!0:r[t]=0;n||(o=!1)}function p(e,t,s,i,a,o){var l,c,u,h,p=[],g=s.type;if(!n._callbacks[e])return[];for("keyup"==g&&d(e)&&(t=[e]),l=0;l<n._callbacks[e].length;++l)if(c=n._callbacks[e][l],(i||!c.seq||r[c.seq]==c.level)&&g==c.action&&("keypress"==g&&!s.metaKey&&!s.ctrlKey||(u=t,h=c.modifiers,u.sort().join(",")===h.sort().join(",")))){var m=!i&&c.combo==a,f=i&&c.seq==i&&c.level==o;(m||f)&&n._callbacks[e].splice(l,1),p.push(c)}return p}function m(e,t,s,r){n.stopCallback(t,t.target||t.srcElement,s,r)||!1===e(t,s)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(t),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(t))}function f(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t=c(e);t&&("keyup"!=e.type||i!==t?n.handleKey(t,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):i=!1)}function b(e,t,n,a){function l(t){return function(){o=t,++r[e],clearTimeout(s),s=setTimeout(u,1e3)}}function d(t){m(n,t,e),"keyup"!==a&&(i=c(t)),setTimeout(u,10)}r[e]=0;for(var p=0;p<t.length;++p){var g=p+1===t.length?d:l(a||h(t[p+1]).action);y(t[p],g,a,e,p)}}function y(e,t,s,r,i){n._directMap[e+":"+s]=t;var a,o=(e=e.replace(/\s+/g," ")).split(" ");o.length>1?b(e,o,t,s):(a=h(e,s),n._callbacks[a.key]=n._callbacks[a.key]||[],p(a.key,a.modifiers,{type:a.action},r,e,i),n._callbacks[a.key][r?"unshift":"push"]({callback:t,modifiers:a.modifiers,action:a.action,seq:r,level:i,combo:e}))}n._handleKey=function(e,t,n){var s,r=p(e,t,n),i={},l=0,c=!1;for(s=0;s<r.length;++s)r[s].seq&&(l=Math.max(l,r[s].level));for(s=0;s<r.length;++s)if(r[s].seq){if(r[s].level!=l)continue;c=!0,i[r[s].seq]=1,m(r[s].callback,n,r[s].combo,r[s].seq)}else c||m(r[s].callback,n,r[s].combo);var h="keypress"==n.type&&a;n.type!=o||d(e)||h||u(i),a=c&&"keydown"==n.type},n._bindMultiple=function(e,t,n){for(var s=0;s<e.length;++s)y(e[s],t,n)},l(e,"keypress",f),l(e,"keydown",f),l(e,"keyup",f)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)),me.exports));var be;be||(be=1,function(e){if(e){var t={},n=e.prototype.stopCallback;e.prototype.stopCallback=function(e,s,r,i){return!!this.paused||!t[r]&&!t[i]&&n.call(this,e,s,r)},e.prototype.bindGlobal=function(e,n,s){if(this.bind(e,n,s),e instanceof Array)for(var r=0;r<e.length;r++)t[e[r]]=!0;else t[e]=!0},e.init()}}("undefined"!=typeof Mousetrap?Mousetrap:void 0));const ye=class _SkldrMouseTrap{constructor(){t(this,"mouseTrap"),t(this,"hotkeys"),this.mouseTrap=new fe,this.hotkeys=[]}static get commands(){return _SkldrMouseTrap.instance().hotkeys.map((e=>({command:e.command,hotkey:e.hotkey})))}static addBinding(e){const t=Array.isArray(e)?e:[e],n=_SkldrMouseTrap.instance();n.hotkeys=[...n.hotkeys,...t],t.forEach((e=>{fe.bindGlobal(e.hotkey,((t,n)=>{!function(){const e=document.activeElement;return(!(e instanceof HTMLInputElement)||"checkbox"!==e.type&&"radio"!==e.type)&&e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||e.isContentEditable)}()?e.callback(t,n):console.log(`Ignoring hotkey ${e.hotkey} while input element is focused`)}))}))}static removeBinding(e){const t=_SkldrMouseTrap.instance(),n=[...t.hotkeys];Array.isArray(e)&&!e.every((e=>"string"==typeof e||"number"==typeof e))?e.forEach((e=>{t.hotkeys=t.hotkeys.filter((t=>JSON.stringify(t.hotkey)!==JSON.stringify(e))),fe.unbind(e)})):(t.hotkeys=n.filter((t=>JSON.stringify(t.hotkey)!==JSON.stringify(e))),fe.unbind(e))}static reset(){console.warn("SkldrMouseTrap.reset() may affect hotkeys registered by other components. Consider using removeBinding() with specific hotkeys for better component isolation."),fe.reset(),_SkldrMouseTrap.instance().mouseTrap.reset(),_SkldrMouseTrap.instance().hotkeys=[]}static instance(){return _SkldrMouseTrap._instance||(_SkldrMouseTrap._instance=new _SkldrMouseTrap),_SkldrMouseTrap._instance}};t(ye,"_instance");let ke=ye;const ve=n({name:"SkMouseTrap",props:{refreshInterval:{type:Number,default:500}},data:()=>({commands:[],display:!1,intervalId:null}),created(){this.intervalId=window.setInterval(this.refreshState,this.refreshInterval)},beforeUnmount(){null!==this.intervalId&&clearInterval(this.intervalId)},methods:{refreshState(){this.commands=ke.commands,this.display=this.commands.length>0}}}),we={class:"text-caption ml-2"};const xe=/* @__PURE__ */oe(ve,[["render",function(e,t,n,l,b,y){const k=d("v-icon"),v=d("v-btn"),w=d("v-toolbar-title"),x=d("v-toolbar"),_=d("v-spacer"),S=d("v-list-item"),C=d("v-list"),E=d("v-card"),T=d("v-dialog");return e.display?(r(),u(T,{key:0,"max-width":"500px",transition:"dialog-transition"},{activator:h((({props:e})=>[p(v,f({icon:"",color:"primary"},e),{default:h((()=>[p(k,null,{default:h((()=>t[0]||(t[0]=[g("mdi-keyboard")]))),_:1})])),_:2},1040)])),default:h((()=>[p(E,null,{default:h((()=>[p(x,{color:"secondary",dark:"",dense:""},{default:h((()=>[p(w,{class:"text-subtitle-1"},{default:h((()=>t[1]||(t[1]=[g("Shortcut keys:")]))),_:1})])),_:1}),p(C,{dense:""},{default:h((()=>[(r(!0),s(a,null,o(e.commands,(e=>(r(),u(S,{key:Array.isArray(e.hotkey)?e.hotkey.join(","):e.hotkey,class:"py-1"},{default:h((()=>[p(v,{variant:"outlined",color:"primary",class:"text-white",size:"small"},{default:h((()=>[g(c(Array.isArray(e.hotkey)?e.hotkey[0]:e.hotkey),1)])),_:2},1024),p(_),m("span",we,c(e.command),1)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1})):i("",!0)}]]);const _e=/* @__PURE__ */oe(n({name:"SkMouseTrapToolTip",props:{hotkey:{type:[String,Array],required:!0},command:{type:String,required:!0},disabled:{type:Boolean,default:!1},position:{type:String,default:"top"},showTooltip:{type:Boolean,default:!0},highlightEffect:{type:String,default:"glow"}},emits:["hotkey-triggered"],setup(e,{emit:t}){const n=b(null),s=b(!1);b(`hotkey-${Math.random().toString(36).substring(2,15)}`);const r=y((()=>{const t=Array.isArray(e.hotkey)?e.hotkey[0]:e.hotkey;return t.includes(" ")?t.toLowerCase().split(" ").map((e=>e.charAt(0)+e.slice(1))).join(", "):t.toLowerCase().split("+").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" + ")}));k((()=>s.value),(t=>{if(!n.value||e.disabled)return;const s=n.value.querySelector('button, a, input[type="button"], [role="button"]');s&&(s.style.transition="all 250ms ease",t&&"none"!==e.highlightEffect?s.style.filter="brightness(1.1)":s.style.filter="")}));const i=e=>{"Control"===e.key&&(s.value=!0)},a=e=>{"Control"===e.key&&(s.value=!1)},o=()=>{if(e.disabled||!n.value)return;let s=n.value.querySelector('button, a, input[type="button"], [role="button"]');if(s||(s=n.value.querySelector("v-list-item, .v-list-item, router-link, .router-link, a, [to]")),s||!n.value.hasAttribute("to")&&"A"!==n.value.tagName&&!n.value.classList.contains("v-list-item")||(s=n.value),!s){const e=n.value.closest("v-list-item, .v-list-item, a, [to]");e&&(s=e)}if(s)if(s.hasAttribute("to")){const n=s.getAttribute("to");if(n&&window.location.pathname!==n){const e=window.$nuxt?.$router||window.$router;e&&"function"==typeof e.push?e.push(n):window.location.pathname=n}t("hotkey-triggered",e.hotkey)}else s.click(),t("hotkey-triggered",e.hotkey);else console.log("No clickable element found for hotkey",e.hotkey),t("hotkey-triggered",e.hotkey)},l=()=>{e.disabled||ke.addBinding({hotkey:e.hotkey,command:e.command,callback:o})},c=()=>{e.disabled||ke.removeBinding(e.hotkey)};return k((()=>e.disabled),(e=>{e?c():l()})),v((()=>{document.addEventListener("keydown",i),document.addEventListener("keyup",a),l()})),w((()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",a),c()})),{wrapperElement:n,isControlKeyPressed:s,formattedHotkey:r}}}),[["render",function(e,t,n,a,o,l){return r(),s("div",{class:x(["sk-mousetrap-tooltip-wrapper",[e.isControlKeyPressed&&!e.disabled&&"none"!==e.highlightEffect?`sk-mousetrap-highlight-${e.highlightEffect}`:""]]),ref:"wrapperElement"},[_(e.$slots,"default",{},void 0,!0),p(S,{name:"fade"},{default:h((()=>[e.showTooltip&&e.isControlKeyPressed&&!e.disabled?(r(),s("div",{key:0,class:x(["sk-mousetrap-tooltip",{"sk-mt-tooltip-top":"top"===e.position,"sk-mt-tooltip-bottom":"bottom"===e.position,"sk-mt-tooltip-left":"left"===e.position,"sk-mt-tooltip-right":"right"===e.position}])},c(e.formattedHotkey),3)):i("",!0)])),_:1})],2)}],["__scopeId","data-v-5d6fb09c"]]),Se=/* @__PURE__ */(()=>{let e=null;return{setInstance(t){e=t},getInstance:()=>e,alertUser(t){e?e.addSnack(t):console.error("SnackbarService not found")}}})(),{setInstance:Ce,alertUser:Ee}=Se,Te=n({name:"SnackbarService",data:()=>({snacks:[],show:[]}),mounted(){Ce(this)},methods:{addSnack(e){this.snacks.push(e),this.show.push(!0)},close(){this.show.pop(),this.show.push(!1)},getColor:e=>e.status===U.ok?"success":e.status===U.error?"error":e.status===U.warning?"yellow":void 0}}),Re={class:"d-flex align-center justify-space-between w-100"};const Ie=/* @__PURE__ */oe(Te,[["render",function(e,t,n,i,l,f){const b=d("v-icon"),y=d("v-btn"),k=d("v-snackbar");return r(),s("div",null,[(r(!0),s(a,null,o(e.snacks,(n=>(r(),u(k,{key:e.snacks.indexOf(n),modelValue:e.show[e.snacks.indexOf(n)],"onUpdate:modelValue":t=>e.show[e.snacks.indexOf(n)]=t,timeout:n.timeout,location:"bottom right",color:e.getColor(n)},{default:h((()=>[m("div",Re,[m("span",null,c(n.text),1),p(y,{icon:"",variant:"text",onClick:t[0]||(t[0]=t=>e.close())},{default:h((()=>[p(b,null,{default:h((()=>t[1]||(t[1]=[g("mdi-close")]))),_:1})])),_:1})])])),_:2},1032,["modelValue","onUpdate:modelValue","timeout","color"])))),128))])}]]),Ae=n({name:"PaginatingToolbar",props:{pages:{type:Array,required:!0},page:{type:Number,required:!0},title:{type:String,required:!1,default:""},subtitle:{type:String,required:!1,default:""}},emits:["first","prev","next","last","set-page"]}),Me={key:0,class:"ms-2 text-subtitle-2","data-cy":"paginating-toolbar-subtitle"};const Ne=/* @__PURE__ */oe(Ae,[["render",function(e,t,n,a,o,l){const f=d("v-toolbar-title"),b=d("v-spacer"),y=d("v-icon"),k=d("v-btn"),v=d("v-select"),w=d("v-toolbar");return r(),u(w,{density:"compact"},{default:h((()=>[p(f,null,{default:h((()=>[m("span",null,c(e.title),1),e.subtitle?(r(),s("span",Me,c(e.subtitle),1)):i("",!0)])),_:1}),p(b),p(k,{variant:"text",icon:"",color:"secondary",disabled:1==e.page,onClick:t[0]||(t[0]=t=>e.$emit("first"))},{default:h((()=>[p(y,null,{default:h((()=>t[5]||(t[5]=[g("mdi-page-first")]))),_:1})])),_:1},8,["disabled"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:1==e.page,onClick:t[1]||(t[1]=t=>e.$emit("prev"))},{default:h((()=>[p(y,null,{default:h((()=>t[6]||(t[6]=[g("mdi-chevron-left")]))),_:1})])),_:1},8,["disabled"]),p(v,{"model-value":e.page,items:e.pages,class:"pageSelect",density:"compact","hide-details":"","return-object":!1,variant:"outlined","onUpdate:modelValue":t[2]||(t[2]=t=>e.$emit("set-page",t))},{selection:h((({item:e})=>[g(c(e.value),1)])),_:1},8,["model-value","items"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:e.page==e.pages.length,onClick:t[3]||(t[3]=t=>e.$emit("next"))},{default:h((()=>[p(y,null,{default:h((()=>t[7]||(t[7]=[g("mdi-chevron-right")]))),_:1})])),_:1},8,["disabled"]),p(k,{variant:"text",icon:"",color:"secondary",disabled:e.page==e.pages.length,onClick:t[4]||(t[4]=t=>e.$emit("last"))},{default:h((()=>[p(y,null,{default:h((()=>t[8]||(t[8]=[g("mdi-page-last")]))),_:1})])),_:1},8,["disabled"])])),_:1})}],["__scopeId","data-v-a75fea7e"]]),$e=n({name:"CardSearch",emits:{search:e=>"string"==typeof e},data:()=>({query:""}),methods:{search(){this.$emit("search",this.query)}}}),De={class:"card-search"};const Oe=/* @__PURE__ */oe($e,[["render",function(e,t,n,i,a,o){const l=d("v-text-field");return r(),s("div",De,[p(l,{modelValue:e.query,"onUpdate:modelValue":t[0]||(t[0]=t=>e.query=t),label:"Search for cards...","append-icon":"mdi-magnify","onClick:append":e.search,onKeydown:C(e.search,["enter"])},null,8,["modelValue","onClick:append","onKeydown"])])}]]),Le=n({name:"CardSearchResults",emits:{"card-selected":e=>"string"==typeof e.cardId&&"string"==typeof e.courseId},props:{query:{type:String,required:!0},dataLayer:{type:Object,required:!0},courseFilter:{type:String,default:null}},data:()=>({cards:[],loading:!1,error:null,selectedCardId:null}),watch:{query:{immediate:!0,handler(e){e&&this.fetchResults(e)}}},methods:{async fetchResults(e){this.loading=!0,this.error=null;try{let t=[];if(this.courseFilter)t=[this.courseFilter],console.log(`Filtering search to course: ${this.courseFilter}`);else{const{CourseLookup:e}=await import("@vue-skuilder/db");t=(await e.allCourseWare()).map((e=>e._id)).filter(Boolean),console.log(`Searching across all ${t.length} courses`)}const n=[];for(const s of t){const t=this.dataLayer.getCourseDB(s),r=await t.searchCards(e);for(const e of r)n.push({...e,courseId:s})}this.cards=n,console.log(`Search completed: found ${n.length} cards across ${t.length} courses`)}catch(t){this.error="Error fetching search results.",console.error("Search error:",t)}finally{this.loading=!1}},selectCard(e){this.selectedCardId=e._id,this.$emit("card-selected",{cardId:e._id,courseId:e.courseId})}}}),Pe={class:"card-search-results"},Be={key:0},ze={key:1},je={key:2};const Ue=/* @__PURE__ */oe(Le,[["render",function(e,t,n,i,l,m){const f=d("v-list-item-title"),b=d("v-list-item-subtitle"),y=d("v-list-item"),k=d("v-list");return r(),s("div",Pe,[e.loading?(r(),s("div",Be,"Loading...")):e.error?(r(),s("div",ze,c(e.error),1)):(r(),s("div",je,[p(k,null,{default:h((()=>[(r(!0),s(a,null,o(e.cards,(t=>(r(),u(y,{key:t._id,onClick:n=>e.selectCard(t),class:x([{"selected-card":t._id===e.selectedCardId},"cursor-pointer"])},{default:h((()=>[p(f,null,{default:h((()=>[g(c(t._id),1)])),_:2},1024),p(b,null,{default:h((()=>[g("Course: "+c(t.courseId),1)])),_:2},1024)])),_:2},1032,["onClick","class"])))),128))])),_:1})]))])}],["__scopeId","data-v-285e13bd"]]),Fe=n({name:"CardHistoryViewer",props:{cardId:{type:String,required:!0},courseId:{type:String,required:!0},userId:{type:String,required:!0},userDB:{type:Object,required:!0}},data:()=>({history:[],cardHistory:null,bestIntervalHumanized:"",loading:!1,error:null,headers:[{title:"Timestamp",key:"formattedTimeStamp"},{title:"Interval",key:"userFriendlyInterval"},{title:"Time Spent (s)",key:"timeSpentSeconds"},{title:"Correct?",key:"isCorrect"},{title:"Performance",key:"performance"},{title:"Prior Attempts",key:"priorAttemps"},{title:"User Answer",key:"userAnswer"}]}),watch:{cardId:{immediate:!0,handler(e){e&&this.userDB&&this.fetchHistory()}},userDB:{handler(e){e&&this.cardId&&this.fetchHistory()}}},methods:{async fetchHistory(){this.loading=!0,this.error=null;try{const e=G(this.courseId,this.cardId),t=await this.userDB.get(e);this.cardHistory=t,this.bestIntervalHumanized=j.duration(t.bestInterval,"seconds").humanize();const n=[...t.records].sort(((e,t)=>j(e.timeStamp).valueOf()-j(t.timeStamp).valueOf()));this.history=n.map(((e,t)=>{const s=j(e.timeStamp),r={...e,formattedTimeStamp:s.format("YYYY-MM-DD HH:mm:ss"),timeSpentSeconds:Math.round(e.timeSpent/1e3),isCorrect:e.isCorrect,performance:e.performance,priorAttemps:e.priorAttemps,userAnswer:e.userAnswer};if(t>0){const e=j(n[t-1].timeStamp),i=s.diff(e,"seconds",!0);r.intervalFromPrevious=Math.round(100*i)/100,r.userFriendlyInterval=`${r.intervalFromPrevious} sec (${j.duration(i,"seconds").humanize()})`}return r}))}catch(e){this.error="Error fetching card history.",console.error(e)}finally{this.loading=!1}}}}),qe={class:"card-history-viewer"},Ve={key:0},He={key:1},Ze={key:2,class:"error-message"},Ke={key:3};const Ge=/* @__PURE__ */oe(Fe,[["render",function(e,t,n,a,o,l){const u=d("v-card-title"),m=d("v-list-item-title"),f=d("v-list-item-subtitle"),b=d("v-list-item-content"),y=d("v-list-item"),k=d("v-card"),v=d("v-data-table");return r(),s("div",qe,[e.userId?(r(),s("h3",Ve,"Card History for User: "+c(e.userId),1)):i("",!0),e.loading?(r(),s("div",He,"Loading...")):e.error?(r(),s("div",Ze,c(e.error),1)):e.cardHistory?(r(),s("div",Ke,[p(k,{class:"mb-4"},{default:h((()=>[p(u,null,{default:h((()=>t[0]||(t[0]=[g("Summary")]))),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Best Interval: "+c(e.cardHistory.bestInterval)+" seconds ("+c(e.bestIntervalHumanized)+")",1)])),_:1}),p(f,null,{default:h((()=>t[1]||(t[1]=[g("The to-date largest interval between successful card reviews.")]))),_:1})])),_:1})])),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Lapses: "+c(e.cardHistory.lapses),1)])),_:1}),p(f,null,{default:h((()=>t[2]||(t[2]=[g("The number of times that a card has been failed in review.")]))),_:1})])),_:1})])),_:1}),p(y,null,{default:h((()=>[p(b,null,{default:h((()=>[p(m,null,{default:h((()=>[g("Streak: "+c(e.cardHistory.streak),1)])),_:1}),p(f,null,{default:h((()=>t[3]||(t[3]=[g("The number of consecutive successful impressions on this card.")]))),_:1})])),_:1})])),_:1})])),_:1}),p(v,{headers:e.headers,items:e.history,class:"elevation-1"},null,8,["headers","items"])])):i("",!0)])}],["__scopeId","data-v-a4bdfdfb"]]);function We(e,t,n){const s=b(j.utc()),r=b([]),i={log:(e,...t)=>console.log(`[${n}]: `,e,...t),error:(e,...t)=>console.error(`[${n}]: `,e,...t),warn:(e,...t)=>console.warn(`[${n}]: `,e,...t)},a=y((()=>Math.abs(j.utc().diff(s.value,"milliseconds"))));return{startTime:s,hotKeys:r,timeSpent:a,logger:i,getURL:(t,n=0)=>{try{if(e.data[n]?.[t])return URL.createObjectURL(e.data[n][t])}catch(s){i.error("Error creating URL for item:",t,s)}return""},emitResponse:e=>{t("emitResponse",e)}}}function Qe(e){const t=b(0),n=b(0),s=b([]),r=b(3),i=b(2),a=b();return{priorSessionViews:t,priorAttempts:n,priorAnswers:s,maxAttemptsPerView:r,maxSessionViews:i,question:a,submitAnswer:(t,r)=>{if(e.logger.log("submitAnswer called..."),!a.value)throw new Error("Question not initialized");s.value.push([t,r??""]);const i=a.value.evaluate(t,e.timeSpent.value);e.logger.log(`evaluation of answer ${t}:`,i);const o={...i,priorAttemps:n.value,courseID:"",cardID:"",timeSpent:e.timeSpent.value,timeStamp:e.startTime.value,userAnswer:t};return i.isCorrect||n.value++,e.emitResponse(o),o}}}function Ye(e){return"object"==typeof e&&null!==e&&"submitAnswer"in e&&"priorAttempts"in e}function Je(e){return void 0!==e.__isFragment}class Displayable{constructor(e){if(0===e.length)throw new Error("\nDisplayable Constructor was called with no view Data.\n ");!function(e,t){for(let n=0;n<e.length;n++)e[n].fields.forEach(((e,s)=>{console.log(`[Displayable] shape[${n}].field[${s}]:\n ${JSON.stringify(e)}`),void 0===t[n][e.name]&&e.type!==F.MEDIA_UPLOADS&&console.warn("[Displayable] missing data")}))}(this.dataShapes(),e)}}t(Displayable,"dataShapes"),t(Displayable,"views"),t(Displayable,"seedData"),t(Displayable,"acceptsUserData",!0);class Question extends Displayable{displayedSkill(e,t){console.warn("Question is running the reference implementation of displayedSkill.\n Consider overriding!");const n=5e3,s=Math.min(t,5e4),r=s/n,i=s>n?Math.pow(.8,r):1;let a=this.isCorrect(e)?1:0;return a*=i,Math.min(a,1)}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}}const Xe=()=>{let e="fallback (empty string)",t="";if(!t&&"undefined"!=typeof window&&window.__SKUILDER_CONFIG__?.apiBase){const n=window.__SKUILDER_CONFIG__.apiBase.replace(/\/$/,"");t=n.startsWith("/")?n:`/${n}`,e="window.__SKUILDER_CONFIG__.apiBase"}return console.log("[authAPI] getApiBase() called"),console.log("[authAPI] source:",e),console.log("[authAPI] result:",t),t};async function et(e,t,n){try{const s={username:e,email:t};n&&(s.origin=n);const r=await fetch(`${Xe()}/auth/send-verification`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(s)});if(!r.ok){const e=await r.text();return console.error("Send verification email error:",e),{ok:!1,error:`HTTP ${r.status}: ${r.statusText}`}}return await r.json()}catch(s){return console.error("Send verification email fetch error:",s),{ok:!1,error:s instanceof Error?s.message:"Network error"}}}async function tt(e){try{const t=await fetch(`${Xe()}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:e})});return t.ok?await t.json():{ok:!1,error:`HTTP ${t.status}: ${t.statusText}`}}catch(t){return{ok:!1,error:t instanceof Error?t.message:"Network error"}}}async function nt(){try{const e=await fetch(`${Xe()}/auth/status`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});return e.ok?await e.json():{ok:!1,error:`HTTP ${e.status}: ${e.statusText}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Network error"}}}async function st(e,t){try{const n={email:e};t&&(n.origin=t);const s=await fetch(`${Xe()}/auth/request-reset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)});return s.ok?await s.json():{ok:!1,error:`HTTP ${s.status}: ${s.statusText}`}}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Network error"}}}async function rt(e,t){try{const n=await fetch(`${Xe()}/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:e,newPassword:t})});return n.ok?await n.json():{ok:!1,error:`HTTP ${n.status}: ${n.statusText}`}}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Network error"}}}function it(e){const t=b({}),n=b(!1),s=b(null),r=y((()=>{const n=t.value[e];if(!n)return{isActive:!1,isPaid:!1,daysRemaining:null,expiresDate:null};if("paid"===n.status)return{isActive:!0,isPaid:!0,daysRemaining:null,expiresDate:null};const s=n.expires;if(!s)return{isActive:!0,isPaid:!1,daysRemaining:null,expiresDate:null};const r=new Date(s),i=/* @__PURE__ */new Date,a=Math.ceil((r.getTime()-i.getTime())/864e5);return{isActive:a>0,isPaid:!1,daysRemaining:Math.max(0,a),expiresDate:s}})),i=y((()=>r.value.isPaid));return{entitlements:t,trialStatus:r,hasPremiumAccess:i,loading:n,error:s,fetchEntitlements:async function(){n.value=!0,s.value=null;try{const e=await nt();e.ok?t.value=e.entitlements||{}:(s.value=e.error||"Failed to fetch entitlements",console.error("[useEntitlements] Error:",s.value))}catch(e){s.value=e instanceof Error?e.message:"Unknown error",console.error("[useEntitlements] Exception:",e)}finally{n.value=!1}}}}const at=/* @__PURE__ */oe(n({name:"StudySessionTimer",props:{timeRemaining:{type:Number,required:!0},sessionTimeLimit:{type:Number,required:!0,default:5}},emits:["add-time"],setup:(e,{emit:t})=>({hovered:b(!1),formattedTimeRemaining:y((()=>{let t="";const n=e.timeRemaining;n>60&&(t=Math.floor(n/60).toString()+":");const s=n%60;return t+=s>=10?s:"0"+s,n<=60&&(t+=" seconds"),t+=" left!",t})),percentageRemaining:y((()=>e.timeRemaining>60?e.timeRemaining/(60*e.sessionTimeLimit)*100:e.timeRemaining/60*100)),timerColor:y((()=>e.timeRemaining>60?"primary":"orange darken-3")),addSessionTime:()=>{t("add-time")}})}),[["render",function(e,t,n,s,a,o){const l=d("v-icon"),b=d("v-btn"),y=d("v-progress-circular"),k=d("v-tooltip");return r(),u(k,{location:"right","open-delay":0,"close-delay":200,color:"secondary",class:"text-subtitle-1"},{activator:h((({props:n})=>[m("div",f({class:"timer-container"},n,{onMouseenter:t[0]||(t[0]=t=>e.hovered=!0),onMouseleave:t[1]||(t[1]=t=>e.hovered=!1)}),[p(y,{alt:"Time remaining in study session",size:"64",width:"8",rotate:"0",color:e.timerColor,"model-value":e.percentageRemaining},{default:h((()=>[e.timeRemaining>0&&e.hovered?(r(),u(b,{key:0,icon:"",color:"transparent",location:"bottom left",onClick:e.addSessionTime},{default:h((()=>[p(l,{size:"large"},{default:h((()=>t[2]||(t[2]=[g("mdi-plus")]))),_:1})])),_:1},8,["onClick"])):i("",!0)])),_:1},8,["color","model-value"])],16)])),default:h((()=>[g(" "+c(e.formattedTimeRemaining),1)])),_:1})}],["__scopeId","data-v-5960940a"]]);const ot=/* @__PURE__ */oe(n({name:"CardViewer",ref:{},props:{sessionOrder:{type:Number,required:!1,default:0},card_id:{type:String,required:!0,default:""},course_id:{type:String,required:!0,default:""},view:{type:[Function,Object],required:!0},data:{type:Array,required:!0},user_elo:{type:Object,default:()=>({global:{score:1e3,count:0},tags:{},misc:{}})},card_elo:{type:Number,default:1e3}},emits:["emitResponse"],methods:{processResponse(e){console.log(`\n Card was displayed at ${e.timeStamp}\n User spent ${e.timeSpent} milliseconds with the card.\n `),this.$emit("emitResponse",e)}}}),[["render",function(e,t,n,s,i,a){const o=d("v-card");return r(),u(o,{elevation:"12"},{default:h((()=>[(r(),u(E(e.view),{ref:"activeView",key:e.course_id+"-"+e.card_id+"-"+e.sessionOrder,data:e.data,"modify-difficulty":e.user_elo.global.score-e.card_elo,class:"cardView ma-2 pa-2",onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,40,["data","modify-difficulty"]))])),_:1})}],["__scopeId","data-v-318fb94f"]]),lt=n({name:"SessionControllerDebug",props:{sessionController:{type:Object,required:!0}},setup(e){const t=b(0);let n=null;v((()=>{n=setInterval((()=>{t.value++}),500)})),T((()=>{n&&clearInterval(n)}));return{debugInfo:y((()=>(t.value,e.sessionController?e.sessionController.getDebugInfo():{reviewQueue:{length:0,dequeueCount:0,items:[]},newQueue:{length:0,dequeueCount:0,items:[]},failedQueue:{length:0,dequeueCount:0,items:[]},hydratedCache:{count:0,failedCacheSize:0,items:[]}})))}}}),ct={class:"debug-section"},dt={class:"debug-header"},ut={class:"debug-stats"},ht={class:"text-caption"},pt={class:"text-caption ml-2"},gt={key:0,class:"debug-items"},mt={class:"text-caption"},ft={class:"text-caption text-grey ml-1"},bt={key:0,class:"text-caption text-grey"},yt={key:1,class:"text-caption text-grey"},kt={class:"debug-section"},vt={class:"debug-header"},wt={class:"debug-stats"},xt={class:"text-caption"},_t={class:"text-caption ml-2"},St={key:0,class:"debug-items"},Ct={class:"text-caption"},Et={class:"text-caption text-grey ml-1"},Tt={key:0,class:"text-caption text-grey"},Rt={key:1,class:"text-caption text-grey"},It={class:"debug-section"},At={class:"debug-header"},Mt={class:"debug-stats"},Nt={class:"text-caption"},$t={class:"text-caption ml-2"},Dt={key:0,class:"debug-items"},Ot={class:"text-caption"},Lt={class:"text-caption text-grey ml-1"},Pt={key:0,class:"text-caption text-grey"},Bt={key:1,class:"text-caption text-grey"},zt={class:"debug-section"},jt={class:"debug-header"},Ut={class:"debug-stats"},Ft={class:"text-caption"},qt={class:"text-caption ml-2"},Vt={key:0,class:"debug-items"},Ht={class:"text-caption"},Zt={key:0,class:"text-caption text-grey"},Kt={key:1,class:"text-caption text-grey"};const Gt=/* @__PURE__ */oe(lt,[["render",function(e,t,n,l,f,b){const y=d("v-spacer"),k=d("v-icon"),v=d("v-card-title"),w=d("v-col"),x=d("v-row"),_=d("v-divider"),S=d("v-card-text"),C=d("v-card");return e.sessionController?(r(),u(C,{key:0,class:"session-debug ma-2",elevation:"2"},{default:h((()=>[p(v,{class:"text-caption bg-grey-darken-3"},{default:h((()=>[t[1]||(t[1]=g(" Session Controller Debug ")),p(y),p(k,{size:"small"},{default:h((()=>t[0]||(t[0]=[g("mdi-bug")]))),_:1})])),_:1}),p(S,{class:"pa-2"},{default:h((()=>[p(x,{dense:""},{default:h((()=>[p(w,{cols:"12",md:"4"},{default:h((()=>[m("div",ct,[m("div",dt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[2]||(t[2]=[g("mdi-calendar-check")]))),_:1}),t[3]||(t[3]=m("strong",null,"Review Queue",-1))]),m("div",ut,[m("span",ht,"Length: "+c(e.debugInfo.reviewQueue.length),1),m("span",pt,"Dequeued: "+c(e.debugInfo.reviewQueue.dequeueCount),1)]),e.debugInfo.reviewQueue.items.length>0?(r(),s("div",gt,[(r(!0),s(a,null,o(e.debugInfo.reviewQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",mt,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",ft,"("+c(e.status)+")",1)])))),128)),e.debugInfo.reviewQueue.items.length>5?(r(),s("div",bt," ... +"+c(e.debugInfo.reviewQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",yt," (empty) "))])])),_:1}),p(w,{cols:"12",md:"4"},{default:h((()=>[m("div",kt,[m("div",vt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[4]||(t[4]=[g("mdi-file-document-plus")]))),_:1}),t[5]||(t[5]=m("strong",null,"New Cards Queue",-1))]),m("div",wt,[m("span",xt,"Length: "+c(e.debugInfo.newQueue.length),1),m("span",_t,"Dequeued: "+c(e.debugInfo.newQueue.dequeueCount),1)]),e.debugInfo.newQueue.items.length>0?(r(),s("div",St,[(r(!0),s(a,null,o(e.debugInfo.newQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",Ct,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",Et,"("+c(e.status)+")",1)])))),128)),e.debugInfo.newQueue.items.length>5?(r(),s("div",Tt," ... +"+c(e.debugInfo.newQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",Rt," (empty) "))])])),_:1}),p(w,{cols:"12",md:"4"},{default:h((()=>[m("div",It,[m("div",At,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[6]||(t[6]=[g("mdi-alert-circle")]))),_:1}),t[7]||(t[7]=m("strong",null,"Failed Cards Queue",-1))]),m("div",Mt,[m("span",Nt,"Length: "+c(e.debugInfo.failedQueue.length),1),m("span",$t,"Dequeued: "+c(e.debugInfo.failedQueue.dequeueCount),1)]),e.debugInfo.failedQueue.items.length>0?(r(),s("div",Dt,[(r(!0),s(a,null,o(e.debugInfo.failedQueue.items.slice(0,5),((e,t)=>(r(),s("div",{key:t,class:"debug-item"},[m("span",Ot,c(t)+": "+c(e.courseID)+"::"+c(e.cardID),1),m("span",Lt,"("+c(e.status)+")",1)])))),128)),e.debugInfo.failedQueue.items.length>5?(r(),s("div",Pt," ... +"+c(e.debugInfo.failedQueue.items.length-5)+" more ",1)):i("",!0)])):(r(),s("div",Bt," (empty) "))])])),_:1})])),_:1}),p(x,{dense:""},{default:h((()=>[p(w,{cols:"12"},{default:h((()=>[p(_,{class:"my-2"}),m("div",zt,[m("div",jt,[p(k,{size:"x-small",class:"mr-1"},{default:h((()=>t[8]||(t[8]=[g("mdi-database")]))),_:1}),t[9]||(t[9]=m("strong",null,"Hydrated Cards Cache",-1))]),m("div",Ut,[m("span",Ft,"Cached: "+c(e.debugInfo.hydratedCache.count),1),m("span",qt,"Failed Cache: "+c(e.debugInfo.hydratedCache.failedCacheSize),1)]),e.debugInfo.hydratedCache.items.length>0?(r(),s("div",Vt,[(r(!0),s(a,null,o(e.debugInfo.hydratedCache.items.slice(0,8),((e,t)=>(r(),s("div",{key:t,class:"debug-item d-inline-block mr-3"},[m("span",Ht,c(e.courseID)+"::"+c(e.cardID),1)])))),128)),e.debugInfo.hydratedCache.items.length>8?(r(),s("div",Zt," ... +"+c(e.debugInfo.hydratedCache.items.length-8)+" more ",1)):i("",!0)])):(r(),s("div",Kt," (empty) "))])])),_:1})])),_:1})])),_:1})])),_:1})):i("",!0)}],["__scopeId","data-v-1a6ac7a1"]]);var Wt={};!function e(t,n,s,r){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),a="function"==typeof Path2D&&"function"==typeof DOMMatrix;function o(){}function l(e){var s=n.exports.Promise,r=void 0!==s?s:t.Promise;return"function"==typeof r?new r(e):(e(o,o),null)}var c,d,u,h,p,g,m=/* @__PURE__ */function(e,t){return{transform:function(n){if(e)return n;if(t.has(n))return t.get(n);var s=new OffscreenCanvas(n.width,n.height);return s.getContext("2d").drawImage(n,0,0),t.set(n,s),s},clear:function(){t.clear()}}}(function(){if(!t.OffscreenCanvas)return!1;var e=new OffscreenCanvas(1,1),n=e.getContext("2d");n.fillRect(0,0,1,1);var s=e.transferToImageBitmap();try{n.createPattern(s,"no-repeat")}catch(r){return!1}return!0}(),/* @__PURE__ */new Map),f=(u=Math.floor(1e3/60),h={},p=0,"function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame?(c=function(e){var t=Math.random();return h[t]=requestAnimationFrame((function n(s){p===s||p+u-1<s?(p=s,delete h[t],e()):h[t]=requestAnimationFrame(n)})),t},d=function(e){h[e]&&cancelAnimationFrame(h[e])}):(c=function(e){return setTimeout(e,u)},d=function(e){return clearTimeout(e)}),{frame:c,cancel:d}),b=/* @__PURE__ */function(){var t,n,r={};return function(){if(t)return t;if(!s&&i){var a=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join("\n");try{t=new Worker(URL.createObjectURL(new Blob([a])))}catch(o){return void 0!==typeof console&&"function"==typeof console.warn&&console.warn("🎊 Could not load worker",o),null}!function(e){function t(t,n){e.postMessage({options:t||{},callback:n})}e.init=function(t){var n=t.transferControlToOffscreen();e.postMessage({canvas:n},[n])},e.fire=function(s,i,a){if(n)return t(s,null),n;var o=Math.random().toString(36).slice(2);return n=l((function(i){function l(t){t.data.callback===o&&(delete r[o],e.removeEventListener("message",l),n=null,m.clear(),a(),i())}e.addEventListener("message",l),t(s,o),r[o]=l.bind(null,{data:{callback:o}})}))},e.reset=function(){for(var t in e.postMessage({reset:!0}),r)r[t](),delete r[t]}}(t)}return t}}(),y={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function k(e,t,n){return function(e,t){return t?t(e):e}(e&&null!=e[t]?e[t]:y[t],n)}function v(e){return e<0?0:Math.floor(e)}function w(e){return parseInt(e,16)}function x(e){return e.map(_)}function _(e){var t=String(e).replace(/[^0-9a-f]/gi,"");return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:w(t.substring(0,2)),g:w(t.substring(2,4)),b:w(t.substring(4,6))}}function S(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function C(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function E(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,s=t.x+t.random*t.tiltCos,r=t.y+t.random*t.tiltSin,i=t.wobbleX+t.random*t.tiltCos,o=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+(1-n)+")",e.beginPath(),a&&"path"===t.shape.type&&"string"==typeof t.shape.path&&Array.isArray(t.shape.matrix))e.fill(function(e,t,n,s,r,i,a){var o=new Path2D(e),l=new Path2D;l.addPath(o,new DOMMatrix(t));var c=new Path2D;return c.addPath(l,new DOMMatrix([Math.cos(a)*r,Math.sin(a)*r,-Math.sin(a)*i,Math.cos(a)*i,n,s])),c}(t.shape.path,t.shape.matrix,t.x,t.y,.1*Math.abs(i-s),.1*Math.abs(o-r),Math.PI/10*t.wobble));else if("bitmap"===t.shape.type){var l=Math.PI/10*t.wobble,c=.1*Math.abs(i-s),d=.1*Math.abs(o-r),u=t.shape.bitmap.width*t.scalar,h=t.shape.bitmap.height*t.scalar,p=new DOMMatrix([Math.cos(l)*c,Math.sin(l)*c,-Math.sin(l)*d,Math.cos(l)*d,t.x,t.y]);p.multiplySelf(new DOMMatrix(t.shape.matrix));var g=e.createPattern(m.transform(t.shape.bitmap),"no-repeat");g.setTransform(p),e.globalAlpha=1-n,e.fillStyle=g,e.fillRect(t.x-u/2,t.y-h/2,u,h),e.globalAlpha=1}else if("circle"===t.shape)e.ellipse?e.ellipse(t.x,t.y,Math.abs(i-s)*t.ovalScalar,Math.abs(o-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):function(e,t,n,s,r,i,a,o,l){e.save(),e.translate(t,n),e.rotate(i),e.scale(s,r),e.arc(0,0,1,a,o,l),e.restore()}(e,t.x,t.y,Math.abs(i-s)*t.ovalScalar,Math.abs(o-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if("star"===t.shape)for(var f=Math.PI/2*3,b=4*t.scalar,y=8*t.scalar,k=t.x,v=t.y,w=5,x=Math.PI/w;w--;)k=t.x+Math.cos(f)*y,v=t.y+Math.sin(f)*y,e.lineTo(k,v),f+=x,k=t.x+Math.cos(f)*b,v=t.y+Math.sin(f)*b,e.lineTo(k,v),f+=x;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(r)),e.lineTo(Math.floor(i),Math.floor(o)),e.lineTo(Math.floor(s),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function T(e,n){var a,o=!e,c=!!k(n||{},"resize"),d=!1,u=k(n,"disableForReducedMotion",Boolean),h=i&&!!k(n||{},"useWorker")?b():null,p=o?S:C,g=!(!e||!h)&&!!e.__confetti_initialized,y="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion)").matches;function w(t,n,i){for(var o,c,d,u,h,g=k(t,"particleCount",v),b=k(t,"angle",Number),y=k(t,"spread",Number),w=k(t,"startVelocity",Number),_=k(t,"decay",Number),S=k(t,"gravity",Number),C=k(t,"drift",Number),T=k(t,"colors",x),R=k(t,"ticks",Number),I=k(t,"shapes"),A=k(t,"scalar"),M=!!k(t,"flat"),N=function(e){var t=k(e,"origin",Object);return t.x=k(t,"x",Number),t.y=k(t,"y",Number),t}(t),$=g,D=[],O=e.width*N.x,L=e.height*N.y;$--;)D.push((o={x:O,y:L,angle:b,spread:y,startVelocity:w,color:T[$%T.length],shape:I[(u=0,h=I.length,Math.floor(Math.random()*(h-u))+u)],ticks:R,decay:_,gravity:S,drift:C,scalar:A,flat:M},c=void 0,d=void 0,c=o.angle*(Math.PI/180),d=o.spread*(Math.PI/180),{x:o.x,y:o.y,wobble:10*Math.random(),wobbleSpeed:Math.min(.11,.1*Math.random()+.05),velocity:.5*o.startVelocity+Math.random()*o.startVelocity,angle2D:-c+(.5*d-Math.random()*d),tiltAngle:(.5*Math.random()+.25)*Math.PI,color:o.color,shape:o.shape,tick:0,totalTicks:o.ticks,decay:o.decay,drift:o.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:3*o.gravity,ovalScalar:.6,scalar:o.scalar,flat:o.flat}));return a?a.addFettis(D):(a=function(e,t,n,i,a){var o,c,d=t.slice(),u=e.getContext("2d"),h=l((function(t){function l(){o=c=null,u.clearRect(0,0,i.width,i.height),m.clear(),a(),t()}o=f.frame((function t(){!s||i.width===r.width&&i.height===r.height||(i.width=e.width=r.width,i.height=e.height=r.height),i.width||i.height||(n(e),i.width=e.width,i.height=e.height),u.clearRect(0,0,i.width,i.height),(d=d.filter((function(e){return E(u,e)}))).length?o=f.frame(t):l()})),c=l}));return{addFettis:function(e){return d=d.concat(e),h},canvas:e,promise:h,reset:function(){o&&f.cancel(o),c&&c()}}}(e,D,p,n,i),a.promise)}function _(n){var s=u||k(n,"disableForReducedMotion",Boolean),r=k(n,"zIndex",Number);if(s&&y)return l((function(e){e()}));o&&a?e=a.canvas:o&&!e&&(e=function(e){var t=document.createElement("canvas");return t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.pointerEvents="none",t.style.zIndex=e,t}(r),document.body.appendChild(e)),c&&!g&&p(e);var i={width:e.width,height:e.height};function m(){if(h){var t={getBoundingClientRect:function(){if(!o)return e.getBoundingClientRect()}};return p(t),void h.postMessage({resize:{width:t.width,height:t.height}})}i.width=i.height=null}function f(){a=null,c&&(d=!1,t.removeEventListener("resize",m)),o&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,g=!1)}return h&&!g&&h.init(e),g=!0,h&&(e.__confetti_initialized=!0),c&&!d&&(d=!0,t.addEventListener("resize",m,!1)),h?h.fire(n,i,f):w(n,i,f)}return _.reset=function(){h&&h.reset(),a&&a.reset()},_}function R(){return g||(g=T(null,{useWorker:!0,resize:!0})),g}n.exports=function(){return R().apply(this,arguments)},n.exports.reset=function(){R().reset()},n.exports.create=T,n.exports.shapeFromPath=function(e){if(!a)throw new Error("path confetti are not supported in this browser");var t,n;"string"==typeof e?t=e:(t=e.path,n=e.matrix);var s=new Path2D(t),r=document.createElement("canvas").getContext("2d");if(!n){for(var i,o,l=1e3,c=l,d=l,u=0,h=0,p=0;p<l;p+=2)for(var g=0;g<l;g+=2)r.isPointInPath(s,p,g,"nonzero")&&(c=Math.min(c,p),d=Math.min(d,g),u=Math.max(u,p),h=Math.max(h,g));i=u-c,o=h-d;var m=Math.min(10/i,10/o);n=[m,0,0,m,-Math.round(i/2+c)*m,-Math.round(o/2+d)*m]}return{type:"path",path:t,matrix:n}},n.exports.shapeFromText=function(e){var t,n=1,s="#000000",r='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';"string"==typeof e?t=e:(t=e.text,n="scalar"in e?e.scalar:n,r="fontFamily"in e?e.fontFamily:r,s="color"in e?e.color:s);var i=10*n,a=i+"px "+r,o=new OffscreenCanvas(i,i),l=o.getContext("2d");l.font=a;var c=l.measureText(t),d=Math.ceil(c.actualBoundingBoxRight+c.actualBoundingBoxLeft),u=Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent),h=c.actualBoundingBoxLeft+2,p=c.actualBoundingBoxAscent+2;d+=4,u+=4,(l=(o=new OffscreenCanvas(d,u)).getContext("2d")).font=a,l.fillStyle=s,l.fillText(t,h,p);var g=1/n;return{type:"bitmap",bitmap:o.transferToImageBitmap(),matrix:[g,0,0,g,-d*g/2,-u*g/2]}}}(function(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:this||{}}(),Wt,!1);const Qt=Wt.exports;Wt.exports.create;const Yt=n({name:"StudySession",ref:{},components:{CardViewer:ot,StudySessionTimer:at,SkMouseTrap:xe,HeatMap:ue,SessionControllerDebug:Gt},props:{sessionTimeLimit:{type:Number,required:!0},contentSources:{type:Array,required:!0},user:{type:Object,required:!0},dataLayer:{type:Object,required:!0},sessionConfig:{type:Object,default:()=>({likesConfetti:!1})},getViewComponent:{type:Function,required:!0}},emits:["session-finished","session-started","card-loaded","card-response","time-changed","session-prepared","session-error"],data:()=>({cardID:"",view:null,data:[],courseID:"",card_elo:1e3,courseNames:{},cardCount:1,sessionController:null,sessionPrepared:!1,sessionFinished:!1,sessionRecord:[],percentageRemaining:100,timerIsActive:!0,loading:!1,userCourseRegDoc:null,sessionContentSources:[],timeRemaining:300,intervalHandler:null,cardType:"",debugMode:!0===window.debugMode}),computed:{currentCard(){return this.sessionRecord[this.sessionRecord.length-1]}},async created(){this.userCourseRegDoc=await this.user.getCourseRegistrationsDoc(),console.log("[StudySession] Created lifecycle hook - starting initSession"),await this.initSession(),console.log("[StudySession] InitSession completed in created hook")},methods:{user_elo(e){const t=this.userCourseRegDoc.courses.find((t=>t.courseID===e));return q(t?t.elo:void 0)},handleClassroomMessage(){return e=>(Ee({text:this.user?.getUsername()||"[Unknown user]",status:U.ok}),console.log("[StudySession] There was a change in the classroom DB:"),console.log(`[StudySession] change: ${e}`),console.log(`[StudySession] Stringified change: ${JSON.stringify(e)}`),{})},incrementSessionClock(){const e=60*this.sessionTimeLimit-this.timeRemaining;this.sessionController.addTime(Math.min(e,60)),this.tick()},tick(){this.timeRemaining=this.sessionController.secondsRemaining,this.percentageRemaining=this.timeRemaining>60?this.timeRemaining/(60*this.sessionTimeLimit)*100:this.timeRemaining/60*100,this.$emit("time-changed",this.timeRemaining),0===this.timeRemaining&&clearInterval(this.intervalHandler)},async initSession(){let e=[];try{console.log(`[StudySession] starting study session w/ sources: ${JSON.stringify(this.contentSources)}`),console.log("[StudySession] Beginning preparation process"),this.sessionContentSources=R((await Promise.all(this.contentSources.map((async e=>{try{return await Y(e,this.user)}catch(t){return console.error(`Failed to load study source: ${e.type}/${e.id}`,t),null}})))).filter((e=>null!==e))),this.timeRemaining=60*this.sessionTimeLimit,e=await Promise.all(this.contentSources.filter((e=>"classroom"===e.type)).map((async e=>await this.dataLayer.getClassroomDB(e.id,"student")))),e.forEach((e=>{})),this.sessionController=R(new J(this.sessionContentSources,60*this.sessionTimeLimit,this.dataLayer,this.getViewComponent)),this.sessionController.sessionRecord=this.sessionRecord,await this.sessionController.prepareSession(),this.intervalHandler=setInterval(this.tick,1e3),this.sessionPrepared=!0,console.log("[StudySession] Session preparation complete, emitting session-prepared event"),this.$emit("session-prepared"),console.log("[StudySession] Event emission completed")}catch(t){console.error("[StudySession] Error during session preparation:",t),this.$emit("session-error",{message:"Failed to prepare study session",error:t})}try{this.contentSources.filter((e=>"course"===e.type)).forEach((async e=>this.courseNames[e.id]=(await this.dataLayer.getCoursesDB().getCourseConfig(e.id)).name)),console.log(`[StudySession] Session created:\n ${this.sessionController?.toString()||"Session controller not initialized"}\n User courses: ${this.contentSources.filter((e=>"course"===e.type)).map((e=>e.id)).toString()}\n User classrooms: ${e.map((e=>e._id)).toString()||"No classrooms"}\n `)}catch(t){console.error("[StudySession] Error during final session setup:",t)}if(this.sessionController)try{this.$emit("session-started"),this.loadCard(await this.sessionController.nextCard())}catch(t){console.error("[StudySession] Error loading next card:",t),this.$emit("session-error",{message:"Failed to load study card",error:t})}else console.error("[StudySession] Cannot load card: session controller not initialized"),this.$emit("session-error",{message:"Study session initialization failed"})},countCardViews(e,t){return this.sessionRecord.filter((n=>n.card.course_id===e&&n.card.card_id===t)).length},async processResponse(e){let t;this.$emit("card-response",e),this.timerIsActive=!0,e.cardID=this.cardID,e.courseID=this.courseID,this.currentCard.records.push(e),console.log("[StudySession] StudySession.processResponse is running...");try{t=this.logCardRecord(e)}catch(a){console.log(`Caught ${a} during putCardHistory...`)}let n=1,s=1;if(Ye(this.$refs.cardViewer?.$refs.activeView)){const e=this.$refs.cardViewer.$refs.activeView;n=e.maxAttemptsPerView,s=e.maxSessionViews}const r=this.countCardViews(this.courseID,this.cardID),i=await this.sessionController.submitResponse(e,t,this.userCourseRegDoc,this.currentCard,this.courseID,this.cardID,n,s,r);try{this.handleUIFeedback(i)}catch(o){console.error(`[StudySession] Error handling UI feedback: ${o}.\n\nResult: ${JSON.stringify(i)}`)}i.shouldLoadNextCard&&this.loadCard(await this.sessionController.nextCard(i.nextCardAction)),i.shouldClearFeedbackShadow&&this.clearFeedbackShadow()},handleUIFeedback(e){if(e.isCorrect){try{this.$refs.shadowWrapper&&void 0!==e.performanceScore&&(this.$refs.shadowWrapper.setAttribute("style",`--r: ${255*(1-e.performanceScore)}; --g:255`),this.$refs.shadowWrapper.classList.add("correct"))}catch(t){console.warn(`[StudySession] Error setting shadowWrapper style: ${t}`)}this.sessionConfig.likesConfetti&&Qt({origin:{y:1,x:.25+.5*Math.random()},disableForReducedMotion:!0,angle:60+60*Math.random()})}else try{this.$refs.shadowWrapper&&this.$refs.shadowWrapper.classList.add("incorrect")}catch(t){console.warn(`[StudySession] Error setting shadowWrapper style: ${t}`)}},clearFeedbackShadow(){setTimeout((()=>{try{this.$refs.shadowWrapper&&this.$refs.shadowWrapper.classList.remove("correct","incorrect")}catch(e){console.warn(`[StudySession] Error clearing shadowWrapper style: ${e}`)}}),1250)},async logCardRecord(e){console.log("[StudySession] About to call user.putCardRecord...");const t=await this.user.putCardRecord(e);return console.log("[StudySession] user.putCardRecord completed"),t},async loadCard(e){if(this.loading)console.warn("Attempted to load card while loading another...");else{if(console.log(`[StudySession] loading: ${JSON.stringify(e)}`),null===e)return this.sessionFinished=!0,void this.$emit("session-finished",this.sessionRecord);this.cardType=e.item.status,this.loading=!0;try{this.cardCount++,this.data=e.data,this.view=R(e.view),this.cardID=e.item.cardID,this.courseID=e.item.courseID,this.card_elo=e.item.elo||1e3,this.sessionRecord.push({card:{course_id:e.item.courseID,card_id:e.item.cardID,card_elo:this.card_elo},item:e.item,records:[]}),this.$emit("card-loaded",{courseID:e.item.courseID,cardID:e.item.cardID,cardCount:this.cardCount})}catch(t){console.warn(`[StudySession] Error loading card ${JSON.stringify(e)}:\n\t${JSON.stringify(t)}, ${t}`),this.loading=!1;W(t)&&Q(e.item)&&(console.warn(`Card was deleted: ${e.item.courseID}::${e.item.cardID}`),this.user.removeScheduledCardReview(e.item.reviewID)),this.loadCard(await this.sessionController.nextCard("dismiss-error"))}finally{this.loading=!1}}}}}),Jt={key:0,class:"StudySession"},Xt={key:1,class:"text-h4"},en={key:0},tn={key:2,ref:"shadowWrapper"},nn={key:3};const sn=/* @__PURE__ */oe(Yt,[["render",function(e,t,n,l,g,f){const b=d("v-spacer"),y=d("v-progress-circular"),k=d("v-row"),v=d("session-controller-debug"),w=d("heat-map"),_=d("card-viewer"),C=d("StudySessionTimer"),E=d("v-col"),T=d("SkMouseTrap");return e.sessionPrepared?(r(),s("div",Jt,[p(k,{align:"center"},{default:h((()=>[p(b),e.loading?(r(),u(y,{key:0,color:"primary",indeterminate:"",size:"32",width:"4"})):i("",!0)])),_:1}),e.debugMode?(r(),u(v,{key:0,"session-controller":e.sessionController},null,8,["session-controller"])):i("",!0),t[2]||(t[2]=m("br",null,null,-1)),e.sessionFinished?(r(),s("div",Xt,[t[1]||(t[1]=m("p",null,"Study session finished! Great job!",-1)),e.sessionController?(r(),s("p",en,c(e.sessionController.report),1)):i("",!0),p(w,{"activity-records-getter":()=>e.user.getActivityRecords()},null,8,["activity-records-getter"])])):(r(),s("div",tn,[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[(r(),u(_,{ref:"cardViewer",key:e.cardID,class:x(e.loading?"muted":""),view:e.view,data:e.data,card_id:e.cardID,course_id:e.courseID,"session-order":e.cardCount,user_elo:e.user_elo(e.courseID),card_elo:e.card_elo,onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,8,["class","view","data","card_id","course_id","session-order","user_elo","card_elo"]))])),_:1})],512)),t[3]||(t[3]=m("br",null,null,-1)),e.sessionController?(r(),s("div",nn,[(r(!0),s(a,null,o(e.sessionController.failedCount,(e=>(r(),s("span",{key:e,class:"text-h5"},"•")))),128))])):i("",!0),p(k,{align:"center",class:"footer-controls pa-5"},{default:h((()=>[p(E,{cols:"auto",class:"d-flex flex-grow-0 mr-auto"},{default:h((()=>[p(C,{"time-remaining":e.timeRemaining,"session-time-limit":e.sessionTimeLimit,onAddTime:e.incrementSessionClock},null,8,["time-remaining","session-time-limit","onAddTime"])])),_:1}),p(b),p(E,{cols:"auto",class:"footer-right"},{default:h((()=>[p(T)])),_:1})])),_:1})])):i("",!0)}],["__scopeId","data-v-dc537be7"]]);let rn=null;const an=()=>rn,on={install(e,t){const n=t?.pinia;n&&(e=>{rn=e})(n)}},ln=()=>{const e=an();return e&&ne(e),te("previewMode",{state:()=>({previewMode:!1}),actions:{setPreviewMode(e){this.previewMode=e}},getters:{isPreviewMode(){return this.previewMode}}})()},cn=n({name:"UserInput",data:()=>({answer:"",previewModeStore:null}),mounted(){this.previewModeStore=ln()},computed:{autofocus(){return!this.previewModeStore?.previewMode},autoFocus(){return this.autofocus}},methods:{submitAnswer(e){return this.submit(e)},submit(e){return this.getQuestionViewAncestor().submitAnswer(e,this.$options.name??"UserInput")},getQuestionViewAncestor(){let e=this.$parent,t=0;for(;e&&!Ye(e);){const n=e.$parent;if(!n){const e="\nUserInput.submit() has failed.\nThe input element has no QuestionView ancestor element.";throw V(e),new Error(e)}if(e=n,t++,t>100){const e="\nUserInput.submit() has failed.\nExceeded maximum ancestor lookup depth.";throw V(e),new Error(e)}}if(!e)throw new Error("No QuestionView ancestor found");return e}}});const dn=/* @__PURE__ */oe(n({name:"MultipleChoiceOption",components:{MarkdownRenderer:I((()=>Promise.resolve().then((()=>si))))},props:{content:{type:String,required:!0},selected:{type:Boolean,required:!0},number:{type:Number,required:!0},setSelection:{type:Function,required:!0},submit:{type:Function,required:!0},markedWrong:{type:Boolean,required:!0}},computed:{className(){let e;switch(this.number){case 0:e="bg-red";break;case 1:e="bg-purple";break;case 2:e="bg-indigo";break;case 3:e="bg-light-blue";break;case 4:e="bg-teal";break;case 5:e="bg-deep-orange";break;default:e="bg-grey"}if(this.selected&&!this.markedWrong)return`choice selected ${e} lighten-3 elevation-8`;if(this.selected||this.markedWrong){if(this.selected&&this.markedWrong)return"choice selected grey lighten-2 elevation-8";if(!this.selected&&this.markedWrong)return"choice not-selected grey lighten-2 elevation-0";throw new Error("'selected' and 'markedWrong' props in MultipleChoiceOption are in an impossible configuration.")}return`choice not-selected ${e} lighten-4 elevation-1`}},methods:{select(){this.setSelection(this.number)},submitThisOption(){this.markedWrong||(this.select(),this.submit())}}}),[["render",function(e,t,n,s,i,a){const o=d("markdown-renderer"),l=d("v-card");return r(),u(l,{class:x(`${e.className}`),onMouseover:e.select,onClick:e.submitThisOption},{default:h((()=>[p(o,{md:e.content},null,8,["md"])])),_:1},8,["class","onMouseover","onClick"])}],["__scopeId","data-v-96de7172"]]),un=n({name:"RadioMultipleChoice",components:{MultipleChoiceOption:dn},extends:cn,props:{choiceList:{type:Array,required:!0}},data:()=>({currentSelection:-1,incorrectSelections:[],containerRef:null,_registeredHotkeys:[]}),watch:{choiceList:{immediate:!0,handler(e){e?.length&&this.bindKeys()}}},mounted(){this.containerRef&&this.containerRef.focus()},unmounted(){this.unbindKeys()},methods:{forwardSelection(){if(!this.choiceIsWrong(this.choiceList[this.currentSelection])&&-1!==this.currentSelection){const e={choiceList:this.choiceList,selection:this.currentSelection};this.submitAnswer(e).isCorrect||this.incorrectSelections.push(this.currentSelection)}},setSelection(e){e<this.choiceList.length&&(this.currentSelection=e)},incrementSelection(){-1===this.currentSelection?this.currentSelection=Math.ceil(this.choiceList.length/2):this.currentSelection=Math.min(this.choiceList.length-1,this.currentSelection+1)},decrementSelection(){-1===this.currentSelection?this.currentSelection=Math.floor(this.choiceList.length/2-1):this.currentSelection=Math.max(0,this.currentSelection-1)},choiceIsWrong(e){let t=!1;return this.incorrectSelections.forEach((n=>{this.choiceList[n]===e&&(t=!0)})),t},bindKeys(){const e=[{hotkey:"left",callback:this.decrementSelection,command:"Move selection left"},{hotkey:"right",callback:this.incrementSelection,command:"Move selection right"},{hotkey:"enter",callback:this.forwardSelection,command:"Submit selection"},...Array.from({length:this.choiceList.length},((e,t)=>({hotkey:(t+1).toString(),callback:()=>this.setSelection(t),command:`Select ${(e=>{switch(e){case 0:return"first";case 1:return"second";case 2:return"third";case 3:return"fourth";case 4:return"fifth";case 5:return"sixth";default:return`${e+1}th`}})(t)} option`})))];ke.addBinding(e),this._registeredHotkeys=e.map((e=>e.hotkey))},unbindKeys(){this._registeredHotkeys&&this._registeredHotkeys.forEach((e=>{ke.removeBinding(e)}))}}}),hn={ref:"containerRef",class:"multipleChoice"};const pn=/* @__PURE__ */oe(un,[["render",function(e,t,n,i,l,c){const h=d("MultipleChoiceOption");return r(),s("div",hn,[(r(!0),s(a,null,o(e.choiceList,((t,n)=>(r(),u(h,{key:n,content:t,selected:e.choiceList.indexOf(t)===e.currentSelection,number:e.choiceList.indexOf(t),"set-selection":e.setSelection,submit:e.forwardSelection,"marked-wrong":e.choiceIsWrong(t)},null,8,["content","selected","number","set-selection","submit","marked-wrong"])))),128))],512)}]]),gn=n({name:"TrueFalse",components:{RadioMultipleChoice:pn},props:{MouseTrap:{type:Object,required:!0},submit:{type:Function,required:!0}}}),mn={"data-viewable":"TrueFalse"};const fn=/* @__PURE__ */oe(gn,[["render",function(e,t,n,i,a,o){const l=d("RadioMultipleChoice");return r(),s("div",mn,[p(l,{"choice-list":["True","False"],MouseTrap:e.MouseTrap,submit:e.submit},null,8,["MouseTrap","submit"])])}]]);const bn=/* @__PURE__ */oe(n({name:"UserInputNumber",ref:{},extends:cn,methods:{mounted(){this.$refs.input.focus()},isNumeric:e=>!isNaN(Number.parseFloat(e)),makeNumeric(e){if("string"==typeof e)return Number.parseFloat(e);throw new Error("Expected a string, got "+typeof e)}}}),[["render",function(e,t,n,s,i,a){const o=d("v-text-field"),l=d("v-container");return r(),u(l,{class:"pa-0"},{default:h((()=>[p(o,{ref:"input",modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t),"prepend-icon":"edit",autofocus:e.autofocus,"row-height":"24","toggle-keys":"[13,32]",class:"text-h5",rules:[e.isNumeric],onKeyup:t[1]||(t[1]=C((t=>e.submitAnswer(e.makeNumeric(e.answer))),["enter"]))},null,8,["modelValue","autofocus","rules"])])),_:1})}],["__scopeId","data-v-a56dcd1c"]]),yn=n({name:"UserInputString",extends:cn,props:{icon:{type:Boolean,required:!1}},computed:{prependIcon(){return this.icon?"edit":""}},mounted(){this.$refs.input?.focus()},methods:{}}),kn={class:"user-input-container"},vn=["autofocus"];const wn=/* @__PURE__ */oe(yn,[["render",function(e,t,n,i,a,o){return r(),s("span",kn,[A(m("input",{"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t),autofocus:e.autofocus,type:"text",class:"user-input-string",ref:"input",onKeyup:t[1]||(t[1]=C((t=>e.submitAnswer(e.answer)),["enter"]))},null,40,vn),[[M,e.answer]])])}],["__scopeId","data-v-aa14961f"]]),xn=n({name:"FillInInput",components:{UserInputString:wn},props:{text:{type:String,required:!0}},setup(e){const t=b("text"),n=b(""),s=y((()=>e.text.split("||").length>1));return v((()=>{console.log(`fillinCreated w/ text: ${e.text}`),n.value=e.text.substring(2,e.text.length-2),console.log(`fillin text trimmed to: ${n.value}`);n.value.split("||").length>1&&(t.value="radio")})),{inputType:t,radioType:s,processedText:n}}}),_n={key:0,class:"text-h5 underline"};const Sn=/* @__PURE__ */oe(xn,[["render",function(e,t,n,i,a,o){const l=d("user-input-string");return e.radioType?(r(),s("span",_n,"             ")):(r(),u(l,{key:1,id:"input",icon:!1,type:"text",value:e.processedText},null,8,["value"]))}],["__scopeId","data-v-486ac035"]]);const Cn=/* @__PURE__ */oe(n({name:"CardLoader",components:{CardViewer:ot},props:{sessionOrder:{type:Number,required:!1,default:0},qualified_id:{type:Object,required:!0},viewLookup:{type:Function,required:!0}},data:()=>({loading:!0,view:null,data:[],courseID:"",cardID:""}),created(){this.loadCard()},watch:{qualified_id:{immediate:!0,handler(){this.loadCard()}}},methods:{processResponse(e){V(`\n Card was displayed at ${e.timeStamp}\n User spent ${e.timeSpent} milliseconds with the card.\n `),this.$emit("emitResponse",e)},async loadCard(){const e=this.qualified_id;console.log(`Card Loader displaying: ${e.courseID}::${e.cardID}`),this.loading=!0;const t=e.courseID,n=e.cardID,s=X().getCourseDB(t);try{const e=await s.getCourseDoc(n),r=this.viewLookup(e.id_view),i=e.id_displayable_data.map((e=>s.getCourseDoc(e,{attachments:!0,binary:!0}))),a=[];for(const t of i){const e=await t;a.unshift(H(e))}this.data=a,this.view=R(r),this.cardID=n,this.courseID=t}catch(r){throw new Error(`[CardLoader] Error loading card: ${JSON.stringify(r)}, ${r}`)}finally{this.loading=!1,this.$emit("card-loaded")}}}}),[["render",function(e,t,n,s,a,o){const l=d("card-viewer");return e.loading?i("",!0):(r(),u(l,{key:0,class:x(["ma-2",e.loading?"muted":""]),view:e.view,data:e.data,card_id:e.cardID,course_id:e.courseID,"session-order":e.sessionOrder,onEmitResponse:t[0]||(t[0]=t=>e.processResponse(t))},null,8,["class","view","data","card_id","course_id","session-order"]))}],["__scopeId","data-v-93f758b5"]]);function En(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Tn={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Rn(e){Tn=e}const In={exec:()=>null};function An(e,t=""){let n="string"==typeof e?e:e.source;const s={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(Mn.caret,"$1"),n=n.replace(e,r),s},getRegex:()=>new RegExp(n,t)};return s}const Mn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Nn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$n=/(?:[*+-]|\d{1,9}[.)])/,Dn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,On=An(Dn).replace(/bull/g,$n).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ln=An(Dn).replace(/bull/g,$n).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Pn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Bn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,zn=An(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Bn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),jn=An(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$n).getRegex(),Un="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Fn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qn=An("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Fn).replace("tag",Un).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Vn=An(Pn).replace("hr",Nn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Un).getRegex(),Hn={blockquote:An(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Vn).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:zn,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Nn,html:qn,lheading:On,list:jn,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Vn,table:In,text:/^[^\n]+/},Zn=An("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Un).getRegex(),Kn={...Hn,lheading:Ln,table:Zn,paragraph:An(Pn).replace("hr",Nn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zn).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Un).getRegex()},Gn={...Hn,html:An("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Fn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:In,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:An(Pn).replace("hr",Nn).replace("heading"," *#{1,6} *[^\n]").replace("lheading",On).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Wn=/^( {2,}|\\)\n(?!\s*$)/,Qn=/[\p{P}\p{S}]/u,Yn=/[\s\p{P}\p{S}]/u,Jn=/[^\s\p{P}\p{S}]/u,Xn=An(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Yn).getRegex(),es=/(?!~)[\p{P}\p{S}]/u,ts=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ns=An(ts,"u").replace(/punct/g,Qn).getRegex(),ss=An(ts,"u").replace(/punct/g,es).getRegex(),rs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",is=An(rs,"gu").replace(/notPunctSpace/g,Jn).replace(/punctSpace/g,Yn).replace(/punct/g,Qn).getRegex(),as=An(rs,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,es).getRegex(),os=An("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Jn).replace(/punctSpace/g,Yn).replace(/punct/g,Qn).getRegex(),ls=An(/\\(punct)/,"gu").replace(/punct/g,Qn).getRegex(),cs=An(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[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])?)+(?![-_])/).getRegex(),ds=An(Fn).replace("(?:--\x3e|$)","--\x3e").getRegex(),us=An("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ds).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hs=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ps=An(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",hs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gs=An(/^!?\[(label)\]\[(ref)\]/).replace("label",hs).replace("ref",Bn).getRegex(),ms=An(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bn).getRegex(),fs={_backpedal:In,anyPunctuation:ls,autolink:cs,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:Wn,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:In,emStrongLDelim:ns,emStrongRDelimAst:is,emStrongRDelimUnd:os,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:ps,nolink:ms,punctuation:Xn,reflink:gs,reflinkSearch:An("reflink|nolink(?!\\()","g").replace("reflink",gs).replace("nolink",ms).getRegex(),tag:us,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:In},bs={...fs,link:An(/^!?\[(label)\]\((.*?)\)/).replace("label",hs).getRegex(),reflink:An(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",hs).getRegex()},ys={...fs,emStrongRDelimAst:as,emStrongLDelim:ss,url:An(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ks={...ys,br:An(Wn).replace("{2,}","*").getRegex(),text:An(ys.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vs={normal:Hn,gfm:Kn,pedantic:Gn},ws={normal:fs,gfm:ys,breaks:ks,pedantic:bs},xs={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_s=e=>xs[e];function Ss(e,t){if(t){if(Mn.escapeTest.test(e))return e.replace(Mn.escapeReplace,_s)}else if(Mn.escapeTestNoEncode.test(e))return e.replace(Mn.escapeReplaceNoEncode,_s);return e}function Cs(e){try{e=encodeURI(e).replace(Mn.percentDecode,"%")}catch{return null}return e}function Es(e,t){const n=e.replace(Mn.findPipe,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(Mn.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Mn.slashPipe,"|");return n}function Ts(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){if(e.charAt(s-r-1)!==t)break;r++}return e.slice(0,s-r)}function Rs(e,t,n,s,r){const i=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,e}return{type:"image",raw:n,href:i,title:a,text:o}}class _Tokenizer{constructor(e){t(this,"options"),t(this,"rules"),t(this,"lexer"),this.options=e||Tn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Ts(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(null===s)return t;const r=s[1];return t.split("\n").map((e=>{const t=e.match(n.other.beginningSpace);if(null===t)return e;const[s]=t;return s.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=Ts(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ts(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=Ts(t[0],"\n").split("\n"),n="",s="";const r=[];for(;e.length>0;){let t=!1;const i=[];let a;for(a=0;a<e.length;a++)if(this.rules.other.blockquoteStart.test(e[a]))i.push(e[a]),t=!0;else{if(t)break;i.push(e[a])}e=e.slice(a);const o=i.join("\n"),l=o.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${o}`:o,s=s?`${s}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,r,!0),this.lexer.state.top=c,0===e.length)break;const d=r.at(-1);if("code"===d?.type)break;if("blockquote"===d?.type){const t=d,i=t.raw+"\n"+e.join("\n"),a=this.blockquote(i);r[r.length-1]=a,n=n.substring(0,n.length-t.raw.length)+a.raw,s=s.substring(0,s.length-t.text.length)+a.text;break}if("list"!==d?.type);else{const t=d,i=t.raw+"\n"+e.join("\n"),a=this.list(i);r[r.length-1]=a,n=n.substring(0,n.length-d.raw.length)+a.raw,s=s.substring(0,s.length-t.raw.length)+a.raw,e=i.substring(r.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let a=!1;for(;e;){let n=!1,s="",o="";if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=!l.trim(),u=0;if(this.options.pedantic?(u=2,o=l.trimStart()):d?u=t[1].length+1:(u=t[2].search(this.rules.other.nonSpaceChar),u=u>4?1:u,o=l.slice(u),u+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(s+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=this.rules.other.nextBulletRegex(u),n=this.rules.other.hrRegex(u),r=this.rules.other.fencesBeginRegex(u),i=this.rules.other.headingBeginRegex(u),a=this.rules.other.htmlBeginRegex(u);for(;e;){const h=e.split("\n",1)[0];let p;if(c=h,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),p=c):p=c.replace(this.rules.other.tabCharGlobal," "),r.test(c))break;if(i.test(c))break;if(a.test(c))break;if(t.test(c))break;if(n.test(c))break;if(p.search(this.rules.other.nonSpaceChar)>=u||!c.trim())o+="\n"+p.slice(u);else{if(d)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(r.test(l))break;if(i.test(l))break;if(n.test(l))break;o+="\n"+c}d||c.trim()||(d=!0),s+=h+"\n",e=e.substring(h.length+1),l=p.slice(u)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(s)&&(a=!0));let h,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(o),p&&(h="[ ] "!==p[0],o=o.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:s,task:!!p,checked:h,loose:!1,text:o,tokens:[]}),r.raw+=s}const o=r.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!this.rules.other.tableDelimiter.test(t[2]))return;const n=Es(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const e of s)this.rules.other.tableAlignRight.test(e)?i.align.push("right"):this.rules.other.tableAlignCenter.test(e)?i.align.push("center"):this.rules.other.tableAlignLeft.test(e)?i.align.push("left"):i.align.push(null);for(let e=0;e<n.length;e++)i.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:i.align[e]});for(const e of r)i.rows.push(Es(e,i.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=Ts(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Rs(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Rs(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,a=n,o=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=l.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){a+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+o);const t=[...s[0]][0].length,l=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(e),s=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&s&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class _Lexer{constructor(e){t(this,"tokens"),t(this,"options"),t(this,"state"),t(this,"tokenizer"),t(this,"inlineQueue"),this.tokens=[],this.tokens.links=/* @__PURE__ */Object.create(null),this.options=e||Tn,this.options.tokenizer=this.options.tokenizer||new _Tokenizer,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:Mn,block:vs.normal,inline:ws.normal};this.options.pedantic?(n.block=vs.pedantic,n.inline=ws.pedantic):this.options.gfm&&(n.block=vs.gfm,this.options.breaks?n.inline=ws.breaks:n.inline=ws.gfm),this.tokenizer.rules=n}static get rules(){return{block:vs,inline:ws}}static lex(e,t){return new _Lexer(t).lex(e)}static lexInline(e,t){return new _Lexer(t).inlineTokens(e)}lex(e){e=e.replace(Mn.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Mn.tabCharGlobal," ").replace(Mn.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const n=t.at(-1);1===s.raw.length&&void 0!==n?n.raw+="\n":t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.at(-1).src=n.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let r=e;if(this.options.extensions?.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){const i=t.at(-1);n&&"paragraph"===i?.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length)}else if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r=!1,i="";for(;e;){let s;if(r||(i=""),r=!1,this.options.extensions?.inline?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===s.type&&"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,n,i)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(a)){e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(i=s.raw.slice(-1)),r=!0;const n=t.at(-1);"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class _Renderer{constructor(e){t(this,"options"),t(this,"parser"),this.options=e||Tn}space(e){return""}code({text:e,lang:t,escaped:n}){const s=(t||"").match(Mn.notSpaceStart)?.[0],r=e.replace(Mn.endingNewline,"")+"\n";return s?'<pre><code class="language-'+Ss(s)+'">'+(n?r:Ss(r,!0))+"</code></pre>\n":"<pre><code>"+(n?r:Ss(r,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,n=e.start;let s="";for(let i=0;i<e.items.length;i++){const t=e.items[i];s+=this.listitem(t)}const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+s+"</"+r+">\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+Ss(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let s="";for(let r=0;r<e.rows.length;r++){const t=e.rows[r];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+s+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ss(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),r=Cs(e);if(null===r)return s;let i='<a href="'+(e=r)+'"';return t&&(i+=' title="'+Ss(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:n}){const s=Cs(e);if(null===s)return Ss(n);let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${Ss(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ss(e.text)}}class _TextRenderer{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class _Parser{constructor(e){t(this,"options"),t(this,"renderer"),t(this,"textRenderer"),this.options=e||Tn,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,t){return new _Parser(t).parse(e)}static parseInline(e,t){return new _Parser(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions?.renderers?.[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}const i=r;switch(i.type){case"space":n+=this.renderer.space(i);continue;case"hr":n+=this.renderer.hr(i);continue;case"heading":n+=this.renderer.heading(i);continue;case"code":n+=this.renderer.code(i);continue;case"table":n+=this.renderer.table(i);continue;case"blockquote":n+=this.renderer.blockquote(i);continue;case"list":n+=this.renderer.list(i);continue;case"html":n+=this.renderer.html(i);continue;case"paragraph":n+=this.renderer.paragraph(i);continue;case"text":{let r=i,a=this.renderer.text(r);for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],a+="\n"+this.renderer.text(r);n+=t?this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a,escaped:!0}]}):a;continue}default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions?.renderers?.[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}const i=r;switch(i.type){case"escape":case"text":n+=t.text(i);break;case"html":n+=t.html(i);break;case"link":n+=t.link(i);break;case"image":n+=t.image(i);break;case"strong":n+=t.strong(i);break;case"em":n+=t.em(i);break;case"codespan":n+=t.codespan(i);break;case"br":n+=t.br(i);break;case"del":n+=t.del(i);break;default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class _Hooks{constructor(e){t(this,"options"),t(this,"block"),this.options=e||Tn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}}t(_Hooks,"passThroughHooks",/* @__PURE__ */new Set(["preprocess","postprocess","processAllTokens"]));const Is=new class Marked{constructor(...e){t(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),t(this,"options",this.setOptions),t(this,"parse",this.parseMarkdown(!0)),t(this,"parseInline",this.parseMarkdown(!1)),t(this,"Parser",_Parser),t(this,"Renderer",_Renderer),t(this,"TextRenderer",_TextRenderer),t(this,"Lexer",_Lexer),t(this,"Tokenizer",_Tokenizer),t(this,"Hooks",_Hooks),this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)n=n.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const r=e[s].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new _Renderer(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const s=n,r=e.renderer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,r=e.tokenizer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new _Hooks;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const s=n,r=e.hooks[s],i=t[s];_Hooks.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>i.call(t,e)));const n=r.call(t,e);return i.call(t,n)}:t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _Lexer.lex(e,t??this.defaults)}parser(e,t){return _Parser.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{const s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(!0===this.defaults.async&&!1===s.async)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return i(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const a=r.hooks?r.hooks.provideLexer():e?_Lexer.lex:_Lexer.lexInline,o=r.hooks?r.hooks.provideParser():e?_Parser.parse:_Parser.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then((e=>a(e,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>o(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let e=a(t,r);r.hooks&&(e=r.hooks.processAllTokens(e)),r.walkTokens&&this.walkTokens(e,r.walkTokens);let n=o(e,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(l){return i(l)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Ss(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function As(e,t){return Is.parse(e,t)}As.options=As.setOptions=function(e){return Is.setOptions(e),As.defaults=Is.defaults,Rn(As.defaults),As},As.getDefaults=En,As.defaults=Tn,As.use=function(...e){return Is.use(...e),As.defaults=Is.defaults,Rn(As.defaults),As},As.walkTokens=function(e,t){return Is.walkTokens(e,t)},As.parseInline=Is.parseInline,As.Parser=_Parser,As.parser=_Parser.parse,As.Renderer=_Renderer,As.TextRenderer=_TextRenderer,As.Lexer=_Lexer,As.lexer=_Lexer.lex,As.Tokenizer=_Tokenizer,As.Hooks=_Hooks,As.parse=As,As.options,As.setOptions,As.use,As.walkTokens,As.parseInline,_Parser.parse;const Ms=_Lexer.lex;function Ns(e,t,n){if(0===e.length)return[];let s=[];const r=e.indexOf(t),i=e.indexOf(n,r);return r>=0&&i>r?(s.push(e.substring(0,r)),s.push(e.substring(r,i+n.length)),s=s.concat(Ns(e.substring(i+n.length),t,n)),s):[e]}function $s(e){if(Os(e)){const t=Ns(e.text,"{{","}}"),n=Ns(e.raw,"{{","}}");if(t.length===n.length)return t.map(((e,s)=>({type:"text",text:t[s],raw:n[s]})));throw new Error("Error parsing markdown")}return[e]}function Ds(e){let t=[];if(Os(e)){const n=Ns(e.text,"{{","}}"),s=Ns(e.raw,"{{","}}");if(n.length===s.length){for(let e=0;e<n.length;e++){const r={type:"text",text:n[e],raw:s[e]};Ls(r)?t.push(r):Ms(s[e]).forEach((e=>{"paragraph"===e.type?t=t.concat(e.tokens):t.push(e)}))}return t}throw new Error("Error parsing Markdown")}return t.push(e),t}function Os(e){if("text"===e.type||"paragraph"===e.type){const t=e.raw.indexOf("{{"),n=e.raw.indexOf("}}");return-1!==t&&-1!==n&&n>t}return!1}function Ls(e){return"text"===e.type&&e.text.startsWith("{{")&&e.text.endsWith("}}")}function Ps(e){if(e.length>1e4)return null;const t=e.match(/^\{\{\s*<([\w-]+)((?:\s+[\w-]+="[^"]*")*)\s*\/>\s*\}\}$/);if(!t)return null;const n=t[1],s=t[2],r={};if(s){const e=/\s+([\w-]+)="([^"]*)"/g;let t;for(;null!==(t=e.exec(s));)r[t[1]]=t[2]}return{componentName:n,props:r}}function Bs(e){if(e.length>1e4)return!1;const t=e.trim();return/^<[\w-]+(?:\s+[\w-]+="[^"]*")*\s*\/?>$/.test(t)}function zs(e){return Ps("text"in e?e.text:"raw"in e?e.raw:"")}const js=/* @__PURE__ */oe(/* @__PURE__ */n({__name:"AudioAutoPlayer",props:{src:{}},setup(e){const t=e,n=b([]),s=b([]),i=b(!1);let a=null;const o=e=>{if((e=>{try{return!isNaN(n.value[e].duration)}catch(t){throw new Error("AudioPlayer does not have an element at this index:",t)}})(e))if(n.value[e].play(),e+1<n.value.length){const t=1e3*(n.value[e].duration+.7);s.value.push(setTimeout((()=>{i.value&&o(e+1)}),t))}else setTimeout((()=>{i.value=!1}),1e3*n.value[e].duration),setTimeout((()=>{a=null}),1e3*n.value[e].duration+500);else setTimeout(o,100,e)},l=()=>{null===a||a===N()?(a=N(),i.value=!0,o(0)):setTimeout(l,100)};return v((()=>{a=null,"string"==typeof t.src?n.value.push(new Audio(t.src)):t.src.forEach((e=>{n.value.push(new Audio(e))}));const e=[{hotkey:"up",callback:l,command:"Replay Audio"}];ke.addBinding(e),l()})),w((()=>{ke.removeBinding("up"),i.value=!1,setTimeout((()=>{a=null}),500),s.value.forEach(clearTimeout),console.log("Audio stopping..."),n.value.forEach((e=>{e.paused||(e.pause(),e.currentTime=0)}))})),(e,t)=>{const n=d("v-icon"),s=d("v-btn");return r(),u(s,{size:"large",icon:"",color:i.value?"primary lighten-3":"primary",class:x({playing:i.value}),onClick:l},{default:h((()=>[p(n,null,{default:h((()=>t[0]||(t[0]=[g("mdi-volume-high")]))),_:1})])),_:1},8,["color","class"])}}}),[["__scopeId","data-v-e1a0f62c"]]);var Us,Fs;function qs(){if(Fs)return Us;function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{const s=t[n],r=typeof s;"object"!==r&&"function"!==r||Object.isFrozen(s)||e(s)})),t}Fs=1;class Response{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function n(e,...t){const n=/* @__PURE__ */Object.create(null);for(const s in e)n[s]=e[s];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope;class HTMLRenderer{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const r=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class TokenTree{constructor(){this.rootNode=r(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=r({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{TokenTree._collapse(e)})))}}class TokenTreeEmitter extends TokenTree{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new HTMLRenderer(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function i(e){return e?"string"==typeof e?e:e.source:null}function a(e){return c("(?=",e,")")}function o(e){return c("(?:",e,")*")}function l(e){return c("(?:",e,")?")}function c(...e){return e.map((e=>i(e))).join("")}function d(...e){const t=function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e);return"("+(t.capture?"":"?:")+e.map((e=>i(e))).join("|")+")"}function u(e){return new RegExp(e.toString()+"|").exec("").length-1}const h=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function p(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let s=i(e),r="";for(;s.length>0;){const e=h.exec(s);if(!e){r+=s;break}r+=s.substring(0,e.index),s=s.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?r+="\\"+String(Number(e[1])+t):(r+=e[0],"("===e[0]&&n++)}return r})).map((e=>`(${e})`)).join(t)}const g="[a-zA-Z]\\w*",m="[a-zA-Z_]\\w*",f="\\b\\d+(\\.\\d+)?",b="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",y="\\b(0b[01]+)",k={begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[k]},w={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[k]},x=function(e,t,s={}){const r=n({scope:"comment",begin:e,end:t,contains:[]},s);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=d("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:c(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},_=x("//","$"),S=x("/\\*","\\*/"),C=x("#","$"),E={scope:"number",begin:f,relevance:0},T={scope:"number",begin:b,relevance:0},R={scope:"number",begin:y,relevance:0},I={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[k,{begin:/\[/,end:/\]/,relevance:0,contains:[k]}]},A={scope:"title",begin:g,relevance:0},M={scope:"title",begin:m,relevance:0},N={begin:"\\.\\s*"+m,relevance:0};var $=/* @__PURE__ */Object.freeze({__proto__:null,APOS_STRING_MODE:v,BACKSLASH_ESCAPE:k,BINARY_NUMBER_MODE:R,BINARY_NUMBER_RE:y,COMMENT:x,C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:_,C_NUMBER_MODE:T,C_NUMBER_RE:b,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:C,IDENT_RE:g,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:N,NUMBER_MODE:E,NUMBER_RE:f,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:w,REGEXP_MODE:I,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=c(t,/.*\b/,e.binary,/\b.*/)),n({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:A,UNDERSCORE_IDENT_RE:m,UNDERSCORE_TITLE_MODE:M});function D(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function O(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function L(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=D,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function P(e,t){Array.isArray(e.illegal)&&(e.illegal=d(...e.illegal))}function B(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function z(e,t){void 0===e.relevance&&(e.relevance=1)}const j=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]})),e.keywords=n.keywords,e.begin=c(n.beforeMatch,a(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},U=["of","and","for","in","not","or","if","then","parent","list","value"];function F(e,t,n="keyword"){const s=/* @__PURE__ */Object.create(null);return"string"==typeof e?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach((function(n){Object.assign(s,F(e[n],t,n))})),s;function r(e,n){t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((function(t){const n=t.split("|");s[n[0]]=[e,q(n[0],n[1])]}))}}function q(e,t){return t?Number(t):function(e){return U.includes(e.toLowerCase())}(e)?0:1}const V={},H=e=>{console.error(e)},Z=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K=(e,t)=>{V[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),V[`${e}/${t}`]=!0)},G=new Error;function W(e,t,{key:n}){let s=0;const r=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+s]=r[o],i[o+s]=!0,s+=u(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function Q(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw H("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),G;if("object"!=typeof e.beginScope||null===e.beginScope)throw H("beginScope must be object"),G;W(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw H("skip, excludeEnd, returnEnd not compatible with endScope: {}"),G;if("object"!=typeof e.endScope||null===e.endScope)throw H("endScope must be object"),G;W(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}}(e)}function Y(e){function t(t,n){return new RegExp(i(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class MultiRegex{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=u(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=t(p(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),s=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,s)}}class ResumableMultiRegex{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new MultiRegex;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=n(e.classNameAliases||{}),function s(r,a){const o=r;if(r.isCompiled)return o;[O,B,Q,j].forEach((e=>e(r,a))),e.compilerExtensions.forEach((e=>e(r,a))),r.__beforeBegin=null,[L,P,z].forEach((e=>e(r,a))),r.isCompiled=!0;let l=null;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords),l=r.keywords.$pattern,delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=F(r.keywords,e.case_insensitive)),o.keywordPatternRe=t(l,!0),a&&(r.begin||(r.begin=/\B|\b/),o.beginRe=t(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),r.end&&(o.endRe=t(o.end)),o.terminatorEnd=i(o.end)||"",r.endsWithParent&&a.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+a.terminatorEnd)),r.illegal&&(o.illegalRe=t(r.illegal)),r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return n(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(J(e))return n(e,{starts:e.starts?n(e.starts):null});if(Object.isFrozen(e))return n(e);return e}("self"===e?r:e)}))),r.contains.forEach((function(e){s(e,o)})),r.starts&&s(r.starts,a),o.matcher=function(e){const t=new ResumableMultiRegex;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(o),o}(e)}function J(e){return!!e&&(e.endsWithParent||J(e.starts))}class HTMLInjectionError extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const X=t,ee=n,te=Symbol("nomatch"),ne=function(t){const n=/* @__PURE__ */Object.create(null),s=/* @__PURE__ */Object.create(null),r=[];let i=!0;const u="Could not find the language '{}', did you forget to load/include a language module?",h={disableAutodetect:!0,name:"Plain text",contains:[]};let p={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:TokenTreeEmitter};function g(e){return p.noHighlightRe.test(e)}function m(e,t,n){let s="",r="";"object"==typeof t?(s=e,n=t.ignoreIllegals,r=t.language):(K("10.7.0","highlight(lang, code, ...args) has been deprecated."),K("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),r=e,s=t),void 0===n&&(n=!0);const i={code:s,language:r};S("before:highlight",i);const a=i.result?i.result:f(i.language,i.code,n);return a.code=i.code,S("after:highlight",a),a}function f(e,t,s,r){const a=/* @__PURE__ */Object.create(null);function o(){if(!C.keywords)return void T.addText(R);let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(R),n="";for(;t;){n+=R.substring(e,t.index);const r=x.case_insensitive?t[0].toLowerCase():t[0],i=(s=r,C.keywords[s]);if(i){const[e,s]=i;if(T.addText(n),n="",a[r]=(a[r]||0)+1,a[r]<=7&&(I+=s),e.startsWith("_"))n+=t[0];else{const n=x.classNameAliases[e]||e;c(t[0],n)}}else n+=t[0];e=C.keywordPatternRe.lastIndex,t=C.keywordPatternRe.exec(R)}var s;n+=R.substring(e),T.addText(n)}function l(){null!=C.subLanguage?function(){if(""===R)return;let e=null;if("string"==typeof C.subLanguage){if(!n[C.subLanguage])return void T.addText(R);e=f(C.subLanguage,R,!0,E[C.subLanguage]),E[C.subLanguage]=e._top}else e=b(R,C.subLanguage.length?C.subLanguage:null);C.relevance>0&&(I+=e.relevance),T.__addSublanguage(e._emitter,e.language)}():o(),R=""}function c(e,t){""!==e&&(T.startScope(t),T.addText(e),T.endScope())}function d(e,t){let n=1;const s=t.length-1;for(;n<=s;){if(!e._emit[n]){n++;continue}const s=x.classNameAliases[e[n]]||e[n],r=t[n];s?c(r,s):(R=r,o(),R=""),n++}}function h(e,t){return e.scope&&"string"==typeof e.scope&&T.openNode(x.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(c(R,x.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),C=Object.create(e,{parent:{value:C}}),C}function g(e,t,n){let s=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(s){if(e["on:end"]){const n=new Response(e);e["on:end"](t,n),n.isMatchIgnored&&(s=!1)}if(s){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return g(e.parent,t,n)}function m(e){return 0===C.matcher.regexIndex?(R+=e[0],1):(N=!0,0)}function y(e){const n=e[0],s=t.substring(e.index),r=g(C,e,s);if(!r)return te;const i=C;C.endScope&&C.endScope._wrap?(l(),c(n,C.endScope._wrap)):C.endScope&&C.endScope._multi?(l(),d(C.endScope,e)):i.skip?R+=n:(i.returnEnd||i.excludeEnd||(R+=n),l(),i.excludeEnd&&(R=n));do{C.scope&&T.closeNode(),C.skip||C.subLanguage||(I+=C.relevance),C=C.parent}while(C!==r.parent);return r.starts&&h(r.starts,e),i.returnEnd?0:n.length}let k={};function v(n,r){const a=r&&r[0];if(R+=n,null==a)return l(),0;if("begin"===k.type&&"end"===r.type&&k.index===r.index&&""===a){if(R+=t.slice(r.index,r.index+1),!i){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=k.rule,t}return 1}if(k=r,"begin"===r.type)return function(e){const t=e[0],n=e.rule,s=new Response(n),r=[n.__beforeBegin,n["on:begin"]];for(const i of r)if(i&&(i(e,s),s.isMatchIgnored))return m(t);return n.skip?R+=t:(n.excludeBegin&&(R+=t),l(),n.returnBegin||n.excludeBegin||(R=t)),h(n,e),n.returnBegin?0:t.length}(r);if("illegal"===r.type&&!s){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(C.scope||"<unnamed>")+'"');throw e.mode=C,e}if("end"===r.type){const e=y(r);if(e!==te)return e}if("illegal"===r.type&&""===a)return R+="\n",1;if(M>1e5&&M>3*r.index){throw new Error("potential infinite loop, way more iterations than matches")}return R+=a,a.length}const x=w(e);if(!x)throw H(u.replace("{}",e)),new Error('Unknown language: "'+e+'"');const _=Y(x);let S="",C=r||_;const E={},T=new p.__emitter(p);!function(){const e=[];for(let t=C;t!==x;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach((e=>T.openNode(e)))}();let R="",I=0,A=0,M=0,N=!1;try{if(x.__emitTokens)x.__emitTokens(t,T);else{for(C.matcher.considerAll();;){M++,N?N=!1:C.matcher.considerAll(),C.matcher.lastIndex=A;const e=C.matcher.exec(t);if(!e)break;const n=v(t.substring(A,e.index),e);A=e.index+n}v(t.substring(A))}return T.finalize(),S=T.toHTML(),{language:e,value:S,relevance:I,illegal:!1,_emitter:T,_top:C}}catch($){if($.message&&$.message.includes("Illegal"))return{language:e,value:X(t),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:A,context:t.slice(A-100,A+100),mode:$.mode,resultSoFar:S},_emitter:T};if(i)return{language:e,value:X(t),illegal:!1,relevance:0,errorRaised:$,_emitter:T,_top:C};throw $}}function b(e,t){t=t||p.languages||Object.keys(n);const s=function(e){const t={value:X(e),illegal:!1,relevance:0,_top:h,_emitter:new p.__emitter(p)};return t._emitter.addText(e),t}(e),r=t.filter(w).filter(_).map((t=>f(t,e,!1)));r.unshift(s);const i=r.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(w(e.language).supersetOf===t.language)return 1;if(w(t.language).supersetOf===e.language)return-1}return 0})),[a,o]=i,l=a;return l.secondBest=o,l}function y(e){let t=null;const n=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=p.languageDetectRe.exec(t);if(n){const t=w(n[1]);return t||(Z(u.replace("{}",n[1])),Z("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>g(e)||w(e)))}(e);if(g(n))return;if(S("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),p.throwUnescapedHTML)){throw new HTMLInjectionError("One of your code blocks includes unescaped HTML.",e.innerHTML)}t=e;const r=t.textContent,i=n?m(r,{language:n,ignoreIllegals:!0}):b(r);e.innerHTML=i.value,e.dataset.highlighted="yes",function(e,t,n){const r=t&&s[t]||n;e.classList.add("hljs"),e.classList.add(`language-${r}`)}(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),S("after:highlightElement",{el:e,result:i,text:r})}let k=!1;function v(){if("loading"===document.readyState)return k||window.addEventListener("DOMContentLoaded",(function(){v()}),!1),void(k=!0);document.querySelectorAll(p.cssSelector).forEach(y)}function w(e){return e=(e||"").toLowerCase(),n[e]||n[s[e]]}function x(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{s[e.toLowerCase()]=t}))}function _(e){const t=w(e);return t&&!t.disableAutodetect}function S(e,t){const n=e;r.forEach((function(e){e[n]&&e[n](t)}))}Object.assign(t,{highlight:m,highlightAuto:b,highlightAll:v,highlightElement:y,highlightBlock:function(e){return K("10.7.0","highlightBlock will be removed entirely in v12.0"),K("10.7.0","Please use highlightElement now."),y(e)},configure:function(e){p=ee(p,e)},initHighlighting:()=>{v(),K("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){v(),K("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(e,s){let r=null;try{r=s(t)}catch(a){if(H("Language definition for '{}' could not be registered.".replace("{}",e)),!i)throw a;H(a),r=h}r.name||(r.name=e),n[e]=r,r.rawDefinition=s.bind(null,t),r.aliases&&x(r.aliases,{languageName:e})},unregisterLanguage:function(e){delete n[e];for(const t of Object.keys(s))s[t]===e&&delete s[t]},listLanguages:function(){return Object.keys(n)},getLanguage:w,registerAliases:x,autoDetection:_,inherit:ee,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),r.push(e)},removePlugin:function(e){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString="11.11.1",t.regex={concat:c,lookahead:a,either:d,optional:l,anyNumberOfTimes:o};for(const a in $)"object"==typeof $[a]&&e($[a]);return Object.assign(t,$),t},se=ne({});return se.newInstance=()=>ne({}),Us=se,se.HighlightJS=se,se.default=se,Us}const Vs=/* @__PURE__ */he(/* @__PURE__ */qs());var Hs={component:n({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(e){var t=b(e.language);k((function(){return e.language}),(function(e){t.value=e}));var n=y((function(){return e.autodetect||!t.value})),s=y((function(){return!n.value&&!Vs.getLanguage(t.value)}));return{className:y((function(){return s.value?"":"hljs "+t.value})),highlightedCode:y((function(){var r;if(s.value)return console.warn('The language "'+t.value+'" you specified could not be found.'),e.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;");if(n.value){var i=Vs.highlightAuto(e.code);return t.value=null!==(r=i.language)&&void 0!==r?r:"",i.value}return(i=Vs.highlight(e.code,{language:t.value,ignoreIllegals:e.ignoreIllegals})).value}))}},render:function(){return $("pre",{},[$("code",{class:this.className,innerHTML:this.highlightedCode,tabindex:"0"})])}})};const Zs="[A-Za-z$_][0-9A-Za-z$_]*",Ks=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Gs=["true","false","null","undefined","NaN","Infinity"],Ws=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Qs=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ys=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Js=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Xs=[].concat(Ys,Ws,Qs);function er(e){const t=e.regex,n=Zs,s="<>",r="</>",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,s=e.input[n];if("<"===s||","===s)return void t.ignoreMatch();let r;">"===s&&(((e,{after:t})=>{const n="</"+e[0].slice(1);return-1!==e.input.indexOf(n,t)})(e,{after:n})||t.ignoreMatch());const i=e.input.substring(n);((r=i.match(/^\s*=/))||(r=i.match(/^\s+extends\s+/))&&0===r.index)&&t.ignoreMatch()}},a={$pattern:Zs,keyword:Ks,literal:Gs,built_in:Xs,"variable.language":Js},o="[0-9](_?[0-9])*",l=`\\.(${o})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},f={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];u.contains=b.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(b)});const y=[].concat(f,u.contains),k=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(y)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},w={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},x={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ws,...Qs]}},_={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/};const S={match:t.concat(/\b/,(C=[...Ys,"super","import"].map((e=>`${e}\\s*\\(`)),t.concat("(?!",C.join("|"),")")),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var C;const E={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[v]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,f,{match:/\$\d+/},d,x,{scope:"attr",match:n+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s,end:r},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},E,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},S,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},w,T,{match:/\$[(.]/}]}}const tr="[A-Za-z$_][0-9A-Za-z$_]*",nr=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],sr=["true","false","null","undefined","NaN","Infinity"],rr=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ir=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ar=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],or=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],lr=[].concat(ar,rr,ir);function cr(e){const t=e.regex,n=function(e){const t=e.regex,n=tr,s="<>",r="</>",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,s=e.input[n];if("<"===s||","===s)return void t.ignoreMatch();let r;">"===s&&(((e,{after:t})=>{const n="</"+e[0].slice(1);return-1!==e.input.indexOf(n,t)})(e,{after:n})||t.ignoreMatch());const i=e.input.substring(n);((r=i.match(/^\s*=/))||(r=i.match(/^\s+extends\s+/))&&0===r.index)&&t.ignoreMatch()}},a={$pattern:tr,keyword:nr,literal:sr,built_in:lr,"variable.language":or},o="[0-9](_?[0-9])*",l=`\\.(${o})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},f={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];u.contains=b.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(b)});const y=[].concat(f,u.contains),k=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(y)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},w={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},x={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rr,...ir]}},_={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},S={match:t.concat(/\b/,(C=[...ar,"super","import"].map((e=>`${e}\\s*\\(`)),t.concat("(?!",C.join("|"),")")),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0};var C;const E={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",I={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[v]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,g,m,f,{match:/\$\d+/},d,x,{scope:"attr",match:n+t.lookahead(":"),relevance:0},I,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[f,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s,end:r},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},E,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},S,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},w,T,{match:/\$[(.]/}]}}(e),s=tr,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},o={$pattern:tr,keyword:nr.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:sr,built_in:lr.concat(r),"variable.language":or},l={className:"meta",begin:"@"+s},c=(e,t,n)=>{const s=e.contains.findIndex((e=>e.label===t));if(-1===s)throw new Error("can not find mode to replace");e.contains.splice(s,1,n)};Object.assign(n.keywords,o),n.exports.PARAMS_CONTAINS.push(l);const d=n.contains.find((e=>"attr"===e.scope)),u=Object.assign({},d,{match:t.concat(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,u]),n.contains=n.contains.concat([l,i,a,u]),c(n,"shebang",e.SHEBANG()),c(n,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/});return n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const dr=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],ur=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),hr=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),pr=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),gr=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function mr(e){const t=e.regex,n=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}))(e),s=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+hr.join("|")+")"},{begin:":(:)?("+pr.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+gr.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:ur.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+dr.join("|")+")\\b"}]}}function fr(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(r,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[r,o,a,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[r,i,o,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function br(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(o);const l={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},c=e.SHEBANG({binary:`(${["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"].join("|")})`,relevance:10}),d={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[c,e.SHEBANG(),d,l,i,a,{match:/(\/[a-z._-]+)+/},o,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}}function yr(e){const t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function kr(e){const t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function vr(e){const t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],r={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},i={className:"meta",begin:/^(>>>|\.\.\.) /},a={className:"subst",begin:/\{/,end:/\}/,keywords:r,illegal:/#/},o={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,i,o,a]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,i,o,a]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,o,a]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,o,a]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u=`\\b|${s.join("|")}`,h={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},p={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:r,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,contains:["self",i,h,l,e.HASH_COMMENT_MODE]}]};return a.contains=[l,h,i],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:r,illegal:/(<\/|\?)|=>/,contains:[i,h,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},l,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[h,g,l]}]}}const wr={class:"code-block-wrapper pa-2"},xr={key:0,class:"language-indicator"},_r=/* @__PURE__ */n({__name:"CodeBlockRenderer",props:{code:{type:String,required:!0},language:{type:String,default:""}},setup(e){Vs.registerLanguage("js",er),Vs.registerLanguage("javascript",er),Vs.registerLanguage("ts",cr),Vs.registerLanguage("typescript",cr),Vs.registerLanguage("css",mr),Vs.registerLanguage("html",fr),Vs.registerLanguage("bash",br),Vs.registerLanguage("sh",br),Vs.registerLanguage("json",yr),Vs.registerLanguage("go",kr),Vs.registerLanguage("golang",kr),Vs.registerLanguage("python",vr);const t=N();return t&&t.appContext.app.component("highlightjs",Hs.component),(t,n)=>{const a=d("highlightjs");return r(),s("div",wr,[e.language?(r(),s("div",xr,c(e.language),1)):i("",!0),p(a,{language:e.language,code:e.code},null,8,["language","code"])])}}}),Sr={key:0},Cr={key:0},Er={key:0},Tr={key:1,class:"error--text"},Rr={key:1},Ir={key:2},Ar={key:1},Mr={key:1},Nr={key:0,class:"text-h2"},$r={key:1,class:"text-h3"},Dr={key:2,class:"text-h4"},Or={key:3},Lr={key:4},Pr={key:5},Br={key:2},zr={key:3,class:"text-h5"},jr={key:0},Ur=["href","title"],Fr={key:5},qr={key:6},Vr={key:7},Hr=["src","alt"],Zr={key:9},Kr={key:10},Gr={key:11},Wr=["align"],Qr=["innerHTML"],Yr=["innerHTML"],Jr={key:16},Xr={key:17},ei={key:18},ti=/* @__PURE__ */oe(/* @__PURE__ */n({__name:"MdTokenRenderer",props:{token:{type:Object,required:!0},last:{type:Boolean,required:!1,default:!1}},setup(e,{expose:t}){const n=D("markdownComponents",{}),l={fillIn:R(Sn),...n};function h(e){return Ls(e)}function p(e){return Os(e)}function g(e){return $s(e)}function b(e){return Ds(e)}function y(e){let t="";"text"in e&&"string"==typeof e.text?t=e.text:"raw"in e&&"string"==typeof e.raw&&(t=e.raw);const n=Ps(t);return n?{is:n.componentName,text:"",props:n.props}:{is:"fillIn",text:t,props:{}}}function k(e){const t=l[e];return t||(console.warn(`[MarkdownRenderer] Unknown component: "${e}". Available components: ${Object.keys(l).join(", ")}`),null)}function v(e){return e.replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}function w(e){return void 0===e.inLink&&"text"===e.type}return t({isComponent:h,containsComponent:p,splitTextToken:g,splitParagraphToken:b,parsedComponent:y,decodeBasicEntities:v,isText:w,components:l,getComponent:k}),(t,n)=>{const l=d("md-token-renderer",!0);return w(e.token)?(r(),s("span",Sr,[e.token.tokens&&0!==e.token.tokens.length?e.token.tokens&&0!==e.token.tokens.length?(r(),s("span",Ar,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0):(r(),s("span",Cr,[h(e.token)?(r(),s("span",Er,[!e.last&&k(y(e.token).is)?(r(),u(E(k(y(e.token).is)),f({key:0,text:y(e.token).text},y(e.token).props),null,16,["text"])):e.last||k(y(e.token).is)?i("",!0):(r(),s("span",Tr," [Unknown component: "+c(y(e.token).is)+"] ",1))])):p(e.token)?(r(),s("span",Rr,[(r(!0),s(a,null,o(g(e.token),((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):(r(),s("span",Ir,c(v(e.token.text)),1))]))])):"heading"===e.token.type?(r(),s("span",Mr,[1===e.token.depth?(r(),s("h1",Nr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):2===e.token.depth?(r(),s("h2",$r,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):3===e.token.depth?(r(),s("h3",Dr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):4===e.token.depth?(r(),s("h4",Or,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):5===e.token.depth?(r(),s("h5",Lr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):6===e.token.depth?(r(),s("h6",Pr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0)])):"strong"===e.token.type?(r(),s("strong",Br,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"paragraph"===e.token.type?(r(),s("p",zr,[p(e.token)?(r(),s("span",jr,[(r(!0),s(a,null,o(b(e.token),((t,n)=>(r(),u(l,{key:n,token:t,last:e.last&&1===e.token.tokens.length&&n===b(e.token).length-1},null,8,["token","last"])))),128))])):(r(!0),s(a,{key:1},o(e.token.tokens,((t,n)=>(r(),u(l,{key:n,token:t,last:e.last&&1===e.token.tokens.length},null,8,["token","last"])))),128))])):"link"===e.token.type?(r(),s("a",{key:4,href:e.token.href,title:e.token.title},[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))],8,Ur)):"list"===e.token.type&&!1===e.token.ordered?(r(),s("ul",Fr,[(r(!0),s(a,null,o(e.token.items,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"list"===e.token.type&&!0===e.token.ordered?(r(),s("ol",qr,[(r(!0),s(a,null,o(e.token.items,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"list_item"===e.token.type?(r(),s("li",Vr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"image"===e.token.type?(r(),s("img",{key:8,src:e.token.href,alt:e.token.title},null,8,Hr)):"hr"===e.token.type?(r(),s("hr",Zr)):"br"===e.token.type?(r(),s("br",Kr)):"del"===e.token.type?(r(),s("del",Gr)):"table"===e.token.type?(r(),s("table",{key:12,align:e.token.align},[m("thead",null,[(r(!0),s(a,null,o(e.token.header,((e,t)=>(r(),s("th",{key:t},c(e.text),1)))),128))]),m("tbody",null,[(r(!0),s(a,null,o(e.token.rows,((e,t)=>(r(),s("tr",{key:t},[(r(!0),s(a,null,o(e,((e,t)=>(r(),s("td",{key:t},c(e.text),1)))),128))])))),128))])],8,Wr)):"html"===e.token.type?(r(),s("span",{key:13,innerHTML:e.token.raw},null,8,Qr)):"code"===e.token.type?(r(),u(_r,{key:14,code:e.token.text,language:e.token.lang},null,8,["code","language"])):"codespan"===e.token.type?(r(),s("code",{key:15,class:"codespan",innerHTML:e.token.text},null,8,Yr)):"blockquote"===e.token.type?(r(),s("blockquote",Jr,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):"escape"===e.token.type?(r(),s("span",Xr,c(e.token.text),1)):"em"===e.token.type?(r(),s("em",ei,[(r(!0),s(a,null,o(e.token.tokens,((e,t)=>(r(),u(l,{key:t,token:e},null,8,["token"])))),128))])):i("",!0)}}}),[["__scopeId","data-v-de3eebd6"]]);const ni=/* @__PURE__ */oe(n({name:"MarkdownRenderer",components:{MdTokenRenderer:ti,AudioAutoPlayer:js},props:{md:{type:String,required:!0}},computed:{tokens(){return Ms(this.md)}}}),[["render",function(e,t,n,l,c,h){const p=d("md-token-renderer"),g=d("audio-auto-player");return r(),s("div",null,[(r(!0),s(a,null,o(e.tokens,((t,n)=>(r(),s("span",{key:n},[t.type?(r(),u(p,{key:0,token:t,last:n===e.tokens.length-1},null,8,["token","last"])):t.audio?(r(),u(g,{key:1,src:t.audio},null,8,["src"])):i("",!0)])))),128))])}]]),si=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ni},Symbol.toStringTag,{value:"Module"}));async function ri(){const e=ii();if(!e.onLoadComplete){let t=200;const n=50;for(;!e.onLoadComplete&&t>0;)await new Promise((e=>setTimeout(e,n))),t--;if(!e.onLoadComplete)throw new Error("User initialization timed out")}return X().getUserDB()}const ii=()=>{const e=an();return e&&ne(e),te("auth",{state:()=>({_user:void 0,loginAndRegistration:{init:!1,loggedIn:!1,regDialogOpen:!1,loginDialogOpen:!1},onLoadComplete:!1}),actions:{async init(){try{this._user=X().getUserDB(),this.loginAndRegistration.loggedIn=!!this._user&&this._user.isLoggedIn(),this.onLoadComplete=!0,this.loginAndRegistration.init=!0}catch(e){console.error("Failed to initialize auth store:",e),this.loginAndRegistration.loggedIn=!1,this.onLoadComplete=!0,this.loginAndRegistration.init=!0}},setLoginDialog(e){this.loginAndRegistration.loginDialogOpen=e},setRegDialog(e){this.loginAndRegistration.regDialogOpen=e},async resetUserData(){try{if(!this._user)throw new Error("No user available for data reset");const e=await this._user.resetUserData();if("ok"!==e.status)throw new Error(e.error||"Reset failed");return console.log("User data reset successfully"),e}catch(e){throw console.error("Failed to reset user data:",e),e}}},getters:{currentUser:async()=>ri(),isLoggedIn:e=>e.loginAndRegistration.loggedIn,isInitialized:e=>e.loginAndRegistration.init,status:e=>({loggedIn:e.loginAndRegistration.loggedIn,init:e.loginAndRegistration.init,user:e._user})}})()},ai=()=>{const e=an();return e&&ne(e),te("config",{state:()=>({config:{darkMode:!1,likesConfetti:!1,sessionTimeLimit:5}}),actions:{updateConfig(e){this.config=e},async updateDarkMode(e){this.config.darkMode=e;const t=await ri();t&&await t.setConfig({darkMode:e})},async updateLikesConfetti(e){this.config.likesConfetti=e;const t=await ri();t&&await t.setConfig({likesConfetti:e})},async updateSessionTimeLimit(e){this.config.sessionTimeLimit=e;const t=await ri();t&&await t.setConfig({sessionTimeLimit:e})},async hydrate(){try{const e=await ri();if(e){const t=await e.getConfig();console.log(`user config: ${JSON.stringify(t)}`),this.updateConfig(t)}else console.log("No user logged in, using default config")}catch(e){console.warn("Failed to hydrate config store, using defaults:",e)}},async init(){await this.hydrate()},resetDefaults(){this.config={darkMode:!1,likesConfetti:!1,sessionTimeLimit:5}}}})()};function oi(){const e=b(!0),t=b(!1),n=b(!1);return{config:y((()=>n.value?{showLoginRegistration:!1,showLogout:!1,showResetData:!0,logoutLabel:"",resetLabel:"Reset User Data"}:{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""})),isLoading:e,syncStrategyDetected:t,isLocalOnlyMode:n,detectSyncStrategy:async()=>{try{e.value=!0;const s=await ri(),r=s.syncStrategy?.canCreateAccount?.();n.value=!r,t.value=!0}catch(s){console.error("Failed to detect sync strategy:",s),n.value=!1,t.value=!0}finally{e.value=!1}}}}const li=/* @__PURE__ */oe(/* @__PURE__ */n({__name:"UserChip",props:{showLoginButton:{type:Boolean},redirectToPath:{}},setup(e){const t=se(),n=ii(),l=ai(),k=oi(),w=b(""),x=b([]),_=b(!1),S=b(""),E=y((()=>"reset"===S.value)),T=()=>{S.value="",_.value=!1},R=y((()=>x.value.length>0)),I=y((()=>k.config.value||{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""}));v((async()=>{const e=await ri();w.value=e.getUsername(),await k.detectSyncStrategy()}));const A=async()=>{t.push(`/u/${(await ri()).getUsername()}`)},M=async()=>{t.push(`/u/${(await ri()).getUsername()}/stats`)},N=async()=>{(await n._user.logout()).ok&&(n.loginAndRegistration={init:!0,loggedIn:!1,regDialogOpen:!1,loginDialogOpen:!1},l.resetDefaults(),t.push("/home"))},$=async()=>{try{await n.resetUserData(),l.resetDefaults(),T(),t.push("/home")}catch(e){console.error("Failed to reset user data:",e)}};return(e,t)=>{const n=d("v-icon"),l=d("v-avatar"),b=d("v-chip"),y=d("v-list-item-title"),k=d("v-list-item"),v=d("v-divider"),D=d("v-list"),O=d("v-menu"),L=d("v-badge"),P=d("v-card-title"),B=d("v-text-field"),z=d("v-card-text"),j=d("v-spacer"),U=d("v-btn"),F=d("v-card-actions"),q=d("v-card"),V=d("v-dialog");return r(),s(a,null,[p(L,{content:x.value.length,"model-value":R.value,color:"accent",location:"end top"},{default:h((()=>[p(O,{location:"bottom end",transition:"scale-transition"},{activator:h((({props:e})=>[p(b,f(e,{class:"ma-2"}),{default:h((()=>[p(l,{start:"",class:"bg-primary"},{default:h((()=>[p(n,null,{default:h((()=>t[4]||(t[4]=[g("mdi-school")]))),_:1})])),_:1}),g(" "+c(w.value),1)])),_:2},1040)])),default:h((()=>[p(D,null,{default:h((()=>[(r(!0),s(a,null,o(x.value,(e=>(r(),u(k,{key:e,onClick:t=>(e=>{const t=x.value.indexOf(e);x.value.splice(t,1)})(e)},{default:h((()=>[p(y,null,{default:h((()=>[g(c(e),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),x.value.length?(r(),u(v,{key:0})):i("",!0),p(k,{onClick:M},{prepend:h((()=>[p(n,null,{default:h((()=>t[5]||(t[5]=[g("mdi-trending-up")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>t[6]||(t[6]=[g("Stats")]))),_:1})])),_:1}),p(k,{onClick:A},{prepend:h((()=>[p(n,null,{default:h((()=>t[7]||(t[7]=[g("mdi-cog")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>t[8]||(t[8]=[g("Settings")]))),_:1})])),_:1}),I.value.showLogout?(r(),u(k,{key:1,onClick:N},{prepend:h((()=>[p(n,null,{default:h((()=>t[9]||(t[9]=[g("mdi-logout")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>[g(c(I.value.logoutLabel),1)])),_:1})])),_:1})):i("",!0),I.value.showResetData?(r(),u(k,{key:2,onClick:t[0]||(t[0]=e=>_.value=!0)},{prepend:h((()=>[p(n,null,{default:h((()=>t[10]||(t[10]=[g("mdi-delete-sweep")]))),_:1})])),default:h((()=>[p(y,null,{default:h((()=>[g(c(I.value.resetLabel),1)])),_:1})])),_:1})):i("",!0)])),_:1})])),_:1})])),_:1},8,["content","model-value"]),p(V,{modelValue:_.value,"onUpdate:modelValue":t[3]||(t[3]=e=>_.value=e),"max-width":"500px",persistent:""},{default:h((()=>[p(q,null,{default:h((()=>[p(P,{class:"text-h5 d-flex align-center"},{default:h((()=>[p(n,{color:"warning",class:"mr-3"},{default:h((()=>t[11]||(t[11]=[g("mdi-alert-circle")]))),_:1}),t[12]||(t[12]=g(" Reset All User Data "))])),_:1}),p(z,null,{default:h((()=>[t[13]||(t[13]=m("p",{class:"mb-4"},"This will permanently delete:",-1)),t[14]||(t[14]=m("ul",{class:"mb-4"},[m("li",null,"All course progress and history"),m("li",null,"Scheduled card reviews"),m("li",null,"Course registrations"),m("li",null,"User preferences")],-1)),t[15]||(t[15]=m("p",{class:"mb-4 text-error font-weight-bold"},"This cannot be undone.",-1)),p(B,{modelValue:S.value,"onUpdate:modelValue":t[1]||(t[1]=e=>S.value=e),label:'Type "reset" to confirm',outlined:"",dense:"",onKeyup:t[2]||(t[2]=C((e=>E.value&&$()),["enter"]))},null,8,["modelValue"])])),_:1}),p(F,null,{default:h((()=>[p(j),p(U,{text:"",onClick:T},{default:h((()=>t[16]||(t[16]=[g("Cancel")]))),_:1}),p(U,{color:"error",disabled:!E.value,onClick:$},{default:h((()=>t[17]||(t[17]=[g(" Reset All Data ")]))),_:1},8,["disabled"])])),_:1})])),_:1})])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-9a38a213"]]),ci={class:"d-flex flex-column align-start"},di={class:"mb-2"},ui=/* @__PURE__ */oe(/* @__PURE__ */n({__name:"UserLogin",props:{redirectTo:{default:"/study"}},emits:["toggle","loginSuccess","forgotPassword"],setup(e,{emit:t}){const n=e,s=t,a=se(),o=re(),l=ii(),c=ai(),f=b(""),k=b(""),v=b(!1),w=b(!1),x=b(!1),S=b(7e3),C=b(void 0),E=y((()=>"login"===o.name)),T=y((()=>({color:x.value?"error":"success",text:x.value?"Try again":"Log In"}))),R=async()=>{w.value=!0,V("Starting login attempt"),V(`Login attempt for username: ${f.value}`);try{V("Attempting to get User instance"),C.value=await ri(),V("Got User instance, attempting login"),await C.value.login(f.value,k.value),V("Login successful"),V("Initializing user config"),c.init(),V("User config initialized"),V("Setting authentication state"),l.loginAndRegistration.loggedIn=!0,V(`Authentication state set, redirecting to: ${n.redirectTo}`),s("loginSuccess",n.redirectTo),a.push(n.redirectTo),V("Login and redirect complete")}catch(e){V("Login attempt failed"),V(`Login error details: ${JSON.stringify(e)}`),console.log(`login error: ${JSON.stringify(e)}`),V("Initiating bad login feedback"),x.value=!0,Ee({text:"Username or password was incorrect.",status:U.error,timeout:S.value}),setTimeout((()=>{x.value=!1}),S.value)}V("Resetting awaiting response state"),w.value=!1},I=()=>{V("Toggling registration / login forms."),s("toggle")},A=()=>{V("Forgot password clicked"),E.value?a.push("/request-reset"):s("forgotPassword")};return(e,t)=>{const n=d("v-card-title"),s=d("v-text-field"),a=d("v-btn"),o=d("v-snackbar"),l=d("v-icon"),c=d("router-link"),b=d("v-form"),y=d("v-card-text"),C=d("v-card");return r(),u(C,null,{default:h((()=>[E.value?i("",!0):(r(),u(n,{key:0,class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[5]||(t[5]=[g("Log In")]))),_:1})),p(y,null,{default:h((()=>[p(b,{onsubmit:"return false;",onSubmit:O(R,["prevent"])},{default:h((()=>[p(s,{id:"",modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=e=>f.value=e),autofocus:"",name:"username",label:"Username","prepend-icon":"mdi-account-circle"},null,8,["modelValue"]),p(s,{modelValue:k.value,"onUpdate:modelValue":t[1]||(t[1]=e=>k.value=e),"prepend-icon":"mdi-lock",name:"password",hover:"Show password input",label:"Enter your password",hint:"",min:"0","append-icon":v.value?"mdi-eye-off":"mdi-eye",type:v.value?"text":"password","onClick:append":t[2]||(t[2]=()=>v.value=!v.value)},null,8,["modelValue","append-icon","type"]),p(o,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=e=>x.value=e),location:"bottom right",timeout:S.value},{default:h((()=>[t[7]||(t[7]=g(" Username or password was incorrect. ")),p(a,{color:"pink",variant:"text",onClick:t[3]||(t[3]=e=>x.value=!1)},{default:h((()=>t[6]||(t[6]=[g("Close")]))),_:1})])),_:1},8,["modelValue","timeout"]),m("div",ci,[m("div",di,[p(a,{class:"mr-2",type:"submit",loading:w.value,color:T.value.color},{default:h((()=>[p(l,{start:""},{default:h((()=>t[8]||(t[8]=[g("mdi-lock-open")]))),_:1}),t[9]||(t[9]=g(" Log In "))])),_:1},8,["loading","color"]),E.value?(r(),u(c,{key:0,to:"signup"},{default:h((()=>[p(a,{variant:"text"},{default:h((()=>t[10]||(t[10]=[g("Create New Account")]))),_:1})])),_:1})):(r(),u(a,{key:1,variant:"text",onClick:I},{default:h((()=>t[11]||(t[11]=[g("Create New Account")]))),_:1}))]),_(e.$slots,"forgot-password",{},(()=>[m("a",{href:"#",class:"text-caption text-decoration-none",onClick:O(A,["prevent"])}," Forgot password? ")]),!0)])])),_:3})])),_:3})])),_:3})}}}),[["__scopeId","data-v-563b0048"]]);function hi(e){if(!e)return"";if(e.length<6)return"Password must be at least 6 characters";return new Set(e).size<2?"Password must contain at least 2 different characters":""}function pi(e){return""===hi(e)}const gi=/* @__PURE__ */oe(n({name:"UserRegistration",props:{onSignupSuccess:{type:Function,required:!1}},emits:["toggle","signup-success"],data:()=>({email:"",username:"",password:"",retypedPassword:"",passwordVisible:!1,emailError:!1,emailHint:"",usernameValidationInProgress:!1,usernameError:!1,usernameHint:"",awaitingResponse:!1,badLoginAttempt:!1,userSecret:"",secret:"goons",user:null,roles:["Student","Teacher","Author"],student:!0,teacher:!1,author:!1,authStore:ii()}),computed:{registrationRoute(){return"string"==typeof this.$route.name&&"signup"===this.$route.name.toLowerCase()},buttonStatus(){return{color:this.badLoginAttempt?"error":"success",text:this.badLoginAttempt?"Try again":"Log In"}},passwordError(){return hi(this.password)},passwordRetypeError(){return console.log("[RTE]"),this.password!==this.retypedPassword?"Passwords must match.":""}},async created(){this.user=await ri()},methods:{toggle(){V("Toggling registration / login forms."),this.$emit("toggle")},validateEmail(){this.emailError=!1;this.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email)?(this.emailError=!0,this.emailHint="Please enter a valid email address"):this.emailHint=""},validateUsername(){this.usernameError=!1},async createUser(){if(this.awaitingResponse=!0,this.passwordError)return Ee({text:this.passwordError,status:U.error}),void(this.awaitingResponse=!1);if(V(`\nUser creation\n-------------\n\nName: ${this.username}\nStudent: ${this.student}\nTeacher: ${this.teacher}\nAuthor: ${this.author}\n`),this.password===this.retypedPassword){if(!this.user)return void console.error("ERROR: No user object available");this.user.createAccount(this.username,this.password).then((async e=>{if(e.status===U.ok){if(this.authStore.loginAndRegistration.loggedIn=!0,this.authStore.loginAndRegistration.init=!1,this.authStore.loginAndRegistration.init=!0,this.email)try{const e=await ri();await e.setConfig({email:this.email});const t="undefined"!=typeof window?window.location.origin:void 0,n=await et(this.username,this.email,t);n.ok?Ee({text:"Account created! Please check your email to verify your account.",status:U.ok}):V(`Warning: Failed to send verification email: ${n.error}`)}catch(t){console.error("Email save/send error:",t),V(`Warning: Failed to save email or send verification: ${t}`)}this.onSignupSuccess&&(console.log("[UserRegistration] Calling onSignupSuccess callback"),this.onSignupSuccess({username:this.username})),this.$emit("signup-success",{username:this.username})}else"This username is taken!"===e.error?(this.usernameError=!0,this.usernameHint="Try a different name.",this.$refs.userNameTextField.focus(),Ee({text:`The name ${this.username} is taken!`,status:e.status})):Ee({text:e.error,status:e.status})})).catch((e=>{if(console.error("[UserRegistration] .catch() called with error:",e),e){const t=e?.message||e?.error||e?.toString()||"Account creation failed";Ee({text:t,status:U.error})}})),this.awaitingResponse=!1}else Ee({text:"Passwords do not match.",status:U.error}),this.awaitingResponse=!1}}}),[["render",function(e,t,n,s,i,a){const o=d("v-card-title"),l=d("v-text-field"),c=d("v-btn"),m=d("v-snackbar"),f=d("v-icon"),b=d("router-link"),y=d("v-form"),k=d("v-card-text"),v=d("v-card");return r(),u(v,null,{default:h((()=>[p(o,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[7]||(t[7]=[g(" Create an Account ")]))),_:1}),p(k,null,{default:h((()=>[p(y,{onSubmit:O(e.createUser,["prevent"])},{default:h((()=>[p(l,{modelValue:e.email,"onUpdate:modelValue":t[0]||(t[0]=t=>e.email=t),name:"email",label:"Email address",type:"email","prepend-icon":"mdi-email",error:e.emailError,hint:e.emailHint,onBlur:e.validateEmail},null,8,["modelValue","error","hint","onBlur"]),p(l,{id:"",ref:"userNameTextField",modelValue:e.username,"onUpdate:modelValue":t[1]||(t[1]=t=>e.username=t),name:"username",label:"Choose a Username","prepend-icon":"mdi-account-circle",error:e.usernameError,hint:e.usernameHint,onBlur:e.validateUsername},null,8,["modelValue","error","hint","onBlur"]),p(l,{modelValue:e.password,"onUpdate:modelValue":t[2]||(t[2]=t=>e.password=t),"prepend-icon":"mdi-lock",name:"password",hover:"Show password",label:"Create a password",hint:e.passwordError,error:!!e.passwordError,min:"4","append-icon":e.passwordVisible?"mdi-eye-off":"mdi-eye",type:e.passwordVisible?"text":"password","onClick:append":t[3]||(t[3]=()=>e.passwordVisible=!e.passwordVisible)},null,8,["modelValue","hint","error","append-icon","type"]),p(l,{modelValue:e.retypedPassword,"onUpdate:modelValue":t[4]||(t[4]=t=>e.retypedPassword=t),"prepend-icon":"mdi-lock",name:"retypedPassword",hover:"Show password",label:"Retype your password",disabled:""===e.password||!!e.passwordError,hint:e.passwordRetypeError,min:"4",type:e.passwordVisible?"text":"password"},null,8,["modelValue","disabled","hint","type"]),p(m,{modelValue:e.badLoginAttempt,"onUpdate:modelValue":t[6]||(t[6]=t=>e.badLoginAttempt=t),location:"bottom right",timeout:5e3},{default:h((()=>[t[9]||(t[9]=g(" Username or password was incorrect. ")),p(c,{color:"pink",variant:"text",onClick:t[5]||(t[5]=t=>e.badLoginAttempt=!1)},{default:h((()=>t[8]||(t[8]=[g(" Close ")]))),_:1})])),_:1},8,["modelValue"]),p(c,{class:"mr-2 my-2",type:"submit",loading:e.awaitingResponse,color:e.buttonStatus.color,disabled:!!e.passwordError||e.password!==e.retypedPassword},{default:h((()=>[p(f,{start:""},{default:h((()=>t[10]||(t[10]=[g("mdi-lock-open")]))),_:1}),t[11]||(t[11]=g(" Create Account "))])),_:1},8,["loading","color","disabled"]),e.registrationRoute?(r(),u(b,{key:0,to:"login"},{default:h((()=>[p(c,{variant:"text"},{default:h((()=>t[12]||(t[12]=[g("Log In")]))),_:1})])),_:1})):(r(),u(c,{key:1,variant:"text",onClick:e.toggle},{default:h((()=>t[13]||(t[13]=[g(" Log In ")]))),_:1},8,["onClick"]))])),_:1},8,["onSubmit"])])),_:1})])),_:1})}]]),mi=n({name:"RequestPasswordReset",emits:["cancel","success"],data:()=>({email:"",emailError:!1,emailHint:"",isSubmitting:!1,requestSent:!1}),methods:{validateEmail(){if(this.emailError=!1,this.emailHint="",!this.email)return;/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email)||(this.emailError=!0,this.emailHint="Please enter a valid email address")},async handleSubmit(){if(this.validateEmail(),!this.emailError&&this.email){this.isSubmitting=!0;try{const e="undefined"!=typeof window?window.location.origin:void 0,t=await st(this.email,e);t.ok?(this.requestSent=!0,this.$emit("success",this.email)):Ee({text:t.error||"Failed to send reset email",status:U.error})}catch(e){Ee({text:"An unexpected error occurred",status:U.error})}finally{this.isSubmitting=!1}}}}}),fi={key:1,class:"text-center"};const bi=/* @__PURE__ */oe(mi,[["render",function(e,t,n,a,o,l){const f=d("v-card-title"),b=d("v-text-field"),y=d("v-icon"),k=d("v-btn"),v=d("v-form"),w=d("v-card-text"),x=d("v-spacer"),S=d("v-card-actions"),C=d("v-card");return r(),u(C,null,{default:h((()=>[p(f,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[2]||(t[2]=[g(" Reset Password ")]))),_:1}),p(w,{class:"pa-6"},{default:h((()=>[e.requestSent?(r(),s("div",fi,[p(y,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[6]||(t[6]=[g("mdi-email-check")]))),_:1}),t[9]||(t[9]=m("h3",{class:"mb-2"},"Check Your Email",-1)),m("p",null,[t[7]||(t[7]=g(" If an account exists with ")),m("strong",null,c(e.email),1),t[8]||(t[8]=g(", you will receive a password reset link shortly. "))]),t[10]||(t[10]=m("p",{class:"text-caption mt-4"},"Didn't receive an email? Check your spam folder.",-1))])):(r(),u(v,{key:0,onSubmit:O(e.handleSubmit,["prevent"])},{default:h((()=>[t[5]||(t[5]=m("p",{class:"mb-4"}," Enter your email address and we'll send you a link to reset your password. ",-1)),p(b,{modelValue:e.email,"onUpdate:modelValue":t[0]||(t[0]=t=>e.email=t),name:"email",label:"Email address",type:"email","prepend-icon":"mdi-email",error:e.emailError,hint:e.emailHint,disabled:e.isSubmitting,onBlur:e.validateEmail},null,8,["modelValue","error","hint","disabled","onBlur"]),p(k,{type:"submit",color:"primary",class:"mt-4",loading:e.isSubmitting,disabled:!e.email||e.emailError,block:""},{default:h((()=>[p(y,{start:""},{default:h((()=>t[3]||(t[3]=[g("mdi-email-send")]))),_:1}),t[4]||(t[4]=g(" Send Reset Link "))])),_:1},8,["loading","disabled"])])),_:1},8,["onSubmit"]))])),_:1}),e.requestSent?i("",!0):(r(),u(S,{key:0},{default:h((()=>[_(e.$slots,"back-action",{},(()=>[p(k,{variant:"text",onClick:t[1]||(t[1]=t=>e.$emit("cancel"))},{default:h((()=>t[11]||(t[11]=[g(" Cancel ")]))),_:1})])),p(x)])),_:3}))])),_:3})}]]),yi={key:0},ki={key:"login-buttons"},vi={key:"user-chip"},wi=/* @__PURE__ */oe(/* @__PURE__ */n({__name:"UserLoginAndRegistrationContainer",props:{showLoginButton:{type:Boolean},redirectToPath:{},showRegistration:{type:Boolean},onSignupSuccess:{type:Function}},emits:["signup-success"],setup(e,{emit:t}){const n=e,a=t,o=re(),l=ii(),c=oi();v((async()=>{await c.detectSyncStrategy()}));const m=y((()=>{if(!o.name||"string"!=typeof o.name)return!0;const e=o.name.toLowerCase();return!("login"===e||"signup"===e)})),k=y((()=>l.onLoadComplete)),w=y((()=>l._user?l._user.getUsername().startsWith(ee):!l.loginAndRegistration.loggedIn)),x=y((()=>({...c.config.value||{showLoginRegistration:!0,showLogout:!0,showResetData:!1,logoutLabel:"Log out",resetLabel:""},...void 0!==n.showRegistration&&{showLoginRegistration:n.showRegistration}}))),_=y({get:()=>l.loginAndRegistration.regDialogOpen,set:e=>{l.loginAndRegistration.regDialogOpen=e}}),C=y({get:()=>l.loginAndRegistration.loginDialogOpen,set:e=>{l.loginAndRegistration.loginDialogOpen=e}}),E=b(!1),T=()=>{if(_.value&&C.value)throw new Error("Registration / Login dialogs both activated.");if(_.value===C.value)throw new Error("Registration / Login dialogs toggled while both were dormant.");_.value=!_.value,C.value=!C.value},R=()=>{C.value=!1,E.value=!0},I=()=>{E.value=!1},A=e=>{_.value=!1,n.onSignupSuccess&&n.onSignupSuccess(e),a("signup-success",e)};return(e,t)=>{const n=d("v-btn"),a=d("v-dialog");return k.value&&m.value?(r(),s("div",yi,[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[w.value?(r(),s("div",ki,[x.value.showLoginRegistration?(r(),u(a,{key:0,modelValue:_.value,"onUpdate:modelValue":t[0]||(t[0]=e=>_.value=e),width:"500px"},{activator:h((({props:e})=>[p(n,f({class:"mr-2",size:"small",color:"success"},e),{default:h((()=>t[3]||(t[3]=[g("Sign Up")]))),_:2},1040)])),default:h((()=>[p(gi,{onToggle:T,onSignupSuccess:A,"on-signup-success":A})])),_:1},8,["modelValue"])):i("",!0),p(a,{modelValue:C.value,"onUpdate:modelValue":t[1]||(t[1]=e=>C.value=e),width:"500px"},{activator:h((({props:e})=>[p(n,f({size:"small",color:"success"},e),{default:h((()=>t[4]||(t[4]=[g("Log In")]))),_:2},1040)])),default:h((()=>[p(ui,{onToggle:T,onForgotPassword:R})])),_:1},8,["modelValue"]),p(a,{modelValue:E.value,"onUpdate:modelValue":t[2]||(t[2]=e=>E.value=e),width:"500px"},{default:h((()=>[p(bi,{onCancel:I,onSuccess:I})])),_:1},8,["modelValue"])])):(r(),s("div",vi,[p(li)]))])),_:1})])):i("",!0)}}}),[["__scopeId","data-v-5a55bdf0"]]),xi=n({name:"VerifyEmail",emits:["verified","error"],props:{token:{type:String,default:null}},data:()=>({isVerifying:!1,verificationStatus:null,errorMessage:"",username:""}),async mounted(){await this.performVerification()},methods:{async performVerification(){const e=this.token||this.getTokenFromURL();if(!e)return this.verificationStatus="error",void(this.errorMessage="No verification token provided");this.isVerifying=!0;try{const t=await tt(e);t.ok?(this.verificationStatus="success",this.username=t.username||"",Ee({text:"Email verified successfully!",status:U.ok})):(this.verificationStatus="error",this.errorMessage=t.error||"Verification failed",Ee({text:t.error||"Verification failed",status:U.error}))}catch(t){this.verificationStatus="error",this.errorMessage="An unexpected error occurred",Ee({text:"An unexpected error occurred",status:U.error})}finally{this.isVerifying=!1}},getTokenFromURL(){if("undefined"==typeof window)return null;return new URLSearchParams(window.location.search).get("token")}}}),_i={key:0,class:"text-center"},Si={key:1,class:"text-center"},Ci={key:0},Ei={key:2,class:"text-center"},Ti={key:3,class:"text-center"};const Ri=/* @__PURE__ */oe(xi,[["render",function(e,t,n,a,o,l){const f=d("v-card-title"),b=d("v-progress-circular"),y=d("v-icon"),k=d("v-card-text"),v=d("v-spacer"),w=d("v-btn"),x=d("v-card-actions"),S=d("v-card"),C=d("v-col"),E=d("v-row"),T=d("v-container");return r(),u(T,{class:"fill-height",fluid:""},{default:h((()=>[p(E,{align:"center",justify:"center"},{default:h((()=>[p(C,{cols:"12",sm:"8",md:"6"},{default:h((()=>[p(S,null,{default:h((()=>[p(f,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[2]||(t[2]=[g(" Email Verification ")]))),_:1}),p(k,{class:"pa-6"},{default:h((()=>[e.isVerifying?(r(),s("div",_i,[p(b,{indeterminate:"",color:"primary",size:"64",class:"mb-4"}),t[3]||(t[3]=m("p",null,"Verifying your email...",-1))])):"success"===e.verificationStatus?(r(),s("div",Si,[p(y,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[4]||(t[4]=[g("mdi-check-circle")]))),_:1}),t[5]||(t[5]=m("h3",{class:"mb-2"},"Email Verified!",-1)),t[6]||(t[6]=m("p",null,"Your account has been successfully verified.",-1)),e.username?(r(),s("p",Ci,"Welcome, "+c(e.username)+"!",1)):i("",!0)])):"error"===e.verificationStatus?(r(),s("div",Ei,[p(y,{color:"error",size:"64",class:"mb-4"},{default:h((()=>t[7]||(t[7]=[g("mdi-alert-circle")]))),_:1}),t[8]||(t[8]=m("h3",{class:"mb-2"},"Verification Failed",-1)),m("p",null,c(e.errorMessage),1)])):(r(),s("div",Ti,[p(y,{color:"warning",size:"64",class:"mb-4"},{default:h((()=>t[9]||(t[9]=[g("mdi-help-circle")]))),_:1}),t[10]||(t[10]=m("h3",{class:"mb-2"},"No Verification Token",-1)),t[11]||(t[11]=m("p",null,"Please use the link from your verification email.",-1))]))])),_:1}),p(x,null,{default:h((()=>[p(v),_(e.$slots,"actions",{status:e.verificationStatus,username:e.username},(()=>["success"===e.verificationStatus?(r(),u(w,{key:0,color:"primary",onClick:t[0]||(t[0]=t=>e.$emit("verified",e.username))},{default:h((()=>t[12]||(t[12]=[g(" Continue ")]))),_:1})):"error"===e.verificationStatus?(r(),u(w,{key:1,variant:"text",onClick:t[1]||(t[1]=t=>e.$emit("error",e.errorMessage))},{default:h((()=>t[13]||(t[13]=[g(" Close ")]))),_:1})):i("",!0)]))])),_:3})])),_:3})])),_:3})])),_:3})])),_:3})}]]),Ii=n({name:"ResetPassword",emits:["complete","error"],props:{token:{type:String,default:null}},data:()=>({password:"",confirmPassword:"",passwordVisible:!1,confirmPasswordError:!1,confirmPasswordHint:"",isSubmitting:!1,isComplete:!1}),computed:{canSubmit(){return this.password.length>=4&&this.confirmPassword.length>=4&&this.password===this.confirmPassword&&!this.confirmPasswordError}},methods:{validateConfirmPassword(){this.confirmPasswordError=!1,this.confirmPasswordHint="",this.confirmPassword&&this.password!==this.confirmPassword&&(this.confirmPasswordError=!0,this.confirmPasswordHint="Passwords do not match")},async handleSubmit(){if(this.validateConfirmPassword(),!this.canSubmit)return;const e=this.token||this.getTokenFromURL();if(!e)return Ee({text:"No reset token provided. Please use the link from your email.",status:U.error}),void this.$emit("error","No token");this.isSubmitting=!0;try{const t=await rt(e,this.password);t.ok?(this.isComplete=!0,Ee({text:"Password reset successfully!",status:U.ok})):(Ee({text:t.error||"Failed to reset password",status:U.error}),this.$emit("error",t.error))}catch(t){Ee({text:"An unexpected error occurred",status:U.error}),this.$emit("error","Unexpected error")}finally{this.isSubmitting=!1}},getTokenFromURL(){if("undefined"==typeof window)return null;return new URLSearchParams(window.location.search).get("token")}}}),Ai={key:1,class:"text-center"};const Mi=/* @__PURE__ */oe(Ii,[["render",function(e,t,n,a,o,l){const c=d("v-card-title"),f=d("v-text-field"),b=d("v-icon"),y=d("v-btn"),k=d("v-form"),v=d("v-card-text"),w=d("v-spacer"),x=d("v-card-actions"),S=d("v-card"),C=d("v-col"),E=d("v-row"),T=d("v-container");return r(),u(T,{class:"fill-height",fluid:""},{default:h((()=>[p(E,{align:"center",justify:"center"},{default:h((()=>[p(C,{cols:"12",sm:"8",md:"6"},{default:h((()=>[p(S,null,{default:h((()=>[p(c,{class:"text-h5 bg-grey-lighten-2"},{default:h((()=>t[4]||(t[4]=[g(" Set New Password ")]))),_:1}),p(v,{class:"pa-6"},{default:h((()=>[e.isComplete?(r(),s("div",Ai,[p(b,{color:"success",size:"64",class:"mb-4"},{default:h((()=>t[8]||(t[8]=[g("mdi-check-circle")]))),_:1}),t[9]||(t[9]=m("h3",{class:"mb-2"},"Password Reset Successful!",-1)),t[10]||(t[10]=m("p",null,"Your password has been updated. You can now log in with your new password.",-1))])):(r(),u(k,{key:0,onSubmit:O(e.handleSubmit,["prevent"])},{default:h((()=>[t[7]||(t[7]=m("p",{class:"mb-4"},"Enter your new password below.",-1)),p(f,{modelValue:e.password,"onUpdate:modelValue":t[0]||(t[0]=t=>e.password=t),"prepend-icon":"mdi-lock",name:"password",label:"New password",min:"4","append-icon":e.passwordVisible?"mdi-eye-off":"mdi-eye",type:e.passwordVisible?"text":"password",disabled:e.isSubmitting,"onClick:append":t[1]||(t[1]=()=>e.passwordVisible=!e.passwordVisible)},null,8,["modelValue","append-icon","type","disabled"]),p(f,{modelValue:e.confirmPassword,"onUpdate:modelValue":t[2]||(t[2]=t=>e.confirmPassword=t),"prepend-icon":"mdi-lock",name:"confirmPassword",label:"Confirm new password",min:"4",type:e.passwordVisible?"text":"password",error:e.confirmPasswordError,hint:e.confirmPasswordHint,disabled:e.isSubmitting,onBlur:e.validateConfirmPassword},null,8,["modelValue","type","error","hint","disabled","onBlur"]),p(y,{type:"submit",color:"primary",class:"mt-4",loading:e.isSubmitting,disabled:!e.canSubmit,block:""},{default:h((()=>[p(b,{start:""},{default:h((()=>t[5]||(t[5]=[g("mdi-lock-reset")]))),_:1}),t[6]||(t[6]=g(" Reset Password "))])),_:1},8,["loading","disabled"])])),_:1},8,["onSubmit"]))])),_:1}),e.isComplete?(r(),u(x,{key:0},{default:h((()=>[p(w),_(e.$slots,"success-action",{},(()=>[p(y,{color:"primary",onClick:t[3]||(t[3]=t=>e.$emit("complete"))},{default:h((()=>t[11]||(t[11]=[g(" Continue to Login ")]))),_:1})]))])),_:3})):i("",!0)])),_:3})])),_:3})])),_:3})])),_:3})}]]),Ni=n({name:"SkTagsInput",components:{VueTagsInput:ie},props:{courseID:{type:String,required:!0,default:""},cardID:{type:String,required:!1,default:""},hideSubmit:{type:Boolean,required:!1,default:!1}},data:()=>({loading:!0,tag:"",tags:[],initialTags:[],availableCourseTags:[],separators:[";",","," "],courseDB:null}),computed:{autoCompleteSuggestions(){return this.availableCourseTags.filter((e=>-1!==e.name.toLowerCase().indexOf(this.tag.toLowerCase()))).map((e=>({text:e.name,data:{snippet:e.snippet}})))}},watch:{async cardID(){await this.getAppliedTags()},async courseID(){this.courseDB=X().getCourseDB(this.courseID),await this.updateAvailableCourseTags()}},async created(){this.courseDB=X().getCourseDB(this.courseID),await this.updateAvailableCourseTags(),await this.getAppliedTags()},methods:{tagsChanged(e){console.log(`[TagsInput] Tags changing: ${JSON.stringify(e)}`),this.tags=e},async getAppliedTags(){this.initialTags=[],this.tags=[];try{(await this.courseDB.getAppliedTags(this.cardID)).rows.forEach((e=>{console.log(`[TagsInput] The following tag is applied:\n\t${JSON.stringify(e)}`),this.tags.push({text:e.value.name,style:"",classes:""})})),this.initialTags=this.tags.map((e=>e.text))}catch(e){console.error(`Error in init-getAppliedTags: ${JSON.stringify(e)}, ${e}`)}finally{this.loading=!1}},async updateAvailableCourseTags(){try{this.availableCourseTags=(await this.courseDB.getCourseTagStubs()).rows.map((e=>e.doc))}catch(e){console.error(`Error in init-availableCourseTags: ${JSON.stringify(e)}`)}},async submit(){console.log("[TagsInput] tagsInput is submitting..."),this.loading=!0;try{await Promise.all(this.tags.map((async e=>{if(!this.initialTags.includes(e.text))try{await this.courseDB.addTagToCard(this.cardID,e.text),console.log(`[TagsInput] Successfully added tag: ${e.text}`)}catch(t){console.error(`Failed to add tag ${e.text}:`,t)}})))}catch(e){console.error(`Exception adding tags: ${JSON.stringify(e)}`)}try{await Promise.all(this.initialTags.map((async e=>{if(0===this.tags.filter((t=>t.text===e)).length)try{await this.courseDB.removeTagFromCard(this.cardID,e),console.log(`[TagsInput] Successfully removed tag: ${e}`)}catch(t){console.error(`Failed to remove tag ${e}:`,t)}})))}catch(e){console.error(`Exception removing tags: ${JSON.stringify(e)}`)}this.loading=!1}}}),$i={"data-cy":"tags-input"},Di={class:"tag-name"},Oi={key:0,class:"tag-snippet"};const Li=/* @__PURE__ */oe(Ni,[["render",function(e,t,n,a,o,l){const f=d("vue-tags-input"),b=d("v-btn");return r(),s("div",$i,[p(f,{modelValue:e.tag,"onUpdate:modelValue":t[0]||(t[0]=t=>e.tag=t),tags:e.tags,"autocomplete-items":e.autoCompleteSuggestions,separators:e.separators,"add-on-key":e.separators,onTagsChanged:e.tagsChanged},{"autocomplete-item":h((e=>[m("div",{class:x(["autocomplete-item",{"is-active":e.selected}])},[m("span",Di,c(e.item.text),1),e.item.data&&e.item.data.snippet?(r(),s("span",Oi," - "+c(e.item.data.snippet),1)):i("",!0)],2)])),_:1},8,["modelValue","tags","autocomplete-items","separators","add-on-key","onTagsChanged"]),e.hideSubmit?i("",!0):(r(),u(b,{key:0,color:"success",loading:e.loading,onClick:e.submit},{default:h((()=>t[1]||(t[1]=[g("Save Changes")]))),_:1},8,["loading","onClick"]))])}],["__scopeId","data-v-f7373dc0"]]),Pi=n({name:"CourseCardBrowser",components:{CardLoader:Cn,TagsInput:Li,PaginatingToolbar:Ne},props:{courseId:{type:String,required:!0},tagId:{type:String,required:!1,default:""},viewLookupFunction:{type:Function,required:!0,default:()=>(console.warn("No viewLookupFunction provided to CourseCardBrowser"),null)},editMode:{type:String,required:!1,default:"full"}},data(){return{courseDB:null,page:1,pages:[],cards:[],cardData:{},cardPreview:{},cardElos:{},cardTags:{},internalEditMode:"none",delBtn:!1,updatePending:!0,userIsRegistered:!1,questionCount:0,tags:[],viewLookup:this.viewLookupFunction}},async created(){try{this.courseDB=X().getCourseDB(this.courseId),this.tagId?this.questionCount=(await this.courseDB.getTag(this.tagId)).taggedCards.length:this.questionCount=(await this.courseDB.getCourseInfo()).cardCount;for(let e=1;25*(e-1)<this.questionCount;e++)this.pages.push(e);await this.populateTableData()}catch(e){console.error("Error initializing CourseCardBrowser:",e)}finally{this.updatePending=!1}},methods:{idQualify(e){return e.includes("-")?e:`${this.courseId}-${e}`},idToQualifiedObject(e){if(e.includes("-")){const t=e.split("-");return{courseID:t[0],cardID:t[1]}}return{courseID:this.courseId,cardID:e}},first(){this.page=1,this.populateTableData()},prev(){this.page--,this.populateTableData()},next(){this.page++,this.populateTableData()},last(){this.page=this.pages.length,this.populateTableData()},setPage(e){this.page=e,this.populateTableData()},async loadCardTags(e){try{await Promise.all(e.map((async e=>{const t=await this.courseDB.getAppliedTags(e);this.cardTags[e]=t.rows.map((e=>({name:e.value.name,snippet:e.value.snippet,count:e.value.count})))})))}catch(t){console.error("Error loading card tags:",t)}},clearSelections(e=""){this.cards.forEach((t=>{t.card.cardID!==e&&(t.isOpen=!1)})),this.internalEditMode="none",this.delBtn=!1},async deleteCard(e){console.log(`Deleting card ${e}`);const t=await this.courseDB.removeCard(e);t.ok?(this.cards=this.cards.filter((t=>t.card.cardID!=e)),this.clearSelections()):(console.error(`Failed to delete card:\n\n${JSON.stringify(t)}`),Ee({text:"Failed to delete card",status:U.error}))},async populateTableData(){if(this.updatePending=!0,this.tagId){const e=await this.courseDB.getTag(this.tagId);this.cards=e.taggedCards.map((e=>({card:{cardID:e,courseID:this.courseId},isOpen:!1,delBtn:!1})))}else this.cards=(await this.courseDB.getCardsByELO(0,25)).map((e=>({card:e,isOpen:!1,delBtn:!1})));const e=[],t=(await this.courseDB.getCourseDocs(this.cards.map((e=>e.card.cardID)),{include_docs:!0})).rows.filter((e=>!!e.doc||(console.error(`Card ${e.id}.doc not found.\ncard: ${JSON.stringify(e)}`),!1))).map((e=>e.doc));this.cards=this.cards.filter((t=>!e.includes(t.card.cardID))),t.forEach((e=>{e&&e.id_displayable_data&&(this.cardData[e._id]=e.id_displayable_data)}));try{await Promise.all(this.cards.map((async e=>{const n=e.card.cardID,s=t.find((e=>e._id==n));if(!s||!s.id_displayable_data)return void console.error(`No valid data found for card ${n}`);const r=this.viewLookupFunction(s.id_view||"default.question.BlanksCard.FillInView"),i=s.id_displayable_data.map((e=>this.courseDB.getCourseDoc(e,{attachments:!1,binary:!0}))),a=await Promise.all(i);await Promise.all(a.map((t=>{[].unshift(H(t)),this.cardPreview[e.card.cardID]=r.name?r.name:"Unknown"})))})));const e=this.cards.map((e=>e.card.cardID)),n=await this.courseDB.getCardEloData(e);e.forEach(((e,t)=>{this.cardElos[e]=n[t]})),await this.loadCardTags(e)}catch(n){console.error("Error populating table data:",n)}finally{this.updatePending=!1,this.$forceUpdate()}}}}),Bi={key:0,class:"d-flex justify-center align-center pa-6"},zi={key:1},ji={key:0,class:"px-4 py-2 bg-blue-grey-lighten-5"},Ui={key:0,class:"mt-4"},Fi={class:"mt-4"},qi={key:0,class:"ml-4"};const Vi=/* @__PURE__ */oe(Pi,[["render",function(e,t,n,l,b,y){const k=d("v-progress-circular"),v=d("paginating-toolbar"),w=d("v-list-item-title"),_=d("v-list-item-subtitle"),S=d("v-btn"),C=d("v-icon"),E=d("v-speed-dial"),T=d("v-list-item"),R=d("card-loader"),I=d("v-chip"),M=d("v-chip-group"),N=d("tags-input"),$=d("v-list"),D=d("v-card");return r(),u(D,null,{default:h((()=>[e.updatePending?(r(),s("div",Bi,[p(k,{indeterminate:"",color:"primary"})])):(r(),s("div",zi,[p(v,{title:"Exercises",page:e.page,pages:e.pages,subtitle:`(${e.questionCount})`,onFirst:e.first,onPrev:e.prev,onNext:e.next,onLast:e.last,onSetPage:t[0]||(t[0]=t=>e.setPage(t))},null,8,["page","pages","subtitle","onFirst","onPrev","onNext","onLast"]),p($,null,{default:h((()=>[(r(!0),s(a,null,o(e.cards,(n=>(r(),s(a,{key:n.card.cardID},[p(T,{class:x({"bg-blue-grey-lighten-5":n.isOpen,"elevation-4":n.isOpen}),density:"compact","data-cy":"course-card"},{prepend:h((()=>[m("div",null,[p(w,{class:x([{"text-blue-grey-darken-1":n.isOpen},"font-weight-medium"])},{default:h((()=>[g(c(e.cardPreview[n.card.cardID]),1)])),_:2},1032,["class"]),p(_,null,{default:h((()=>[g(" ELO: "+c(e.cardElos[n.card.cardID]?.global?.score||"(unknown)"),1)])),_:2},1024)])])),append:h((()=>[p(E,{modelValue:n.isOpen,"onUpdate:modelValue":e=>n.isOpen=e,location:"left center",transition:"slide-x-transition",style:{display:"flex","flex-direction":"row-reverse"},persistent:""},{activator:h((({props:t})=>[p(S,f({ref_for:!0},t,{icon:n.isOpen?"mdi-close":"mdi-plus",size:"small",variant:"text",onClick:t=>e.clearSelections(n.card.cardID)}),null,16,["icon","onClick"])])),default:h((()=>["full"===e.editMode?(r(),u(S,{key:"tags",icon:"",size:"small",variant:"tags"!==e.internalEditMode?"outlined":"elevated",color:"tags"===e.internalEditMode?"teal":"teal-darken-3",onClick:t[1]||(t[1]=O((t=>e.internalEditMode="tags"),["stop"]))},{default:h((()=>[p(C,null,{default:h((()=>t[4]||(t[4]=[g("mdi-bookmark")]))),_:1})])),_:1},8,["variant","color"])):i("",!0),"full"===e.editMode?(r(),u(S,{key:"flag",icon:"",size:"small",variant:"flag"!==e.internalEditMode?"outlined":"elevated",color:"flag"===e.internalEditMode?"error":"error-darken-3",onClick:t[2]||(t[2]=O((t=>e.internalEditMode="flag"),["stop"]))},{default:h((()=>[p(C,null,{default:h((()=>t[5]||(t[5]=[g("mdi-flag")]))),_:1})])),_:1},8,["variant","color"])):i("",!0)])),_:2},1032,["modelValue","onUpdate:modelValue"])])),_:2},1032,["class"]),n.isOpen?(r(),s("div",ji,[p(R,{qualified_id:n.card,"view-lookup":e.viewLookup,class:"elevation-1"},null,8,["qualified_id","view-lookup"]),"readonly"===e.editMode&&e.cardTags[n.card.cardID]?(r(),s("div",Ui,[p(M,null,{default:h((()=>[(r(!0),s(a,null,o(e.cardTags[n.card.cardID],(e=>(r(),u(I,{key:e.name,size:"small",color:"primary",variant:"outlined"},{default:h((()=>[g(c(e.name),1)])),_:2},1024)))),128))])),_:2},1024)])):i("",!0),A(p(N,{"course-i-d":e.courseId,"card-i-d":n.card.cardID,class:"mt-4"},null,8,["course-i-d","card-i-d"]),[[L,"tags"===e.internalEditMode&&"full"===e.editMode]]),A(m("div",Fi,[p(S,{color:"error",variant:"outlined",onClick:e=>n.delBtn=!0},{default:h((()=>t[6]||(t[6]=[g(" Delete this card ")]))),_:2},1032,["onClick"]),n.delBtn?(r(),s("span",qi,[t[8]||(t[8]=m("span",{class:"mr-2"},"Are you sure?",-1)),p(S,{color:"error",variant:"elevated",onClick:t=>e.deleteCard(n.card.cardID)},{default:h((()=>t[7]||(t[7]=[g(" Confirm ")]))),_:2},1032,["onClick"])])):i("",!0)],512),[[L,"flag"===e.internalEditMode&&"full"===e.editMode]])])):i("",!0)],64)))),128))])),_:1}),p(v,{class:"elevation-0",page:e.page,pages:e.pages,onFirst:e.first,onPrev:e.prev,onNext:e.next,onLast:e.last,onSetPage:t[3]||(t[3]=t=>e.setPage(t))},null,8,["page","pages","onFirst","onPrev","onNext","onLast"])]))])),_:1})}],["__scopeId","data-v-5ecc9d21"]]),Hi=n({name:"CourseInformation",components:{CourseCardBrowser:Vi},props:{courseId:{type:String,required:!0},viewLookupFunction:{type:Function,required:!1,default:e=>(console.warn("No viewLookupFunction provided to CourseInformation"),null)},editMode:{type:String,required:!1,default:"full"}},data:()=>({courseDB:null,nameRules:[e=>!(e.length>30)||"Course name must be 30 characters or less"],updatePending:!0,courseConfig:{},userIsRegistered:!1,tags:[],user:null}),computed:{},async created(){this.courseDB=X().getCourseDB(this.courseId),this.user=await ri();const e=await this.user.getCourseRegistrationsDoc();"admin"===this.user.getUsername()?this.userIsRegistered=!0:this.userIsRegistered=1===e.courses.filter((e=>e.courseID===this.courseId&&("active"===e.status||void 0===e.status))).length,this.courseConfig=await this.courseDB.getCourseConfig(),this.tags=(await this.courseDB.getCourseTagStubs()).rows.map((e=>e.doc)),this.updatePending=!1},methods:{async register(){V(`Registering for ${this.courseId}`);(await this.user.registerForCourse(this.courseId)).ok&&(this.userIsRegistered=!0)},async drop(){V(`Dropping course ${this.courseId}`);(await this.user.dropCourse(this.courseId)).ok&&(this.userIsRegistered=!1)}}}),Zi={key:0},Ki={class:"text-h4 mb-2"},Gi={class:"text-body-2"},Wi={key:0},Qi={key:1};const Yi=/* @__PURE__ */oe(Hi,[["render",function(e,t,n,l,f,b){const y=d("v-btn"),k=d("v-icon"),v=d("v-toolbar-title"),w=d("v-toolbar-items"),x=d("v-toolbar"),C=d("v-chip"),E=d("v-card-text"),T=d("v-card"),R=d("course-card-browser");return e.updatePending?i("",!0):(r(),s("div",Zi,[_(e.$slots,"header",{courseConfig:e.courseConfig,courseId:e.courseId},(()=>[m("h1",Ki,c(e.courseConfig.name),1)]),!0),m("p",Gi,c(e.courseConfig.description),1),_(e.$slots,"actions",{userIsRegistered:e.userIsRegistered,courseId:e.courseId,editMode:e.editMode,register:e.register,drop:e.drop},(()=>[p(S,{name:"component-fade",mode:"out-in"},{default:h((()=>[e.userIsRegistered?(r(),s("div",Wi,[p(y,{color:"success","data-cy":"focused-study-session-btn",class:"me-2"},{default:h((()=>t[0]||(t[0]=[g("Start ad study session")]))),_:1}),"full"===e.editMode?(r(),u(y,{key:0,"data-cy":"add-content-btn",color:"indigo-lighten-1",class:"me-2"},{default:h((()=>[p(k,{start:""},{default:h((()=>t[1]||(t[1]=[g("mdi-plus")]))),_:1}),t[2]||(t[2]=g(" Add content "))])),_:1})):i("",!0),"full"===e.editMode?(r(),u(y,{key:1,color:"green-darken-2",title:"Rank course content for difficulty",class:"me-2"},{default:h((()=>[p(k,{start:""},{default:h((()=>t[3]||(t[3]=[g("mdi-format-list-numbered")]))),_:1}),t[4]||(t[4]=g(" Arrange "))])),_:1})):i("",!0),"full"===e.editMode?(r(),u(y,{key:2,color:"error",size:"small",variant:"outlined",onClick:e.drop},{default:h((()=>t[5]||(t[5]=[g(" Drop this course ")]))),_:1},8,["onClick"])):i("",!0)])):(r(),s("div",Qi,[p(y,{"data-cy":"register-btn",color:"primary",class:"me-2",onClick:e.register},{default:h((()=>t[6]||(t[6]=[g("Register")]))),_:1},8,["onClick"]),p(y,{variant:"outlined",color:"primary",class:"me-2"},{default:h((()=>t[7]||(t[7]=[g("Start a trial study session")]))),_:1})]))])),_:1})]),!0),_(e.$slots,"additional-content",{},void 0,!0),p(T,{class:"my-2"},{default:h((()=>[p(x,{density:"compact"},{default:h((()=>[p(v,null,{default:h((()=>t[8]||(t[8]=[g("Tags")]))),_:1}),p(w,null,{default:h((()=>[p(y,{variant:"text"},{default:h((()=>[g("("+c(e.tags.length)+")",1)])),_:1})])),_:1})])),_:1}),p(E,null,{default:h((()=>[(r(!0),s(a,null,o(e.tags,((t,n)=>(r(),s("span",{key:n},[_(e.$slots,"tag-link",{tag:t,courseId:e.courseId},(()=>[p(C,{variant:"tonal",class:"me-2 mb-2"},{default:h((()=>[g(c(t.name),1)])),_:2},1024)]),!0)])))),128))])),_:3})])),_:3}),p(R,{class:"my-3","course-id":e.courseId,"view-lookup-function":e.viewLookupFunction,"edit-mode":e.editMode},null,8,["course-id","view-lookup-function","edit-mode"])]))}],["__scopeId","data-v-38e9efe1"]]),Ji=n({name:"CardBrowser",components:{CardViewer:ot},props:{views:{type:Array,required:!0},data:{type:Array,required:!0},suppressSpinner:{type:Boolean,default:!1}},data:()=>({viewIndex:0,previewMode:ln()}),computed:{spinner(){return this.views.length>1}},created(){console.log("[CardBrowser] Card browser created. Cards now in 'prewviewMode'"),this.previewMode.setPreviewMode(!0)},unmounted(){console.log("[CardBrowser] Card browser unmounted. Cards no longer in 'prewviewMode'"),this.previewMode.setPreviewMode(!1)},methods:{incrementView(){this.viewIndex++,this.viewIndex=(this.viewIndex+this.views.length)%this.views.length},decrementView(){this.viewIndex--,this.viewIndex=(this.viewIndex+this.views.length)%this.views.length}}}),Xi={key:0,class:"text-subtitle-1 pa-2"};const ea=/* @__PURE__ */oe(Ji,[["render",function(e,t,n,a,o,l){const f=d("CardViewer"),b=d("v-icon"),y=d("v-btn"),k=d("v-row");return r(),u(k,{column:"",align:"center",justify:"center"},{default:h((()=>[p(f,{view:e.views[e.viewIndex],data:e.data,course_id:"[browsing]",card_id:"[browsing]"},null,8,["view","data"]),t[2]||(t[2]=m("br",null,null,-1)),t[3]||(t[3]=m("br",null,null,-1)),e.suppressSpinner?i("",!0):(r(),s("div",Xi,[e.spinner?(r(),u(y,{key:0,icon:"",variant:"outlined",color:"primary",onClick:e.decrementView},{default:h((()=>[p(b,null,{default:h((()=>t[0]||(t[0]=[g("mdi-chevron-left")]))),_:1})])),_:1},8,["onClick"])):i("",!0),g(" "+c(e.views[e.viewIndex].name)+" ",1),e.spinner?(r(),u(y,{key:1,icon:"",variant:"outlined",color:"primary",onClick:e.incrementView},{default:h((()=>[p(b,null,{default:h((()=>t[1]||(t[1]=[g("mdi-chevron-right")]))),_:1})])),_:1},8,["onClick"])):i("",!0)]))])),_:1})}]]),ta=n({name:"CourseTagFilterWidget",props:{courseId:{type:String,required:!0},modelValue:{type:Object,default:void 0}},emits:["update:modelValue"],setup(e,{emit:t}){const n=b(!0),s=b([]),r=b({}),i=b(e.modelValue?{...e.modelValue}:Z()),a=y((()=>s.value.filter((e=>!i.value.include.includes(e))))),o=y((()=>K(i.value)));async function l(){n.value=!0;try{const t=X().getCourseDB(e.courseId),n=await t.getCourseTagStubs();s.value=[],r.value={};for(const e of n.rows)if(e.doc){const t=e.doc;s.value.push(t.name),t.snippet&&(r.value[t.name]=t.snippet)}s.value.sort(((e,t)=>e.localeCompare(t)))}catch(t){console.error("[CourseTagFilterWidget] Failed to load tags:",t),s.value=[],r.value={}}finally{n.value=!1}}return k((()=>e.modelValue),(e=>{i.value=e?{...e}:Z()}),{deep:!0}),k(i,(e=>{t("update:modelValue",{...e})}),{deep:!0}),k((()=>e.courseId),(async e=>{e&&await l()})),v((()=>{e.courseId&&l()})),{loading:n,availableTags:s,availableTagsForExclude:a,tagSnippets:r,localFilter:i,hasActiveFilter:o,fuzzyFilter:(e,t)=>{if(!t)return!0;const n=t.toLowerCase(),s=e.toLowerCase();let r=0;for(let i=0;i<s.length&&r<n.length;i++)s[i]===n[r]&&r++;return r===n.length}}}}),na={class:"course-tag-filter-widget"},sa={key:0,class:"filter-summary text-caption mt-2"},ra={key:0},ia={key:1},aa={key:2};const oa=/* @__PURE__ */oe(ta,[["render",function(e,t,n,a,o,l){const u=d("v-chip"),m=d("v-list-item"),b=d("v-autocomplete"),y=d("v-icon");return r(),s("div",na,[p(b,{modelValue:e.localFilter.include,"onUpdate:modelValue":t[0]||(t[0]=t=>e.localFilter.include=t),items:e.availableTags,loading:e.loading,disabled:e.loading,label:"Include tags",placeholder:"Type to search tags...",hint:"Cards must have at least one of these tags","persistent-hint":"",multiple:"",chips:"","closable-chips":"",clearable:"",density:"compact",variant:"outlined",class:"mb-2","custom-filter":e.fuzzyFilter,"no-data-text":"No matching tags found"},{chip:h((({props:e,item:t})=>[p(u,f(e,{color:"primary",variant:"tonal",size:"small"}),{default:h((()=>[g(c(t.raw),1)])),_:2},1040)])),item:h((({props:t,item:n})=>[p(m,f(t,{title:n.raw}),P({_:2},[e.tagSnippets[n.raw]?{name:"subtitle",fn:h((()=>[g(c(e.tagSnippets[n.raw]),1)])),key:"0"}:void 0]),1040,["title"])])),_:1},8,["modelValue","items","loading","disabled","custom-filter"]),p(b,{modelValue:e.localFilter.exclude,"onUpdate:modelValue":t[1]||(t[1]=t=>e.localFilter.exclude=t),items:e.availableTagsForExclude,loading:e.loading,disabled:e.loading,label:"Exclude tags",placeholder:"Type to search tags...",hint:"Cards with these tags will be excluded","persistent-hint":"",multiple:"",chips:"","closable-chips":"",clearable:"",density:"compact",variant:"outlined","custom-filter":e.fuzzyFilter,"no-data-text":"No matching tags found"},{chip:h((({props:e,item:t})=>[p(u,f(e,{color:"error",variant:"tonal",size:"small"}),{default:h((()=>[g(c(t.raw),1)])),_:2},1040)])),item:h((({props:t,item:n})=>[p(m,f(t,{title:n.raw}),P({_:2},[e.tagSnippets[n.raw]?{name:"subtitle",fn:h((()=>[g(c(e.tagSnippets[n.raw]),1)])),key:"0"}:void 0]),1040,["title"])])),_:1},8,["modelValue","items","loading","disabled","custom-filter"]),e.hasActiveFilter?(r(),s("div",sa,[p(y,{size:"small",color:"info",class:"mr-1"},{default:h((()=>t[2]||(t[2]=[g("mdi-filter")]))),_:1}),e.localFilter.include.length?(r(),s("span",ra," Including: "+c(e.localFilter.include.join(", ")),1)):i("",!0),e.localFilter.include.length&&e.localFilter.exclude.length?(r(),s("span",ia," · ")):i("",!0),e.localFilter.exclude.length?(r(),s("span",aa," Excluding: "+c(e.localFilter.exclude.join(", ")),1)):i("",!0)])):i("",!0)])}],["__scopeId","data-v-e1ba963b"]]),la=0,ca=2,da=10,ua="UserTagPreferenceFilter",ha=n({name:"UserTagPreferences",props:{courseId:{type:String,required:!1,default:""},sliderConfig:{type:Object,required:!1,default:()=>({})}},emits:["preferences-saved","preferences-changed"],data:()=>({loading:!0,saving:!1,saveError:"",saveSuccess:!1,preferences:{boost:{}},savedPreferences:{boost:{}},tagMaxRanges:{},availableTags:[],tagToAdd:null,courseDB:null,user:null}),computed:{sliderConfigResolved(){return{min:this.sliderConfig.min??la,startingMax:this.sliderConfig.startingMax??ca,absoluteMax:this.sliderConfig.absoluteMax??da}},tagNames(){return Object.keys(this.preferences.boost).sort()},globalSliderMax(){const e=Object.values(this.tagMaxRanges);return 0===e.length?this.sliderConfigResolved.startingMax:Math.max(...e)},availableTagsToAdd(){const e=new Set(Object.keys(this.preferences.boost));return this.availableTags.filter((t=>!e.has(t.name)))},hasChanges(){const e=Object.keys(this.preferences.boost).sort(),t=Object.keys(this.savedPreferences.boost).sort();return e.length!==t.length||(e.join(",")!==t.join(",")||e.some((e=>this.preferences.boost[e]!==this.savedPreferences.boost[e])))}},watch:{courseId:{immediate:!0,async handler(e){e?await this.loadPreferences():this.loading=!1}}},methods:{async loadPreferences(){this.loading=!0,this.saveError="";try{if(this.user=await ri()??null,!this.user)throw new Error("User not available");this.courseDB=X().getCourseDB(this.courseId);const e=await this.courseDB.getCourseTagStubs();this.availableTags=e.rows.map((e=>e.doc)).filter(Boolean);const t=await this.user.getStrategyState(this.courseId,ua);this.preferences.boost=t?{...t.boost}:{},this.savedPreferences.boost={...this.preferences.boost},this.tagMaxRanges={},Object.keys(this.preferences.boost).forEach((e=>{const t=this.preferences.boost[e],n=this.sliderConfigResolved.startingMax;this.tagMaxRanges[e]=t>n?Math.min(Math.ceil(t),this.sliderConfigResolved.absoluteMax):n}))}catch(e){console.error("Failed to load preferences:",e),this.saveError="Failed to load preferences. Please try again."}finally{this.loading=!1}},addTag(e){e&&!(e in this.preferences.boost)&&(this.preferences.boost[e]=1,this.tagMaxRanges[e]=this.sliderConfigResolved.startingMax,this.$emit("preferences-changed",this.preferences)),this.$nextTick((()=>{this.tagToAdd=null}))},removeTag(e){delete this.preferences.boost[e],delete this.tagMaxRanges[e],this.$emit("preferences-changed",this.preferences)},updateBoost(e,t){this.preferences.boost[e]=t,this.$emit("preferences-changed",this.preferences)},expandSliderRange(e){const t=this.globalSliderMax;if(t<this.sliderConfigResolved.absoluteMax){const n=t+1;Object.keys(this.tagMaxRanges).forEach((e=>{this.tagMaxRanges[e]=Math.max(this.tagMaxRanges[e],n)})),this.preferences.boost[e]=n,this.$emit("preferences-changed",this.preferences)}},formatMultiplier:e=>0===e?"0x":e<.1?e.toFixed(2)+"x":e.toFixed(1)+"x",resetToSaved(){this.preferences.boost={...this.savedPreferences.boost},this.saveSuccess=!1,this.saveError="",this.tagMaxRanges={},Object.keys(this.preferences.boost).forEach((e=>{const t=this.preferences.boost[e],n=this.sliderConfigResolved.startingMax;this.tagMaxRanges[e]=t>n?Math.min(Math.ceil(t),this.sliderConfigResolved.absoluteMax):n}))},async savePreferences(){if(this.user&&this.courseId){this.saving=!0,this.saveError="",this.saveSuccess=!1;try{const e={boost:{...this.preferences.boost},updatedAt:/* @__PURE__ */(new Date).toISOString()};await this.user.putStrategyState(this.courseId,ua,e),this.savedPreferences.boost={...this.preferences.boost},this.saveSuccess=!0,this.$emit("preferences-saved",e)}catch(e){console.error("Failed to save preferences:",e),this.saveError="Failed to save preferences. Please try again."}finally{this.saving=!1}}else this.saveError="Unable to save - user or course not available"}}}),pa={key:1},ga={class:"mb-6"},ma={class:"text-subtitle-1 font-weight-bold mb-2"},fa={class:"d-flex align-center ga-3 w-100"},ba={class:"text-body-2 flex-shrink-0",style:{"min-width":"60px","text-align":"right"}},ya={key:2,class:"d-flex justify-center py-8"};const ka=/* @__PURE__ */oe(ha,[["render",function(e,t,n,l,f,b){const y=d("v-icon"),k=d("v-card-title"),v=d("v-card-subtitle"),w=d("v-alert"),x=d("v-list-item"),_=d("v-autocomplete"),S=d("v-chip"),C=d("v-slider"),E=d("v-btn"),T=d("v-list"),R=d("v-progress-circular"),I=d("v-card-text"),A=d("v-spacer"),M=d("v-card-actions"),N=d("v-card");return r(),u(N,{loading:e.loading},{default:h((()=>[p(k,null,{default:h((()=>[p(y,{start:""},{default:h((()=>t[3]||(t[3]=[g("mdi-tune")]))),_:1}),t[4]||(t[4]=g(" Learning Preferences "))])),_:1}),e.courseId?(r(),u(v,{key:0},{default:h((()=>t[5]||(t[5]=[g(" Customize how content is presented in this course ")]))),_:1})):i("",!0),p(I,null,{default:h((()=>[e.courseId?e.loading?(r(),s("div",ya,[p(R,{indeterminate:"",color:"primary"})])):(r(),s("div",pa,[m("div",ga,[m("h3",ma,[p(y,{start:"",size:"small"},{default:h((()=>t[7]||(t[7]=[g("mdi-tune-variant")]))),_:1}),t[8]||(t[8]=g(" Tag Preferences "))]),t[10]||(t[10]=m("p",{class:"text-body-2 text-medium-emphasis mb-3"}," Adjust how much you want to see cards with specific tags. 0 = exclude, 1 = neutral, higher = prefer more. ",-1)),p(_,{modelValue:e.tagToAdd,"onUpdate:modelValue":[t[0]||(t[0]=t=>e.tagToAdd=t),e.addTag],items:e.availableTagsToAdd,"item-title":"name","item-value":"name",label:"Add tag preference",placeholder:"Search tags...",density:"compact",variant:"outlined",clearable:"","hide-details":"",class:"mb-4"},{item:h((({props:e,item:t})=>[p(x,B(z(e)),{subtitle:h((()=>[g(c(t.raw.snippet),1)])),_:2},1040)])),_:1},8,["modelValue","items","onUpdate:modelValue"]),e.tagNames.length>0?(r(),u(T,{key:0,class:"mt-4"},{default:h((()=>[(r(!0),s(a,null,o(e.tagNames,(t=>(r(),u(x,{key:t,class:"px-0"},{default:h((()=>[m("div",fa,[p(S,{size:"small",variant:"tonal",class:"flex-shrink-0",style:{"min-width":"120px"}},{default:h((()=>[g(c(t),1)])),_:2},1024),p(C,{"model-value":e.preferences.boost[t],min:e.sliderConfigResolved.min,max:e.globalSliderMax,step:.01,"hide-details":"",class:"flex-grow-1","thumb-label":"","onUpdate:modelValue":n=>e.updateBoost(t,n)},{"thumb-label":h((({modelValue:t})=>[g(c(e.formatMultiplier(t)),1)])),_:2},1032,["model-value","min","max","onUpdate:modelValue"]),m("span",ba,c(e.formatMultiplier(e.preferences.boost[t])),1),p(E,{icon:"mdi-plus",size:"small",variant:"text",density:"compact",disabled:e.globalSliderMax>=e.sliderConfigResolved.absoluteMax,onClick:n=>e.expandSliderRange(t)},null,8,["disabled","onClick"]),p(E,{icon:"mdi-delete",size:"small",variant:"text",density:"compact",onClick:n=>e.removeTag(t)},null,8,["onClick"])])])),_:2},1024)))),128))])),_:1})):(r(),u(w,{key:1,type:"info",variant:"tonal",class:"mt-4"},{default:h((()=>t[9]||(t[9]=[g(" No tag preferences configured yet. Add tags above to get started. ")]))),_:1}))]),e.saveError?(r(),u(w,{key:0,type:"error",variant:"tonal",class:"mt-4",closable:"","onClick:close":t[1]||(t[1]=t=>e.saveError="")},{default:h((()=>[g(c(e.saveError),1)])),_:1})):i("",!0),e.saveSuccess?(r(),u(w,{key:1,type:"success",variant:"tonal",class:"mt-4",closable:"","onClick:close":t[2]||(t[2]=t=>e.saveSuccess=!1)},{default:h((()=>t[11]||(t[11]=[g(" Preferences saved successfully ")]))),_:1})):i("",!0)])):(r(),u(w,{key:0,type:"info",variant:"tonal",class:"mb-4"},{default:h((()=>t[6]||(t[6]=[g(" Select a course to configure your learning preferences. ")]))),_:1}))])),_:1}),e.courseId&&!e.loading?(r(),u(M,{key:1},{default:h((()=>[p(A),p(E,{variant:"text",disabled:!e.hasChanges,onClick:e.resetToSaved},{default:h((()=>t[12]||(t[12]=[g(" Reset ")]))),_:1},8,["disabled","onClick"]),p(E,{color:"primary",variant:"flat",loading:e.saving,disabled:!e.hasChanges,onClick:e.savePreferences},{default:h((()=>t[13]||(t[13]=[g(" Save Preferences ")]))),_:1},8,["loading","disabled","onClick"])])),_:1})):i("",!0)])),_:1},8,["loading"])}],["__scopeId","data-v-8fb14605"]]);export{js as AudioAutoPlayer,ea as CardBrowser,Ge as CardHistoryViewer,Cn as CardLoader,Oe as CardSearch,Ue as CardSearchResults,ot as CardViewer,_r as CodeBlockRenderer,Vi as CourseCardBrowser,Yi as CourseInformation,oa as CourseTagFilterWidget,Displayable,Sn as FillInInput,ue as HeatMap,ni as MarkdownRenderer,ti as MdTokenRenderer,dn as MultipleChoiceOption,Ne as PaginatingToolbar,Question,pn as RadioMultipleChoice,bi as RequestPasswordReset,Mi as ResetPassword,Gt as SessionControllerDebug,xe as SkMouseTrap,_e as SkMouseTrapToolTip,ke as SkldrMouseTrap,Ie as SnackbarService,sn as StudySession,at as StudySessionTimer,fn as TFSelect,Li as TagsInput,li as UserChip,bn as UserInputNumber,wn as UserInputString,ui as UserLogin,wi as UserLoginAndRegistrationContainer,gi as UserRegistration,ka as UserTagPreferences,Ri as VerifyEmail,Ee as alertUser,Os as containsComponent,ri as getCurrentUser,nt as getUserStatus,Ls as isComponent,Je as isDefineComponent,Bs as isInlineComponent,pi as isPasswordValid,Ye as isQuestionView,Ps as parseComponentSyntax,zs as parseComponentToken,on as piniaPlugin,st as requestPasswordReset,rt as resetPassword,et as sendVerificationEmail,Ns as splitByDelimiters,Ds as splitParagraphToken,$s as splitTextToken,ii as useAuthStore,ln as useCardPreviewModeStore,ai as useConfigStore,it as useEntitlements,Qe as useQuestionView,We as useViewable,hi as validatePassword,tt as verifyEmail};
2
2
  //# sourceMappingURL=common-ui.es.js.map