diff --git a/example/flex/flex_demo.py b/example/flex/flex_demo.py index 13c0d09..60bf66c 100644 --- a/example/flex/flex_demo.py +++ b/example/flex/flex_demo.py @@ -8,6 +8,7 @@ from pykoi.retrieval import RetrievalFactory from pykoi.retrieval import VectorDbFactory from pykoi.component import Chatbot, Dashboard, RetrievalQA +from pykoi.chat import RAGDatabase load_dotenv() @@ -32,9 +33,9 @@ def main(**kargs): ) # retrieval, chatbot, and dashboard pykoi components - retriever = RetrievalQA(retrieval_model=retrieval_model, vector_db=vector_db) - chatbot = Chatbot(None, feedback="vote", is_retrieval=True) - dashboard = Dashboard(QuestionAnswerDatabase()) + retriever = RetrievalQA(retrieval_model=retrieval_model, vector_db=vector_db, feedback="rag") + chatbot = Chatbot(None, feedback="rag", is_retrieval=True) + dashboard = Dashboard(RAGDatabase(), feedback="rag") ############################################################ # Starting the application and retrieval qa as a component # diff --git a/pykoi/__init__.py b/pykoi/__init__.py index 86c1474..16edacc 100644 --- a/pykoi/__init__.py +++ b/pykoi/__init__.py @@ -1,4 +1,3 @@ from pykoi.application import Application - __version__ = "0.0.6" diff --git a/pykoi/application.py b/pykoi/application.py index 32072ce..05f61ef 100644 --- a/pykoi/application.py +++ b/pykoi/application.py @@ -17,6 +17,7 @@ from pykoi.interactives.chatbot import Chatbot from pykoi.telemetry.telemetry import Telemetry from pykoi.telemetry.events import AppStartEvent, AppStopEvent +from pykoi.chat.db.constants import QA_LIST_SEPARATOR oauth_scheme = HTTPBasic() @@ -26,6 +27,17 @@ class UpdateQATable(BaseModel): id: int vote_status: str +class UpdateRAGTable(BaseModel): + id: int + vote_status: str + +class UpdateQATableAnswer(BaseModel): + id: int + new_answer: str + +class UpdateRAGTableAnswer(BaseModel): + id: int + new_answer: str class RankingTableUpdate(BaseModel): question: str @@ -209,6 +221,7 @@ async def update_qa_table( user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), ): try: + print("updating QA vote") component["component"].database.update_vote_status( request_body.id, request_body.vote_status ) @@ -216,6 +229,20 @@ async def update_qa_table( except Exception as ex: return {"log": f"Table update failed: {ex}", "status": "500"} + @app.post("/chat/qa_table/update_answer") + async def update_qa_table_response( + request_body: UpdateQATableAnswer, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + component["component"].database.update_answer( + request_body.id, request_body.new_answer + ) + print("/chat/qa_table/update_answer", request_body.id, request_body.new_answer) + return {"log": "Table response updated", "new_answer": request_body.new_answer, "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + @app.get("/chat/qa_table/close") async def close_qa_table( user: Union[None, UserInDB] = Depends(self.get_auth_dependency()) @@ -271,6 +298,51 @@ async def retrieve_ranking_table( except Exception as ex: return {"log": f"Table retrieval failed: {ex}", "status": "500"} + @app.post("/chat/rag_table/update") + async def update_rag_table( + request_body: UpdateRAGTable, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + print("updating RAG vote") + component["component"].database.update_vote_status( + request_body.id, request_body.vote_status + ) + return {"log": "Table updated", "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + + @app.post("/chat/rag_table/update_answer") + async def update_rag_table_response( + request_body: UpdateRAGTableAnswer, + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()), + ): + try: + component["component"].database.update_answer( + request_body.id, request_body.new_answer + ) + print("/chat/rag_table/update_answer", request_body.id, request_body.new_answer) + return {"log": "Table response updated", "new_answer": request_body.new_answer, "status": "200"} + except Exception as ex: + return {"log": f"Table update failed: {ex}", "status": "500"} + + @app.get("/chat/rag_table/retrieve") + async def retrieve_rag_table( + user: Union[None, UserInDB] = Depends(self.get_auth_dependency()) + ): + try: + rows = component["component"].database.retrieve_all_question_answers() + modified_rows = [] + for row in rows: + row_list = list(row) # Convert the tuple to a list + row_list[5] = row_list[5].split(QA_LIST_SEPARATOR) + row_list[6] = row_list[6].split(QA_LIST_SEPARATOR) + row_list[7] = row_list[7].split(QA_LIST_SEPARATOR) + modified_rows.append(row_list) # Append the modified list to the new list + return {"rows": modified_rows, "log": "RAG Table retrieved", "status": "200"} + except Exception as ex: + return {"log": f"Table retrieval failed: {ex}", "status": "500"} + def create_feedback_route(self, app: FastAPI, component: Dict[str, Any]): """ Create feedback routes for the application. @@ -286,7 +358,14 @@ async def retrieve_qa_table( ): try: rows = component["component"].database.retrieve_all_question_answers() - return {"rows": rows, "log": "Table retrieved", "status": "200"} + modified_rows = [] + for row in rows: + row_list = list(row) # Convert the tuple to a list + row_list[5] = row_list[5].split(QA_LIST_SEPARATOR) + row_list[6] = row_list[6].split(QA_LIST_SEPARATOR) + row_list[7] = row_list[7].split(QA_LIST_SEPARATOR) + modified_rows.append(row_list) # Append the modified list to the new list + return {"rows": modified_rows, "log": "Table retrieved", "status": "200"} except Exception as ex: return {"log": f"Table retrieval failed: {ex}", "status": "500"} @@ -489,16 +568,19 @@ async def inference( print("[/retrieval]: model inference.....", request_body.prompt) component["component"].retrieval_model.re_init(request_body.file_names) output = component["component"].retrieval_model.run_with_return_source_documents({"query": request_body.prompt}) - id = component["component"].database.insert_question_answer( - request_body.prompt, output["result"] - ) print('output', output, output["result"]) if output["source_documents"] == []: - source = "N/A" - source_content = "N/A" + source = ["N/A"] + source_content = ["N/A"] else: - source = output["source_documents"][0].metadata.get('file_name', 'No file name found') - source_content = "1. " + output["source_documents"][0].page_content + "\n2. " + output["source_documents"][1].page_content + source = [] + source_content = [] + for source_document in output["source_documents"]: + source.append(source_document.metadata.get('file_name', 'No file name found')) + source_content.append(source_document.page_content) + id = component["component"].database.insert_question_answer( + request_body.prompt, output["result"], request_body.file_names, source, source_content + ) return { "id": id, "log": "Inference complete", diff --git a/pykoi/chat/__init__.py b/pykoi/chat/__init__.py index cfdb23d..efbeb29 100644 --- a/pykoi/chat/__init__.py +++ b/pykoi/chat/__init__.py @@ -3,3 +3,4 @@ from pykoi.chat.llm.model_factory import ModelFactory from pykoi.chat.db.qa_database import QuestionAnswerDatabase from pykoi.chat.db.ranking_database import RankingDatabase +from pykoi.chat.db.rag_database import RAGDatabase \ No newline at end of file diff --git a/pykoi/chat/db/constants.py b/pykoi/chat/db/constants.py index 2c4e94d..432109e 100644 --- a/pykoi/chat/db/constants.py +++ b/pykoi/chat/db/constants.py @@ -25,3 +25,6 @@ RANKING_CSV_HEADER_UP_RANKING_ANSWER, RANKING_CSV_HEADER_LOW_RANKING_ANSWER, ) + +# list separator +QA_LIST_SEPARATOR = "||" \ No newline at end of file diff --git a/pykoi/chat/db/rag_database.py b/pykoi/chat/db/rag_database.py new file mode 100644 index 0000000..52a82c7 --- /dev/null +++ b/pykoi/chat/db/rag_database.py @@ -0,0 +1,244 @@ +"""Question answer database module""" +import csv +import datetime +import os +import sqlite3 +import threading + +import pandas as pd + +from pykoi.chat.db.constants import QA_CSV_HEADER, QA_LIST_SEPARATOR + + +class RAGDatabase: + """RAG Question Answer Database class""" + + def __init__( + self, + db_file: str = os.path.join(os.getcwd(), "rag.db"), + debug: bool = False, + ): + """ + Initializes a new instance of the RAGDatabase class. + + Args: + db_file (str): The path to the SQLite database file. + debug (bool, optional): Whether to print debug messages. Defaults to False. + """ + self._db_file = db_file + self._debug = debug + self._local = threading.local() # Thread-local storage + self._lock = threading.Lock() # Lock for concurrent write operations + self.create_table() + + def get_connection(self): + """Returns the thread-local database connection""" + if not hasattr(self._local, "connection"): + self._local.connection = sqlite3.connect(self._db_file) + return self._local.connection + + def get_cursor(self): + """Returns the thread-local database cursor""" + if not hasattr(self._local, "cursor"): + self._local.cursor = self.get_connection().cursor() + return self._local.cursor + + def create_table(self): + """ + Creates the question_answer table if it does not already exist in the database. + The table has 6 columns: id (primary key), question, answer, source, source_content, and vote_status. + vote_status is a text field that can only have the values 'up', 'down', or 'n/a'. + """ + query = """ + CREATE TABLE IF NOT EXISTS rag_question_answer ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + question TEXT, + answer TEXT, + edited_answer TEXT, + vote_status TEXT CHECK (vote_status IN ('up', 'down', 'n/a')), + rag_sources TEXT, + source TEXT, + source_content TEXT, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ); + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query) + self.get_connection().commit() + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after creating table:") + self.print_table(rows) + + def insert_question_answer(self, question: str, answer: str, rag_sources: list, source: list, source_content: list): + """ + Inserts a new question-answer pair into the database with the given question and answer. + The vote_status field is set to 'n/a' by default. + Returns the ID of the newly inserted row. + + Args: + question (str): The question to insert. + answer (str): The answer to insert. + rag_sources (list): The RAG sources of the question-answer pair. + source (list): The source(s) of the question-answer pair. + source_content (list): The source content(s) of the question-answer pair. + + Returns: + int: The ID of the newly inserted row. + """ + timestamp = datetime.datetime.now() + query = """ + INSERT INTO rag_question_answer (question, answer, edited_answer, rag_sources, source, source_content, vote_status, timestamp) + VALUES (?, ?, '', ?, ?, ?, 'n/a', ?); + """ + rag_sources = QA_LIST_SEPARATOR.join(rag_sources) + source = QA_LIST_SEPARATOR.join(source) + source_content = QA_LIST_SEPARATOR.join(source_content) + print("rag insert question answer", rag_sources) + + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (question, answer, rag_sources, source, source_content, timestamp)) + self.get_connection().commit() + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after inserting table:") + self.print_table(rows) + + return cursor.lastrowid + + def update_vote_status(self, id, vote_status): + """ + Updates the vote status of a question-answer pair with the given ID. + + Args: + id (int): The ID of the question-answer pair to update. + vote_status (str): The new vote status to set. Must be one of 'up', 'down', or 'n/a'. + + Raises: + ValueError: If the question with the given ID does not exist. + """ + query = """ + UPDATE rag_question_answer + SET vote_status = ? + WHERE id = ?; + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (vote_status, id)) + self.get_connection().commit() + + if cursor.rowcount == 0: + raise ValueError(f"Question with ID {id} does not exist.") + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after updating table:") + self.print_table(rows) + + def update_answer(self, id, new_answer): + """ + Updates the edited_answer of a question-answer pair with the given ID. + + Args: + id (int): The ID of the question-answer pair to update. + new_answer (str): The new modified response to set. + + Raises: + ValueError: If the question with the given ID does not exist. + """ + query = """ + UPDATE rag_question_answer + SET edited_answer = ? + WHERE id = ?; + """ + print('update_answer',new_answer) + with self._lock: + cursor = self.get_cursor() + cursor.execute(query, (new_answer, id)) + self.get_connection().commit() + + if cursor.rowcount == 0: + raise ValueError(f"Question with ID {id} does not exist.") + + if self._debug: + rows = self.retrieve_all_question_answers() + print("Table contents after updating table:") + self.print_table(rows) + + def retrieve_all_question_answers(self): + """ + Retrieves all question-answer pairs from the database. + + Returns: + list: A list of tuples representing the question-answer pairs. + """ + query = """ + SELECT * FROM rag_question_answer; + """ + with self._lock: + cursor = self.get_cursor() + cursor.execute(query) + rows = cursor.fetchall() + return rows + + def retrieve_all_question_answers_as_pandas(self): + """ + Retrieves all question-answer pairs from the database as a pandas dataframe. + + Returns: + DataFrame: A pandas dataframe. + """ + rows = self.retrieve_all_question_answers() + rows_to_pd = pd.DataFrame(rows) + rows_to_pd.columns = QA_CSV_HEADER + return rows_to_pd + + def close_connection(self): + """ + Closes the connection to the database. + """ + if hasattr(self._local, "cursor"): + self._local.cursor.close() + del self._local.cursor + if hasattr(self._local, "connection"): + self._local.connection.close() + del self._local.connection + + def print_table(self, rows): + """ + Prints the contents of the table in a formatted manner. + + Args: + rows (list): A list of tuples where each tuple represents a row in the table. + Each tuple contains five elements: ID, Question, Answer, Timestamp, and Vote Status. + """ + for row in rows: + print( + f"ID: {row[0]}, Question: {row[1]}, " + f"Answer: {row[2]}, Vote Status: {row[3]}, Timestamp: {row[4]}" + ) + + def save_to_csv(self, csv_file_name="question_answer_votes.csv"): + """ + This method saves the contents of the question_answer table into a CSV file. + + Args: + csv_file_name (str, optional): The name of the CSV file to which the data will be written. + Defaults to "question_answer_votes.csv". + + The CSV file will have the following columns: ID, Question, Answer, Vote Status. Each row in the + CSV file corresponds to a row in the question_answer table. + + This method first retrieves all question-answer pairs from the database by calling the + retrieve_all_question_answers method. It then writes this data to the CSV file. + """ + my_sql_data = self.retrieve_all_question_answers() + + with open(csv_file_name, "w", newline="") as file: + writer = csv.writer(file) + writer.writerow(QA_CSV_HEADER) + writer.writerows(my_sql_data) diff --git a/pykoi/component/base.py b/pykoi/component/base.py index 6f6e15e..44960f3 100644 --- a/pykoi/component/base.py +++ b/pykoi/component/base.py @@ -5,6 +5,7 @@ from pykoi.component.chatbot_database_factory import ChatbotDatabaseFactory from pykoi.component.constants import FeedbackType from pykoi.chat.db.qa_database import QuestionAnswerDatabase +from pykoi.chat.db.rag_database import RAGDatabase from pykoi.chat.db.ranking_database import RankingDatabase from pykoi.chat.llm.abs_llm import AbsLlm @@ -129,7 +130,7 @@ class Dashboard(Component): database (str): The database to use for the dashboard. """ - def __init__(self, database: QuestionAnswerDatabase, **kwargs): + def __init__(self, database: any, **kwargs): """ Initialize a new instance of Dashboard. diff --git a/pykoi/component/chatbot_database_factory.py b/pykoi/component/chatbot_database_factory.py index 0c158e3..d774ba8 100644 --- a/pykoi/component/chatbot_database_factory.py +++ b/pykoi/component/chatbot_database_factory.py @@ -4,6 +4,7 @@ from pykoi.component.constants import FeedbackType from pykoi.chat.db.qa_database import QuestionAnswerDatabase from pykoi.chat.db.ranking_database import RankingDatabase +from pykoi.chat.db.rag_database import RAGDatabase class ChatbotDatabaseFactory: @@ -20,13 +21,15 @@ def create(feedback: Union[str, FeedbackType]): feedback (Union[str, FeedbackType]): The type of the chatbot. Returns: - Union[QuestionAnswerDatabase, RankingDatabase]: The created database. + Union[QuestionAnswerDatabase, RankingDatabase, RAGDatabase]: The created database. """ feedback = FeedbackType(feedback) if feedback == FeedbackType.VOTE: return QuestionAnswerDatabase() elif feedback == FeedbackType.RANK: return RankingDatabase() + elif feedback == FeedbackType.RAG: + return RAGDatabase() else: raise ValueError( f"Invalid feedback name: {feedback}. " diff --git a/pykoi/component/constants.py b/pykoi/component/constants.py index 5d78872..f1f30ee 100644 --- a/pykoi/component/constants.py +++ b/pykoi/component/constants.py @@ -7,3 +7,4 @@ class FeedbackType(Enum): VOTE = "vote" RANK = "rank" + RAG = "rag" diff --git a/pykoi/frontend/dist/assets/index-47e316ee.js b/pykoi/frontend/dist/assets/index-47e316ee.js deleted file mode 100644 index 84a03c6..0000000 --- a/pykoi/frontend/dist/assets/index-47e316ee.js +++ /dev/null @@ -1,65 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function X(){}const Hl=e=>e;function Lr(e,t){for(const n in t)e[n]=t[n];return e}function Ll(e){return e()}function qr(){return Object.create(null)}function we(e){e.forEach(Ll)}function ot(e){return typeof e=="function"}function de(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Zs(e){return Object.keys(e).length===0}function fr(e,...t){if(e==null)return X;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function ea(e){let t;return fr(e,n=>t=n)(),t}function ie(e,t,n){e.$$.on_destroy.push(fr(t,n))}function Ue(e,t,n){return e.set(n),t}function qn(e){return e&&ot(e.destroy)?e.destroy:X}const ql=typeof window<"u";let Gl=ql?()=>window.performance.now():()=>Date.now(),gi=ql?e=>requestAnimationFrame(e):X;const Ot=new Set;function Bl(e){Ot.forEach(t=>{t.c(e)||(Ot.delete(t),t.f())}),Ot.size!==0&&gi(Bl)}function jl(e){let t;return Ot.size===0&&gi(Bl),{promise:new Promise(n=>{Ot.add(t={c:e,f:n})}),abort(){Ot.delete(t)}}}let cr=!1;function ta(){cr=!0}function na(){cr=!1}function ra(e,t,n,r){for(;e>1);n(i)<=r?e=i+1:t=i}return e}function ia(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const a=[];for(let u=0;u0&&t[n[i]].claim_order<=u?i+1:ra(1,i,g=>t[n[g]].claim_order,u))-1;r[a]=n[f]+1;const c=f+1;n[c]=a,i=Math.max(c,i)}const o=[],l=[];let s=t.length-1;for(let a=n[i]+1;a!=0;a=r[a-1]){for(o.push(t[a-1]);s>=a;s--)l.push(t[s]);s--}for(;s>=0;s--)l.push(t[s]);o.reverse(),l.sort((a,u)=>a.claim_order-u.claim_order);for(let a=0,u=0;a=o[u].claim_order;)u++;const f=ue.removeEventListener(t,n,r)}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function ua(e){return Array.from(e.childNodes)}function fa(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function ca(e,t,n,r,i=!1){fa(e);const o=(()=>{for(let l=e.claim_info.last_index;l=0;l--){const s=e[l];if(t(s)){const a=n(s);return a===void 0?e.splice(l,1):e[l]=a,i?a===void 0&&e.claim_info.last_index--:e.claim_info.last_index=l,s}}return r()})();return o.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,o}function da(e,t){return ca(e,n=>n.nodeType===3,n=>{const r=""+t;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>z(t),!0)}function J(e,t){t=""+t,e.data!==t&&(e.data=t)}function Lt(e,t){e.value=t??""}function Ee(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Gn(e,t,n){for(let r=0;r{l.source===r.contentWindow&&t()})):(r.src="about:blank",r.onload=()=>{o=K(r.contentWindow,"resize",t),t()}),w(e,r),()=>{(i||o&&r.contentWindow)&&o(),N(r)}}function en(e,t,n){e.classList[n?"add":"remove"](t)}function ha(e,t,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}function qt(e,t){return new e(t)}const Bn=new Map;let jn=0;function pa(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function ma(e,t){const n={stylesheet:oa(t),rules:{}};return Bn.set(e,n),n}function Di(e,t,n,r,i,o,l,s=0){const a=16.666/r;let u=`{ -`;for(let _=0;_<=1;_+=a){const b=t+(n-t)*o(_);u+=_*100+`%{${l(b,1-b)}} -`}const f=u+`100% {${l(n,1-n)}} -}`,c=`__svelte_${pa(f)}_${s}`,g=Ul(e),{stylesheet:d,rules:p}=Bn.get(g)||ma(g,e);p[c]||(p[c]=!0,d.insertRule(`@keyframes ${c} ${f}`,d.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${c} ${r}ms linear ${i}ms 1 both`,jn+=1,c}function _a(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),i=n.length-r.length;i&&(e.style.animation=r.join(", "),jn-=i,jn||va())}function va(){gi(()=>{jn||(Bn.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&N(t)}),Bn.clear())})}let Gt;function yt(e){Gt=e}function wa(){if(!Gt)throw new Error("Function called outside component initialization");return Gt}function Xt(e){wa().$$.on_mount.push(e)}const Dt=[],Un=[];let Tt=[];const xi=[],ba=Promise.resolve();let Gr=!1;function ya(){Gr||(Gr=!0,ba.then(Xl))}function Re(e){Tt.push(e)}const _r=new Set;let Et=0;function Xl(){if(Et!==0)return;const e=Gt;do{try{for(;Ete.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),Tt=t}let Qt;function ka(){return Qt||(Qt=Promise.resolve(),Qt.then(()=>{Qt=null})),Qt}function vr(e,t,n){e.dispatchEvent(ha(`${t?"intro":"outro"}${n}`))}const Nn=new Set;let rt;function ke(){rt={r:0,c:[],p:rt}}function $e(){rt.r||we(rt.c),rt=rt.p}function T(e,t){e&&e.i&&(Nn.delete(e),e.i(t))}function L(e,t,n,r){if(e&&e.o){if(Nn.has(e))return;Nn.add(e),rt.c.push(()=>{Nn.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}const $a={duration:0};function dt(e,t,n,r){const i={direction:"both"};let o=t(e,n,i),l=r?0:1,s=null,a=null,u=null;function f(){u&&_a(e,u)}function c(d,p){const m=d.b-l;return p*=Math.abs(m),{a:l,b:d.b,d:m,duration:p,start:d.start,end:d.start+p,group:d.group}}function g(d){const{delay:p=0,duration:m=300,easing:_=Hl,tick:b=X,css:v}=o||$a,$={start:Gl()+p,b:d};d||($.group=rt,rt.r+=1),s||a?a=$:(v&&(f(),u=Di(e,l,d,m,p,_,v)),d&&b(0,1),s=c($,m),Re(()=>vr(e,d,"start")),jl(A=>{if(a&&A>a.start&&(s=c(a,m),a=null,vr(e,s.b,"start"),v&&(f(),u=Di(e,l,s.b,s.duration,0,_,o.css))),s){if(A>=s.end)b(l=s.b,1-l),vr(e,s.b,"end"),a||(s.b?f():--s.group.r||we(s.group.c)),s=null;else if(A>=s.start){const k=A-s.start;l=s.a+s.d*_(k/s.duration),b(l,1-l)}}return!!(s||a)}))}return{run(d){ot(o)?ka().then(()=>{o=o(i),g(d)}):g(d)},end(){f(),s=a=null}}}function hi(e,t){e.d(1),t.delete(e.key)}function Yl(e,t){L(e,1,1,()=>{t.delete(e.key)})}function _n(e,t,n,r,i,o,l,s,a,u,f,c){let g=e.length,d=o.length,p=g;const m={};for(;p--;)m[e[p].key]=p;const _=[],b=new Map,v=new Map,$=[];for(p=d;p--;){const y=c(i,o,p),C=n(y);let S=l.get(C);S?r&&$.push(()=>S.p(y,t)):(S=u(C,y),S.c()),b.set(C,_[p]=S),C in m&&v.set(C,Math.abs(p-m[C]))}const A=new Set,k=new Set;function E(y){T(y,1),y.m(s,f),l.set(y.key,y),f=y.first,d--}for(;g&&d;){const y=_[d-1],C=e[g-1],S=y.key,M=C.key;y===C?(f=y.first,g--,d--):b.has(M)?!l.has(S)||A.has(S)?E(y):k.has(M)?g--:v.get(S)>v.get(M)?(k.add(S),E(y)):(A.add(M),g--):(a(C,l),g--)}for(;g--;){const y=e[g];b.has(y.key)||a(y,l)}for(;d;)E(_[d-1]);return we($),_}function Ra(e,t){const n={},r={},i={$$scope:1};let o=e.length;for(;o--;){const l=e[o],s=t[o];if(s){for(const a in l)a in s||(r[a]=1);for(const a in s)i[a]||(n[a]=s[a],i[a]=1);e[o]=s}else for(const a in l)i[a]=1}for(const l in r)l in n||(n[l]=void 0);return n}function Aa(e){return typeof e=="object"&&e!==null?e:{}}const Ea=/[&"]/g,Ma=/[&<]/g;function Fa(e,t=!1){const n=String(e),r=t?Ea:Ma;r.lastIndex=0;let i="",o=0;for(;r.test(n);){const l=r.lastIndex-1,s=n[l];i+=n.substring(o,l)+(s==="&"?"&":s==='"'?""":"<"),o=l+1}return i+n.substring(o)}function Ia(e,t){if(!e||!e.$$render)throw t==="svelte:component"&&(t+=" this={...}"),new Error(`<${t}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${t}>.`);return e}let wr;function Ql(e){function t(n,r,i,o,l){const s=Gt,a={on_destroy:wr,context:new Map(l||(s?s.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:qr()};yt({$$:a});const u=e(n,r,i,o);return yt(s),u}return{render:(n={},{$$slots:r={},context:i=new Map}={})=>{wr=[];const o={title:"",head:"",css:new Set},l=t(o,n,{},r,i);return we(wr),{html:l,css:{code:Array.from(o.css).map(s=>s.code).join(` -`),map:null},head:o.title+o.head}},$$render:t}}function ce(e){e&&e.c()}function Da(e,t){e&&e.l(t)}function ae(e,t,n,r){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,n),r||Re(()=>{const l=e.$$.on_mount.map(Ll).filter(ot);e.$$.on_destroy?e.$$.on_destroy.push(...l):we(l),e.$$.on_mount=[]}),o.forEach(Re)}function ue(e,t){const n=e.$$;n.fragment!==null&&(Ca(n.after_update),we(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function xa(e,t){e.$$.dirty[0]===-1&&(Dt.push(e),ya(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const p=d.length?d[0]:g;return u.ctx&&i(u.ctx[c],u.ctx[c]=p)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](p),f&&xa(e,c)),g}):[],u.update(),f=!0,we(u.before_update),u.fragment=r?r(u.ctx):!1,t.target){if(t.hydrate){ta();const c=ua(t.target);u.fragment&&u.fragment.l(c),c.forEach(N)}else u.fragment&&u.fragment.c();t.intro&&T(e.$$.fragment),ae(e,t.target,t.anchor,t.customElement),na(),Xl()}yt(a)}class ge{$destroy(){ue(this,1),this.$destroy=X}$on(t,n){if(!ot(n))return X;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Zs(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Mt=[];function Br(e,t){return{subscribe:Me(e,t).subscribe}}function Me(e,t=X){let n;const r=new Set;function i(s){if(de(e,s)&&(e=s,n)){const a=!Mt.length;for(const u of r)u[1](),Mt.push(u,e);if(a){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:l}}function Pa(e,t,n){const r=!Array.isArray(e),i=r?[e]:e,o=t.length<2;return Br(n,l=>{let s=!1;const a=[];let u=0,f=X;const c=()=>{if(u)return;f();const d=t(r?a[0]:a,l);o?l(d):f=ot(d)?d:X},g=i.map((d,p)=>fr(d,m=>{a[p]=m,u&=~(1<{u|=1<e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const r=t.map((i,o)=>jr(e[o],i));return i=>r.map(o=>o(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(Pi(e)&&Pi(t)){e=e.getTime(),t=t.getTime();const o=t-e;return l=>new Date(e+l*o)}const r=Object.keys(t),i={};return r.forEach(o=>{i[o]=jr(e[o],t[o])}),o=>{const l={};return r.forEach(s=>{l[s]=i[s](o)}),l}}if(n==="number"){const r=t-e;return i=>e+i*r}throw new Error(`Cannot interpolate ${n} values`)}function mi(e,t={}){const n=Me(e);let r,i=e;function o(l,s){if(e==null)return n.set(e=l),Promise.resolve();i=l;let a=r,u=!1,{delay:f=0,duration:c=400,easing:g=Hl,interpolate:d=jr}=Lr(Lr({},t),s);if(c===0)return a&&(a.abort(),a=null),n.set(e=i),Promise.resolve();const p=Gl()+f;let m;return r=jl(_=>{if(_c?(n.set(e=l),!1):(n.set(e=m(g(b/c))),!0)}),r.promise}return{set:o,update:(l,s)=>o(l(i,e),s),subscribe:n.subscribe}}const qe=Me([]),br=Me([]),yr=Me([]),et=Me("all"),Ni=Me({"n/a":1,up:1,down:1}),Na=["who","what","how","why","where","does","can","n/a"],Ur=mi(Na.map(e=>({question:e,count:0}))),Wr=Me(new Set);var Xr="http://www.w3.org/1999/xhtml";const Oi={svg:"http://www.w3.org/2000/svg",xhtml:Xr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Kl(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Oi.hasOwnProperty(t)?{space:Oi[t],local:e}:e}function Oa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Xr&&t.documentElement.namespaceURI===Xr?t.createElement(e):t.createElementNS(n,e)}}function Ta(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Jl(e){var t=Kl(e);return(t.local?Ta:Oa)(t)}function Va(){}function Zl(e){return e==null?Va:function(){return this.querySelector(e)}}function za(e){typeof e!="function"&&(e=Zl(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=$&&($=v+1);!(k=_[$])&&++$=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function cu(e){e||(e=du);function t(c,g){return c&&g?e(c.__data__,g.__data__):!c-!g}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function gu(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hu(){return Array.from(this)}function pu(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ru:typeof t=="function"?Eu:Au)(e,t,n??"")):Fu(this.node(),e)}function Fu(e,t){return e.style.getPropertyValue(t)||rs(e).getComputedStyle(e,null).getPropertyValue(t)}function Iu(e){return function(){delete this[e]}}function Du(e,t){return function(){this[e]=t}}function xu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Pu(e,t){return arguments.length>1?this.each((t==null?Iu:typeof t=="function"?xu:Du)(e,t)):this.node()[e]}function is(e){return e.trim().split(/^|\s+/)}function _i(e){return e.classList||new os(e)}function os(e){this._node=e,this._names=is(e.getAttribute("class")||"")}os.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ls(e,t){for(var n=_i(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function uf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n`${b[0].toUpperCase()}${b.slice(1)}`),c=parseFloat(o[`padding${f[0]}`]),g=parseFloat(o[`padding${f[1]}`]),d=parseFloat(o[`margin${f[0]}`]),p=parseFloat(o[`margin${f[1]}`]),m=parseFloat(o[`border${f[0]}Width`]),_=parseFloat(o[`border${f[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*l};${s}: ${b*a}px;padding-${u[0]}: ${b*c}px;padding-${u[1]}: ${b*g}px;margin-${u[0]}: ${b*d}px;margin-${u[1]}: ${b*p}px;border-${u[0]}-width: ${b*m}px;border-${u[1]}-width: ${b*_}px;`}}function Cn(e,{delay:t=0,duration:n=400,easing:r=pi,start:i=0,opacity:o=0}={}){const l=getComputedStyle(e),s=+l.opacity,a=l.transform==="none"?"":l.transform,u=1-i,f=s*(1-o);return{delay:t,duration:n,easing:r,css:(c,g)=>` - transform: ${a} scale(${1-u*g}); - opacity: ${s-f*g} - `}}function Ti(e,t,n){const r=e.slice();return r[8]=t[n],r[10]=n,r}function Vi(e){let t,n,r,i,o=e[8].name+"",l,s,a,u,f;function c(...g){return e[6](e[8],...g)}return{c(){t=R("label"),n=R("input"),l=z(o),s=P(),h(n,"type","checkbox"),h(n,"id",r=e[8].id),n.checked=i=e[1].has(e[8].name),h(t,"for",a=e[8].id)},m(g,d){V(g,t,d),w(t,n),w(t,l),w(t,s),u||(f=K(n,"change",c),u=!0)},p(g,d){e=g,d&1&&r!==(r=e[8].id)&&h(n,"id",r),d&3&&i!==(i=e[1].has(e[8].name))&&(n.checked=i),d&1&&o!==(o=e[8].name+"")&&J(l,o),d&1&&a!==(a=e[8].id)&&h(t,"for",a)},d(g){g&&N(t),u=!1,f()}}}function _f(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[0],d=[];for(let p=0;pn(1,r=c));let{documents:i=[]}=t,o=!1,l;function s(){n(2,o=!o)}function a(c,g){g.target.checked?r.add(c):r.delete(c),Wr.set(new Set(r))}const u=(c,g)=>a(c.name,g);function f(c){Un[c?"unshift":"push"](()=>{l=c,n(3,l)})}return e.$$set=c=>{"documents"in c&&n(0,i=c.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(r)},[i,r,o,l,s,a,u,f]}let wf=class extends ge{constructor(t){super(),me(this,t,vf,_f,de,{documents:0})}};function Qr(e,t=2){if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,o)).toFixed(r))+" "+i[o]}function bf(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let r=0;r({question:r,count:t[r]}))}function fs(e){return e.map(t=>{const n=t.question.split(" ").length,r=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+r,vote:t.vote}})}function yf(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const i=document.createElement("span");i.textContent=t,i.setAttribute("id","tooltip"),e.appendChild(i),e.addEventListener("mouseleave",r),e.addEventListener("blur",r),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function r(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",r),e.removeEventListener("blur",r),e.addEventListener("mouseenter",n),e.addEventListener("focus",n)}return e.addEventListener("mouseenter",n),e.addEventListener("focus",n),{onDestroy(){e.classList.remove("tooltip"),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}}}function zi(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function Hi(e){let t,n,r,i,o,l;function s(...u){return e[12](e[23],...u)}function a(...u){return e[13](e[23],...u)}return{c(){t=R("div"),n=R("button"),n.textContent="👍",r=P(),i=R("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-1uetn8d"),h(i,"class","small-button thumbs-down svelte-1uetn8d"),h(t,"class","feedback-buttons svelte-1uetn8d")},m(u,f){V(u,t,f),w(t,n),w(t,r),w(t,i),o||(l=[K(n,"click",s),K(i,"click",a)],o=!0)},p(u,f){e=u},d(u){u&&N(t),o=!1,we(l)}}}function Sf(e){let t;return{c(){t=R("p"),t.textContent="⌄"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Cf(e){let t;return{c(){t=R("p"),t.textContent="⌃"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Li(e){let t,n,r=e[21].source_content+"",i,o,l;return{c(){t=R("div"),n=R("p"),i=z(r),h(n,"class","bold svelte-1uetn8d"),h(t,"class","source_content svelte-1uetn8d")},m(s,a){V(s,t,a),w(t,n),w(n,i),l=!0},p(s,a){(!l||a&32)&&r!==(r=s[21].source_content+"")&&J(i,r)},i(s){l||(Re(()=>{l&&(o||(o=dt(t,Yr,{},!0)),o.run(1))}),l=!0)},o(s){o||(o=dt(t,Yr,{},!1)),o.run(0),l=!1},d(s){s&&N(t),s&&o&&o.end()}}}function qi(e,t){let n,r,i,o,l,s,a,u,f,c=t[21].question+"",g,d,p,m,_,b,v,$,A,k,E,y=t[21].answer+"",C,S,M,F,I,D,j,le=t[21].source+"",Z,be,ye,he,te,pe,ut,Ye,Q=t[0]&&Hi(t);function yn(Y,H){return Y[3][Y[23]]?Cf:Sf}let He=yn(t),ne=He(t);function mr(){return t[14](t[23])}let O=t[3][t[23]]&&Li(t);return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=P(),l=R("div"),s=R("div"),a=R("h5"),a.textContent="Question:",u=P(),f=R("p"),g=z(c),d=P(),p=R("div"),m=R("p"),m.textContent="ℹī¸ Retrieval Sources",b=P(),v=R("div"),$=R("div"),A=R("h5"),A.textContent="Response:",k=P(),E=R("p"),C=z(y),S=P(),Q&&Q.c(),M=P(),F=R("div"),I=R("div"),D=R("p"),j=z("📖 Source: "),Z=z(le),be=P(),ne.c(),ye=P(),O&&O.c(),he=P(),h(i,"class","avatar"),h(a,"class","bold svelte-1uetn8d"),h(m,"class","bold svelte-1uetn8d"),h(p,"class","rag-sources svelte-1uetn8d"),h(s,"class","question svelte-1uetn8d"),h(A,"class","bold svelte-1uetn8d"),h($,"class","answer svelte-1uetn8d"),h(D,"class","bold svelte-1uetn8d"),h(I,"class","source_tab svelte-1uetn8d"),h(F,"class","source svelte-1uetn8d"),h(v,"class","answers svelte-1uetn8d"),h(l,"class","message-content svelte-1uetn8d"),h(r,"class","chat-message-center svelte-1uetn8d"),h(n,"class","chat-message svelte-1uetn8d"),this.first=n},m(Y,H){V(Y,n,H),w(n,r),w(r,i),w(r,o),w(r,l),w(l,s),w(s,a),w(s,u),w(s,f),w(f,g),w(s,d),w(s,p),w(p,m),w(l,b),w(l,v),w(v,$),w($,A),w($,k),w($,E),w(E,C),w($,S),Q&&Q.m($,null),w(v,M),w(v,F),w(F,I),w(I,D),w(D,j),w(D,Z),w(I,be),ne.m(I,null),w(F,ye),O&&O.m(F,null),w(n,he),pe=!0,ut||(Ye=[qn(_=yf.call(null,m,Gi(t[21]))),K(I,"click",mr),qn(te=$f.call(null,n,t[23]===t[5].length-1))],ut=!0)},p(Y,H){t=Y,(!pe||H&32)&&c!==(c=t[21].question+"")&&J(g,c),_&&ot(_.update)&&H&32&&_.update.call(null,Gi(t[21])),(!pe||H&32)&&y!==(y=t[21].answer+"")&&J(C,y),t[0]?Q?Q.p(t,H):(Q=Hi(t),Q.c(),Q.m($,null)):Q&&(Q.d(1),Q=null),(!pe||H&32)&&le!==(le=t[21].source+"")&&J(Z,le),He!==(He=yn(t))&&(ne.d(1),ne=He(t),ne&&(ne.c(),ne.m(I,null))),t[3][t[23]]?O?(O.p(t,H),H&40&&T(O,1)):(O=Li(t),O.c(),T(O,1),O.m(F,null)):O&&(ke(),L(O,1,1,()=>{O=null}),$e()),te&&ot(te.update)&&H&32&&te.update.call(null,t[23]===t[5].length-1)},i(Y){pe||(T(O),pe=!0)},o(Y){L(O),pe=!1},d(Y){Y&&N(n),Q&&Q.d(),ne.d(),O&&O.d(),ut=!1,we(Ye)}}}function kf(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,g,d,p,m,_,b,v=(e[2]?e[4]:"Send")+"",$,A,k,E,y,C,S,M=e[5];const F=I=>I[23];for(let I=0;IVote Feedback Instructions -

Ask a question to receive an answer from the chatbot. If the response is - satisfactory, click on the 👍 - button. If the repsonse is not satisfactory, click on the - 👎 button.

`,r=P(),i=R("div"),o=R("section"),l=R("div");for(let I=0;I{e.scrollIntoView({behavior:"smooth"})},0)}async function Rf(e){const t=await fetch("/chat/qa_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Gi(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Af(e,t,n){let r,i,o,l;ie(e,qe,y=>n(5,i=y)),ie(e,Wr,y=>n(17,o=y));let{feedback:s=!1}=t,{is_retrieval:a=!1}=t;const u=Me([]);ie(e,u,y=>n(6,l=y));let f="",c="",g=!1,d=[];Xt(()=>{m(),p()});async function p(){const C=await(await fetch("/retrieval/file/get")).json();console.log("data",C.files);const M=C.files.map((F,I)=>({id:String(I),name:F.name}));console.log("files",M),Ue(u,l=[...M],l)}async function m(){const M=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(F=>({id:F[0],question:F[1],answer:F[2],vote_status:F[3],rag_sources:["doc1.pdf","doc2.pdf","doc3.pdf"]}));n(3,d=new Array(M.length).fill(!1)),Ue(qe,i=[...M],i)}const _=async y=>{y.preventDefault(),f=c,n(1,c=""),n(2,g=!0);const C=[...o];let S={id:i.length+1,question:f,answer:"Loading...",rag_sources:C,vote_status:"na",source:"Loading...",source_content:"Loading..."};Ue(qe,i=[...i,S],i);const M=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f,file_names:C})}):await fetch(`/chat/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f})});if(M.ok){const F=await M.json();console.log("response data",F),S.answer=F.answer,S.source=F.source,S.source_content=F.source_content,d.push(!1),qe.update(I=>(I[I.length-1]=S,I))}else{const F=await M.text();alert(F)}n(2,g=!1)};let b=0;setInterval(()=>{n(11,b=(b+1)%4)},200);function v(y,C,S){const M=i[S];M.vote=C;const F={id:S+1,vote_status:C};Rf(F),Ct(y.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),Ct(y.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}[...Array(10).keys()].map(y=>String.fromCharCode(65+y));const $=(y,C)=>v(C,"up",y),A=(y,C)=>v(C,"down",y),k=y=>n(3,d[y]=!d[y],d);function E(){c=this.value,n(1,c)}return e.$$set=y=>{"feedback"in y&&n(0,s=y.feedback),"is_retrieval"in y&&n(10,a=y.is_retrieval)},e.$$.update=()=>{e.$$.dirty&2048&&n(4,r=".".repeat(b).padEnd(3))},[s,c,g,d,r,i,l,u,_,v,a,b,$,A,k,E]}class vi extends ge{constructor(t){super(),me(this,t,Af,kf,de,{feedback:0,is_retrieval:10})}}function Bi(e,t,n){const r=e.slice();return r[14]=t[n],r[16]=n,r}function ji(e,t){let n,r,i,o,l,s,a,u,f,c=t[14].question+"",g,d,p,m,_,b,v,$=t[14].up_ranking_answer+"",A,k,E,y,C,S,M=t[14].low_ranking_answer+"",F,I,D,j,le;function Z(...te){return t[7](t[14],t[16],...te)}function be(...te){return t[8](t[14],t[16],...te)}function ye(...te){return t[9](t[14],t[16],...te)}function he(...te){return t[10](t[14],t[16],...te)}return{key:e,first:null,c(){n=R("div"),r=R("div"),i=R("div"),o=P(),l=R("div"),s=R("div"),a=R("h5"),a.textContent="Question:",u=P(),f=R("p"),g=z(c),d=P(),p=R("div"),m=R("div"),_=R("h5"),_.textContent="Response 1:",b=P(),v=R("p"),A=z($),k=P(),E=R("div"),y=R("h5"),y.textContent="Response 2:",C=P(),S=R("p"),F=z(M),I=P(),h(i,"class","avatar"),h(a,"class","bold svelte-au920n"),h(s,"class","question svelte-au920n"),h(_,"class","bold underline svelte-au920n"),h(m,"class","answer svelte-au920n"),h(y,"class","bold underline svelte-au920n"),h(E,"class","answer svelte-au920n"),h(p,"class","answers svelte-au920n"),h(l,"class","message-content svelte-au920n"),h(r,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(te,pe){V(te,n,pe),w(n,r),w(r,i),w(r,o),w(r,l),w(l,s),w(s,a),w(s,u),w(s,f),w(f,g),w(l,d),w(l,p),w(p,m),w(m,_),w(m,b),w(m,v),w(v,A),w(p,k),w(p,E),w(E,y),w(E,C),w(E,S),w(S,F),w(n,I),j||(le=[K(m,"click",Z),K(m,"keydown",be),K(E,"click",ye),K(E,"keydown",he),qn(D=Mf.call(null,n,t[16]===t[3].length-1))],j=!0)},p(te,pe){t=te,pe&8&&c!==(c=t[14].question+"")&&J(g,c),pe&8&&$!==($=t[14].up_ranking_answer+"")&&J(A,$),pe&8&&M!==(M=t[14].low_ranking_answer+"")&&J(F,M),D&&ot(D.update)&&pe&8&&D.update.call(null,t[16]===t[3].length-1)},d(te){te&&N(n),j=!1,we(le)}}}function Ef(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,g,d,p,m=(e[1]?e[2]:"Send")+"",_,b,v,$,A,k,E=e[3];const y=C=>C[16];for(let C=0;CRanked Feedback Instructions -

Ask a question and click on the better of the two responses. The better - response will be outlined in green, the worse - response outlined in red. This data will be - automatically fed to RLHF.

- `,r=P(),i=R("div"),o=R("section"),l=R("div");for(let C=0;C{e.scrollIntoView({behavior:"smooth"})},0)}async function Ff(e){const t=await fetch("/chat/ranking_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function If(e,t,n){let r,i;ie(e,br,_=>n(3,i=_));let o="",l="",s=!1;Xt(()=>{});const a=async _=>{_.preventDefault(),o=l,n(0,l=""),n(1,s=!0);let b={question:o,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Ue(br,i=[...i,b],i);const v=await fetch(`/chat/multi_responses/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:o})});if(v.ok){const $=await v.json();b.up_ranking_answer=$.answer[0],b.low_ranking_answer=$.answer[1],br.update(A=>(A[A.length-1]=b,A))}else{const $=await v.text();alert($)}n(1,s=!1)};let u=0;setInterval(()=>{n(6,u=(u+1)%4)},200);function f(_,b,v,$){const A=i[v],k={1:"up_ranking_answer",2:"low_ranking_answer"},E={question:A.question,up_ranking_answer:A[k[$]],low_ranking_answer:A[k[$%2+1]]};Ff(E),Ct(_.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),Ct(_.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const c=(_,b,v)=>f(v,_,b,1),g=(_,b,v)=>f(v,_,b,1),d=(_,b,v)=>f(v,_,b,2),p=(_,b,v)=>f(v,_,b,2);function m(){l=this.value,n(0,l)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,r=".".repeat(u).padEnd(3))},[l,s,r,i,a,f,u,c,g,d,p,m]}class Df extends ge{constructor(t){super(),me(this,t,If,Ef,de,{})}}function Ui(e){let t,n;return t=new vi({props:{is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Wi(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Xi(e){let t,n,r,i;const o=[Pf,xf],l=[];function s(a,u){return a[1]?0:1}return t=s(e),n=l[t]=o[t](e),{c(){n.c(),r=lt()},m(a,u){l[t].m(a,u),V(a,r,u),i=!0},p(a,u){let f=t;t=s(a),t===f?l[t].p(a,u):(ke(),L(l[f],1,1,()=>{l[f]=null}),$e(),n=l[t],n?n.p(a,u):(n=l[t]=o[t](a),n.c()),T(n,1),n.m(r.parentNode,r))},i(a){i||(T(n),i=!0)},o(a){L(n),i=!1},d(a){l[t].d(a),a&&N(r)}}}function xf(e){let t,n;return t=new Df({}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p:X,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Pf(e){let t,n;return t=new vi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Nf(e){let t,n,r,i,o=!e[0]&&Ui(e),l=e[0]==="vote"&&Wi(e),s=e[0]==="rank"&&Xi(e);return{c(){o&&o.c(),t=P(),l&&l.c(),n=P(),s&&s.c(),r=lt()},m(a,u){o&&o.m(a,u),V(a,t,u),l&&l.m(a,u),V(a,n,u),s&&s.m(a,u),V(a,r,u),i=!0},p(a,[u]){a[0]?o&&(ke(),L(o,1,1,()=>{o=null}),$e()):o?(o.p(a,u),u&1&&T(o,1)):(o=Ui(a),o.c(),T(o,1),o.m(t.parentNode,t)),a[0]==="vote"?l?(l.p(a,u),u&1&&T(l,1)):(l=Wi(a),l.c(),T(l,1),l.m(n.parentNode,n)):l&&(ke(),L(l,1,1,()=>{l=null}),$e()),a[0]==="rank"?s?(s.p(a,u),u&1&&T(s,1)):(s=Xi(a),s.c(),T(s,1),s.m(r.parentNode,r)):s&&(ke(),L(s,1,1,()=>{s=null}),$e())},i(a){i||(T(o),T(l),T(s),i=!0)},o(a){L(o),L(l),L(s),i=!1},d(a){o&&o.d(a),a&&N(t),l&&l.d(a),a&&N(n),s&&s.d(a),a&&N(r)}}}function Of(e,t,n){let{feedback:r}=t,{is_retrieval:i}=t;return e.$$set=o=>{"feedback"in o&&n(0,r=o.feedback),"is_retrieval"in o&&n(1,i=o.is_retrieval)},[r,i]}class Tf extends ge{constructor(t){super(),me(this,t,Of,Nf,de,{feedback:0,is_retrieval:1})}}function Yi(e,t,n){const r=e.slice();return r[2]=t[n],r}function Qi(e){let t,n=e[2]+"",r,i;return{c(){t=R("option"),r=z(n),t.__value=i=e[2],t.value=t.__value},m(o,l){V(o,t,l),w(t,r)},p(o,l){l&1&&n!==(n=o[2]+"")&&J(r,n),l&1&&i!==(i=o[2])&&(t.__value=i,t.value=t.__value)},d(o){o&&N(t)}}}function Vf(e){let t,n=e[0],r=[];for(let i=0;i{const o=await fetch(`/data/${r}`);n(0,i=await o.json())}),e.$$set=o=>{"data_endpoint"in o&&n(1,r=o.data_endpoint)},[i,r]}class Hf extends ge{constructor(t){super(),me(this,t,zf,Vf,de,{data_endpoint:1})}}function Vt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Lf(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function cs(e){let t,n,r;e.length!==2?(t=Vt,n=(s,a)=>Vt(e(s),a),r=(s,a)=>e(s)-a):(t=e===Vt||e===Lf?e:qf,n=e,r=e);function i(s,a,u=0,f=s.length){if(u>>1;n(s[c],a)<0?u=c+1:f=c}while(u>>1;n(s[c],a)<=0?u=c+1:f=c}while(uu&&r(s[c-1],a)>-r(s[c],a)?c-1:c}return{left:i,center:l,right:o}}function qf(){return 0}function Gf(e){return e===null?NaN:+e}function*Bf(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const jf=cs(Vt),Uf=jf.right;cs(Gf).center;const ds=Uf;function Wf(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function sn(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=o&&(n=r=o):(n>o&&(n=o),r{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function gs(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var Zf=Array.prototype,ec=Zf.slice;function Cr(e){return()=>e}const tc=Math.sqrt(50),nc=Math.sqrt(10),rc=Math.sqrt(2);function Xn(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),l=o>=tc?10:o>=nc?5:o>=rc?2:1;let s,a,u;return i<0?(u=Math.pow(10,-i)/l,s=Math.round(e*u),a=Math.round(t*u),s/ut&&--a,u=-u):(u=Math.pow(10,i)*l,s=Math.round(e/u),a=Math.round(t/u),s*ut&&--a),a0))return[];if(e===t)return[e];const r=t=i))return[];const s=o-i+1,a=new Array(s);if(r)if(l<0)for(let u=0;u0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function lc(e){return Math.max(1,Math.ceil(Math.log(Wf(e))/Math.LN2)+1)}function ps(){var e=Kf,t=sn,n=lc;function r(i){Array.isArray(i)||(i=Array.from(i));var o,l=i.length,s,a,u=new Array(l);for(o=0;o=g)if($>=g&&t===sn){const k=Bt(c,g,A);isFinite(k)&&(k>0?g=(Math.floor(g/k)+1)*k:k<0&&(g=(Math.ceil(g*-k)+1)/-k))}else d.pop()}for(var p=d.length,m=0,_=p;d[m]<=c;)++m;for(;d[_-1]>g;)--_;(m||_0?d[o-1]:c,v.x1=o0)for(o=0;o=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function Zi(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ms(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?gs:Jf(i);r>n;){if(r-n>600){const a=r-n+1,u=t-n+1,f=Math.log(a),c=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*c*(a-c)/a)*(u-a/2<0?-1:1),d=Math.max(n,Math.floor(t-u*c/a+g)),p=Math.min(r,Math.floor(t+(a-u)*c/a+g));ms(e,t,d,p,i)}const o=e[t];let l=n,s=r;for(Kt(e,n,t),i(e[r],o)>0&&Kt(e,n,r);l0;)--s}i(e[n],o)===0?Kt(e,n,s):(++s,Kt(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Kt(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function sc(e,t,n){if(e=Float64Array.from(Bf(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Zi(e);if(t>=1)return kt(e);var r,i=(r-1)*t,o=Math.floor(i),l=kt(ms(e,o).subarray(0,o+1)),s=Zi(e.subarray(o+1));return l+(s-l)*(i-o)}}function ac(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Yn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function jt(e){return e=Yn(Math.abs(e)),e?e[1]:NaN}function fc(e,t){return function(n,r){for(var i=n.length,o=[],l=0,s=e[0],a=0;i>0&&s>0&&(a+s+1>r&&(s=Math.max(1,r-a)),o.push(n.substring(i-=s,i+s)),!((a+=s+1)>r));)s=e[l=(l+1)%e.length];return o.reverse().join(t)}}function cc(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var dc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qn(e){if(!(t=dc.exec(e)))throw new Error("invalid format: "+e);var t;return new wi({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Qn.prototype=wi.prototype;function wi(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}wi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function gc(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var _s;function hc(e,t){var n=Yn(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(_s=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Yn(e,Math.max(0,t+o-1))[0]}function eo(e,t){var n=Yn(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const to={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:uc,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>eo(e*100,t),r:eo,s:hc,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function no(e){return e}var ro=Array.prototype.map,io=["y","z","a","f","p","n","Âĩ","m","","k","M","G","T","P","E","Z","Y"];function pc(e){var t=e.grouping===void 0||e.thousands===void 0?no:fc(ro.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?no:cc(ro.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",a=e.nan===void 0?"NaN":e.nan+"";function u(c){c=Qn(c);var g=c.fill,d=c.align,p=c.sign,m=c.symbol,_=c.zero,b=c.width,v=c.comma,$=c.precision,A=c.trim,k=c.type;k==="n"?(v=!0,k="g"):to[k]||($===void 0&&($=12),A=!0,k="g"),(_||g==="0"&&d==="=")&&(_=!0,g="0",d="=");var E=m==="$"?n:m==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():"",y=m==="$"?r:/[%p]/.test(k)?l:"",C=to[k],S=/[defgprs%]/.test(k);$=$===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,$)):Math.max(0,Math.min(20,$));function M(F){var I=E,D=y,j,le,Z;if(k==="c")D=C(F)+D,F="";else{F=+F;var be=F<0||1/F<0;if(F=isNaN(F)?a:C(Math.abs(F),$),A&&(F=gc(F)),be&&+F==0&&p!=="+"&&(be=!1),I=(be?p==="("?p:s:p==="-"||p==="("?"":p)+I,D=(k==="s"?io[8+_s/3]:"")+D+(be&&p==="("?")":""),S){for(j=-1,le=F.length;++jZ||Z>57){D=(Z===46?i+F.slice(j+1):F.slice(j))+D,F=F.slice(0,j);break}}}v&&!_&&(F=t(F,1/0));var ye=I.length+F.length+D.length,he=ye>1)+I+F+D+he.slice(ye);break;default:F=he+I+F+D;break}return o(F)}return M.toString=function(){return c+""},M}function f(c,g){var d=u((c=Qn(c),c.type="f",c)),p=Math.max(-8,Math.min(8,Math.floor(jt(g)/3)))*3,m=Math.pow(10,-p),_=io[8+p/3];return function(b){return d(m*b)+_}}return{format:u,formatPrefix:f}}var kn,At,vs;mc({thousands:",",grouping:[3],currency:["$",""]});function mc(e){return kn=pc(e),At=kn.format,vs=kn.formatPrefix,kn}function _c(e){return Math.max(0,-jt(Math.abs(e)))}function vc(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jt(t)/3)))*3-jt(Math.abs(e)))}function wc(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jt(t)-jt(e))+1}function bi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const oo=Symbol("implicit");function dr(){var e=new Ki,t=[],n=[],r=oo;function i(o){let l=e.get(o);if(l===void 0){if(r!==oo)return r;e.set(o,l=t.push(o)-1)}return n[l%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Ki;for(const l of o)e.has(l)||e.set(l,t.push(l)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return dr(t,n).unknown(r)},bi.apply(i,arguments),i}function yi(){var e=dr().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,l,s=!1,a=0,u=0,f=.5;delete e.unknown;function c(){var g=t().length,d=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$n(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$n(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yc.exec(e))?new Ne(t[1],t[2],t[3],1):(t=Sc.exec(e))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cc.exec(e))?$n(t[1],t[2],t[3],t[4]):(t=kc.exec(e))?$n(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$c.exec(e))?go(t[1],t[2]/100,t[3]/100,1):(t=Rc.exec(e))?go(t[1],t[2]/100,t[3]/100,t[4]):lo.hasOwnProperty(e)?uo(lo[e]):e==="transparent"?new Ne(NaN,NaN,NaN,0):null}function uo(e){return new Ne(e>>16&255,e>>8&255,e&255,1)}function $n(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ne(e,t,n,r)}function Mc(e){return e instanceof vn||(e=pn(e)),e?(e=e.rgb(),new Ne(e.r,e.g,e.b,e.opacity)):new Ne}function Kr(e,t,n,r){return arguments.length===1?Mc(e):new Ne(e,t,n,r??1)}function Ne(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Si(Ne,Kr,ws(vn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gn:Math.pow(gn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ne(St(this.r),St(this.g),St(this.b),Jn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:fo,formatHex:fo,formatHex8:Fc,formatRgb:co,toString:co}));function fo(){return`#${bt(this.r)}${bt(this.g)}${bt(this.b)}`}function Fc(){return`#${bt(this.r)}${bt(this.g)}${bt(this.b)}${bt((isNaN(this.opacity)?1:this.opacity)*255)}`}function co(){const e=Jn(this.opacity);return`${e===1?"rgb(":"rgba("}${St(this.r)}, ${St(this.g)}, ${St(this.b)}${e===1?")":`, ${e})`}`}function Jn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function St(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bt(e){return e=St(e),(e<16?"0":"")+e.toString(16)}function go(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new je(e,t,n,r)}function bs(e){if(e instanceof je)return new je(e.h,e.s,e.l,e.opacity);if(e instanceof vn||(e=pn(e)),!e)return new je;if(e instanceof je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,s=o-i,a=(o+i)/2;return s?(t===o?l=(n-r)/s+(n0&&a<1?0:l,new je(l,s,a,e.opacity)}function Ic(e,t,n,r){return arguments.length===1?bs(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Si(je,Ic,ws(vn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gn:Math.pow(gn,e),new je(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ne(kr(e>=240?e-240:e+120,i,r),kr(e,i,r),kr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new je(ho(this.h),Rn(this.s),Rn(this.l),Jn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Jn(this.opacity);return`${e===1?"hsl(":"hsla("}${ho(this.h)}, ${Rn(this.s)*100}%, ${Rn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ho(e){return e=(e||0)%360,e<0?e+360:e}function Rn(e){return Math.max(0,Math.min(1,e||0))}function kr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ci=e=>()=>e;function Dc(e,t){return function(n){return e+n*t}}function xc(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Pc(e){return(e=+e)==1?ys:function(t,n){return n-t?xc(t,n,e):Ci(isNaN(t)?n:t)}}function ys(e,t){var n=t-e;return n?Dc(e,n):Ci(isNaN(e)?t:e)}const po=function e(t){var n=Pc(t);function r(i,o){var l=n((i=Kr(i)).r,(o=Kr(o)).r),s=n(i.g,o.g),a=n(i.b,o.b),u=ys(i.opacity,o.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=a(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function Nc(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),s[l]?s[l]+=o:s[++l]=o),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,a.push({i:l,x:Zn(r,i)})),n=$r.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Wc(e,t,n){var r=e[0],i=e[1],o=t[0],l=t[1];return i2?Xc:Wc,a=u=null,c}function c(g){return g==null||isNaN(g=+g)?o:(a||(a=s(e.map(r),t,n)))(r(l(g)))}return c.invert=function(g){return l(i((u||(u=s(t,e.map(r),Zn)))(g)))},c.domain=function(g){return arguments.length?(e=Array.from(g,jc),f()):e.slice()},c.range=function(g){return arguments.length?(t=Array.from(g),f()):t.slice()},c.rangeRound=function(g){return t=Array.from(g),n=Gc,f()},c.clamp=function(g){return arguments.length?(l=g?!0:Pt,f()):l!==Pt},c.interpolate=function(g){return arguments.length?(n=g,f()):n},c.unknown=function(g){return arguments.length?(o=g,c):o},function(g,d){return r=g,i=d,f()}}function Kc(){return Qc()(Pt,Pt)}function Jc(e,t,n,r){var i=ic(e,t,n),o;switch(r=Qn(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=vc(i,l))&&(r.precision=o),vs(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=wc(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=_c(i))&&(r.precision=o-(r.type==="%")*2);break}}return At(r)}function Zc(e){var t=e.domain;return e.ticks=function(n){var r=t();return hs(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Jc(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,l=r[i],s=r[o],a,u,f=10;for(s0;){if(u=Bt(l,s,n),u===a)return r[i]=l,r[o]=s,t(r);if(u>0)l=Math.floor(l/u)*u,s=Math.ceil(s/u)*u;else if(u<0)l=Math.ceil(l*u)/u,s=Math.floor(s*u)/u;else break;a=u}return e},e}function We(){var e=Kc();return e.copy=function(){return Yc(e,We())},bi.apply(e,arguments),Zc(e)}function An(e){return function(){return e}}function ed(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ei(e,t){if((l=e.length)>1)for(var n=1,r,i,o=e[t[0]],l,s=o.length;n=0;)n[t]=t;return n}function td(e,t){return e[t]}function nd(e){const t=[];return t.key=e,t}function rd(){var e=An([]),t=ti,n=ei,r=td;function i(o){var l=Array.from(e.apply(this,arguments),nd),s,a=l.length,u=-1,f;for(const c of o)for(s=0,++u;sFeedback Distribution

",n=P(),r=R("div"),i=U("svg");for(let a=0;ae[19].call(r))},m(a,u){V(a,t,u),V(a,n,u),V(a,r,u),w(r,i);for(let f=0;fn(15,c=C)),ie(e,Ni,C=>n(4,g=C)),ie(e,qe,C=>n(16,d=C));let p=300,m=300;const _={up:2,down:1,"n/a":0,all:"all"},b={top:10,bottom:10,left:25,right:5},v=dr().range(["var(--yellow)","var(--red)","var(--green)"]),$=At(".0%");function A(C,S){r===C?n(5,r="all"):n(5,r=C),Ue(et,c=r==="all"?"all":S,c)}const k=(C,S)=>A(C,S.key),E=(C,S)=>A(C,S.key);function y(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,r=_[c]),e.$$.dirty&2&&n(3,i=m-b.left-b.right),e.$$.dirty&1&&n(14,o=p-b.top-b.bottom),e.$$.dirty&65552&&d.forEach(C=>{Ue(Ni,g[C.vote_status]++,g)}),e.$$.dirty&16&&n(2,l=g.up+g.down+g["n/a"]),e.$$.dirty&16384&&n(8,s=yi().rangeRound([b.top,o-b.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=We().rangeRound([b.left,i-b.right]).domain([0,l])),e.$$.dirty&8208&&n(6,f=u([g]))},n(13,u=rd().keys(["n/a","down","up"]).order(ti).offset(ei)),[p,m,l,i,g,r,f,a,s,b,v,$,A,u,o,c,d,k,E,y]}class ld extends ge{constructor(t){super(),me(this,t,od,id,de,{})}}function sd(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[3][e[2]]+"",d,p;return{c(){t=R("div"),n=R("div"),r=z("Q: "),i=z(e[0]),o=P(),l=R("div"),s=z("A: "),a=z(e[1]),u=P(),f=R("div"),c=z("Rating: "),d=z(g),h(n,"class","question svelte-szi0e"),h(l,"class","answer svelte-szi0e"),h(f,"class",p="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(m,_){V(m,t,_),w(t,n),w(n,r),w(n,i),w(t,o),w(t,l),w(l,s),w(l,a),w(t,u),w(t,f),w(f,c),w(f,d)},p(m,[_]){_&1&&J(i,m[0]),_&2&&J(a,m[1]),_&4&&g!==(g=m[3][m[2]]+"")&&J(d,g),_&4&&p!==(p="feedback "+m[2]+" svelte-szi0e")&&h(f,"class",p)},i:X,o:X,d(m){m&&N(t)}}}function ad(e,t,n){let{question:r="What is gradient descent?"}=t,{answer:i="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:o="Good: 👍"}=t;const l={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=s=>{"question"in s&&n(0,r=s.question),"answer"in s&&n(1,i=s.answer),"feedback"in s&&n(2,o=s.feedback)},[r,i,o,l]}class ud extends ge{constructor(t){super(),me(this,t,ad,sd,de,{question:0,answer:1,feedback:2})}}function yo(e,t,n){const r=e.slice();return r[5]=t[n].question,r[6]=t[n].answer,r[7]=t[n].vote_status,r}function So(e){let t,n,r,i,o;return n=new ud({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=R("div"),ce(n.$$.fragment),r=P()},m(l,s){V(l,t,s),ae(n,t,null),w(t,r),o=!0},p(l,s){const a={};s&1&&(a.question=l[5]),s&1&&(a.answer=l[6]),s&1&&(a.feedback=l[7]),n.$set(a)},i(l){o||(T(n.$$.fragment,l),l&&Re(()=>{o&&(i||(i=dt(t,e[1],{duration:300},!0)),i.run(1))}),o=!0)},o(l){L(n.$$.fragment,l),l&&(i||(i=dt(t,e[1],{duration:300},!1)),i.run(0)),o=!1},d(l){l&&N(t),ue(n),l&&i&&i.end()}}}function fd(e){let t,n,r=e[0],i=[];for(let l=0;lL(i[l],1,1,()=>{i[l]=null});return{c(){t=R("div");for(let l=0;ln(4,i=a)),ie(e,et,a=>n(2,o=a)),ie(e,qe,a=>n(3,l=a));const s=(a,{delay:u=0,duration:f=1e3,easing:c=pi})=>Yr(a,{delay:u,duration:f,easing:c});return e.$$.update=()=>{e.$$.dirty&12&&n(0,r=o==="all"?l:l.filter(a=>a.vote_status===o)),e.$$.dirty&1&&Ue(Ur,i=bf(r),i)},[r,s,o,l]}class dd extends ge{constructor(t){super(),me(this,t,cd,fd,de,{})}}function Co(e,t,n){const r=e.slice();return r[13]=t[n],r}function ko(e,t,n){const r=e.slice();return r[16]=t[n],r}function $o(e,t,n){const r=e.slice();return r[16]=t[n],r}function Ro(e){let t,n,r,i,o=e[16]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-1oikip4"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[10].bottom+a[10].top)&&h(n,"y2",r),u&16&&o!==(o=a[16]+"")&&J(l,o),u&84&&s!==(s=`translate(${a[6](a[16])+a[6].bandwidth()/2} ${a[2]-a[10].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function Ao(e){let t,n,r,i;return{c(){t=U("g"),n=U("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",r=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",i=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(o,l){V(o,t,l),w(t,n)},p(o,l){l&8&&r!==(r=o[3]-o[10].right-o[10].left)&&h(n,"x2",r),l&32&&i!==(i=`translate(${o[10].left} ${o[5](o[16])+0})`)&&h(t,"transform",i)},d(o){o&&N(t)}}}function Eo(e){let t,n,r,i,o,l,s,a,u=Math.round(e[11](e[13].count))+"",f,c,g;return{c(){t=U("g"),n=U("rect"),a=U("text"),f=z(u),h(n,"x",r=e[6](e[13].question)),h(n,"y",i=e[5](e[13].count)),h(n,"height",o=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",l=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",s=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(a,"class","axis-text svelte-1oikip4"),h(a,"x",c=e[6](e[13].question)+e[6].bandwidth()/2),h(a,"y",g=e[5](e[13].count)-5),h(a,"text-anchor","middle"),h(t,"class","series")},m(d,p){V(d,t,p),w(t,n),w(t,a),w(a,f)},p(d,p){p&80&&r!==(r=d[6](d[13].question))&&h(n,"x",r),p&48&&i!==(i=d[5](d[13].count))&&h(n,"y",i),p&52&&o!==(o=d[2]-d[5](d[13].count)-d[10].bottom)&&h(n,"height",o),p&128&&l!==(l=d[9][d[7]])&&h(n,"fill",l),p&64&&s!==(s=d[6].bandwidth())&&h(n,"width",s),p&16&&u!==(u=Math.round(d[11](d[13].count))+"")&&J(f,u),p&80&&c!==(c=d[6](d[13].question)+d[6].bandwidth()/2)&&h(a,"x",c),p&48&&g!==(g=d[5](d[13].count)-5)&&h(a,"y",g)},d(d){d&&N(t)}}}function gd(e){let t,n,r,i,o,l,s=e[8][e[7]]+"",a,u,f,c,g,d,p,m,_,b=e[4].map(Mo),v=[];for(let y=0;ye[12].call(t))},m(y,C){V(y,t,C),w(t,n);for(let S=0;Se.question;function hd(e,t,n){let r,i,o,l,s,a;ie(e,Ur,_=>n(4,s=_)),ie(e,et,_=>n(7,a=_));const u={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},f={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let c=300,g=300,d={top:35,bottom:10,left:25,right:5};const p=At(".1f");function m(){g=this.offsetWidth,c=this.offsetHeight,n(1,g),n(0,c)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,r=g-d.left-d.right),e.$$.dirty&1&&n(2,i=c-d.top-d.bottom),e.$$.dirty&24&&n(6,o=yi().rangeRound([d.left,r-d.right]).padding(.05).domain(s.map(_=>_.question))),e.$$.dirty&20&&n(5,l=We().rangeRound([i-d.bottom,d.top]).domain([0,kt(s,_=>_.count)])),e.$$.dirty&16&&console.log(s)},[c,g,i,r,s,l,o,a,u,f,d,p,m]}class pd extends ge{constructor(t){super(),me(this,t,hd,gd,de,{})}}function Fo(e,t,n){const r=e.slice();r[19]=t[n];const i=r[7](r[19].x1)-r[7](r[19].x0);return r[20]=i,r}function Io(e,t,n){const r=e.slice();return r[23]=t[n],r}function Do(e){let t,n,r,i,o=e[23]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[23]+"")&&J(l,o),u&132&&s!==(s=`translate(${a[7](a[23])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function xo(e){let t,n,r,i,o,l,s;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[19].x0)+1),h(n,"width",i=e[20]),h(n,"y",o=e[6](e[19].length)),h(n,"height",l=e[6](0)-e[6](e[19].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n)},p(a,u){u&136&&r!==(r=a[7](a[19].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[20])&&h(n,"width",i),u&72&&o!==(o=a[6](a[19].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[19].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&N(t)}}}function md(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[7].ticks(),d=[];for(let _=0;_e[14].call(t))},m(_,b){V(_,t,b),w(t,n);for(let v=0;vn(5,c=$)),ie(e,qe,$=>n(13,g=$));const d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let p=300,m=300,_={top:15,bottom:10,left:25,right:5};At(".1f");let b=Array.from({length:Po},($,A)=>A);function v(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,r=c==="all"?g:g.filter($=>$.vote_status===c)),e.$$.dirty&4096&&n(11,i=fs(r)),e.$$.dirty&2&&n(4,o=m-_.left-_.right),e.$$.dirty&1&&n(2,l=p-_.top-_.bottom),e.$$.dirty&2048&&n(3,s=ps().thresholds(b).value($=>$.answer)(i)),e.$$.dirty&16&&n(7,a=We().domain([3,Po]).range([_.left,o-_.right])),e.$$.dirty&12&&n(6,u=We().domain([0,kt(s,$=>$.length)]).range([l-_.bottom,_.top])),e.$$.dirty&2048&&n(10,f=kt(i,$=>$.length)),e.$$.dirty&1056&&We().domain([0,f]).range(["white",d[c]]).interpolate(gr)},[p,m,l,s,o,c,u,a,d,_,f,i,r,g,v]}class vd extends ge{constructor(t){super(),me(this,t,_d,md,de,{})}}function No(e,t,n){const r=e.slice();r[18]=t[n];const i=r[7](r[18].x1)-r[7](r[18].x0);return r[19]=i,r}function Oo(e,t,n){const r=e.slice();return r[22]=t[n],r}function To(e){let t,n,r,i,o=e[22]+"",l,s;return{c(){t=U("g"),n=U("line"),i=U("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n),w(t,i),w(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[22]+"")&&J(l,o),u&132&&s!==(s=`translate(${a[7](a[22])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&N(t)}}}function Vo(e){let t,n,r,i,o,l,s;return{c(){t=U("g"),n=U("rect"),h(n,"x",r=e[7](e[18].x0)+1),h(n,"width",i=e[19]),h(n,"y",o=e[6](e[18].length)),h(n,"height",l=e[6](0)-e[6](e[18].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){V(a,t,u),w(t,n)},p(a,u){u&136&&r!==(r=a[7](a[18].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[19])&&h(n,"width",i),u&72&&o!==(o=a[6](a[18].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[18].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&N(t)}}}function wd(e){let t,n,r,i,o,l,s,a,u,f,c,g=e[7].ticks(),d=[];for(let _=0;_e[13].call(t))},m(_,b){V(_,t,b),w(t,n);for(let v=0;vn(5,f=v)),ie(e,qe,v=>n(12,c=v));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let d=300,p=300,m={top:15,bottom:10,left:25,right:5},_=Array.from({length:zo},(v,$)=>$);dr().range(["var(--yellow)","var(--red)","var(--green)"]);function b(){p=this.offsetWidth,d=this.offsetHeight,n(1,p),n(0,d)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,r=f==="all"?c:c.filter(v=>v.vote_status===f)),e.$$.dirty&2048&&n(10,i=fs(r)),e.$$.dirty&2&&n(4,o=p-m.left-m.right),e.$$.dirty&1&&n(2,l=d-m.top-m.bottom),e.$$.dirty&1024&&n(3,s=ps().thresholds(_).value(v=>v.question)(i)),e.$$.dirty&16&&n(7,a=We().domain([3,zo]).range([m.left,o-m.right])),e.$$.dirty&12&&n(6,u=We().domain([0,kt(s,v=>v.length)]).range([l-m.bottom,m.top])),e.$$.dirty&1024&&kt(i,v=>v.length)},[d,p,l,s,o,f,u,a,g,m,i,r,c,b]}class yd extends ge{constructor(t){super(),me(this,t,bd,wd,de,{})}}function Sd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p=Math.round(e[5](e[3]))+"",m,_,b,v,$,A,k,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=P(),o=R("select"),l=R("option"),l.textContent="All",s=R("option"),s.textContent="Good",a=R("option"),a.textContent="Bad",u=R("option"),u.textContent="N/A",f=P(),c=R("div"),g=U("svg"),d=U("text"),m=z(p),$=P(),A=R("p"),A.textContent="number of responses",h(r,"class","card-text svelte-1pknxov"),l.__value="all",l.value=l.__value,h(l,"class","svelte-1pknxov"),s.__value="up",s.value=s.__value,h(s,"class","svelte-1pknxov"),a.__value="down",a.value=a.__value,h(a,"class","svelte-1pknxov"),u.__value="n/a",u.value=u.__value,h(u,"class","svelte-1pknxov"),h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Ee(o,"background",e[6][e[0]]),h(o,"class","svelte-1pknxov"),e[0]===void 0&&Re(()=>e[9].call(o)),h(n,"class","svelte-1pknxov"),h(d,"dominant-baseline","middle"),h(d,"x",_=e[2]/2),h(d,"y",b=e[1]/2),h(d,"text-anchor","middle"),h(d,"class","svelte-1pknxov"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-1pknxov"),h(c,"class","svelte-1pknxov"),Re(()=>e[10].call(c)),h(A,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Ee(t,"background",e[6][e[0]])},m(y,C){V(y,t,C),w(t,n),w(n,r),w(n,i),w(n,o),w(o,l),w(o,s),w(o,a),w(o,u),Gn(o,e[0],!0),w(t,f),w(t,c),w(c,g),w(g,d),w(d,m),v=Rt(c,e[10].bind(c)),w(t,$),w(t,A),k||(E=K(o,"change",e[9]),k=!0)},p(y,[C]){C&1&&Ee(o,"background",y[6][y[0]]),C&1&&Gn(o,y[0]),C&8&&p!==(p=Math.round(y[5](y[3]))+"")&&J(m,p),C&4&&_!==(_=y[2]/2)&&h(d,"x",_),C&2&&b!==(b=y[1]/2)&&h(d,"y",b),C&4&&h(g,"width",y[2]),C&2&&h(g,"height",y[1]),C&1&&Ee(t,"background",y[6][y[0]])},i:X,o:X,d(y){y&&N(t),v(),k=!1,E()}}}function Cd(e,t){return t==="all"?e.length:e.filter(r=>r.vote_status===t).length}function kd(e,t,n){let r,i,o,l;ie(e,et,p=>n(0,i=p)),ie(e,qe,p=>n(8,o=p));let s,a,u=mi(0);ie(e,u,p=>n(3,l=p));const f=At(".1f"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){i=Wl(this),et.set(i)}function d(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=Cd(o,i)),e.$$.dirty&128&&console.log("fbc",r),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,g,d]}class $d extends ge{constructor(t){super(),me(this,t,kd,Sd,de,{})}}function Rd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p=e[5](e[3])+"",m,_,b,v,$,A,k,E;return{c(){t=R("div"),n=R("div"),r=R("p"),r.textContent="Questions",i=P(),o=R("select"),l=R("option"),l.textContent="All",s=R("option"),s.textContent="Good",a=R("option"),a.textContent="Bad",u=R("option"),u.textContent="N/A",f=P(),c=R("div"),g=U("svg"),d=U("text"),m=z(p),$=P(),A=R("p"),A.textContent="percentage of responses",h(r,"class","card-text svelte-mchgj2"),l.__value="all",l.value=l.__value,s.__value="up",s.value=s.__value,a.__value="down",a.value=a.__value,u.__value="n/a",u.value=u.__value,h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Ee(o,"background",e[6][e[0]]),h(o,"class","svelte-mchgj2"),e[0]===void 0&&Re(()=>e[9].call(o)),h(d,"dominant-baseline","middle"),h(d,"x",_=e[2]/2),h(d,"y",b=e[1]/2),h(d,"text-anchor","middle"),h(d,"class","svelte-mchgj2"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-mchgj2"),Re(()=>e[10].call(c)),h(A,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Ee(t,"background",e[6][e[0]])},m(y,C){V(y,t,C),w(t,n),w(n,r),w(n,i),w(n,o),w(o,l),w(o,s),w(o,a),w(o,u),Gn(o,e[0],!0),w(t,f),w(t,c),w(c,g),w(g,d),w(d,m),v=Rt(c,e[10].bind(c)),w(t,$),w(t,A),k||(E=K(o,"change",e[9]),k=!0)},p(y,[C]){C&1&&Ee(o,"background",y[6][y[0]]),C&1&&Gn(o,y[0]),C&8&&p!==(p=y[5](y[3])+"")&&J(m,p),C&4&&_!==(_=y[2]/2)&&h(d,"x",_),C&2&&b!==(b=y[1]/2)&&h(d,"y",b),C&4&&h(g,"width",y[2]),C&2&&h(g,"height",y[1]),C&1&&Ee(t,"background",y[6][y[0]])},i:X,o:X,d(y){y&&N(t),v(),k=!1,E()}}}function Ad(e,t){const n=e.length;return t==="all"?1:e.filter(i=>i.vote_status===t).length/n}function Ed(e,t,n){let r,i,o,l;ie(e,et,p=>n(0,i=p)),ie(e,qe,p=>n(8,o=p));let s,a,u=mi(0);ie(e,u,p=>n(3,l=p));const f=At(".1%"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){i=Wl(this),et.set(i)}function d(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=Ad(o,i)),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,g,d]}class Md extends ge{constructor(t){super(),me(this,t,Ed,Rd,de,{})}}function Fd(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p,m,_,b,v,$,A,k,E,y,C,S,M,F;return o=new $d({}),a=new Md({}),c=new ld({}),p=new pd({props:{feedback:"Bad"}}),b=new yd({}),A=new vd({}),M=new dd({}),{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),ce(o.$$.fragment),l=P(),s=R("div"),ce(a.$$.fragment),u=P(),f=R("div"),ce(c.$$.fragment),g=P(),d=R("div"),ce(p.$$.fragment),m=P(),_=R("div"),ce(b.$$.fragment),v=P(),$=R("div"),ce(A.$$.fragment),k=P(),E=R("div"),y=R("div"),y.innerHTML=`
-
`,C=P(),S=R("div"),ce(M.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(s,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(f,"class","left-confidence svelte-14znspc"),h(d,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h($,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(y,"class","right-chart svelte-14znspc"),h(S,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(I,D){V(I,t,D),w(t,n),w(n,r),w(r,i),ae(o,i,null),w(r,l),w(r,s),ae(a,s,null),w(n,u),w(n,f),ae(c,f,null),w(n,g),w(n,d),ae(p,d,null),w(n,m),w(n,_),ae(b,_,null),w(n,v),w(n,$),ae(A,$,null),w(t,k),w(t,E),w(E,y),w(E,C),w(E,S),ae(M,S,null),F=!0},p:X,i(I){F||(T(o.$$.fragment,I),T(a.$$.fragment,I),T(c.$$.fragment,I),T(p.$$.fragment,I),T(b.$$.fragment,I),T(A.$$.fragment,I),T(M.$$.fragment,I),F=!0)},o(I){L(o.$$.fragment,I),L(a.$$.fragment,I),L(c.$$.fragment,I),L(p.$$.fragment,I),L(b.$$.fragment,I),L(A.$$.fragment,I),L(M.$$.fragment,I),F=!1},d(I){I&&N(t),ue(o),ue(a),ue(c),ue(p),ue(b),ue(A),ue(M)}}}function Id(e,t,n){let r;ie(e,qe,o=>n(0,r=o)),Xt(()=>{i()});async function i(){const a=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[3]}));Ue(qe,r=[...a],r)}return[]}class Dd extends ge{constructor(t){super(),me(this,t,Id,Fd,de,{})}}/**! - * Sortable 1.15.0 - * @author RubaXa - * @author owenm - * @license MIT - */function Ho(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tt(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function Nd(e,t){if(e==null)return{};var n=Pd(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Od="1.15.0";function it(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var at=it(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),wn=it(/Edge/i),Lo=it(/firefox/i),an=it(/safari/i)&&!it(/chrome/i)&&!it(/android/i),Ss=it(/iP(ad|od|hone)/i),Cs=it(/chrome/i)&&it(/android/i),ks={capture:!1,passive:!1};function re(e,t,n){e.addEventListener(t,n,!at&&ks)}function ee(e,t,n){e.removeEventListener(t,n,!at&&ks)}function er(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Td(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Qe(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&er(e,t):er(e,t))||r&&e===n)return e;if(e===n)break}while(e=Td(e))}return null}var qo=/\s+/g;function Te(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(qo," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(qo," ")}}function G(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function Ht(e,t){var n="";if(typeof e=="string")n=e;else do{var r=G(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function $s(e,t,n){if(e){var r=e.getElementsByTagName(t),i=0,o=r.length;if(n)for(;i=o:l=i<=o,!l)return r;if(r===Ze())break;r=ht(r,!1)}return!1}function Ut(e,t,n,r){for(var i=0,o=0,l=e.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=Nd(r,jd);bn.pluginEvent.bind(q)(t,n,tt({dragEl:x,parentEl:fe,ghostEl:W,rootEl:oe,nextEl:wt,lastDownEl:Tn,cloneEl:se,cloneHidden:ct,dragStarted:tn,putSortable:Ce,activeSortable:q.active,originalEvent:i,oldIndex:Nt,oldDraggableIndex:fn,newIndex:Ve,newDraggableIndex:ft,hideGhostForTarget:Ds,unhideGhostForTarget:xs,cloneNowHidden:function(){ct=!0},cloneNowShown:function(){ct=!1},dispatchSortableEvent:function(s){Fe({sortable:n,name:s,originalEvent:i})}},o))};function Fe(e){Bd(tt({putSortable:Ce,cloneEl:se,targetEl:x,rootEl:oe,oldIndex:Nt,oldDraggableIndex:fn,newIndex:Ve,newDraggableIndex:ft},e))}var x,fe,W,oe,wt,Tn,se,ct,Nt,Ve,fn,ft,En,Ce,xt=!1,tr=!1,nr=[],_t,Be,Er,Mr,jo,Uo,tn,It,cn,dn=!1,Mn=!1,Vn,Ae,Fr=[],ni=!1,rr=[],hr=typeof document<"u",Fn=Ss,Wo=wn||at?"cssFloat":"float",Ud=hr&&!Cs&&!Ss&&"draggable"in document.createElement("div"),Ms=function(){if(hr){if(at)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Fs=function(t,n){var r=G(t),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Ut(t,0,n),l=Ut(t,1,n),s=o&&G(o),a=l&&G(l),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ve(o).width,f=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ve(l).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return l&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return o&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&r[Wo]==="none"||l&&r[Wo]==="none"&&u+f>i)?"vertical":"horizontal"},Wd=function(t,n,r){var i=r?t.left:t.top,o=r?t.right:t.bottom,l=r?t.width:t.height,s=r?n.left:n.top,a=r?n.right:n.bottom,u=r?n.width:n.height;return i===s||o===a||i+l/2===s+u/2},Xd=function(t,n){var r;return nr.some(function(i){var o=i[ze].options.emptyInsertThreshold;if(!(!o||ki(i))){var l=ve(i),s=t>=l.left-o&&t<=l.right+o,a=n>=l.top-o&&n<=l.bottom+o;if(s&&a)return r=i}}),r},Is=function(t){function n(o,l){return function(s,a,u,f){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(o==null&&(l||c))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return n(o(s,a,u,f),l)(s,a,u,f);var g=(l?s:a).options.group.name;return o===!0||typeof o=="string"&&o===g||o.join&&o.indexOf(g)>-1}}var r={},i=t.group;(!i||On(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=n(i.pull,!0),r.checkPut=n(i.put),r.revertClone=i.revertClone,t.group=r},Ds=function(){!Ms&&W&&G(W,"display","none")},xs=function(){!Ms&&W&&G(W,"display","")};hr&&!Cs&&document.addEventListener("click",function(e){if(tr)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),tr=!1,!1},!0);var vt=function(t){if(x){t=t.touches?t.touches[0]:t;var n=Xd(t.clientX,t.clientY);if(n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[ze]._onDragOver(r)}}},Yd=function(t){x&&x.parentNode[ze]._isOutsideThisEl(t.target)};function q(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=st({},t),e[ze]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fs(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,s){l.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:q.supportPointer!==!1&&"PointerEvent"in window&&!an,emptyInsertThreshold:5};bn.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);Is(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:Ud,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?re(e,"pointerdown",this._onTapStart):(re(e,"mousedown",this._onTapStart),re(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(re(e,"dragover",this),re(e,"dragenter",this)),nr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),st(this,Ld())}q.prototype={constructor:q,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(It=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,x):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,i=this.options,o=i.preventOnFilter,l=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,f=i.filter;if(rg(r),!x&&!(/mousedown|pointerdown/.test(l)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&an&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=Qe(a,i.draggable,r,!1),!(a&&a.animated)&&Tn!==a)){if(Nt=Le(a),fn=Le(a,i.draggable),typeof f=="function"){if(f.call(this,t,a,this)){Fe({sortable:n,rootEl:u,name:"filter",targetEl:a,toEl:r,fromEl:r}),xe("filter",n,{evt:t}),o&&t.cancelable&&t.preventDefault();return}}else if(f&&(f=f.split(",").some(function(c){if(c=Qe(u,c.trim(),r,!1),c)return Fe({sortable:n,rootEl:c,name:"filter",targetEl:a,fromEl:r,toEl:r}),xe("filter",n,{evt:t}),!0}),f)){o&&t.cancelable&&t.preventDefault();return}i.handle&&!Qe(u,i.handle,r,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,n,r){var i=this,o=i.el,l=i.options,s=o.ownerDocument,a;if(r&&!x&&r.parentNode===o){var u=ve(r);if(oe=o,x=r,fe=x.parentNode,wt=x.nextSibling,Tn=r,En=l.group,q.dragged=x,_t={target:x,clientX:(n||t).clientX,clientY:(n||t).clientY},jo=_t.clientX-u.left,Uo=_t.clientY-u.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,x.style["will-change"]="all",a=function(){if(xe("delayEnded",i,{evt:t}),q.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Lo&&i.nativeDraggable&&(x.draggable=!0),i._triggerDragStart(t,n),Fe({sortable:i,name:"choose",originalEvent:t}),Te(x,l.chosenClass,!0)},l.ignore.split(",").forEach(function(f){$s(x,f.trim(),Ir)}),re(s,"dragover",vt),re(s,"mousemove",vt),re(s,"touchmove",vt),re(s,"mouseup",i._onDrop),re(s,"touchend",i._onDrop),re(s,"touchcancel",i._onDrop),Lo&&this.nativeDraggable&&(this.options.touchStartThreshold=4,x.draggable=!0),xe("delayStart",this,{evt:t}),l.delay&&(!l.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(wn||at))){if(q.eventCanceled){this._onDrop();return}re(s,"mouseup",i._disableDelayedDrag),re(s,"touchend",i._disableDelayedDrag),re(s,"touchcancel",i._disableDelayedDrag),re(s,"mousemove",i._delayedDragTouchMoveHandler),re(s,"touchmove",i._delayedDragTouchMoveHandler),l.supportPointer&&re(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,l.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){x&&Ir(x),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ee(t,"mouseup",this._disableDelayedDrag),ee(t,"touchend",this._disableDelayedDrag),ee(t,"touchcancel",this._disableDelayedDrag),ee(t,"mousemove",this._delayedDragTouchMoveHandler),ee(t,"touchmove",this._delayedDragTouchMoveHandler),ee(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?re(document,"pointermove",this._onTouchMove):n?re(document,"touchmove",this._onTouchMove):re(document,"mousemove",this._onTouchMove):(re(x,"dragend",this),re(oe,"dragstart",this._onDragStart));try{document.selection?zn(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(xt=!1,oe&&x){xe("dragStarted",this,{evt:n}),this.nativeDraggable&&re(document,"dragover",Yd);var r=this.options;!t&&Te(x,r.dragClass,!1),Te(x,r.ghostClass,!0),q.active=this,t&&this._appendGhost(),Fe({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Be){this._lastX=Be.clientX,this._lastY=Be.clientY,Ds();for(var t=document.elementFromPoint(Be.clientX,Be.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Be.clientX,Be.clientY),t!==n);)n=t;if(x.parentNode[ze]._isOutsideThisEl(t),n)do{if(n[ze]){var r=void 0;if(r=n[ze]._onDragOver({clientX:Be.clientX,clientY:Be.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);xs()}},_onTouchMove:function(t){if(_t){var n=this.options,r=n.fallbackTolerance,i=n.fallbackOffset,o=t.touches?t.touches[0]:t,l=W&&Ht(W,!0),s=W&&l&&l.a,a=W&&l&&l.d,u=Fn&&Ae&&Bo(Ae),f=(o.clientX-_t.clientX+i.x)/(s||1)+(u?u[0]-Fr[0]:0)/(s||1),c=(o.clientY-_t.clientY+i.y)/(a||1)+(u?u[1]-Fr[1]:0)/(a||1);if(!q.active&&!xt){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Fe({rootEl:fe,name:"add",toEl:fe,fromEl:oe,originalEvent:t}),Fe({sortable:this,name:"remove",toEl:fe,originalEvent:t}),Fe({rootEl:fe,name:"sort",toEl:fe,fromEl:oe,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:fe,originalEvent:t})),Ce&&Ce.save()):Ve!==Nt&&Ve>=0&&(Fe({sortable:this,name:"update",toEl:fe,originalEvent:t}),Fe({sortable:this,name:"sort",toEl:fe,originalEvent:t})),q.active&&((Ve==null||Ve===-1)&&(Ve=Nt,ft=fn),Fe({sortable:this,name:"end",toEl:fe,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){xe("nulling",this),oe=x=fe=W=wt=se=Tn=ct=_t=Be=tn=Ve=ft=Nt=fn=It=cn=Ce=En=q.dragged=q.ghost=q.clone=q.active=null,rr.forEach(function(t){t.checked=!0}),rr.length=Er=Mr=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":x&&(this._onDragOver(t),Qd(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,r=this.el.children,i=0,o=r.length,l=this.options;ir.right+i||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+i}function eg(e,t,n,r,i,o,l,s){var a=r?e.clientY:e.clientX,u=r?n.height:n.width,f=r?n.top:n.left,c=r?n.bottom:n.right,g=!1;if(!l){if(s&&Vnf+u*o/2:ac-Vn)return-cn}else if(a>f+u*(1-i)/2&&ac-u*o/2)?a>f+u/2?1:-1:0}function tg(e){return Le(x)C[24];for(let C=0;CE[21];for(let E=0;EQ & A Comparison Instructions -
-

Ask a question and rank the answers across the models. Drag each answer to - rank it, in ascending order, from left-to-right. Optionally, select the - rank for each via the corresponding dropdown.

-
- `,r=P(),i=R("div"),o=R("section"),l=R("div");for(let E=0;E{e.scrollIntoView({behavior:"smooth"})},0)}async function tl(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const r=await n.text();alert(r)}}function sg(e,t,n){let r,i,o;ie(e,yr,k=>n(7,o=k));let{numModels:l=1}=t,{models:s=[0]}=t,a="",u="",f=!1;Xt(async()=>{if(await new Promise(k=>setTimeout(k,200)),d){const k=new q(d,{animation:150,onUpdate(E){k.toArray()}});k.toArray()}});const c=async k=>{k.preventDefault(),a=u,n(3,u=""),n(4,f=!0);let E={question:a};for(let C of s)E[C]="Loading...";Ue(yr,o=[...o,E],o);const y=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(y.ok){const C=await y.json();n(1,s=Object.keys(C.answer)),n(0,l=s.length);for(let S of s)E[S]=C.answer[S];E.qid=C.qid,yr.update(S=>(S[S.length-1]=E,S))}else{const C=await y.text();alert(C)}n(4,f=!1)};let g=0;setInterval(()=>{n(11,g=(g+1)%4)},200);let d,p;function m(k,E){const y=E,S=Ct(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(D=>D.id);S.forEach((D,j)=>{Ct(`#${D}`).select(".answer-rank").property("value",j+1)});let M=[];for(let[D,j]of S.entries()){const le=parseInt(j.split("-")[1]),Z=s[le],be={rank:D,model:Z};M.push(be)}let F=o.filter(D=>D.qid===y),I=[];for(let D of M){const j={model:D.model,qid:parseInt(y),rank:parseInt(D.rank)+1,answer:F[0][D.model]};I.push(j)}tl(I)}function _(k,E,y){const C=E,S=parseInt(k.target.value),M=s[y],F={qid:C,rank:parseInt(S),model:M};let I=[],j=o.filter(Z=>Z.qid===F.qid)[0][F.model];const le={model:F.model,qid:parseInt(F.qid),rank:parseInt(F.rank),answer:j};I.push(le),tl(I)}const b=(k,E,y)=>_(y,k.qid,E),v=(k,E)=>m(E,k.qid);function $(k){Un[k?"unshift":"push"](()=>{d=k,n(2,d)})}function A(){u=this.value,n(3,u)}return e.$$set=k=>{"numModels"in k&&n(0,l=k.numModels),"models"in k&&n(1,s=k.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,r="1fr ".repeat(l).trim()),e.$$.dirty&2048&&n(5,i=".".repeat(g).padEnd(3)),e.$$.dirty&4100&&d&&(n(12,p=new q(d,{animation:150,dataIdAttr:"id",onUpdate(k){p.toArray()}})),p.toArray())},[l,s,d,u,f,i,r,o,c,m,_,g,p,b,v,$,A]}class ag extends ge{constructor(t){super(),me(this,t,sg,og,de,{numModels:0,models:1})}}function ug(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Ns(this.cover(t,n),t,n,e)}function Ns(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,l={data:r},s=e._x0,a=e._y0,u=e._x1,f=e._y1,c,g,d,p,m,_,b,v;if(!o)return e._root=l,e;for(;o.length;)if((m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(g=(a+f)/2))?a=g:f=g,i=o,!(o=o[b=_<<1|m]))return i[b]=l,e;if(d=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===d&&n===p)return l.next=o,i?i[b]=l:e._root=l,e;do i=i?i[b]=new Array(4):e._root=new Array(4),(m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(g=(a+f)/2))?a=g:f=g;while((b=_<<1|m)===(v=(p>=g)<<1|d>=c));return i[v]=o,i[b]=l,e}function fg(e){var t,n,r=e.length,i,o,l=new Array(r),s=new Array(r),a=1/0,u=1/0,f=-1/0,c=-1/0;for(n=0;nf&&(f=i),oc&&(c=o));if(a>f||u>c)return this;for(this.cover(a,u).cover(f,c),n=0;ne||e>=i||r>t||t>=o;)switch(u=(tf||(s=p.y0)>c||(a=p.x1)=b)<<1|e>=_)&&(p=g[g.length-1],g[g.length-1]=g[g.length-1-m],g[g.length-1-m]=p)}else{var v=e-+this._x.call(null,d.data),$=t-+this._y.call(null,d.data),A=v*v+$*$;if(A=(g=(l+a)/2))?l=g:a=g,(m=c>=(d=(s+u)/2))?s=d:u=d,t=n,!(n=n[_=m<<1|p]))return this;if(!n.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,b=_)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[_]=o:delete t[_],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=o,this)}function mg(e){for(var t=0,n=e.length;tg.index){var F=d-C.x-C.vx,I=p-C.y-C.vy,D=F*F+I*I;Dd+M||Ep+M||yu.r&&(u.r=u[f].r)}function a(){if(t){var u,f=t.length,c;for(n=new Array(f),u=0;u{}};function Ts(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ln.prototype=Ts.prototype={constructor:Ln,on:function(e,t){var n=this._,r=Mg(e+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&e._call.call(void 0,t),e=e._next;--Wt}function ol(){$t=(lr=mn.now())+pr,Wt=on=0;try{Dg()}finally{Wt=0,Pg(),$t=0}}function xg(){var e=mn.now(),t=e-lr;t>Vs&&(pr-=t,lr=e)}function Pg(){for(var e,t=or,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:or=n);ln=e,si(r)}function si(e){if(!Wt){on&&(on=clearTimeout(on));var t=e-$t;t>24?(e<1/0&&(on=setTimeout(ol,e-mn.now()-pr)),Jt&&(Jt=clearInterval(Jt))):(Jt||(lr=mn.now(),Jt=setInterval(xg,Vs)),Wt=1,zs(ol))}}const Ng=1664525,Og=1013904223,ll=4294967296;function Tg(){let e=1;return()=>(e=(Ng*e+Og)%ll)/ll}var Vg=10,zg=Math.PI*(3-Math.sqrt(5));function Hg(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,l=.6,s=new Map,a=Ls(c),u=Ts("tick","end"),f=Tg();e==null&&(e=[]);function c(){g(),u.call("tick",t),n1?(_==null?s.delete(m):s.set(m,p(_)),t):s.get(m)},find:function(m,_,b){var v=0,$=e.length,A,k,E,y,C;for(b==null?b=1/0:b*=b,v=0;v<$;++v)y=e[v],A=m-y.x,k=_-y.y,E=A*A+k*k,E1?(u.on(m,_),t):u.on(m)}}}function Lg(e){var t=Ke(.1),n,r,i;typeof e!="function"&&(e=Ke(e==null?0:+e));function o(s){for(var a=0,u=n.length,f;ae[4]?1:0),h(t,"class",d="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",p=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(v,$){V(v,t,$),w(t,n),w(t,o),w(o,s),w(o,a),w(a,f),m=!0,_||(b=[K(t,"mouseover",e[6]),K(t,"mouseout",e[7]),K(t,"focus",e[6]),K(t,"blur",e[7])],_=!0)},p(v,$){(!m||$&12&&r!==(r=v[3](v[20].size)))&&h(n,"r",r),(!m||$&4)&&l!==(l=v[20].file+"")&&J(s,l),(!m||$&4)&&u!==(u=Qr(v[20].size)+"")&&J(f,u),(!m||$&20&&c!==(c=v[20].size>v[4]?1:0))&&h(o,"opacity",c),(!m||$&20&&d!==(d="file-circle-g "+(v[20].size>v[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",d),(!m||$&4&&p!==(p=v[5](v[20].x,v[20].y)))&&h(t,"style",p)},i(v){m||(v&&Re(()=>{m&&(i||(i=dt(n,Cn,{duration:1e3},!0)),i.run(1))}),v&&Re(()=>{m&&(g||(g=dt(o,Cn,{duration:1e3},!0)),g.run(1))}),m=!0)},o(v){v&&(i||(i=dt(n,Cn,{duration:1e3},!1)),i.run(0)),v&&(g||(g=dt(o,Cn,{duration:1e3},!1)),g.run(0)),m=!1},d(v){v&&N(t),v&&i&&i.end(),v&&g&&g.end(),_=!1,we(b)}}}function Gg(e){let t,n,r,i,o=e[2],l=[];for(let a=0;aL(l[a],1,1,()=>{l[a]=null});return{c(){t=R("div"),n=U("svg");for(let a=0;ae[15].call(t))},m(a,u){V(a,t,u),w(t,n);for(let f=0;fn(14,f=k));let c=600,g=350,d=!0,p=!1;const m=(k,E)=>`transform: translate(${k}px, ${E}px)`,_=[-4,4],b=[-1,1];function v(){n(8,d=!0),n(9,p=!0);const k=Ct(this);Sr(".file-circle-g").select("text").style("opacity",0),k.raise(),k.select("circle").attr("fill","var(--red)"),k.select("text").style("opacity",1)}const $=()=>{const k=Sr(".file-circle-g");k.select("circle").attr("fill","var(--yellow)"),k.select("text").style("opacity",0),n(9,p=!1),setTimeout(()=>{n(8,d=!1)},1e3)};function A(){c=this.offsetWidth,g=this.offsetHeight,n(0,c),n(1,g)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,r=f.map(k=>({...k,x:c/2,y:g/2,tickCount:0}))),e.$$.dirty&16384&&console.log(f.map(k=>k.size).sort((k,E)=>k-E)),e.$$.dirty&1&&n(13,i=Lg().x(c/2)),e.$$.dirty&2&&n(12,o=qg().y(g/2)),e.$$.dirty&16384&&n(3,a=We().domain(sn(f,k=>k.size)).range([12,60])),e.$$.dirty&8&&n(10,l=Ag().radius(k=>a(k.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,s=sc(f.map(k=>k.size).sort((k,E)=>k-E),.85)),e.$$.dirty&1&&We().domain(_).range([5,c]),e.$$.dirty&2&&We().domain(b).range([g,5]),e.$$.dirty&4&&n(11,u=Hg().nodes(r).on("tick",()=>{n(2,r=[...r])})),e.$$.dirty&15360&&(u.force("x",i),u.force("y",o),u.force("collide",l),u.alpha(.02),u.restart()),e.$$.dirty&19468&&(a.domain(sn(f,k=>k.size)),r.forEach(k=>k.radius=a(k.size)),u.nodes(r),l.radius(k=>k.radius+.5)),e.$$.dirty&768&&d===!1&&(p||Sr(".large").select("text").style("opacity",1))},[c,g,r,a,s,m,v,$,d,p,l,u,o,i,f,A]}class jg extends ge{constructor(t){super(),me(this,t,Bg,Gg,de,{})}}/** - * table-core - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function pt(e,t){return typeof e=="function"?e(t):e}function Ge(e,t){return n=>{t.setState(r=>({...r,[e]:pt(n,r[e])}))}}function ar(e){return e instanceof Function}function Ug(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Wg(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const l=t(o);l!=null&&l.length&&r(l)})};return r(e),n}function B(e,t,n){let r=[],i;return()=>{let o;n.key&&n.debug&&(o=Date.now());const l=e();if(!(l.length!==r.length||l.some((u,f)=>r[f]!==u)))return i;r=l;let a;if(n.key&&n.debug&&(a=Date.now()),i=t(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-o)*100)/100,f=Math.round((Date.now()-a)*100)/100,c=f/16,g=(d,p)=>{for(d=String(d);d.length{let d=g;for(const m of a.split(".")){var p;d=(p=d)==null?void 0:p[m]}return d}:f=g=>g[s.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:f,parent:r,depth:n,columnDef:s,columns:[],getFlatColumns:B(()=>[!0],()=>{var g;return[c,...(g=c.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}}),getLeafColumns:B(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=c.columns)!=null&&d.length){let p=c.columns.flatMap(m=>m.getLeafColumns());return g(p)}return[c]},{key:"column.getLeafColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}})};return c=e._features.reduce((g,d)=>Object.assign(g,d.createColumn==null?void 0:d.createColumn(c,e)),c),c}function fl(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(o),l},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(l=>{Object.assign(o,l.createHeader==null?void 0:l.createHeader(o,e))}),o}const Yg={createTable:e=>({getHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,l;const s=(o=r==null?void 0:r.map(c=>n.find(g=>g.id===c)).filter(Boolean))!=null?o:[],a=(l=i==null?void 0:i.map(c=>n.find(g=>g.id===c)).filter(Boolean))!=null?l:[],u=n.filter(c=>!(r!=null&&r.includes(c.id))&&!(i!=null&&i.includes(c.id)));return Dn(t,[...s,...u,...a],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Dn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return Dn(t,o,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:B(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return Dn(t,o,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:B(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:B(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:B(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:B(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:B(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFlatHeaders:B(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFlatHeaders:B(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFlatHeaders:B(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterLeafHeaders:B(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:B(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:B(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:B(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,l,s,a,u;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(l=(s=n[0])==null?void 0:s.headers)!=null?l:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(f=>f.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}})})};function Dn(e,t,n,r){var i,o;let l=0;const s=function(g,d){d===void 0&&(d=1),l=Math.max(l,d),g.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&s(p.columns,d+1)},0)};s(e);let a=[];const u=(g,d)=>{const p={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},m=[];g.forEach(_=>{const b=[...m].reverse()[0],v=_.column.depth===p.depth;let $,A=!1;if(v&&_.column.parent?$=_.column.parent:($=_.column,A=!0),b&&(b==null?void 0:b.column)===$)b.subHeaders.push(_);else{const k=fl(n,$,{id:[r,d,$.id,_==null?void 0:_.id].filter(Boolean).join("_"),isPlaceholder:A,placeholderId:A?`${m.filter(E=>E.column===$).length}`:void 0,depth:d,index:m.length});k.subHeaders.push(_),m.push(k)}p.headers.push(_),_.headerGroup=p}),a.push(p),d>0&&u(m,d-1)},f=t.map((g,d)=>fl(n,g,{depth:l,index:d}));u(f,l-1),a.reverse();const c=g=>g.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,_=0,b=[0];p.subHeaders&&p.subHeaders.length?(b=[],c(p.subHeaders).forEach($=>{let{colSpan:A,rowSpan:k}=$;m+=A,b.push(k)})):m=1;const v=Math.min(...b);return _=_+v,p.colSpan=m,p.rowSpan=_,{colSpan:m,rowSpan:_}});return c((i=(o=a[0])==null?void 0:o.headers)!=null?i:[]),a}const xn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Nr=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Qg={getDefaultColumnDef:()=>xn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Nr(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Ge("columnSizing",e),onColumnSizingInfoChange:Ge("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:xn.minSize,(r=o??e.columnDef.size)!=null?r:xn.size),(i=e.columnDef.maxSize)!=null?i:xn.maxSize)},getStart:n=>{const r=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),i=r.findIndex(o=>o.id===e.id);if(i>0){const o=r[i-1];return o.getStart(n)+o.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},getCanResize:()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},getStart:()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),Or(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[n.id,n.getSize()]],s=Or(i)?Math.round(i.touches[0].clientX):i.clientX,a={},u=(m,_)=>{typeof _=="number"&&(t.setColumnSizingInfo(b=>{var v,$;const A=_-((v=b==null?void 0:b.startOffset)!=null?v:0),k=Math.max(A/(($=b==null?void 0:b.startSize)!=null?$:0),-.999999);return b.columnSizingStart.forEach(E=>{let[y,C]=E;a[y]=Math.round(Math.max(C+C*k,0)*100)/100}),{...b,deltaOffset:A,deltaPercentage:k}}),(t.options.columnResizeMode==="onChange"||m==="end")&&t.setColumnSizing(b=>({...b,...a})))},f=m=>u("move",m),c=m=>{u("end",m),t.setColumnSizingInfo(_=>({..._,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g={moveHandler:m=>f(m.clientX),upHandler:m=>{document.removeEventListener("mousemove",g.moveHandler),document.removeEventListener("mouseup",g.upHandler),c(m.clientX)}},d={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),f(m.touches[0].clientX),!1),upHandler:m=>{var _;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),c((_=m.touches[0])==null?void 0:_.clientX)}},p=Kg()?{passive:!1}:!1;Or(i)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",g.moveHandler,p),document.addEventListener("mouseup",g.upHandler,p)),t.setColumnSizingInfo(m=>({...m,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?Nr():(n=e.initialState.columnSizingInfo)!=null?n:Nr())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}})};let Pn=null;function Kg(){if(typeof Pn=="boolean")return Pn;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Pn=e,Pn}function Or(e){return e.type==="touchstart"}const Jg={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Ge("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const l=o.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let l={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=r,n=(i=n)!=null?i:!o,!o&&n)return{...l,[e.id]:!0};if(o&&!n){const{[e.id]:s,...a}=l;return a}return r})},getIsExpanded:()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},getCanExpand:()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},qs=(e,t,n)=>{var r,i,o;const l=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(i=r.toString())==null||(o=i.toLowerCase())==null)&&o.includes(l))};qs.autoRemove=e=>Xe(e);const Gs=(e,t,n)=>{var r,i;return!!(!((r=e.getValue(t))==null||(i=r.toString())==null)&&i.includes(n))};Gs.autoRemove=e=>Xe(e);const Bs=(e,t,n)=>{var r,i;return((r=e.getValue(t))==null||(i=r.toString())==null?void 0:i.toLowerCase())===(n==null?void 0:n.toLowerCase())};Bs.autoRemove=e=>Xe(e);const js=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};js.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Us=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});Us.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Ws=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});Ws.autoRemove=e=>Xe(e)||!(e!=null&&e.length);const Xs=(e,t,n)=>e.getValue(t)===n;Xs.autoRemove=e=>Xe(e);const Ys=(e,t,n)=>e.getValue(t)==n;Ys.autoRemove=e=>Xe(e);const Ei=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};Ei.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,l=n===null||Number.isNaN(i)?1/0:i;if(o>l){const s=o;o=l,l=s}return[o,l]};Ei.autoRemove=e=>Xe(e)||Xe(e[0])&&Xe(e[1]);const nt={includesString:qs,includesStringSensitive:Gs,equalsString:Bs,arrIncludes:js,arrIncludesAll:Us,arrIncludesSome:Ws,equals:Xs,weakEquals:Ys,inNumberRange:Ei};function Xe(e){return e==null||e===""}const Zg={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Ge("columnFilters",e),onGlobalFilterChange:Ge("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,r;const i=(n=e.getCoreRowModel().flatRows[0])==null||(r=n._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?nt.includesString:typeof r=="number"?nt.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?nt.equals:Array.isArray(r)?nt.arrIncludes:nt.weakEquals},getFilterFn:()=>{var n,r;return ar(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:nt[e.columnDef.filterFn]},getCanFilter:()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,r;return(n=t.getState().columnFilters)==null||(r=n.find(i=>i.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r==null?void 0:r.find(f=>f.id===e.id),l=pt(n,o?o.value:void 0);if(cl(i,l,e)){var s;return(s=r==null?void 0:r.filter(f=>f.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(o){var u;return(u=r==null?void 0:r.map(f=>f.id===e.id?a:f))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>nt.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:r}=e.options;return ar(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:nt[r]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=pt(t,i))==null?void 0:o.filter(l=>{const s=n.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(cl(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function cl(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const eh=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),th=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},nh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},rh=(e,t,n)=>{let r,i;return n.forEach(o=>{const l=o.getValue(e);l!=null&&(r===void 0?l>=l&&(r=i=l):(r>l&&(r=l),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},oh=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!Ug(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,l)=>o-l);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},lh=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),sh=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,ah=(e,t)=>t.length,Tr={sum:eh,min:th,max:nh,extent:rh,mean:ih,median:oh,unique:lh,uniqueCount:sh,count:ah},uh={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Ge("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,r,i,o;return(n=(r=(i=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?i:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},getIsGrouped:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Tr.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Tr.extent},getAggregationFn:()=>{var n,r;if(!e)throw new Error;return ar(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Tr[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,t)=>({getIsGrouped:()=>!!e.groupingColumnId,getGroupingValue:n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,r)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}})};function fh(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(l=>l.id===o)).filter(Boolean),...r]}const ch={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Ge("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},_getOrderColumnsFn:B(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const l=[...t],s=[...i];for(;s.length&&l.length;){const a=l.shift(),u=s.findIndex(f=>f.id===a);u>-1&&o.push(s.splice(u,1)[0])}o=[...o,...s]}return fh(o,n,r)},{key:!1})})},ai=0,ui=10,Vr=()=>({pageIndex:ai,pageSize:ui}),dh={getInitialState:e=>({...e,pagination:{...Vr(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Ge("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:r=>{const i=o=>pt(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},resetPagination:r=>{var i;e.setPagination(r?Vr():(i=e.initialState.pagination)!=null?i:Vr())},setPageIndex:r=>{e.setPagination(i=>{let o=pt(r,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,l)),{...i,pageIndex:o}})},resetPageIndex:r=>{var i,o,l;e.setPageIndex(r?ai:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageIndex)!=null?i:ai)},resetPageSize:r=>{var i,o,l;e.setPageSize(r?ui:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageSize)!=null?i:ui)},setPageSize:r=>{e.setPagination(i=>{const o=Math.max(1,pt(r,i.pageSize)),l=i.pageSize*i.pageIndex,s=Math.floor(l/o);return{...i,pageIndex:s,pageSize:o}})},setPageCount:r=>e.setPagination(i=>{var o;let l=pt(r,(o=e.options.pageCount)!=null?o:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),getPageOptions:B(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,l)=>l)),i},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},zr=()=>({left:[],right:[]}),gh={getInitialState:e=>({columnPinning:zr(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Ge("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,l;if(n==="right"){var s,a;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((a=i==null?void 0:i.right)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(n==="left"){var u,f;return{left:[...((u=i==null?void 0:i.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((f=i==null?void 0:i.right)!=null?f:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((o=i==null?void 0:i.left)!=null?o:[]).filter(c=>!(r!=null&&r.includes(c))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var i,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=t.options.enablePinning)!=null?o:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(s=>s.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(s=>r==null?void 0:r.includes(s)),l=n.some(s=>i==null?void 0:i.includes(s));return o?"left":l?"right":!1},getPinnedIndex:()=>{var n,r,i;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(i=r[o])==null?void 0:i.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(l=>!o.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:B(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,r;return e.setColumnPinning(t?zr():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:zr())},getIsSomeColumnsPinned:t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},getLeftLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:B(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},hh={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Ge("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{fi(i,o.id,r,e)}),i}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:B(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:B(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:B(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Hr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},getIsSomeRowsSelected:()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const r=e.getIsSelected();t.setRowSelection(i=>{if(n=typeof n<"u"?n:!r,r===n)return i;const o={...i};return fi(o,e.id,n,t),o})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Mi(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return dl(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return dl(e,n)==="all"},getCanSelect:()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},getCanSelectSubRows:()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},getCanMultiSelect:()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},getToggleSelectedHandler:()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}})},fi=(e,t,n,r)=>{var i;const o=r.getRow(t);n?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>fi(e,l.id,n,r))};function Hr(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(l,s){return l.map(a=>{var u;const f=Mi(a,n);if(f&&(r.push(a),i[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:o(a.subRows)}),f)return a}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function Mi(e,t){var n;return(n=t[e.id])!=null?n:!1}function dl(e,t,n){if(e.subRows&&e.subRows.length){let r=!0,i=!1;return e.subRows.forEach(o=>{i&&!r||(Mi(o,t)?i=!0:r=!1)}),r?"all":i?"some":!1}return!1}const ci=/([0-9]+)/gm,ph=(e,t,n)=>Qs(mt(e.getValue(n)).toLowerCase(),mt(t.getValue(n)).toLowerCase()),mh=(e,t,n)=>Qs(mt(e.getValue(n)),mt(t.getValue(n))),_h=(e,t,n)=>Fi(mt(e.getValue(n)).toLowerCase(),mt(t.getValue(n)).toLowerCase()),vh=(e,t,n)=>Fi(mt(e.getValue(n)),mt(t.getValue(n))),wh=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:rFi(e.getValue(n),t.getValue(n));function Fi(e,t){return e===t?0:e>t?1:-1}function mt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Qs(e,t){const n=e.split(ci).filter(Boolean),r=t.split(ci).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),l=parseInt(i,10),s=parseInt(o,10),a=[l,s].sort();if(isNaN(a[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return n.length-r.length}const Zt={alphanumeric:ph,alphanumericCaseSensitive:mh,text:_h,textCaseSensitive:vh,datetime:wh,basic:bh},yh={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Ge("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Zt.datetime;if(typeof o=="string"&&(r=!0,o.split(ci).length>1))return Zt.alphanumeric}return r?Zt.text:Zt.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,r;if(!e)throw new Error;return ar(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Zt[e.columnDef.sortingFn]},toggleSorting:(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(l=>{const s=l==null?void 0:l.find(d=>d.id===e.id),a=l==null?void 0:l.findIndex(d=>d.id===e.id);let u=[],f,c=o?n:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?s?f="toggle":f="add":l!=null&&l.length&&a!==l.length-1?f="replace":s?f="toggle":f="replace",f==="toggle"&&(o||i||(f="remove")),f==="add"){var g;u=[...l,{id:e.id,desc:c}],u.splice(0,u.length-((g=t.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=l.map(d=>d.id===e.id?{...d,desc:c}:d):f==="remove"?u=l.filter(d=>d.id!==e.id):u=[{id:e.id,desc:c}];return u})},getFirstSortDir:()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var r,i;const o=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":o},getCanSort:()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},getSortIndex:()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},Sh={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Ge("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,r;return(n=(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},getCanHide:()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:B(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:B(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,r)=>B(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),{key:n,debug:()=>{var i;return(i=e.options.debugAll)!=null?i:e.options.debugColumns}});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),resetColumnVisibility:n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},toggleAllColumnsVisible:n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}}},gl=[Yg,Sh,ch,gh,Zg,yh,uh,Jg,dh,hh,Qg];function Ch(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:gl};const r=n._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(n)),{}),i=f=>n.options.mergeOptions?n.options.mergeOptions(r,f):{...r,...f};let l={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(f=>{var c;l=(c=f.getInitialState==null?void 0:f.getInitialState(l))!=null?c:l});const s=[];let a=!1;const u={_features:gl,options:{...r,...e},initialState:l,_queue:f=>{s.push(f),a||(a=!0,Promise.resolve().then(()=>{for(;s.length;)s.shift()();a=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{n.setState(n.initialState)},setOptions:f=>{const c=pt(f,n.options);n.options=i(c)},getState:()=>n.options.state,setState:f=>{n.options.onStateChange==null||n.options.onStateChange(f)},_getRowId:(f,c,g)=>{var d;return(d=n.options.getRowId==null?void 0:n.options.getRowId(f,c,g))!=null?d:`${g?[g.id,c].join("."):c}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:f=>{const c=n.getRowModel().rowsById[f];if(!c)throw new Error;return c},_getDefaultColumnDef:B(()=>[n.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:g=>{const d=g.header.column.columnDef;return d.accessorKey?d.accessorKey:d.accessorFn?d.id:null},cell:g=>{var d,p;return(d=(p=g.renderValue())==null||p.toString==null?void 0:p.toString())!=null?d:null},...n._features.reduce((g,d)=>Object.assign(g,d.getDefaultColumnDef==null?void 0:d.getDefaultColumnDef()),{}),...f}},{debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:B(()=>[n._getColumnDefs()],f=>{const c=function(g,d,p){return p===void 0&&(p=0),g.map(m=>{const _=Xg(n,m,p,d),b=m;return _.columns=b.columns?c(b.columns,_,p+1):[],_})};return c(f)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllFlatColumns:B(()=>[n.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),_getAllFlatColumnsById:B(()=>[n.getAllFlatColumns()],f=>f.reduce((c,g)=>(c[g.id]=g,c),{}),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllLeafColumns:B(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(f,c)=>{let g=f.flatMap(d=>d.getLeafColumns());return c(g)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getColumn:f=>n._getAllFlatColumnsById()[f]};return Object.assign(n,u),n._features.forEach(f=>Object.assign(n,f.createTable==null?void 0:f.createTable(n))),n}function kh(e,t,n,r){const i=()=>{var l;return(l=o.getValue())!=null?l:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:B(()=>[e,n,t,o],(l,s,a,u)=>({table:l,column:s,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(o,l.createCell==null?void 0:l.createCell(o,n,t,e))},{}),o}const Ii=(e,t,n,r,i,o,l)=>{let s={id:t,index:r,original:n,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return s._valuesCache[a]=u.accessorFn(s.original,r),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=u.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=s.getValue(a))!=null?u:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>Wg(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId):void 0,getParentRows:()=>{let a=[],u=s;for(;;){const f=u.getParentRow();if(!f)break;a.push(f),u=f}return a.reverse()},getAllCells:B(()=>[e.getAllLeafColumns()],a=>a.map(u=>kh(e,s,u,u.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:B(()=>[s.getAllCells()],a=>a.reduce((u,f)=>(u[f.column.id]=f,u),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;atypeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function hl(){return e=>B(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,l){o===void 0&&(o=0);const s=[];for(let u=0;u{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Ks(e,t,n){return n.options.filterFromLeafRows?Rh(e,t,n):Ah(e,t,n)}function Rh(e,t,n){var r;const i=[],o={},l=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,s=function(a,u){u===void 0&&(u=0);const f=[];for(let g=0;gB(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let g=0;g{var d;const p=e.getColumn(g.id);if(!p)return;const m=p.getFilterFn();m&&i.push({id:g.id,filterFn:m,resolvedValue:(d=m.resolveFilterValue==null?void 0:m.resolveFilterValue(g.value))!=null?d:g.value})});const l=n.map(g=>g.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&s&&a.length&&(l.push("__global__"),a.forEach(g=>{var d;o.push({id:g.id,filterFn:s,resolvedValue:(d=s.resolveFilterValue==null?void 0:s.resolveFilterValue(r))!=null?d:r})}));let u,f;for(let g=0;g{d.columnFiltersMeta[m]=_})}if(o.length){for(let p=0;p{d.columnFiltersMeta[m]=_})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}const c=g=>{for(let d=0;d{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function ml(){return(e,t)=>B(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(s=>s.id).filter(s=>s!==t),i?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;a{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function _l(){return e=>B(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(a=>{var u;return(u=e.getColumn(a.id))==null?void 0:u.getCanSort()}),l={};o.forEach(a=>{const u=e.getColumn(a.id);u&&(l[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const s=a=>{const u=[...a];return u.sort((f,c)=>{for(let d=0;d{var c;i.push(f),(c=f.subRows)!=null&&c.length&&(f.subRows=s(f.subRows))}),u};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Eh(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vl(e){return t=>B(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:l,flatRows:s,rowsById:a}=r;const u=i*o,f=u+i;l=l.slice(u,f);let c;t.options.paginateExpandedRows?c={rows:l,flatRows:s,rowsById:a}:c=Eh({rows:l,flatRows:s,rowsById:a}),c.flatRows=[];const g=d=>{c.flatRows.push(d),d.subRows.length&&d.subRows.forEach(g)};return c.rows.forEach(g),c},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** - * svelte-table - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Mh(e){let t;return{c(){t=z(e[0])},l(n){t=da(n,e[0])},m(n,r){aa(n,t,r)},p(n,[r]){r&1&&J(t,n[0])},i:X,o:X,d(n){n&&N(t)}}}function Fh(e,t,n){let{content:r}=t;return e.$$set=i=>{"content"in i&&n(0,r=i.content)},[r]}class Ih extends ge{constructor(t){super(),me(this,t,Fh,Mh,de,{content:0})}}const Dh=Ql((e,t,n,r)=>`${Fa(t.content)}`);var xh=typeof document>"u"?Dh:Ih;function Ph(e,t,n){let r,i;return r=new t({props:n,$$inline:!0}),{c(){ce(r.$$.fragment)},l(o){Da(r.$$.fragment,o)},m(o,l){ae(r,o,l),i=!0},p:X,i(o){i||(T(r.$$.fragment,o),i=!0)},o(o){L(r.$$.fragment,o),i=!1},d(o){ue(r,o)}}}function Nh(e,t){return class extends ge{constructor(r){super(),me(this,r,null,i=>Ph(i,e,t),de,{},void 0)}}}function Oh(e,t){return Ql((r,i,o,l)=>`${Ia(e,"TableComponent").$$render(r,t,{},{})}`)}const di=typeof window>"u"?Oh:Nh;function Th(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function Vh(e){var t,n;let r="__SVELTE_HMR"in window;return e.prototype instanceof ge||r&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function wl(e){return typeof document>"u"?Th(e):Vh(e)}function bl(e){return di(xh,{content:e})}function ur(e,t){if(!e)return null;if(wl(e))return di(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:wl(n)?di(n,t):bl(n)}return bl(e)}function yl(e){let t;"subscribe"in e?t=e:t=Br(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...ea(t)},r=Ch(n),i=Me(r.initialState),o=Pa([i,t],s=>s);return Br(r,function(a){const u=o.subscribe(f=>{let[c,g]=f;r.setOptions(d=>({...d,...g,state:{...c,...g.state},onStateChange:p=>{p instanceof Function?i.update(p):i.set(p),n.onStateChange==null||n.onStateChange(p)}})),a(r)});return function(){u()}})}/** - * match-sorter-utils - * - * Copyright (c) TanStack - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const Js={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",áē¤:"A",áēŽ:"A",áē˛:"A",áē´:"A",áēļ:"A",Æ:"AE",áēĻ:"A",áē°:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",áēž:"E",Ḗ:"E",áģ€:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḏ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",áģ:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",ÃĄ:"a",Ãĸ:"a",ÃŖ:"a",ä:"a",ÃĨ:"a",áēĨ:"a",áē¯:"a",áēŗ:"a",áēĩ:"a",áēˇ:"a",ÃĻ:"ae",áē§:"a",áēą:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",Ê:"e",ÃĒ:"e",ÃĢ:"e",áēŋ:"e",ḗ:"e",áģ:"e",ḕ:"e",ḝ:"e",ȇ:"e",ÃŦ:"i",í:"i",ÃŽ:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",Ãą:"n",Ã˛:"o",Ãŗ:"o",ô:"o",Ãĩ:"o",Ãļ:"o",ø:"o",áģ‘:"o",ᚍ:"o",ṓ:"o",ȏ:"o",Ú:"u",Ãē:"u",Ãģ:"u",Ãŧ:"u",ÃŊ:"y",Ãŋ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",CĖ†:"C",cĖ†:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Į´:"G",ĝ:"g",Įĩ:"g",Ğ:"G",ğ:"g",Ä :"G",ÄĄ:"g",Äĸ:"G",ÄŖ:"g",Ĥ:"H",ÄĨ:"h",ÄĻ:"H",ħ:"h",á¸Ē:"H",á¸Ģ:"h",Ĩ:"I",ÄŠ:"i",ÄĒ:"I",ÄĢ:"i",ÄŦ:"I",Ä­:"i",ÄŽ:"I",į:"i",Ä°:"I",Äą:"i",IJ:"IJ",Äŗ:"ij",Ä´:"J",Äĩ:"j",Äļ:"K",ġ:"k",Ḱ:"K",ḹ:"k",KĖ†:"K",kĖ†:"k",Äš:"L",Äē:"l",Äģ:"L",Äŧ:"l",ÄŊ:"L",Äž:"l",Äŋ:"L",ŀ:"l",Ł:"l",ł:"l",Ḟ:"M",á¸ŋ:"m",MĖ†:"M",mĖ†:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",NĖ†:"N",nĖ†:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",PĖ†:"P",pĖ†:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",RĖ†:"R",rĖ†:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Å :"S",ÅĄ:"s",Åĸ:"T",ÅŖ:"t",ț:"t",Ț:"T",Ť:"T",ÅĨ:"t",ÅĻ:"T",ŧ:"t",TĖ†:"T",tĖ†:"t",Ũ:"U",ÅŠ:"u",ÅĒ:"U",ÅĢ:"u",ÅŦ:"U",Å­:"u",ÅŽ:"U",ů:"u",Å°:"U",Åą:"u",Å˛:"U",Åŗ:"u",Ȗ:"U",ȗ:"u",VĖ†:"V",vĖ†:"v",Å´:"W",Åĩ:"w",áē‚:"W",áēƒ:"w",XĖ†:"X",xĖ†:"x",Åļ:"Y",Åˇ:"y",Ÿ:"Y",YĖ†:"Y",yĖ†:"y",Åš:"Z",Åē:"z",Åģ:"Z",Åŧ:"z",ÅŊ:"Z",Åž:"z",Åŋ:"s",ƒ:"f",Æ :"O",ÆĄ:"o",Ư:"U",Æ°:"u",Į:"A",ĮŽ:"a",Į:"I",Į:"i",Į‘:"O",Į’:"o",Į“:"U",Į”:"u",Į•:"U",Į–:"u",Į—:"U",Į˜:"u",Į™:"U",Įš:"u",Į›:"U",Įœ:"u",áģ¨:"U",áģŠ:"u",ᚸ:"U",ášš:"u",Įē:"A",Įģ:"a",Įŧ:"AE",ĮŊ:"ae",Įž:"O",Įŋ:"o",Þ:"TH",Þ:"th",Ṕ:"P",ṕ:"p",ᚤ:"S",ášĨ:"s",XĖ:"X",xĖ:"x",Ѓ:"Г",Ņ“:"Đŗ",Ќ:"К",Ņœ:"Đē",AĖ‹:"A",aĖ‹:"a",EĖ‹:"E",eĖ‹:"e",IĖ‹:"I",iĖ‹:"i",Į¸:"N",Įš:"n",áģ’:"O",áģ“:"o",ᚐ:"O",ṑ:"o",áģĒ:"U",áģĢ:"u",áē€:"W",áē:"w",áģ˛:"Y",áģŗ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",BĖŒ:"B",bĖŒ:"b",ČĖŖ:"C",čĖŖ:"c",ÊĖŒ:"E",ÃĒĖŒ:"e",FĖŒ:"F",fĖŒ:"f",ĮĻ:"G",Į§:"g",Ȟ:"H",ȟ:"h",JĖŒ:"J",Į°:"j",Į¨:"K",ĮŠ:"k",MĖŒ:"M",mĖŒ:"m",PĖŒ:"P",pĖŒ:"p",QĖŒ:"Q",qĖŒ:"q",ŘĖŠ:"R",řĖŠ:"r",ášĻ:"S",ᚧ:"s",VĖŒ:"V",vĖŒ:"v",WĖŒ:"W",wĖŒ:"w",XĖŒ:"X",xĖŒ:"x",YĖŒ:"Y",yĖŒ:"y",AĖ§:"A",aĖ§:"a",BĖ§:"B",bĖ§:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ČŠ:"e",ƐĖ§:"E",ɛĖ§:"e",Ḩ:"H",Ḋ:"h",IĖ§:"I",iĖ§:"i",ƗĖ§:"I",ɨĖ§:"i",MĖ§:"M",mĖ§:"m",OĖ§:"O",oĖ§:"o",QĖ§:"Q",qĖ§:"q",UĖ§:"U",uĖ§:"u",XĖ§:"X",xĖ§:"x",ZĖ§:"Z",zĖ§:"z"},zh=Object.keys(Js).join("|"),Hh=new RegExp(zh,"g");function Lh(e){return e.replace(Hh,t=>Js[t])}/** - * @name match-sorter - * @license MIT license. - * @copyright (c) 2099 Kent C. Dodds - * @author Kent C. Dodds (https://kentcdodds.com) - */const Pe={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function qh(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:Pe.MATCHES,!n.accessors){const l=Sl(e,t,n);return{rankedValue:e,rank:l,accessorIndex:-1,accessorThreshold:n.threshold,passed:l>=n.threshold}}const i=Uh(e,n.accessors),o={rankedValue:e,rank:Pe.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let l=0;l=Pe.MATCHES?a=u:a>f&&(a=f),a=Math.min(a,f),a>=c&&a>o.rank&&(o.rank=a,o.passed=!0,o.accessorIndex=l,o.accessorThreshold=c,o.rankedValue=s.itemValue)}return o}function Sl(e,t,n){return e=Cl(e,n),t=Cl(t,n),t.length>e.length?Pe.NO_MATCH:e===t?Pe.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?Pe.EQUAL:e.startsWith(t)?Pe.STARTS_WITH:e.includes(` ${t}`)?Pe.WORD_STARTS_WITH:e.includes(t)?Pe.CONTAINS:t.length===1?Pe.NO_MATCH:Gh(e).includes(t)?Pe.ACRONYM:Bh(e,t))}function Gh(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function Bh(e,t){let n=0,r=0;function i(a,u,f){for(let c=f,g=u.length;c-1))return Pe.NO_MATCH}const s=r-l;return o(s)}function Cl(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=Lh(e)),e}function jh(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function Uh(e,t){const n=[];for(let r=0,i=t.length;r{ue(p,1)}),$e()}f?(n=qt(f,c()),ce(n.$$.fragment),T(n.$$.fragment,1),ae(n,t,r)):n=null}},i(g){s||(n&&T(n.$$.fragment,g),s=!0)},o(g){n&&L(n.$$.fragment,g),s=!1},d(g){g&&N(t),n&&ue(n),a=!1,u()}}}function Ml(e){let t,n,r=!e[26].isPlaceholder&&Xh(e);return{c(){t=R("th"),r&&r.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(i,o){V(i,t,o),r&&r.m(t,null),n=!0},p(i,o){i[26].isPlaceholder||r.p(i,o)},i(i){n||(T(r),n=!0)},o(i){L(r),n=!1},d(i){i&&N(t),r&&r.d()}}}function Fl(e){let t,n,r,i=e[23].headers,o=[];for(let s=0;sL(o[s],1,1,()=>{o[s]=null});return{c(){t=R("tr");for(let s=0;s{ue(u,1)}),$e()}o?(r=qt(o,l()),ce(r.$$.fragment),T(r.$$.fragment,1),ae(r,n,null)):r=null}},i(s){i||(r&&T(r.$$.fragment,s),i=!0)},o(s){r&&L(r.$$.fragment,s),i=!1},d(s){s&&N(n),r&&ue(r)}}}function Dl(e){let t,n=[],r=new Map,i,o,l=e[17].getVisibleCells();const s=a=>a[20].id;for(let a=0;a",ye,he,te,pe,ut,Ye=e[5],Q=[];for(let O=0;OL(Q[O],1,1,()=>{Q[O]=null});let He=e[1].getRowModel().rows,ne=[];for(let O=0;OL(ne[O],1,1,()=>{ne[O]=null});return{c(){t=R("div"),n=R("input"),r=P(),i=R("div"),o=R("table"),l=R("thead");for(let O=0;O(o(),o=fr(b,k=>n(1,i=k)),b);ie(e,sr,k=>n(8,r=k)),e.$$.on_destroy.push(()=>o());const s=(k,E,y,C)=>{if(console.log("yessir"),Array.isArray(y))return y.length===0?!0:y.includes(k.getValue(E));typeof y=="number"&&(y=String(y));const S=qh(k.getValue(E),y);return C({itemRank:S}),S.passed},a=$h(),u=[a.accessor("file",{header:"File",cell:k=>k.getValue(),footer:k=>k.column.id}),a.accessor("size",{header:"Size",cell:k=>Qr(k.getValue()),footer:k=>k.column.id}),a.accessor("type",{header:"Type",cell:k=>k.getValue(),footer:k=>k.column.id})];let f="",c=Me({data:r,columns:u,getCoreRowModel:hl(),getSortedRowModel:_l(),getFilteredRowModel:pl(),globalFilterFn:s,getFacetedRowModel:ml(),getPaginationRowModel:vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function g(k){n(6,f=k),c.update(E=>({...E,state:{...E.state,globalFilter:k}}))}function d(k){c.update(E=>{var y;return{...E,state:{...E.state,pagination:{...(y=E.state)==null?void 0:y.pagination,pageIndex:k}}}})}let p;function m(k){clearTimeout(p),p=setTimeout(()=>{const E=k.target;g(E.value)},100)}function _(k){const E=k.target;d(parseInt(E.value)-1)}let b=yl(c);l();let v=i.getHeaderGroups();const $=()=>d(i.getState().pagination.pageIndex-1),A=()=>d(i.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,c={data:r,columns:u,getCoreRowModel:hl(),getSortedRowModel:_l(),getFilteredRowModel:pl(),globalFilterFn:s,getFacetedRowModel:ml(),getPaginationRowModel:vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),l(n(0,b=yl(Me(c)))))},[b,i,d,m,_,v,f,c,r,$,A]}class Jh extends ge{constructor(t){super(),me(this,t,Kh,Yh,de,{})}}function xl(e){let t,n;return{c(){t=R("p"),n=z(e[3])},m(r,i){V(r,t,i),w(t,n)},p(r,i){i&8&&J(n,r[3])},d(r){r&&N(t)}}}function Pl(e){let t;return{c(){t=R("p"),t.textContent="Data Successfully indexed!"},m(n,r){V(n,t,r)},d(n){n&&N(t)}}}function Nl(e){let t,n;return t=new Jh({}),{c(){ce(t.$$.fragment)},m(r,i){ae(t,r,i),n=!0},i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){L(t.$$.fragment,r),n=!1},d(r){ue(t,r)}}}function Zh(e){let t,n,r,i,o,l,s,a,u,f,c,g,d,p,m,_,b,v,$,A,k,E,y,C=e[2]&&!e[1]&&xl(e),S=e[1]&&Pl();$=new jg({});let M=e[0]&&Nl();return{c(){t=R("div"),n=R("div"),r=R("div"),i=R("div"),o=R("h4"),o.textContent="Upload Data",l=P(),s=R("br"),a=P(),u=R("form"),f=R("input"),c=P(),C&&C.c(),g=P(),S&&S.c(),d=P(),p=R("p"),p.textContent="These are the files your model will use as context.",m=P(),_=R("p"),_.innerHTML="Currently pdf, txt, and md are supported.",b=P(),v=R("div"),ce($.$$.fragment),A=P(),M&&M.c(),h(f,"type","file"),f.multiple=!0,h(i,"class","upload-box svelte-1lu6hos"),h(r,"class","upload-container svelte-1lu6hos"),h(n,"class","file-container svelte-1lu6hos"),h(v,"class","charts-container svelte-1lu6hos"),h(t,"class","data-grid svelte-1lu6hos")},m(F,I){V(F,t,I),w(t,n),w(n,r),w(r,i),w(i,o),w(i,l),w(i,s),w(i,a),w(i,u),w(u,f),w(i,c),C&&C.m(i,null),w(i,g),S&&S.m(i,null),w(i,d),w(i,p),w(i,m),w(i,_),w(t,b),w(t,v),ae($,v,null),w(v,A),M&&M.m(v,null),k=!0,E||(y=K(f,"change",e[4]),E=!0)},p(F,[I]){F[2]&&!F[1]?C?C.p(F,I):(C=xl(F),C.c(),C.m(i,g)):C&&(C.d(1),C=null),F[1]?S||(S=Pl(),S.c(),S.m(i,d)):S&&(S.d(1),S=null),F[0]?M?I&1&&T(M,1):(M=Nl(),M.c(),T(M,1),M.m(v,null)):M&&(ke(),L(M,1,1,()=>{M=null}),$e())},i(F){k||(T($.$$.fragment,F),T(M),k=!0)},o(F){L($.$$.fragment,F),L(M),k=!1},d(F){F&&N(t),C&&C.d(),S&&S.d(),ue($),M&&M.d(),E=!1,y()}}}function ep(e,t,n){let r,i,o;ie(e,sl,p=>n(6,i=p)),ie(e,sr,p=>n(7,o=p));let l=[],s=!1,a=!1;async function u(p){n(0,l=p.target.files);const m=new FormData;for(let _=0;_({file:b.name,size:b.size,type:b.type}));Ue(sr,o=[..._],o)}async function c(){console.log("index!"),n(2,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,s=!0),n(2,a=!1)}async function g(){console.log("getting embeddings...");const m=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",m),Ue(sl,i=m,i)}Xt(()=>{f()});let d=0;return setInterval(()=>{n(5,d=(d+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,r="Indexing"+".".repeat(d))},[l,s,a,r,u,d]}class tp extends ge{constructor(t){super(),me(this,t,ep,Zh,de,{})}}function Ol(e,t,n){const r=e.slice();return r[7]=t[n],r}function Tl(e){let t,n=e[0],r=[];for(let i=0;i{ue(f,1)}),$e()}o?(t=qt(o,l()),ce(t.$$.fragment),T(t.$$.fragment,1),ae(t,n.parentNode,n)):t=null}else o&&t.$set(u)},i(s){r||(t&&T(t.$$.fragment,s),r=!0)},o(s){t&&L(t.$$.fragment,s),r=!1},d(s){s&&N(n),t&&ue(t,s)}}}function np(e){let t,n,r,i=e[0].length>1&&Tl(e),o=e[1]&&zl(e);return{c(){i&&i.c(),t=P(),o&&o.c(),n=lt()},m(l,s){i&&i.m(l,s),V(l,t,s),o&&o.m(l,s),V(l,n,s),r=!0},p(l,[s]){l[0].length>1?i?i.p(l,s):(i=Tl(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),l[1]?o?(o.p(l,s),s&2&&T(o,1)):(o=zl(l),o.c(),T(o,1),o.m(n.parentNode,n)):o&&(ke(),L(o,1,1,()=>{o=null}),$e())},i(l){r||(T(o),r=!0)},o(l){L(o),r=!1},d(l){i&&i.d(l),l&&N(t),o&&o.d(l),l&&N(n)}}}function rp(e,t,n){let r,i;const o=Me([]);ie(e,o,f=>n(0,r=f));const l=Me(null);ie(e,l,f=>n(1,i=f));const s={Chatbot:Tf,Dropdown:Hf,Feedback:Dd,Compare:ag,RetrievalQA:tp},a=f=>{l.set(f)};return fetch("/components").then(f=>{if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}).then(f=>{o.set(f),l.set(f[0])}).catch(f=>{console.log("Fetch request failed",f)}),[r,i,o,l,s,a,f=>a(f)]}class ip extends ge{constructor(t){super(),me(this,t,rp,np,de,{})}}new ip({target:document.getElementById("app")}); diff --git a/pykoi/frontend/dist/assets/index-7e1d34ae.js b/pykoi/frontend/dist/assets/index-7e1d34ae.js new file mode 100644 index 0000000..ad6b269 --- /dev/null +++ b/pykoi/frontend/dist/assets/index-7e1d34ae.js @@ -0,0 +1,70 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function q(){}const ls=e=>e;function Un(e,t){for(const n in t)e[n]=t[n];return e}function ss(e){return e()}function Br(){return Object.create(null)}function me(e){e.forEach(ss)}function Ue(e){return typeof e=="function"}function ae(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Fa(e){return Object.keys(e).length===0}function hr(e,...t){if(e==null)return q;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Da(e){let t;return hr(e,n=>t=n)(),t}function ne(e,t,n){e.$$.on_destroy.push(hr(t,n))}function Ti(e){return e??""}function Ne(e,t,n){return e.set(n),t}function Bt(e){return e&&Ue(e.destroy)?e.destroy:q}const as=typeof window<"u";let us=as?()=>window.performance.now():()=>Date.now(),pi=as?e=>requestAnimationFrame(e):q;const Ht=new Set;function fs(e){Ht.forEach(t=>{t.c(e)||(Ht.delete(t),t.f())}),Ht.size!==0&&pi(fs)}function cs(e){let t;return Ht.size===0&&pi(fs),{promise:new Promise(n=>{Ht.add(t={c:e,f:n})}),abort(){Ht.delete(t)}}}let pr=!1;function Ia(){pr=!0}function Na(){pr=!1}function Pa(e,t,n,r){for(;e>1);n(i)<=r?e=i+1:t=i}return e}function Ta(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const a=[];for(let u=0;u0&&t[n[i]].claim_order<=u?i+1:Pa(1,i,d=>t[n[d]].claim_order,u))-1;r[a]=n[f]+1;const c=f+1;n[c]=a,i=Math.max(c,i)}const o=[],l=[];let s=t.length-1;for(let a=n[i]+1;a!=0;a=r[a-1]){for(o.push(t[a-1]);s>=a;s--)l.push(t[s]);s--}for(;s>=0;s--)l.push(t[s]);o.reverse(),l.sort((a,u)=>a.claim_order-u.claim_order);for(let a=0,u=0;a=o[u].claim_order;)u++;const f=ue.removeEventListener(t,n,r)}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Ha(e){return Array.from(e.childNodes)}function La(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function qa(e,t,n,r,i=!1){La(e);const o=(()=>{for(let l=e.claim_info.last_index;l=0;l--){const s=e[l];if(t(s)){const a=n(s);return a===void 0?e.splice(l,1):e[l]=a,i?a===void 0&&e.claim_info.last_index--:e.claim_info.last_index=l,s}}return r()})();return o.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,o}function ja(e,t){return qa(e,n=>n.nodeType===3,n=>{const r=""+t;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>z(t),!0)}function Q(e,t){t=""+t,e.data!==t&&(e.data=t)}function rt(e,t){e.value=t??""}function Me(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Wn(e,t,n){for(let r=0;r{l.source===r.contentWindow&&t()})):(r.src="about:blank",r.onload=()=>{o=U(r.contentWindow,"resize",t),t()}),v(e,r),()=>{(i||o&&r.contentWindow)&&o(),T(r)}}function rn(e,t,n){e.classList[n?"add":"remove"](t)}function Ba(e,t,{bubbles:n=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}function bt(e,t){return new e(t)}const Xn=new Map;let Yn=0;function Ua(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Wa(e,t){const n={stylesheet:xa(t),rules:{}};return Xn.set(e,n),n}function xi(e,t,n,r,i,o,l,s=0){const a=16.666/r;let u=`{ +`;for(let _=0;_<=1;_+=a){const b=t+(n-t)*o(_);u+=_*100+`%{${l(b,1-b)}} +`}const f=u+`100% {${l(n,1-n)}} +}`,c=`__svelte_${Ua(f)}_${s}`,d=ds(e),{stylesheet:g,rules:p}=Xn.get(d)||Wa(d,e);p[c]||(p[c]=!0,g.insertRule(`@keyframes ${c} ${f}`,g.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${c} ${r}ms linear ${i}ms 1 both`,Yn+=1,c}function Xa(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),i=n.length-r.length;i&&(e.style.animation=r.join(", "),Yn-=i,Yn||Ya())}function Ya(){pi(()=>{Yn||(Xn.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&T(t)}),Xn.clear())})}let Ut;function $t(e){Ut=e}function Qa(){if(!Ut)throw new Error("Function called outside component initialization");return Ut}function ct(e){Qa().$$.on_mount.push(e)}const xt=[],mn=[];let Lt=[];const Oi=[],Ka=Promise.resolve();let Ur=!1;function Ja(){Ur||(Ur=!0,Ka.then(hs))}function ke(e){Lt.push(e)}const yr=new Set;let It=0;function hs(){if(It!==0)return;const e=Ut;do{try{for(;Ite.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),Lt=t}let Zt;function tu(){return Zt||(Zt=Promise.resolve(),Zt.then(()=>{Zt=null})),Zt}function Sr(e,t,n){e.dispatchEvent(Ba(`${t?"intro":"outro"}${n}`))}const zn=new Set;let st;function ce(){st={r:0,c:[],p:st}}function de(){st.r||me(st.c),st=st.p}function P(e,t){e&&e.i&&(zn.delete(e),e.i(t))}function O(e,t,n,r){if(e&&e.o){if(zn.has(e))return;zn.add(e),st.c.push(()=>{zn.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}const nu={duration:0};function Be(e,t,n,r){const i={direction:"both"};let o=t(e,n,i),l=r?0:1,s=null,a=null,u=null;function f(){u&&Xa(e,u)}function c(g,p){const m=g.b-l;return p*=Math.abs(m),{a:l,b:g.b,d:m,duration:p,start:g.start,end:g.start+p,group:g.group}}function d(g){const{delay:p=0,duration:m=300,easing:_=ls,tick:b=q,css:w}=o||nu,C={start:us()+p,b:g};g||(C.group=st,st.r+=1),s||a?a=C:(w&&(f(),u=xi(e,l,g,m,p,_,w)),g&&b(0,1),s=c(C,m),ke(()=>Sr(e,g,"start")),cs(E=>{if(a&&E>a.start&&(s=c(a,m),a=null,Sr(e,s.b,"start"),w&&(f(),u=xi(e,l,s.b,s.duration,0,_,o.css))),s){if(E>=s.end)b(l=s.b,1-l),Sr(e,s.b,"end"),a||(s.b?f():--s.group.r||me(s.group.c)),s=null;else if(E>=s.start){const R=E-s.start;l=s.a+s.d*_(R/s.duration),b(l,1-l)}}return!!(s||a)}))}return{run(g){Ue(o)?tu().then(()=>{o=o(i),d(g)}):d(g)},end(){f(),s=a=null}}}function mi(e,t){e.d(1),t.delete(e.key)}function _i(e,t){O(e,1,1,()=>{t.delete(e.key)})}function Kt(e,t,n,r,i,o,l,s,a,u,f,c){let d=e.length,g=o.length,p=d;const m={};for(;p--;)m[e[p].key]=p;const _=[],b=new Map,w=new Map,C=[];for(p=g;p--;){const y=c(i,o,p),$=n(y);let S=l.get($);S?r&&C.push(()=>S.p(y,t)):(S=u($,y),S.c()),b.set($,_[p]=S),$ in m&&w.set($,Math.abs(p-m[$]))}const E=new Set,R=new Set;function A(y){P(y,1),y.m(s,f),l.set(y.key,y),f=y.first,g--}for(;d&&g;){const y=_[g-1],$=e[d-1],S=y.key,F=$.key;y===$?(f=y.first,d--,g--):b.has(F)?!l.has(S)||E.has(S)?A(y):R.has(F)?d--:w.get(S)>w.get(F)?(R.add(S),A(y)):(E.add(F),d--):(a($,l),d--)}for(;d--;){const y=e[d];b.has(y.key)||a(y,l)}for(;g;)A(_[g-1]);return me(C),_}function ps(e,t){const n={},r={},i={$$scope:1};let o=e.length;for(;o--;){const l=e[o],s=t[o];if(s){for(const a in l)a in s||(r[a]=1);for(const a in s)i[a]||(n[a]=s[a],i[a]=1);e[o]=s}else for(const a in l)i[a]=1}for(const l in r)l in n||(n[l]=void 0);return n}function ms(e){return typeof e=="object"&&e!==null?e:{}}const ru=/[&"]/g,iu=/[&<]/g;function ou(e,t=!1){const n=String(e),r=t?ru:iu;r.lastIndex=0;let i="",o=0;for(;r.test(n);){const l=r.lastIndex-1,s=n[l];i+=n.substring(o,l)+(s==="&"?"&":s==='"'?""":"<"),o=l+1}return i+n.substring(o)}function lu(e,t){if(!e||!e.$$render)throw t==="svelte:component"&&(t+=" this={...}"),new Error(`<${t}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${t}>.`);return e}let kr;function _s(e){function t(n,r,i,o,l){const s=Ut,a={on_destroy:kr,context:new Map(l||(s?s.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:Br()};$t({$$:a});const u=e(n,r,i,o);return $t(s),u}return{render:(n={},{$$slots:r={},context:i=new Map}={})=>{kr=[];const o={title:"",head:"",css:new Set},l=t(o,n,{},r,i);return me(kr),{html:l,css:{code:Array.from(o.css).map(s=>s.code).join(` +`),map:null},head:o.title+o.head}},$$render:t}}function ee(e){e&&e.c()}function su(e,t){e&&e.l(t)}function J(e,t,n,r){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,n),r||ke(()=>{const l=e.$$.on_mount.map(ss).filter(Ue);e.$$.on_destroy?e.$$.on_destroy.push(...l):me(l),e.$$.on_mount=[]}),o.forEach(ke)}function Z(e,t){const n=e.$$;n.fragment!==null&&(eu(n.after_update),me(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function au(e,t){e.$$.dirty[0]===-1&&(xt.push(e),Ja(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const p=g.length?g[0]:d;return u.ctx&&i(u.ctx[c],u.ctx[c]=p)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](p),f&&au(e,c)),d}):[],u.update(),f=!0,me(u.before_update),u.fragment=r?r(u.ctx):!1,t.target){if(t.hydrate){Ia();const c=Ha(t.target);u.fragment&&u.fragment.l(c),c.forEach(T)}else u.fragment&&u.fragment.c();t.intro&&P(e.$$.fragment),J(e,t.target,t.anchor,t.customElement),Na(),hs()}$t(a)}class ue{$destroy(){Z(this,1),this.$destroy=q}$on(t,n){if(!Ue(n))return q;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Fa(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Nt=[];function Wr(e,t){return{subscribe:Re(e,t).subscribe}}function Re(e,t=q){let n;const r=new Set;function i(s){if(ae(e,s)&&(e=s,n)){const a=!Nt.length;for(const u of r)u[1](),Nt.push(u,e);if(a){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:l}}function uu(e,t,n){const r=!Array.isArray(e),i=r?[e]:e,o=t.length<2;return Wr(n,l=>{let s=!1;const a=[];let u=0,f=q;const c=()=>{if(u)return;f();const g=t(r?a[0]:a,l);o?l(g):f=Ue(g)?g:q},d=i.map((g,p)=>hr(g,m=>{a[p]=m,u&=~(1<{u|=1<e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const r=t.map((i,o)=>Xr(e[o],i));return i=>r.map(o=>o(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(Vi(e)&&Vi(t)){e=e.getTime(),t=t.getTime();const o=t-e;return l=>new Date(e+l*o)}const r=Object.keys(t),i={};return r.forEach(o=>{i[o]=Xr(e[o],t[o])}),o=>{const l={};return r.forEach(s=>{l[s]=i[s](o)}),l}}if(n==="number"){const r=t-e;return i=>e+i*r}throw new Error(`Cannot interpolate ${n} values`)}function bi(e,t={}){const n=Re(e);let r,i=e;function o(l,s){if(e==null)return n.set(e=l),Promise.resolve();i=l;let a=r,u=!1,{delay:f=0,duration:c=400,easing:d=ls,interpolate:g=Xr}=Un(Un({},t),s);if(c===0)return a&&(a.abort(),a=null),n.set(e=i),Promise.resolve();const p=us()+f;let m;return r=cs(_=>{if(_c?(n.set(e=l),!1):(n.set(e=m(d(b/c))),!0)}),r.promise}return{set:o,update:(l,s)=>o(l(i,e),s),subscribe:n.subscribe}}const Oe=Re([]),Cr=Re([]),$r=Re([]),_n=Re([]),it=Re("all"),zi=Re({"n/a":1,up:1,down:1}),fu=["who","what","how","why","where","does","can","n/a"],Yr=bi(fu.map(e=>({question:e,count:0}))),Qr=Re(new Set);var Kr="http://www.w3.org/1999/xhtml";const Hi={svg:"http://www.w3.org/2000/svg",xhtml:Kr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vs(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Hi.hasOwnProperty(t)?{space:Hi[t],local:e}:e}function cu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Kr&&t.documentElement.namespaceURI===Kr?t.createElement(e):t.createElementNS(n,e)}}function du(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bs(e){var t=vs(e);return(t.local?du:cu)(t)}function gu(){}function ws(e){return e==null?gu:function(){return this.querySelector(e)}}function hu(e){typeof e!="function"&&(e=ws(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=C&&(C=w+1);!(R=_[C])&&++C=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function Hu(e){e||(e=Lu);function t(c,d){return c&&d?e(c.__data__,d.__data__):!c-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function qu(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ju(){return Array.from(this)}function Gu(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?tf:typeof t=="function"?rf:nf)(e,t,n??"")):lf(this.node(),e)}function lf(e,t){return e.style.getPropertyValue(t)||Cs(e).getComputedStyle(e,null).getPropertyValue(t)}function sf(e){return function(){delete this[e]}}function af(e,t){return function(){this[e]=t}}function uf(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ff(e,t){return arguments.length>1?this.each((t==null?sf:typeof t=="function"?uf:af)(e,t)):this.node()[e]}function $s(e){return e.trim().split(/^|\s+/)}function wi(e){return e.classList||new Rs(e)}function Rs(e){this._node=e,this._names=$s(e.getAttribute("class")||"")}Rs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function As(e,t){for(var n=wi(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Vf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n`${b[0].toUpperCase()}${b.slice(1)}`),c=parseFloat(o[`padding${f[0]}`]),d=parseFloat(o[`padding${f[1]}`]),g=parseFloat(o[`margin${f[0]}`]),p=parseFloat(o[`margin${f[1]}`]),m=parseFloat(o[`border${f[0]}Width`]),_=parseFloat(o[`border${f[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*l};${s}: ${b*a}px;padding-${u[0]}: ${b*c}px;padding-${u[1]}: ${b*d}px;margin-${u[0]}: ${b*g}px;margin-${u[1]}: ${b*p}px;border-${u[0]}-width: ${b*m}px;border-${u[1]}-width: ${b*_}px;`}}function An(e,{delay:t=0,duration:n=400,easing:r=vi,start:i=0,opacity:o=0}={}){const l=getComputedStyle(e),s=+l.opacity,a=l.transform==="none"?"":l.transform,u=1-i,f=s*(1-o);return{delay:t,duration:n,easing:r,css:(c,d)=>` + transform: ${a} scale(${1-u*d}); + opacity: ${s-f*d} + `}}function Li(e,t,n){const r=e.slice();return r[8]=t[n],r[10]=n,r}function qi(e){let t,n,r,i,o=e[8].name+"",l,s,a,u,f;function c(...d){return e[6](e[8],...d)}return{c(){t=k("label"),n=k("input"),l=z(o),s=I(),h(n,"type","checkbox"),h(n,"id",r=e[8].id),n.checked=i=e[1].has(e[8].name),h(t,"for",a=e[8].id)},m(d,g){x(d,t,g),v(t,n),v(t,l),v(t,s),u||(f=U(n,"change",c),u=!0)},p(d,g){e=d,g&1&&r!==(r=e[8].id)&&h(n,"id",r),g&3&&i!==(i=e[1].has(e[8].name))&&(n.checked=i),g&1&&o!==(o=e[8].name+"")&&Q(l,o),g&1&&a!==(a=e[8].id)&&h(t,"for",a)},d(d){d&&T(t),u=!1,f()}}}function Uf(e){let t,n,r,i,o,l,s,a,u,f,c,d=e[0],g=[];for(let p=0;pn(1,r=c));let{documents:i=[]}=t,o=!1,l;function s(){n(2,o=!o)}function a(c,d){d.target.checked?r.add(c):r.delete(c),Qr.set(new Set(r))}const u=(c,d)=>a(c.name,d);function f(c){mn[c?"unshift":"push"](()=>{l=c,n(3,l)})}return e.$$set=c=>{"documents"in c&&n(0,i=c.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(r)},[i,r,o,l,s,a,u,f]}let Ds=class extends ue{constructor(t){super(),fe(this,t,Wf,Uf,ae,{documents:0})}};function Jr(e,t=2){if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,o)).toFixed(r))+" "+i[o]}function Xf(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let r=0;r({question:r,count:t[r]}))}function Is(e){return e.map(t=>{const n=t.question.split(" ").length,r=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+r,vote:t.vote}})}function Ns(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const i=document.createElement("span");i.textContent=t,i.setAttribute("id","tooltip"),e.appendChild(i),e.addEventListener("mouseleave",r),e.addEventListener("blur",r),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function r(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",r),e.removeEventListener("blur",r),e.addEventListener("mouseenter",n),e.addEventListener("focus",n)}return e.addEventListener("mouseenter",n),e.addEventListener("focus",n),{onDestroy(){e.classList.remove("tooltip"),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}}}function ji(e,t,n){const r=e.slice();return r[20]=t[n],r[22]=n,r}function Gi(e){let t,n,r,i,o,l;function s(...u){return e[12](e[22],...u)}function a(...u){return e[13](e[22],...u)}return{c(){t=k("div"),n=k("button"),n.textContent="👍",r=I(),i=k("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-1a3jfs3"),h(i,"class","small-button thumbs-down svelte-1a3jfs3"),h(t,"class","feedback-buttons svelte-1a3jfs3")},m(u,f){x(u,t,f),v(t,n),v(t,r),v(t,i),o||(l=[U(n,"click",s),U(i,"click",a)],o=!0)},p(u,f){e=u},d(u){u&&T(t),o=!1,me(l)}}}function Yf(e){let t;return{c(){t=k("p"),t.textContent="⌄"},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function Qf(e){let t;return{c(){t=k("p"),t.textContent="⌃"},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function Bi(e){let t,n,r=e[20].source_content+"",i,o,l;return{c(){t=k("div"),n=k("p"),i=z(r),h(n,"class","bold svelte-1a3jfs3"),h(t,"class","source_content svelte-1a3jfs3")},m(s,a){x(s,t,a),v(t,n),v(n,i),l=!0},p(s,a){(!l||a&32)&&r!==(r=s[20].source_content+"")&&Q(i,r)},i(s){l||(ke(()=>{l&&(o||(o=Be(t,At,{},!0)),o.run(1))}),l=!0)},o(s){o||(o=Be(t,At,{},!1)),o.run(0),l=!1},d(s){s&&T(t),s&&o&&o.end()}}}function Ui(e,t){let n,r,i,o,l,s,a,u,f,c=t[20].question+"",d,g,p,m,_,b,w,C,E,R,A,y=t[20].answer+"",$,S,F,N,M,D,L,ge=t[20].source+"",re,Ce,$e,ve,oe,be,gt,Je,te=t[0]&&Gi(t);function $n(K,j){return K[3][K[22]]?Qf:Yf}let je=$n(t),le=je(t);function wr(){return t[14](t[22])}let H=t[3][t[22]]&&Bi(t);return{key:e,first:null,c(){n=k("div"),r=k("div"),i=k("div"),o=I(),l=k("div"),s=k("div"),a=k("h5"),a.textContent="Question:",u=I(),f=k("p"),d=z(c),g=I(),p=k("div"),m=k("p"),m.textContent="ℹī¸ RAG Sources",b=I(),w=k("div"),C=k("div"),E=k("h5"),E.textContent="Response:",R=I(),A=k("p"),$=z(y),S=I(),te&&te.c(),F=I(),N=k("div"),M=k("div"),D=k("p"),L=z("📖 Source: "),re=z(ge),Ce=I(),le.c(),$e=I(),H&&H.c(),ve=I(),h(i,"class","avatar"),h(a,"class","bold svelte-1a3jfs3"),h(m,"class","bold svelte-1a3jfs3"),h(p,"class","rag-sources svelte-1a3jfs3"),h(s,"class","question svelte-1a3jfs3"),h(E,"class","bold svelte-1a3jfs3"),h(C,"class","answer svelte-1a3jfs3"),h(D,"class","bold svelte-1a3jfs3"),h(M,"class","source_tab svelte-1a3jfs3"),h(N,"class","source svelte-1a3jfs3"),h(w,"class","answers svelte-1a3jfs3"),h(l,"class","message-content svelte-1a3jfs3"),h(r,"class","chat-message-center svelte-1a3jfs3"),h(n,"class","chat-message svelte-1a3jfs3"),this.first=n},m(K,j){x(K,n,j),v(n,r),v(r,i),v(r,o),v(r,l),v(l,s),v(s,a),v(s,u),v(s,f),v(f,d),v(s,g),v(s,p),v(p,m),v(l,b),v(l,w),v(w,C),v(C,E),v(C,R),v(C,A),v(A,$),v(C,S),te&&te.m(C,null),v(w,F),v(w,N),v(N,M),v(M,D),v(D,L),v(D,re),v(M,Ce),le.m(M,null),v(N,$e),H&&H.m(N,null),v(n,ve),be=!0,gt||(Je=[Bt(_=Ns.call(null,m,Wi(t[20]))),U(M,"click",wr),Bt(oe=Jf.call(null,n,t[22]===t[5].length-1))],gt=!0)},p(K,j){t=K,(!be||j&32)&&c!==(c=t[20].question+"")&&Q(d,c),_&&Ue(_.update)&&j&32&&_.update.call(null,Wi(t[20])),(!be||j&32)&&y!==(y=t[20].answer+"")&&Q($,y),t[0]?te?te.p(t,j):(te=Gi(t),te.c(),te.m(C,null)):te&&(te.d(1),te=null),(!be||j&32)&&ge!==(ge=t[20].source+"")&&Q(re,ge),je!==(je=$n(t))&&(le.d(1),le=je(t),le&&(le.c(),le.m(M,null))),t[3][t[22]]?H?(H.p(t,j),j&40&&P(H,1)):(H=Bi(t),H.c(),P(H,1),H.m(N,null)):H&&(ce(),O(H,1,1,()=>{H=null}),de()),oe&&Ue(oe.update)&&j&32&&oe.update.call(null,t[22]===t[5].length-1)},i(K){be||(P(H),be=!0)},o(K){O(H),be=!1},d(K){K&&T(n),te&&te.d(),le.d(),H&&H.d(),gt=!1,me(Je)}}}function Kf(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,d,g,p,m,_,b,w=(e[2]?e[4]:"Send")+"",C,E,R,A,y,$,S,F=e[5];const N=M=>M[22];for(let M=0;MVote Feedback Instructions +

Ask a question to receive an answer from the chatbot. If the response is + satisfactory, click on the 👍 + button. If the repsonse is not satisfactory, click on the + 👎 button.

`,r=I(),i=k("div"),o=k("section"),l=k("div");for(let M=0;M{e.scrollIntoView({behavior:"smooth"})},0)}async function Zf(e){const t=await fetch("/chat/qa_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Wi(e){return e.rag_sources.length===0?"All":e.rag_sources.join(", ")}function ec(e,t,n){let r,i,o;ne(e,Oe,A=>n(5,i=A));let{feedback:l=!1}=t,{is_retrieval:s=!1}=t;const a=Re([]);ne(e,a,A=>n(6,o=A));let u="",f="",c=!1,d=[];ct(()=>{p(),g()});async function g(){const y=await(await fetch("/retrieval/file/get")).json();console.log("data",y.files);const S=y.files.map((F,N)=>({id:String(N),name:F.name}));console.log("files",S),Ne(a,o=[...S],o)}async function p(){const S=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(F=>({id:F[0],question:F[1],answer:F[2],vote_status:F[3],rag_sources:["doc1.pdf","doc2.pdf","doc3.pdf"]}));n(3,d=new Array(S.length).fill(!1)),Ne(Oe,i=[...S],i)}const m=async A=>{A.preventDefault(),u=f,n(1,f=""),n(2,c=!0);let y={id:i.length+1,question:u,answer:"Loading...",rag_sources:["doc1.pdf","doc2.pdf","doc3.pdf"],vote_status:"na",source:"Loading...",source_content:"Loading..."};Ne(Oe,i=[...i,y],i);const $=s?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:u})}):await fetch(`/chat/${u}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:u})});if($.ok){const S=await $.json();console.log("response data",S),y.answer=S.answer,y.source=S.source,y.source_content=S.source_content,d.push(!1),Oe.update(F=>(F[F.length-1]=y,F))}else{const S=await $.text();alert(S)}n(2,c=!1)};let _=0;setInterval(()=>{n(11,_=(_+1)%4)},200);function b(A,y,$){const S=i[$];S.vote=y;const F={id:$+1,vote_status:y};Zf(F),ut(A.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),ut(A.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}[...Array(10).keys()].map(A=>String.fromCharCode(65+A));const w=(A,y)=>b(y,"up",A),C=(A,y)=>b(y,"down",A),E=A=>n(3,d[A]=!d[A],d);function R(){f=this.value,n(1,f)}return e.$$set=A=>{"feedback"in A&&n(0,l=A.feedback),"is_retrieval"in A&&n(10,s=A.is_retrieval)},e.$$.update=()=>{e.$$.dirty&2048&&n(4,r=".".repeat(_).padEnd(3))},[l,f,c,d,r,i,o,a,m,b,s,_,w,C,E,R]}class yi extends ue{constructor(t){super(),fe(this,t,ec,Kf,ae,{feedback:0,is_retrieval:10})}}function Xi(e,t,n){const r=e.slice();return r[14]=t[n],r[16]=n,r}function Yi(e,t){let n,r,i,o,l,s,a,u,f,c=t[14].question+"",d,g,p,m,_,b,w,C=t[14].up_ranking_answer+"",E,R,A,y,$,S,F=t[14].low_ranking_answer+"",N,M,D,L,ge;function re(...oe){return t[7](t[14],t[16],...oe)}function Ce(...oe){return t[8](t[14],t[16],...oe)}function $e(...oe){return t[9](t[14],t[16],...oe)}function ve(...oe){return t[10](t[14],t[16],...oe)}return{key:e,first:null,c(){n=k("div"),r=k("div"),i=k("div"),o=I(),l=k("div"),s=k("div"),a=k("h5"),a.textContent="Question:",u=I(),f=k("p"),d=z(c),g=I(),p=k("div"),m=k("div"),_=k("h5"),_.textContent="Response 1:",b=I(),w=k("p"),E=z(C),R=I(),A=k("div"),y=k("h5"),y.textContent="Response 2:",$=I(),S=k("p"),N=z(F),M=I(),h(i,"class","avatar"),h(a,"class","bold svelte-au920n"),h(s,"class","question svelte-au920n"),h(_,"class","bold underline svelte-au920n"),h(m,"class","answer svelte-au920n"),h(y,"class","bold underline svelte-au920n"),h(A,"class","answer svelte-au920n"),h(p,"class","answers svelte-au920n"),h(l,"class","message-content svelte-au920n"),h(r,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(oe,be){x(oe,n,be),v(n,r),v(r,i),v(r,o),v(r,l),v(l,s),v(s,a),v(s,u),v(s,f),v(f,d),v(l,g),v(l,p),v(p,m),v(m,_),v(m,b),v(m,w),v(w,E),v(p,R),v(p,A),v(A,y),v(A,$),v(A,S),v(S,N),v(n,M),L||(ge=[U(m,"click",re),U(m,"keydown",Ce),U(A,"click",$e),U(A,"keydown",ve),Bt(D=nc.call(null,n,t[16]===t[3].length-1))],L=!0)},p(oe,be){t=oe,be&8&&c!==(c=t[14].question+"")&&Q(d,c),be&8&&C!==(C=t[14].up_ranking_answer+"")&&Q(E,C),be&8&&F!==(F=t[14].low_ranking_answer+"")&&Q(N,F),D&&Ue(D.update)&&be&8&&D.update.call(null,t[16]===t[3].length-1)},d(oe){oe&&T(n),L=!1,me(ge)}}}function tc(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,d,g,p,m=(e[1]?e[2]:"Send")+"",_,b,w,C,E,R,A=e[3];const y=$=>$[16];for(let $=0;$Ranked Feedback Instructions +

Ask a question and click on the better of the two responses. The better + response will be outlined in green, the worse + response outlined in red. This data will be + automatically fed to RLHF.

+ `,r=I(),i=k("div"),o=k("section"),l=k("div");for(let $=0;${e.scrollIntoView({behavior:"smooth"})},0)}async function rc(e){const t=await fetch("/chat/ranking_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function ic(e,t,n){let r,i;ne(e,Cr,_=>n(3,i=_));let o="",l="",s=!1;ct(()=>{});const a=async _=>{_.preventDefault(),o=l,n(0,l=""),n(1,s=!0);let b={question:o,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Ne(Cr,i=[...i,b],i);const w=await fetch(`/chat/multi_responses/${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:o})});if(w.ok){const C=await w.json();b.up_ranking_answer=C.answer[0],b.low_ranking_answer=C.answer[1],Cr.update(E=>(E[E.length-1]=b,E))}else{const C=await w.text();alert(C)}n(1,s=!1)};let u=0;setInterval(()=>{n(6,u=(u+1)%4)},200);function f(_,b,w,C){const E=i[w],R={1:"up_ranking_answer",2:"low_ranking_answer"},A={question:E.question,up_ranking_answer:E[R[C]],low_ranking_answer:E[R[C%2+1]]};rc(A),ut(_.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),ut(_.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const c=(_,b,w)=>f(w,_,b,1),d=(_,b,w)=>f(w,_,b,1),g=(_,b,w)=>f(w,_,b,2),p=(_,b,w)=>f(w,_,b,2);function m(){l=this.value,n(0,l)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,r=".".repeat(u).padEnd(3))},[l,s,r,i,a,f,u,c,d,g,p,m]}class oc extends ue{constructor(t){super(),fe(this,t,ic,tc,ae,{})}}function lc(e){let t;return{c(){t=k("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function sc(e){let t;return{c(){t=k("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function Qi(e){let t,n,r,i,o;return{c(){t=k("div"),n=k("p"),r=z(e[1]),h(n,"class","bold svelte-1pk2e1k"),h(t,"class","source_content svelte-1pk2e1k")},m(l,s){x(l,t,s),v(t,n),v(n,r),o=!0},p(l,s){(!o||s&2)&&Q(r,l[1])},i(l){o||(ke(()=>{o&&(i||(i=Be(t,At,{},!0)),i.run(1))}),o=!0)},o(l){i||(i=Be(t,At,{},!1)),i.run(0),o=!1},d(l){l&&T(t),l&&i&&i.end()}}}function ac(e){let t,n,r,i=e[2]+1+"",o,l,s,a,u,f,c,d,g;function p(w,C){return w[3]?sc:lc}let m=p(e),_=m(e),b=e[3]&&Qi(e);return{c(){t=k("div"),n=k("div"),r=k("p"),o=z(i),l=z(": "),s=z(e[0]),a=I(),_.c(),f=I(),b&&b.c(),h(r,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(w,C){x(w,t,C),v(t,n),v(n,r),v(r,o),v(r,l),v(r,s),v(n,a),_.m(n,null),v(t,f),b&&b.m(t,null),c=!0,d||(g=U(n,"click",e[4]),d=!0)},p(w,[C]){(!c||C&4)&&i!==(i=w[2]+1+"")&&Q(o,i),(!c||C&1)&&Q(s,w[0]),m!==(m=p(w))&&(_.d(1),_=m(w),_&&(_.c(),_.m(n,null))),w[3]?b?(b.p(w,C),C&8&&P(b,1)):(b=Qi(w),b.c(),P(b,1),b.m(t,null)):b&&(ce(),O(b,1,1,()=>{b=null}),de())},i(w){c||(ke(()=>{c&&(u||(u=Be(n,At,{},!0)),u.run(1))}),P(b),c=!0)},o(w){u||(u=Be(n,At,{},!1)),u.run(0),O(b),c=!1},d(w){w&&T(t),_.d(),w&&u&&u.end(),b&&b.d(),d=!1,g()}}}function uc(e,t,n){let{source:r=""}=t,{source_content:i=""}=t,{i:o=0}=t,l=o===0;const s=()=>n(3,l=!l);return e.$$set=a=>{"source"in a&&n(0,r=a.source),"source_content"in a&&n(1,i=a.source_content),"i"in a&&n(2,o=a.i)},[r,i,o,l,s]}class fc extends ue{constructor(t){super(),fe(this,t,uc,ac,ae,{source:0,source_content:1,i:2})}}function Ki(e,t,n){const r=e.slice();return r[4]=t[n],r[6]=n,r}function Ji(e){let t,n,r,i;const o=[hc,gc,dc,cc],l=[];function s(a,u){return a[0][0]==="N/A"?0:a[0][0]==="Loading..."?1:a[0][0]==="Not loaded"?2:3}return t=s(e),n=l[t]=o[t](e),{c(){n.c(),r=Fe()},m(a,u){l[t].m(a,u),x(a,r,u),i=!0},p(a,u){let f=t;t=s(a),t===f?l[t].p(a,u):(ce(),O(l[f],1,1,()=>{l[f]=null}),de(),n=l[t],n?n.p(a,u):(n=l[t]=o[t](a),n.c()),P(n,1),n.m(r.parentNode,r))},i(a){i||(P(n),i=!0)},o(a){O(n),i=!1},d(a){l[t].d(a),a&&T(r)}}}function cc(e){let t,n,r,i=e[0].length+"",o,l,s,a,u,f,c,d;function g(b,w){return b[2]?mc:pc}let p=g(e),m=p(e),_=e[2]&&Zi(e);return{c(){t=k("div"),n=k("h5"),r=z("📖 Response Sources ("),o=z(i),l=z(")"),s=I(),m.c(),a=I(),_&&_.c(),u=Fe(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(b,w){x(b,t,w),v(t,n),v(n,r),v(n,o),v(n,l),v(t,s),m.m(t,null),x(b,a,w),_&&_.m(b,w),x(b,u,w),f=!0,c||(d=U(t,"click",e[3]),c=!0)},p(b,w){(!f||w&1)&&i!==(i=b[0].length+"")&&Q(o,i),p!==(p=g(b))&&(m.d(1),m=p(b),m&&(m.c(),m.m(t,null))),b[2]?_?(_.p(b,w),w&4&&P(_,1)):(_=Zi(b),_.c(),P(_,1),_.m(u.parentNode,u)):_&&(ce(),O(_,1,1,()=>{_=null}),de())},i(b){f||(P(_),f=!0)},o(b){O(_),f=!1},d(b){b&&T(t),m.d(),b&&T(a),_&&_.d(b),b&&T(u),c=!1,d()}}}function dc(e){let t;return{c(){t=k("h5"),t.textContent="⚠ī¸ No sources loaded",h(t,"class","bold")},m(n,r){x(n,t,r)},p:q,i:q,o:q,d(n){n&&T(t)}}}function gc(e){let t;return{c(){t=k("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,r){x(n,t,r)},p:q,i:q,o:q,d(n){n&&T(t)}}}function hc(e){let t;return{c(){t=k("h5"),t.textContent="⚠ī¸ No Retrieval Sources selected",h(t,"class","bold")},m(n,r){x(n,t,r)},p:q,i:q,o:q,d(n){n&&T(t)}}}function pc(e){let t;return{c(){t=k("span"),t.textContent="⌄"},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function mc(e){let t;return{c(){t=k("span"),t.textContent="⌃"},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function Zi(e){let t,n,r=e[0],i=[];for(let l=0;lO(i[l],1,1,()=>{i[l]=null});return{c(){for(let l=0;l{r=null}),de())},i(i){n||(P(r),n=!0)},o(i){O(r),n=!1},d(i){i&&T(t),r&&r.d()}}}function vc(e,t,n){let{sources:r=[]}=t,{source_content:i=[]}=t,o=!1;const l=()=>n(2,o=!o);return e.$$set=s=>{"sources"in s&&n(0,r=s.sources),"source_content"in s&&n(1,i=s.source_content)},[r,i,o,l]}class bc extends ue{constructor(t){super(),fe(this,t,vc,_c,ae,{sources:0,source_content:1})}}function to(e,t,n){const r=e.slice();return r[4]=t[n],r}function no(e,t,n){const r=e.slice();return r[4]=t[n],r}function ro(e){let t,n,r,i=e[4].label+"",o,l,s,a,u;return{c(){t=k("li"),n=k("span"),r=k("h5"),o=z(i),l=I(),h(r,"class","bold"),h(n,"class","svelte-iwm583"),h(t,"class",s=Ti(e[0]===e[4].value?"active":"")+" svelte-iwm583")},m(f,c){x(f,t,c),v(t,n),v(n,r),v(r,o),v(t,l),a||(u=U(n,"click",function(){Ue(e[3](e[4].value))&&e[3](e[4].value).apply(this,arguments)}),a=!0)},p(f,c){e=f,c&2&&i!==(i=e[4].label+"")&&Q(o,i),c&3&&s!==(s=Ti(e[0]===e[4].value?"active":"")+" svelte-iwm583")&&h(t,"class",s)},d(f){f&&T(t),a=!1,u()}}}function io(e){let t,n,r,i;const o=[e[2]];var l=e[4].component;function s(a){let u={};for(let f=0;f{Z(c,1)}),de()}l?(n=bt(l,s()),ee(n.$$.fragment),P(n.$$.fragment,1),J(n,t,r)):n=null}else l&&n.$set(f)},i(a){i||(n&&P(n.$$.fragment,a),i=!0)},o(a){n&&O(n.$$.fragment,a),i=!1},d(a){a&&T(t),n&&Z(n)}}}function oo(e){let t,n,r=e[0]==e[4].value&&io(e);return{c(){r&&r.c(),t=Fe()},m(i,o){r&&r.m(i,o),x(i,t,o),n=!0},p(i,o){i[0]==i[4].value?r?(r.p(i,o),o&3&&P(r,1)):(r=io(i),r.c(),P(r,1),r.m(t.parentNode,t)):r&&(ce(),O(r,1,1,()=>{r=null}),de())},i(i){n||(P(r),n=!0)},o(i){O(r),n=!1},d(i){r&&r.d(i),i&&T(t)}}}function wc(e){let t,n,r,i,o=e[1],l=[];for(let f=0;fO(a[f],1,1,()=>{a[f]=null});return{c(){t=k("ul");for(let f=0;f()=>n(0,i=s);return e.$$set=s=>{"items"in s&&n(1,r=s.items),"activeTabValue"in s&&n(0,i=s.activeTabValue),"tabProps"in s&&n(2,o=s.tabProps)},[i,r,o,l]}class Sc extends ue{constructor(t){super(),fe(this,t,yc,wc,ae,{items:1,activeTabValue:0,tabProps:2})}}function lo(e){let t;return{c(){t=z("Press ENTER to autofill with the RAG answer.")},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function kc(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p=e[0].edited_answer===Kn&&lo();return{c(){t=k("form"),n=k("textarea"),i=I(),o=k("div"),l=k("div"),p&&p.c(),s=I(),a=k("div"),u=k("button"),u.textContent="Update",f=I(),c=k("button"),c.textContent="Reset",h(n,"placeholder",r=e[0].answer),h(l,"class","note svelte-i9wciy"),h(o,"class","button-container svelte-i9wciy")},m(m,_){x(m,t,_),v(t,n),rt(n,e[0].edited_answer),e[6](n),v(t,i),v(t,o),v(o,l),p&&p.m(l,null),v(o,s),v(o,a),v(a,u),v(a,f),v(a,c),d||(g=[U(n,"input",e[5]),U(n,"keydown",e[4]),U(u,"click",e[2]),U(c,"click",e[3])],d=!0)},p(m,[_]){_&1&&r!==(r=m[0].answer)&&h(n,"placeholder",r),_&1&&rt(n,m[0].edited_answer),m[0].edited_answer===Kn?p||(p=lo(),p.c(),p.m(l,null)):p&&(p.d(1),p=null)},i:q,o:q,d(m){m&&T(t),e[6](null),p&&p.d(),d=!1,me(g)}}}const Kn="";function Cc(e,t,n){let{message:r={}}=t,i;const o=async c=>{const d={id:r.id,new_answer:c},g=await fetch("/chat/rag_table/update_answer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(g.ok)console.log("Answer updated successfully",g),n(0,r.edited_answer=c,r);else{const p=await g.text();alert(p)}},l=c=>{c.preventDefault(),o(r.edited_answer)},s=c=>{c.preventDefault(),o(Kn)},a=c=>{c.key=="Enter"&&r.edited_answer===Kn&&(c.preventDefault(),console.log("ENTER"),n(0,r.edited_answer=r.answer,r))};ct(function(){i.focus()});function u(){r.edited_answer=this.value,n(0,r)}function f(c){mn[c?"unshift":"push"](()=>{i=c,n(1,i)})}return e.$$set=c=>{"message"in c&&n(0,r=c.message)},[r,i,l,s,a,u,f]}class $c extends ue{constructor(t){super(),fe(this,t,Cc,kc,ae,{message:0})}}function so(e){let t,n,r,i,o,l;return{c(){t=k("div"),n=k("button"),n.textContent="👍",r=I(),i=k("button"),i.textContent="👎",h(n,"class","small-button thumbs-up svelte-1u8cd0w"),h(i,"class","small-button thumbs-down svelte-1u8cd0w"),h(t,"class","feedback-buttons svelte-1u8cd0w")},m(s,a){x(s,t,a),v(t,n),v(t,r),v(t,i),o||(l=[U(n,"click",e[4]),U(i,"click",e[5])],o=!0)},p:q,d(s){s&&T(t),o=!1,me(l)}}}function Rc(e){let t,n=e[0].answer+"",r,i,o,l=e[1]&&so(e);return{c(){t=k("div"),r=z(n),i=I(),l&&l.c(),o=Fe()},m(s,a){x(s,t,a),v(t,r),x(s,i,a),l&&l.m(s,a),x(s,o,a)},p(s,[a]){a&1&&n!==(n=s[0].answer+"")&&Q(r,n),s[1]?l?l.p(s,a):(l=so(s),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null)},i:q,o:q,d(s){s&&T(t),s&&T(i),l&&l.d(s),s&&T(o)}}}async function Ac(e){const t=await fetch("/chat/rag_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)console.log("response",t);else{const n=await t.text();alert(n)}}function Ec(e,t,n){let r;ne(e,Oe,f=>n(6,r=f));let{message:i={}}=t,{feedback:o=!1}=t,{index:l=0}=t;function s(f,c,d){const g=r[d];g.vote=c;const p={id:d+1,vote_status:c};Ac(p),ut(f.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),ut(f.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}const a=f=>s(f,"up",l),u=f=>s(f,"down",l);return e.$$set=f=>{"message"in f&&n(0,i=f.message),"feedback"in f&&n(1,o=f.feedback),"index"in f&&n(2,l=f.index)},[i,o,l,s,a,u]}class Mc extends ue{constructor(t){super(),fe(this,t,Ec,Rc,ae,{message:0,feedback:1,index:2})}}function ao(e,t,n){const r=e.slice();return r[16]=t[n],r[18]=n,r}function uo(e,t){let n,r,i,o,l,s,a,u,f,c=t[16].question+"",d,g,p,m,_,b,w,C,E,R,A,y,$,S,F,N;return E=new Sc({props:{items:t[7],tabProps:{message:t[16],feedback:t[0],index:t[18]}}}),A=new bc({props:{sources:t[16].source,source_content:t[16].source_content}}),{key:e,first:null,c(){n=k("div"),r=k("div"),i=k("div"),o=I(),l=k("div"),s=k("div"),a=k("h5"),a.textContent="Question:",u=I(),f=k("p"),d=z(c),g=I(),p=k("div"),m=k("p"),m.textContent="ℹī¸ Retrieval Sources",b=I(),w=k("div"),C=k("div"),ee(E.$$.fragment),R=I(),ee(A.$$.fragment),y=I(),h(i,"class","avatar"),h(a,"class","bold"),h(m,"class","bold"),h(p,"class","rag-sources svelte-aj7hp0"),h(s,"class","question svelte-aj7hp0"),h(C,"class","answer svelte-aj7hp0"),h(w,"class","answers svelte-aj7hp0"),h(l,"class","message-content svelte-aj7hp0"),h(r,"class","chat-message-center svelte-aj7hp0"),h(n,"class","chat-message svelte-aj7hp0"),this.first=n},m(M,D){x(M,n,D),v(n,r),v(r,i),v(r,o),v(r,l),v(l,s),v(s,a),v(s,u),v(s,f),v(f,d),v(s,g),v(s,p),v(p,m),v(l,b),v(l,w),v(w,C),J(E,C,null),v(l,R),J(A,l,null),v(n,y),S=!0,F||(N=[Bt(_=Ns.call(null,m,fo(t[16]))),Bt($=Dc.call(null,n,t[18]===t[4].length-1))],F=!0)},p(M,D){t=M,(!S||D&16)&&c!==(c=t[16].question+"")&&Q(d,c),_&&Ue(_.update)&&D&16&&_.update.call(null,fo(t[16]));const L={};D&17&&(L.tabProps={message:t[16],feedback:t[0],index:t[18]}),E.$set(L);const ge={};D&16&&(ge.sources=t[16].source),D&16&&(ge.source_content=t[16].source_content),A.$set(ge),$&&Ue($.update)&&D&16&&$.update.call(null,t[18]===t[4].length-1)},i(M){S||(P(E.$$.fragment,M),P(A.$$.fragment,M),S=!0)},o(M){O(E.$$.fragment,M),O(A.$$.fragment,M),S=!1},d(M){M&&T(n),Z(E),Z(A),F=!1,me(N)}}}function Fc(e){let t,n,r,i,o,l,s=[],a=new Map,u,f,c,d,g,p,m,_,b,w=(e[2]?e[3]:"Send")+"",C,E,R,A,y,$,S,F=e[4];const N=M=>M[18];for(let M=0;MVote Feedback Instructions +

Ask a question to receive an answer from the chatbot. If the response is + satisfactory, click on the 👍 + button. If the response is not satisfactory, click on the + 👎 button.

`,r=I(),i=k("div"),o=k("section"),l=k("div");for(let M=0;M{e.scrollIntoView({behavior:"smooth"})},0)}function fo(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Ic(e,t,n){let r,i,o,l;ne(e,Oe,C=>n(4,i=C)),ne(e,Qr,C=>n(13,o=C));let{feedback:s=!1}=t,{is_retrieval:a=!1}=t;const u=Re([]);ne(e,u,C=>n(5,l=C));let f="",c="",d=!1,g=[{label:"Answer",value:1,component:Mc},{label:"Modified Answer",value:2,component:$c}];ct(()=>{m(),p()});async function p(){const E=await(await fetch("/retrieval/file/get")).json();console.log("data",E.files);const A=E.files.map((y,$)=>({id:String($),name:y.name}));console.log("files",A),Ne(u,l=[...A],l)}async function m(){const R=(await(await fetch("/chat/rag_table/retrieve")).json()).rows;console.log("Got data from db",R);const A=R.map(y=>({id:y[0],question:y[1],answer:y[2],edited_answer:y[3],vote_status:y[4],rag_sources:y[5],source:y[6],source_content:y[7]}));Ne(Oe,i=[...A],i)}const _=async C=>{C.preventDefault(),f=c,n(1,c=""),n(2,d=!0);const E=[...o];let R={id:i.length+1,question:f,answer:"Loading...",rag_sources:E,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};Ne(Oe,i=[...i,R],i);const A=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f,file_names:E})}):await fetch(`/chat/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:f})});if(A.ok){const y=await A.json();console.log("response data",y),R.answer=y.answer,R.source=y.source,R.source_content=y.source_content,Oe.update($=>($[$.length-1]=R,$))}else{const y=await A.text();alert(y)}n(2,d=!1)};let b=0;setInterval(()=>{n(10,b=(b+1)%4)},200);function w(){c=this.value,n(1,c)}return e.$$set=C=>{"feedback"in C&&n(0,s=C.feedback),"is_retrieval"in C&&n(9,a=C.is_retrieval)},e.$$.update=()=>{e.$$.dirty&1024&&n(3,r=".".repeat(b).padEnd(3))},[s,c,d,r,i,l,u,g,_,a,b,w]}class Nc extends ue{constructor(t){super(),fe(this,t,Ic,Fc,ae,{feedback:0,is_retrieval:9})}}function co(e){let t,n;return t=new yi({props:{is_retrieval:e[1]}}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function go(e){let t,n;return t=new yi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function ho(e){let t,n;return t=new Nc({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function po(e){let t,n,r,i;const o=[Tc,Pc],l=[];function s(a,u){return a[1]?0:1}return t=s(e),n=l[t]=o[t](e),{c(){n.c(),r=Fe()},m(a,u){l[t].m(a,u),x(a,r,u),i=!0},p(a,u){let f=t;t=s(a),t===f?l[t].p(a,u):(ce(),O(l[f],1,1,()=>{l[f]=null}),de(),n=l[t],n?n.p(a,u):(n=l[t]=o[t](a),n.c()),P(n,1),n.m(r.parentNode,r))},i(a){i||(P(n),i=!0)},o(a){O(n),i=!1},d(a){l[t].d(a),a&&T(r)}}}function Pc(e){let t,n;return t=new oc({}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},p:q,i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function Tc(e){let t,n;return t=new yi({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},p(r,i){const o={};i&2&&(o.is_retrieval=r[1]),t.$set(o)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function xc(e){let t,n,r,i,o,l=!e[0]&&co(e),s=e[0]==="vote"&&go(e),a=e[0]==="rag"&&ho(e),u=e[0]==="rank"&&po(e);return{c(){l&&l.c(),t=I(),s&&s.c(),n=I(),a&&a.c(),r=I(),u&&u.c(),i=Fe()},m(f,c){l&&l.m(f,c),x(f,t,c),s&&s.m(f,c),x(f,n,c),a&&a.m(f,c),x(f,r,c),u&&u.m(f,c),x(f,i,c),o=!0},p(f,[c]){f[0]?l&&(ce(),O(l,1,1,()=>{l=null}),de()):l?(l.p(f,c),c&1&&P(l,1)):(l=co(f),l.c(),P(l,1),l.m(t.parentNode,t)),f[0]==="vote"?s?(s.p(f,c),c&1&&P(s,1)):(s=go(f),s.c(),P(s,1),s.m(n.parentNode,n)):s&&(ce(),O(s,1,1,()=>{s=null}),de()),f[0]==="rag"?a?(a.p(f,c),c&1&&P(a,1)):(a=ho(f),a.c(),P(a,1),a.m(r.parentNode,r)):a&&(ce(),O(a,1,1,()=>{a=null}),de()),f[0]==="rank"?u?(u.p(f,c),c&1&&P(u,1)):(u=po(f),u.c(),P(u,1),u.m(i.parentNode,i)):u&&(ce(),O(u,1,1,()=>{u=null}),de())},i(f){o||(P(l),P(s),P(a),P(u),o=!0)},o(f){O(l),O(s),O(a),O(u),o=!1},d(f){l&&l.d(f),f&&T(t),s&&s.d(f),f&&T(n),a&&a.d(f),f&&T(r),u&&u.d(f),f&&T(i)}}}function Oc(e,t,n){let{feedback:r}=t,{is_retrieval:i}=t;return e.$$set=o=>{"feedback"in o&&n(0,r=o.feedback),"is_retrieval"in o&&n(1,i=o.is_retrieval)},[r,i]}class Vc extends ue{constructor(t){super(),fe(this,t,Oc,xc,ae,{feedback:0,is_retrieval:1})}}function mo(e,t,n){const r=e.slice();return r[2]=t[n],r}function _o(e){let t,n=e[2]+"",r,i;return{c(){t=k("option"),r=z(n),t.__value=i=e[2],t.value=t.__value},m(o,l){x(o,t,l),v(t,r)},p(o,l){l&1&&n!==(n=o[2]+"")&&Q(r,n),l&1&&i!==(i=o[2])&&(t.__value=i,t.value=t.__value)},d(o){o&&T(t)}}}function zc(e){let t,n=e[0],r=[];for(let i=0;i{const o=await fetch(`/data/${r}`);n(0,i=await o.json())}),e.$$set=o=>{"data_endpoint"in o&&n(1,r=o.data_endpoint)},[i,r]}class Lc extends ue{constructor(t){super(),fe(this,t,Hc,zc,ae,{data_endpoint:1})}}function qt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function qc(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ps(e){let t,n,r;e.length!==2?(t=qt,n=(s,a)=>qt(e(s),a),r=(s,a)=>e(s)-a):(t=e===qt||e===qc?e:jc,n=e,r=e);function i(s,a,u=0,f=s.length){if(u>>1;n(s[c],a)<0?u=c+1:f=c}while(u>>1;n(s[c],a)<=0?u=c+1:f=c}while(uu&&r(s[c-1],a)>-r(s[c],a)?c-1:c}return{left:i,center:l,right:o}}function jc(){return 0}function Gc(e){return e===null?NaN:+e}function*Bc(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const Uc=Ps(qt),Wc=Uc.right;Ps(Gc).center;const Ts=Wc;function Xc(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function fn(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=o&&(n=r=o):(n>o&&(n=o),r{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function xs(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var ed=Array.prototype,td=ed.slice;function Ar(e){return()=>e}const nd=Math.sqrt(50),rd=Math.sqrt(10),id=Math.sqrt(2);function Jn(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),l=o>=nd?10:o>=rd?5:o>=id?2:1;let s,a,u;return i<0?(u=Math.pow(10,-i)/l,s=Math.round(e*u),a=Math.round(t*u),s/ut&&--a,u=-u):(u=Math.pow(10,i)*l,s=Math.round(e/u),a=Math.round(t/u),s*ut&&--a),a0))return[];if(e===t)return[e];const r=t=i))return[];const s=o-i+1,a=new Array(s);if(r)if(l<0)for(let u=0;u0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function sd(e){return Math.max(1,Math.ceil(Math.log(Xc(e))/Math.LN2)+1)}function Vs(){var e=Jc,t=fn,n=sd;function r(i){Array.isArray(i)||(i=Array.from(i));var o,l=i.length,s,a,u=new Array(l);for(o=0;o=d)if(C>=d&&t===fn){const R=Wt(c,d,E);isFinite(R)&&(R>0?d=(Math.floor(d/R)+1)*R:R<0&&(d=(Math.ceil(d*-R)+1)/-R))}else g.pop()}for(var p=g.length,m=0,_=p;g[m]<=c;)++m;for(;g[_-1]>d;)--_;(m||_0?g[o-1]:c,w.x1=o0)for(o=0;o=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function wo(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function zs(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?xs:Zc(i);r>n;){if(r-n>600){const a=r-n+1,u=t-n+1,f=Math.log(a),c=.5*Math.exp(2*f/3),d=.5*Math.sqrt(f*c*(a-c)/a)*(u-a/2<0?-1:1),g=Math.max(n,Math.floor(t-u*c/a+d)),p=Math.min(r,Math.floor(t+(a-u)*c/a+d));zs(e,t,g,p,i)}const o=e[t];let l=n,s=r;for(en(e,n,t),i(e[r],o)>0&&en(e,n,r);l0;)--s}i(e[n],o)===0?en(e,n,s):(++s,en(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function en(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function ad(e,t,n){if(e=Float64Array.from(Bc(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return wo(e);if(t>=1)return Et(e);var r,i=(r-1)*t,o=Math.floor(i),l=Et(zs(e,o).subarray(0,o+1)),s=wo(e.subarray(o+1));return l+(s-l)*(i-o)}}function ud(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Zn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Xt(e){return e=Zn(Math.abs(e)),e?e[1]:NaN}function cd(e,t){return function(n,r){for(var i=n.length,o=[],l=0,s=e[0],a=0;i>0&&s>0&&(a+s+1>r&&(s=Math.max(1,r-a)),o.push(n.substring(i-=s,i+s)),!((a+=s+1)>r));)s=e[l=(l+1)%e.length];return o.reverse().join(t)}}function dd(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var gd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function er(e){if(!(t=gd.exec(e)))throw new Error("invalid format: "+e);var t;return new Si({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}er.prototype=Si.prototype;function Si(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Si.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function hd(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Hs;function pd(e,t){var n=Zn(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Hs=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return o===l?r:o>l?r+new Array(o-l+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Zn(e,Math.max(0,t+o-1))[0]}function yo(e,t){var n=Zn(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const So={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:fd,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>yo(e*100,t),r:yo,s:pd,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function ko(e){return e}var Co=Array.prototype.map,$o=["y","z","a","f","p","n","Âĩ","m","","k","M","G","T","P","E","Z","Y"];function md(e){var t=e.grouping===void 0||e.thousands===void 0?ko:cd(Co.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?ko:dd(Co.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",a=e.nan===void 0?"NaN":e.nan+"";function u(c){c=er(c);var d=c.fill,g=c.align,p=c.sign,m=c.symbol,_=c.zero,b=c.width,w=c.comma,C=c.precision,E=c.trim,R=c.type;R==="n"?(w=!0,R="g"):So[R]||(C===void 0&&(C=12),E=!0,R="g"),(_||d==="0"&&g==="=")&&(_=!0,d="0",g="=");var A=m==="$"?n:m==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():"",y=m==="$"?r:/[%p]/.test(R)?l:"",$=So[R],S=/[defgprs%]/.test(R);C=C===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function F(N){var M=A,D=y,L,ge,re;if(R==="c")D=$(N)+D,N="";else{N=+N;var Ce=N<0||1/N<0;if(N=isNaN(N)?a:$(Math.abs(N),C),E&&(N=hd(N)),Ce&&+N==0&&p!=="+"&&(Ce=!1),M=(Ce?p==="("?p:s:p==="-"||p==="("?"":p)+M,D=(R==="s"?$o[8+Hs/3]:"")+D+(Ce&&p==="("?")":""),S){for(L=-1,ge=N.length;++Lre||re>57){D=(re===46?i+N.slice(L+1):N.slice(L))+D,N=N.slice(0,L);break}}}w&&!_&&(N=t(N,1/0));var $e=M.length+N.length+D.length,ve=$e>1)+M+N+D+ve.slice($e);break;default:N=ve+M+N+D;break}return o(N)}return F.toString=function(){return c+""},F}function f(c,d){var g=u((c=er(c),c.type="f",c)),p=Math.max(-8,Math.min(8,Math.floor(Xt(d)/3)))*3,m=Math.pow(10,-p),_=$o[8+p/3];return function(b){return g(m*b)+_}}return{format:u,formatPrefix:f}}var En,Dt,Ls;_d({thousands:",",grouping:[3],currency:["$",""]});function _d(e){return En=md(e),Dt=En.format,Ls=En.formatPrefix,En}function vd(e){return Math.max(0,-Xt(Math.abs(e)))}function bd(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Xt(t)/3)))*3-Xt(Math.abs(e)))}function wd(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Xt(t)-Xt(e))+1}function ki(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const Ro=Symbol("implicit");function mr(){var e=new vo,t=[],n=[],r=Ro;function i(o){let l=e.get(o);if(l===void 0){if(r!==Ro)return r;e.set(o,l=t.push(o)-1)}return n[l%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new vo;for(const l of o)e.has(l)||e.set(l,t.push(l)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return mr(t,n).unknown(r)},ki.apply(i,arguments),i}function Ci(){var e=mr().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,l,s=!1,a=0,u=0,f=.5;delete e.unknown;function c(){var d=t().length,g=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Sd.exec(e))?new Ve(t[1],t[2],t[3],1):(t=kd.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cd.exec(e))?Mn(t[1],t[2],t[3],t[4]):(t=$d.exec(e))?Mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Rd.exec(e))?No(t[1],t[2]/100,t[3]/100,1):(t=Ad.exec(e))?No(t[1],t[2]/100,t[3]/100,t[4]):Ao.hasOwnProperty(e)?Fo(Ao[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function Fo(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function Mn(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ve(e,t,n,r)}function Fd(e){return e instanceof Sn||(e=wn(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function Zr(e,t,n,r){return arguments.length===1?Fd(e):new Ve(e,t,n,r??1)}function Ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$i(Ve,Zr,qs(Sn,{brighter(e){return e=e==null?tr:Math.pow(tr,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vn:Math.pow(vn,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(Rt(this.r),Rt(this.g),Rt(this.b),nr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Do,formatHex:Do,formatHex8:Dd,formatRgb:Io,toString:Io}));function Do(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}`}function Dd(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}${Ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function Io(){const e=nr(this.opacity);return`${e===1?"rgb(":"rgba("}${Rt(this.r)}, ${Rt(this.g)}, ${Rt(this.b)}${e===1?")":`, ${e})`}`}function nr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Rt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ct(e){return e=Rt(e),(e<16?"0":"")+e.toString(16)}function No(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ye(e,t,n,r)}function js(e){if(e instanceof Ye)return new Ye(e.h,e.s,e.l,e.opacity);if(e instanceof Sn||(e=wn(e)),!e)return new Ye;if(e instanceof Ye)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,s=o-i,a=(o+i)/2;return s?(t===o?l=(n-r)/s+(n0&&a<1?0:l,new Ye(l,s,a,e.opacity)}function Id(e,t,n,r){return arguments.length===1?js(e):new Ye(e,t,n,r??1)}function Ye(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$i(Ye,Id,qs(Sn,{brighter(e){return e=e==null?tr:Math.pow(tr,e),new Ye(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vn:Math.pow(vn,e),new Ye(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ve(Er(e>=240?e-240:e+120,i,r),Er(e,i,r),Er(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ye(Po(this.h),Fn(this.s),Fn(this.l),nr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=nr(this.opacity);return`${e===1?"hsl(":"hsla("}${Po(this.h)}, ${Fn(this.s)*100}%, ${Fn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Po(e){return e=(e||0)%360,e<0?e+360:e}function Fn(e){return Math.max(0,Math.min(1,e||0))}function Er(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ri=e=>()=>e;function Nd(e,t){return function(n){return e+n*t}}function Pd(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Td(e){return(e=+e)==1?Gs:function(t,n){return n-t?Pd(t,n,e):Ri(isNaN(t)?n:t)}}function Gs(e,t){var n=t-e;return n?Nd(e,n):Ri(isNaN(e)?t:e)}const To=function e(t){var n=Td(t);function r(i,o){var l=n((i=Zr(i)).r,(o=Zr(o)).r),s=n(i.g,o.g),a=n(i.b,o.b),u=Gs(i.opacity,o.opacity);return function(f){return i.r=l(f),i.g=s(f),i.b=a(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function xd(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),s[l]?s[l]+=o:s[++l]=o),(r=r[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,a.push({i:l,x:rr(r,i)})),n=Mr.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Xd(e,t,n){var r=e[0],i=e[1],o=t[0],l=t[1];return i2?Yd:Xd,a=u=null,c}function c(d){return d==null||isNaN(d=+d)?o:(a||(a=s(e.map(r),t,n)))(r(l(d)))}return c.invert=function(d){return l(i((u||(u=s(t,e.map(r),rr)))(d)))},c.domain=function(d){return arguments.length?(e=Array.from(d,Ud),f()):e.slice()},c.range=function(d){return arguments.length?(t=Array.from(d),f()):t.slice()},c.rangeRound=function(d){return t=Array.from(d),n=Gd,f()},c.clamp=function(d){return arguments.length?(l=d?!0:Vt,f()):l!==Vt},c.interpolate=function(d){return arguments.length?(n=d,f()):n},c.unknown=function(d){return arguments.length?(o=d,c):o},function(d,g){return r=d,i=g,f()}}function Jd(){return Kd()(Vt,Vt)}function Zd(e,t,n,r){var i=od(e,t,n),o;switch(r=er(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=bd(i,l))&&(r.precision=o),Ls(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=wd(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=vd(i))&&(r.precision=o-(r.type==="%")*2);break}}return Dt(r)}function eg(e){var t=e.domain;return e.ticks=function(n){var r=t();return Os(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Zd(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,l=r[i],s=r[o],a,u,f=10;for(s0;){if(u=Wt(l,s,n),u===a)return r[i]=l,r[o]=s,t(r);if(u>0)l=Math.floor(l/u)*u,s=Math.ceil(s/u)*u;else if(u<0)l=Math.ceil(l*u)/u,s=Math.floor(s*u)/u;else break;a=u}return e},e}function Qe(){var e=Jd();return e.copy=function(){return Qd(e,Qe())},ki.apply(e,arguments),eg(e)}function Dn(e){return function(){return e}}function tg(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ni(e,t){if((l=e.length)>1)for(var n=1,r,i,o=e[t[0]],l,s=o.length;n=0;)n[t]=t;return n}function ng(e,t){return e[t]}function rg(e){const t=[];return t.key=e,t}function ig(){var e=Dn([]),t=ri,n=ni,r=ng;function i(o){var l=Array.from(e.apply(this,arguments),rg),s,a=l.length,u=-1,f;for(const c of o)for(s=0,++u;sFeedback Distribution

",n=I(),r=k("div"),i=X("svg");for(let a=0;ae[19].call(r))},m(a,u){x(a,t,u),x(a,n,u),x(a,r,u),v(r,i);for(let f=0;fn(15,c=$)),ne(e,zi,$=>n(4,d=$)),ne(e,Oe,$=>n(16,g=$));let p=300,m=300;const _={up:2,down:1,"n/a":0,all:"all"},b={top:10,bottom:10,left:25,right:5},w=mr().range(["var(--yellow)","var(--red)","var(--green)"]),C=Dt(".0%");function E($,S){r===$?n(5,r="all"):n(5,r=$),Ne(it,c=r==="all"?"all":S,c)}const R=($,S)=>E($,S.key),A=($,S)=>E($,S.key);function y(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,r=_[c]),e.$$.dirty&2&&n(3,i=m-b.left-b.right),e.$$.dirty&1&&n(14,o=p-b.top-b.bottom),e.$$.dirty&65552&&g.forEach($=>{Ne(zi,d[$.vote_status]++,d)}),e.$$.dirty&16&&n(2,l=d.up+d.down+d["n/a"]),e.$$.dirty&16384&&n(8,s=Ci().rangeRound([b.top,o-b.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=Qe().rangeRound([b.left,i-b.right]).domain([0,l])),e.$$.dirty&8208&&n(6,f=u([d]))},n(13,u=ig().keys(["n/a","down","up"]).order(ri).offset(ni)),[p,m,l,i,d,r,f,a,s,b,w,C,E,u,o,c,g,R,A,y]}class Bs extends ue{constructor(t){super(),fe(this,t,lg,og,ae,{})}}function sg(e){let t,n,r,i,o,l,s,a,u,f,c,d=e[3][e[2]]+"",g,p;return{c(){t=k("div"),n=k("div"),r=z("Q: "),i=z(e[0]),o=I(),l=k("div"),s=z("A: "),a=z(e[1]),u=I(),f=k("div"),c=z("Rating: "),g=z(d),h(n,"class","question svelte-szi0e"),h(l,"class","answer svelte-szi0e"),h(f,"class",p="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(m,_){x(m,t,_),v(t,n),v(n,r),v(n,i),v(t,o),v(t,l),v(l,s),v(l,a),v(t,u),v(t,f),v(f,c),v(f,g)},p(m,[_]){_&1&&Q(i,m[0]),_&2&&Q(a,m[1]),_&4&&d!==(d=m[3][m[2]]+"")&&Q(g,d),_&4&&p!==(p="feedback "+m[2]+" svelte-szi0e")&&h(f,"class",p)},i:q,o:q,d(m){m&&T(t)}}}function ag(e,t,n){let{question:r="What is gradient descent?"}=t,{answer:i="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:o="Good: 👍"}=t;const l={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=s=>{"question"in s&&n(0,r=s.question),"answer"in s&&n(1,i=s.answer),"feedback"in s&&n(2,o=s.feedback)},[r,i,o,l]}class ug extends ue{constructor(t){super(),fe(this,t,ag,sg,ae,{question:0,answer:1,feedback:2})}}function Lo(e,t,n){const r=e.slice();return r[5]=t[n].question,r[6]=t[n].answer,r[7]=t[n].vote_status,r}function qo(e){let t,n,r,i,o;return n=new ug({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=k("div"),ee(n.$$.fragment),r=I()},m(l,s){x(l,t,s),J(n,t,null),v(t,r),o=!0},p(l,s){const a={};s&1&&(a.question=l[5]),s&1&&(a.answer=l[6]),s&1&&(a.feedback=l[7]),n.$set(a)},i(l){o||(P(n.$$.fragment,l),l&&ke(()=>{o&&(i||(i=Be(t,e[1],{duration:300},!0)),i.run(1))}),o=!0)},o(l){O(n.$$.fragment,l),l&&(i||(i=Be(t,e[1],{duration:300},!1)),i.run(0)),o=!1},d(l){l&&T(t),Z(n),l&&i&&i.end()}}}function fg(e){let t,n,r=e[0],i=[];for(let l=0;lO(i[l],1,1,()=>{i[l]=null});return{c(){t=k("div");for(let l=0;ln(4,i=a)),ne(e,it,a=>n(2,o=a)),ne(e,_n,a=>n(3,l=a));const s=(a,{delay:u=0,duration:f=1e3,easing:c=vi})=>At(a,{delay:u,duration:f,easing:c});return e.$$.update=()=>{e.$$.dirty&12&&n(0,r=o==="all"?l:l.filter(a=>a.vote_status===o)),e.$$.dirty&1&&Ne(Yr,i=Xf(r),i)},[r,s,o,l]}class Us extends ue{constructor(t){super(),fe(this,t,cg,fg,ae,{})}}function jo(e,t,n){const r=e.slice();return r[13]=t[n],r}function Go(e,t,n){const r=e.slice();return r[16]=t[n],r}function Bo(e,t,n){const r=e.slice();return r[16]=t[n],r}function Uo(e){let t,n,r,i,o=e[16]+"",l,s;return{c(){t=X("g"),n=X("line"),i=X("text"),l=z(o),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-1oikip4"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(a,u){x(a,t,u),v(t,n),v(t,i),v(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[10].bottom+a[10].top)&&h(n,"y2",r),u&16&&o!==(o=a[16]+"")&&Q(l,o),u&84&&s!==(s=`translate(${a[6](a[16])+a[6].bandwidth()/2} ${a[2]-a[10].bottom})`)&&h(t,"transform",s)},d(a){a&&T(t)}}}function Wo(e){let t,n,r,i;return{c(){t=X("g"),n=X("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",r=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",i=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(o,l){x(o,t,l),v(t,n)},p(o,l){l&8&&r!==(r=o[3]-o[10].right-o[10].left)&&h(n,"x2",r),l&32&&i!==(i=`translate(${o[10].left} ${o[5](o[16])+0})`)&&h(t,"transform",i)},d(o){o&&T(t)}}}function Xo(e){let t,n,r,i,o,l,s,a,u=Math.round(e[11](e[13].count))+"",f,c,d;return{c(){t=X("g"),n=X("rect"),a=X("text"),f=z(u),h(n,"x",r=e[6](e[13].question)),h(n,"y",i=e[5](e[13].count)),h(n,"height",o=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",l=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",s=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(a,"class","axis-text svelte-1oikip4"),h(a,"x",c=e[6](e[13].question)+e[6].bandwidth()/2),h(a,"y",d=e[5](e[13].count)-5),h(a,"text-anchor","middle"),h(t,"class","series")},m(g,p){x(g,t,p),v(t,n),v(t,a),v(a,f)},p(g,p){p&80&&r!==(r=g[6](g[13].question))&&h(n,"x",r),p&48&&i!==(i=g[5](g[13].count))&&h(n,"y",i),p&52&&o!==(o=g[2]-g[5](g[13].count)-g[10].bottom)&&h(n,"height",o),p&128&&l!==(l=g[9][g[7]])&&h(n,"fill",l),p&64&&s!==(s=g[6].bandwidth())&&h(n,"width",s),p&16&&u!==(u=Math.round(g[11](g[13].count))+"")&&Q(f,u),p&80&&c!==(c=g[6](g[13].question)+g[6].bandwidth()/2)&&h(a,"x",c),p&48&&d!==(d=g[5](g[13].count)-5)&&h(a,"y",d)},d(g){g&&T(t)}}}function dg(e){let t,n,r,i,o,l,s=e[8][e[7]]+"",a,u,f,c,d,g,p,m,_,b=e[4].map(Yo),w=[];for(let y=0;ye[12].call(t))},m(y,$){x(y,t,$),v(t,n);for(let S=0;Se.question;function gg(e,t,n){let r,i,o,l,s,a;ne(e,Yr,_=>n(4,s=_)),ne(e,it,_=>n(7,a=_));const u={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},f={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let c=300,d=300,g={top:35,bottom:10,left:25,right:5};const p=Dt(".1f");function m(){d=this.offsetWidth,c=this.offsetHeight,n(1,d),n(0,c)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,r=d-g.left-g.right),e.$$.dirty&1&&n(2,i=c-g.top-g.bottom),e.$$.dirty&24&&n(6,o=Ci().rangeRound([g.left,r-g.right]).padding(.05).domain(s.map(_=>_.question))),e.$$.dirty&20&&n(5,l=Qe().rangeRound([i-g.bottom,g.top]).domain([0,Et(s,_=>_.count)])),e.$$.dirty&16&&console.log(s)},[c,d,i,r,s,l,o,a,u,f,g,p,m]}class Ws extends ue{constructor(t){super(),fe(this,t,gg,dg,ae,{})}}function Qo(e,t,n){const r=e.slice();r[19]=t[n];const i=r[7](r[19].x1)-r[7](r[19].x0);return r[20]=i,r}function Ko(e,t,n){const r=e.slice();return r[23]=t[n],r}function Jo(e){let t,n,r,i,o=e[23]+"",l,s;return{c(){t=X("g"),n=X("line"),i=X("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){x(a,t,u),v(t,n),v(t,i),v(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[23]+"")&&Q(l,o),u&132&&s!==(s=`translate(${a[7](a[23])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&T(t)}}}function Zo(e){let t,n,r,i,o,l,s;return{c(){t=X("g"),n=X("rect"),h(n,"x",r=e[7](e[19].x0)+1),h(n,"width",i=e[20]),h(n,"y",o=e[6](e[19].length)),h(n,"height",l=e[6](0)-e[6](e[19].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){x(a,t,u),v(t,n)},p(a,u){u&136&&r!==(r=a[7](a[19].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[20])&&h(n,"width",i),u&72&&o!==(o=a[6](a[19].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[19].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&T(t)}}}function hg(e){let t,n,r,i,o,l,s,a,u,f,c,d=e[7].ticks(),g=[];for(let _=0;_e[14].call(t))},m(_,b){x(_,t,b),v(t,n);for(let w=0;wn(5,c=C)),ne(e,Oe,C=>n(13,d=C));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let p=300,m=300,_={top:15,bottom:10,left:25,right:5};Dt(".1f");let b=Array.from({length:el},(C,E)=>E);function w(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,r=c==="all"?d:d.filter(C=>C.vote_status===c)),e.$$.dirty&4096&&n(11,i=Is(r)),e.$$.dirty&2&&n(4,o=m-_.left-_.right),e.$$.dirty&1&&n(2,l=p-_.top-_.bottom),e.$$.dirty&2048&&n(3,s=Vs().thresholds(b).value(C=>C.answer)(i)),e.$$.dirty&16&&n(7,a=Qe().domain([3,el]).range([_.left,o-_.right])),e.$$.dirty&12&&n(6,u=Qe().domain([0,Et(s,C=>C.length)]).range([l-_.bottom,_.top])),e.$$.dirty&2048&&n(10,f=Et(i,C=>C.length)),e.$$.dirty&1056&&Qe().domain([0,f]).range(["white",g[c]]).interpolate(_r)},[p,m,l,s,o,c,u,a,g,_,f,i,r,d,w]}class Xs extends ue{constructor(t){super(),fe(this,t,pg,hg,ae,{})}}function tl(e,t,n){const r=e.slice();r[18]=t[n];const i=r[7](r[18].x1)-r[7](r[18].x0);return r[19]=i,r}function nl(e,t,n){const r=e.slice();return r[22]=t[n],r}function rl(e){let t,n,r,i,o=e[22]+"",l,s;return{c(){t=X("g"),n=X("line"),i=X("text"),l=z(o),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",r=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(i,"class","axis-text svelte-kz2qh6"),h(i,"y","15"),h(i,"text-anchor","middle"),h(t,"transform",s=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,u){x(a,t,u),v(t,n),v(t,i),v(i,l)},p(a,u){u&4&&r!==(r=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",r),u&128&&o!==(o=a[22]+"")&&Q(l,o),u&132&&s!==(s=`translate(${a[7](a[22])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",s)},d(a){a&&T(t)}}}function il(e){let t,n,r,i,o,l,s;return{c(){t=X("g"),n=X("rect"),h(n,"x",r=e[7](e[18].x0)+1),h(n,"width",i=e[19]),h(n,"y",o=e[6](e[18].length)),h(n,"height",l=e[6](0)-e[6](e[18].length)),h(n,"fill",s=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,u){x(a,t,u),v(t,n)},p(a,u){u&136&&r!==(r=a[7](a[18].x0)+1)&&h(n,"x",r),u&136&&i!==(i=a[19])&&h(n,"width",i),u&72&&o!==(o=a[6](a[18].length))&&h(n,"y",o),u&72&&l!==(l=a[6](0)-a[6](a[18].length))&&h(n,"height",l),u&32&&s!==(s=a[8][a[5]])&&h(n,"fill",s)},d(a){a&&T(t)}}}function mg(e){let t,n,r,i,o,l,s,a,u,f,c,d=e[7].ticks(),g=[];for(let _=0;_e[13].call(t))},m(_,b){x(_,t,b),v(t,n);for(let w=0;wn(5,f=w)),ne(e,Oe,w=>n(12,c=w));const d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let g=300,p=300,m={top:15,bottom:10,left:25,right:5},_=Array.from({length:ol},(w,C)=>C);mr().range(["var(--yellow)","var(--red)","var(--green)"]);function b(){p=this.offsetWidth,g=this.offsetHeight,n(1,p),n(0,g)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,r=f==="all"?c:c.filter(w=>w.vote_status===f)),e.$$.dirty&2048&&n(10,i=Is(r)),e.$$.dirty&2&&n(4,o=p-m.left-m.right),e.$$.dirty&1&&n(2,l=g-m.top-m.bottom),e.$$.dirty&1024&&n(3,s=Vs().thresholds(_).value(w=>w.question)(i)),e.$$.dirty&16&&n(7,a=Qe().domain([3,ol]).range([m.left,o-m.right])),e.$$.dirty&12&&n(6,u=Qe().domain([0,Et(s,w=>w.length)]).range([l-m.bottom,m.top])),e.$$.dirty&1024&&Et(i,w=>w.length)},[g,p,l,s,o,f,u,a,d,m,i,r,c,b]}class Ys extends ue{constructor(t){super(),fe(this,t,_g,mg,ae,{})}}function vg(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p=Math.round(e[5](e[3]))+"",m,_,b,w,C,E,R,A;return{c(){t=k("div"),n=k("div"),r=k("p"),r.textContent="Questions",i=I(),o=k("select"),l=k("option"),l.textContent="All",s=k("option"),s.textContent="Good",a=k("option"),a.textContent="Bad",u=k("option"),u.textContent="N/A",f=I(),c=k("div"),d=X("svg"),g=X("text"),m=z(p),C=I(),E=k("p"),E.textContent="number of responses",h(r,"class","card-text svelte-1pknxov"),l.__value="all",l.value=l.__value,h(l,"class","svelte-1pknxov"),s.__value="up",s.value=s.__value,h(s,"class","svelte-1pknxov"),a.__value="down",a.value=a.__value,h(a,"class","svelte-1pknxov"),u.__value="n/a",u.value=u.__value,h(u,"class","svelte-1pknxov"),h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Me(o,"background",e[6][e[0]]),h(o,"class","svelte-1pknxov"),e[0]===void 0&&ke(()=>e[9].call(o)),h(n,"class","svelte-1pknxov"),h(g,"dominant-baseline","middle"),h(g,"x",_=e[2]/2),h(g,"y",b=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-1pknxov"),h(d,"width",e[2]),h(d,"height",e[1]),h(d,"class","svelte-1pknxov"),h(c,"class","svelte-1pknxov"),ke(()=>e[10].call(c)),h(E,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Me(t,"background",e[6][e[0]])},m(y,$){x(y,t,$),v(t,n),v(n,r),v(n,i),v(n,o),v(o,l),v(o,s),v(o,a),v(o,u),Wn(o,e[0],!0),v(t,f),v(t,c),v(c,d),v(d,g),v(g,m),w=Ft(c,e[10].bind(c)),v(t,C),v(t,E),R||(A=U(o,"change",e[9]),R=!0)},p(y,[$]){$&1&&Me(o,"background",y[6][y[0]]),$&1&&Wn(o,y[0]),$&8&&p!==(p=Math.round(y[5](y[3]))+"")&&Q(m,p),$&4&&_!==(_=y[2]/2)&&h(g,"x",_),$&2&&b!==(b=y[1]/2)&&h(g,"y",b),$&4&&h(d,"width",y[2]),$&2&&h(d,"height",y[1]),$&1&&Me(t,"background",y[6][y[0]])},i:q,o:q,d(y){y&&T(t),w(),R=!1,A()}}}function bg(e,t){return t==="all"?e.length:e.filter(r=>r.vote_status===t).length}function wg(e,t,n){let r,i,o,l;ne(e,it,p=>n(0,i=p)),ne(e,Oe,p=>n(8,o=p));let s,a,u=bi(0);ne(e,u,p=>n(3,l=p));const f=Dt(".1f"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function d(){i=gs(this),it.set(i)}function g(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=bg(o,i)),e.$$.dirty&128&&console.log("fbc",r),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,d,g]}class Qs extends ue{constructor(t){super(),fe(this,t,wg,vg,ae,{})}}function yg(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p=e[5](e[3])+"",m,_,b,w,C,E,R,A;return{c(){t=k("div"),n=k("div"),r=k("p"),r.textContent="Questions",i=I(),o=k("select"),l=k("option"),l.textContent="All",s=k("option"),s.textContent="Good",a=k("option"),a.textContent="Bad",u=k("option"),u.textContent="N/A",f=I(),c=k("div"),d=X("svg"),g=X("text"),m=z(p),C=I(),E=k("p"),E.textContent="percentage of responses",h(r,"class","card-text svelte-mchgj2"),l.__value="all",l.value=l.__value,s.__value="up",s.value=s.__value,a.__value="down",a.value=a.__value,u.__value="n/a",u.value=u.__value,h(o,"id","feedback-dropdown"),h(o,"name","feedback-dropdown"),Me(o,"background",e[6][e[0]]),h(o,"class","svelte-mchgj2"),e[0]===void 0&&ke(()=>e[9].call(o)),h(g,"dominant-baseline","middle"),h(g,"x",_=e[2]/2),h(g,"y",b=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-mchgj2"),h(d,"width",e[2]),h(d,"height",e[1]),h(d,"class","svelte-mchgj2"),ke(()=>e[10].call(c)),h(E,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Me(t,"background",e[6][e[0]])},m(y,$){x(y,t,$),v(t,n),v(n,r),v(n,i),v(n,o),v(o,l),v(o,s),v(o,a),v(o,u),Wn(o,e[0],!0),v(t,f),v(t,c),v(c,d),v(d,g),v(g,m),w=Ft(c,e[10].bind(c)),v(t,C),v(t,E),R||(A=U(o,"change",e[9]),R=!0)},p(y,[$]){$&1&&Me(o,"background",y[6][y[0]]),$&1&&Wn(o,y[0]),$&8&&p!==(p=y[5](y[3])+"")&&Q(m,p),$&4&&_!==(_=y[2]/2)&&h(g,"x",_),$&2&&b!==(b=y[1]/2)&&h(g,"y",b),$&4&&h(d,"width",y[2]),$&2&&h(d,"height",y[1]),$&1&&Me(t,"background",y[6][y[0]])},i:q,o:q,d(y){y&&T(t),w(),R=!1,A()}}}function Sg(e,t){const n=e.length;return t==="all"?1:e.filter(i=>i.vote_status===t).length/n}function kg(e,t,n){let r,i,o,l;ne(e,it,p=>n(0,i=p)),ne(e,Oe,p=>n(8,o=p));let s,a,u=bi(0);ne(e,u,p=>n(3,l=p));const f=Dt(".1%"),c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function d(){i=gs(this),it.set(i)}function g(){a=this.clientWidth,s=this.clientHeight,n(2,a),n(1,s)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,r=Sg(o,i)),e.$$.dirty&128&&u.set(r)},[i,s,a,l,u,f,c,r,o,d,g]}class Ks extends ue{constructor(t){super(),fe(this,t,kg,yg,ae,{})}}function Cg(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p,m,_,b,w,C,E,R,A,y,$,S,F,N;return o=new Qs({}),a=new Ks({}),c=new Bs({}),p=new Ws({props:{feedback:"Bad"}}),b=new Ys({}),E=new Xs({}),F=new Us({}),{c(){t=k("div"),n=k("div"),r=k("div"),i=k("div"),ee(o.$$.fragment),l=I(),s=k("div"),ee(a.$$.fragment),u=I(),f=k("div"),ee(c.$$.fragment),d=I(),g=k("div"),ee(p.$$.fragment),m=I(),_=k("div"),ee(b.$$.fragment),w=I(),C=k("div"),ee(E.$$.fragment),R=I(),A=k("div"),y=k("div"),y.innerHTML=`
+
`,$=I(),S=k("div"),ee(F.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(s,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(f,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(y,"class","right-chart svelte-14znspc"),h(S,"class","right-table svelte-14znspc"),h(A,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(M,D){x(M,t,D),v(t,n),v(n,r),v(r,i),J(o,i,null),v(r,l),v(r,s),J(a,s,null),v(n,u),v(n,f),J(c,f,null),v(n,d),v(n,g),J(p,g,null),v(n,m),v(n,_),J(b,_,null),v(n,w),v(n,C),J(E,C,null),v(t,R),v(t,A),v(A,y),v(A,$),v(A,S),J(F,S,null),N=!0},p:q,i(M){N||(P(o.$$.fragment,M),P(a.$$.fragment,M),P(c.$$.fragment,M),P(p.$$.fragment,M),P(b.$$.fragment,M),P(E.$$.fragment,M),P(F.$$.fragment,M),N=!0)},o(M){O(o.$$.fragment,M),O(a.$$.fragment,M),O(c.$$.fragment,M),O(p.$$.fragment,M),O(b.$$.fragment,M),O(E.$$.fragment,M),O(F.$$.fragment,M),N=!1},d(M){M&&T(t),Z(o),Z(a),Z(c),Z(p),Z(b),Z(E),Z(F)}}}function $g(e,t,n){let r;ne(e,_n,o=>n(0,r=o)),ct(()=>{i()});async function i(){const a=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[3]}));Ne(_n,r=[...a],r)}return[]}class Js extends ue{constructor(t){super(),fe(this,t,$g,Cg,ae,{})}}/**! + * Sortable 1.15.0 + * @author RubaXa + * @author owenm + * @license MIT + */function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function Eg(e,t){if(e==null)return{};var n=Ag(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Mg="1.15.0";function at(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var dt=at(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),kn=at(/Edge/i),sl=at(/firefox/i),cn=at(/safari/i)&&!at(/chrome/i)&&!at(/android/i),Zs=at(/iP(ad|od|hone)/i),ea=at(/chrome/i)&&at(/android/i),ta={capture:!1,passive:!1};function se(e,t,n){e.addEventListener(t,n,!dt&&ta)}function ie(e,t,n){e.removeEventListener(t,n,!dt&&ta)}function ir(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Fg(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Ze(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&ir(e,t):ir(e,t))||r&&e===n)return e;if(e===n)break}while(e=Fg(e))}return null}var al=/\s+/g;function He(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(al," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(al," ")}}function B(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function Gt(e,t){var n="";if(typeof e=="string")n=e;else do{var r=B(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function na(e,t,n){if(e){var r=e.getElementsByTagName(t),i=0,o=r.length;if(n)for(;i=o:l=i<=o,!l)return r;if(r===nt())break;r=_t(r,!1)}return!1}function Yt(e,t,n,r){for(var i=0,o=0,l=e.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=Eg(r,Vg);Cn.pluginEvent.bind(G)(t,n,ot({dragEl:V,parentEl:_e,ghostEl:Y,rootEl:he,nextEl:kt,lastDownEl:Ln,cloneEl:pe,cloneHidden:pt,dragStarted:on,putSortable:Ae,activeSortable:G.active,originalEvent:i,oldIndex:zt,oldDraggableIndex:gn,newIndex:Le,newDraggableIndex:ht,hideGhostForTarget:ua,unhideGhostForTarget:fa,cloneNowHidden:function(){pt=!0},cloneNowShown:function(){pt=!1},dispatchSortableEvent:function(s){De({sortable:n,name:s,originalEvent:i})}},o))};function De(e){Og(ot({putSortable:Ae,cloneEl:pe,targetEl:V,rootEl:he,oldIndex:zt,oldDraggableIndex:gn,newIndex:Le,newDraggableIndex:ht},e))}var V,_e,Y,he,kt,Ln,pe,pt,zt,Le,gn,ht,In,Ae,Ot=!1,or=!1,lr=[],yt,Xe,Ir,Nr,cl,dl,on,Tt,hn,pn=!1,Nn=!1,qn,Ee,Pr=[],ii=!1,sr=[],vr=typeof document<"u",Pn=Zs,gl=kn||dt?"cssFloat":"float",zg=vr&&!ea&&!Zs&&"draggable"in document.createElement("div"),la=function(){if(vr){if(dt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),sa=function(t,n){var r=B(t),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Yt(t,0,n),l=Yt(t,1,n),s=o&&B(o),a=l&&B(l),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Se(o).width,f=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Se(l).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return l&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return o&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&r[gl]==="none"||l&&r[gl]==="none"&&u+f>i)?"vertical":"horizontal"},Hg=function(t,n,r){var i=r?t.left:t.top,o=r?t.right:t.bottom,l=r?t.width:t.height,s=r?n.left:n.top,a=r?n.right:n.bottom,u=r?n.width:n.height;return i===s||o===a||i+l/2===s+u/2},Lg=function(t,n){var r;return lr.some(function(i){var o=i[qe].options.emptyInsertThreshold;if(!(!o||Ai(i))){var l=Se(i),s=t>=l.left-o&&t<=l.right+o,a=n>=l.top-o&&n<=l.bottom+o;if(s&&a)return r=i}}),r},aa=function(t){function n(o,l){return function(s,a,u,f){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(o==null&&(l||c))return!0;if(o==null||o===!1)return!1;if(l&&o==="clone")return o;if(typeof o=="function")return n(o(s,a,u,f),l)(s,a,u,f);var d=(l?s:a).options.group.name;return o===!0||typeof o=="string"&&o===d||o.join&&o.indexOf(d)>-1}}var r={},i=t.group;(!i||Hn(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=n(i.pull,!0),r.checkPut=n(i.put),r.revertClone=i.revertClone,t.group=r},ua=function(){!la&&Y&&B(Y,"display","none")},fa=function(){!la&&Y&&B(Y,"display","")};vr&&!ea&&document.addEventListener("click",function(e){if(or)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),or=!1,!1},!0);var St=function(t){if(V){t=t.touches?t.touches[0]:t;var n=Lg(t.clientX,t.clientY);if(n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[qe]._onDragOver(r)}}},qg=function(t){V&&V.parentNode[qe]._isOutsideThisEl(t.target)};function G(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=ft({},t),e[qe]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return sa(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(l,s){l.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:G.supportPointer!==!1&&"PointerEvent"in window&&!cn,emptyInsertThreshold:5};Cn.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);aa(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:zg,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?se(e,"pointerdown",this._onTapStart):(se(e,"mousedown",this._onTapStart),se(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(se(e,"dragover",this),se(e,"dragenter",this)),lr.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ft(this,Pg())}G.prototype={constructor:G,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Tt=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,V):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,i=this.options,o=i.preventOnFilter,l=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,f=i.filter;if(Qg(r),!V&&!(/mousedown|pointerdown/.test(l)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&cn&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=Ze(a,i.draggable,r,!1),!(a&&a.animated)&&Ln!==a)){if(zt=Ge(a),gn=Ge(a,i.draggable),typeof f=="function"){if(f.call(this,t,a,this)){De({sortable:n,rootEl:u,name:"filter",targetEl:a,toEl:r,fromEl:r}),Te("filter",n,{evt:t}),o&&t.cancelable&&t.preventDefault();return}}else if(f&&(f=f.split(",").some(function(c){if(c=Ze(u,c.trim(),r,!1),c)return De({sortable:n,rootEl:c,name:"filter",targetEl:a,fromEl:r,toEl:r}),Te("filter",n,{evt:t}),!0}),f)){o&&t.cancelable&&t.preventDefault();return}i.handle&&!Ze(u,i.handle,r,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,n,r){var i=this,o=i.el,l=i.options,s=o.ownerDocument,a;if(r&&!V&&r.parentNode===o){var u=Se(r);if(he=o,V=r,_e=V.parentNode,kt=V.nextSibling,Ln=r,In=l.group,G.dragged=V,yt={target:V,clientX:(n||t).clientX,clientY:(n||t).clientY},cl=yt.clientX-u.left,dl=yt.clientY-u.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,V.style["will-change"]="all",a=function(){if(Te("delayEnded",i,{evt:t}),G.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!sl&&i.nativeDraggable&&(V.draggable=!0),i._triggerDragStart(t,n),De({sortable:i,name:"choose",originalEvent:t}),He(V,l.chosenClass,!0)},l.ignore.split(",").forEach(function(f){na(V,f.trim(),Tr)}),se(s,"dragover",St),se(s,"mousemove",St),se(s,"touchmove",St),se(s,"mouseup",i._onDrop),se(s,"touchend",i._onDrop),se(s,"touchcancel",i._onDrop),sl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,V.draggable=!0),Te("delayStart",this,{evt:t}),l.delay&&(!l.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(kn||dt))){if(G.eventCanceled){this._onDrop();return}se(s,"mouseup",i._disableDelayedDrag),se(s,"touchend",i._disableDelayedDrag),se(s,"touchcancel",i._disableDelayedDrag),se(s,"mousemove",i._delayedDragTouchMoveHandler),se(s,"touchmove",i._delayedDragTouchMoveHandler),l.supportPointer&&se(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,l.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){V&&Tr(V),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ie(t,"mouseup",this._disableDelayedDrag),ie(t,"touchend",this._disableDelayedDrag),ie(t,"touchcancel",this._disableDelayedDrag),ie(t,"mousemove",this._delayedDragTouchMoveHandler),ie(t,"touchmove",this._delayedDragTouchMoveHandler),ie(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?se(document,"pointermove",this._onTouchMove):n?se(document,"touchmove",this._onTouchMove):se(document,"mousemove",this._onTouchMove):(se(V,"dragend",this),se(he,"dragstart",this._onDragStart));try{document.selection?jn(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Ot=!1,he&&V){Te("dragStarted",this,{evt:n}),this.nativeDraggable&&se(document,"dragover",qg);var r=this.options;!t&&He(V,r.dragClass,!1),He(V,r.ghostClass,!0),G.active=this,t&&this._appendGhost(),De({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Xe){this._lastX=Xe.clientX,this._lastY=Xe.clientY,ua();for(var t=document.elementFromPoint(Xe.clientX,Xe.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Xe.clientX,Xe.clientY),t!==n);)n=t;if(V.parentNode[qe]._isOutsideThisEl(t),n)do{if(n[qe]){var r=void 0;if(r=n[qe]._onDragOver({clientX:Xe.clientX,clientY:Xe.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);fa()}},_onTouchMove:function(t){if(yt){var n=this.options,r=n.fallbackTolerance,i=n.fallbackOffset,o=t.touches?t.touches[0]:t,l=Y&&Gt(Y,!0),s=Y&&l&&l.a,a=Y&&l&&l.d,u=Pn&&Ee&&fl(Ee),f=(o.clientX-yt.clientX+i.x)/(s||1)+(u?u[0]-Pr[0]:0)/(s||1),c=(o.clientY-yt.clientY+i.y)/(a||1)+(u?u[1]-Pr[1]:0)/(a||1);if(!G.active&&!Ot){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(De({rootEl:_e,name:"add",toEl:_e,fromEl:he,originalEvent:t}),De({sortable:this,name:"remove",toEl:_e,originalEvent:t}),De({rootEl:_e,name:"sort",toEl:_e,fromEl:he,originalEvent:t}),De({sortable:this,name:"sort",toEl:_e,originalEvent:t})),Ae&&Ae.save()):Le!==zt&&Le>=0&&(De({sortable:this,name:"update",toEl:_e,originalEvent:t}),De({sortable:this,name:"sort",toEl:_e,originalEvent:t})),G.active&&((Le==null||Le===-1)&&(Le=zt,ht=gn),De({sortable:this,name:"end",toEl:_e,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Te("nulling",this),he=V=_e=Y=kt=pe=Ln=pt=yt=Xe=on=Le=ht=zt=gn=Tt=hn=Ae=In=G.dragged=G.ghost=G.clone=G.active=null,sr.forEach(function(t){t.checked=!0}),sr.length=Ir=Nr=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":V&&(this._onDragOver(t),jg(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,r=this.el.children,i=0,o=r.length,l=this.options;ir.right+i||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+i}function Wg(e,t,n,r,i,o,l,s){var a=r?e.clientY:e.clientX,u=r?n.height:n.width,f=r?n.top:n.left,c=r?n.bottom:n.right,d=!1;if(!l){if(s&&qnf+u*o/2:ac-qn)return-hn}else if(a>f+u*(1-i)/2&&ac-u*o/2)?a>f+u/2?1:-1:0}function Xg(e){return Ge(V)$[24];for(let $=0;$A[21];for(let A=0;AQ & A Comparison Instructions +
+

Ask a question and rank the answers across the models. Drag each answer to + rank it, in ascending order, from left-to-right. Optionally, select the + rank for each via the corresponding dropdown.

+
+ `,r=I(),i=k("div"),o=k("section"),l=k("div");for(let A=0;A{e.scrollIntoView({behavior:"smooth"})},0)}async function yl(e){console.log("run update",e);const n=await fetch("/chat/comparator/db/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})});if(n.ok)console.log("ok",n);else{const r=await n.text();alert(r)}}function eh(e,t,n){let r,i,o;ne(e,$r,R=>n(7,o=R));let{numModels:l=1}=t,{models:s=[0]}=t,a="",u="",f=!1;ct(async()=>{if(await new Promise(R=>setTimeout(R,200)),g){const R=new G(g,{animation:150,onUpdate(A){R.toArray()}});R.toArray()}});const c=async R=>{R.preventDefault(),a=u,n(3,u=""),n(4,f=!0);let A={question:a};for(let $ of s)A[$]="Loading...";Ne($r,o=[...o,A],o);const y=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(y.ok){const $=await y.json();n(1,s=Object.keys($.answer)),n(0,l=s.length);for(let S of s)A[S]=$.answer[S];A.qid=$.qid,$r.update(S=>(S[S.length-1]=A,S))}else{const $=await y.text();alert($)}n(4,f=!1)};let d=0;setInterval(()=>{n(11,d=(d+1)%4)},200);let g,p;function m(R,A){const y=A,S=ut(R.currentTarget.parentNode).selectAll("div.answer").nodes().map(D=>D.id);S.forEach((D,L)=>{ut(`#${D}`).select(".answer-rank").property("value",L+1)});let F=[];for(let[D,L]of S.entries()){const ge=parseInt(L.split("-")[1]),re=s[ge],Ce={rank:D,model:re};F.push(Ce)}let N=o.filter(D=>D.qid===y),M=[];for(let D of F){const L={model:D.model,qid:parseInt(y),rank:parseInt(D.rank)+1,answer:N[0][D.model]};M.push(L)}yl(M)}function _(R,A,y){const $=A,S=parseInt(R.target.value),F=s[y],N={qid:$,rank:parseInt(S),model:F};let M=[],L=o.filter(re=>re.qid===N.qid)[0][N.model];const ge={model:N.model,qid:parseInt(N.qid),rank:parseInt(N.rank),answer:L};M.push(ge),yl(M)}const b=(R,A,y)=>_(y,R.qid,A),w=(R,A)=>m(A,R.qid);function C(R){mn[R?"unshift":"push"](()=>{g=R,n(2,g)})}function E(){u=this.value,n(3,u)}return e.$$set=R=>{"numModels"in R&&n(0,l=R.numModels),"models"in R&&n(1,s=R.models)},e.$$.update=()=>{e.$$.dirty&1&&n(6,r="1fr ".repeat(l).trim()),e.$$.dirty&2048&&n(5,i=".".repeat(d).padEnd(3)),e.$$.dirty&4100&&g&&(n(12,p=new G(g,{animation:150,dataIdAttr:"id",onUpdate(R){p.toArray()}})),p.toArray())},[l,s,g,u,f,i,r,o,c,m,_,d,p,b,w,C,E]}class th extends ue{constructor(t){super(),fe(this,t,eh,Jg,ae,{numModels:0,models:1})}}function nh(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return da(this.cover(t,n),t,n,e)}function da(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,l={data:r},s=e._x0,a=e._y0,u=e._x1,f=e._y1,c,d,g,p,m,_,b,w;if(!o)return e._root=l,e;for(;o.length;)if((m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(d=(a+f)/2))?a=d:f=d,i=o,!(o=o[b=_<<1|m]))return i[b]=l,e;if(g=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===g&&n===p)return l.next=o,i?i[b]=l:e._root=l,e;do i=i?i[b]=new Array(4):e._root=new Array(4),(m=t>=(c=(s+u)/2))?s=c:u=c,(_=n>=(d=(a+f)/2))?a=d:f=d;while((b=_<<1|m)===(w=(p>=d)<<1|g>=c));return i[w]=o,i[b]=l,e}function rh(e){var t,n,r=e.length,i,o,l=new Array(r),s=new Array(r),a=1/0,u=1/0,f=-1/0,c=-1/0;for(n=0;nf&&(f=i),oc&&(c=o));if(a>f||u>c)return this;for(this.cover(a,u).cover(f,c),n=0;ne||e>=i||r>t||t>=o;)switch(u=(tf||(s=p.y0)>c||(a=p.x1)=b)<<1|e>=_)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-m],d[d.length-1-m]=p)}else{var w=e-+this._x.call(null,g.data),C=t-+this._y.call(null,g.data),E=w*w+C*C;if(E=(d=(l+a)/2))?l=d:a=d,(m=c>=(g=(s+u)/2))?s=g:u=g,t=n,!(n=n[_=m<<1|p]))return this;if(!n.length)break;(t[_+1&3]||t[_+2&3]||t[_+3&3])&&(r=t,b=_)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[_]=o:delete t[_],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=o,this)}function uh(e){for(var t=0,n=e.length;td.index){var N=g-$.x-$.vx,M=p-$.y-$.vy,D=N*N+M*M;Dg+F||Ap+F||yu.r&&(u.r=u[f].r)}function a(){if(t){var u,f=t.length,c;for(n=new Array(f),u=0;u{}};function ha(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Bn.prototype=ha.prototype={constructor:Bn,on:function(e,t){var n=this._,r=Sh(e+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&e._call.call(void 0,t),e=e._next;--Qt}function $l(){Mt=(fr=yn.now())+br,Qt=an=0;try{$h()}finally{Qt=0,Ah(),Mt=0}}function Rh(){var e=yn.now(),t=e-fr;t>pa&&(br-=t,fr=e)}function Ah(){for(var e,t=ur,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ur=n);un=e,ui(r)}function ui(e){if(!Qt){an&&(an=clearTimeout(an));var t=e-Mt;t>24?(e<1/0&&(an=setTimeout($l,e-yn.now()-br)),tn&&(tn=clearInterval(tn))):(tn||(fr=yn.now(),tn=setInterval(Rh,pa)),Qt=1,ma($l))}}const Eh=1664525,Mh=1013904223,Rl=4294967296;function Fh(){let e=1;return()=>(e=(Eh*e+Mh)%Rl)/Rl}var Dh=10,Ih=Math.PI*(3-Math.sqrt(5));function Nh(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,l=.6,s=new Map,a=va(c),u=ha("tick","end"),f=Fh();e==null&&(e=[]);function c(){d(),u.call("tick",t),n1?(_==null?s.delete(m):s.set(m,p(_)),t):s.get(m)},find:function(m,_,b){var w=0,C=e.length,E,R,A,y,$;for(b==null?b=1/0:b*=b,w=0;w1?(u.on(m,_),t):u.on(m)}}}function Ph(e){var t=et(.1),n,r,i;typeof e!="function"&&(e=et(e==null?0:+e));function o(s){for(var a=0,u=n.length,f;ae[4]?1:0),h(t,"class",g="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",p=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(w,C){x(w,t,C),v(t,n),v(t,o),v(o,s),v(o,a),v(a,f),m=!0,_||(b=[U(t,"mouseover",e[6]),U(t,"mouseout",e[7]),U(t,"focus",e[6]),U(t,"blur",e[7])],_=!0)},p(w,C){(!m||C&12&&r!==(r=w[3](w[20].size)))&&h(n,"r",r),(!m||C&4)&&l!==(l=w[20].file+"")&&Q(s,l),(!m||C&4)&&u!==(u=Jr(w[20].size)+"")&&Q(f,u),(!m||C&20&&c!==(c=w[20].size>w[4]?1:0))&&h(o,"opacity",c),(!m||C&20&&g!==(g="file-circle-g "+(w[20].size>w[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",g),(!m||C&4&&p!==(p=w[5](w[20].x,w[20].y)))&&h(t,"style",p)},i(w){m||(w&&ke(()=>{m&&(i||(i=Be(n,An,{duration:1e3},!0)),i.run(1))}),w&&ke(()=>{m&&(d||(d=Be(o,An,{duration:1e3},!0)),d.run(1))}),m=!0)},o(w){w&&(i||(i=Be(n,An,{duration:1e3},!1)),i.run(0)),w&&(d||(d=Be(o,An,{duration:1e3},!1)),d.run(0)),m=!1},d(w){w&&T(t),w&&i&&i.end(),w&&d&&d.end(),_=!1,me(b)}}}function xh(e){let t,n,r,i,o=e[2],l=[];for(let a=0;aO(l[a],1,1,()=>{l[a]=null});return{c(){t=k("div"),n=X("svg");for(let a=0;ae[15].call(t))},m(a,u){x(a,t,u),v(t,n);for(let f=0;fn(14,f=R));let c=600,d=350,g=!0,p=!1;const m=(R,A)=>`transform: translate(${R}px, ${A}px)`,_=[-4,4],b=[-1,1];function w(){n(8,g=!0),n(9,p=!0);const R=ut(this);Rr(".file-circle-g").select("text").style("opacity",0),R.raise(),R.select("circle").attr("fill","var(--red)"),R.select("text").style("opacity",1)}const C=()=>{const R=Rr(".file-circle-g");R.select("circle").attr("fill","var(--yellow)"),R.select("text").style("opacity",0),n(9,p=!1),setTimeout(()=>{n(8,g=!1)},1e3)};function E(){c=this.offsetWidth,d=this.offsetHeight,n(0,c),n(1,d)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,r=f.map(R=>({...R,x:c/2,y:d/2,tickCount:0}))),e.$$.dirty&16384&&console.log(f.map(R=>R.size).sort((R,A)=>R-A)),e.$$.dirty&1&&n(13,i=Ph().x(c/2)),e.$$.dirty&2&&n(12,o=Th().y(d/2)),e.$$.dirty&16384&&n(3,a=Qe().domain(fn(f,R=>R.size)).range([12,60])),e.$$.dirty&8&&n(10,l=wh().radius(R=>a(R.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,s=ad(f.map(R=>R.size).sort((R,A)=>R-A),.85)),e.$$.dirty&1&&Qe().domain(_).range([5,c]),e.$$.dirty&2&&Qe().domain(b).range([d,5]),e.$$.dirty&4&&n(11,u=Nh().nodes(r).on("tick",()=>{n(2,r=[...r])})),e.$$.dirty&15360&&(u.force("x",i),u.force("y",o),u.force("collide",l),u.alpha(.02),u.restart()),e.$$.dirty&19468&&(a.domain(fn(f,R=>R.size)),r.forEach(R=>R.radius=a(R.size)),u.nodes(r),l.radius(R=>R.radius+.5)),e.$$.dirty&768&&g===!1&&(p||Rr(".large").select("text").style("opacity",1))},[c,d,r,a,s,m,w,C,g,p,l,u,o,i,f,E]}class Vh extends ue{constructor(t){super(),fe(this,t,Oh,xh,ae,{})}}/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function vt(e,t){return typeof e=="function"?e(t):e}function We(e,t){return n=>{t.setState(r=>({...r,[e]:vt(n,r[e])}))}}function dr(e){return e instanceof Function}function zh(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Hh(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const l=t(o);l!=null&&l.length&&r(l)})};return r(e),n}function W(e,t,n){let r=[],i;return()=>{let o;n.key&&n.debug&&(o=Date.now());const l=e();if(!(l.length!==r.length||l.some((u,f)=>r[f]!==u)))return i;r=l;let a;if(n.key&&n.debug&&(a=Date.now()),i=t(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-o)*100)/100,f=Math.round((Date.now()-a)*100)/100,c=f/16,d=(g,p)=>{for(g=String(g);g.length{let g=d;for(const m of a.split(".")){var p;g=(p=g)==null?void 0:p[m]}return g}:f=d=>d[s.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:f,parent:r,depth:n,columnDef:s,columns:[],getFlatColumns:W(()=>[!0],()=>{var d;return[c,...(d=c.columns)==null?void 0:d.flatMap(g=>g.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var d;return(d=e.options.debugAll)!=null?d:e.options.debugColumns}}),getLeafColumns:W(()=>[e._getOrderColumnsFn()],d=>{var g;if((g=c.columns)!=null&&g.length){let p=c.columns.flatMap(m=>m.getLeafColumns());return d(p)}return[c]},{key:"column.getLeafColumns",debug:()=>{var d;return(d=e.options.debugAll)!=null?d:e.options.debugColumns}})};return c=e._features.reduce((d,g)=>Object.assign(d,g.createColumn==null?void 0:g.createColumn(c,e)),c),c}function Fl(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(s),l.push(a)};return s(o),l},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(l=>{Object.assign(o,l.createHeader==null?void 0:l.createHeader(o,e))}),o}const qh={createTable:e=>({getHeaderGroups:W(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,l;const s=(o=r==null?void 0:r.map(c=>n.find(d=>d.id===c)).filter(Boolean))!=null?o:[],a=(l=i==null?void 0:i.map(c=>n.find(d=>d.id===c)).filter(Boolean))!=null?l:[],u=n.filter(c=>!(r!=null&&r.includes(c.id))&&!(i!=null&&i.includes(c.id)));return xn(t,[...s,...u,...a],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:W(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),xn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:W(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return xn(t,o,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:W(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r==null?void 0:r.map(l=>n.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return xn(t,o,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:W(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:W(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:W(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:W(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:W(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFlatHeaders:W(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFlatHeaders:W(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFlatHeaders:W(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterLeafHeaders:W(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:W(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:W(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:W(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,l,s,a,u;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(l=(s=n[0])==null?void 0:s.headers)!=null?l:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(f=>f.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}})})};function xn(e,t,n,r){var i,o;let l=0;const s=function(d,g){g===void 0&&(g=1),l=Math.max(l,g),d.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&s(p.columns,g+1)},0)};s(e);let a=[];const u=(d,g)=>{const p={depth:g,id:[r,`${g}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(_=>{const b=[...m].reverse()[0],w=_.column.depth===p.depth;let C,E=!1;if(w&&_.column.parent?C=_.column.parent:(C=_.column,E=!0),b&&(b==null?void 0:b.column)===C)b.subHeaders.push(_);else{const R=Fl(n,C,{id:[r,g,C.id,_==null?void 0:_.id].filter(Boolean).join("_"),isPlaceholder:E,placeholderId:E?`${m.filter(A=>A.column===C).length}`:void 0,depth:g,index:m.length});R.subHeaders.push(_),m.push(R)}p.headers.push(_),_.headerGroup=p}),a.push(p),g>0&&u(m,g-1)},f=t.map((d,g)=>Fl(n,d,{depth:l,index:g}));u(f,l-1),a.reverse();const c=d=>d.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,_=0,b=[0];p.subHeaders&&p.subHeaders.length?(b=[],c(p.subHeaders).forEach(C=>{let{colSpan:E,rowSpan:R}=C;m+=E,b.push(R)})):m=1;const w=Math.min(...b);return _=_+w,p.colSpan=m,p.rowSpan=_,{colSpan:m,rowSpan:_}});return c((i=(o=a[0])==null?void 0:o.headers)!=null?i:[]),a}const On={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},zr=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jh={getDefaultColumnDef:()=>On,getInitialState:e=>({columnSizing:{},columnSizingInfo:zr(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:We("columnSizing",e),onColumnSizingInfoChange:We("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:On.minSize,(r=o??e.columnDef.size)!=null?r:On.size),(i=e.columnDef.maxSize)!=null?i:On.maxSize)},getStart:n=>{const r=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),i=r.findIndex(o=>o.id===e.id);if(i>0){const o=r[i-1];return o.getStart(n)+o.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},getCanResize:()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},getStart:()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),r=n==null?void 0:n.getCanResize();return i=>{if(!n||!r||(i.persist==null||i.persist(),Hr(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[n.id,n.getSize()]],s=Hr(i)?Math.round(i.touches[0].clientX):i.clientX,a={},u=(m,_)=>{typeof _=="number"&&(t.setColumnSizingInfo(b=>{var w,C;const E=_-((w=b==null?void 0:b.startOffset)!=null?w:0),R=Math.max(E/((C=b==null?void 0:b.startSize)!=null?C:0),-.999999);return b.columnSizingStart.forEach(A=>{let[y,$]=A;a[y]=Math.round(Math.max($+$*R,0)*100)/100}),{...b,deltaOffset:E,deltaPercentage:R}}),(t.options.columnResizeMode==="onChange"||m==="end")&&t.setColumnSizing(b=>({...b,...a})))},f=m=>u("move",m),c=m=>{u("end",m),t.setColumnSizingInfo(_=>({..._,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d={moveHandler:m=>f(m.clientX),upHandler:m=>{document.removeEventListener("mousemove",d.moveHandler),document.removeEventListener("mouseup",d.upHandler),c(m.clientX)}},g={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),f(m.touches[0].clientX),!1),upHandler:m=>{var _;document.removeEventListener("touchmove",g.moveHandler),document.removeEventListener("touchend",g.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),c((_=m.touches[0])==null?void 0:_.clientX)}},p=Gh()?{passive:!1}:!1;Hr(i)?(document.addEventListener("touchmove",g.moveHandler,p),document.addEventListener("touchend",g.upHandler,p)):(document.addEventListener("mousemove",d.moveHandler,p),document.addEventListener("mouseup",d.upHandler,p)),t.setColumnSizingInfo(m=>({...m,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}}),createTable:e=>({setColumnSizing:t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?zr():(n=e.initialState.columnSizingInfo)!=null?n:zr())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}})};let Vn=null;function Gh(){if(typeof Vn=="boolean")return Vn;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Vn=e,Vn}function Hr(e){return e.type==="touchstart"}const Bh={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:We("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const l=o.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let l={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=r,n=(i=n)!=null?i:!o,!o&&n)return{...l,[e.id]:!0};if(o&&!n){const{[e.id]:s,...a}=l;return a}return r})},getIsExpanded:()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},getCanExpand:()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},ba=(e,t,n)=>{var r,i,o;const l=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(i=r.toString())==null||(o=i.toLowerCase())==null)&&o.includes(l))};ba.autoRemove=e=>Ke(e);const wa=(e,t,n)=>{var r,i;return!!(!((r=e.getValue(t))==null||(i=r.toString())==null)&&i.includes(n))};wa.autoRemove=e=>Ke(e);const ya=(e,t,n)=>{var r,i;return((r=e.getValue(t))==null||(i=r.toString())==null?void 0:i.toLowerCase())===(n==null?void 0:n.toLowerCase())};ya.autoRemove=e=>Ke(e);const Sa=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};Sa.autoRemove=e=>Ke(e)||!(e!=null&&e.length);const ka=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});ka.autoRemove=e=>Ke(e)||!(e!=null&&e.length);const Ca=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});Ca.autoRemove=e=>Ke(e)||!(e!=null&&e.length);const $a=(e,t,n)=>e.getValue(t)===n;$a.autoRemove=e=>Ke(e);const Ra=(e,t,n)=>e.getValue(t)==n;Ra.autoRemove=e=>Ke(e);const Di=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};Di.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,l=n===null||Number.isNaN(i)?1/0:i;if(o>l){const s=o;o=l,l=s}return[o,l]};Di.autoRemove=e=>Ke(e)||Ke(e[0])&&Ke(e[1]);const lt={includesString:ba,includesStringSensitive:wa,equalsString:ya,arrIncludes:Sa,arrIncludesAll:ka,arrIncludesSome:Ca,equals:$a,weakEquals:Ra,inNumberRange:Di};function Ke(e){return e==null||e===""}const Uh={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:We("columnFilters",e),onGlobalFilterChange:We("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,r;const i=(n=e.getCoreRowModel().flatRows[0])==null||(r=n._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?lt.includesString:typeof r=="number"?lt.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?lt.equals:Array.isArray(r)?lt.arrIncludes:lt.weakEquals},getFilterFn:()=>{var n,r;return dr(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:lt[e.columnDef.filterFn]},getCanFilter:()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,r;return(n=t.getState().columnFilters)==null||(r=n.find(i=>i.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r==null?void 0:r.find(f=>f.id===e.id),l=vt(n,o?o.value:void 0);if(Dl(i,l,e)){var s;return(s=r==null?void 0:r.filter(f=>f.id!==e.id))!=null?s:[]}const a={id:e.id,value:l};if(o){var u;return(u=r==null?void 0:r.map(f=>f.id===e.id?a:f))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})},_getFacetedRowModel:t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),_getFacetedUniqueValues:t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>lt.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:r}=e.options;return dr(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:lt[r]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=vt(t,i))==null?void 0:o.filter(l=>{const s=n.find(a=>a.id===l.id);if(s){const a=s.getFilterFn();if(Dl(a,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function Dl(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Wh=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),Xh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},Yh=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},Qh=(e,t,n)=>{let r,i;return n.forEach(o=>{const l=o.getValue(e);l!=null&&(r===void 0?l>=l&&(r=i=l):(r>l&&(r=l),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},Jh=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!zh(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,l)=>o-l);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},Zh=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),ep=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,tp=(e,t)=>t.length,Lr={sum:Wh,min:Xh,max:Yh,extent:Qh,mean:Kh,median:Jh,unique:Zh,uniqueCount:ep,count:tp},np={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:We("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,r,i,o;return(n=(r=(i=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?i:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},getIsGrouped:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Lr.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Lr.extent},getAggregationFn:()=>{var n,r;if(!e)throw new Error;return dr(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Lr[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,t)=>({getIsGrouped:()=>!!e.groupingColumnId,getGroupingValue:n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,r)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}})};function rp(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(l=>l.id===o)).filter(Boolean),...r]}const ip={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:We("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},_getOrderColumnsFn:W(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const l=[...t],s=[...i];for(;s.length&&l.length;){const a=l.shift(),u=s.findIndex(f=>f.id===a);u>-1&&o.push(s.splice(u,1)[0])}o=[...o,...s]}return rp(o,n,r)},{key:!1})})},fi=0,ci=10,qr=()=>({pageIndex:fi,pageSize:ci}),op={getInitialState:e=>({...e,pagination:{...qr(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:We("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:r=>{const i=o=>vt(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},resetPagination:r=>{var i;e.setPagination(r?qr():(i=e.initialState.pagination)!=null?i:qr())},setPageIndex:r=>{e.setPagination(i=>{let o=vt(r,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,l)),{...i,pageIndex:o}})},resetPageIndex:r=>{var i,o,l;e.setPageIndex(r?fi:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageIndex)!=null?i:fi)},resetPageSize:r=>{var i,o,l;e.setPageSize(r?ci:(i=(o=e.initialState)==null||(l=o.pagination)==null?void 0:l.pageSize)!=null?i:ci)},setPageSize:r=>{e.setPagination(i=>{const o=Math.max(1,vt(r,i.pageSize)),l=i.pageSize*i.pageIndex,s=Math.floor(l/o);return{...i,pageIndex:s,pageSize:o}})},setPageCount:r=>e.setPagination(i=>{var o;let l=vt(r,(o=e.options.pageCount)!=null?o:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),getPageOptions:W(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,l)=>l)),i},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},jr=()=>({left:[],right:[]}),lp={getInitialState:e=>({columnPinning:jr(),...e}),getDefaultOptions:e=>({onColumnPinningChange:We("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,l;if(n==="right"){var s,a;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((a=i==null?void 0:i.right)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(n==="left"){var u,f;return{left:[...((u=i==null?void 0:i.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((f=i==null?void 0:i.right)!=null?f:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((o=i==null?void 0:i.left)!=null?o:[]).filter(c=>!(r!=null&&r.includes(c))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var i,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=t.options.enablePinning)!=null?o:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(s=>s.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(s=>r==null?void 0:r.includes(s)),l=n.some(s=>i==null?void 0:i.includes(s));return o?"left":l?"right":!1},getPinnedIndex:()=>{var n,r,i;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(i=r[o])==null?void 0:i.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:W(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(l=>!o.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:W(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:W(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(l=>l.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,r;return e.setColumnPinning(t?jr():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:jr())},getIsSomeColumnsPinned:t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},getLeftLeafColumns:W(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:W(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:W(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},sp={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:We("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{di(i,o.id,r,e)}),i}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:W(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:W(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:W(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Gr(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},getIsSomeRowsSelected:()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const r=e.getIsSelected();t.setRowSelection(i=>{if(n=typeof n<"u"?n:!r,r===n)return i;const o={...i};return di(o,e.id,n,t),o})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Ii(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return Il(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return Il(e,n)==="all"},getCanSelect:()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},getCanSelectSubRows:()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},getCanMultiSelect:()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},getToggleSelectedHandler:()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}})},di=(e,t,n,r)=>{var i;const o=r.getRow(t);n?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>di(e,l.id,n,r))};function Gr(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(l,s){return l.map(a=>{var u;const f=Ii(a,n);if(f&&(r.push(a),i[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:o(a.subRows)}),f)return a}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function Ii(e,t){var n;return(n=t[e.id])!=null?n:!1}function Il(e,t,n){if(e.subRows&&e.subRows.length){let r=!0,i=!1;return e.subRows.forEach(o=>{i&&!r||(Ii(o,t)?i=!0:r=!1)}),r?"all":i?"some":!1}return!1}const gi=/([0-9]+)/gm,ap=(e,t,n)=>Aa(wt(e.getValue(n)).toLowerCase(),wt(t.getValue(n)).toLowerCase()),up=(e,t,n)=>Aa(wt(e.getValue(n)),wt(t.getValue(n))),fp=(e,t,n)=>Ni(wt(e.getValue(n)).toLowerCase(),wt(t.getValue(n)).toLowerCase()),cp=(e,t,n)=>Ni(wt(e.getValue(n)),wt(t.getValue(n))),dp=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:rNi(e.getValue(n),t.getValue(n));function Ni(e,t){return e===t?0:e>t?1:-1}function wt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Aa(e,t){const n=e.split(gi).filter(Boolean),r=t.split(gi).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),l=parseInt(i,10),s=parseInt(o,10),a=[l,s].sort();if(isNaN(a[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return n.length-r.length}const nn={alphanumeric:ap,alphanumericCaseSensitive:up,text:fp,textCaseSensitive:cp,datetime:dp,basic:gp},hp={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:We("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return nn.datetime;if(typeof o=="string"&&(r=!0,o.split(gi).length>1))return nn.alphanumeric}return r?nn.text:nn.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,r;if(!e)throw new Error;return dr(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:nn[e.columnDef.sortingFn]},toggleSorting:(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(l=>{const s=l==null?void 0:l.find(g=>g.id===e.id),a=l==null?void 0:l.findIndex(g=>g.id===e.id);let u=[],f,c=o?n:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?s?f="toggle":f="add":l!=null&&l.length&&a!==l.length-1?f="replace":s?f="toggle":f="replace",f==="toggle"&&(o||i||(f="remove")),f==="add"){var d;u=[...l,{id:e.id,desc:c}],u.splice(0,u.length-((d=t.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=l.map(g=>g.id===e.id?{...g,desc:c}:g):f==="remove"?u=l.filter(g=>g.id!==e.id):u=[{id:e.id,desc:c}];return u})},getFirstSortDir:()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var r,i;const o=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":o},getCanSort:()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},getSortIndex:()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},pp={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:We("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,r;return(n=(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},getCanHide:()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:W(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:W(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,r)=>W(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),{key:n,debug:()=>{var i;return(i=e.options.debugAll)!=null?i:e.options.debugColumns}});return{getVisibleFlatColumns:t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),resetColumnVisibility:n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},toggleAllColumnsVisible:n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}}},Nl=[qh,pp,ip,lp,Uh,hp,np,Bh,op,sp,jh];function mp(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:Nl};const r=n._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(n)),{}),i=f=>n.options.mergeOptions?n.options.mergeOptions(r,f):{...r,...f};let l={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(f=>{var c;l=(c=f.getInitialState==null?void 0:f.getInitialState(l))!=null?c:l});const s=[];let a=!1;const u={_features:Nl,options:{...r,...e},initialState:l,_queue:f=>{s.push(f),a||(a=!0,Promise.resolve().then(()=>{for(;s.length;)s.shift()();a=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{n.setState(n.initialState)},setOptions:f=>{const c=vt(f,n.options);n.options=i(c)},getState:()=>n.options.state,setState:f=>{n.options.onStateChange==null||n.options.onStateChange(f)},_getRowId:(f,c,d)=>{var g;return(g=n.options.getRowId==null?void 0:n.options.getRowId(f,c,d))!=null?g:`${d?[d.id,c].join("."):c}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:f=>{const c=n.getRowModel().rowsById[f];if(!c)throw new Error;return c},_getDefaultColumnDef:W(()=>[n.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:d=>{const g=d.header.column.columnDef;return g.accessorKey?g.accessorKey:g.accessorFn?g.id:null},cell:d=>{var g,p;return(g=(p=d.renderValue())==null||p.toString==null?void 0:p.toString())!=null?g:null},...n._features.reduce((d,g)=>Object.assign(d,g.getDefaultColumnDef==null?void 0:g.getDefaultColumnDef()),{}),...f}},{debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:W(()=>[n._getColumnDefs()],f=>{const c=function(d,g,p){return p===void 0&&(p=0),d.map(m=>{const _=Lh(n,m,p,g),b=m;return _.columns=b.columns?c(b.columns,_,p+1):[],_})};return c(f)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllFlatColumns:W(()=>[n.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),_getAllFlatColumnsById:W(()=>[n.getAllFlatColumns()],f=>f.reduce((c,d)=>(c[d.id]=d,c),{}),{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getAllLeafColumns:W(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(f,c)=>{let d=f.flatMap(g=>g.getLeafColumns());return c(d)},{key:!1,debug:()=>{var f;return(f=n.options.debugAll)!=null?f:n.options.debugColumns}}),getColumn:f=>n._getAllFlatColumnsById()[f]};return Object.assign(n,u),n._features.forEach(f=>Object.assign(n,f.createTable==null?void 0:f.createTable(n))),n}function _p(e,t,n,r){const i=()=>{var l;return(l=o.getValue())!=null?l:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:W(()=>[e,n,t,o],(l,s,a,u)=>({table:l,column:s,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(o,l.createCell==null?void 0:l.createCell(o,n,t,e))},{}),o}const Pi=(e,t,n,r,i,o,l)=>{let s={id:t,index:r,original:n,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(s._valuesCache.hasOwnProperty(a))return s._valuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return s._valuesCache[a]=u.accessorFn(s.original,r),s._valuesCache[a]},getUniqueValues:a=>{if(s._uniqueValuesCache.hasOwnProperty(a))return s._uniqueValuesCache[a];const u=e.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(s._uniqueValuesCache[a]=u.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[a]):(s._uniqueValuesCache[a]=[s.getValue(a)],s._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=s.getValue(a))!=null?u:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>Hh(s.subRows,a=>a.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId):void 0,getParentRows:()=>{let a=[],u=s;for(;;){const f=u.getParentRow();if(!f)break;a.push(f),u=f}return a.reverse()},getAllCells:W(()=>[e.getAllLeafColumns()],a=>a.map(u=>_p(e,s,u,u.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:W(()=>[s.getAllCells()],a=>a.reduce((u,f)=>(u[f.column.id]=f,u),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;atypeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function Pl(){return e=>W(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,l){o===void 0&&(o=0);const s=[];for(let u=0;u{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Ea(e,t,n){return n.options.filterFromLeafRows?bp(e,t,n):wp(e,t,n)}function bp(e,t,n){var r;const i=[],o={},l=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,s=function(a,u){u===void 0&&(u=0);const f=[];for(let d=0;dW(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let d=0;d{var g;const p=e.getColumn(d.id);if(!p)return;const m=p.getFilterFn();m&&i.push({id:d.id,filterFn:m,resolvedValue:(g=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?g:d.value})});const l=n.map(d=>d.id),s=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());r&&s&&a.length&&(l.push("__global__"),a.forEach(d=>{var g;o.push({id:d.id,filterFn:s,resolvedValue:(g=s.resolveFilterValue==null?void 0:s.resolveFilterValue(r))!=null?g:r})}));let u,f;for(let d=0;d{g.columnFiltersMeta[m]=_})}if(o.length){for(let p=0;p{g.columnFiltersMeta[m]=_})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const c=d=>{for(let g=0;g{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function xl(){return(e,t)=>W(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(s=>s.id).filter(s=>s!==t),i?"__global__":void 0].filter(Boolean),l=s=>{for(let a=0;a{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function Ol(){return e=>W(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(a=>{var u;return(u=e.getColumn(a.id))==null?void 0:u.getCanSort()}),l={};o.forEach(a=>{const u=e.getColumn(a.id);u&&(l[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const s=a=>{const u=[...a];return u.sort((f,c)=>{for(let g=0;g{var c;i.push(f),(c=f.subRows)!=null&&c.length&&(f.subRows=s(f.subRows))}),u};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function yp(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Vl(e){return t=>W(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:l,flatRows:s,rowsById:a}=r;const u=i*o,f=u+i;l=l.slice(u,f);let c;t.options.paginateExpandedRows?c={rows:l,flatRows:s,rowsById:a}:c=yp({rows:l,flatRows:s,rowsById:a}),c.flatRows=[];const d=g=>{c.flatRows.push(g),g.subRows.length&&g.subRows.forEach(d)};return c.rows.forEach(d),c},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** + * svelte-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Sp(e){let t;return{c(){t=z(e[0])},l(n){t=ja(n,e[0])},m(n,r){za(n,t,r)},p(n,[r]){r&1&&Q(t,n[0])},i:q,o:q,d(n){n&&T(t)}}}function kp(e,t,n){let{content:r}=t;return e.$$set=i=>{"content"in i&&n(0,r=i.content)},[r]}class Cp extends ue{constructor(t){super(),fe(this,t,kp,Sp,ae,{content:0})}}const $p=_s((e,t,n,r)=>`${ou(t.content)}`);var Rp=typeof document>"u"?$p:Cp;function Ap(e,t,n){let r,i;return r=new t({props:n,$$inline:!0}),{c(){ee(r.$$.fragment)},l(o){su(r.$$.fragment,o)},m(o,l){J(r,o,l),i=!0},p:q,i(o){i||(P(r.$$.fragment,o),i=!0)},o(o){O(r.$$.fragment,o),i=!1},d(o){Z(r,o)}}}function Ep(e,t){return class extends ue{constructor(r){super(),fe(this,r,null,i=>Ap(i,e,t),ae,{},void 0)}}}function Mp(e,t){return _s((r,i,o,l)=>`${lu(e,"TableComponent").$$render(r,t,{},{})}`)}const hi=typeof window>"u"?Mp:Ep;function Fp(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function Dp(e){var t,n;let r="__SVELTE_HMR"in window;return e.prototype instanceof ue||r&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function zl(e){return typeof document>"u"?Fp(e):Dp(e)}function Hl(e){return hi(Rp,{content:e})}function gr(e,t){if(!e)return null;if(zl(e))return hi(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:zl(n)?hi(n,t):Hl(n)}return Hl(e)}function Ll(e){let t;"subscribe"in e?t=e:t=Wr(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Da(t)},r=mp(n),i=Re(r.initialState),o=uu([i,t],s=>s);return Wr(r,function(a){const u=o.subscribe(f=>{let[c,d]=f;r.setOptions(g=>({...g,...d,state:{...c,...d.state},onStateChange:p=>{p instanceof Function?i.update(p):i.set(p),n.onStateChange==null||n.onStateChange(p)}})),a(r)});return function(){u()}})}/** + * match-sorter-utils + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const Ma={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",áē¤:"A",áēŽ:"A",áē˛:"A",áē´:"A",áēļ:"A",Æ:"AE",áēĻ:"A",áē°:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",áēž:"E",Ḗ:"E",áģ€:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḏ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",áģ:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",ÃĄ:"a",Ãĸ:"a",ÃŖ:"a",ä:"a",ÃĨ:"a",áēĨ:"a",áē¯:"a",áēŗ:"a",áēĩ:"a",áēˇ:"a",ÃĻ:"ae",áē§:"a",áēą:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",Ê:"e",ÃĒ:"e",ÃĢ:"e",áēŋ:"e",ḗ:"e",áģ:"e",ḕ:"e",ḝ:"e",ȇ:"e",ÃŦ:"i",í:"i",ÃŽ:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",Ãą:"n",Ã˛:"o",Ãŗ:"o",ô:"o",Ãĩ:"o",Ãļ:"o",ø:"o",áģ‘:"o",ᚍ:"o",ṓ:"o",ȏ:"o",Ú:"u",Ãē:"u",Ãģ:"u",Ãŧ:"u",ÃŊ:"y",Ãŋ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",CĖ†:"C",cĖ†:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Į´:"G",ĝ:"g",Įĩ:"g",Ğ:"G",ğ:"g",Ä :"G",ÄĄ:"g",Äĸ:"G",ÄŖ:"g",Ĥ:"H",ÄĨ:"h",ÄĻ:"H",ħ:"h",á¸Ē:"H",á¸Ģ:"h",Ĩ:"I",ÄŠ:"i",ÄĒ:"I",ÄĢ:"i",ÄŦ:"I",Ä­:"i",ÄŽ:"I",į:"i",Ä°:"I",Äą:"i",IJ:"IJ",Äŗ:"ij",Ä´:"J",Äĩ:"j",Äļ:"K",ġ:"k",Ḱ:"K",ḹ:"k",KĖ†:"K",kĖ†:"k",Äš:"L",Äē:"l",Äģ:"L",Äŧ:"l",ÄŊ:"L",Äž:"l",Äŋ:"L",ŀ:"l",Ł:"l",ł:"l",Ḟ:"M",á¸ŋ:"m",MĖ†:"M",mĖ†:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",NĖ†:"N",nĖ†:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",PĖ†:"P",pĖ†:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",RĖ†:"R",rĖ†:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Å :"S",ÅĄ:"s",Åĸ:"T",ÅŖ:"t",ț:"t",Ț:"T",Ť:"T",ÅĨ:"t",ÅĻ:"T",ŧ:"t",TĖ†:"T",tĖ†:"t",Ũ:"U",ÅŠ:"u",ÅĒ:"U",ÅĢ:"u",ÅŦ:"U",Å­:"u",ÅŽ:"U",ů:"u",Å°:"U",Åą:"u",Å˛:"U",Åŗ:"u",Ȗ:"U",ȗ:"u",VĖ†:"V",vĖ†:"v",Å´:"W",Åĩ:"w",áē‚:"W",áēƒ:"w",XĖ†:"X",xĖ†:"x",Åļ:"Y",Åˇ:"y",Ÿ:"Y",YĖ†:"Y",yĖ†:"y",Åš:"Z",Åē:"z",Åģ:"Z",Åŧ:"z",ÅŊ:"Z",Åž:"z",Åŋ:"s",ƒ:"f",Æ :"O",ÆĄ:"o",Ư:"U",Æ°:"u",Į:"A",ĮŽ:"a",Į:"I",Į:"i",Į‘:"O",Į’:"o",Į“:"U",Į”:"u",Į•:"U",Į–:"u",Į—:"U",Į˜:"u",Į™:"U",Įš:"u",Į›:"U",Įœ:"u",áģ¨:"U",áģŠ:"u",ᚸ:"U",ášš:"u",Įē:"A",Įģ:"a",Įŧ:"AE",ĮŊ:"ae",Įž:"O",Įŋ:"o",Þ:"TH",Þ:"th",Ṕ:"P",ṕ:"p",ᚤ:"S",ášĨ:"s",XĖ:"X",xĖ:"x",Ѓ:"Г",Ņ“:"Đŗ",Ќ:"К",Ņœ:"Đē",AĖ‹:"A",aĖ‹:"a",EĖ‹:"E",eĖ‹:"e",IĖ‹:"I",iĖ‹:"i",Į¸:"N",Įš:"n",áģ’:"O",áģ“:"o",ᚐ:"O",ṑ:"o",áģĒ:"U",áģĢ:"u",áē€:"W",áē:"w",áģ˛:"Y",áģŗ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",BĖŒ:"B",bĖŒ:"b",ČĖŖ:"C",čĖŖ:"c",ÊĖŒ:"E",ÃĒĖŒ:"e",FĖŒ:"F",fĖŒ:"f",ĮĻ:"G",Į§:"g",Ȟ:"H",ȟ:"h",JĖŒ:"J",Į°:"j",Į¨:"K",ĮŠ:"k",MĖŒ:"M",mĖŒ:"m",PĖŒ:"P",pĖŒ:"p",QĖŒ:"Q",qĖŒ:"q",ŘĖŠ:"R",řĖŠ:"r",ášĻ:"S",ᚧ:"s",VĖŒ:"V",vĖŒ:"v",WĖŒ:"W",wĖŒ:"w",XĖŒ:"X",xĖŒ:"x",YĖŒ:"Y",yĖŒ:"y",AĖ§:"A",aĖ§:"a",BĖ§:"B",bĖ§:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ČŠ:"e",ƐĖ§:"E",ɛĖ§:"e",Ḩ:"H",Ḋ:"h",IĖ§:"I",iĖ§:"i",ƗĖ§:"I",ɨĖ§:"i",MĖ§:"M",mĖ§:"m",OĖ§:"O",oĖ§:"o",QĖ§:"Q",qĖ§:"q",UĖ§:"U",uĖ§:"u",XĖ§:"X",xĖ§:"x",ZĖ§:"Z",zĖ§:"z"},Ip=Object.keys(Ma).join("|"),Np=new RegExp(Ip,"g");function Pp(e){return e.replace(Np,t=>Ma[t])}/** + * @name match-sorter + * @license MIT license. + * @copyright (c) 2099 Kent C. Dodds + * @author Kent C. Dodds (https://kentcdodds.com) + */const xe={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function Tp(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:xe.MATCHES,!n.accessors){const l=ql(e,t,n);return{rankedValue:e,rank:l,accessorIndex:-1,accessorThreshold:n.threshold,passed:l>=n.threshold}}const i=zp(e,n.accessors),o={rankedValue:e,rank:xe.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let l=0;l=xe.MATCHES?a=u:a>f&&(a=f),a=Math.min(a,f),a>=c&&a>o.rank&&(o.rank=a,o.passed=!0,o.accessorIndex=l,o.accessorThreshold=c,o.rankedValue=s.itemValue)}return o}function ql(e,t,n){return e=jl(e,n),t=jl(t,n),t.length>e.length?xe.NO_MATCH:e===t?xe.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?xe.EQUAL:e.startsWith(t)?xe.STARTS_WITH:e.includes(` ${t}`)?xe.WORD_STARTS_WITH:e.includes(t)?xe.CONTAINS:t.length===1?xe.NO_MATCH:xp(e).includes(t)?xe.ACRONYM:Op(e,t))}function xp(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function Op(e,t){let n=0,r=0;function i(a,u,f){for(let c=f,d=u.length;c-1))return xe.NO_MATCH}const s=r-l;return o(s)}function jl(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=Pp(e)),e}function Vp(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function zp(e,t){const n=[];for(let r=0,i=t.length;r{Z(p,1)}),de()}f?(n=bt(f,c()),ee(n.$$.fragment),P(n.$$.fragment,1),J(n,t,r)):n=null}},i(d){s||(n&&P(n.$$.fragment,d),s=!0)},o(d){n&&O(n.$$.fragment,d),s=!1},d(d){d&&T(t),n&&Z(n),a=!1,u()}}}function Yl(e){let t,n,r=!e[26].isPlaceholder&&Lp(e);return{c(){t=k("th"),r&&r.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(i,o){x(i,t,o),r&&r.m(t,null),n=!0},p(i,o){i[26].isPlaceholder||r.p(i,o)},i(i){n||(P(r),n=!0)},o(i){O(r),n=!1},d(i){i&&T(t),r&&r.d()}}}function Ql(e){let t,n,r,i=e[23].headers,o=[];for(let s=0;sO(o[s],1,1,()=>{o[s]=null});return{c(){t=k("tr");for(let s=0;s{Z(u,1)}),de()}o?(r=bt(o,l()),ee(r.$$.fragment),P(r.$$.fragment,1),J(r,n,null)):r=null}},i(s){i||(r&&P(r.$$.fragment,s),i=!0)},o(s){r&&O(r.$$.fragment,s),i=!1},d(s){s&&T(n),r&&Z(r)}}}function Jl(e){let t,n=[],r=new Map,i,o,l=e[17].getVisibleCells();const s=a=>a[20].id;for(let a=0;a",$e,ve,oe,be,gt,Je=e[5],te=[];for(let H=0;HO(te[H],1,1,()=>{te[H]=null});let je=e[1].getRowModel().rows,le=[];for(let H=0;HO(le[H],1,1,()=>{le[H]=null});return{c(){t=k("div"),n=k("input"),r=I(),i=k("div"),o=k("table"),l=k("thead");for(let H=0;H(o(),o=hr(b,R=>n(1,i=R)),b);ne(e,cr,R=>n(8,r=R)),e.$$.on_destroy.push(()=>o());const s=(R,A,y,$)=>{if(console.log("yessir"),Array.isArray(y))return y.length===0?!0:y.includes(R.getValue(A));typeof y=="number"&&(y=String(y));const S=Tp(R.getValue(A),y);return $({itemRank:S}),S.passed},a=vp(),u=[a.accessor("file",{header:"File",cell:R=>R.getValue(),footer:R=>R.column.id}),a.accessor("size",{header:"Size",cell:R=>Jr(R.getValue()),footer:R=>R.column.id}),a.accessor("type",{header:"Type",cell:R=>R.getValue(),footer:R=>R.column.id})];let f="",c=Re({data:r,columns:u,getCoreRowModel:Pl(),getSortedRowModel:Ol(),getFilteredRowModel:Tl(),globalFilterFn:s,getFacetedRowModel:xl(),getPaginationRowModel:Vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function d(R){n(6,f=R),c.update(A=>({...A,state:{...A.state,globalFilter:R}}))}function g(R){c.update(A=>{var y;return{...A,state:{...A.state,pagination:{...(y=A.state)==null?void 0:y.pagination,pageIndex:R}}}})}let p;function m(R){clearTimeout(p),p=setTimeout(()=>{const A=R.target;d(A.value)},100)}function _(R){const A=R.target;g(parseInt(A.value)-1)}let b=Ll(c);l();let w=i.getHeaderGroups();const C=()=>g(i.getState().pagination.pageIndex-1),E=()=>g(i.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,c={data:r,columns:u,getCoreRowModel:Pl(),getSortedRowModel:Ol(),getFilteredRowModel:Tl(),globalFilterFn:s,getFacetedRowModel:xl(),getPaginationRowModel:Vl(),state:{globalFilter:f,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),l(n(0,b=Ll(Re(c)))))},[b,i,g,m,_,w,f,c,r,C,E]}class Bp extends ue{constructor(t){super(),fe(this,t,Gp,qp,ae,{})}}function Zl(e){let t,n;return{c(){t=k("p"),n=z(e[3])},m(r,i){x(r,t,i),v(t,n)},p(r,i){i&8&&Q(n,r[3])},d(r){r&&T(t)}}}function es(e){let t;return{c(){t=k("p"),t.textContent="Data Successfully indexed!"},m(n,r){x(n,t,r)},d(n){n&&T(t)}}}function ts(e){let t,n;return t=new Bp({}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function Up(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p,m,_,b,w,C,E,R,A,y,$=e[2]&&!e[1]&&Zl(e),S=e[1]&&es();C=new Vh({});let F=e[0]&&ts();return{c(){t=k("div"),n=k("div"),r=k("div"),i=k("div"),o=k("h4"),o.textContent="Upload Data",l=I(),s=k("br"),a=I(),u=k("form"),f=k("input"),c=I(),$&&$.c(),d=I(),S&&S.c(),g=I(),p=k("p"),p.textContent="These are the files your model will use as context.",m=I(),_=k("p"),_.innerHTML="Currently pdf, txt, and md are supported.",b=I(),w=k("div"),ee(C.$$.fragment),E=I(),F&&F.c(),h(f,"type","file"),f.multiple=!0,h(i,"class","upload-box svelte-1lu6hos"),h(r,"class","upload-container svelte-1lu6hos"),h(n,"class","file-container svelte-1lu6hos"),h(w,"class","charts-container svelte-1lu6hos"),h(t,"class","data-grid svelte-1lu6hos")},m(N,M){x(N,t,M),v(t,n),v(n,r),v(r,i),v(i,o),v(i,l),v(i,s),v(i,a),v(i,u),v(u,f),v(i,c),$&&$.m(i,null),v(i,d),S&&S.m(i,null),v(i,g),v(i,p),v(i,m),v(i,_),v(t,b),v(t,w),J(C,w,null),v(w,E),F&&F.m(w,null),R=!0,A||(y=U(f,"change",e[4]),A=!0)},p(N,[M]){N[2]&&!N[1]?$?$.p(N,M):($=Zl(N),$.c(),$.m(i,d)):$&&($.d(1),$=null),N[1]?S||(S=es(),S.c(),S.m(i,g)):S&&(S.d(1),S=null),N[0]?F?M&1&&P(F,1):(F=ts(),F.c(),P(F,1),F.m(w,null)):F&&(ce(),O(F,1,1,()=>{F=null}),de())},i(N){R||(P(C.$$.fragment,N),P(F),R=!0)},o(N){O(C.$$.fragment,N),O(F),R=!1},d(N){N&&T(t),$&&$.d(),S&&S.d(),Z(C),F&&F.d(),A=!1,y()}}}function Wp(e,t,n){let r,i,o;ne(e,Al,p=>n(6,i=p)),ne(e,cr,p=>n(7,o=p));let l=[],s=!1,a=!1;async function u(p){n(0,l=p.target.files);const m=new FormData;for(let _=0;_({file:b.name,size:b.size,type:b.type}));Ne(cr,o=[..._],o)}async function c(){console.log("index!"),n(2,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,s=!0),n(2,a=!1)}async function d(){console.log("getting embeddings...");const m=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",m),Ne(Al,i=m,i)}ct(()=>{f()});let g=0;return setInterval(()=>{n(5,g=(g+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,r="Indexing"+".".repeat(g))},[l,s,a,r,u,g]}class Xp extends ue{constructor(t){super(),fe(this,t,Wp,Up,ae,{})}}function Yp(e){let t,n,r,i,o,l,s,a,u,f,c,d,g,p,m,_,b,w,C,E,R,A,y,$,S,F,N;return o=new Qs({}),a=new Ks({}),c=new Bs({}),p=new Ws({props:{feedback:"Bad"}}),b=new Ys({}),E=new Xs({}),F=new Us({}),{c(){t=k("div"),n=k("div"),r=k("div"),i=k("div"),ee(o.$$.fragment),l=I(),s=k("div"),ee(a.$$.fragment),u=I(),f=k("div"),ee(c.$$.fragment),d=I(),g=k("div"),ee(p.$$.fragment),m=I(),_=k("div"),ee(b.$$.fragment),w=I(),C=k("div"),ee(E.$$.fragment),R=I(),A=k("div"),y=k("div"),y.innerHTML=`
+
`,$=I(),S=k("div"),ee(F.$$.fragment),h(i,"class","card-1 svelte-14znspc"),h(s,"class","card-2"),h(r,"class","left-text svelte-14znspc"),h(f,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(_,"class","left-filter svelte-14znspc"),h(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(y,"class","right-chart svelte-14znspc"),h(S,"class","right-table svelte-14znspc"),h(A,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(M,D){x(M,t,D),v(t,n),v(n,r),v(r,i),J(o,i,null),v(r,l),v(r,s),J(a,s,null),v(n,u),v(n,f),J(c,f,null),v(n,d),v(n,g),J(p,g,null),v(n,m),v(n,_),J(b,_,null),v(n,w),v(n,C),J(E,C,null),v(t,R),v(t,A),v(A,y),v(A,$),v(A,S),J(F,S,null),N=!0},p:q,i(M){N||(P(o.$$.fragment,M),P(a.$$.fragment,M),P(c.$$.fragment,M),P(p.$$.fragment,M),P(b.$$.fragment,M),P(E.$$.fragment,M),P(F.$$.fragment,M),N=!0)},o(M){O(o.$$.fragment,M),O(a.$$.fragment,M),O(c.$$.fragment,M),O(p.$$.fragment,M),O(b.$$.fragment,M),O(E.$$.fragment,M),O(F.$$.fragment,M),N=!1},d(M){M&&T(t),Z(o),Z(a),Z(c),Z(p),Z(b),Z(E),Z(F)}}}function Qp(e,t,n){let r;ne(e,_n,o=>n(0,r=o)),ct(()=>{console.log("FEEDBACK on mount"),i()});async function i(){const a=(await(await fetch("/chat/rag_table/retrieve")).json()).rows.map(u=>({id:u[0],question:u[1],answer:u[2],vote_status:u[4]}));Ne(_n,r=[...a],r)}return[]}class Kp extends ue{constructor(t){super(),fe(this,t,Qp,Yp,ae,{})}}function Jp(e){let t,n;return t=new Js({}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function Zp(e){let t,n;return t=new Kp({}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function em(e){let t,n;return t=new Js({}),{c(){ee(t.$$.fragment)},m(r,i){J(t,r,i),n=!0},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){O(t.$$.fragment,r),n=!1},d(r){Z(t,r)}}}function tm(e){let t,n,r,i;const o=[em,Zp,Jp],l=[];function s(a,u){return a[0]==="vote"?0:a[0]==="rag"?1:2}return t=s(e),n=l[t]=o[t](e),{c(){n.c(),r=Fe()},m(a,u){l[t].m(a,u),x(a,r,u),i=!0},p(a,[u]){let f=t;t=s(a),t!==f&&(ce(),O(l[f],1,1,()=>{l[f]=null}),de(),n=l[t],n||(n=l[t]=o[t](a),n.c()),P(n,1),n.m(r.parentNode,r))},i(a){i||(P(n),i=!0)},o(a){O(n),i=!1},d(a){l[t].d(a),a&&T(r)}}}function nm(e,t,n){let{feedback:r}=t;return e.$$set=i=>{"feedback"in i&&n(0,r=i.feedback)},[r]}class rm extends ue{constructor(t){super(),fe(this,t,nm,tm,ae,{feedback:0})}}function ns(e,t,n){const r=e.slice();return r[7]=t[n],r}function rs(e){let t,n=e[0],r=[];for(let i=0;i{Z(f,1)}),de()}o?(t=bt(o,l()),ee(t.$$.fragment),P(t.$$.fragment,1),J(t,n.parentNode,n)):t=null}else o&&t.$set(u)},i(s){r||(t&&P(t.$$.fragment,s),r=!0)},o(s){t&&O(t.$$.fragment,s),r=!1},d(s){s&&T(n),t&&Z(t,s)}}}function im(e){let t,n,r,i=e[0].length>1&&rs(e),o=e[1]&&os(e);return{c(){i&&i.c(),t=I(),o&&o.c(),n=Fe()},m(l,s){i&&i.m(l,s),x(l,t,s),o&&o.m(l,s),x(l,n,s),r=!0},p(l,[s]){l[0].length>1?i?i.p(l,s):(i=rs(l),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),l[1]?o?(o.p(l,s),s&2&&P(o,1)):(o=os(l),o.c(),P(o,1),o.m(n.parentNode,n)):o&&(ce(),O(o,1,1,()=>{o=null}),de())},i(l){r||(P(o),r=!0)},o(l){O(o),r=!1},d(l){i&&i.d(l),l&&T(t),o&&o.d(l),l&&T(n)}}}function om(e,t,n){let r,i;const o=Re([]);ne(e,o,f=>n(0,r=f));const l=Re(null);ne(e,l,f=>n(1,i=f));const s={Chatbot:Vc,Dropdown:Lc,Feedback:rm,Compare:th,RetrievalQA:Xp},a=f=>{l.set(f)};return fetch("/components").then(f=>{if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}).then(f=>{o.set(f),l.set(f[0])}).catch(f=>{console.log("Fetch request failed",f)}),[r,i,o,l,s,a,f=>a(f)]}class lm extends ue{constructor(t){super(),fe(this,t,om,im,ae,{})}}new lm({target:document.getElementById("app")}); diff --git a/pykoi/frontend/dist/assets/index-902bbaf3.css b/pykoi/frontend/dist/assets/index-902bbaf3.css new file mode 100644 index 0000000..d3f962a --- /dev/null +++ b/pykoi/frontend/dist/assets/index-902bbaf3.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css?family=Work+Sans:400|Lato:400|Inconsolata:400";:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:auto;width:100%}h1{font-size:3.2em;line-height:1.1}.card{padding:2em}#app{margin:0 auto;text-align:center}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Inconsolata", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px}header{color:var(--headerTextColor);position:fixed;left:0;top:0;width:100%;height:var(--headerHeight);background:var(--headerBackground);border-bottom:var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;position:absolute;bottom:0;width:100%}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:5px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 300px}/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--white);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--green);--footerTextColor: var(--black);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px;--height: height: calc(100vh - var(--headerHeight))}html{box-sizing:border-box;font-size:var(--baseFontSize)}*,*:before,*:after{box-sizing:inherit}body{font-family:var(--bodyFont);font-weight:400;line-height:1.75;background:var(--background);color:var(--textColor)}header{color:var(--headerTextColor);margin-top:1%;height:var(--headerHeight);background:var(--headerBackground);font-size:var(--h5);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}header nav a{color:var(--white);text-decoration:none}header nav a+a{margin-left:10px}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;bottom:0;width:100%}footer a{color:var(--footerTextColor)}footer nav a+a{margin-left:10px}footer p{margin-bottom:0;max-width:none}p{margin-bottom:1rem}p a,blockquote a{color:var(--textColor);text-decoration:none;border-bottom:var(--borderBottom)}h1,h2,h3,h4,h5{margin:3rem 0 1.38rem;font-family:var(--headingFont);font-weight:400;line-height:1.15}h1{margin-top:0;font-size:var(--h1)}h2{font-size:var(--h2)}h3{font-size:var(--h3)}h4{font-size:var(--h4)}h5{font-size:var(--h5)}small,.text_small{font-size:var(--smallText)}blockquote{margin:10px;padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg)}label{display:block;font-size:var(--smallText)}input,textarea{padding:2px 5px;border:var(--line);border-radius:4px}textarea{width:100%;height:5rem}::placeholder{color:var(--grey)}::selection,.highlight{background:#ffb7b7;background:var(--red);color:var(--white)}select{border:var(--line)}hr{border-top:var(--line)}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:10px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}button:hover{cursor:pointer;box-shadow:var(--shadow-md)}button[disabled]{opacity:.4}button.cancel{--buttonColor: var(--danger);--buttonTextColor: var(--white)}button.small{font-size:var(--smallText)}.layout{padding-top:calc(0rem + var(--headerHeight))}.grid{--gridCols: 2;display:block;grid-template-columns:repeat(var(--gridCols),1fr)}.cols-3{--gridCols: 3}.cols-4{--gridCols: 4}.flex{--justifyContent: space-between;display:block;justify-content:var(--justifyContent)}.flex-around{--justifyContent: space-around}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius)}.grid-split{display:grid;grid-template-columns:33% 67%;gap:20px}@media only screen and (min-width: 600px){:root{--baseFontSize: 100%}.grid{display:grid}.flex{display:flex}}.logo{font-size:var(--baseFontSize);margin:0 0 0 8px}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--yellow);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.oled{--black: #000;--cardBg: var(--darkGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 25px}.grid-sidemenu{--gridCols: 2;display:grid;grid-template-columns:var(--left) 1fr}header{padding:0 15px 0 0}header nav a+a{margin-left:15px}.corner{margin-left:var(--left)}header nav a{color:var(--black);text-decoration:none}.page{padding:3em}.page-title{text-decoration:none;border-bottom:var(--borderBottom)}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius);font-size:var(--smallText)}.card:hover{box-shadow:var(--shadow-xl)}.card>*:first-child{margin-top:0}.card>*:last-child{margin-bottom:0}table{margin:auto}button{margin:5px}.multiselect.svelte-8o2wf2.svelte-8o2wf2{position:relative;max-width:200px}.selectBox.svelte-8o2wf2.svelte-8o2wf2{position:relative}.selectBox.svelte-8o2wf2 select.svelte-8o2wf2{width:100%;font-weight:700}.overSelect.svelte-8o2wf2.svelte-8o2wf2{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-8o2wf2.svelte-8o2wf2{position:absolute;top:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1}.chat-and-question.svelte-1a3jfs3.svelte-1a3jfs3{display:grid;grid-template-columns:20% 80%;width:100%}.small-button.svelte-1a3jfs3.svelte-1a3jfs3{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-1a3jfs3.svelte-1a3jfs3{text-align:center;margin:auto;width:20%}.small-button.svelte-1a3jfs3.svelte-1a3jfs3:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1a3jfs3.svelte-1a3jfs3,.thumbs-up.svelte-1a3jfs3.svelte-1a3jfs3:hover,.thumbs-up.svelte-1a3jfs3.svelte-1a3jfs3::selection{background:var(--green)}.thumbs-down.svelte-1a3jfs3.svelte-1a3jfs3,.thumbs-down.svelte-1a3jfs3.svelte-1a3jfs3:hover,.thumbs-down.svelte-1a3jfs3.svelte-1a3jfs3::selection{background:var(--red)}.ranked-chat.svelte-1a3jfs3.svelte-1a3jfs3{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-1a3jfs3.svelte-1a3jfs3{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-1a3jfs3.svelte-1a3jfs3{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;width:100%}.btnyousend.svelte-1a3jfs3.svelte-1a3jfs3{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1a3jfs3.svelte-1a3jfs3{opacity:1}.green.svelte-1a3jfs3.svelte-1a3jfs3{border-bottom:2px solid var(--green)}.red.svelte-1a3jfs3.svelte-1a3jfs3{border-bottom:2px solid var(--red)}.instructions.svelte-1a3jfs3.svelte-1a3jfs3{text-align:center;padding:5%}.instructions.svelte-1a3jfs3 h5.svelte-1a3jfs3{text-align:left}.instructions.svelte-1a3jfs3 p.svelte-1a3jfs3{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-1a3jfs3.svelte-1a3jfs3{display:grid;grid-template-columns:20% 80%}.underline.svelte-1a3jfs3.svelte-1a3jfs3{border-bottom:var(--line)}.bold.svelte-1a3jfs3.svelte-1a3jfs3{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1a3jfs3.svelte-1a3jfs3{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1a3jfs3.svelte-1a3jfs3{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1a3jfs3 .question.svelte-1a3jfs3{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-1a3jfs3 .answer.svelte-1a3jfs3{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-1a3jfs3 .source.svelte-1a3jfs3{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey);color:var(--darkGrey);box-sizing:border-box}.source_tab.svelte-1a3jfs3.svelte-1a3jfs3{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.source_content.svelte-1a3jfs3.svelte-1a3jfs3{background-color:#fff;border:1pt solid var(--grey);padding:5px}.message-content.svelte-1a3jfs3 .answers.svelte-1a3jfs3{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-1a3jfs3.svelte-1a3jfs3{display:flex}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(50%);padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.ranked-chat.svelte-au920n.svelte-au920n{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-au920n.svelte-au920n{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-au920n.svelte-au920n{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-au920n.svelte-au920n{display:flex;width:100%}.btnyousend.svelte-au920n.svelte-au920n{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-au920n.svelte-au920n{opacity:1}.green.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--green)}.red.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--red)}.instructions.svelte-au920n.svelte-au920n{text-align:center;padding:5%}.instructions.svelte-au920n h5.svelte-au920n{text-align:left}.instructions.svelte-au920n p.svelte-au920n{font-size:var(--smallText);text-align:left}.instructions.svelte-au920n button.svelte-au920n{font-size:var(--smallText)}.ranked-feedback-container.svelte-au920n.svelte-au920n{display:grid;grid-template-columns:20% 80%}.underline.svelte-au920n.svelte-au920n{border-bottom:var(--line)}.bold.svelte-au920n.svelte-au920n{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-au920n.svelte-au920n{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-au920n.svelte-au920n{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-au920n .question.svelte-au920n{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-au920n .answer.svelte-au920n{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-au920n .answers.svelte-au920n{display:grid;grid-template-columns:49% 49%;gap:2%;width:100%;margin:auto}.source.svelte-1pk2e1k{text-align:left;background-color:var(--lightGrey);border:1px solid var(--grey);border-top:none;padding:0 5px;margin:0;color:var(--darkGrey);box-sizing:border-box}.source_tab.svelte-1pk2e1k{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.source_content.svelte-1pk2e1k{border:1pt solid var(--grey);padding:5px;margin-bottom:5px;background-color:#fff;color:var(--darkGrey)}p.svelte-1pk2e1k{margin:0;padding:0}.source.svelte-1pk2e1k:nth-of-type(2){border-top:1px solid var(--grey)}.sources.svelte-1r759df{display:inline-block;text-align:left;padding:5px;border:1pt solid var(--grey)}.sources-header.svelte-1r759df{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.box.svelte-iwm583.svelte-iwm583{margin-bottom:10px;padding:40px;border:1px solid #dee2e6;border-radius:0 0 .5rem .5rem;border-top:0}ul.svelte-iwm583.svelte-iwm583{display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none;border-bottom:1px solid #dee2e6}li.svelte-iwm583.svelte-iwm583{margin-bottom:-1px}span.svelte-iwm583.svelte-iwm583{border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem;display:block;padding:.5rem 1rem;cursor:pointer}span.svelte-iwm583.svelte-iwm583:hover{border-color:#e9ecef #e9ecef #dee2e6;color:#495057}li.svelte-iwm583>span.svelte-iwm583{color:var(--grey)}li.active.svelte-iwm583>span.svelte-iwm583{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.button-container.svelte-i9wciy{display:flex;justify-content:space-between}.note.svelte-i9wciy{font-size:var(--smallText);color:var(--gray)}.small-button.svelte-1u8cd0w{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-1u8cd0w{display:flex;text-align:center;margin:auto;width:20%}.small-button.svelte-1u8cd0w:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1u8cd0w,.thumbs-up.svelte-1u8cd0w:hover,.thumbs-up.svelte-1u8cd0w::selection{background:var(--green)}.thumbs-down.svelte-1u8cd0w,.thumbs-down.svelte-1u8cd0w:hover,.thumbs-down.svelte-1u8cd0w::selection{background:var(--red)}.chat-and-question.svelte-aj7hp0.svelte-aj7hp0{display:grid;grid-template-columns:20% 80%;width:100%}.ranked-chat.svelte-aj7hp0.svelte-aj7hp0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-aj7hp0.svelte-aj7hp0{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-aj7hp0.svelte-aj7hp0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-aj7hp0.svelte-aj7hp0{display:flex;width:100%}.btnyousend.svelte-aj7hp0.svelte-aj7hp0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-aj7hp0.svelte-aj7hp0{opacity:1}.green.svelte-aj7hp0.svelte-aj7hp0{border-bottom:2px solid var(--green)}.red.svelte-aj7hp0.svelte-aj7hp0{border-bottom:2px solid var(--red)}.instructions.svelte-aj7hp0.svelte-aj7hp0{text-align:center;padding:5%}.instructions.svelte-aj7hp0 h5.svelte-aj7hp0{text-align:left}.instructions.svelte-aj7hp0 p.svelte-aj7hp0{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-aj7hp0.svelte-aj7hp0{display:grid;grid-template-columns:20% 80%}.underline.svelte-aj7hp0.svelte-aj7hp0{border-bottom:var(--line)}.bold{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-aj7hp0.svelte-aj7hp0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-aj7hp0.svelte-aj7hp0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-aj7hp0.svelte-aj7hp0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-aj7hp0 .question.svelte-aj7hp0{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-aj7hp0 .answer.svelte-aj7hp0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-aj7hp0 .answers.svelte-aj7hp0{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-aj7hp0.svelte-aj7hp0{display:flex}.tooltip{white-space:nowrap;position:relative;padding-top:.35rem;cursor:zoom-in}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(calc(100% - 120px));padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:10px;width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.series.svelte-tg5p7i:focus{outline:none}.horizontal-bar-rect.selected.svelte-tg5p7i{stroke:var(--black);stroke-width:3}#stackedrect-holder.svelte-tg5p7i{height:100%;width:100%}.line.svelte-tg5p7i{stroke-width:3;stroke:var(--black);fill:none}.horizontal-bar-rect.svelte-tg5p7i{transition:opacity .3s}.horizontal-bar-rect.svelte-tg5p7i:hover{stroke:var(--black);stroke-width:3}.horizontal-bar-text.svelte-tg5p7i{transition:opacity .3s;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none;font-size:var(--smallText)}.qa-card.svelte-szi0e{border:2px solid var(--black);display:flex;flex-direction:column;font-size:var(--smallText);padding:4px;margin:6px}.qa-card.svelte-szi0e:hover{border:3px solid var(--black)}.question.svelte-szi0e{background-color:var(--white);margin:0;padding:8px;border-bottom:1px solid var(--black)}.answer.svelte-szi0e{background-color:var(--lightGrey);margin:0;padding:8px}.feedback.svelte-szi0e{margin:0;padding:8px}.up.svelte-szi0e{background-color:var(--green)}.down.svelte-szi0e{background-color:var(--red)}.na.svelte-szi0e{background-color:var(--yellow)}.qa-container.svelte-1xv9cfi{border:2px solid var(--background);max-height:100%;overflow-y:auto}.chart-title.svelte-1oikip4{font-size:var(--smallText)}rect.svelte-1oikip4:hover{stroke:var(--black)}#stackedrect-holder.svelte-1oikip4{height:100%;width:100%}.axis-line.svelte-1oikip4{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-1oikip4{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-1oikip4{font-size:calc(var(--smallText) * .9)}.svelte-kz2qh6{transition:all .3s}.chart-title.svelte-kz2qh6{font-size:var(--smallText)}rect.svelte-kz2qh6:hover{stroke:var(--black)}.histogram-container.svelte-kz2qh6{height:100%;width:100%}.axis-line.svelte-kz2qh6{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-kz2qh6{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-kz2qh6{font-size:calc(var(--smallText) * .9)}.svelte-1pknxov{font-family:Lato}.card-container.svelte-1pknxov{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-1pknxov{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-1pknxov{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-1pknxov{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-1pknxov{font-size:.6em}text.svelte-1pknxov{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.card-container.svelte-mchgj2{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-mchgj2{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-mchgj2{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-mchgj2{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-mchgj2{font-size:.6em}text.svelte-mchgj2{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.ranked-chat.svelte-1nj8mt0.svelte-1nj8mt0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.chat-input-holder.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;width:100%}.btnyousend.svelte-1nj8mt0.svelte-1nj8mt0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1nj8mt0.svelte-1nj8mt0{opacity:1}.instructions.svelte-1nj8mt0.svelte-1nj8mt0{text-align:center;padding:5%;border-right:var(--line)}.instructions.svelte-1nj8mt0 h5.svelte-1nj8mt0{text-align:left}.instructions.svelte-1nj8mt0 p.svelte-1nj8mt0{font-size:var(--smallText);text-align:left;margin:0}.instructions.svelte-1nj8mt0 button.svelte-1nj8mt0{font-size:var(--smallText)}.ranked-feedback-container.svelte-1nj8mt0.svelte-1nj8mt0{display:grid;grid-template-columns:20% 80%}.underline.svelte-1nj8mt0.svelte-1nj8mt0{border-bottom:var(--line)}.bold.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1nj8mt0.svelte-1nj8mt0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1nj8mt0 .question.svelte-1nj8mt0{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-1nj8mt0 .answer.svelte-1nj8mt0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}option.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:120%}p.svelte-1nj8mt0.svelte-1nj8mt0{margin:0}.svelte-1nna9rx{font-family:Lato}#chart-holder.svelte-1nna9rx{height:100%;width:100%}.axis-line.svelte-1nna9rx{stroke-width:3;stroke:#000;fill:none}.axis-tick.svelte-1nna9rx{stroke-width:2;stroke:#000;fill:none;opacity:.13}.axis-text.svelte-1nna9rx{font-family:Arial;font-size:12px}.bump-text.svelte-1nna9rx{font-size:12px;pointer-events:none}.model-path.svelte-1nna9rx{fill:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}.model-path-outer.svelte-1nna9rx{fill:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:round}.chart-subtitle.svelte-1nna9rx{font-size:12px}#bar-chart-holder.svelte-1y9gffu{height:100%;width:100%}.axis-text.svelte-1y9gffu{font-size:9px}.axis-line.svelte-1y9gffu{stroke-width:3;stroke:#000;fill:none}.label-text.svelte-1y9gffu{font-size:9px}.cell.svelte-hnulv9{max-height:40px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.cell.active.svelte-hnulv9{max-height:100%;overflow:visible;white-space:normal}.svelte-owgjbp.svelte-owgjbp{font-family:Lato,monospace}.table.svelte-owgjbp.svelte-owgjbp{margin:auto;width:90%}.pretty-pager.svelte-owgjbp.svelte-owgjbp{padding-top:1rem}.pretty-table.normal.svelte-owgjbp.svelte-owgjbp{font-size:15px}.pretty-table.normal.svelte-owgjbp th.svelte-owgjbp,.pretty-table.normal.svelte-owgjbp td.svelte-owgjbp{padding:3px 2px}.pretty-table.svelte-owgjbp th.svelte-owgjbp,.pretty-table.svelte-owgjbp td.svelte-owgjbp{vertical-align:top}.pretty-table.svelte-owgjbp thead th.svelte-owgjbp{text-transform:uppercase;font-weight:700;font-family:Work Sans,sans-serif;border-bottom:2px solid black}.pretty-table.svelte-owgjbp th.svelte-owgjbp{cursor:pointer}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{text-align:right}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{font-family:menlo,consolas,monaco,monospace;font-size:90%}.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{padding-right:1em;color:#666}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse;table-layout:fixed}.pretty-table.svelte-owgjbp tr.svelte-owgjbp{border-bottom:1px solid #eee}td.active.svelte-owgjbp.svelte-owgjbp{max-height:100%;overflow:auto;color:red}td.svelte-owgjbp.svelte-owgjbp:not(.active){overflow:hidden;white-space:normal}tr.svelte-owgjbp.svelte-owgjbp:hover{background:#eee}.pretty-table.svelte-owgjbp.svelte-owgjbp{width:100%}#heatmap-holder.svelte-t6wv8i{height:100%;width:100%}.axis-text.svelte-t6wv8i,.chart-subtitle.svelte-t6wv8i{font-size:12px}.holder.svelte-1gze3r0.svelte-1gze3r0{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-1gze3r0.svelte-1gze3r0{margin:0}.chart-captions.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-1gze3r0 h4.svelte-1gze3r0{padding:0;margin:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{text-align:left;padding-left:0}.instructions.svelte-1gze3r0 p.svelte-1gze3r0{font-size:var(--smallText);text-align:left}.instructions.svelte-1gze3r0 button.svelte-1gze3r0{font-size:var(--smallText)}.underline.svelte-1gze3r0.svelte-1gze3r0{border-bottom:var(--line)}.bold.svelte-1gze3r0.svelte-1gze3r0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{border-right:1px solid #eee}.main-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:20% 80%}.eval-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%}.right-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:10% 33% 33%;gap:1%}.main-annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:90% 10%;height:100vh;width:100%;margin:auto}.buttons.svelte-3wjb3y.svelte-3wjb3y{display:flex;background:var(--grey)}.rating-button.svelte-3wjb3y.svelte-3wjb3y{padding:10px;border:none}.rating-button.svelte-3wjb3y+.rating-button.svelte-3wjb3y{margin-left:-1px}.ranked-chat.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:100%;border:var(--line);margin:12px}.chat-input-holder.svelte-3wjb3y.svelte-3wjb3y{align-items:center;width:100%;margin:auto;border-top:var(--line)}.instructions.svelte-3wjb3y.svelte-3wjb3y{text-align:center;padding:5%}.instructions.svelte-3wjb3y h5.svelte-3wjb3y{text-align:left}.instructions.svelte-3wjb3y p.svelte-3wjb3y{font-size:var(--smallText);text-align:left}.instructions.svelte-3wjb3y button.svelte-3wjb3y{font-size:var(--smallText)}.annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:40% 60%}.underline.svelte-3wjb3y.svelte-3wjb3y{border-bottom:var(--line)}.bold.svelte-3wjb3y.svelte-3wjb3y{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-message-center.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;padding:12px;box-sizing:border-box}.message-content.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;box-sizing:border-box;display:block}.message-content.svelte-3wjb3y .question.svelte-3wjb3y{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-3wjb3y .answer.svelte-3wjb3y{display:block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-3wjb3y .answers.svelte-3wjb3y{display:grid;grid-template-columns:100%;gap:2%;width:100%;margin:auto}svg.svelte-h2ab3o{background:conic-gradient(from 90deg at 1px 1px,#0000 90deg,rgba(0,0,0,.04) 0) 0 0/20px 20px;border:var(--line)}.file-circle-g.svelte-h2ab3o:hover{opacity:1}.bubble-file-text.svelte-h2ab3o{font-size:calc(.99 * var(--smallText));pointer-events:none;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill}circle.svelte-h2ab3o{transition:all .3s ease}circle.svelte-h2ab3o:hover{stroke:var(--black);stroke-width:3}.table-container.svelte-16fb3tv.svelte-16fb3tv{margin:auto;width:100%;overflow-y:scroll;max-height:100%;height:100%;overflow-y:auto}table.svelte-16fb3tv.svelte-16fb3tv{width:100%;border-collapse:collapse;font-size:var(--smallText)}thead.svelte-16fb3tv th.svelte-16fb3tv{text-align:center;padding:5px;border-bottom:4px solid var(--grey);background-color:var(--lightGrey)}thead.svelte-16fb3tv th.svelte-16fb3tv:nth-child(1){text-align:left}tbody.svelte-16fb3tv tr.svelte-16fb3tv{border-bottom:var(--line)}tbody.svelte-16fb3tv tr.svelte-16fb3tv:nth-child(2n){background-color:var(--white)}tbody.svelte-16fb3tv td.svelte-16fb3tv{padding:10px}.is-flex.svelte-16fb3tv.svelte-16fb3tv{display:flex;justify-content:space-between;align-items:center;padding:10px}.button.svelte-16fb3tv.svelte-16fb3tv{padding:5px 10px;border:none;cursor:pointer;transition:background-color .3s ease}.button.is-disabled.svelte-16fb3tv.svelte-16fb3tv{cursor:not-allowed;color:#ccc}.button.svelte-16fb3tv.svelte-16fb3tv:not(.is-disabled):hover{background-color:#f2f2f2}.button.is-white.svelte-16fb3tv.svelte-16fb3tv{color:#000}.mx-1.svelte-16fb3tv.svelte-16fb3tv{margin-left:1em;margin-right:1em}.file-container.svelte-1lu6hos{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-1lu6hos{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-1lu6hos{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-1lu6hos{display:grid;grid-template-columns:45% 50%;gap:0;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-1lu6hos{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;max-height:50vh;margin:auto;border:5px dashed var(--grey);padding:20px;box-sizing:border-box}.feedback-container.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:30% 70%;grid-template-rows:100%;width:90%;height:calc(100vh - var(--headerHeight))}.feedback-left.svelte-14znspc{border-bottom:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:25% 25% 25% 12.5% 12.5%}.left-text.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:100%;grid-template-columns:50% 50%}.left-confidence.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:40% 55%}.left-question.svelte-14znspc,.left-filter.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.feedback-right.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:30% 70%;grid-template-rows:0% 100%}.right-chart.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:50% 50%;grid-template-rows:100%}.right-chart-1.svelte-14znspc,.right-chart-2.svelte-14znspc{border-right:var(--line)}.right-table.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.card-1.svelte-14znspc{border-right:var(--line)} diff --git a/pykoi/frontend/dist/assets/index-c5532657.css b/pykoi/frontend/dist/assets/index-c5532657.css deleted file mode 100644 index f38bb83..0000000 --- a/pykoi/frontend/dist/assets/index-c5532657.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css?family=Work+Sans:400|Lato:400|Inconsolata:400";:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:auto;width:100%}h1{font-size:3.2em;line-height:1.1}.card{padding:2em}#app{margin:0 auto;text-align:center}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Inconsolata", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px}header{color:var(--headerTextColor);position:fixed;left:0;top:0;width:100%;height:var(--headerHeight);background:var(--headerBackground);border-bottom:var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;position:absolute;bottom:0;width:100%}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:5px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--lightGrey);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 300px}/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--yellow);--danger: var(--red);--background: var(--white);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--white);--footerBackground: var(--green);--footerTextColor: var(--black);--headerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--borderBottom: solid 2px var(--primary);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 0px;--height: height: calc(100vh - var(--headerHeight))}html{box-sizing:border-box;font-size:var(--baseFontSize)}*,*:before,*:after{box-sizing:inherit}body{font-family:var(--bodyFont);font-weight:400;line-height:1.75;background:var(--background);color:var(--textColor)}header{color:var(--headerTextColor);margin-top:1%;height:var(--headerHeight);background:var(--headerBackground);font-size:var(--h5);display:flex;justify-content:space-between;align-items:center;padding:0 var(--containerPadding)}header nav a{color:var(--white);text-decoration:none}header nav a+a{margin-left:10px}footer{color:var(--footerTextColor);background-color:var(--footerBackground);padding:calc(var(--headerHeight) * .75) var(--containerPadding);text-align:center;bottom:0;width:100%}footer a{color:var(--footerTextColor)}footer nav a+a{margin-left:10px}footer p{margin-bottom:0;max-width:none}p{margin-bottom:1rem}p a,blockquote a{color:var(--textColor);text-decoration:none;border-bottom:var(--borderBottom)}h1,h2,h3,h4,h5{margin:3rem 0 1.38rem;font-family:var(--headingFont);font-weight:400;line-height:1.15}h1{margin-top:0;font-size:var(--h1)}h2{font-size:var(--h2)}h3{font-size:var(--h3)}h4{font-size:var(--h4)}h5{font-size:var(--h5)}small,.text_small{font-size:var(--smallText)}blockquote{margin:10px;padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg)}label{display:block;font-size:var(--smallText)}input,textarea{padding:2px 5px;border:var(--line);border-radius:4px}textarea{width:100%;height:5rem}::placeholder{color:var(--grey)}::selection,.highlight{background:#ffb7b7;background:var(--red);color:var(--white)}select{border:var(--line)}hr{border-top:var(--line)}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--buttonTextColor);background-color:var(--white);border:var(--line);border-radius:var(--borderRadius);padding:10px 25px;box-shadow:var(--shadow-s);transition:.3s ease-in-out box-shadow}button:hover{cursor:pointer;box-shadow:var(--shadow-md)}button[disabled]{opacity:.4}button.cancel{--buttonColor: var(--danger);--buttonTextColor: var(--white)}button.small{font-size:var(--smallText)}.layout{padding-top:calc(0rem + var(--headerHeight))}.grid{--gridCols: 2;display:block;grid-template-columns:repeat(var(--gridCols),1fr)}.cols-3{--gridCols: 3}.cols-4{--gridCols: 4}.flex{--justifyContent: space-between;display:block;justify-content:var(--justifyContent)}.flex-around{--justifyContent: space-around}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius)}.grid-split{display:grid;grid-template-columns:33% 67%;gap:20px}@media only screen and (min-width: 600px){:root{--baseFontSize: 100%}.grid{display:grid}.flex{display:flex}}.logo{font-size:var(--baseFontSize);margin:0 0 0 8px}.dark{--background: var(--black);--textColor: var(--lightGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--yellow);--cardBg: var(--darkGrey);--buttonTextColor: var(--black)}.oled{--black: #000;--cardBg: var(--darkGrey);--headerBackground: var(--darkGrey);--footerBackground: var(--darkGrey)}.theme{--green: #00ebc7;--red: #FF5470;--yellow: #fde24f;--black: #1b2d45;--darkBlue: #00214d;--darkGrey: #222;--grey: #bfbfbf;--lightGrey: #f2f4f6;--white: white;--primary: var(--green);--danger: var(--red);--background: var(--lightGrey);--textColor: var(--black);--lineColor: var(--grey);--cardBg: var(--white);--headerBackground: var(--darkBlue);--footerBackground: var(--darkBlue);--footerTextColor: var(--black);--buttonColor: var(--primary);--buttonTextColor: var(--textColor);--line: solid 1px var(--lineColor);--headingFont: "Lato", monospace;--bodyFont: "Work Sans", sans-serif;--baseFontSize: 100%;--h1: 3.052em;--h2: 2.441em;--h3: 1.953em;--h4: 1.563em;--h5: 1.25em;--smallText: .8em;--shadow-s: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--containerPadding: 2.5%;--headerHeight: 3rem;--borderRadius: 10px}:root{--left: 25px}.grid-sidemenu{--gridCols: 2;display:grid;grid-template-columns:var(--left) 1fr}header{padding:0 15px 0 0}header nav a+a{margin-left:15px}.corner{margin-left:var(--left)}header nav a{color:var(--black);text-decoration:none}.page{padding:3em}.page-title{text-decoration:none;border-bottom:var(--borderBottom)}.card{padding:2em;background:var(--cardBg);box-shadow:var(--shadow-lg);border-radius:var(--borderRadius);font-size:var(--smallText)}.card:hover{box-shadow:var(--shadow-xl)}.card>*:first-child{margin-top:0}.card>*:last-child{margin-bottom:0}table{margin:auto}button{margin:5px}.multiselect.svelte-8o2wf2.svelte-8o2wf2{position:relative;max-width:200px}.selectBox.svelte-8o2wf2.svelte-8o2wf2{position:relative}.selectBox.svelte-8o2wf2 select.svelte-8o2wf2{width:100%;font-weight:700}.overSelect.svelte-8o2wf2.svelte-8o2wf2{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-8o2wf2.svelte-8o2wf2{position:absolute;top:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1}.chat-and-question.svelte-1uetn8d.svelte-1uetn8d{display:grid;grid-template-columns:20% 80%;width:100%}.small-button.svelte-1uetn8d.svelte-1uetn8d{margin-left:10px;background:none;border:3px solid transparent;color:inherit;padding:6px 10px;cursor:pointer;box-shadow:none;font-size:var(--smallText)}.feedback-buttons.svelte-1uetn8d.svelte-1uetn8d{text-align:center;margin:auto;width:20%}.small-button.svelte-1uetn8d.svelte-1uetn8d:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1uetn8d.svelte-1uetn8d,.thumbs-up.svelte-1uetn8d.svelte-1uetn8d:hover,.thumbs-up.svelte-1uetn8d.svelte-1uetn8d::selection{background:var(--green)}.thumbs-down.svelte-1uetn8d.svelte-1uetn8d,.thumbs-down.svelte-1uetn8d.svelte-1uetn8d:hover,.thumbs-down.svelte-1uetn8d.svelte-1uetn8d::selection{background:var(--red)}.ranked-chat.svelte-1uetn8d.svelte-1uetn8d{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-1uetn8d.svelte-1uetn8d{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-1uetn8d.svelte-1uetn8d{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1uetn8d.svelte-1uetn8d{display:flex;width:100%}.btnyousend.svelte-1uetn8d.svelte-1uetn8d{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1uetn8d.svelte-1uetn8d{opacity:1}.green.svelte-1uetn8d.svelte-1uetn8d{border-bottom:2px solid var(--green)}.red.svelte-1uetn8d.svelte-1uetn8d{border-bottom:2px solid var(--red)}.instructions.svelte-1uetn8d.svelte-1uetn8d{text-align:center;padding:5%}.instructions.svelte-1uetn8d h5.svelte-1uetn8d{text-align:left}.instructions.svelte-1uetn8d p.svelte-1uetn8d{font-size:var(--smallText);text-align:left}.ranked-feedback-container.svelte-1uetn8d.svelte-1uetn8d{display:grid;grid-template-columns:20% 80%}.underline.svelte-1uetn8d.svelte-1uetn8d{border-bottom:var(--line)}.bold.svelte-1uetn8d.svelte-1uetn8d{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1uetn8d.svelte-1uetn8d{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1uetn8d.svelte-1uetn8d{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1uetn8d.svelte-1uetn8d{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1uetn8d .question.svelte-1uetn8d{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-1uetn8d .answer.svelte-1uetn8d{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-1uetn8d .source.svelte-1uetn8d{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey);color:var(--darkGrey);box-sizing:border-box}.source_tab.svelte-1uetn8d.svelte-1uetn8d{display:flex;justify-content:space-between;align-items:center;cursor:pointer}.source_content.svelte-1uetn8d.svelte-1uetn8d{background-color:#fff;border:1pt solid var(--grey);padding:5px}.message-content.svelte-1uetn8d .answers.svelte-1uetn8d{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-1uetn8d.svelte-1uetn8d{display:flex}.tooltip{white-space:nowrap;position:relative;padding-top:.35rem;cursor:zoom-in}#tooltip{position:absolute;bottom:100%;right:.78rem;transform:translate(calc(100% - 120px));padding:.2rem .35rem;background:hsl(0,0%,20%);color:#fafafa;font-size:.95em;border-radius:.25rem;filter:drop-shadow(0 1px 2px hsla(0,0%,0%,.2));width:max-content}.tooltip #tooltip:before{content:"";position:absolute;top:100%;left:10px;width:.6em;height:.25em;background:inherit;clip-path:polygon(0% 0%,100% 0%,50% 100%)}.ranked-chat.svelte-au920n.svelte-au920n{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-au920n.svelte-au920n{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-au920n.svelte-au920n{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-au920n.svelte-au920n{display:flex;width:100%}.btnyousend.svelte-au920n.svelte-au920n{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-au920n.svelte-au920n{opacity:1}.green.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--green)}.red.svelte-au920n.svelte-au920n{border-bottom:2px solid var(--red)}.instructions.svelte-au920n.svelte-au920n{text-align:center;padding:5%}.instructions.svelte-au920n h5.svelte-au920n{text-align:left}.instructions.svelte-au920n p.svelte-au920n{font-size:var(--smallText);text-align:left}.instructions.svelte-au920n button.svelte-au920n{font-size:var(--smallText)}.ranked-feedback-container.svelte-au920n.svelte-au920n{display:grid;grid-template-columns:20% 80%}.underline.svelte-au920n.svelte-au920n{border-bottom:var(--line)}.bold.svelte-au920n.svelte-au920n{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-au920n.svelte-au920n{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-au920n.svelte-au920n{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-au920n.svelte-au920n{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-au920n .question.svelte-au920n{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-au920n .answer.svelte-au920n{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-au920n .answers.svelte-au920n{display:grid;grid-template-columns:49% 49%;gap:2%;width:100%;margin:auto}.series.svelte-tg5p7i:focus{outline:none}.horizontal-bar-rect.selected.svelte-tg5p7i{stroke:var(--black);stroke-width:3}#stackedrect-holder.svelte-tg5p7i{height:100%;width:100%}.line.svelte-tg5p7i{stroke-width:3;stroke:var(--black);fill:none}.horizontal-bar-rect.svelte-tg5p7i{transition:opacity .3s}.horizontal-bar-rect.svelte-tg5p7i:hover{stroke:var(--black);stroke-width:3}.horizontal-bar-text.svelte-tg5p7i{transition:opacity .3s;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none;font-size:var(--smallText)}.qa-card.svelte-szi0e{border:2px solid var(--black);display:flex;flex-direction:column;font-size:var(--smallText);padding:4px;margin:6px}.qa-card.svelte-szi0e:hover{border:3px solid var(--black)}.question.svelte-szi0e{background-color:var(--white);margin:0;padding:8px;border-bottom:1px solid var(--black)}.answer.svelte-szi0e{background-color:var(--lightGrey);margin:0;padding:8px}.feedback.svelte-szi0e{margin:0;padding:8px}.up.svelte-szi0e{background-color:var(--green)}.down.svelte-szi0e{background-color:var(--red)}.na.svelte-szi0e{background-color:var(--yellow)}.qa-container.svelte-1xv9cfi{border:2px solid var(--background);max-height:100%;overflow-y:auto}.chart-title.svelte-1oikip4{font-size:var(--smallText)}rect.svelte-1oikip4:hover{stroke:var(--black)}#stackedrect-holder.svelte-1oikip4{height:100%;width:100%}.axis-line.svelte-1oikip4{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-1oikip4{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-1oikip4{font-size:calc(var(--smallText) * .9)}.svelte-kz2qh6{transition:all .3s}.chart-title.svelte-kz2qh6{font-size:var(--smallText)}rect.svelte-kz2qh6:hover{stroke:var(--black)}.histogram-container.svelte-kz2qh6{height:100%;width:100%}.axis-line.svelte-kz2qh6{stroke-width:3;stroke:var(--black);fill:none}.axis-tick.svelte-kz2qh6{stroke-width:1;fill:none;opacity:0;font-size:9px}.axis-text.svelte-kz2qh6{font-size:calc(var(--smallText) * .9)}.svelte-1pknxov{font-family:Lato}.card-container.svelte-1pknxov{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-1pknxov{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-1pknxov{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-1pknxov{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-1pknxov{font-size:.6em}text.svelte-1pknxov{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.card-container.svelte-mchgj2{border:2px solid var(--black);width:100%;height:100%;display:grid;grid-template-columns:100%;grid-template-rows:35% 50% 10%;padding:5px;box-sizing:border-box}.card-text.svelte-mchgj2{text-align:left;margin:0;padding:0 0 0 2px;font-weight:700;font-size:.8em}#feedback-dropdown.svelte-mchgj2{width:98%;border:none;border-bottom:1px solid var(--black);border-top:1px solid var(--black);font-size:var(--smallText);margin-bottom:1px}svg.svelte-mchgj2{width:100%;height:100%;border-bottom:1px solid var(--black)}.small.svelte-mchgj2{font-size:.6em}text.svelte-mchgj2{font-size:3rem;transition:opacity .3s;stroke:#fff;stroke-width:6px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill;pointer-events:none}.feedback-container.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:30% 70%;grid-template-rows:100%;width:90%;height:calc(100vh - var(--headerHeight))}.feedback-left.svelte-14znspc{border-bottom:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:25% 25% 25% 12.5% 12.5%}.left-text.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:100%;grid-template-columns:50% 50%}.left-confidence.svelte-14znspc{text-align:center;border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-rows:40% 55%}.left-question.svelte-14znspc,.left-filter.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.feedback-right.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:100%;grid-template-rows:30% 70%;grid-template-rows:0% 100%}.right-chart.svelte-14znspc{border-bottom:var(--line);border-right:var(--line);display:grid;grid-template-columns:50% 50%;grid-template-rows:100%}.right-chart-1.svelte-14znspc,.right-chart-2.svelte-14znspc{border-right:var(--line)}.right-table.svelte-14znspc{border-bottom:var(--line);border-right:var(--line)}.card-1.svelte-14znspc{border-right:var(--line)}.ranked-chat.svelte-1nj8mt0.svelte-1nj8mt0{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.chat-input-holder.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;align-items:center;padding:24px;width:100%;max-width:640px;margin:auto}.chat-input-textarea.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--lightgrey);cursor:pointer;width:100%;border:var(--line);border-color:none;margin:12px;outline:none;padding:12px;color:var(--black);font-size:var(--baseFontSize);box-shadow:var(--shadow-md);flex:3;border-radius:0;border-right:0px}.chat-input-form.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;width:100%}.btnyousend.svelte-1nj8mt0.svelte-1nj8mt0{border-radius:0;margin-top:12px;margin-bottom:12px;margin-left:-15px;background:var(--primary);color:var(--black);opacity:.5;transition:all .3s}.active.svelte-1nj8mt0.svelte-1nj8mt0{opacity:1}.instructions.svelte-1nj8mt0.svelte-1nj8mt0{text-align:center;padding:5%;border-right:var(--line)}.instructions.svelte-1nj8mt0 h5.svelte-1nj8mt0{text-align:left}.instructions.svelte-1nj8mt0 p.svelte-1nj8mt0{font-size:var(--smallText);text-align:left;margin:0}.instructions.svelte-1nj8mt0 button.svelte-1nj8mt0{font-size:var(--smallText)}.ranked-feedback-container.svelte-1nj8mt0.svelte-1nj8mt0{display:grid;grid-template-columns:20% 80%}.underline.svelte-1nj8mt0.svelte-1nj8mt0{border-bottom:var(--line)}.bold.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-log.svelte-1nj8mt0.svelte-1nj8mt0{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-1nj8mt0.svelte-1nj8mt0{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-1nj8mt0.svelte-1nj8mt0{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-1nj8mt0 .question.svelte-1nj8mt0{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-1nj8mt0 .answer.svelte-1nj8mt0{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}option.svelte-1nj8mt0.svelte-1nj8mt0{font-weight:700;font-size:120%}p.svelte-1nj8mt0.svelte-1nj8mt0{margin:0}.svelte-1nna9rx{font-family:Lato}#chart-holder.svelte-1nna9rx{height:100%;width:100%}.axis-line.svelte-1nna9rx{stroke-width:3;stroke:#000;fill:none}.axis-tick.svelte-1nna9rx{stroke-width:2;stroke:#000;fill:none;opacity:.13}.axis-text.svelte-1nna9rx{font-family:Arial;font-size:12px}.bump-text.svelte-1nna9rx{font-size:12px;pointer-events:none}.model-path.svelte-1nna9rx{fill:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}.model-path-outer.svelte-1nna9rx{fill:none;stroke-width:8;stroke-linecap:round;stroke-linejoin:round}.chart-subtitle.svelte-1nna9rx{font-size:12px}#bar-chart-holder.svelte-1y9gffu{height:100%;width:100%}.axis-text.svelte-1y9gffu{font-size:9px}.axis-line.svelte-1y9gffu{stroke-width:3;stroke:#000;fill:none}.label-text.svelte-1y9gffu{font-size:9px}.cell.svelte-hnulv9{max-height:40px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.cell.active.svelte-hnulv9{max-height:100%;overflow:visible;white-space:normal}.svelte-owgjbp.svelte-owgjbp{font-family:Lato,monospace}.table.svelte-owgjbp.svelte-owgjbp{margin:auto;width:90%}.pretty-pager.svelte-owgjbp.svelte-owgjbp{padding-top:1rem}.pretty-table.normal.svelte-owgjbp.svelte-owgjbp{font-size:15px}.pretty-table.normal.svelte-owgjbp th.svelte-owgjbp,.pretty-table.normal.svelte-owgjbp td.svelte-owgjbp{padding:3px 2px}.pretty-table.svelte-owgjbp th.svelte-owgjbp,.pretty-table.svelte-owgjbp td.svelte-owgjbp{vertical-align:top}.pretty-table.svelte-owgjbp thead th.svelte-owgjbp{text-transform:uppercase;font-weight:700;font-family:Work Sans,sans-serif;border-bottom:2px solid black}.pretty-table.svelte-owgjbp th.svelte-owgjbp{cursor:pointer}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{text-align:right}.pretty-table.svelte-owgjbp tbody td.cell-type-number.svelte-owgjbp,.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{font-family:menlo,consolas,monaco,monospace;font-size:90%}.pretty-table.svelte-owgjbp tbody td.cell-rank.svelte-owgjbp{padding-right:1em;color:#666}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse}table.pretty-table.svelte-owgjbp.svelte-owgjbp{border-collapse:collapse;table-layout:fixed}.pretty-table.svelte-owgjbp tr.svelte-owgjbp{border-bottom:1px solid #eee}td.active.svelte-owgjbp.svelte-owgjbp{max-height:100%;overflow:auto;color:red}td.svelte-owgjbp.svelte-owgjbp:not(.active){overflow:hidden;white-space:normal}tr.svelte-owgjbp.svelte-owgjbp:hover{background:#eee}.pretty-table.svelte-owgjbp.svelte-owgjbp{width:100%}#heatmap-holder.svelte-t6wv8i{height:100%;width:100%}.axis-text.svelte-t6wv8i,.chart-subtitle.svelte-t6wv8i{font-size:12px}.holder.svelte-1gze3r0.svelte-1gze3r0{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-1gze3r0.svelte-1gze3r0{margin:0}.chart-captions.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-1gze3r0 h4.svelte-1gze3r0{padding:0;margin:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{text-align:left;padding-left:0}.instructions.svelte-1gze3r0 p.svelte-1gze3r0{font-size:var(--smallText);text-align:left}.instructions.svelte-1gze3r0 button.svelte-1gze3r0{font-size:var(--smallText)}.underline.svelte-1gze3r0.svelte-1gze3r0{border-bottom:var(--line)}.bold.svelte-1gze3r0.svelte-1gze3r0{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.instructions.svelte-1gze3r0.svelte-1gze3r0{border-right:1px solid #eee}.main-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:20% 80%}.eval-container.svelte-1gze3r0.svelte-1gze3r0{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-1gze3r0.svelte-1gze3r0{margin:auto;width:100%}.right-charts.svelte-1gze3r0.svelte-1gze3r0{display:grid;grid-template-columns:100%;grid-template-rows:10% 33% 33%;gap:1%}.main-annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:90% 10%;height:100vh;width:100%;margin:auto}.buttons.svelte-3wjb3y.svelte-3wjb3y{display:flex;background:var(--grey)}.rating-button.svelte-3wjb3y.svelte-3wjb3y{padding:10px;border:none}.rating-button.svelte-3wjb3y+.rating-button.svelte-3wjb3y{margin-left:-1px}.ranked-chat.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:100%;grid-template-rows:100%;border:var(--line);margin:12px}.chat-input-holder.svelte-3wjb3y.svelte-3wjb3y{align-items:center;width:100%;margin:auto;border-top:var(--line)}.instructions.svelte-3wjb3y.svelte-3wjb3y{text-align:center;padding:5%}.instructions.svelte-3wjb3y h5.svelte-3wjb3y{text-align:left}.instructions.svelte-3wjb3y p.svelte-3wjb3y{font-size:var(--smallText);text-align:left}.instructions.svelte-3wjb3y button.svelte-3wjb3y{font-size:var(--smallText)}.annotation-container.svelte-3wjb3y.svelte-3wjb3y{display:grid;grid-template-columns:40% 60%}.underline.svelte-3wjb3y.svelte-3wjb3y{border-bottom:var(--line)}.bold.svelte-3wjb3y.svelte-3wjb3y{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - var(--headerHeight));background-color:var(--white);box-sizing:border-box;width:95%;margin:auto;height:100%}.chat-message-center.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;padding:12px;box-sizing:border-box}.message-content.svelte-3wjb3y.svelte-3wjb3y{display:flex;flex-direction:column;box-sizing:border-box;display:block}.message-content.svelte-3wjb3y .question.svelte-3wjb3y{text-align:left;border:1px solid var(--grey);padding:5px;margin-bottom:10px;background-color:var(--lightGrey)}.message-content.svelte-3wjb3y .answer.svelte-3wjb3y{display:block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-3wjb3y .answers.svelte-3wjb3y{display:grid;grid-template-columns:100%;gap:2%;width:100%;margin:auto}svg.svelte-h2ab3o{background:conic-gradient(from 90deg at 1px 1px,#0000 90deg,rgba(0,0,0,.04) 0) 0 0/20px 20px;border:var(--line)}.file-circle-g.svelte-h2ab3o:hover{opacity:1}.bubble-file-text.svelte-h2ab3o{font-size:calc(.99 * var(--smallText));pointer-events:none;stroke:var(--white);stroke-width:4px;fill:var(--black);stroke-linejoin:round;paint-order:stroke fill}circle.svelte-h2ab3o{transition:all .3s ease}circle.svelte-h2ab3o:hover{stroke:var(--black);stroke-width:3}.table-container.svelte-16fb3tv.svelte-16fb3tv{margin:auto;width:100%;overflow-y:scroll;max-height:100%;height:100%;overflow-y:auto}table.svelte-16fb3tv.svelte-16fb3tv{width:100%;border-collapse:collapse;font-size:var(--smallText)}thead.svelte-16fb3tv th.svelte-16fb3tv{text-align:center;padding:5px;border-bottom:4px solid var(--grey);background-color:var(--lightGrey)}thead.svelte-16fb3tv th.svelte-16fb3tv:nth-child(1){text-align:left}tbody.svelte-16fb3tv tr.svelte-16fb3tv{border-bottom:var(--line)}tbody.svelte-16fb3tv tr.svelte-16fb3tv:nth-child(2n){background-color:var(--white)}tbody.svelte-16fb3tv td.svelte-16fb3tv{padding:10px}.is-flex.svelte-16fb3tv.svelte-16fb3tv{display:flex;justify-content:space-between;align-items:center;padding:10px}.button.svelte-16fb3tv.svelte-16fb3tv{padding:5px 10px;border:none;cursor:pointer;transition:background-color .3s ease}.button.is-disabled.svelte-16fb3tv.svelte-16fb3tv{cursor:not-allowed;color:#ccc}.button.svelte-16fb3tv.svelte-16fb3tv:not(.is-disabled):hover{background-color:#f2f2f2}.button.is-white.svelte-16fb3tv.svelte-16fb3tv{color:#000}.mx-1.svelte-16fb3tv.svelte-16fb3tv{margin-left:1em;margin-right:1em}.file-container.svelte-1lu6hos{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-1lu6hos{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-1lu6hos{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-1lu6hos{display:grid;grid-template-columns:45% 50%;gap:0;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-1lu6hos{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;max-height:50vh;margin:auto;border:5px dashed var(--grey);padding:20px;box-sizing:border-box} diff --git a/pykoi/frontend/dist/index.html b/pykoi/frontend/dist/index.html index c71c999..e35de9f 100644 --- a/pykoi/frontend/dist/index.html +++ b/pykoi/frontend/dist/index.html @@ -5,8 +5,8 @@ Vite + Svelte - - + +
diff --git a/pykoi/frontend/src/App.svelte b/pykoi/frontend/src/App.svelte index be194df..bb9f970 100644 --- a/pykoi/frontend/src/App.svelte +++ b/pykoi/frontend/src/App.svelte @@ -8,6 +8,7 @@ import QuestionRating from "./lib/Annotations/QuestionRating.svelte"; import RankedChatbot from "./lib/Chatbots/RankedChatbot.svelte"; import RAG from "./lib/RAG/RAG.svelte"; + import FeedbackWrapper from "./lib/Dashboards/FeedbackWrapper.svelte"; const components = writable([]); const selectedPage = writable(null); @@ -15,7 +16,7 @@ const componentMap = { Chatbot: Chat, Dropdown: Dropdown, - Feedback: Feedback, + Feedback: FeedbackWrapper, Compare: ComparisonChat, RetrievalQA: RAG, }; diff --git a/pykoi/frontend/src/lib/Chatbots/Chat.svelte b/pykoi/frontend/src/lib/Chatbots/Chat.svelte index ca43ddf..dfd3650 100644 --- a/pykoi/frontend/src/lib/Chatbots/Chat.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Chat.svelte @@ -1,7 +1,7 @@ @@ -12,6 +12,9 @@ {#if feedback === "vote"} {/if} +{#if feedback === "rag"} + +{/if} {#if feedback === "rank"} {#if is_retrieval} diff --git a/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte b/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte index e38e2cc..4c97e78 100644 --- a/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Chatbot.svelte @@ -1,5 +1,5 @@ + +
+ {message.answer} +
+{#if feedback} + +{/if} + + diff --git a/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte b/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte new file mode 100644 index 0000000..14e3954 --- /dev/null +++ b/pykoi/frontend/src/lib/Chatbots/Components/ModifiedAnswer.svelte @@ -0,0 +1,87 @@ + + +
+