diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 022372383..d3ed9bf17 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -6,47 +6,47 @@ on: - preview jobs: - pypi-deployment: - runs-on: ubuntu-20.04 - permissions: - contents: write - steps: - - name: Check out code - uses: actions/checkout@v2 + # pypi-deployment: + # runs-on: ubuntu-20.04 + # permissions: + # contents: write + # steps: + # - name: Check out code + # uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10.8" + # - name: Set up Python + # uses: actions/setup-python@v4 + # with: + # python-version: "3.10.8" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install poetry - - name: Install project dependencies - run: cd server && poetry install + # - name: Install project dependencies + # run: cd server && poetry install - - name: Configure Poetry Token - run: cd server && poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} + # - name: Configure Poetry Token + # run: cd server && poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} - - name: Bump the version - run: cd server && poetry version patch + # - name: Bump the version + # run: cd server && poetry version patch - - name: Build and publish the package - run: cd server && poetry publish --build + # - name: Build and publish the package + # run: cd server && poetry publish --build - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "ci: 🏷 Update PyPI version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "ci: 🏷 Update PyPI version [skip ci]" - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} build: strategy: @@ -215,7 +215,7 @@ jobs: - name: Download Apple Silicon Binary if: matrix.os == 'macos-latest' && matrix.arch == 'arm64' - run: curl -o extensions/vscode/exe/continue_server https://continue-server-binaries.s3.us-west-1.amazonaws.com/apple-silicon/continue_server + run: curl -o extensions/vscode/exe/continue_server https://continue-server-binaries.s3.us-west-1.amazonaws.com/apple-silicon-preview/continue_server - name: Set permissions run: | @@ -293,42 +293,42 @@ jobs: branch: ${{ github.ref }} # 5. Download binaries and upload to S3 - - name: Download Linux build - uses: actions/download-artifact@v2 - with: - name: LinuxBinary - path: exe/linux + # - name: Download Linux build + # uses: actions/download-artifact@v2 + # with: + # name: LinuxBinary + # path: exe/linux - - name: Download macOS build - uses: actions/download-artifact@v2 - with: - name: macOSBinary - path: exe/mac + # - name: Download macOS build + # uses: actions/download-artifact@v2 + # with: + # name: macOSBinary + # path: exe/mac - - name: Download Windows build - uses: actions/download-artifact@v2 - with: - name: WindowsBinary - path: exe/windows + # - name: Download Windows build + # uses: actions/download-artifact@v2 + # with: + # name: WindowsBinary + # path: exe/windows - - name: Upload binaries to S3 (s3.continue.dev) - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks - env: - AWS_S3_BUCKET: s3.continue.dev - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: "us-west-1" - SOURCE_DIR: "exe" + # - name: Upload binaries to S3 (s3.continue.dev) + # uses: jakejarvis/s3-sync-action@master + # with: + # args: --acl public-read --follow-symlinks + # env: + # AWS_S3_BUCKET: s3.continue.dev + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # AWS_REGION: "us-west-1" + # SOURCE_DIR: "exe" - - name: Upload binaries to S3 (continue-server-binaries) - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks - env: - AWS_S3_BUCKET: continue-server-binaries - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: "us-west-1" - SOURCE_DIR: "exe" + # - name: Upload binaries to S3 (continue-server-binaries) + # uses: jakejarvis/s3-sync-action@master + # with: + # args: --acl public-read --follow-symlinks + # env: + # AWS_S3_BUCKET: continue-server-binaries + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # AWS_REGION: "us-west-1" + # SOURCE_DIR: "exe" diff --git a/.vscode/launch.json b/.vscode/launch.json index 77ced5f73..fac656674 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -90,7 +90,7 @@ "outFiles": ["${workspaceFolder}/extensions/vscode/out/**/*.js"], "preLaunchTask": "vscode-extension:build", "env": { - "CONTINUE_SERVER_URL": "http://localhost:8001" + "CONTINUE_SERVER_URL": "http://localhost:65432" } }, // Has to be run after starting the server (separately or using the compound configuration) diff --git a/extensions/intellij/src/main/resources/webview/assets/index.js b/extensions/intellij/src/main/resources/webview/assets/index.js index 6da0d5f1f..63e2704aa 100644 --- a/extensions/intellij/src/main/resources/webview/assets/index.js +++ b/extensions/intellij/src/main/resources/webview/assets/index.js @@ -354,7 +354,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var M2=C,nfe=tfe;function rfe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ife=typeof Object.is=="function"?Object.is:rfe,afe=nfe.useSyncExternalStore,ofe=M2.useRef,sfe=M2.useEffect,lfe=M2.useMemo,ufe=M2.useDebugValue;cP.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=ofe(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=lfe(function(){function u(h){if(!c){if(c=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var b=o.value;if(i(b,h))return f=b}return f=h}if(b=f,ife(p,h))return b;var y=r(h);return i!==void 0&&i(b,y)?b:(p=h,f=y)}var c=!1,p,f,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,i]);var s=afe(e,a[0],a[1]);return sfe(function(){o.hasValue=!0,o.value=s},[s]),ufe(s),s};uP.exports=cP;var cfe=uP.exports;function dfe(e){e()}let dP=dfe;const pfe=e=>dP=e,ffe=()=>dP,RI=Symbol.for("react-redux-context"),NI=typeof globalThis<"u"?globalThis:{};function hfe(){var e;if(!C.createContext)return{};const t=(e=NI[RI])!=null?e:NI[RI]=new Map;let n=t.get(C.createContext);return n||(n=C.createContext(null),t.set(C.createContext,n)),n}const yl=hfe();function eT(e=yl){return function(){return C.useContext(e)}}const pP=eT(),gfe=()=>{throw new Error("uSES not initialized!")};let fP=gfe;const mfe=e=>{fP=e},bfe=(e,t)=>e===t;function yfe(e=yl){const t=e===yl?pP:eT(e);return function(r,i={}){const{equalityFn:a=bfe,stabilityCheck:o=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:u,subscription:c,getServerState:p,stabilityCheck:f,noopCheck:m}=t();C.useRef(!0);const h=C.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o]),b=fP(c.addNestedSub,u.getState,p||u.getState,h,a);return C.useDebugValue(b),b}}const St=yfe();function Efe(){const e=ffe();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){!i||t===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const OI={notify(){},get:()=>[]};function vfe(e,t){let n,r=OI;function i(f){return u(),r.subscribe(f)}function a(){r.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return!!n}function u(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=Efe())}function c(){n&&(n(),n=void 0,r.clear(),r=OI)}const p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:c,getListeners:()=>r};return p}const _fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tfe=_fe?C.useLayoutEffect:C.useEffect;function Sfe({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:a="once"}){const o=C.useMemo(()=>{const c=vfe(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:a}},[e,r,i,a]),s=C.useMemo(()=>e.getState(),[e]);Tfe(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,s]);const u=t||yl;return C.createElement(u.Provider,{value:o},n)}function hP(e=yl){const t=e===yl?pP:eT(e);return function(){const{store:r}=t();return r}}const wfe=hP();function Afe(e=yl){const t=e===yl?wfe:hP(e);return function(){return t().dispatch}}const Io=Afe();mfe(cfe.useSyncExternalStoreWithSelector);pfe(c9.unstable_batchedUpdates);function za(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:tT(e)?2:nT(e)?3:0}function W1(e,t){return Cc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Cfe(e,t){return Cc(e)===2?e.get(t):e[t]}function gP(e,t,n){var r=Cc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function mP(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function tT(e){return Ofe&&e instanceof Map}function nT(e){return Dfe&&e instanceof Set}function Zl(e){return e.o||e.t}function rT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=yP(e);delete t[xn];for(var n=q1(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=xfe),Object.freeze(e),t&&Su(e,function(n,r){return iT(r,!0)},!0)),e}function xfe(){za(2)}function aT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function To(e){var t=Ay[e];return t||za(18,e),t}function kfe(e,t){Ay[e]||(Ay[e]=t)}function Ty(){return Cp}function E4(e,t){t&&(To("Patches"),e.u=[],e.s=[],e.v=t)}function Vg(e){Sy(e),e.p.forEach(Ife),e.p=null}function Sy(e){e===Cp&&(Cp=e.l)}function DI(e){return Cp={p:[],l:Cp,h:e,m:!0,_:0}}function Ife(e){var t=e[xn];t.i===0||t.i===1?t.j():t.g=!0}function v4(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||To("ES5").S(t,e,r),r?(n[xn].P&&(Vg(t),za(4)),ps(e)&&(e=Wg(t,e),t.l||qg(t,e)),t.u&&To("Patches").M(n[xn].t,e,t.u,t.s)):e=Wg(t,n,[]),Vg(t),t.u&&t.v(t.u,t.s),e!==bP?e:void 0}function Wg(e,t,n){if(aT(t))return t;var r=t[xn];if(!r)return Su(t,function(s,u){return LI(e,r,t,s,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return qg(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=rT(r.k):r.o,a=i,o=!1;r.i===3&&(a=new Set(i),i.clear(),o=!0),Su(a,function(s,u){return LI(e,r,i,s,u,n,o)}),qg(e,i,!1),n&&e.u&&To("Patches").N(r,n,e.u,e.s)}return r.o}function LI(e,t,n,r,i,a,o){if(El(i)){var s=Wg(e,i,a&&t&&t.i!==3&&!W1(t.R,r)?a.concat(r):void 0);if(gP(n,r,s),!El(s))return;e.m=!1}else o&&n.add(i);if(ps(i)&&!aT(i)){if(!e.h.D&&e._<1)return;Wg(e,i),t&&t.A.l||qg(e,i)}}function qg(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&iT(t,n)}function _4(e,t){var n=e[xn];return(n?Zl(n):e)[t]}function MI(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function qs(e){e.P||(e.P=!0,e.l&&qs(e.l))}function T4(e){e.o||(e.o=rT(e.t))}function wy(e,t,n){var r=tT(t)?To("MapSet").F(t,n):nT(t)?To("MapSet").T(t,n):e.O?function(i,a){var o=Array.isArray(i),s={i:o?1:0,A:a?a.A:Ty(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},u=s,c=xp;o&&(u=[s],c=Sd);var p=Proxy.revocable(u,c),f=p.revoke,m=p.proxy;return s.k=m,s.j=f,m}(t,n):To("ES5").J(t,n);return(n?n.A:Ty()).p.push(r),r}function Rfe(e){return El(e)||za(22,e),function t(n){if(!ps(n))return n;var r,i=n[xn],a=Cc(n);if(i){if(!i.P&&(i.i<4||!To("ES5").K(i)))return i.t;i.I=!0,r=FI(n,a),i.I=!1}else r=FI(n,a);return Su(r,function(o,s){i&&Cfe(i.t,o)===s||gP(r,o,t(s))}),a===3?new Set(r):r}(e)}function FI(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return rT(e)}function Nfe(){function e(a,o){var s=i[a];return s?s.enumerable=o:i[a]=s={configurable:!0,enumerable:o,get:function(){var u=this[xn];return xp.get(u,a)},set:function(u){var c=this[xn];xp.set(c,a,u)}},s}function t(a){for(var o=a.length-1;o>=0;o--){var s=a[o][xn];if(!s.P)switch(s.i){case 5:r(s)&&qs(s);break;case 4:n(s)&&qs(s)}}}function n(a){for(var o=a.t,s=a.k,u=q1(s),c=u.length-1;c>=0;c--){var p=u[c];if(p!==xn){var f=o[p];if(f===void 0&&!W1(o,p))return!0;var m=s[p],h=m&&m[xn];if(h?h.t!==f:!mP(m,f))return!0}}var b=!!o[xn];return u.length!==q1(o).length+(b?0:1)}function r(a){var o=a.k;if(o.length!==a.t.length)return!0;var s=Object.getOwnPropertyDescriptor(o,o.length-1);if(s&&!s.get)return!0;for(var u=0;u1?E-1:0),w=1;w1?p-1:0),m=1;m=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var o=To("Patches").$;return El(n)?o(n,r):this.produce(n,function(s){return o(s,r)})},e}(),ji=new Mfe,EP=ji.produce;ji.produceWithPatches.bind(ji);ji.setAutoFreeze.bind(ji);ji.setUseProxies.bind(ji);ji.applyPatches.bind(ji);ji.createDraft.bind(ji);ji.finishDraft.bind(ji);function kp(e){"@babel/helpers - typeof";return kp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kp(e)}function Ffe(e,t){if(kp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pfe(e){var t=Ffe(e,"string");return kp(t)==="symbol"?t:String(t)}function Bfe(e,t,n){return t=Pfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $I(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 zI(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ur(1));return n(sT)(e,t)}if(typeof e!="function")throw new Error(Ur(2));var i=e,a=t,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function p(){if(u)throw new Error(Ur(3));return a}function f(y){if(typeof y!="function")throw new Error(Ur(4));if(u)throw new Error(Ur(5));var T=!0;return c(),s.push(y),function(){if(T){if(u)throw new Error(Ur(6));T=!1,c();var v=s.indexOf(y);s.splice(v,1),o=null}}}function m(y){if(!Ufe(y))throw new Error(Ur(7));if(typeof y.type>"u")throw new Error(Ur(8));if(u)throw new Error(Ur(9));try{u=!0,a=i(a,y)}finally{u=!1}for(var T=o=s,E=0;E"u")throw new Error(Ur(12));if(typeof n(void 0,{type:Kg.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ur(13))})}function vP(e){for(var t=Object.keys(e),n={},r=0;r"u")throw c&&c.type,new Error(Ur(14));f[h]=T,p=p||T!==y}return p=p||a.length!==Object.keys(u).length,p?f:u}}function Yg(){for(var e=arguments.length,t=new Array(e),n=0;n0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{let n=e.active;typeof t.stop=="boolean"&&(n=!t.stop);let r;t.index>e.history.length?r={...t.update}:t.delta===!0?(r={...e.history[t.index]},t.update.name&&(r.name=(r.name??"")+t.update.name),t.update.description&&(r.description=(r.description??"")+t.update.description),t.update.observations&&(r.observations=[...r.observations??[],...t.update.observations]),t.update.logs&&(r.logs=[...r.logs??[],...t.update.logs])):t.delta===!1&&(r={...e.history[t.index],...t.update});let i=[...e.history];return r&&(i[t.index]=r),{...e,history:i,active:n}},newSession:(e,{payload:t})=>t?(console.log("NEW SESSION"),{...e,history:t.session_state.history,context_items:t.session_state.context_items,contextItemsAtIndex:{},active:!1,title:t.title,session_id:t.session_id}):{...e,history:[],context_items:[],contextItemsAtIndex:{},active:!1,title:"New Session",session_id:Yd()},setTitle:(e,{payload:t})=>({...e,title:t}),setActive:(e,{payload:t})=>({...e,active:t}),setHistory:(e,{payload:t})=>({...e,history:t}),deleteAtIndex:(e,{payload:t})=>{let n=[...e.history];return n[t]={...n[t],hide:!0},{...e,history:n}},addContextItem:(e,{payload:t})=>(console.log("HERE...",t),{...e,context_items:[...e.context_items,t]}),addContextItemAtIndex:(e,{payload:t})=>({...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:[...e.contextItemsAtIndex[t.index]??[],t.item]}}),addHighlightedCode:(e,{payload:t})=>{let n=[...e.context_items].map(a=>({...a,editing:!1}));const r=`(${t.rangeInFileWithContents.range.start.line+1}-${t.rangeInFileWithContents.range.end.line+1})`,i=t.rangeInFileWithContents.filepath.split(/[\\/]/).pop();return n.push({description:{name:`${i} ${r}`,description:t.rangeInFileWithContents.filepath,id:{provider_title:"code",item_id:Yd()}},content:t.rangeInFileWithContents.contents,editing:!0,editable:!0}),{...e,context_items:n}},deleteContextWithIds:(e,{payload:t})=>{const n=t.ids.map(r=>`${r.provider_title}-${r.item_id}`);return typeof t.index>"u"?{...e,context_items:e.context_items.filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}}},setEditingAtIds:(e,{payload:t})=>{const n=t.ids.map(r=>r.item_id);return typeof t.index>"u"?{...e,context_items:e.context_items.map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}}}}}),{setActive:Xd,setHistory:YI,processSessionUpdate:b0e,newSession:F2,deleteAtIndex:C4,addContextItem:CP,addContextItemAtIndex:xP,addHighlightedCode:y0e,deleteContextWithIds:x4,setTitle:kP,setEditingAtIds:E0e}=AP.actions,v0e=AP.reducer,_0e=He.button` + */var M2=C,nfe=tfe;function rfe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ife=typeof Object.is=="function"?Object.is:rfe,afe=nfe.useSyncExternalStore,ofe=M2.useRef,sfe=M2.useEffect,lfe=M2.useMemo,ufe=M2.useDebugValue;cP.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=ofe(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=lfe(function(){function u(h){if(!c){if(c=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var b=o.value;if(i(b,h))return f=b}return f=h}if(b=f,ife(p,h))return b;var y=r(h);return i!==void 0&&i(b,y)?b:(p=h,f=y)}var c=!1,p,f,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,i]);var s=afe(e,a[0],a[1]);return sfe(function(){o.hasValue=!0,o.value=s},[s]),ufe(s),s};uP.exports=cP;var cfe=uP.exports;function dfe(e){e()}let dP=dfe;const pfe=e=>dP=e,ffe=()=>dP,RI=Symbol.for("react-redux-context"),NI=typeof globalThis<"u"?globalThis:{};function hfe(){var e;if(!C.createContext)return{};const t=(e=NI[RI])!=null?e:NI[RI]=new Map;let n=t.get(C.createContext);return n||(n=C.createContext(null),t.set(C.createContext,n)),n}const yl=hfe();function eT(e=yl){return function(){return C.useContext(e)}}const pP=eT(),gfe=()=>{throw new Error("uSES not initialized!")};let fP=gfe;const mfe=e=>{fP=e},bfe=(e,t)=>e===t;function yfe(e=yl){const t=e===yl?pP:eT(e);return function(r,i={}){const{equalityFn:a=bfe,stabilityCheck:o=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:u,subscription:c,getServerState:p,stabilityCheck:f,noopCheck:m}=t();C.useRef(!0);const h=C.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o]),b=fP(c.addNestedSub,u.getState,p||u.getState,h,a);return C.useDebugValue(b),b}}const wt=yfe();function Efe(){const e=ffe();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){!i||t===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const OI={notify(){},get:()=>[]};function vfe(e,t){let n,r=OI;function i(f){return u(),r.subscribe(f)}function a(){r.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return!!n}function u(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=Efe())}function c(){n&&(n(),n=void 0,r.clear(),r=OI)}const p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:c,getListeners:()=>r};return p}const _fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tfe=_fe?C.useLayoutEffect:C.useEffect;function Sfe({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:a="once"}){const o=C.useMemo(()=>{const c=vfe(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:a}},[e,r,i,a]),s=C.useMemo(()=>e.getState(),[e]);Tfe(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,s]);const u=t||yl;return C.createElement(u.Provider,{value:o},n)}function hP(e=yl){const t=e===yl?pP:eT(e);return function(){const{store:r}=t();return r}}const wfe=hP();function Afe(e=yl){const t=e===yl?wfe:hP(e);return function(){return t().dispatch}}const Io=Afe();mfe(cfe.useSyncExternalStoreWithSelector);pfe(c9.unstable_batchedUpdates);function za(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:tT(e)?2:nT(e)?3:0}function W1(e,t){return Cc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Cfe(e,t){return Cc(e)===2?e.get(t):e[t]}function gP(e,t,n){var r=Cc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function mP(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function tT(e){return Ofe&&e instanceof Map}function nT(e){return Dfe&&e instanceof Set}function Zl(e){return e.o||e.t}function rT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=yP(e);delete t[xn];for(var n=q1(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=xfe),Object.freeze(e),t&&Su(e,function(n,r){return iT(r,!0)},!0)),e}function xfe(){za(2)}function aT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function To(e){var t=Ay[e];return t||za(18,e),t}function kfe(e,t){Ay[e]||(Ay[e]=t)}function Ty(){return Cp}function E4(e,t){t&&(To("Patches"),e.u=[],e.s=[],e.v=t)}function Vg(e){Sy(e),e.p.forEach(Ife),e.p=null}function Sy(e){e===Cp&&(Cp=e.l)}function DI(e){return Cp={p:[],l:Cp,h:e,m:!0,_:0}}function Ife(e){var t=e[xn];t.i===0||t.i===1?t.j():t.g=!0}function v4(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||To("ES5").S(t,e,r),r?(n[xn].P&&(Vg(t),za(4)),ps(e)&&(e=Wg(t,e),t.l||qg(t,e)),t.u&&To("Patches").M(n[xn].t,e,t.u,t.s)):e=Wg(t,n,[]),Vg(t),t.u&&t.v(t.u,t.s),e!==bP?e:void 0}function Wg(e,t,n){if(aT(t))return t;var r=t[xn];if(!r)return Su(t,function(s,u){return LI(e,r,t,s,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return qg(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=rT(r.k):r.o,a=i,o=!1;r.i===3&&(a=new Set(i),i.clear(),o=!0),Su(a,function(s,u){return LI(e,r,i,s,u,n,o)}),qg(e,i,!1),n&&e.u&&To("Patches").N(r,n,e.u,e.s)}return r.o}function LI(e,t,n,r,i,a,o){if(El(i)){var s=Wg(e,i,a&&t&&t.i!==3&&!W1(t.R,r)?a.concat(r):void 0);if(gP(n,r,s),!El(s))return;e.m=!1}else o&&n.add(i);if(ps(i)&&!aT(i)){if(!e.h.D&&e._<1)return;Wg(e,i),t&&t.A.l||qg(e,i)}}function qg(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&iT(t,n)}function _4(e,t){var n=e[xn];return(n?Zl(n):e)[t]}function MI(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function qs(e){e.P||(e.P=!0,e.l&&qs(e.l))}function T4(e){e.o||(e.o=rT(e.t))}function wy(e,t,n){var r=tT(t)?To("MapSet").F(t,n):nT(t)?To("MapSet").T(t,n):e.O?function(i,a){var o=Array.isArray(i),s={i:o?1:0,A:a?a.A:Ty(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},u=s,c=xp;o&&(u=[s],c=Sd);var p=Proxy.revocable(u,c),f=p.revoke,m=p.proxy;return s.k=m,s.j=f,m}(t,n):To("ES5").J(t,n);return(n?n.A:Ty()).p.push(r),r}function Rfe(e){return El(e)||za(22,e),function t(n){if(!ps(n))return n;var r,i=n[xn],a=Cc(n);if(i){if(!i.P&&(i.i<4||!To("ES5").K(i)))return i.t;i.I=!0,r=FI(n,a),i.I=!1}else r=FI(n,a);return Su(r,function(o,s){i&&Cfe(i.t,o)===s||gP(r,o,t(s))}),a===3?new Set(r):r}(e)}function FI(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return rT(e)}function Nfe(){function e(a,o){var s=i[a];return s?s.enumerable=o:i[a]=s={configurable:!0,enumerable:o,get:function(){var u=this[xn];return xp.get(u,a)},set:function(u){var c=this[xn];xp.set(c,a,u)}},s}function t(a){for(var o=a.length-1;o>=0;o--){var s=a[o][xn];if(!s.P)switch(s.i){case 5:r(s)&&qs(s);break;case 4:n(s)&&qs(s)}}}function n(a){for(var o=a.t,s=a.k,u=q1(s),c=u.length-1;c>=0;c--){var p=u[c];if(p!==xn){var f=o[p];if(f===void 0&&!W1(o,p))return!0;var m=s[p],h=m&&m[xn];if(h?h.t!==f:!mP(m,f))return!0}}var b=!!o[xn];return u.length!==q1(o).length+(b?0:1)}function r(a){var o=a.k;if(o.length!==a.t.length)return!0;var s=Object.getOwnPropertyDescriptor(o,o.length-1);if(s&&!s.get)return!0;for(var u=0;u1?E-1:0),w=1;w1?p-1:0),m=1;m=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var o=To("Patches").$;return El(n)?o(n,r):this.produce(n,function(s){return o(s,r)})},e}(),ji=new Mfe,EP=ji.produce;ji.produceWithPatches.bind(ji);ji.setAutoFreeze.bind(ji);ji.setUseProxies.bind(ji);ji.applyPatches.bind(ji);ji.createDraft.bind(ji);ji.finishDraft.bind(ji);function kp(e){"@babel/helpers - typeof";return kp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kp(e)}function Ffe(e,t){if(kp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pfe(e){var t=Ffe(e,"string");return kp(t)==="symbol"?t:String(t)}function Bfe(e,t,n){return t=Pfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $I(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 zI(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ur(1));return n(sT)(e,t)}if(typeof e!="function")throw new Error(Ur(2));var i=e,a=t,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function p(){if(u)throw new Error(Ur(3));return a}function f(y){if(typeof y!="function")throw new Error(Ur(4));if(u)throw new Error(Ur(5));var T=!0;return c(),s.push(y),function(){if(T){if(u)throw new Error(Ur(6));T=!1,c();var v=s.indexOf(y);s.splice(v,1),o=null}}}function m(y){if(!Ufe(y))throw new Error(Ur(7));if(typeof y.type>"u")throw new Error(Ur(8));if(u)throw new Error(Ur(9));try{u=!0,a=i(a,y)}finally{u=!1}for(var T=o=s,E=0;E"u")throw new Error(Ur(12));if(typeof n(void 0,{type:Kg.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ur(13))})}function vP(e){for(var t=Object.keys(e),n={},r=0;r"u")throw c&&c.type,new Error(Ur(14));f[h]=T,p=p||T!==y}return p=p||a.length!==Object.keys(u).length,p?f:u}}function Yg(){for(var e=arguments.length,t=new Array(e),n=0;n0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{let n=e.active;typeof t.stop=="boolean"&&(n=!t.stop);let r;t.index>e.history.length?r={...t.update}:t.delta===!0?(r={...e.history[t.index]},t.update.name&&(r.name=(r.name??"")+t.update.name),t.update.description&&(r.description=(r.description??"")+t.update.description),t.update.observations&&(r.observations=[...r.observations??[],...t.update.observations]),t.update.logs&&(r.logs=[...r.logs??[],...t.update.logs])):t.delta===!1&&(r={...e.history[t.index],...t.update});let i=[...e.history];return r&&(i[t.index]=r),{...e,history:i,active:n}},newSession:(e,{payload:t})=>t?(console.log("NEW SESSION"),{...e,history:t.session_state.history,context_items:t.session_state.context_items,contextItemsAtIndex:{},active:!1,title:t.title,session_id:t.session_id}):{...e,history:[],context_items:[],contextItemsAtIndex:{},active:!1,title:"New Session",session_id:Yd()},setTitle:(e,{payload:t})=>({...e,title:t}),setActive:(e,{payload:t})=>({...e,active:t}),setHistory:(e,{payload:t})=>({...e,history:t}),deleteAtIndex:(e,{payload:t})=>{let n=[...e.history];return n[t]={...n[t],hide:!0},{...e,history:n}},addContextItem:(e,{payload:t})=>(console.log("HERE...",t),{...e,context_items:[...e.context_items,t]}),addContextItemAtIndex:(e,{payload:t})=>({...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:[...e.contextItemsAtIndex[t.index]??[],t.item]}}),addHighlightedCode:(e,{payload:t})=>{let n=[...e.context_items].map(a=>({...a,editing:!1}));const r=`(${t.rangeInFileWithContents.range.start.line+1}-${t.rangeInFileWithContents.range.end.line+1})`,i=t.rangeInFileWithContents.filepath.split(/[\\/]/).pop();return n.push({description:{name:`${i} ${r}`,description:t.rangeInFileWithContents.filepath,id:{provider_title:"code",item_id:Yd()}},content:t.rangeInFileWithContents.contents,editing:!0,editable:!0}),{...e,context_items:n}},deleteContextWithIds:(e,{payload:t})=>{const n=t.ids.map(r=>`${r.provider_title}-${r.item_id}`);return typeof t.index>"u"?{...e,context_items:e.context_items.filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}}},setEditingAtIds:(e,{payload:t})=>{const n=t.ids.map(r=>r.item_id);return typeof t.index>"u"?{...e,context_items:e.context_items.map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}}}}}),{setActive:Xd,setHistory:YI,processSessionUpdate:b0e,newSession:F2,deleteAtIndex:C4,addContextItem:CP,addContextItemAtIndex:xP,addHighlightedCode:y0e,deleteContextWithIds:x4,setTitle:kP,setEditingAtIds:E0e}=AP.actions,v0e=AP.reducer,_0e=He.button` border: none; color: ${jt}; background-color: ${Mt}; @@ -429,7 +429,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho background-color: ${e.color}; } `} -`,x0e=e=>{const[t,n]=C.useState(!1);C.useContext(eo);const r=Io(),[i,a]=C.useState(void 0);C.useEffect(()=>{e.editing&&e.item.content.length>4e3?a("Editing such a large range may be slow"):a(void 0)},[e.editing,e.item]);const o=C.useCallback(()=>{var c,p;e.editing||r(E0e({ids:[e.item.description.id],index:e.inputIndex})),e.editingAny||(c=e.prefixInputWithEdit)==null||c.call(e,!0),e.editingAny&&e.editing&&((p=e.prefixInputWithEdit)==null||p.call(e,!1))},[e.editing,e.editingAny,e.item,e.inputIndex]),s=C.useRef(null),u=C.useRef(null);return St(c=>c.sessionState.context_items),R.jsxs("div",{style:{position:"relative"},children:[R.jsxs(S0e,{previewing:e.previewing,ref:s,children:[R.jsx(w0e,{fontSize:ir(),borderColor:e.editing&&i?"red":void 0,ref:u,onMouseEnter:()=>{n(!0),e.onHover&&e.onHover(!0)},onMouseLeave:()=>{n(!1),e.onHover&&e.onHover(!1)},className:`pill-button-${e.stepIndex||"main"}`,onKeyDown:c=>{var p,f;c.key==="Backspace"?(p=e.onDelete)==null||p.call(e,e.stepIndex):c.key==="v"?(f=e.toggleViewContent)==null||f.call(e):c.key==="e"&&o()},onClick:c=>{var p;if((p=e.onClick)==null||p.call(e,c),e.item.description.id.provider_title==="file")qa("showFile",{filepath:e.item.description.description});else if(e.item.description.id.provider_title==="code"){const f=e.item.description.name.split("(")[1].split(")")[0].split("-");qa("showLines",{filepath:e.item.description.description,start:parseInt(f[0])-1,end:parseInt(f[1])-1})}else qa("showVirtualFile",{name:e.item.description.name,content:e.item.content})},onBlur:c=>{var p,f;(p=s.current)!=null&&p.contains(c.relatedTarget)&&(c.preventDefault(),(f=u.current)==null||f.focus())},children:R.jsxs("span",{className:(t?"underline":"")+" flex",children:[["file","code"].includes(e.item.description.id.provider_title)&&R.jsx(_y,{height:"16px",width:"16px",filename:e.item.description.name.split(" ").at(0)}),e.item.description.name]})}),(e.editingAny||e.focusing&&e.item.editable||e.editing&&e.editingAny)&&R.jsxs(R.Fragment,{children:[R.jsx(C0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,text:e.editing?"Editing this range":"Edit this range (e)",onClick:o,tabIndex:-1,color:"#f0f4",selected:e.editing,children:R.jsx(zQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:"Editing this range"})]}),e.focusing&&R.jsx(A0e,{text:"Delete (⌫)",onClick:()=>{var c;return(c=e.onDelete)==null?void 0:c.call(e,e.stepIndex)},tabIndex:-1,color:"#f004",children:R.jsx(NL,{width:"1.4em",height:"1.4em"})})]}),R.jsx(Qs,{id:`edit-${e.index}`,children:e.item.editing?"Editing this section (with entire file as context)":"Edit this section"}),R.jsx(Qs,{id:`delete-${e.index}`,children:"Delete"}),e.editing&&i&&R.jsxs(R.Fragment,{children:[R.jsx(T0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,className:"z-10",children:R.jsx(xL,{style:{margin:"auto"},width:"1.0em",strokeWidth:2})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:i})]})]})},k0e={};var xy=function(e,t){return xy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},xy(e,t)};function ff(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tn=function(){return tn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{const[t,n]=C.useState(!1);C.useContext(eo);const r=Io(),[i,a]=C.useState(void 0);C.useEffect(()=>{e.editing&&e.item.content.length>4e3?a("Editing such a large range may be slow"):a(void 0)},[e.editing,e.item]);const o=C.useCallback(()=>{var c,p;e.editing||r(E0e({ids:[e.item.description.id],index:e.inputIndex})),e.editingAny||(c=e.prefixInputWithEdit)==null||c.call(e,!0),e.editingAny&&e.editing&&((p=e.prefixInputWithEdit)==null||p.call(e,!1))},[e.editing,e.editingAny,e.item,e.inputIndex]),s=C.useRef(null),u=C.useRef(null);return wt(c=>c.sessionState.context_items),R.jsxs("div",{style:{position:"relative"},children:[R.jsxs(S0e,{previewing:e.previewing,ref:s,children:[R.jsx(w0e,{fontSize:ir(),borderColor:e.editing&&i?"red":void 0,ref:u,onMouseEnter:()=>{n(!0),e.onHover&&e.onHover(!0)},onMouseLeave:()=>{n(!1),e.onHover&&e.onHover(!1)},className:`pill-button-${e.stepIndex||"main"}`,onKeyDown:c=>{var p,f;c.key==="Backspace"?(p=e.onDelete)==null||p.call(e,e.stepIndex):c.key==="v"?(f=e.toggleViewContent)==null||f.call(e):c.key==="e"&&o()},onClick:c=>{var p;if((p=e.onClick)==null||p.call(e,c),e.item.description.id.provider_title==="file")qa("showFile",{filepath:e.item.description.description});else if(e.item.description.id.provider_title==="code"){const f=e.item.description.name.split("(")[1].split(")")[0].split("-");qa("showLines",{filepath:e.item.description.description,start:parseInt(f[0])-1,end:parseInt(f[1])-1})}else qa("showVirtualFile",{name:e.item.description.name,content:e.item.content})},onBlur:c=>{var p,f;(p=s.current)!=null&&p.contains(c.relatedTarget)&&(c.preventDefault(),(f=u.current)==null||f.focus())},children:R.jsxs("span",{className:(t?"underline":"")+" flex",children:[["file","code"].includes(e.item.description.id.provider_title)&&R.jsx(_y,{height:"16px",width:"16px",filename:e.item.description.name.split(" ").at(0)}),e.item.description.name]})}),(e.editingAny||e.focusing&&e.item.editable||e.editing&&e.editingAny)&&R.jsxs(R.Fragment,{children:[R.jsx(C0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,text:e.editing?"Editing this range":"Edit this range (e)",onClick:o,tabIndex:-1,color:"#f0f4",selected:e.editing,children:R.jsx(zQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:"Editing this range"})]}),e.focusing&&R.jsx(A0e,{text:"Delete (⌫)",onClick:()=>{var c;return(c=e.onDelete)==null?void 0:c.call(e,e.stepIndex)},tabIndex:-1,color:"#f004",children:R.jsx(NL,{width:"1.4em",height:"1.4em"})})]}),R.jsx(Qs,{id:`edit-${e.index}`,children:e.item.editing?"Editing this section (with entire file as context)":"Edit this section"}),R.jsx(Qs,{id:`delete-${e.index}`,children:"Delete"}),e.editing&&i&&R.jsxs(R.Fragment,{children:[R.jsx(T0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,className:"z-10",children:R.jsx(xL,{style:{margin:"auto"},width:"1.0em",strokeWidth:2})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:i})]})]})},k0e={};var xy=function(e,t){return xy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},xy(e,t)};function ff(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tn=function(){return tn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]"u"&&require("cross-fetch/polyfill"),c=new URL(i,this.url),a&&(p=new URLSearchParams,Object.keys(a).filter(function(w){return a[w]!==null}).map(function(w){return p.set(w,a[w])}),c.search=p.toString()),!((n=u.headers)===null||n===void 0)&&n["Content-Type"]||(o=JSON.stringify(o)),f=tn(tn({},this.headers),u.headers),v.label=1;case 1:return v.trys.push([1,6,,7]),m=this.httpClient?this.httpClient:fetch,h=m(c.toString(),tn(tn(tn({},u),this.requestConfig),{method:r,body:o,headers:f})),this.httpClient?[4,h]:[3,3];case 2:return[2,v.sent()];case 3:return[4,h.then(function(w){return I0e(w)})];case 4:return b=v.sent(),[4,b.json().catch(function(){})];case 5:return y=v.sent(),[2,y];case 6:return T=v.sent(),E=T.stack,R0e(T,E,c.toString()),[3,7];case 7:return[2]}})})},e.prototype.get=function(t,n,r){return Ne(this,void 0,void 0,function(){return Oe(this,function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:n,config:r})];case 1:return[2,i.sent()]}})})},e.prototype.post=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"POST",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.put=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"PUT",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.patch=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"PATCH",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.delete=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"DELETE",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e}(),Pn=function(){function e(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}return e}(),XI=function(){function e(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}return e}(),IP=function(){function e(t){this.httpRequest=new Qg(t)}return e.prototype.getTask=function(t){return Ne(this,void 0,void 0,function(){var n,r;return Oe(this,function(i){switch(i.label){case 0:return n="tasks/".concat(t),[4,this.httpRequest.get(n)];case 1:return r=i.sent(),[2,new XI(r)]}})})},e.prototype.getTasks=function(t){return t===void 0&&(t={}),Ne(this,void 0,void 0,function(){var n,r;return Oe(this,function(i){switch(i.label){case 0:return n="tasks",[4,this.httpRequest.get(n,k4(t))];case 1:return r=i.sent(),[2,tn(tn({},r),{results:r.results.map(function(a){return new XI(a)})})]}})})},e.prototype.waitForTask=function(t,n){var r=n===void 0?{}:n,i=r.timeOutMs,a=i===void 0?5e3:i,o=r.intervalMs,s=o===void 0?50:o;return Ne(this,void 0,void 0,function(){var u,c;return Oe(this,function(p){switch(p.label){case 0:u=Date.now(),p.label=1;case 1:return Date.now()-u"u"?this.tokens.generateTenantToken(n,r,i):e.prototype.generateTenantToken.call(this,n,r,i)},t}($0e);const NP=pf({name:"uiState",initialState:{bottomMessage:void 0,bottomMessageCloseTimeout:void 0,showDialog:!1,dialogMessage:"",dialogEntryOn:!1,displayBottomMessageOnBottom:!0},reducers:{setBottomMessage:(e,t)=>{e.bottomMessage=t.payload},setBottomMessageCloseTimeout:(e,t)=>{e.bottomMessageCloseTimeout&&clearTimeout(e.bottomMessageCloseTimeout),e.bottomMessageCloseTimeout=t.payload},setDialogMessage:(e,t)=>{e.dialogMessage=t.payload},setDialogEntryOn:(e,t)=>{e.dialogEntryOn=t.payload},setShowDialog:(e,t)=>{e.showDialog=t.payload},setDisplayBottomMessageOnBottom:(e,t)=>{e.displayBottomMessageOnBottom=t.payload}}}),{setBottomMessage:pu,setBottomMessageCloseTimeout:QI,setDialogMessage:I4,setDialogEntryOn:q0e,setShowDialog:lc,setDisplayBottomMessageOnBottom:K0e}=NP.actions,Y0e=NP.reducer,X0e=He(_p)` @@ -455,7 +455,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili opacity: 0.7; `} } -`;function Q0e(e){const t=St(i=>i.config.vscMediaUrl),[n,r]=C.useState(localStorage.getItem("continueButtonColor"));return C.useEffect(()=>{const i=a=>{a.key==="continueButtonColor"&&r(a.newValue)};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),R.jsx(X0e,{showStop:e.showStop,color:n,hidden:e.hidden,style:{fontSize:"10px"},className:"m-auto press-start-2p",onClick:e.disabled?void 0:e.onClick,isDisabled:e.disabled,children:e.showStop?R.jsxs(R.Fragment,{children:[R.jsx(nZ,{width:"18px",height:"18px"}),"STOP"]}):R.jsxs(R.Fragment,{children:[t?R.jsx("img",{src:`${t}/play_button.png`,height:"18px"}):R.jsx(kL,{width:"18px",height:"18px"}),"CONTINUE"]})})}const OP=pf({name:"misc",initialState:{takenAction:!1,serverStatusMessage:"Continue Server Starting"},reducers:{setTakenActionTrue:(e,t)=>{e.takenAction=!0},setServerStatusMessage:(e,t)=>{e.serverStatusMessage=t.payload}}}),{setTakenActionTrue:wd,setServerStatusMessage:Z0e}=OP.actions,J0e=OP.reducer,ehe=(e,t,n)=>{const r=Rg(e);if(r&&e.key==="Backspace"){e.preventDefault();const i=e.target.selectionStart,a=e.target.selectionEnd;if(i!==a){const o=t.slice(0,i)+t.slice(a);n(o),e.target.selectionStart=i,e.target.selectionEnd=i}else{const o=t.lastIndexOf(` +`;function Q0e(e){const t=wt(i=>i.config.vscMediaUrl),[n,r]=C.useState(localStorage.getItem("continueButtonColor"));return C.useEffect(()=>{const i=a=>{a.key==="continueButtonColor"&&r(a.newValue)};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),R.jsx(X0e,{showStop:e.showStop,color:n,hidden:e.hidden,style:{fontSize:"10px"},className:"m-auto press-start-2p",onClick:e.disabled?void 0:e.onClick,isDisabled:e.disabled,children:e.showStop?R.jsxs(R.Fragment,{children:[R.jsx(nZ,{width:"18px",height:"18px"}),"STOP"]}):R.jsxs(R.Fragment,{children:[t?R.jsx("img",{src:`${t}/play_button.png`,height:"18px"}):R.jsx(kL,{width:"18px",height:"18px"}),"CONTINUE"]})})}const OP=pf({name:"misc",initialState:{takenAction:!1,serverStatusMessage:"Continue Server Starting"},reducers:{setTakenActionTrue:(e,t)=>{e.takenAction=!0},setServerStatusMessage:(e,t)=>{e.serverStatusMessage=t.payload}}}),{setTakenActionTrue:wd,setServerStatusMessage:Z0e}=OP.actions,J0e=OP.reducer,ehe=(e,t,n)=>{const r=Rg(e);if(r&&e.key==="Backspace"){e.preventDefault();const i=e.target.selectionStart,a=e.target.selectionEnd;if(i!==a){const o=t.slice(0,i)+t.slice(a);n(o),e.target.selectionStart=i,e.target.selectionEnd=i}else{const o=t.lastIndexOf(` `,i-1),s=t.slice(0,o+1)+t.slice(i);n(s),e.target.selectionStart=o+1,e.target.selectionEnd=o+1}}else if(r){const i=e.target.selectionStart,a=e.target.selectionEnd;let o=i,s=a;const u=e.shiftKey;if(e.key==="ArrowLeft"){const c=t.lastIndexOf(` `,i-1);o=c===-1?0:c+1,s=u?a:o}else if(e.key==="ArrowRight"){const c=t.indexOf(` `,i);s=c===-1?t.length:c,o=u?o:s}e.target.selectionStart=o,e.target.selectionEnd=s,e.preventDefault()}},the=(e,t,n)=>{const r=e.target.selectionStart,i=e.target.selectionEnd,a=Rg(e);if(a&&e.key==="Backspace")if(e.preventDefault(),r!==i){const o=t.slice(0,r)+t.slice(i);n(o),e.target.selectionStart=r,e.target.selectionEnd=r}else{const o=t.slice(0,r).trimEnd().lastIndexOf(" "),s=t.slice(0,o+1)+t.slice(r);n(s),console.log(o),setTimeout(()=>{e.target.selectionStart=o+1,e.target.selectionEnd=o+1},10)}else if(a&&e.key==="c"){if(e.preventDefault(),e.stopPropagation(),r!==i){const o=t.slice(r,i);navigator.clipboard.writeText(o)}}else a&&e.key==="v"&&(e.preventDefault(),e.stopPropagation(),navigator.clipboard.readText().then(o=>{const s=t.slice(0,r)+o+t.slice(i);n(s);const u=r+o.length;setTimeout(()=>{e.target.selectionStart=u,e.target.selectionEnd=u},10)}))},nhe="continue_context_items",rhe=Wm` @@ -606,7 +606,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili ${({isLastItem:e})=>e&&"border-bottom: 1px solid gray;"} cursor: pointer; z-index: 500; -`,JI=ut.forwardRef((e,t)=>{var Se,De,ze,Ye,Gt,ue,ve,qe;const n=St(H=>H.serverState.meilisearchUrl||"http://127.0.0.1:7700"),[r,i]=C.useState(void 0);C.useEffect(()=>{const H=new W0e({host:n});i(H)},[n]);const a=C.useContext(eo),o=Io(),s=St(H=>H.config.workspacePaths);St(H=>H.sessionState.history);const[u,c]=ut.useState([]),[p,f]=ut.useState(0),[m,h]=ut.useState([]),b=ut.useRef(null);C.useEffect(()=>{b.current&&(b.current.style.height="auto",b.current.style.height=Math.min(b.current.scrollHeight,300)+"px")},[(Se=b.current)==null?void 0:Se.scrollHeight,(De=b.current)==null?void 0:De.clientHeight,(ze=b.current)==null?void 0:ze.value]);const[y,T]=C.useState(!1),[E,v]=C.useState(void 0),[w,A]=C.useState(void 0),N=St(H=>H.serverState.slashCommands).map(H=>({name:`/${H.name}`,description:H.description})),x=St(H=>typeof e.index<"u"?H.sessionState.contextItemsAtIndex[e.index]||[]:H.sessionState.context_items),D=St(H=>H.sessionState.history),B=St(H=>H.sessionState.active);C.useEffect(()=>{y||(v(void 0),A(void 0))},[y]);const V=St(H=>H.serverState.contextProviders),P=()=>{T(!1),v(void 0),A(void 0),se.setInputValue("@")};C.useEffect(()=>{E||h((V==null?void 0:V.map(H=>({name:H.display_title,description:H.description,id:H.title})).sort((H,me)=>H.id==="file"?-1:1))||[])},[E]);const[Z,$]=C.useState(""),oe=C.useCallback(async(H,me)=>{const We=await(a==null?void 0:a.getContextItem(H,me));e.isMainInput?o(CP(We)):typeof e.index<"u"&&o(xP({item:We,index:e.index}))},[a,e.index]),pe=C.useCallback(({inputValue:H,highlightedIndex:me})=>{var We;if(!H){h([]),v(void 0),T(!1);return}if(Z===""&&(V!=null&&V.some(ge=>ge.display_title===H))){se.setInputValue(""),$("");return}if($(H),w&&!H.startsWith(`@${w.title}`)&&A(void 0),(We=e.onInputValueChange)==null||We.call(e,H),H.endsWith("@")||y){const ge=(H==null?void 0:H.split("@"))||[];if(ge.length>1){T(!0);const j=ge[ge.length-1]||"";if(E&&!H.endsWith("@")){const W=j.split(" ");ce(E.title,W.length>1?W[1]:"").then(ne=>{h(ne)})}else{const W=(V==null?void 0:V.filter(ne=>`@${ne.title}`.toLowerCase().startsWith(H.toLowerCase())||`@${ne.display_title}`.toLowerCase().startsWith(H.toLowerCase())).map(ne=>({name:ne.display_title,description:ne.description,id:ne.title})).sort((ne,_e)=>ne.id==="file"?-1:1))||[];h(W),T(!0)}return}else T(!1),v(void 0)}v(void 0),h((N==null?void 0:N.filter(ge=>{const j=ge.name.toLowerCase(),W=H.toLowerCase();return j.startsWith(W)&&j!==W}))||[]),(H.startsWith("/")||H.startsWith("@"))&&o(wd(null))},[N,y,E,w]),ce=async(H,me)=>{const We=s&&s.length>0?`workspace_dir IN [ ${s.map(ge=>`"${ge}"`).join(", ")} ] AND provider_name = '${H}'`:void 0;try{const ge=await(r==null?void 0:r.index(nhe).search(me,{filter:We}));return(ge==null?void 0:ge.hits.map(j=>({name:j.name,description:j.description,id:j.id,content:j.content})))||[]}catch(ge){return console.log("Error searching context items",ge),[]}},{getInputProps:Le,...se}=JF({onInputValueChange:pe,items:m,itemToString(H){return H?H.name:""}});C.useEffect(()=>{se.highlightedIndex<0&&se.setHighlightedIndex(0)},[se.inputValue]);const le=ut.useRef(null),he=ut.useRef(null),I=()=>{var H;return(((H=le.current)==null?void 0:H.getBoundingClientRect().top)||Number.MAX_SAFE_INTEGER)>DP};C.useImperativeHandle(t,()=>se,[se]);const X=ut.useRef(null),ae=C.useCallback(()=>{var ge;if(Ee(!0),!X.current)return;const H=X.current.querySelectorAll(`.pill-button-${e.index||"main"}`),me=Array.from(H),We=me.findIndex(j=>j===document.activeElement);if(We===me.length-1)(ge=b.current)==null||ge.focus();else if(We!==-1){const j=me[(We+1)%me.length];j==null||j.focus()}else{const j=me[0];j==null||j.focus()}},[e.index]);C.useEffect(()=>{if(b.current){const H=me=>{me.key==="Tab"&&(me.preventDefault(),ae())};return b.current.addEventListener("keydown",H),()=>{var me;(me=b.current)==null||me.removeEventListener("keydown",H)}}},[b.current]),C.useEffect(()=>{e.value&&se.setInputValue(e.value)},[e.value,se.setInputValue]);const[O,Q]=C.useState(!1);C.useLayoutEffect(()=>{he.current&&se.setHighlightedIndex(0)},[m,se.setHighlightedIndex,he.current]);const[be,q]=C.useState(!1),[we,te]=C.useState(!1);C.useEffect(()=>{const H=We=>{We.key==="Meta"&&q(!0)},me=We=>{We.key==="Meta"&&q(!1)};return window.addEventListener("keydown",H),window.addEventListener("keyup",me),()=>{window.removeEventListener("keydown",H),window.removeEventListener("keyup",me)}},[]),C.useEffect(()=>{if(!b.current||!e.isMainInput)return;e.isMainInput&&b.current.focus();const H=me=>{var We;me.data.type==="focusContinueInput"?(b.current.focus(),o(wd(null))):me.data.type==="focusContinueInputWithEdit"?(b.current.focus(),(We=b.current)!=null&&We.value.startsWith("/edit")||se.setInputValue("/edit "),o(wd(null))):me.data.type==="focusContinueInputWithNewSession"&&(a==null||a.stopSession(),o(F2()),o(wd(null)))};return window.addEventListener("message",H),()=>{window.removeEventListener("message",H)}},[b.current,e.isMainInput]);const Me=ut.useRef(null),Re=C.useCallback(H=>{const me=m[se.highlightedIndex],We=me==null?void 0:me.name,ge=V.find(j=>j.display_title===We);if(ge){if(ge.dynamic&&ge.requires_query){A(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}else if(ge.dynamic){if(!me.id)return;const j=se.inputValue.split("@"),W=j[j.length-1];if(oe(me.id,W),se.inputValue.includes("@")){const ne=V.find(_e=>_e.title===me.id);!E&&!(ne!=null&&ne.dynamic)?(se.setInputValue(`@${me.id} `),v(ne)):se.setInputValue("")}se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}}else{if(E&&me.id){oe(me.id,""),se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}v(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault(),ce(ge.title,"").then(j=>h(j))},[m,se.highlightedIndex,V,E,se.inputValue,oe]),[Qe,Ve]=C.useState(!1),[dt,ot]=C.useState(!1),[Ge,pt]=C.useState(void 0),[U,re]=C.useState(void 0),de=ut.useRef(null),[ke,Ee]=C.useState(!1);return C.useEffect(()=>{we||Ee(!1)},[we]),R.jsxs("div",{ref:de,style:{paddingTop:"4px",backgroundColor:Vt},children:[x.length===0&&e.isMainInput&&R.jsxs("div",{style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",paddingTop:ir(),width:"calc(100% - 24px)"},children:[R.jsx("span",{onClick:()=>{var H;se.setInputValue("@"),(H=b.current)==null||H.focus()},className:"hover:underline cursor-pointer",children:"+ Add Context"}),(((Ye=se.inputValue)==null?void 0:Ye.startsWith("/edit"))||we&&be&&((Gt=se.inputValue)==null?void 0:Gt.length)>0)&&R.jsx("span",{className:"float-right",children:"Inserting at cursor"})]}),e.isMainInput||x.length>0&&ke?R.jsxs("div",{className:"px-2 flex gap-2 items-center flex-wrap",ref:X,style:{backgroundColor:Vt},children:[x.length>0&&R.jsx("div",{className:"cursor-pointer",onClick:H=>{ot(me=>!me)},id:"toggle-context-div",children:dt?R.jsx(gQ,{width:"14px",height:"14px",color:Et}):R.jsx(yQ,{width:"14px",height:"14px",color:Et})}),R.jsx(ahe,{className:x.length>0?`pill-button-${e.index||"main"}`:"",onClick:()=>{var H;o(x4({ids:x.map(me=>me.description.id),index:e.index})),(H=b.current)==null||H.focus(),pt(void 0),re(void 0)},onKeyDown:H=>{var me;H.key==="Backspace"&&(o(x4({ids:x.map(We=>We.description.id),index:e.index})),(me=b.current)==null||me.focus(),pt(void 0),re(void 0))},children:R.jsx(NL,{width:"1.4em",height:"1.4em"})}),x.map((H,me)=>{var We,ge,j,W;return R.jsx(x0e,{inputIndex:e.index,areMultipleItems:x.length>1,item:H,editing:H.editing&&((ge=(We=b.current)==null?void 0:We.value)==null?void 0:ge.startsWith("/edit")),editingAny:(W=(j=b.current)==null?void 0:j.value)==null?void 0:W.startsWith("/edit"),stepIndex:e.index,index:me,onDelete:()=>{var ne;o(x4({ids:[H.description.id],index:e.index})),(ne=b.current)==null||ne.focus(),(H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name||H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name)&&(pt(void 0),re(void 0))},onClick:ne=>{H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name?re(void 0):re(H)},onBlur:()=>{re(void 0)},toggleViewContent:()=>{pt(ne=>{if(!ne)return H;if(!(ne.description.id.item_id===H.description.id.item_id&&ne.description.id.provider_name===H.description.id.provider_name))return H})},previewing:H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name,focusing:H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name,prefixInputWithEdit:ne=>{var _e,Ze,Fe;!ne&&((_e=b.current)!=null&&_e.value.startsWith("/edit"))&&se.setInputValue((Ze=b.current)==null?void 0:Ze.value.replace("/edit ","")),!se.inputValue.startsWith("/edit")&&(se.setInputValue(`/edit ${se.inputValue}`),(Fe=b.current)==null||Fe.focus())}},`${H.description.id.item_id}${me}`)})]}):x.length>0&&R.jsxs("div",{onClick:()=>{var H;(H=b.current)==null||H.focus(),Ee(!0)},style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",cursor:"default",paddingTop:ir(),width:"fit-content"},children:[e.active?"Using":"Used"," ",x.length," ","context item",x.length===1?"":"s"]}),Ge&&R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(Ge.description.description)} +`,JI=ut.forwardRef((e,t)=>{var Se,De,ze,Ye,Gt,ue,ve,qe;const n=wt(H=>H.serverState.meilisearchUrl||"http://127.0.0.1:7700"),[r,i]=C.useState(void 0);C.useEffect(()=>{const H=new W0e({host:n});i(H)},[n]);const a=C.useContext(eo),o=Io(),s=wt(H=>H.config.workspacePaths);wt(H=>H.sessionState.history);const[u,c]=ut.useState([]),[p,f]=ut.useState(0),[m,h]=ut.useState([]),b=ut.useRef(null);C.useEffect(()=>{b.current&&(b.current.style.height="auto",b.current.style.height=Math.min(b.current.scrollHeight,300)+"px")},[(Se=b.current)==null?void 0:Se.scrollHeight,(De=b.current)==null?void 0:De.clientHeight,(ze=b.current)==null?void 0:ze.value]);const[y,T]=C.useState(!1),[E,v]=C.useState(void 0),[w,A]=C.useState(void 0),N=wt(H=>H.serverState.slashCommands).map(H=>({name:`/${H.name}`,description:H.description})),x=wt(H=>typeof e.index<"u"?H.sessionState.contextItemsAtIndex[e.index]||[]:H.sessionState.context_items),D=wt(H=>H.sessionState.history),B=wt(H=>H.sessionState.active);C.useEffect(()=>{y||(v(void 0),A(void 0))},[y]);const V=wt(H=>H.serverState.contextProviders),P=()=>{T(!1),v(void 0),A(void 0),se.setInputValue("@")};C.useEffect(()=>{E||h((V==null?void 0:V.map(H=>({name:H.display_title,description:H.description,id:H.title})).sort((H,me)=>H.id==="file"?-1:1))||[])},[E]);const[Z,$]=C.useState(""),oe=C.useCallback(async(H,me)=>{const We=await(a==null?void 0:a.getContextItem(H,me));e.isMainInput?o(CP(We)):typeof e.index<"u"&&o(xP({item:We,index:e.index}))},[a,e.index]),pe=C.useCallback(({inputValue:H,highlightedIndex:me})=>{var We;if(!H){h([]),v(void 0),T(!1);return}if(Z===""&&(V!=null&&V.some(ge=>ge.display_title===H))){se.setInputValue(""),$("");return}if($(H),w&&!H.startsWith(`@${w.title}`)&&A(void 0),(We=e.onInputValueChange)==null||We.call(e,H),H.endsWith("@")||y){const ge=(H==null?void 0:H.split("@"))||[];if(ge.length>1){T(!0);const j=ge[ge.length-1]||"";if(E&&!H.endsWith("@")){const W=j.split(" ");ce(E.title,W.length>1?W[1]:"").then(ne=>{h(ne)})}else{const W=(V==null?void 0:V.filter(ne=>`@${ne.title}`.toLowerCase().startsWith(H.toLowerCase())||`@${ne.display_title}`.toLowerCase().startsWith(H.toLowerCase())).map(ne=>({name:ne.display_title,description:ne.description,id:ne.title})).sort((ne,_e)=>ne.id==="file"?-1:1))||[];h(W),T(!0)}return}else T(!1),v(void 0)}v(void 0),h((N==null?void 0:N.filter(ge=>{const j=ge.name.toLowerCase(),W=H.toLowerCase();return j.startsWith(W)&&j!==W}))||[]),(H.startsWith("/")||H.startsWith("@"))&&o(wd(null))},[N,y,E,w]),ce=async(H,me)=>{const We=s&&s.length>0?`workspace_dir IN [ ${s.map(ge=>`"${ge}"`).join(", ")} ] AND provider_name = '${H}'`:void 0;try{const ge=await(r==null?void 0:r.index(nhe).search(me,{filter:We}));return(ge==null?void 0:ge.hits.map(j=>({name:j.name,description:j.description,id:j.id,content:j.content})))||[]}catch(ge){return console.log("Error searching context items",ge),[]}},{getInputProps:Le,...se}=JF({onInputValueChange:pe,items:m,itemToString(H){return H?H.name:""}});C.useEffect(()=>{se.highlightedIndex<0&&se.setHighlightedIndex(0)},[se.inputValue]);const le=ut.useRef(null),he=ut.useRef(null),I=()=>{var H;return(((H=le.current)==null?void 0:H.getBoundingClientRect().top)||Number.MAX_SAFE_INTEGER)>DP};C.useImperativeHandle(t,()=>se,[se]);const X=ut.useRef(null),ae=C.useCallback(()=>{var ge;if(Ee(!0),!X.current)return;const H=X.current.querySelectorAll(`.pill-button-${e.index||"main"}`),me=Array.from(H),We=me.findIndex(j=>j===document.activeElement);if(We===me.length-1)(ge=b.current)==null||ge.focus();else if(We!==-1){const j=me[(We+1)%me.length];j==null||j.focus()}else{const j=me[0];j==null||j.focus()}},[e.index]);C.useEffect(()=>{if(b.current){const H=me=>{me.key==="Tab"&&(me.preventDefault(),ae())};return b.current.addEventListener("keydown",H),()=>{var me;(me=b.current)==null||me.removeEventListener("keydown",H)}}},[b.current]),C.useEffect(()=>{e.value&&se.setInputValue(e.value)},[e.value,se.setInputValue]);const[O,Q]=C.useState(!1);C.useLayoutEffect(()=>{he.current&&se.setHighlightedIndex(0)},[m,se.setHighlightedIndex,he.current]);const[be,q]=C.useState(!1),[we,te]=C.useState(!1);C.useEffect(()=>{const H=We=>{We.key==="Meta"&&q(!0)},me=We=>{We.key==="Meta"&&q(!1)};return window.addEventListener("keydown",H),window.addEventListener("keyup",me),()=>{window.removeEventListener("keydown",H),window.removeEventListener("keyup",me)}},[]),C.useEffect(()=>{if(!b.current||!e.isMainInput)return;e.isMainInput&&b.current.focus();const H=me=>{var We;me.data.type==="focusContinueInput"?(b.current.focus(),o(wd(null))):me.data.type==="focusContinueInputWithEdit"?(b.current.focus(),(We=b.current)!=null&&We.value.startsWith("/edit")||se.setInputValue("/edit "),o(wd(null))):me.data.type==="focusContinueInputWithNewSession"&&(a==null||a.stopSession(),o(F2()),o(wd(null)))};return window.addEventListener("message",H),()=>{window.removeEventListener("message",H)}},[b.current,e.isMainInput]);const Me=ut.useRef(null),Re=C.useCallback(H=>{const me=m[se.highlightedIndex],We=me==null?void 0:me.name,ge=V.find(j=>j.display_title===We);if(ge){if(ge.dynamic&&ge.requires_query){A(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}else if(ge.dynamic){if(!me.id)return;const j=se.inputValue.split("@"),W=j[j.length-1];if(oe(me.id,W),se.inputValue.includes("@")){const ne=V.find(_e=>_e.title===me.id);!E&&!(ne!=null&&ne.dynamic)?(se.setInputValue(`@${me.id} `),v(ne)):se.setInputValue("")}se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}}else{if(E&&me.id){oe(me.id,""),se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}v(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault(),ce(ge.title,"").then(j=>h(j))},[m,se.highlightedIndex,V,E,se.inputValue,oe]),[Qe,Ve]=C.useState(!1),[dt,ot]=C.useState(!1),[Ge,pt]=C.useState(void 0),[U,re]=C.useState(void 0),de=ut.useRef(null),[ke,Ee]=C.useState(!1);return C.useEffect(()=>{we||Ee(!1)},[we]),R.jsxs("div",{ref:de,style:{paddingTop:"4px",backgroundColor:Vt},children:[x.length===0&&e.isMainInput&&R.jsxs("div",{style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",paddingTop:ir(),width:"calc(100% - 24px)"},children:[R.jsx("span",{onClick:()=>{var H;se.setInputValue("@"),(H=b.current)==null||H.focus()},className:"hover:underline cursor-pointer",children:"+ Add Context"}),(((Ye=se.inputValue)==null?void 0:Ye.startsWith("/edit"))||we&&be&&((Gt=se.inputValue)==null?void 0:Gt.length)>0)&&R.jsx("span",{className:"float-right",children:"Inserting at cursor"})]}),e.isMainInput||x.length>0&&ke?R.jsxs("div",{className:"px-2 flex gap-2 items-center flex-wrap",ref:X,style:{backgroundColor:Vt},children:[x.length>0&&R.jsx("div",{className:"cursor-pointer",onClick:H=>{ot(me=>!me)},id:"toggle-context-div",children:dt?R.jsx(gQ,{width:"14px",height:"14px",color:Et}):R.jsx(yQ,{width:"14px",height:"14px",color:Et})}),R.jsx(ahe,{className:x.length>0?`pill-button-${e.index||"main"}`:"",onClick:()=>{var H;o(x4({ids:x.map(me=>me.description.id),index:e.index})),(H=b.current)==null||H.focus(),pt(void 0),re(void 0)},onKeyDown:H=>{var me;H.key==="Backspace"&&(o(x4({ids:x.map(We=>We.description.id),index:e.index})),(me=b.current)==null||me.focus(),pt(void 0),re(void 0))},children:R.jsx(NL,{width:"1.4em",height:"1.4em"})}),x.map((H,me)=>{var We,ge,j,W;return R.jsx(x0e,{inputIndex:e.index,areMultipleItems:x.length>1,item:H,editing:H.editing&&((ge=(We=b.current)==null?void 0:We.value)==null?void 0:ge.startsWith("/edit")),editingAny:(W=(j=b.current)==null?void 0:j.value)==null?void 0:W.startsWith("/edit"),stepIndex:e.index,index:me,onDelete:()=>{var ne;o(x4({ids:[H.description.id],index:e.index})),(ne=b.current)==null||ne.focus(),(H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name||H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name)&&(pt(void 0),re(void 0))},onClick:ne=>{H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name?re(void 0):re(H)},onBlur:()=>{re(void 0)},toggleViewContent:()=>{pt(ne=>{if(!ne)return H;if(!(ne.description.id.item_id===H.description.id.item_id&&ne.description.id.provider_name===H.description.id.provider_name))return H})},previewing:H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name,focusing:H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name,prefixInputWithEdit:ne=>{var _e,Ze,Fe;!ne&&((_e=b.current)!=null&&_e.value.startsWith("/edit"))&&se.setInputValue((Ze=b.current)==null?void 0:Ze.value.replace("/edit ","")),!se.inputValue.startsWith("/edit")&&(se.setInputValue(`/edit ${se.inputValue}`),(Fe=b.current)==null||Fe.focus())}},`${H.description.id.item_id}${me}`)})]}):x.length>0&&R.jsxs("div",{onClick:()=>{var H;(H=b.current)==null||H.focus(),Ee(!0)},style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",cursor:"default",paddingTop:ir(),width:"fit-content"},children:[e.active?"Using":"Used"," ",x.length," ","context item",x.length===1?"":"s"]}),Ge&&R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(Ge.description.description)} ${Ge.content} \`\`\``,maxHeight:200})}),dt&&R.jsx("div",{children:x.map(H=>R.jsxs(ohe,{children:[R.jsxs(she,{children:[R.jsx(_y,{height:"20px",width:"20px",filename:H.description.name}),H.description.name]}),R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(H.description.description)} ${H.content} @@ -724,7 +724,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho background-color: #ff02; border-radius: ${At}; padding: 8px 4px; -`;function g2e(e){var f,m;const t=oB(),[n,r]=C.useState(parseInt(localStorage.getItem("stage")||"0")),i=St(h=>h.sessionState.history),a=St(h=>h.serverState.selectedContextItems.some(b=>b.description.id.provider_title==="code")),[o,s]=C.useState(!1),[u,c]=C.useState(0),p=C.useCallback(()=>i.filter(b=>!b.hide&&b.name==="User Input").length-u<=0,[i,u]);return R.jsx(R.Fragment,{children:o||n>YR-1||!p()||parseInt(localStorage.getItem("tutorialClosedCount")||"0")>0||R.jsxs(h2e,{children:[R.jsxs("div",{className:"flex",children:[R.jsx(RL,{width:"1.3em",height:"1.3em",color:"yellow"}),R.jsxs("b",{className:"ml-1",children:["Tutorial (",n+1,"/",YR,")"]})]}),R.jsx("div",{style:{color:jt,paddingLeft:"4px"},children:n{s(!0);const h=parseInt(localStorage.getItem("tutorialClosedCount")||"0");localStorage.setItem("tutorialClosedCount",(h+1).toString()),t==null||t.capture("tutorial_closed",{stage:n,tutorialClosedCount:h})},children:R.jsx(Qm,{width:"1.2em",height:"1.2em"})}),R.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:(m=Gh[n])==null?void 0:m.map((h,b)=>R.jsx(f2e,{disabled:!a,...h,onClick:()=>{a&&(e.onClick(h.textInput),t==null||t.capture("tutorial_stage_complete",{stage:n}),r(n+1),localStorage.setItem("stage",(n+1).toString()),s(!0),c(y=>y+1))}},b))})]})})}const m2e=He.div` +`;function g2e(e){var f,m;const t=oB(),[n,r]=C.useState(parseInt(localStorage.getItem("stage")||"0")),i=wt(h=>h.sessionState.history),a=wt(h=>h.serverState.selectedContextItems.some(b=>b.description.id.provider_title==="code")),[o,s]=C.useState(!1),[u,c]=C.useState(0),p=C.useCallback(()=>i.filter(b=>!b.hide&&b.name==="User Input").length-u<=0,[i,u]);return R.jsx(R.Fragment,{children:o||n>YR-1||!p()||parseInt(localStorage.getItem("tutorialClosedCount")||"0")>0||R.jsxs(h2e,{children:[R.jsxs("div",{className:"flex",children:[R.jsx(RL,{width:"1.3em",height:"1.3em",color:"yellow"}),R.jsxs("b",{className:"ml-1",children:["Tutorial (",n+1,"/",YR,")"]})]}),R.jsx("div",{style:{color:jt,paddingLeft:"4px"},children:n{s(!0);const h=parseInt(localStorage.getItem("tutorialClosedCount")||"0");localStorage.setItem("tutorialClosedCount",(h+1).toString()),t==null||t.capture("tutorial_closed",{stage:n,tutorialClosedCount:h})},children:R.jsx(Qm,{width:"1.2em",height:"1.2em"})}),R.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:(m=Gh[n])==null?void 0:m.map((h,b)=>R.jsx(f2e,{disabled:!a,...h,onClick:()=>{a&&(e.onClick(h.textInput),t==null||t.capture("tutorial_stage_complete",{stage:n}),r(n+1),localStorage.setItem("stage",(n+1).toString()),s(!0),c(y=>y+1))}},b))})]})})}const m2e=He.div` overflow-y: scroll; scrollbar-width: none; /* Firefox */ @@ -782,7 +782,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho top: 0; z-index: 100; background-color: ${Vt}; -`;function XR(e){var le,he;const t=C.useContext(eo),n=oB(),r=Io(),i=bs(),a=St(I=>I.sessionState),o=St(I=>{var X;return(X=I.serverState.config.models)==null?void 0:X.default}),s=St(I=>I.misc.serverStatusMessage),u=St(I=>I.serverState.userInputQueue),c=St(I=>I.sessionState.title),p=St(I=>I.sessionState.active),[f,m]=C.useState(!1),[h,b]=C.useState([]),[y,T]=C.useState(!0),[E,v]=C.useState(!0),w=C.useRef(null),A=C.useRef(null),N=C.useRef(null),x=St(I=>I.uiState.bottomMessage),D=St(I=>I.misc.takenAction);C.useEffect(()=>{N.current&&r(K0e(N.current.getBoundingClientRect().top{var X;const I=()=>{var q,we;const O=((q=A.current)==null?void 0:q.scrollTop)||0,Q=((we=A.current)==null?void 0:we.scrollHeight)||0,be=window.innerHeight||0;O+be+-25>=Q?V(!1):V(!0)};return(X=A.current)==null||X.addEventListener("scroll",I),()=>{window.removeEventListener("scroll",I)}},[A.current]),C.useLayoutEffect(()=>{var I,X;B||(X=A.current)==null||X.scrollTo({top:(I=A.current)==null?void 0:I.scrollHeight,behavior:"instant"})},[(le=A.current)==null?void 0:le.scrollHeight,a.history]),C.useEffect(()=>{const I=X=>{X.key==="Backspace"&&Rg(X)&&!X.shiftKey&&p?(t==null||t.stopSession(),r(Xd(!1))):X.key==="Escape"&&r(pu(void 0))};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[t,p]),C.useEffect(()=>{if(t&&y){T(!1);for(const I of u)t.sendMainInput(I)}},[t,u,y]);const P=C.useCallback(I=>{if((o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(!I.startsWith("/")||I.startsWith("/edit"))){const Q=localStorage.getItem("ftc");if(Q){const be=parseInt(Q);if(localStorage.setItem("ftc",(be+1).toString()),be>=250){r(lc(!0)),r(I4(R.jsx(c2e,{}))),n==null||n.capture("ftc_reached");return}}else localStorage.setItem("ftc","1")}m(!0);const X=[...a.history,{name:"User Input",description:I,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:I},hide:!1,depth:0}],ae={history:X,context_items:a.context_items};for(let Q of a.context_items)r(xP({item:Q,index:X.length-1}));t.runFromState(ae),X.push({name:"Generating Response...",description:" ",observations:[],logs:[],step_type:"SimpleChatStep",params:{},hide:!1,depth:0}),r(YI(X)),r(Xd(!0));const O=localStorage.getItem("mainTextEntryCounter");if(O){let Q=parseInt(O);localStorage.setItem("mainTextEntryCounter",(Q+1).toString()),Q===300&&(r(I4(R.jsxs("div",{className:"text-center p-4",children:["👋 Thanks for using Continue. We are a beta product and love working closely with our first users. If you're interested in speaking, enter your name and email. We won't use this information for anything other than reaching out.",R.jsx("br",{}),R.jsx("br",{}),R.jsxs("form",{onSubmit:be=>{be.preventDefault(),n==null||n.capture("user_interest_form",{name:be.target.elements[0].value,email:be.target.elements[1].value}),r(I4(R.jsx("div",{className:"text-center p-4",children:"Thanks! We'll be in touch soon."})))},style:{display:"flex",flexDirection:"column",gap:"10px"},children:[R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"text",name:"name",placeholder:"Name",required:!0}),R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"email",name:"email",placeholder:"Email",required:!0}),R.jsx("button",{style:{padding:"10px",borderRadius:"5px",cursor:"pointer"},type:"submit",children:"Submit"})]})]}))),r(q0e(!1)),r(lc(!0)))}else localStorage.setItem("mainTextEntryCounter","1")},[t,a.history,a.context_items]);C.useEffect(()=>{const I=X=>{X.data.type==="userInput"&&P(X.data.input)};return window.addEventListener("message",I),()=>window.removeEventListener("message",I)},[P]);const Z=I=>{if(r(wd(null)),w.current){let X=w.current.inputValue;if(console.log("Sending main input",X),X.trim()==="")return;if(X.startsWith("#")&&(X.length===7||X.length===4)){localStorage.setItem("continueButtonColor",X),w.current.setInputValue("");return}if(I&&Rg(I)&&(X=`/edit ${X}`),w.current.setInputValue(""),!t){r(Vge(X));return}P(X)}},$=(I,X)=>{t&&t.sendStepUserInput(I,X)},oe=C.useCallback(I=>{let X=!1;for(let ae=I+1;ae{const X=[];let ae=-1;for(let O=I;O>=0;O--)if(typeof a.history[O]<"u"&&a.history[O].name==="User Input"&&a.history[O].hide===!1){X.push(O),ae=O;break}if(X.length===0)return[];for(let O=ae+1;O{const X=pe(I),ae=X[0];b(O=>{const Q=[...O];return Q[I]=!Q[I],!X.some((q,we)=>we>0&&Q[q])?Q[ae]=!1:!X.some((we,te)=>te>0&&!Q[we])&&(Q[ae]=!0),Q})},[pe]);C.useEffect(()=>{c&&se(c)},[c]);const[Le,se]=C.useState(c||"New Session");return R.jsxs(m2e,{ref:A,onKeyDown:I=>{I.key==="Enter"&&I.ctrlKey&&Z()},children:[R.jsxs(v2e,{children:[R.jsx(b2e,{onClick:I=>{I.target.setSelectionRange(0,I.target.value.length)},value:Le,onChange:I=>se(I.target.value),onBlur:I=>{I.target.value===c||typeof c>"u"&&I.target.value==="New Session"||r(kP(I.target.value))},onKeyDown:I=>{I.key==="Enter"?(I.preventDefault(),I.target.blur()):I.key==="Escape"&&(se(c||"New Session"),I.target.blur())}}),R.jsxs("div",{className:"flex gap-2",children:[a.history.filter(I=>!I.hide).length>0&&R.jsx(Ti,{onClick:()=>{t==null||t.stopSession(),r(F2())},text:"New Session (⌥⌘N)",children:R.jsx(IL,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{i("/history")},text:"History",children:R.jsx(OQ,{width:"1.4em",height:"1.4em"})})]})]}),(D||E)&&typeof t>"u"&&R.jsxs(R.Fragment,{children:[R.jsx(jge,{}),R.jsx("p",{style:{textAlign:"center",margin:"0px",fontSize:"14px"},children:s}),R.jsxs("div",{className:"flex mx-8 my-2",children:[R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/troubleshooting",target:"_blank",children:"Troubleshooting help"})})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},onClick:()=>{qa("toggleDevTools",{})},children:R.jsx("u",{children:"View logs"})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/walkthroughs/manually-run-continue#recommended-use-the-continuedev-pypi-package",target:"_blank",children:"Manually start server"})})})]})]}),R.jsx("br",{}),R.jsx(g2e,{onClick:I=>{t==null||t.sendMainInput(I)}}),R.jsx(y2e,{children:a.history.map((I,X)=>I.hide?null:R.jsx(C.Fragment,{children:I.name==="User Input"?I.hide||R.jsx(JI,{isMainInput:!1,value:I.description,active:p&&oe(X),onEnter:(ae,O)=>{if(O){t==null||t.stopSession();const Q=[...a.history.slice(0,X),{name:"User Input",description:O,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:O},hide:!1,depth:0}];r(YI(Q)),r(Xd(!0));const be={history:Q,context_items:a.context_items};console.log("State: ",be),t.runFromState(be)}ae==null||ae.stopPropagation(),ae==null||ae.preventDefault()},groupIndices:pe(X),onToggle:ae=>{b(O=>{const Q=[...O];return pe(X).forEach(be=>{Q[be]=ae}),Q})},onToggleAll:ae=>{b(O=>O.map(Q=>ae))},isToggleOpen:typeof h[X]>"u"?!0:h[X],index:X,onDelete:()=>{pe(X).forEach(ae=>{console.log(ae),r(C4(ae))})}}):R.jsx(Qge,{historyNode:I,iconElement:I.step_type==="DefaultModelEditCodeStep"?R.jsx(wQ,{width:"16px",height:"16px"}):I.error?R.jsx(xL,{width:"16px",height:"16px",color:"red"}):R.jsx(CL,{width:"16px",height:"16px"}),open:typeof h[X]>"u"?!I.error:h[X],onToggle:()=>ce(X),children:I.error?R.jsx(Jge,{onClose:()=>ce(X),error:I.error,onDelete:()=>{r(C4(X))}}):R.jsx(zue,{index:X,isLast:X===a.history.length-1,isFirst:X===0,open:typeof h[X]>"u"?!0:h[X],onUserInput:ae=>{$(ae,X)},step:I,onReverse:()=>{t==null||t.reverseToIndex(X)},onRetry:()=>{t==null||t.retryAtIndex(X),m(!0)},onDelete:()=>{r(C4(X))},noUserInputParent:pe(X).length===0},X)})},X))}),R.jsx("div",{children:(he=u==null?void 0:u.map)==null?void 0:he.call(u,(I,X)=>R.jsx(E2e,{children:I},X))}),R.jsx("div",{ref:N}),R.jsx(JI,{isMainInput:!0,ref:w,onEnter:(I,X)=>{Z(I),I==null||I.stopPropagation(),I==null||I.preventDefault()},onInputValueChange:()=>{},onToggleAddContext:()=>{t==null||t.toggleAddingHighlightedCode()}})]})}const _2e=He.div` +`;function XR(e){var le,he;const t=C.useContext(eo),n=oB(),r=Io(),i=bs(),a=wt(I=>I.sessionState),o=wt(I=>{var X;return(X=I.serverState.config.models)==null?void 0:X.default}),s=wt(I=>I.misc.serverStatusMessage),u=wt(I=>I.serverState.userInputQueue),c=wt(I=>I.sessionState.title),p=wt(I=>I.sessionState.active),[f,m]=C.useState(!1),[h,b]=C.useState([]),[y,T]=C.useState(!0),[E,v]=C.useState(!1);C.useEffect(()=>{setTimeout(()=>{v(!0)},5e3)},[]);const w=C.useRef(null),A=C.useRef(null),N=C.useRef(null),x=wt(I=>I.uiState.bottomMessage),D=wt(I=>I.misc.takenAction);C.useEffect(()=>{N.current&&r(K0e(N.current.getBoundingClientRect().top{var X;const I=()=>{var q,we;const O=((q=A.current)==null?void 0:q.scrollTop)||0,Q=((we=A.current)==null?void 0:we.scrollHeight)||0,be=window.innerHeight||0;O+be+-25>=Q?V(!1):V(!0)};return(X=A.current)==null||X.addEventListener("scroll",I),()=>{window.removeEventListener("scroll",I)}},[A.current]),C.useLayoutEffect(()=>{var I,X;B||(X=A.current)==null||X.scrollTo({top:(I=A.current)==null?void 0:I.scrollHeight,behavior:"instant"})},[(le=A.current)==null?void 0:le.scrollHeight,a.history]),C.useEffect(()=>{const I=X=>{X.key==="Backspace"&&Rg(X)&&!X.shiftKey&&p?(t==null||t.stopSession(),r(Xd(!1))):X.key==="Escape"&&r(pu(void 0))};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[t,p]),C.useEffect(()=>{if(t&&y){T(!1);for(const I of u)t.sendMainInput(I)}},[t,u,y]);const P=C.useCallback(I=>{if((o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(!I.startsWith("/")||I.startsWith("/edit"))){const Q=localStorage.getItem("ftc");if(Q){const be=parseInt(Q);if(localStorage.setItem("ftc",(be+1).toString()),be>=250){r(lc(!0)),r(I4(R.jsx(c2e,{}))),n==null||n.capture("ftc_reached");return}}else localStorage.setItem("ftc","1")}m(!0);const X=[...a.history,{name:"User Input",description:I,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:I},hide:!1,depth:0}],ae={history:X,context_items:a.context_items};for(let Q of a.context_items)r(xP({item:Q,index:X.length-1}));t.runFromState(ae),X.push({name:"Generating Response...",description:" ",observations:[],logs:[],step_type:"SimpleChatStep",params:{},hide:!1,depth:0}),r(YI(X)),r(Xd(!0));const O=localStorage.getItem("mainTextEntryCounter");if(O){let Q=parseInt(O);localStorage.setItem("mainTextEntryCounter",(Q+1).toString()),Q===300&&(r(I4(R.jsxs("div",{className:"text-center p-4",children:["👋 Thanks for using Continue. We are a beta product and love working closely with our first users. If you're interested in speaking, enter your name and email. We won't use this information for anything other than reaching out.",R.jsx("br",{}),R.jsx("br",{}),R.jsxs("form",{onSubmit:be=>{be.preventDefault(),n==null||n.capture("user_interest_form",{name:be.target.elements[0].value,email:be.target.elements[1].value}),r(I4(R.jsx("div",{className:"text-center p-4",children:"Thanks! We'll be in touch soon."})))},style:{display:"flex",flexDirection:"column",gap:"10px"},children:[R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"text",name:"name",placeholder:"Name",required:!0}),R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"email",name:"email",placeholder:"Email",required:!0}),R.jsx("button",{style:{padding:"10px",borderRadius:"5px",cursor:"pointer"},type:"submit",children:"Submit"})]})]}))),r(q0e(!1)),r(lc(!0)))}else localStorage.setItem("mainTextEntryCounter","1")},[t,a.history,a.context_items]);C.useEffect(()=>{const I=X=>{X.data.type==="userInput"&&P(X.data.input)};return window.addEventListener("message",I),()=>window.removeEventListener("message",I)},[P]);const Z=I=>{if(r(wd(null)),w.current){let X=w.current.inputValue;if(console.log("Sending main input",X),X.trim()==="")return;if(X.startsWith("#")&&(X.length===7||X.length===4)){localStorage.setItem("continueButtonColor",X),w.current.setInputValue("");return}if(I&&Rg(I)&&(X=`/edit ${X}`),w.current.setInputValue(""),!t){r(Vge(X));return}P(X)}},$=(I,X)=>{t&&t.sendStepUserInput(I,X)},oe=C.useCallback(I=>{let X=!1;for(let ae=I+1;ae{const X=[];let ae=-1;for(let O=I;O>=0;O--)if(typeof a.history[O]<"u"&&a.history[O].name==="User Input"&&a.history[O].hide===!1){X.push(O),ae=O;break}if(X.length===0)return[];for(let O=ae+1;O{const X=pe(I),ae=X[0];b(O=>{const Q=[...O];return Q[I]=!Q[I],!X.some((q,we)=>we>0&&Q[q])?Q[ae]=!1:!X.some((we,te)=>te>0&&!Q[we])&&(Q[ae]=!0),Q})},[pe]);C.useEffect(()=>{c&&se(c)},[c]);const[Le,se]=C.useState(c||"New Session");return R.jsxs(m2e,{ref:A,onKeyDown:I=>{I.key==="Enter"&&I.ctrlKey&&Z()},children:[R.jsxs(v2e,{children:[R.jsx(b2e,{onClick:I=>{I.target.setSelectionRange(0,I.target.value.length)},value:Le,onChange:I=>se(I.target.value),onBlur:I=>{I.target.value===c||typeof c>"u"&&I.target.value==="New Session"||r(kP(I.target.value))},onKeyDown:I=>{I.key==="Enter"?(I.preventDefault(),I.target.blur()):I.key==="Escape"&&(se(c||"New Session"),I.target.blur())}}),R.jsxs("div",{className:"flex gap-2",children:[a.history.filter(I=>!I.hide).length>0&&R.jsx(Ti,{onClick:()=>{t==null||t.stopSession(),r(F2())},text:"New Session (⌥⌘N)",children:R.jsx(IL,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{i("/history")},text:"History",children:R.jsx(OQ,{width:"1.4em",height:"1.4em"})})]})]}),D&&E&&typeof t>"u"&&R.jsxs(R.Fragment,{children:[R.jsx(jge,{}),R.jsx("p",{style:{textAlign:"center",margin:"0px",fontSize:"14px"},children:s}),R.jsxs("div",{className:"flex mx-8 my-2",children:[R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/troubleshooting",target:"_blank",children:"Troubleshooting help"})})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},onClick:()=>{qa("toggleDevTools",{})},children:R.jsx("u",{children:"View logs"})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/walkthroughs/manually-run-continue#recommended-use-the-continuedev-pypi-package",target:"_blank",children:"Manually start server"})})})]})]}),R.jsx("br",{}),R.jsx(g2e,{onClick:I=>{t==null||t.sendMainInput(I)}}),R.jsx(y2e,{children:a.history.map((I,X)=>I.hide?null:R.jsx(C.Fragment,{children:I.name==="User Input"?I.hide||R.jsx(JI,{isMainInput:!1,value:I.description,active:p&&oe(X),onEnter:(ae,O)=>{if(O){t==null||t.stopSession();const Q=[...a.history.slice(0,X),{name:"User Input",description:O,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:O},hide:!1,depth:0}];r(YI(Q)),r(Xd(!0));const be={history:Q,context_items:a.context_items};console.log("State: ",be),t.runFromState(be)}ae==null||ae.stopPropagation(),ae==null||ae.preventDefault()},groupIndices:pe(X),onToggle:ae=>{b(O=>{const Q=[...O];return pe(X).forEach(be=>{Q[be]=ae}),Q})},onToggleAll:ae=>{b(O=>O.map(Q=>ae))},isToggleOpen:typeof h[X]>"u"?!0:h[X],index:X,onDelete:()=>{pe(X).forEach(ae=>{console.log(ae),r(C4(ae))})}}):R.jsx(Qge,{historyNode:I,iconElement:I.step_type==="DefaultModelEditCodeStep"?R.jsx(wQ,{width:"16px",height:"16px"}):I.error?R.jsx(xL,{width:"16px",height:"16px",color:"red"}):R.jsx(CL,{width:"16px",height:"16px"}),open:typeof h[X]>"u"?!I.error:h[X],onToggle:()=>ce(X),children:I.error?R.jsx(Jge,{onClose:()=>ce(X),error:I.error,onDelete:()=>{r(C4(X))}}):R.jsx(zue,{index:X,isLast:X===a.history.length-1,isFirst:X===0,open:typeof h[X]>"u"?!0:h[X],onUserInput:ae=>{$(ae,X)},step:I,onReverse:()=>{t==null||t.reverseToIndex(X)},onRetry:()=>{t==null||t.retryAtIndex(X),m(!0)},onDelete:()=>{r(C4(X))},noUserInputParent:pe(X).length===0},X)})},X))}),R.jsx("div",{children:(he=u==null?void 0:u.map)==null?void 0:he.call(u,(I,X)=>R.jsx(E2e,{children:I},X))}),R.jsx("div",{ref:N}),R.jsx(JI,{isMainInput:!0,ref:w,onEnter:(I,X)=>{Z(I),I==null||I.stopPropagation(),I==null||I.preventDefault()},onInputValueChange:()=>{},onToggleAddContext:()=>{t==null||t.toggleAddingHighlightedCode()}})]})}const _2e=He.div` display: flex; flex-direction: row; align-items: center; @@ -830,7 +830,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho padding-right: 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; -`;function QR(e){const t=e.includes("/")?"/":"\\";return e.split(t).pop()||e}function A2e(){const e=bs(),t=Io(),[n,r]=C.useState([]),[i,a]=C.useState([]),o=C.useContext(eo),s=St(E=>E.config.apiUrl),u=St(E=>E.config.workspacePaths),c=St(E=>E.sessionState),p=St(E=>{var v;return((v=E.config.workspacePaths)==null?void 0:v[0])||""}),[f,m]=C.useState(!1);C.useEffect(()=>{(async()=>{if(!s)return;const v=await fetch(`${s}/sessions/list`);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const w=await v.json();r(w)})()},[o]),C.useEffect(()=>{a(n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).sort((E,v)=>sh(v.date_created).getTime()-sh(E.date_created).getTime()))},[f,n]);const h=new Date(Date.now()-1e3*60*60*24),b=new Date(Date.now()-1e3*60*60*24*7),y=new Date(Date.now()-1e3*60*60*24*30),T=new Date(0);return R.jsxs("div",{className:"overflow-y-scroll",style:{fontSize:ir()},children:[R.jsxs("div",{className:"sticky top-0",style:{backgroundColor:Vt},children:[R.jsxs("div",{className:"items-center flex m-0 p-0",style:{borderBottom:`0.5px solid ${Et}`},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>e("/"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"History"})]}),u&&u.length>0&&R.jsx(T2e,{checked:f,onClick:()=>m(E=>!E),title:`Show only sessions from ${QR(u[u.length-1])}/`})]}),n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).length===0&&R.jsxs("div",{className:"text-center m-4",children:['No past sessions found. To start a new session, either click the "+" button or use the keyboard shortcut: ',R.jsx("b",{children:"Option + Command + N"})]}),R.jsxs("div",{children:[R.jsx("table",{className:"w-full border-spacing-0 border-collapse",children:R.jsx("tbody",{children:i.map((E,v)=>{const w=v>0?sh(i[v-1].date_created):T,A=sh(E.date_created);return R.jsxs(C.Fragment,{children:[v===0&&A>h&&R.jsx(U4,{children:"Today"}),Ab&&w>h&&R.jsx(U4,{children:"This Week"}),Ay&&w>b&&R.jsx(U4,{children:"This Month"}),R.jsx(S2e,{children:R.jsx("td",{children:R.jsxs(w2e,{onClick:async()=>{const N={session_state:{history:c.history,context_items:c.context_items},title:c.title,workspace_directory:p,session_id:c.session_id};console.log(N),await fetch(`${s}/sessions/save`,{method:"POST",body:JSON.stringify(N),headers:{"Content-Type":"application/json"}});const x=await fetch(`${s}/sessions/${E.session_id}`);if(!x.ok)throw new Error(`HTTP error! status: ${x.status}`);const D=await x.json();o==null||o.stopSession(),t(F2(D)),e("/")},children:[R.jsx("div",{className:"text-md",children:E.title}),R.jsxs("div",{className:"text-gray-400",children:[A.toLocaleString("en-US",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0})," | ",QR(E.workspace_directory||""),"/"]})]})})},v)]},v)})})}),R.jsx("br",{}),R.jsx("i",{className:"text-sm ml-4",children:"All session data is saved in ~/.continue/sessions"})]})]})}const C2e=He.div` +`;function QR(e){const t=e.includes("/")?"/":"\\";return e.split(t).pop()||e}function A2e(){const e=bs(),t=Io(),[n,r]=C.useState([]),[i,a]=C.useState([]),o=C.useContext(eo),s=wt(E=>E.config.apiUrl),u=wt(E=>E.config.workspacePaths),c=wt(E=>E.sessionState),p=wt(E=>{var v;return((v=E.config.workspacePaths)==null?void 0:v[0])||""}),[f,m]=C.useState(!1);C.useEffect(()=>{(async()=>{if(!s)return;const v=await fetch(`${s}/sessions/list`);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const w=await v.json();r(w)})()},[o]),C.useEffect(()=>{a(n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).sort((E,v)=>sh(v.date_created).getTime()-sh(E.date_created).getTime()))},[f,n]);const h=new Date(Date.now()-1e3*60*60*24),b=new Date(Date.now()-1e3*60*60*24*7),y=new Date(Date.now()-1e3*60*60*24*30),T=new Date(0);return R.jsxs("div",{className:"overflow-y-scroll",style:{fontSize:ir()},children:[R.jsxs("div",{className:"sticky top-0",style:{backgroundColor:Vt},children:[R.jsxs("div",{className:"items-center flex m-0 p-0",style:{borderBottom:`0.5px solid ${Et}`},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>e("/"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"History"})]}),u&&u.length>0&&R.jsx(T2e,{checked:f,onClick:()=>m(E=>!E),title:`Show only sessions from ${QR(u[u.length-1])}/`})]}),n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).length===0&&R.jsxs("div",{className:"text-center m-4",children:['No past sessions found. To start a new session, either click the "+" button or use the keyboard shortcut: ',R.jsx("b",{children:"Option + Command + N"})]}),R.jsxs("div",{children:[R.jsx("table",{className:"w-full border-spacing-0 border-collapse",children:R.jsx("tbody",{children:i.map((E,v)=>{const w=v>0?sh(i[v-1].date_created):T,A=sh(E.date_created);return R.jsxs(C.Fragment,{children:[v===0&&A>h&&R.jsx(U4,{children:"Today"}),Ab&&w>h&&R.jsx(U4,{children:"This Week"}),Ay&&w>b&&R.jsx(U4,{children:"This Month"}),R.jsx(S2e,{children:R.jsx("td",{children:R.jsxs(w2e,{onClick:async()=>{const N={session_state:{history:c.history,context_items:c.context_items},title:c.title,workspace_directory:p,session_id:c.session_id};console.log(N),await fetch(`${s}/sessions/save`,{method:"POST",body:JSON.stringify(N),headers:{"Content-Type":"application/json"}});const x=await fetch(`${s}/sessions/${E.session_id}`);if(!x.ok)throw new Error(`HTTP error! status: ${x.status}`);const D=await x.json();o==null||o.stopSession(),t(F2(D)),e("/")},children:[R.jsx("div",{className:"text-md",children:E.title}),R.jsxs("div",{className:"text-gray-400",children:[A.toLocaleString("en-US",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0})," | ",QR(E.workspace_directory||""),"/"]})]})})},v)]},v)})})}),R.jsx("br",{}),R.jsx("i",{className:"text-sm ml-4",children:"All session data is saved in ~/.continue/sessions"})]})]})}const C2e=He.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-gap: 2rem; @@ -998,7 +998,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &:hover { background-color: ${ha}44; } -`;function V4(e){return e!=null&&e.title?e==null?void 0:e.title:(e==null?void 0:e.model)!==void 0&&(e==null?void 0:e.model.trim())!==""?e!=null&&e.class_name?`${e==null?void 0:e.class_name} - ${e==null?void 0:e.model}`:e==null?void 0:e.model:e==null?void 0:e.class_name}function J5e(e){const t=C.useContext(eo),n=St(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.default}),r=St(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.saved}),i=bs(),a={value:JSON.stringify({t:"default",idx:-1}),title:"GPT-4"},[o,s]=C.useState([a]);C.useEffect(()=>{if(!n&&!r){s([a]);return}const c=[];n&&c.push({value:JSON.stringify({t:"default",idx:-1}),title:V4(n)}),r==null||r.forEach((p,f)=>{c.push({value:JSON.stringify({t:"saved",idx:f}),title:V4(p)})}),s(c)},[n,r]);const u=document.getElementById("model-select-top-div");return R.jsx(R.Fragment,{children:R.jsxs(q5e,{children:[R.jsx(Y5e,{value:JSON.stringify({t:"default",idx:-1}),onChange:c=>{const p=JSON.parse(c);p.t==="saved"&&(t==null||t.setModelForRoleFromIndex("*",p.idx))},defaultValue:"0",children:R.jsxs("div",{className:"relative",children:[R.jsxs(X5e,{children:[R.jsx("div",{children:V4(n)||"GPT-4"}),R.jsx("div",{className:"pointer-events-none flex items-center",children:R.jsx(_Q,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),u&&d9.createPortal(R.jsx(W5e,{as:C.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:R.jsx(Q5e,{children:o.map((c,p)=>R.jsx(Z5e,{selected:c.value===JSON.stringify({t:"default",idx:-1}),value:c.value,children:R.jsx("span",{children:c.title})},p))})}),u)]})}),R.jsx(K5e,{width:"1.3em",height:"1.3em",onClick:()=>{i("/models")}})]})})}const e3e=He.div` +`;function V4(e){return e!=null&&e.title?e==null?void 0:e.title:(e==null?void 0:e.model)!==void 0&&(e==null?void 0:e.model.trim())!==""?e!=null&&e.class_name?`${e==null?void 0:e.class_name} - ${e==null?void 0:e.model}`:e==null?void 0:e.model:e==null?void 0:e.class_name}function J5e(e){const t=C.useContext(eo),n=wt(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.default}),r=wt(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.saved}),i=bs(),a={value:JSON.stringify({t:"default",idx:-1}),title:"GPT-4"},[o,s]=C.useState([a]);C.useEffect(()=>{if(!n&&!r){s([a]);return}const c=[];n&&c.push({value:JSON.stringify({t:"default",idx:-1}),title:V4(n)}),r==null||r.forEach((p,f)=>{c.push({value:JSON.stringify({t:"saved",idx:f}),title:V4(p)})}),s(c)},[n,r]);const u=document.getElementById("model-select-top-div");return R.jsx(R.Fragment,{children:R.jsxs(q5e,{children:[R.jsx(Y5e,{value:JSON.stringify({t:"default",idx:-1}),onChange:c=>{const p=JSON.parse(c);p.t==="saved"&&(t==null||t.setModelForRoleFromIndex("*",p.idx))},defaultValue:"0",children:R.jsxs("div",{className:"relative",children:[R.jsxs(X5e,{children:[R.jsx("div",{children:V4(n)||"GPT-4"}),R.jsx("div",{className:"pointer-events-none flex items-center",children:R.jsx(_Q,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),u&&d9.createPortal(R.jsx(W5e,{as:C.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:R.jsx(Q5e,{children:o.map((c,p)=>R.jsx(Z5e,{selected:c.value===JSON.stringify({t:"default",idx:-1}),value:c.value,children:R.jsx("span",{children:c.title})},p))})}),u)]})}),R.jsx(K5e,{width:"1.3em",height:"1.3em",onClick:()=>{i("/models")}})]})})}const e3e=He.div` width: 100px; height: 6px; border-radius: 6px; @@ -1080,7 +1080,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho margin-left: 8px; z-index: 200; font-size: ${ir()}; -`,d3e=()=>{const e=bs(),t=ST(),n=C.useContext(eo),r=Io(),i=St(p=>p.uiState.dialogMessage),a=St(p=>p.uiState.showDialog),o=St(p=>{var f;return(f=p.serverState.config.models)==null?void 0:f.default}),s=St(p=>p.uiState.bottomMessage),u=St(p=>p.uiState.displayBottomMessageOnBottom),c=St(p=>p.sessionState.history);return C.useEffect(()=>{const p=f=>{var m;if(f.metaKey&&f.altKey&&f.code==="KeyN"&&(n==null||n.stopSession(),r(F2())),(f.metaKey||f.ctrlKey)&&f.code==="KeyC"){const h=(m=window.getSelection())==null?void 0:m.toString();h&&setTimeout(()=>{navigator.clipboard.writeText(h)},100)}};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p)}},[n,c]),C.useEffect(()=>{const p=f=>{f.data.type==="addModel"?e("/models"):f.data.type==="openSettings"&&e("/settings")};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[]),R.jsxs(o3e,{children:[R.jsxs("div",{style:{scrollbarGutter:"stable both-edges",minHeight:"100%",display:"grid",gridTemplateRows:"1fr auto"},children:[R.jsx(M2e,{showDialog:a,onEnter:()=>{r(lc(!1))},onClose:()=>{r(lc(!1))},message:i}),R.jsxs(u3e,{children:[R.jsx(a2e,{}),R.jsx(c3e,{id:"model-select-top-div"}),R.jsxs(l3e,{children:[R.jsxs("div",{className:"mr-auto flex gap-2 items-center",children:[localStorage.getItem("ide")==="jetbrains"||localStorage.getItem("hideFeature")==="true"||R.jsx(RL,{className:"cursor-pointer",onClick:()=>{localStorage.setItem("hideFeature","true")},onMouseEnter:()=>{r(pu("🎁 New Feature: Use ⌘⇧R automatically debug errors in the terminal (you can click the sparkle icon to make it go away)"))},onMouseLeave:()=>{r(QI(setTimeout(()=>{r(pu(void 0))},2e3)))},width:"1.3em",height:"1.3em",color:"yellow"}),R.jsx(J5e,{}),(o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(t.pathname==="/settings"||parseInt(localStorage.getItem("ftc")||"0")>=125)&&R.jsx(i3e,{completed:parseInt(localStorage.getItem("ftc")||"0"),total:250})]}),R.jsx(Ti,{text:"Help",onClick:()=>{e("/help")},children:R.jsx(QQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{e("/settings")},text:"Settings",children:R.jsx(xQ,{width:"1.4em",height:"1.4em"})})]})]}),R.jsx(s3e,{displayOnBottom:u,onMouseEnter:()=>{r(QI(void 0))},onMouseLeave:p=>{p.buttons||r(pu(void 0))},hidden:!s,children:s})]}),R.jsx("div",{className:"text-sm",id:"tooltip-portal-div"})]})};class p3e{}const Co=Object.create(null);Co.open="0";Co.close="1";Co.ping="2";Co.pong="3";Co.message="4";Co.upgrade="5";Co.noop="6";const Vh=Object.create(null);Object.keys(Co).forEach(e=>{Vh[Co[e]]=e});const tE={type:"error",data:"parser error"},MB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FB=typeof ArrayBuffer=="function",PB=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NT=({type:e,data:t},n,r)=>MB&&t instanceof Blob?n?r(t):oN(t,r):FB&&(t instanceof ArrayBuffer||PB(t))?n?r(t):oN(new Blob([t]),r):r(Co[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function sN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let W4;function f3e(e,t){if(MB&&e.data instanceof Blob)return e.data.arrayBuffer().then(sN).then(t);if(FB&&(e.data instanceof ArrayBuffer||PB(e.data)))return t(sN(e.data));NT(e,!1,n=>{W4||(W4=new TextEncoder),t(W4.encode(n))})}const lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,a,o,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),p=new Uint8Array(c);for(r=0;r>4,p[i++]=(o&15)<<4|s>>2,p[i++]=(s&3)<<6|u&63;return c},g3e=typeof ArrayBuffer=="function",OT=(e,t)=>{if(typeof e!="string")return{type:"message",data:BB(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:m3e(e.substring(1),t)}:Vh[n]?e.length>1?{type:Vh[n],data:e.substring(1)}:{type:Vh[n]}:tE},m3e=(e,t)=>{if(g3e){const n=h3e(e);return BB(n,t)}else return{base64:!0,data:e}},BB=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},UB=String.fromCharCode(30),b3e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,o)=>{NT(a,!1,s=>{r[o]=s,++i===n&&t(r.join(UB))})})},y3e=(e,t)=>{const n=e.split(UB),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let q4;function dh(e){return e.reduce((t,n)=>t+n.length,0)}function ph(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(tE);break}i=p*Math.pow(2,32)+c.getUint32(4),r=3}else{if(dh(n)e){s.enqueue(tE);break}}}})}const $B=4;function Xn(e){if(e)return _3e(e)}function _3e(e){for(var t in Xn.prototype)e[t]=Xn.prototype[t];return e}Xn.prototype.on=Xn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Xn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function zB(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const T3e=da.setTimeout,S3e=da.clearTimeout;function q2(e,t){t.useNativeTimers?(e.setTimeoutFn=T3e.bind(da),e.clearTimeoutFn=S3e.bind(da)):(e.setTimeoutFn=da.setTimeout.bind(da),e.clearTimeoutFn=da.clearTimeout.bind(da))}const w3e=1.33;function A3e(e){return typeof e=="string"?C3e(e):Math.ceil((e.byteLength||e.size)*w3e)}function C3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function x3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function k3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function jB(){const e=dN(+new Date);return e!==cN?(uN=0,cN=e):e+"."+dN(uN++)}for(;fh{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};y3e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b3e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jB()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Y1(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Y1=class Wh extends Xn{constructor(t,n){super(),q2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=zB(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new VB(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Wh.requestsCount++,Wh.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=O3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Wh.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Y1.requestsCount=0;Y1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pN);else if(typeof addEventListener=="function"){const e="onpagehide"in da?"pagehide":"unload";addEventListener(e,pN,!1)}}function pN(){for(let e in Y1.requests)Y1.requests.hasOwnProperty(e)&&Y1.requests[e].abort()}const LT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),hh=da.WebSocket||da.MozWebSocket,fN=!0,M3e="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F3e extends DT{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:zB(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new hh(t,n):new hh(t):new hh(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const o={};try{fN&&this.ws.send(a)}catch{}i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jB()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!hh}}class P3e extends DT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=v3e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=E3e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const B3e={websocket:F3e,webtransport:P3e,polling:L3e},U3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function rE(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=U3e.exec(e||""),a={},o=14;for(;o--;)a[$3e[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=z3e(a,a.path),a.queryKey=H3e(a,a.query),a}function z3e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function H3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let WB=class p1 extends Xn{constructor(t,n={}){super(),this.binaryType=M3e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=rE(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=rE(n.host).host),q2(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=k3e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=$B,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new B3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&p1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;p1.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;p1.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function a(){r||(r=!0,p(),n.close(),n=null)}const o=f=>{const m=new Error("probe error: "+f);m.transport=n.name,a(),this.emitReserved("upgradeError",m)};function s(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&a()}const p=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",s),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",p1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){p1.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qB=Object.prototype.toString,W3e=typeof Blob=="function"||typeof Blob<"u"&&qB.call(Blob)==="[object BlobConstructor]",q3e=typeof File=="function"||typeof File<"u"&&qB.call(File)==="[object FileConstructor]";function MT(e){return G3e&&(e instanceof ArrayBuffer||V3e(e))||W3e&&e instanceof Blob||q3e&&e instanceof File}function qh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(a),n.apply(this,[null,...o])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((o,s)=>r?o?a(o):i(s):i(o)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case zt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case zt.EVENT:case zt.BINARY_EVENT:this.onevent(t);break;case zt.ACK:case zt.BINARY_ACK:this.onack(t);break;case zt.DISCONNECT:this.ondisconnect();break;case zt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:zt.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}xc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};xc.prototype.reset=function(){this.attempts=0};xc.prototype.setMin=function(e){this.ms=e};xc.prototype.setMax=function(e){this.max=e};xc.prototype.setJitter=function(e){this.jitter=e};class oE extends Xn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,q2(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new xc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||e4e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new WB(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ua(n,"open",function(){r.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=Ua(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ua(t,"ping",this.onping.bind(this)),Ua(t,"data",this.ondata.bind(this)),Ua(t,"error",this.onerror.bind(this)),Ua(t,"close",this.onclose.bind(this)),Ua(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){LT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KB(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const gd={};function Kh(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=j3e(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,o=gd[i]&&a in gd[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let u;return s?u=new oE(r,t):(gd[i]||(gd[i]=new oE(r,t)),u=gd[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Kh,{Manager:oE,Socket:KB,io:Kh,connect:Kh});class YB{}class n4e extends YB{constructor(n){super();zl(this,"socket");console.log("Connecting to socket.io endpoint: ",n,window.windowId),this.socket=Kh(`${n}?window_id=${window.windowId}`,{path:"/gui/socket.io",transports:["websocket","polling","flashsocket"]})}send(n,r){this.socket.emit("message",{message_type:n,data:r,message_id:Yd()})}onMessageType(n,r){this.socket.on("message",({message_type:i,data:a})=>{n===i&&r(a)})}onMessage(n){this.socket.on("message",({messageType:r,data:i})=>{n(r,i)})}onOpen(n){this.socket.on("connect",n)}onClose(n){this.socket.on("disconnect",n)}async sendAndReceive(n,r){return new Promise((i,a)=>{this.socket.emit("message",{message_type:n,data:r,message_id:Yd()},o=>{o&&o.error?a(o.error):i(o)})})}onError(n){this.socket.on("error",n)}close(){this.socket.disconnect()}}class r4e extends YB{constructor(n){super();zl(this,"serverUrl");this.serverUrl=n,qa("websocketForwardingOpen",{url:this.serverUrl})}send(n,r){qa("websocketForwardingMessage",{message:{messageType:n,data:r},url:this.serverUrl})}onMessageType(n,r){window.addEventListener("message",i=>{if(i.data.type==="websocketForwardingMessage"){const a=JSON.parse(i.data.data);a.messageType===n&&r(a.data)}})}onMessage(n){window.addEventListener("message",r=>{if(r.data.type==="websocketForwardingMessage"){const i=JSON.parse(r.data.data);n(i.messageType,i.data)}})}onError(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingError"&&n(r.data.error)})}sendAndReceive(n,r){return new Promise(i=>{const a=o=>{if(o.data.type==="websocketForwardingMessage"){const s=JSON.parse(o.data.data);s.messageType===n&&(window.removeEventListener("message",a),i(s.data))}};window.addEventListener("message",a),this.send(n,r)})}onOpen(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingOpen"&&n()})}onClose(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingClose"&&n()})}close(){qa("websocketForwardingClose",{url:this.serverUrl})}}class i4e extends p3e{constructor(n,r){super();zl(this,"messenger");zl(this,"serverUrl");zl(this,"useVscodeMessagePassing");zl(this,"onStateUpdateCallbacks",[]);this.serverUrl=n,this.useVscodeMessagePassing=r,this.serverUrl=n,this.useVscodeMessagePassing=r,this.messenger=r?new r4e(n):new n4e(n),document.body.appendChild(document.createTextNode(`WHATWHATWHAT ${n}`)),this.messenger.onClose(()=>{console.log("GUI Connection closed: ",n)}),this.messenger.onError(i=>{console.log("GUI Connection error: ",i)}),this.messenger.onOpen(()=>{console.log("GUI Connection opened: ",n)}),this.messenger.onMessage((i,a)=>{this.handleMessage(i,a)})}onConnected(n){var r;(r=this.messenger)==null||r.onOpen(n)}handleMessage(n,r){switch(n){case"state_update":if(r.state)for(const i of this.onStateUpdateCallbacks)i(r.state);break}}loadSession(n){var r;(r=this.messenger)==null||r.send("load_session",{session_id:n})}sendMainInput(n){var r;(r=this.messenger)==null||r.send("main_input",{input:n})}runFromState(n){var r;(r=this.messenger)==null||r.send("run_from_state",{state:n})}async getSessionTitle(n){var r;return await((r=this.messenger)==null?void 0:r.sendAndReceive("get_session_title",{history:n}))}reverseToIndex(n){var r;(r=this.messenger)==null||r.send("reverse_to_index",{index:n})}sendRefinementInput(n,r){var i;(i=this.messenger)==null||i.send("refinement_input",{input:n,index:r})}sendStepUserInput(n,r){var i;(i=this.messenger)==null||i.send("step_user_input",{input:n,index:r})}onStateUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("state_update",i=>{i.state&&n(i.state)}),this.onStateUpdateCallbacks.push(n)}onSessionUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("session_update",i=>{n(i)})}onConfigUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("config_update",i=>{n(i)})}getConfig(){var n;return(n=this.messenger)==null?void 0:n.sendAndReceive("get_config",{})}onAddContextItem(n){var r;(r=this.messenger)==null||r.onMessageType("add_context_item",i=>{n(i)})}onAvailableSlashCommands(n){var r;(r=this.messenger)==null||r.onMessageType("available_slash_commands",i=>{i.commands&&n(i.commands)})}stopSession(){var n;(n=this.messenger)==null||n.send("stop_session",{})}sendClear(){var n;(n=this.messenger)==null||n.send("clear_history",{})}retryAtIndex(n){var r;(r=this.messenger)==null||r.send("retry_at_index",{index:n})}deleteContextWithIds(n,r){var i;(i=this.messenger)==null||i.send("delete_context_with_ids",{ids:n.map(a=>`${a.provider_title}-${a.item_id}`),index:r})}setEditingAtIds(n){var r;(r=this.messenger)==null||r.send("set_editing_at_ids",{ids:n})}toggleAddingHighlightedCode(){var n;(n=this.messenger)==null||n.send("toggle_adding_highlighted_code",{})}showContextVirtualFile(n){var r;(r=this.messenger)==null||r.send("show_context_virtual_file",{index:n})}selectContextItem(n,r){var i;(i=this.messenger)==null||i.send("select_context_item",{id:n,query:r})}async getContextItem(n,r){var i;return await((i=this.messenger)==null?void 0:i.sendAndReceive("get_context_item",{id:n,query:r}))}selectContextItemAtIndex(n,r,i){var a;(a=this.messenger)==null||a.send("select_context_item_at_index",{id:n,query:r,index:i})}editStepAtIndex(n,r){var i;(i=this.messenger)==null||i.send("edit_step_at_index",{user_input:n,index:r})}setSystemMessage(n){var r;(r=this.messenger)==null||r.send("set_system_message",{system_message:n})}setTemperature(n){var r;(r=this.messenger)==null||r.send("set_temperature",{temperature:n})}addModelForRole(n,r,i){var a;(a=this.messenger)==null||a.send("add_model_for_role",{role:n,model:i,model_class:r})}setModelForRoleFromIndex(n,r){var i;(i=this.messenger)==null||i.send("set_model_for_role_from_index",{role:n,index:r})}saveContextGroup(n,r){var i;(i=this.messenger)==null||i.send("save_context_group",{context_items:r,title:n})}selectContextGroup(n){var r;(r=this.messenger)==null||r.send("select_context_group",{id:n})}deleteContextGroup(n){var r;(r=this.messenger)==null||r.send("delete_context_group",{id:n})}}function a4e(e=!0){const[t,n]=C.useState(void 0),r=St(i=>i.config.apiUrl);return C.useEffect(()=>{const i=r||window.serverUrl,a=window.windowId;if(i==null||a==null)return;console.log("Creating GUI websocket",i,e);const o=new i4e(i,e);o.onConnected(()=>{n(o)})},[r,window.windowId]),t}function o4e(){const e=TB();return console.error(e),R.jsxs("div",{id:"error-page",className:"text-center",children:[R.jsx("h1",{children:"Error in Continue React App"}),R.jsx("p",{children:R.jsx("i",{children:e.statusText||e.message})}),R.jsx("br",{}),R.jsx("pre",{className:"text-left m-4",children:e.stack})]})}const XB="28px",s4e=He.div` +`,d3e=()=>{const e=bs(),t=ST(),n=C.useContext(eo),r=Io(),i=wt(p=>p.uiState.dialogMessage),a=wt(p=>p.uiState.showDialog),o=wt(p=>{var f;return(f=p.serverState.config.models)==null?void 0:f.default}),s=wt(p=>p.uiState.bottomMessage),u=wt(p=>p.uiState.displayBottomMessageOnBottom),c=wt(p=>p.sessionState.history);return C.useEffect(()=>{const p=f=>{var m;if(f.metaKey&&f.altKey&&f.code==="KeyN"&&(n==null||n.stopSession(),r(F2())),(f.metaKey||f.ctrlKey)&&f.code==="KeyC"){const h=(m=window.getSelection())==null?void 0:m.toString();h&&setTimeout(()=>{navigator.clipboard.writeText(h)},100)}};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p)}},[n,c]),C.useEffect(()=>{const p=f=>{f.data.type==="addModel"?e("/models"):f.data.type==="openSettings"&&e("/settings")};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[]),R.jsxs(o3e,{children:[R.jsxs("div",{style:{scrollbarGutter:"stable both-edges",minHeight:"100%",display:"grid",gridTemplateRows:"1fr auto"},children:[R.jsx(M2e,{showDialog:a,onEnter:()=>{r(lc(!1))},onClose:()=>{r(lc(!1))},message:i}),R.jsxs(u3e,{children:[R.jsx(a2e,{}),R.jsx(c3e,{id:"model-select-top-div"}),R.jsxs(l3e,{children:[R.jsxs("div",{className:"mr-auto flex gap-2 items-center",children:[localStorage.getItem("ide")==="jetbrains"||localStorage.getItem("hideFeature")==="true"||R.jsx(RL,{className:"cursor-pointer",onClick:()=>{localStorage.setItem("hideFeature","true")},onMouseEnter:()=>{r(pu("🎁 New Feature: Use ⌘⇧R automatically debug errors in the terminal (you can click the sparkle icon to make it go away)"))},onMouseLeave:()=>{r(QI(setTimeout(()=>{r(pu(void 0))},2e3)))},width:"1.3em",height:"1.3em",color:"yellow"}),R.jsx(J5e,{}),(o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(t.pathname==="/settings"||parseInt(localStorage.getItem("ftc")||"0")>=125)&&R.jsx(i3e,{completed:parseInt(localStorage.getItem("ftc")||"0"),total:250})]}),R.jsx(Ti,{text:"Help",onClick:()=>{e("/help")},children:R.jsx(QQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{e("/settings")},text:"Settings",children:R.jsx(xQ,{width:"1.4em",height:"1.4em"})})]})]}),R.jsx(s3e,{displayOnBottom:u,onMouseEnter:()=>{r(QI(void 0))},onMouseLeave:p=>{p.buttons||r(pu(void 0))},hidden:!s,children:s})]}),R.jsx("div",{className:"text-sm",id:"tooltip-portal-div"})]})};class p3e{}const Co=Object.create(null);Co.open="0";Co.close="1";Co.ping="2";Co.pong="3";Co.message="4";Co.upgrade="5";Co.noop="6";const Vh=Object.create(null);Object.keys(Co).forEach(e=>{Vh[Co[e]]=e});const tE={type:"error",data:"parser error"},MB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FB=typeof ArrayBuffer=="function",PB=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NT=({type:e,data:t},n,r)=>MB&&t instanceof Blob?n?r(t):oN(t,r):FB&&(t instanceof ArrayBuffer||PB(t))?n?r(t):oN(new Blob([t]),r):r(Co[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function sN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let W4;function f3e(e,t){if(MB&&e.data instanceof Blob)return e.data.arrayBuffer().then(sN).then(t);if(FB&&(e.data instanceof ArrayBuffer||PB(e.data)))return t(sN(e.data));NT(e,!1,n=>{W4||(W4=new TextEncoder),t(W4.encode(n))})}const lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,a,o,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),p=new Uint8Array(c);for(r=0;r>4,p[i++]=(o&15)<<4|s>>2,p[i++]=(s&3)<<6|u&63;return c},g3e=typeof ArrayBuffer=="function",OT=(e,t)=>{if(typeof e!="string")return{type:"message",data:BB(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:m3e(e.substring(1),t)}:Vh[n]?e.length>1?{type:Vh[n],data:e.substring(1)}:{type:Vh[n]}:tE},m3e=(e,t)=>{if(g3e){const n=h3e(e);return BB(n,t)}else return{base64:!0,data:e}},BB=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},UB=String.fromCharCode(30),b3e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,o)=>{NT(a,!1,s=>{r[o]=s,++i===n&&t(r.join(UB))})})},y3e=(e,t)=>{const n=e.split(UB),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let q4;function dh(e){return e.reduce((t,n)=>t+n.length,0)}function ph(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(tE);break}i=p*Math.pow(2,32)+c.getUint32(4),r=3}else{if(dh(n)e){s.enqueue(tE);break}}}})}const $B=4;function Xn(e){if(e)return _3e(e)}function _3e(e){for(var t in Xn.prototype)e[t]=Xn.prototype[t];return e}Xn.prototype.on=Xn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Xn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function zB(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const T3e=da.setTimeout,S3e=da.clearTimeout;function q2(e,t){t.useNativeTimers?(e.setTimeoutFn=T3e.bind(da),e.clearTimeoutFn=S3e.bind(da)):(e.setTimeoutFn=da.setTimeout.bind(da),e.clearTimeoutFn=da.clearTimeout.bind(da))}const w3e=1.33;function A3e(e){return typeof e=="string"?C3e(e):Math.ceil((e.byteLength||e.size)*w3e)}function C3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function x3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function k3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function jB(){const e=dN(+new Date);return e!==cN?(uN=0,cN=e):e+"."+dN(uN++)}for(;fh{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};y3e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b3e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jB()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Y1(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Y1=class Wh extends Xn{constructor(t,n){super(),q2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=zB(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new VB(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Wh.requestsCount++,Wh.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=O3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Wh.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Y1.requestsCount=0;Y1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pN);else if(typeof addEventListener=="function"){const e="onpagehide"in da?"pagehide":"unload";addEventListener(e,pN,!1)}}function pN(){for(let e in Y1.requests)Y1.requests.hasOwnProperty(e)&&Y1.requests[e].abort()}const LT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),hh=da.WebSocket||da.MozWebSocket,fN=!0,M3e="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F3e extends DT{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:zB(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new hh(t,n):new hh(t):new hh(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const o={};try{fN&&this.ws.send(a)}catch{}i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jB()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!hh}}class P3e extends DT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=v3e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=E3e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const B3e={websocket:F3e,webtransport:P3e,polling:L3e},U3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function rE(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=U3e.exec(e||""),a={},o=14;for(;o--;)a[$3e[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=z3e(a,a.path),a.queryKey=H3e(a,a.query),a}function z3e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function H3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let WB=class p1 extends Xn{constructor(t,n={}){super(),this.binaryType=M3e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=rE(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=rE(n.host).host),q2(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=k3e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=$B,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new B3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&p1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;p1.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;p1.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function a(){r||(r=!0,p(),n.close(),n=null)}const o=f=>{const m=new Error("probe error: "+f);m.transport=n.name,a(),this.emitReserved("upgradeError",m)};function s(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&a()}const p=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",s),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",p1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){p1.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qB=Object.prototype.toString,W3e=typeof Blob=="function"||typeof Blob<"u"&&qB.call(Blob)==="[object BlobConstructor]",q3e=typeof File=="function"||typeof File<"u"&&qB.call(File)==="[object FileConstructor]";function MT(e){return G3e&&(e instanceof ArrayBuffer||V3e(e))||W3e&&e instanceof Blob||q3e&&e instanceof File}function qh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(a),n.apply(this,[null,...o])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((o,s)=>r?o?a(o):i(s):i(o)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case zt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case zt.EVENT:case zt.BINARY_EVENT:this.onevent(t);break;case zt.ACK:case zt.BINARY_ACK:this.onack(t);break;case zt.DISCONNECT:this.ondisconnect();break;case zt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:zt.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}xc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};xc.prototype.reset=function(){this.attempts=0};xc.prototype.setMin=function(e){this.ms=e};xc.prototype.setMax=function(e){this.max=e};xc.prototype.setJitter=function(e){this.jitter=e};class oE extends Xn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,q2(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new xc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||e4e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new WB(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ua(n,"open",function(){r.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=Ua(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ua(t,"ping",this.onping.bind(this)),Ua(t,"data",this.ondata.bind(this)),Ua(t,"error",this.onerror.bind(this)),Ua(t,"close",this.onclose.bind(this)),Ua(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){LT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KB(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const gd={};function Kh(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=j3e(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,o=gd[i]&&a in gd[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let u;return s?u=new oE(r,t):(gd[i]||(gd[i]=new oE(r,t)),u=gd[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Kh,{Manager:oE,Socket:KB,io:Kh,connect:Kh});class YB{}class n4e extends YB{constructor(n){super();zl(this,"socket");console.log("Connecting to socket.io endpoint: ",n,window.windowId),this.socket=Kh(`${n}?window_id=${window.windowId}`,{path:"/gui/socket.io",transports:["websocket","polling","flashsocket"]})}send(n,r){this.socket.emit("message",{message_type:n,data:r,message_id:Yd()})}onMessageType(n,r){this.socket.on("message",({message_type:i,data:a})=>{n===i&&r(a)})}onMessage(n){this.socket.on("message",({messageType:r,data:i})=>{n(r,i)})}onOpen(n){this.socket.on("connect",n)}onClose(n){this.socket.on("disconnect",n)}async sendAndReceive(n,r){return new Promise((i,a)=>{this.socket.emit("message",{message_type:n,data:r,message_id:Yd()},o=>{o&&o.error?a(o.error):i(o)})})}onError(n){this.socket.on("error",n)}close(){this.socket.disconnect()}}class r4e extends YB{constructor(n){super();zl(this,"serverUrl");this.serverUrl=n,qa("websocketForwardingOpen",{url:this.serverUrl})}send(n,r){qa("websocketForwardingMessage",{message:{messageType:n,data:r},url:this.serverUrl})}onMessageType(n,r){window.addEventListener("message",i=>{if(i.data.type==="websocketForwardingMessage"){const a=JSON.parse(i.data.data);a.messageType===n&&r(a.data)}})}onMessage(n){window.addEventListener("message",r=>{if(r.data.type==="websocketForwardingMessage"){const i=JSON.parse(r.data.data);n(i.messageType,i.data)}})}onError(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingError"&&n(r.data.error)})}sendAndReceive(n,r){return new Promise(i=>{const a=o=>{if(o.data.type==="websocketForwardingMessage"){const s=JSON.parse(o.data.data);s.messageType===n&&(window.removeEventListener("message",a),i(s.data))}};window.addEventListener("message",a),this.send(n,r)})}onOpen(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingOpen"&&n()})}onClose(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingClose"&&n()})}close(){qa("websocketForwardingClose",{url:this.serverUrl})}}class i4e extends p3e{constructor(n,r){super();zl(this,"messenger");zl(this,"serverUrl");zl(this,"useVscodeMessagePassing");zl(this,"onStateUpdateCallbacks",[]);this.serverUrl=n,this.useVscodeMessagePassing=r,this.serverUrl=n,this.useVscodeMessagePassing=r,this.messenger=r?new r4e(n):new n4e(n),this.messenger.onClose(()=>{console.log("GUI Connection closed: ",n)}),this.messenger.onError(i=>{console.log("GUI Connection error: ",i)}),this.messenger.onOpen(()=>{console.log("GUI Connection opened: ",n)}),this.messenger.onMessage((i,a)=>{this.handleMessage(i,a)})}onConnected(n){var r;(r=this.messenger)==null||r.onOpen(n)}handleMessage(n,r){switch(n){case"state_update":if(r.state)for(const i of this.onStateUpdateCallbacks)i(r.state);break}}loadSession(n){var r;(r=this.messenger)==null||r.send("load_session",{session_id:n})}sendMainInput(n){var r;(r=this.messenger)==null||r.send("main_input",{input:n})}runFromState(n){var r;(r=this.messenger)==null||r.send("run_from_state",{state:n})}async getSessionTitle(n){var r;return await((r=this.messenger)==null?void 0:r.sendAndReceive("get_session_title",{history:n}))}reverseToIndex(n){var r;(r=this.messenger)==null||r.send("reverse_to_index",{index:n})}sendRefinementInput(n,r){var i;(i=this.messenger)==null||i.send("refinement_input",{input:n,index:r})}sendStepUserInput(n,r){var i;(i=this.messenger)==null||i.send("step_user_input",{input:n,index:r})}onStateUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("state_update",i=>{i.state&&n(i.state)}),this.onStateUpdateCallbacks.push(n)}onSessionUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("session_update",i=>{n(i)})}onConfigUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("config_update",i=>{n(i)})}getConfig(){var n;return(n=this.messenger)==null?void 0:n.sendAndReceive("get_config",{})}onAddContextItem(n){var r;(r=this.messenger)==null||r.onMessageType("add_context_item",i=>{n(i)})}onAvailableSlashCommands(n){var r;(r=this.messenger)==null||r.onMessageType("available_slash_commands",i=>{i.commands&&n(i.commands)})}stopSession(){var n;(n=this.messenger)==null||n.send("stop_session",{})}sendClear(){var n;(n=this.messenger)==null||n.send("clear_history",{})}retryAtIndex(n){var r;(r=this.messenger)==null||r.send("retry_at_index",{index:n})}deleteContextWithIds(n,r){var i;(i=this.messenger)==null||i.send("delete_context_with_ids",{ids:n.map(a=>`${a.provider_title}-${a.item_id}`),index:r})}setEditingAtIds(n){var r;(r=this.messenger)==null||r.send("set_editing_at_ids",{ids:n})}toggleAddingHighlightedCode(){var n;(n=this.messenger)==null||n.send("toggle_adding_highlighted_code",{})}showContextVirtualFile(n){var r;(r=this.messenger)==null||r.send("show_context_virtual_file",{index:n})}selectContextItem(n,r){var i;(i=this.messenger)==null||i.send("select_context_item",{id:n,query:r})}async getContextItem(n,r){var i;return await((i=this.messenger)==null?void 0:i.sendAndReceive("get_context_item",{id:n,query:r}))}selectContextItemAtIndex(n,r,i){var a;(a=this.messenger)==null||a.send("select_context_item_at_index",{id:n,query:r,index:i})}editStepAtIndex(n,r){var i;(i=this.messenger)==null||i.send("edit_step_at_index",{user_input:n,index:r})}setSystemMessage(n){var r;(r=this.messenger)==null||r.send("set_system_message",{system_message:n})}setTemperature(n){var r;(r=this.messenger)==null||r.send("set_temperature",{temperature:n})}addModelForRole(n,r,i){var a;(a=this.messenger)==null||a.send("add_model_for_role",{role:n,model:i,model_class:r})}setModelForRoleFromIndex(n,r){var i;(i=this.messenger)==null||i.send("set_model_for_role_from_index",{role:n,index:r})}saveContextGroup(n,r){var i;(i=this.messenger)==null||i.send("save_context_group",{context_items:r,title:n})}selectContextGroup(n){var r;(r=this.messenger)==null||r.send("select_context_group",{id:n})}deleteContextGroup(n){var r;(r=this.messenger)==null||r.send("delete_context_group",{id:n})}}function a4e(e=!0){const[t,n]=C.useState(void 0);return C.useEffect(()=>{const r=window.serverUrl,i=window.windowId;if(r==null||i==null)return;console.log("Creating GUI websocket",r,e);const a=new i4e(r,e);a.onConnected(()=>{n(a)})},[window.windowId]),t}function o4e(){const e=TB();return console.error(e),R.jsxs("div",{id:"error-page",className:"text-center",children:[R.jsx("h1",{children:"Error in Continue React App"}),R.jsx("p",{children:R.jsx("i",{children:e.statusText||e.message})}),R.jsx("br",{}),R.jsx("pre",{className:"text-left m-4",children:e.stack})]})}const XB="28px",s4e=He.div` margin-top: 16px; margin: auto; width: ${XB}; @@ -1096,7 +1096,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho opacity: 0.4; } } -`;function l4e(e){const t=St(n=>n.config.vscMediaUrl);return R.jsx(s4e,{children:t?R.jsx("img",{src:`${t}/play_button.png`,width:"22px"}):R.jsx(kL,{width:e.size||XB})})}const sE=({msg:e})=>{const t="info-hover",n=document.getElementById("tooltip-portal-div");return R.jsxs(R.Fragment,{children:[R.jsx(MQ,{"data-tooltip-id":t,className:"h-5 w-5 text-gray-500 cursor-help"}),n&&d9.createPortal(R.jsx(Qs,{id:t,place:"bottom",children:e}),n)]})};var bf=e=>e.type==="checkbox",F1=e=>e instanceof Date,ei=e=>e==null;const QB=e=>typeof e=="object";var ar=e=>!ei(e)&&!Array.isArray(e)&&QB(e)&&!F1(e),u4e=e=>ar(e)&&e.target?bf(e.target)?e.target.checked:e.target.value:e,c4e=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d4e=(e,t)=>e.has(c4e(t)),p4e=e=>{const t=e.constructor&&e.constructor.prototype;return ar(t)&&t.hasOwnProperty("isPrototypeOf")},PT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qo(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(PT&&(e instanceof Blob||e instanceof FileList))&&(n||ar(e)))if(t=n?[]:{},!n&&!p4e(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Qo(e[r]));else return e;return t}var yf=e=>Array.isArray(e)?e.filter(Boolean):[],qn=e=>e===void 0,lt=(e,t,n)=>{if(!t||!ar(e))return n;const r=yf(t.split(/[,[\].]+?/)).reduce((i,a)=>ei(i)?i:i[a],e);return qn(r)||r===e?qn(e[t])?n:e[t]:r},lu=e=>typeof e=="boolean";const mN={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ha={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ko={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},f4e=ut.createContext(null),ZB=e=>{const{children:t,...n}=e;return ut.createElement(f4e.Provider,{value:n},t)};var h4e=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const o=a;return t._proxyFormState[o]!==Ha.all&&(t._proxyFormState[o]=!r||Ha.all),n&&(n[o]=!0),e[o]}});return i},sa=e=>ar(e)&&!Object.keys(e).length,g4e=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return sa(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||Ha.all))},K4=e=>Array.isArray(e)?e:[e];function m4e(e){const t=ut.useRef(e);t.current=e,ut.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var yo=e=>typeof e=="string",b4e=(e,t,n,r,i)=>yo(e)?(r&&t.watch.add(e),lt(n,e,i)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),lt(n,a))):(r&&(t.watchAll=!0),n),BT=e=>/^\w*$/.test(e),JB=e=>yf(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Cn(e,t,n){let r=-1;const i=BT(t)?[t]:JB(t),a=i.length,o=a-1;for(;++rt?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{};const lE=(e,t,n)=>{for(const r of n||Object.keys(e)){const i=lt(e,r);if(i){const{_f:a,...o}=i;if(a&&t(a.name)){if(a.ref.focus){a.ref.focus();break}else if(a.refs&&a.refs[0].focus){a.refs[0].focus();break}}else ar(o)&&lE(o,t)}}};var bN=e=>({isOnSubmit:!e||e===Ha.onSubmit,isOnBlur:e===Ha.onBlur,isOnChange:e===Ha.onChange,isOnAll:e===Ha.all,isOnTouch:e===Ha.onTouched}),yN=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),E4e=(e,t,n)=>{const r=yf(lt(e,n));return Cn(r,"root",t[n]),Cn(e,n,r),e},UT=e=>e.type==="file",Js=e=>typeof e=="function",am=e=>{if(!PT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yh=e=>yo(e),$T=e=>e.type==="radio",om=e=>e instanceof RegExp;const EN={value:!1,isValid:!1},vN={value:!0,isValid:!0};var eU=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!qn(e[0].attributes.value)?qn(e[0].value)||e[0].value===""?vN:{value:e[0].value,isValid:!0}:vN:EN}return EN};const _N={isValid:!1,value:null};var tU=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,_N):_N;function TN(e,t,n="validate"){if(Yh(e)||Array.isArray(e)&&e.every(Yh)||lu(e)&&!e)return{type:n,message:Yh(e)?e:"",ref:t}}var a1=e=>ar(e)&&!om(e)?e:{value:e,message:""},SN=async(e,t,n,r,i)=>{const{ref:a,refs:o,required:s,maxLength:u,minLength:c,min:p,max:f,pattern:m,validate:h,name:b,valueAsNumber:y,mount:T,disabled:E}=e._f,v=lt(t,b);if(!T||E)return{};const w=o?o[0]:a,A=$=>{r&&w.reportValidity&&(w.setCustomValidity(lu($)?"":$||""),w.reportValidity())},N={},x=$T(a),D=bf(a),B=x||D,V=(y||UT(a))&&qn(a.value)&&qn(v)||am(a)&&a.value===""||v===""||Array.isArray(v)&&!v.length,P=y4e.bind(null,b,n,N),Z=($,oe,pe,ce=Ko.maxLength,Le=Ko.minLength)=>{const se=$?oe:pe;N[b]={type:$?ce:Le,message:se,ref:a,...P($?ce:Le,se)}};if(i?!Array.isArray(v)||!v.length:s&&(!B&&(V||ei(v))||lu(v)&&!v||D&&!eU(o).isValid||x&&!tU(o).isValid)){const{value:$,message:oe}=Yh(s)?{value:!!s,message:s}:a1(s);if($&&(N[b]={type:Ko.required,message:oe,ref:w,...P(Ko.required,oe)},!n))return A(oe),N}if(!V&&(!ei(p)||!ei(f))){let $,oe;const pe=a1(f),ce=a1(p);if(!ei(v)&&!isNaN(v)){const Le=a.valueAsNumber||v&&+v;ei(pe.value)||($=Le>pe.value),ei(ce.value)||(oe=Lenew Date(new Date().toDateString()+" "+I),le=a.type=="time",he=a.type=="week";yo(pe.value)&&v&&($=le?se(v)>se(pe.value):he?v>pe.value:Le>new Date(pe.value)),yo(ce.value)&&v&&(oe=le?se(v)+$.value,ce=!ei(oe.value)&&v.length<+oe.value;if((pe||ce)&&(Z(pe,$.message,oe.message),!n))return A(N[b].message),N}if(m&&!V&&yo(v)){const{value:$,message:oe}=a1(m);if(om($)&&!v.match($)&&(N[b]={type:Ko.pattern,message:oe,ref:a,...P(Ko.pattern,oe)},!n))return A(oe),N}if(h){if(Js(h)){const $=await h(v,t),oe=TN($,w);if(oe&&(N[b]={...oe,...P(Ko.validate,oe.message)},!n))return A(oe.message),N}else if(ar(h)){let $={};for(const oe in h){if(!sa($)&&!n)break;const pe=TN(await h[oe](v,t),w,oe);pe&&($={...pe,...P(oe,pe.message)},A(pe.message),n&&(N[b]=$))}if(!sa($)&&(N[b]={ref:w,...$},!n))return N}}return A(!0),N};function v4e(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}}var sm=e=>ei(e)||!QB(e);function uu(e,t){if(sm(e)||sm(t))return e===t;if(F1(e)&&F1(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const a=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if(F1(a)&&F1(o)||ar(a)&&ar(o)||Array.isArray(a)&&Array.isArray(o)?!uu(a,o):a!==o)return!1}}return!0}var nU=e=>e.type==="select-multiple",T4e=e=>$T(e)||bf(e),X4=e=>am(e)&&e.isConnected,rU=e=>{for(const t in e)if(Js(e[t]))return!0;return!1};function lm(e,t={}){const n=Array.isArray(e);if(ar(e)||n)for(const r in e)Array.isArray(e[r])||ar(e[r])&&!rU(e[r])?(t[r]=Array.isArray(e[r])?[]:{},lm(e[r],t[r])):ei(e[r])||(t[r]=!0);return t}function iU(e,t,n){const r=Array.isArray(e);if(ar(e)||r)for(const i in e)Array.isArray(e[i])||ar(e[i])&&!rU(e[i])?qn(t)||sm(n[i])?n[i]=Array.isArray(e[i])?lm(e[i],[]):{...lm(e[i])}:iU(e[i],ei(t)?{}:t[i],n[i]):n[i]=!uu(e[i],t[i]);return n}var Q4=(e,t)=>iU(e,t,lm(t)),aU=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>qn(e)?e:t?e===""?NaN:e&&+e:n&&yo(e)?new Date(e):r?r(e):e;function Z4(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return UT(t)?t.files:$T(t)?tU(e.refs).value:nU(t)?[...t.selectedOptions].map(({value:n})=>n):bf(t)?eU(e.refs).value:aU(qn(t.value)?e.ref.value:t.value,e)}var S4e=(e,t,n,r)=>{const i={};for(const a of e){const o=lt(t,a);o&&Cn(i,a,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},md=e=>qn(e)?e:om(e)?e.source:ar(e)?om(e.value)?e.value.source:e.value:e,w4e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function wN(e,t,n){const r=lt(e,n);if(r||BT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=lt(t,a),s=lt(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};i.pop()}return{name:n}}var A4e=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,C4e=(e,t)=>!yf(lt(e,t)).length&&vr(e,t);const x4e={mode:Ha.onSubmit,reValidateMode:Ha.onChange,shouldFocusError:!0};function k4e(e={},t){let n={...x4e,...e},r={submitCount:0,isDirty:!1,isLoading:Js(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},a=ar(n.defaultValues)||ar(n.values)?Qo(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:Qo(a),s={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,p=0;const f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={values:Y4(),array:Y4(),state:Y4()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,b=bN(n.mode),y=bN(n.reValidateMode),T=n.criteriaMode===Ha.all,E=U=>re=>{clearTimeout(p),p=setTimeout(U,re)},v=async U=>{if(f.isValid||U){const re=n.resolver?sa((await V()).errors):await Z(i,!0);re!==r.isValid&&m.state.next({isValid:re})}},w=U=>f.isValidating&&m.state.next({isValidating:U}),A=(U,re=[],de,ke,Ee=!0,Se=!0)=>{if(ke&&de){if(s.action=!0,Se&&Array.isArray(lt(i,U))){const De=de(lt(i,U),ke.argA,ke.argB);Ee&&Cn(i,U,De)}if(Se&&Array.isArray(lt(r.errors,U))){const De=de(lt(r.errors,U),ke.argA,ke.argB);Ee&&Cn(r.errors,U,De),C4e(r.errors,U)}if(f.touchedFields&&Se&&Array.isArray(lt(r.touchedFields,U))){const De=de(lt(r.touchedFields,U),ke.argA,ke.argB);Ee&&Cn(r.touchedFields,U,De)}f.dirtyFields&&(r.dirtyFields=Q4(a,o)),m.state.next({name:U,isDirty:oe(U,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Cn(o,U,re)},N=(U,re)=>{Cn(r.errors,U,re),m.state.next({errors:r.errors})},x=(U,re,de,ke)=>{const Ee=lt(i,U);if(Ee){const Se=lt(o,U,qn(de)?lt(a,U):de);qn(Se)||ke&&ke.defaultChecked||re?Cn(o,U,re?Se:Z4(Ee._f)):Le(U,Se),s.mount&&v()}},D=(U,re,de,ke,Ee)=>{let Se=!1,De=!1;const ze={name:U};if(!de||ke){f.isDirty&&(De=r.isDirty,r.isDirty=ze.isDirty=oe(),Se=De!==ze.isDirty);const Ye=uu(lt(a,U),re);De=lt(r.dirtyFields,U),Ye?vr(r.dirtyFields,U):Cn(r.dirtyFields,U,!0),ze.dirtyFields=r.dirtyFields,Se=Se||f.dirtyFields&&De!==!Ye}if(de){const Ye=lt(r.touchedFields,U);Ye||(Cn(r.touchedFields,U,de),ze.touchedFields=r.touchedFields,Se=Se||f.touchedFields&&Ye!==de)}return Se&&Ee&&m.state.next(ze),Se?ze:{}},B=(U,re,de,ke)=>{const Ee=lt(r.errors,U),Se=f.isValid&&lu(re)&&r.isValid!==re;if(e.delayError&&de?(c=E(()=>N(U,de)),c(e.delayError)):(clearTimeout(p),c=null,de?Cn(r.errors,U,de):vr(r.errors,U)),(de?!uu(Ee,de):Ee)||!sa(ke)||Se){const De={...ke,...Se&&lu(re)?{isValid:re}:{},errors:r.errors,name:U};r={...r,...De},m.state.next(De)}w(!1)},V=async U=>n.resolver(o,n.context,S4e(U||u.mount,i,n.criteriaMode,n.shouldUseNativeValidation)),P=async U=>{const{errors:re}=await V(U);if(U)for(const de of U){const ke=lt(re,de);ke?Cn(r.errors,de,ke):vr(r.errors,de)}else r.errors=re;return re},Z=async(U,re,de={valid:!0})=>{for(const ke in U){const Ee=U[ke];if(Ee){const{_f:Se,...De}=Ee;if(Se){const ze=u.array.has(Se.name),Ye=await SN(Ee,o,T,n.shouldUseNativeValidation&&!re,ze);if(Ye[Se.name]&&(de.valid=!1,re))break;!re&&(lt(Ye,Se.name)?ze?E4e(r.errors,Ye,Se.name):Cn(r.errors,Se.name,Ye[Se.name]):vr(r.errors,Se.name))}De&&await Z(De,re,de)}}return de.valid},$=()=>{for(const U of u.unMount){const re=lt(i,U);re&&(re._f.refs?re._f.refs.every(de=>!X4(de)):!X4(re._f.ref))&&q(U)}u.unMount=new Set},oe=(U,re)=>(U&&re&&Cn(o,U,re),!uu(X(),a)),pe=(U,re,de)=>b4e(U,u,{...s.mount?o:qn(re)?a:yo(U)?{[U]:re}:re},de,re),ce=U=>yf(lt(s.mount?o:a,U,e.shouldUnregister?lt(a,U,[]):[])),Le=(U,re,de={})=>{const ke=lt(i,U);let Ee=re;if(ke){const Se=ke._f;Se&&(!Se.disabled&&Cn(o,U,aU(re,Se)),Ee=am(Se.ref)&&ei(re)?"":re,nU(Se.ref)?[...Se.ref.options].forEach(De=>De.selected=Ee.includes(De.value)):Se.refs?bf(Se.ref)?Se.refs.length>1?Se.refs.forEach(De=>(!De.defaultChecked||!De.disabled)&&(De.checked=Array.isArray(Ee)?!!Ee.find(ze=>ze===De.value):Ee===De.value)):Se.refs[0]&&(Se.refs[0].checked=!!Ee):Se.refs.forEach(De=>De.checked=De.value===Ee):UT(Se.ref)?Se.ref.value="":(Se.ref.value=Ee,Se.ref.type||m.values.next({name:U,values:{...o}})))}(de.shouldDirty||de.shouldTouch)&&D(U,Ee,de.shouldTouch,de.shouldDirty,!0),de.shouldValidate&&I(U)},se=(U,re,de)=>{for(const ke in re){const Ee=re[ke],Se=`${U}.${ke}`,De=lt(i,Se);(u.array.has(U)||!sm(Ee)||De&&!De._f)&&!F1(Ee)?se(Se,Ee,de):Le(Se,Ee,de)}},le=(U,re,de={})=>{const ke=lt(i,U),Ee=u.array.has(U),Se=Qo(re);Cn(o,U,Se),Ee?(m.array.next({name:U,values:{...o}}),(f.isDirty||f.dirtyFields)&&de.shouldDirty&&m.state.next({name:U,dirtyFields:Q4(a,o),isDirty:oe(U,Se)})):ke&&!ke._f&&!ei(Se)?se(U,Se,de):Le(U,Se,de),yN(U,u)&&m.state.next({...r}),m.values.next({name:U,values:{...o}}),!s.mount&&t()},he=async U=>{const re=U.target;let de=re.name,ke=!0;const Ee=lt(i,de),Se=()=>re.type?Z4(Ee._f):u4e(U);if(Ee){let De,ze;const Ye=Se(),Gt=U.type===mN.BLUR||U.type===mN.FOCUS_OUT,ue=!w4e(Ee._f)&&!n.resolver&&!lt(r.errors,de)&&!Ee._f.deps||A4e(Gt,lt(r.touchedFields,de),r.isSubmitted,y,b),ve=yN(de,u,Gt);Cn(o,de,Ye),Gt?(Ee._f.onBlur&&Ee._f.onBlur(U),c&&c(0)):Ee._f.onChange&&Ee._f.onChange(U);const qe=D(de,Ye,Gt,!1),H=!sa(qe)||ve;if(!Gt&&m.values.next({name:de,type:U.type,values:{...o}}),ue)return f.isValid&&v(),H&&m.state.next({name:de,...ve?{}:qe});if(!Gt&&ve&&m.state.next({...r}),w(!0),n.resolver){const{errors:me}=await V([de]),We=wN(r.errors,i,de),ge=wN(me,i,We.name||de);De=ge.error,de=ge.name,ze=sa(me)}else De=(await SN(Ee,o,T,n.shouldUseNativeValidation))[de],ke=Number.isNaN(Ye)||Ye===lt(o,de,Ye),ke&&(De?ze=!1:f.isValid&&(ze=await Z(i,!0)));ke&&(Ee._f.deps&&I(Ee._f.deps),B(de,ze,De,qe))}},I=async(U,re={})=>{let de,ke;const Ee=K4(U);if(w(!0),n.resolver){const Se=await P(qn(U)?U:Ee);de=sa(Se),ke=U?!Ee.some(De=>lt(Se,De)):de}else U?(ke=(await Promise.all(Ee.map(async Se=>{const De=lt(i,Se);return await Z(De&&De._f?{[Se]:De}:De)}))).every(Boolean),!(!ke&&!r.isValid)&&v()):ke=de=await Z(i);return m.state.next({...!yo(U)||f.isValid&&de!==r.isValid?{}:{name:U},...n.resolver||!U?{isValid:de}:{},errors:r.errors,isValidating:!1}),re.shouldFocus&&!ke&&lE(i,Se=>Se&<(r.errors,Se),U?Ee:u.mount),ke},X=U=>{const re={...a,...s.mount?o:{}};return qn(U)?re:yo(U)?lt(re,U):U.map(de=>lt(re,de))},ae=(U,re)=>({invalid:!!lt((re||r).errors,U),isDirty:!!lt((re||r).dirtyFields,U),isTouched:!!lt((re||r).touchedFields,U),error:lt((re||r).errors,U)}),O=U=>{U&&K4(U).forEach(re=>vr(r.errors,re)),m.state.next({errors:U?r.errors:{}})},Q=(U,re,de)=>{const ke=(lt(i,U,{_f:{}})._f||{}).ref;Cn(r.errors,U,{...re,ref:ke}),m.state.next({name:U,errors:r.errors,isValid:!1}),de&&de.shouldFocus&&ke&&ke.focus&&ke.focus()},be=(U,re)=>Js(U)?m.values.subscribe({next:de=>U(pe(void 0,re),de)}):pe(U,re,!0),q=(U,re={})=>{for(const de of U?K4(U):u.mount)u.mount.delete(de),u.array.delete(de),re.keepValue||(vr(i,de),vr(o,de)),!re.keepError&&vr(r.errors,de),!re.keepDirty&&vr(r.dirtyFields,de),!re.keepTouched&&vr(r.touchedFields,de),!n.shouldUnregister&&!re.keepDefaultValue&&vr(a,de);m.values.next({values:{...o}}),m.state.next({...r,...re.keepDirty?{isDirty:oe()}:{}}),!re.keepIsValid&&v()},we=({disabled:U,name:re,field:de,fields:ke})=>{if(lu(U)){const Ee=U?void 0:lt(o,re,Z4(de?de._f:lt(ke,re)._f));Cn(o,re,Ee),D(re,Ee,!1,!1,!0)}},te=(U,re={})=>{let de=lt(i,U);const ke=lu(re.disabled);return Cn(i,U,{...de||{},_f:{...de&&de._f?de._f:{ref:{name:U}},name:U,mount:!0,...re}}),u.mount.add(U),de?we({field:de,disabled:re.disabled,name:U}):x(U,!0,re.value),{...ke?{disabled:re.disabled}:{},...n.progressive?{required:!!re.required,min:md(re.min),max:md(re.max),minLength:md(re.minLength),maxLength:md(re.maxLength),pattern:md(re.pattern)}:{},name:U,onChange:he,onBlur:he,ref:Ee=>{if(Ee){te(U,re),de=lt(i,U);const Se=qn(Ee.value)&&Ee.querySelectorAll&&Ee.querySelectorAll("input,select,textarea")[0]||Ee,De=T4e(Se),ze=de._f.refs||[];if(De?ze.find(Ye=>Ye===Se):Se===de._f.ref)return;Cn(i,U,{_f:{...de._f,...De?{refs:[...ze.filter(X4),Se,...Array.isArray(lt(a,U))?[{}]:[]],ref:{type:Se.type,name:U}}:{ref:Se}}}),x(U,!1,void 0,Se)}else de=lt(i,U,{}),de._f&&(de._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(d4e(u.array,U)&&s.action)&&u.unMount.add(U)}}},Me=()=>n.shouldFocusError&&lE(i,U=>U&<(r.errors,U),u.mount),Re=(U,re)=>async de=>{de&&(de.preventDefault&&de.preventDefault(),de.persist&&de.persist());let ke=Qo(o);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:Ee,values:Se}=await V();r.errors=Ee,ke=Se}else await Z(i);vr(r.errors,"root"),sa(r.errors)?(m.state.next({errors:{}}),await U(ke,de)):(re&&await re({...r.errors},de),Me(),setTimeout(Me)),m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:sa(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Qe=(U,re={})=>{lt(i,U)&&(qn(re.defaultValue)?le(U,lt(a,U)):(le(U,re.defaultValue),Cn(a,U,re.defaultValue)),re.keepTouched||vr(r.touchedFields,U),re.keepDirty||(vr(r.dirtyFields,U),r.isDirty=re.defaultValue?oe(U,lt(a,U)):oe()),re.keepError||(vr(r.errors,U),f.isValid&&v()),m.state.next({...r}))},Ve=(U,re={})=>{const de=U?Qo(U):a,ke=Qo(de),Ee=U&&!sa(U)?ke:a;if(re.keepDefaultValues||(a=de),!re.keepValues){if(re.keepDirtyValues||h)for(const Se of u.mount)lt(r.dirtyFields,Se)?Cn(Ee,Se,lt(o,Se)):le(Se,lt(Ee,Se));else{if(PT&&qn(U))for(const Se of u.mount){const De=lt(i,Se);if(De&&De._f){const ze=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(am(ze)){const Ye=ze.closest("form");if(Ye){Ye.reset();break}}}}i={}}o=e.shouldUnregister?re.keepDefaultValues?Qo(a):{}:Qo(Ee),m.array.next({values:{...Ee}}),m.values.next({values:{...Ee}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!f.isValid||!!re.keepIsValid,s.watch=!!e.shouldUnregister,m.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!uu(U,a)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:re.keepDirtyValues?r.dirtyFields:re.keepDefaultValues&&U?Q4(a,U):{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},dt=(U,re)=>Ve(Js(U)?U(o):U,re);return{control:{register:te,unregister:q,getFieldState:ae,handleSubmit:Re,setError:Q,_executeSchema:V,_getWatch:pe,_getDirty:oe,_updateValid:v,_removeUnmounted:$,_updateFieldArray:A,_updateDisabledField:we,_getFieldArray:ce,_reset:Ve,_resetDefaultValues:()=>Js(n.defaultValues)&&n.defaultValues().then(U=>{dt(U,n.resetOptions),m.state.next({isLoading:!1})}),_updateFormState:U=>{r={...r,...U}},_subjects:m,_proxyFormState:f,get _fields(){return i},get _formValues(){return o},get _state(){return s},set _state(U){s=U},get _defaultValues(){return a},get _names(){return u},set _names(U){u=U},get _formState(){return r},set _formState(U){r=U},get _options(){return n},set _options(U){n={...n,...U}}},trigger:I,register:te,handleSubmit:Re,watch:be,setValue:le,getValues:X,reset:dt,resetField:Qe,clearErrors:O,unregister:q,setError:Q,setFocus:(U,re={})=>{const de=lt(i,U),ke=de&&de._f;if(ke){const Ee=ke.refs?ke.refs[0]:ke.ref;Ee.focus&&(Ee.focus(),re.shouldSelect&&Ee.select())}},getFieldState:ae}}function oU(e={}){const t=ut.useRef(),n=ut.useRef(),[r,i]=ut.useState({isDirty:!1,isValidating:!1,isLoading:Js(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:Js(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...k4e(e,()=>i(o=>({...o}))),formState:r});const a=t.current.control;return a._options=e,m4e({subject:a._subjects.state,next:o=>{g4e(o,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),ut.useEffect(()=>{e.values&&!uu(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values):a._resetDefaultValues()},[e.values,a]),ut.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=h4e(r,a),t.current}const AN=He.hr` +`;function l4e(e){const t=wt(n=>n.config.vscMediaUrl);return R.jsx(s4e,{children:t?R.jsx("img",{src:`${t}/play_button.png`,width:"22px"}):R.jsx(kL,{width:e.size||XB})})}const sE=({msg:e})=>{const t="info-hover",n=document.getElementById("tooltip-portal-div");return R.jsxs(R.Fragment,{children:[R.jsx(MQ,{"data-tooltip-id":t,className:"h-5 w-5 text-gray-500 cursor-help"}),n&&d9.createPortal(R.jsx(Qs,{id:t,place:"bottom",children:e}),n)]})};var bf=e=>e.type==="checkbox",F1=e=>e instanceof Date,ei=e=>e==null;const QB=e=>typeof e=="object";var ar=e=>!ei(e)&&!Array.isArray(e)&&QB(e)&&!F1(e),u4e=e=>ar(e)&&e.target?bf(e.target)?e.target.checked:e.target.value:e,c4e=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d4e=(e,t)=>e.has(c4e(t)),p4e=e=>{const t=e.constructor&&e.constructor.prototype;return ar(t)&&t.hasOwnProperty("isPrototypeOf")},PT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qo(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(PT&&(e instanceof Blob||e instanceof FileList))&&(n||ar(e)))if(t=n?[]:{},!n&&!p4e(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Qo(e[r]));else return e;return t}var yf=e=>Array.isArray(e)?e.filter(Boolean):[],qn=e=>e===void 0,lt=(e,t,n)=>{if(!t||!ar(e))return n;const r=yf(t.split(/[,[\].]+?/)).reduce((i,a)=>ei(i)?i:i[a],e);return qn(r)||r===e?qn(e[t])?n:e[t]:r},lu=e=>typeof e=="boolean";const mN={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ha={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ko={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},f4e=ut.createContext(null),ZB=e=>{const{children:t,...n}=e;return ut.createElement(f4e.Provider,{value:n},t)};var h4e=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const o=a;return t._proxyFormState[o]!==Ha.all&&(t._proxyFormState[o]=!r||Ha.all),n&&(n[o]=!0),e[o]}});return i},sa=e=>ar(e)&&!Object.keys(e).length,g4e=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return sa(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||Ha.all))},K4=e=>Array.isArray(e)?e:[e];function m4e(e){const t=ut.useRef(e);t.current=e,ut.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var yo=e=>typeof e=="string",b4e=(e,t,n,r,i)=>yo(e)?(r&&t.watch.add(e),lt(n,e,i)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),lt(n,a))):(r&&(t.watchAll=!0),n),BT=e=>/^\w*$/.test(e),JB=e=>yf(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Cn(e,t,n){let r=-1;const i=BT(t)?[t]:JB(t),a=i.length,o=a-1;for(;++rt?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{};const lE=(e,t,n)=>{for(const r of n||Object.keys(e)){const i=lt(e,r);if(i){const{_f:a,...o}=i;if(a&&t(a.name)){if(a.ref.focus){a.ref.focus();break}else if(a.refs&&a.refs[0].focus){a.refs[0].focus();break}}else ar(o)&&lE(o,t)}}};var bN=e=>({isOnSubmit:!e||e===Ha.onSubmit,isOnBlur:e===Ha.onBlur,isOnChange:e===Ha.onChange,isOnAll:e===Ha.all,isOnTouch:e===Ha.onTouched}),yN=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),E4e=(e,t,n)=>{const r=yf(lt(e,n));return Cn(r,"root",t[n]),Cn(e,n,r),e},UT=e=>e.type==="file",Js=e=>typeof e=="function",am=e=>{if(!PT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yh=e=>yo(e),$T=e=>e.type==="radio",om=e=>e instanceof RegExp;const EN={value:!1,isValid:!1},vN={value:!0,isValid:!0};var eU=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!qn(e[0].attributes.value)?qn(e[0].value)||e[0].value===""?vN:{value:e[0].value,isValid:!0}:vN:EN}return EN};const _N={isValid:!1,value:null};var tU=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,_N):_N;function TN(e,t,n="validate"){if(Yh(e)||Array.isArray(e)&&e.every(Yh)||lu(e)&&!e)return{type:n,message:Yh(e)?e:"",ref:t}}var a1=e=>ar(e)&&!om(e)?e:{value:e,message:""},SN=async(e,t,n,r,i)=>{const{ref:a,refs:o,required:s,maxLength:u,minLength:c,min:p,max:f,pattern:m,validate:h,name:b,valueAsNumber:y,mount:T,disabled:E}=e._f,v=lt(t,b);if(!T||E)return{};const w=o?o[0]:a,A=$=>{r&&w.reportValidity&&(w.setCustomValidity(lu($)?"":$||""),w.reportValidity())},N={},x=$T(a),D=bf(a),B=x||D,V=(y||UT(a))&&qn(a.value)&&qn(v)||am(a)&&a.value===""||v===""||Array.isArray(v)&&!v.length,P=y4e.bind(null,b,n,N),Z=($,oe,pe,ce=Ko.maxLength,Le=Ko.minLength)=>{const se=$?oe:pe;N[b]={type:$?ce:Le,message:se,ref:a,...P($?ce:Le,se)}};if(i?!Array.isArray(v)||!v.length:s&&(!B&&(V||ei(v))||lu(v)&&!v||D&&!eU(o).isValid||x&&!tU(o).isValid)){const{value:$,message:oe}=Yh(s)?{value:!!s,message:s}:a1(s);if($&&(N[b]={type:Ko.required,message:oe,ref:w,...P(Ko.required,oe)},!n))return A(oe),N}if(!V&&(!ei(p)||!ei(f))){let $,oe;const pe=a1(f),ce=a1(p);if(!ei(v)&&!isNaN(v)){const Le=a.valueAsNumber||v&&+v;ei(pe.value)||($=Le>pe.value),ei(ce.value)||(oe=Lenew Date(new Date().toDateString()+" "+I),le=a.type=="time",he=a.type=="week";yo(pe.value)&&v&&($=le?se(v)>se(pe.value):he?v>pe.value:Le>new Date(pe.value)),yo(ce.value)&&v&&(oe=le?se(v)+$.value,ce=!ei(oe.value)&&v.length<+oe.value;if((pe||ce)&&(Z(pe,$.message,oe.message),!n))return A(N[b].message),N}if(m&&!V&&yo(v)){const{value:$,message:oe}=a1(m);if(om($)&&!v.match($)&&(N[b]={type:Ko.pattern,message:oe,ref:a,...P(Ko.pattern,oe)},!n))return A(oe),N}if(h){if(Js(h)){const $=await h(v,t),oe=TN($,w);if(oe&&(N[b]={...oe,...P(Ko.validate,oe.message)},!n))return A(oe.message),N}else if(ar(h)){let $={};for(const oe in h){if(!sa($)&&!n)break;const pe=TN(await h[oe](v,t),w,oe);pe&&($={...pe,...P(oe,pe.message)},A(pe.message),n&&(N[b]=$))}if(!sa($)&&(N[b]={ref:w,...$},!n))return N}}return A(!0),N};function v4e(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}}var sm=e=>ei(e)||!QB(e);function uu(e,t){if(sm(e)||sm(t))return e===t;if(F1(e)&&F1(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const a=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if(F1(a)&&F1(o)||ar(a)&&ar(o)||Array.isArray(a)&&Array.isArray(o)?!uu(a,o):a!==o)return!1}}return!0}var nU=e=>e.type==="select-multiple",T4e=e=>$T(e)||bf(e),X4=e=>am(e)&&e.isConnected,rU=e=>{for(const t in e)if(Js(e[t]))return!0;return!1};function lm(e,t={}){const n=Array.isArray(e);if(ar(e)||n)for(const r in e)Array.isArray(e[r])||ar(e[r])&&!rU(e[r])?(t[r]=Array.isArray(e[r])?[]:{},lm(e[r],t[r])):ei(e[r])||(t[r]=!0);return t}function iU(e,t,n){const r=Array.isArray(e);if(ar(e)||r)for(const i in e)Array.isArray(e[i])||ar(e[i])&&!rU(e[i])?qn(t)||sm(n[i])?n[i]=Array.isArray(e[i])?lm(e[i],[]):{...lm(e[i])}:iU(e[i],ei(t)?{}:t[i],n[i]):n[i]=!uu(e[i],t[i]);return n}var Q4=(e,t)=>iU(e,t,lm(t)),aU=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>qn(e)?e:t?e===""?NaN:e&&+e:n&&yo(e)?new Date(e):r?r(e):e;function Z4(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return UT(t)?t.files:$T(t)?tU(e.refs).value:nU(t)?[...t.selectedOptions].map(({value:n})=>n):bf(t)?eU(e.refs).value:aU(qn(t.value)?e.ref.value:t.value,e)}var S4e=(e,t,n,r)=>{const i={};for(const a of e){const o=lt(t,a);o&&Cn(i,a,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},md=e=>qn(e)?e:om(e)?e.source:ar(e)?om(e.value)?e.value.source:e.value:e,w4e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function wN(e,t,n){const r=lt(e,n);if(r||BT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=lt(t,a),s=lt(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};i.pop()}return{name:n}}var A4e=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,C4e=(e,t)=>!yf(lt(e,t)).length&&vr(e,t);const x4e={mode:Ha.onSubmit,reValidateMode:Ha.onChange,shouldFocusError:!0};function k4e(e={},t){let n={...x4e,...e},r={submitCount:0,isDirty:!1,isLoading:Js(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},a=ar(n.defaultValues)||ar(n.values)?Qo(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:Qo(a),s={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,p=0;const f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={values:Y4(),array:Y4(),state:Y4()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,b=bN(n.mode),y=bN(n.reValidateMode),T=n.criteriaMode===Ha.all,E=U=>re=>{clearTimeout(p),p=setTimeout(U,re)},v=async U=>{if(f.isValid||U){const re=n.resolver?sa((await V()).errors):await Z(i,!0);re!==r.isValid&&m.state.next({isValid:re})}},w=U=>f.isValidating&&m.state.next({isValidating:U}),A=(U,re=[],de,ke,Ee=!0,Se=!0)=>{if(ke&&de){if(s.action=!0,Se&&Array.isArray(lt(i,U))){const De=de(lt(i,U),ke.argA,ke.argB);Ee&&Cn(i,U,De)}if(Se&&Array.isArray(lt(r.errors,U))){const De=de(lt(r.errors,U),ke.argA,ke.argB);Ee&&Cn(r.errors,U,De),C4e(r.errors,U)}if(f.touchedFields&&Se&&Array.isArray(lt(r.touchedFields,U))){const De=de(lt(r.touchedFields,U),ke.argA,ke.argB);Ee&&Cn(r.touchedFields,U,De)}f.dirtyFields&&(r.dirtyFields=Q4(a,o)),m.state.next({name:U,isDirty:oe(U,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Cn(o,U,re)},N=(U,re)=>{Cn(r.errors,U,re),m.state.next({errors:r.errors})},x=(U,re,de,ke)=>{const Ee=lt(i,U);if(Ee){const Se=lt(o,U,qn(de)?lt(a,U):de);qn(Se)||ke&&ke.defaultChecked||re?Cn(o,U,re?Se:Z4(Ee._f)):Le(U,Se),s.mount&&v()}},D=(U,re,de,ke,Ee)=>{let Se=!1,De=!1;const ze={name:U};if(!de||ke){f.isDirty&&(De=r.isDirty,r.isDirty=ze.isDirty=oe(),Se=De!==ze.isDirty);const Ye=uu(lt(a,U),re);De=lt(r.dirtyFields,U),Ye?vr(r.dirtyFields,U):Cn(r.dirtyFields,U,!0),ze.dirtyFields=r.dirtyFields,Se=Se||f.dirtyFields&&De!==!Ye}if(de){const Ye=lt(r.touchedFields,U);Ye||(Cn(r.touchedFields,U,de),ze.touchedFields=r.touchedFields,Se=Se||f.touchedFields&&Ye!==de)}return Se&&Ee&&m.state.next(ze),Se?ze:{}},B=(U,re,de,ke)=>{const Ee=lt(r.errors,U),Se=f.isValid&&lu(re)&&r.isValid!==re;if(e.delayError&&de?(c=E(()=>N(U,de)),c(e.delayError)):(clearTimeout(p),c=null,de?Cn(r.errors,U,de):vr(r.errors,U)),(de?!uu(Ee,de):Ee)||!sa(ke)||Se){const De={...ke,...Se&&lu(re)?{isValid:re}:{},errors:r.errors,name:U};r={...r,...De},m.state.next(De)}w(!1)},V=async U=>n.resolver(o,n.context,S4e(U||u.mount,i,n.criteriaMode,n.shouldUseNativeValidation)),P=async U=>{const{errors:re}=await V(U);if(U)for(const de of U){const ke=lt(re,de);ke?Cn(r.errors,de,ke):vr(r.errors,de)}else r.errors=re;return re},Z=async(U,re,de={valid:!0})=>{for(const ke in U){const Ee=U[ke];if(Ee){const{_f:Se,...De}=Ee;if(Se){const ze=u.array.has(Se.name),Ye=await SN(Ee,o,T,n.shouldUseNativeValidation&&!re,ze);if(Ye[Se.name]&&(de.valid=!1,re))break;!re&&(lt(Ye,Se.name)?ze?E4e(r.errors,Ye,Se.name):Cn(r.errors,Se.name,Ye[Se.name]):vr(r.errors,Se.name))}De&&await Z(De,re,de)}}return de.valid},$=()=>{for(const U of u.unMount){const re=lt(i,U);re&&(re._f.refs?re._f.refs.every(de=>!X4(de)):!X4(re._f.ref))&&q(U)}u.unMount=new Set},oe=(U,re)=>(U&&re&&Cn(o,U,re),!uu(X(),a)),pe=(U,re,de)=>b4e(U,u,{...s.mount?o:qn(re)?a:yo(U)?{[U]:re}:re},de,re),ce=U=>yf(lt(s.mount?o:a,U,e.shouldUnregister?lt(a,U,[]):[])),Le=(U,re,de={})=>{const ke=lt(i,U);let Ee=re;if(ke){const Se=ke._f;Se&&(!Se.disabled&&Cn(o,U,aU(re,Se)),Ee=am(Se.ref)&&ei(re)?"":re,nU(Se.ref)?[...Se.ref.options].forEach(De=>De.selected=Ee.includes(De.value)):Se.refs?bf(Se.ref)?Se.refs.length>1?Se.refs.forEach(De=>(!De.defaultChecked||!De.disabled)&&(De.checked=Array.isArray(Ee)?!!Ee.find(ze=>ze===De.value):Ee===De.value)):Se.refs[0]&&(Se.refs[0].checked=!!Ee):Se.refs.forEach(De=>De.checked=De.value===Ee):UT(Se.ref)?Se.ref.value="":(Se.ref.value=Ee,Se.ref.type||m.values.next({name:U,values:{...o}})))}(de.shouldDirty||de.shouldTouch)&&D(U,Ee,de.shouldTouch,de.shouldDirty,!0),de.shouldValidate&&I(U)},se=(U,re,de)=>{for(const ke in re){const Ee=re[ke],Se=`${U}.${ke}`,De=lt(i,Se);(u.array.has(U)||!sm(Ee)||De&&!De._f)&&!F1(Ee)?se(Se,Ee,de):Le(Se,Ee,de)}},le=(U,re,de={})=>{const ke=lt(i,U),Ee=u.array.has(U),Se=Qo(re);Cn(o,U,Se),Ee?(m.array.next({name:U,values:{...o}}),(f.isDirty||f.dirtyFields)&&de.shouldDirty&&m.state.next({name:U,dirtyFields:Q4(a,o),isDirty:oe(U,Se)})):ke&&!ke._f&&!ei(Se)?se(U,Se,de):Le(U,Se,de),yN(U,u)&&m.state.next({...r}),m.values.next({name:U,values:{...o}}),!s.mount&&t()},he=async U=>{const re=U.target;let de=re.name,ke=!0;const Ee=lt(i,de),Se=()=>re.type?Z4(Ee._f):u4e(U);if(Ee){let De,ze;const Ye=Se(),Gt=U.type===mN.BLUR||U.type===mN.FOCUS_OUT,ue=!w4e(Ee._f)&&!n.resolver&&!lt(r.errors,de)&&!Ee._f.deps||A4e(Gt,lt(r.touchedFields,de),r.isSubmitted,y,b),ve=yN(de,u,Gt);Cn(o,de,Ye),Gt?(Ee._f.onBlur&&Ee._f.onBlur(U),c&&c(0)):Ee._f.onChange&&Ee._f.onChange(U);const qe=D(de,Ye,Gt,!1),H=!sa(qe)||ve;if(!Gt&&m.values.next({name:de,type:U.type,values:{...o}}),ue)return f.isValid&&v(),H&&m.state.next({name:de,...ve?{}:qe});if(!Gt&&ve&&m.state.next({...r}),w(!0),n.resolver){const{errors:me}=await V([de]),We=wN(r.errors,i,de),ge=wN(me,i,We.name||de);De=ge.error,de=ge.name,ze=sa(me)}else De=(await SN(Ee,o,T,n.shouldUseNativeValidation))[de],ke=Number.isNaN(Ye)||Ye===lt(o,de,Ye),ke&&(De?ze=!1:f.isValid&&(ze=await Z(i,!0)));ke&&(Ee._f.deps&&I(Ee._f.deps),B(de,ze,De,qe))}},I=async(U,re={})=>{let de,ke;const Ee=K4(U);if(w(!0),n.resolver){const Se=await P(qn(U)?U:Ee);de=sa(Se),ke=U?!Ee.some(De=>lt(Se,De)):de}else U?(ke=(await Promise.all(Ee.map(async Se=>{const De=lt(i,Se);return await Z(De&&De._f?{[Se]:De}:De)}))).every(Boolean),!(!ke&&!r.isValid)&&v()):ke=de=await Z(i);return m.state.next({...!yo(U)||f.isValid&&de!==r.isValid?{}:{name:U},...n.resolver||!U?{isValid:de}:{},errors:r.errors,isValidating:!1}),re.shouldFocus&&!ke&&lE(i,Se=>Se&<(r.errors,Se),U?Ee:u.mount),ke},X=U=>{const re={...a,...s.mount?o:{}};return qn(U)?re:yo(U)?lt(re,U):U.map(de=>lt(re,de))},ae=(U,re)=>({invalid:!!lt((re||r).errors,U),isDirty:!!lt((re||r).dirtyFields,U),isTouched:!!lt((re||r).touchedFields,U),error:lt((re||r).errors,U)}),O=U=>{U&&K4(U).forEach(re=>vr(r.errors,re)),m.state.next({errors:U?r.errors:{}})},Q=(U,re,de)=>{const ke=(lt(i,U,{_f:{}})._f||{}).ref;Cn(r.errors,U,{...re,ref:ke}),m.state.next({name:U,errors:r.errors,isValid:!1}),de&&de.shouldFocus&&ke&&ke.focus&&ke.focus()},be=(U,re)=>Js(U)?m.values.subscribe({next:de=>U(pe(void 0,re),de)}):pe(U,re,!0),q=(U,re={})=>{for(const de of U?K4(U):u.mount)u.mount.delete(de),u.array.delete(de),re.keepValue||(vr(i,de),vr(o,de)),!re.keepError&&vr(r.errors,de),!re.keepDirty&&vr(r.dirtyFields,de),!re.keepTouched&&vr(r.touchedFields,de),!n.shouldUnregister&&!re.keepDefaultValue&&vr(a,de);m.values.next({values:{...o}}),m.state.next({...r,...re.keepDirty?{isDirty:oe()}:{}}),!re.keepIsValid&&v()},we=({disabled:U,name:re,field:de,fields:ke})=>{if(lu(U)){const Ee=U?void 0:lt(o,re,Z4(de?de._f:lt(ke,re)._f));Cn(o,re,Ee),D(re,Ee,!1,!1,!0)}},te=(U,re={})=>{let de=lt(i,U);const ke=lu(re.disabled);return Cn(i,U,{...de||{},_f:{...de&&de._f?de._f:{ref:{name:U}},name:U,mount:!0,...re}}),u.mount.add(U),de?we({field:de,disabled:re.disabled,name:U}):x(U,!0,re.value),{...ke?{disabled:re.disabled}:{},...n.progressive?{required:!!re.required,min:md(re.min),max:md(re.max),minLength:md(re.minLength),maxLength:md(re.maxLength),pattern:md(re.pattern)}:{},name:U,onChange:he,onBlur:he,ref:Ee=>{if(Ee){te(U,re),de=lt(i,U);const Se=qn(Ee.value)&&Ee.querySelectorAll&&Ee.querySelectorAll("input,select,textarea")[0]||Ee,De=T4e(Se),ze=de._f.refs||[];if(De?ze.find(Ye=>Ye===Se):Se===de._f.ref)return;Cn(i,U,{_f:{...de._f,...De?{refs:[...ze.filter(X4),Se,...Array.isArray(lt(a,U))?[{}]:[]],ref:{type:Se.type,name:U}}:{ref:Se}}}),x(U,!1,void 0,Se)}else de=lt(i,U,{}),de._f&&(de._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(d4e(u.array,U)&&s.action)&&u.unMount.add(U)}}},Me=()=>n.shouldFocusError&&lE(i,U=>U&<(r.errors,U),u.mount),Re=(U,re)=>async de=>{de&&(de.preventDefault&&de.preventDefault(),de.persist&&de.persist());let ke=Qo(o);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:Ee,values:Se}=await V();r.errors=Ee,ke=Se}else await Z(i);vr(r.errors,"root"),sa(r.errors)?(m.state.next({errors:{}}),await U(ke,de)):(re&&await re({...r.errors},de),Me(),setTimeout(Me)),m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:sa(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Qe=(U,re={})=>{lt(i,U)&&(qn(re.defaultValue)?le(U,lt(a,U)):(le(U,re.defaultValue),Cn(a,U,re.defaultValue)),re.keepTouched||vr(r.touchedFields,U),re.keepDirty||(vr(r.dirtyFields,U),r.isDirty=re.defaultValue?oe(U,lt(a,U)):oe()),re.keepError||(vr(r.errors,U),f.isValid&&v()),m.state.next({...r}))},Ve=(U,re={})=>{const de=U?Qo(U):a,ke=Qo(de),Ee=U&&!sa(U)?ke:a;if(re.keepDefaultValues||(a=de),!re.keepValues){if(re.keepDirtyValues||h)for(const Se of u.mount)lt(r.dirtyFields,Se)?Cn(Ee,Se,lt(o,Se)):le(Se,lt(Ee,Se));else{if(PT&&qn(U))for(const Se of u.mount){const De=lt(i,Se);if(De&&De._f){const ze=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(am(ze)){const Ye=ze.closest("form");if(Ye){Ye.reset();break}}}}i={}}o=e.shouldUnregister?re.keepDefaultValues?Qo(a):{}:Qo(Ee),m.array.next({values:{...Ee}}),m.values.next({values:{...Ee}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!f.isValid||!!re.keepIsValid,s.watch=!!e.shouldUnregister,m.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!uu(U,a)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:re.keepDirtyValues?r.dirtyFields:re.keepDefaultValues&&U?Q4(a,U):{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},dt=(U,re)=>Ve(Js(U)?U(o):U,re);return{control:{register:te,unregister:q,getFieldState:ae,handleSubmit:Re,setError:Q,_executeSchema:V,_getWatch:pe,_getDirty:oe,_updateValid:v,_removeUnmounted:$,_updateFieldArray:A,_updateDisabledField:we,_getFieldArray:ce,_reset:Ve,_resetDefaultValues:()=>Js(n.defaultValues)&&n.defaultValues().then(U=>{dt(U,n.resetOptions),m.state.next({isLoading:!1})}),_updateFormState:U=>{r={...r,...U}},_subjects:m,_proxyFormState:f,get _fields(){return i},get _formValues(){return o},get _state(){return s},set _state(U){s=U},get _defaultValues(){return a},get _names(){return u},set _names(U){u=U},get _formState(){return r},set _formState(U){r=U},get _options(){return n},set _options(U){n={...n,...U}}},trigger:I,register:te,handleSubmit:Re,watch:be,setValue:le,getValues:X,reset:dt,resetField:Qe,clearErrors:O,unregister:q,setError:Q,setFocus:(U,re={})=>{const de=lt(i,U),ke=de&&de._f;if(ke){const Ee=ke.refs?ke.refs[0]:ke.ref;Ee.focus&&(Ee.focus(),re.shouldSelect&&Ee.select())}},getFieldState:ae}}function oU(e={}){const t=ut.useRef(),n=ut.useRef(),[r,i]=ut.useState({isDirty:!1,isValidating:!1,isLoading:Js(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:Js(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...k4e(e,()=>i(o=>({...o}))),formState:r});const a=t.current.control;return a._options=e,m4e({subject:a._subjects.state,next:o=>{g4e(o,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),ut.useEffect(()=>{e.values&&!uu(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values):a._resetDefaultValues()},[e.values,a]),ut.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=h4e(r,a),t.current}const AN=He.hr` border: 0.5px solid ${Et}; `,I4e=He(_p)` background-color: transparent; @@ -1148,7 +1148,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho outline: none; border: none; } -`;function O4e(){const e=oU(),t=s=>console.log(s),n=bs(),r=C.useContext(eo),i=St(s=>s.serverState.config);Io();const a=()=>{if(!r)return;const s=e.watch("system_message"),u=e.watch("temperature");r.setSystemMessage(s||""),u&&r.setTemperature(u)},o=()=>{a(),n("/")};return C.useEffect(()=>{i&&(e.setValue("system_message",i.system_message),e.setValue("temperature",i.temperature))},[i]),R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:o,className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Settings"})]}),R.jsx("form",{onSubmit:e.handleSubmit(t),children:i?R.jsxs("div",{className:"p-2",children:[R.jsxs("h3",{className:"flex gap-1",children:["System Message",R.jsx(sE,{msg:`Set a system message with information that the LLM should always +`;function O4e(){const e=oU(),t=s=>console.log(s),n=bs(),r=C.useContext(eo),i=wt(s=>s.serverState.config);Io();const a=()=>{if(!r)return;const s=e.watch("system_message"),u=e.watch("temperature");r.setSystemMessage(s||""),u&&r.setTemperature(u)},o=()=>{a(),n("/")};return C.useEffect(()=>{i&&(e.setValue("system_message",i.system_message),e.setValue("temperature",i.temperature))},[i]),R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:o,className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Settings"})]}),R.jsx("form",{onSubmit:e.handleSubmit(t),children:i?R.jsxs("div",{className:"p-2",children:[R.jsxs("h3",{className:"flex gap-1",children:["System Message",R.jsx(sE,{msg:`Set a system message with information that the LLM should always keep in mind (e.g. "Please give concise answers. Always respond in Spanish.")`})]}),R.jsx(VX,{placeholder:"Enter a system message (e.g. 'Always respond in German')",...e.register("system_message")}),R.jsx(AN,{}),R.jsxs("h3",{className:"flex gap-1",children:["Temperature",R.jsx(sE,{msg:`Set temperature to any value between 0 and 1. Higher values will make the LLM more creative, while lower values will make it more @@ -1159,9 +1159,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */um.exports;(function(e,t){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",c=500,p="__lodash_placeholder__",f=1,m=2,h=4,b=1,y=2,T=1,E=2,v=4,w=8,A=16,N=32,x=64,D=128,B=256,V=512,P=30,Z="...",$=800,oe=16,pe=1,ce=2,Le=3,se=1/0,le=9007199254740991,he=17976931348623157e292,I=0/0,X=4294967295,ae=X-1,O=X>>>1,Q=[["ary",D],["bind",T],["bindKey",E],["curry",w],["curryRight",A],["flip",V],["partial",N],["partialRight",x],["rearg",B]],be="[object Arguments]",q="[object Array]",we="[object AsyncFunction]",te="[object Boolean]",Me="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ve="[object Function]",dt="[object GeneratorFunction]",ot="[object Map]",Ge="[object Number]",pt="[object Null]",U="[object Object]",re="[object Promise]",de="[object Proxy]",ke="[object RegExp]",Ee="[object Set]",Se="[object String]",De="[object Symbol]",ze="[object Undefined]",Ye="[object WeakMap]",Gt="[object WeakSet]",ue="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",H="[object Float64Array]",me="[object Int8Array]",We="[object Int16Array]",ge="[object Int32Array]",j="[object Uint8Array]",W="[object Uint8ClampedArray]",ne="[object Uint16Array]",_e="[object Uint32Array]",Ze=/\b__p \+= '';/g,Fe=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rt=/&(?:amp|lt|gt|quot|#39);/g,Je=/[&<>"']/g,Nt=RegExp(rt.source),Zt=RegExp(Je.source),It=/<%-([\s\S]+?)%>/g,rn=/<%([\s\S]+?)%>/g,Xt=/<%=([\s\S]+?)%>/g,Wr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qr=/^\w*$/,Kr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aa=/[\\^$.*+?()[\]{}|]/g,si=RegExp(Aa.source),Or=/^\s+/,Es=/\s/,vs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yr=/\{\n\/\* \[wrapped with (.+)\] \*/,_s=/,? & /,Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dr=/[()=,{}\[\]\/\s]/,wi=/\\(\\)?/g,Nl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ke=/\w*$/,J=/^[-+]0x[0-9a-f]+$/i,Be=/^0b[01]+$/i,it=/^\[object .+?Constructor\]$/,un=/^0o[0-7]+$/i,or=/^(?:0|[1-9]\d*)$/,sr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qn=/($^)/,No=/['\n\r\u2028\u2029\\]/g,to="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ef="\\ufe20-\\ufe2f",vf="\\u20d0-\\u20ff",VT=Lr+Ef+vf,WT="\\u2700-\\u27bf",qT="a-z\\xdf-\\xf6\\xf8-\\xff",_U="\\xac\\xb1\\xd7\\xf7",TU="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SU="\\u2000-\\u206f",wU=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",KT="A-Z\\xc0-\\xd6\\xd8-\\xde",YT="\\ufe0e\\ufe0f",XT=_U+TU+SU+wU,K2="['’]",AU="["+to+"]",QT="["+XT+"]",_f="["+VT+"]",ZT="\\d+",CU="["+WT+"]",JT="["+qT+"]",eS="[^"+to+XT+ZT+WT+qT+KT+"]",Y2="\\ud83c[\\udffb-\\udfff]",xU="(?:"+_f+"|"+Y2+")",tS="[^"+to+"]",X2="(?:\\ud83c[\\udde6-\\uddff]){2}",Q2="[\\ud800-\\udbff][\\udc00-\\udfff]",Bu="["+KT+"]",nS="\\u200d",rS="(?:"+JT+"|"+eS+")",kU="(?:"+Bu+"|"+eS+")",iS="(?:"+K2+"(?:d|ll|m|re|s|t|ve))?",aS="(?:"+K2+"(?:D|LL|M|RE|S|T|VE))?",oS=xU+"?",sS="["+YT+"]?",IU="(?:"+nS+"(?:"+[tS,X2,Q2].join("|")+")"+sS+oS+")*",RU="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NU="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",lS=sS+oS+IU,OU="(?:"+[CU,X2,Q2].join("|")+")"+lS,DU="(?:"+[tS+_f+"?",_f,X2,Q2,AU].join("|")+")",LU=RegExp(K2,"g"),MU=RegExp(_f,"g"),Z2=RegExp(Y2+"(?="+Y2+")|"+DU+lS,"g"),FU=RegExp([Bu+"?"+JT+"+"+iS+"(?="+[QT,Bu,"$"].join("|")+")",kU+"+"+aS+"(?="+[QT,Bu+rS,"$"].join("|")+")",Bu+"?"+rS+"+"+iS,Bu+"+"+aS,NU,RU,ZT,OU].join("|"),"g"),PU=RegExp("["+nS+to+VT+YT+"]"),BU=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,UU=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$U=-1,En={};En[qe]=En[H]=En[me]=En[We]=En[ge]=En[j]=En[W]=En[ne]=En[_e]=!0,En[be]=En[q]=En[ue]=En[te]=En[ve]=En[Me]=En[Qe]=En[Ve]=En[ot]=En[Ge]=En[U]=En[ke]=En[Ee]=En[Se]=En[Ye]=!1;var mn={};mn[be]=mn[q]=mn[ue]=mn[ve]=mn[te]=mn[Me]=mn[qe]=mn[H]=mn[me]=mn[We]=mn[ge]=mn[ot]=mn[Ge]=mn[U]=mn[ke]=mn[Ee]=mn[Se]=mn[De]=mn[j]=mn[W]=mn[ne]=mn[_e]=!0,mn[Qe]=mn[Ve]=mn[Ye]=!1;var zU={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"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",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},HU={"&":"&","<":"<",">":">",'"':""","'":"'"},jU={"&":"&","<":"<",">":">",""":'"',"'":"'"},GU={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},VU=parseFloat,WU=parseInt,uS=typeof eu=="object"&&eu&&eu.Object===Object&&eu,qU=typeof self=="object"&&self&&self.Object===Object&&self,mr=uS||qU||Function("return this")(),J2=t&&!t.nodeType&&t,Ol=J2&&!0&&e&&!e.nodeType&&e,cS=Ol&&Ol.exports===J2,e5=cS&&uS.process,Yi=function(){try{var ee=Ol&&Ol.require&&Ol.require("util").types;return ee||e5&&e5.binding&&e5.binding("util")}catch{}}(),dS=Yi&&Yi.isArrayBuffer,pS=Yi&&Yi.isDate,fS=Yi&&Yi.isMap,hS=Yi&&Yi.isRegExp,gS=Yi&&Yi.isSet,mS=Yi&&Yi.isTypedArray;function Ai(ee,Te,fe){switch(fe.length){case 0:return ee.call(Te);case 1:return ee.call(Te,fe[0]);case 2:return ee.call(Te,fe[0],fe[1]);case 3:return ee.call(Te,fe[0],fe[1],fe[2])}return ee.apply(Te,fe)}function KU(ee,Te,fe,et){for(var _t=-1,Jt=ee==null?0:ee.length;++_t-1}function t5(ee,Te,fe){for(var et=-1,_t=ee==null?0:ee.length;++et<_t;)if(fe(Te,ee[et]))return!0;return!1}function An(ee,Te){for(var fe=-1,et=ee==null?0:ee.length,_t=Array(et);++fe-1;);return fe}function wS(ee,Te){for(var fe=ee.length;fe--&&Uu(Te,ee[fe],0)>-1;);return fe}function r$(ee,Te){for(var fe=ee.length,et=0;fe--;)ee[fe]===Te&&++et;return et}var i$=a5(zU),a$=a5(HU);function o$(ee){return"\\"+GU[ee]}function s$(ee,Te){return ee==null?n:ee[Te]}function $u(ee){return PU.test(ee)}function l$(ee){return BU.test(ee)}function u$(ee){for(var Te,fe=[];!(Te=ee.next()).done;)fe.push(Te.value);return fe}function u5(ee){var Te=-1,fe=Array(ee.size);return ee.forEach(function(et,_t){fe[++Te]=[_t,et]}),fe}function AS(ee,Te){return function(fe){return ee(Te(fe))}}function ws(ee,Te){for(var fe=-1,et=ee.length,_t=0,Jt=[];++fe-1}function X$(l,d){var g=this.__data__,_=Uf(g,l);return _<0?(++this.size,g.push([l,d])):g[_][1]=d,this}Oo.prototype.clear=W$,Oo.prototype.delete=q$,Oo.prototype.get=K$,Oo.prototype.has=Y$,Oo.prototype.set=X$;function Do(l){var d=-1,g=l==null?0:l.length;for(this.clear();++d=d?l:d)),l}function Ji(l,d,g,_,k,F){var z,Y=d&f,ie=d&m,Ae=d&h;if(g&&(z=k?g(l,_,k,F):g(l)),z!==n)return z;if(!Rn(l))return l;var xe=Tt(l);if(xe){if(z=eH(l),!Y)return li(l,z)}else{var Ie=Fr(l),Xe=Ie==Ve||Ie==dt;if(Rs(l))return sw(l,Y);if(Ie==U||Ie==be||Xe&&!k){if(z=ie||Xe?{}:Cw(l),!Y)return ie?jz(l,pz(z,l)):Hz(l,PS(z,l))}else{if(!mn[Ie])return k?l:{};z=tH(l,Ie,Y)}}F||(F=new xa);var st=F.get(l);if(st)return st;F.set(l,z),tA(l)?l.forEach(function(yt){z.add(Ji(yt,d,g,yt,l,F))}):Jw(l)&&l.forEach(function(yt,Ot){z.set(Ot,Ji(yt,d,g,Ot,l,F))});var bt=Ae?ie?M5:L5:ie?ci:lr,Ct=xe?n:bt(l);return Xi(Ct||l,function(yt,Ot){Ct&&(Ot=yt,yt=l[Ot]),Mc(z,Ot,Ji(yt,d,g,Ot,l,F))}),z}function fz(l){var d=lr(l);return function(g){return BS(g,l,d)}}function BS(l,d,g){var _=g.length;if(l==null)return!_;for(l=pn(l);_--;){var k=g[_],F=d[k],z=l[k];if(z===n&&!(k in l)||!F(z))return!1}return!0}function US(l,d,g){if(typeof l!="function")throw new Qi(o);return Hc(function(){l.apply(n,g)},d)}function Fc(l,d,g,_){var k=-1,F=Tf,z=!0,Y=l.length,ie=[],Ae=d.length;if(!Y)return ie;g&&(d=An(d,Ci(g))),_?(F=t5,z=!1):d.length>=i&&(F=Ic,z=!1,d=new Ml(d));e:for(;++kk?0:k+g),_=_===n||_>k?k:wt(_),_<0&&(_+=k),_=g>_?0:rA(_);g<_;)l[g++]=d;return l}function zS(l,d){var g=[];return Cs(l,function(_,k,F){d(_,k,F)&&g.push(_)}),g}function br(l,d,g,_,k){var F=-1,z=l.length;for(g||(g=rH),k||(k=[]);++F0&&g(Y)?d>1?br(Y,d-1,g,_,k):Ss(k,Y):_||(k[k.length]=Y)}return k}var m5=fw(),HS=fw(!0);function no(l,d){return l&&m5(l,d,lr)}function b5(l,d){return l&&HS(l,d,lr)}function zf(l,d){return Ts(d,function(g){return Bo(l[g])})}function Pl(l,d){d=ks(d,l);for(var g=0,_=d.length;l!=null&&g<_;)l=l[io(d[g++])];return g&&g==_?l:n}function jS(l,d,g){var _=d(l);return Tt(l)?_:Ss(_,g(l))}function Xr(l){return l==null?l===n?ze:pt:Dl&&Dl in pn(l)?Qz(l):cH(l)}function y5(l,d){return l>d}function mz(l,d){return l!=null&&an.call(l,d)}function bz(l,d){return l!=null&&d in pn(l)}function yz(l,d,g){return l>=Mr(d,g)&&l=120&&xe.length>=120)?new Ml(z&&xe):n}xe=l[0];var Ie=-1,Xe=Y[0];e:for(;++Ie-1;)Y!==l&&Of.call(Y,ie,1),Of.call(l,ie,1);return l}function JS(l,d){for(var g=l?d.length:0,_=g-1;g--;){var k=d[g];if(g==_||k!==F){var F=k;Po(k)?Of.call(l,k,1):x5(l,k)}}return l}function w5(l,d){return l+Mf(DS()*(d-l+1))}function Nz(l,d,g,_){for(var k=-1,F=Jn(Lf((d-l)/(g||1)),0),z=fe(F);F--;)z[_?F:++k]=l,l+=g;return z}function A5(l,d){var g="";if(!l||d<1||d>le)return g;do d%2&&(g+=l),d=Mf(d/2),d&&(l+=l);while(d);return g}function Rt(l,d){return H5(Iw(l,d,di),l+"")}function Oz(l){return FS(Qu(l))}function Dz(l,d){var g=Qu(l);return Zf(g,Fl(d,0,g.length))}function Uc(l,d,g,_){if(!Rn(l))return l;d=ks(d,l);for(var k=-1,F=d.length,z=F-1,Y=l;Y!=null&&++kk?0:k+d),g=g>k?k:g,g<0&&(g+=k),k=d>g?0:g-d>>>0,d>>>=0;for(var F=fe(k);++_>>1,z=l[F];z!==null&&!ki(z)&&(g?z<=d:z=i){var Ae=d?null:qz(l);if(Ae)return wf(Ae);z=!1,k=Ic,ie=new Ml}else ie=d?[]:Y;e:for(;++_=_?l:ea(l,d,g)}var ow=w$||function(l){return mr.clearTimeout(l)};function sw(l,d){if(d)return l.slice();var g=l.length,_=kS?kS(g):new l.constructor(g);return l.copy(_),_}function N5(l){var d=new l.constructor(l.byteLength);return new Rf(d).set(new Rf(l)),d}function Bz(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.byteLength)}function Uz(l){var d=new l.constructor(l.source,Ke.exec(l));return d.lastIndex=l.lastIndex,d}function $z(l){return Lc?pn(Lc.call(l)):{}}function lw(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.length)}function uw(l,d){if(l!==d){var g=l!==n,_=l===null,k=l===l,F=ki(l),z=d!==n,Y=d===null,ie=d===d,Ae=ki(d);if(!Y&&!Ae&&!F&&l>d||F&&z&&ie&&!Y&&!Ae||_&&z&&ie||!g&&ie||!k)return 1;if(!_&&!F&&!Ae&&l=Y)return ie;var Ae=g[_];return ie*(Ae=="desc"?-1:1)}}return l.index-d.index}function cw(l,d,g,_){for(var k=-1,F=l.length,z=g.length,Y=-1,ie=d.length,Ae=Jn(F-z,0),xe=fe(ie+Ae),Ie=!_;++Y1?g[k-1]:n,z=k>2?g[2]:n;for(F=l.length>3&&typeof F=="function"?(k--,F):n,z&&Qr(g[0],g[1],z)&&(F=k<3?n:F,k=1),d=pn(d);++_-1?k[F?d[z]:z]:n}}function mw(l){return Fo(function(d){var g=d.length,_=g,k=Zi.prototype.thru;for(l&&d.reverse();_--;){var F=d[_];if(typeof F!="function")throw new Qi(o);if(k&&!z&&Xf(F)=="wrapper")var z=new Zi([],!0)}for(_=z?_:g;++_1&&$t.reverse(),xe&&ieY))return!1;var Ae=F.get(l),xe=F.get(d);if(Ae&&xe)return Ae==d&&xe==l;var Ie=-1,Xe=!0,st=g&y?new Ml:n;for(F.set(l,d),F.set(d,l);++Ie1?"& ":"")+d[_],d=d.join(g>2?", ":" "),l.replace(vs,`{ + */um.exports;(function(e,t){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",c=500,p="__lodash_placeholder__",f=1,m=2,h=4,b=1,y=2,T=1,E=2,v=4,w=8,A=16,N=32,x=64,D=128,B=256,V=512,P=30,Z="...",$=800,oe=16,pe=1,ce=2,Le=3,se=1/0,le=9007199254740991,he=17976931348623157e292,I=0/0,X=4294967295,ae=X-1,O=X>>>1,Q=[["ary",D],["bind",T],["bindKey",E],["curry",w],["curryRight",A],["flip",V],["partial",N],["partialRight",x],["rearg",B]],be="[object Arguments]",q="[object Array]",we="[object AsyncFunction]",te="[object Boolean]",Me="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ve="[object Function]",dt="[object GeneratorFunction]",ot="[object Map]",Ge="[object Number]",pt="[object Null]",U="[object Object]",re="[object Promise]",de="[object Proxy]",ke="[object RegExp]",Ee="[object Set]",Se="[object String]",De="[object Symbol]",ze="[object Undefined]",Ye="[object WeakMap]",Gt="[object WeakSet]",ue="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",H="[object Float64Array]",me="[object Int8Array]",We="[object Int16Array]",ge="[object Int32Array]",j="[object Uint8Array]",W="[object Uint8ClampedArray]",ne="[object Uint16Array]",_e="[object Uint32Array]",Ze=/\b__p \+= '';/g,Fe=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rt=/&(?:amp|lt|gt|quot|#39);/g,Je=/[&<>"']/g,Nt=RegExp(rt.source),Zt=RegExp(Je.source),It=/<%-([\s\S]+?)%>/g,rn=/<%([\s\S]+?)%>/g,Xt=/<%=([\s\S]+?)%>/g,Wr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qr=/^\w*$/,Kr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aa=/[\\^$.*+?()[\]{}|]/g,si=RegExp(Aa.source),Or=/^\s+/,Es=/\s/,vs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yr=/\{\n\/\* \[wrapped with (.+)\] \*/,_s=/,? & /,Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dr=/[()=,{}\[\]\/\s]/,wi=/\\(\\)?/g,Nl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ke=/\w*$/,J=/^[-+]0x[0-9a-f]+$/i,Be=/^0b[01]+$/i,it=/^\[object .+?Constructor\]$/,un=/^0o[0-7]+$/i,or=/^(?:0|[1-9]\d*)$/,sr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qn=/($^)/,No=/['\n\r\u2028\u2029\\]/g,to="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ef="\\ufe20-\\ufe2f",vf="\\u20d0-\\u20ff",VT=Lr+Ef+vf,WT="\\u2700-\\u27bf",qT="a-z\\xdf-\\xf6\\xf8-\\xff",_U="\\xac\\xb1\\xd7\\xf7",TU="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SU="\\u2000-\\u206f",wU=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",KT="A-Z\\xc0-\\xd6\\xd8-\\xde",YT="\\ufe0e\\ufe0f",XT=_U+TU+SU+wU,K2="['’]",AU="["+to+"]",QT="["+XT+"]",_f="["+VT+"]",ZT="\\d+",CU="["+WT+"]",JT="["+qT+"]",eS="[^"+to+XT+ZT+WT+qT+KT+"]",Y2="\\ud83c[\\udffb-\\udfff]",xU="(?:"+_f+"|"+Y2+")",tS="[^"+to+"]",X2="(?:\\ud83c[\\udde6-\\uddff]){2}",Q2="[\\ud800-\\udbff][\\udc00-\\udfff]",Bu="["+KT+"]",nS="\\u200d",rS="(?:"+JT+"|"+eS+")",kU="(?:"+Bu+"|"+eS+")",iS="(?:"+K2+"(?:d|ll|m|re|s|t|ve))?",aS="(?:"+K2+"(?:D|LL|M|RE|S|T|VE))?",oS=xU+"?",sS="["+YT+"]?",IU="(?:"+nS+"(?:"+[tS,X2,Q2].join("|")+")"+sS+oS+")*",RU="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NU="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",lS=sS+oS+IU,OU="(?:"+[CU,X2,Q2].join("|")+")"+lS,DU="(?:"+[tS+_f+"?",_f,X2,Q2,AU].join("|")+")",LU=RegExp(K2,"g"),MU=RegExp(_f,"g"),Z2=RegExp(Y2+"(?="+Y2+")|"+DU+lS,"g"),FU=RegExp([Bu+"?"+JT+"+"+iS+"(?="+[QT,Bu,"$"].join("|")+")",kU+"+"+aS+"(?="+[QT,Bu+rS,"$"].join("|")+")",Bu+"?"+rS+"+"+iS,Bu+"+"+aS,NU,RU,ZT,OU].join("|"),"g"),PU=RegExp("["+nS+to+VT+YT+"]"),BU=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,UU=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$U=-1,En={};En[qe]=En[H]=En[me]=En[We]=En[ge]=En[j]=En[W]=En[ne]=En[_e]=!0,En[be]=En[q]=En[ue]=En[te]=En[ve]=En[Me]=En[Qe]=En[Ve]=En[ot]=En[Ge]=En[U]=En[ke]=En[Ee]=En[Se]=En[Ye]=!1;var mn={};mn[be]=mn[q]=mn[ue]=mn[ve]=mn[te]=mn[Me]=mn[qe]=mn[H]=mn[me]=mn[We]=mn[ge]=mn[ot]=mn[Ge]=mn[U]=mn[ke]=mn[Ee]=mn[Se]=mn[De]=mn[j]=mn[W]=mn[ne]=mn[_e]=!0,mn[Qe]=mn[Ve]=mn[Ye]=!1;var zU={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"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",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},HU={"&":"&","<":"<",">":">",'"':""","'":"'"},jU={"&":"&","<":"<",">":">",""":'"',"'":"'"},GU={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},VU=parseFloat,WU=parseInt,uS=typeof eu=="object"&&eu&&eu.Object===Object&&eu,qU=typeof self=="object"&&self&&self.Object===Object&&self,mr=uS||qU||Function("return this")(),J2=t&&!t.nodeType&&t,Ol=J2&&!0&&e&&!e.nodeType&&e,cS=Ol&&Ol.exports===J2,e5=cS&&uS.process,Yi=function(){try{var ee=Ol&&Ol.require&&Ol.require("util").types;return ee||e5&&e5.binding&&e5.binding("util")}catch{}}(),dS=Yi&&Yi.isArrayBuffer,pS=Yi&&Yi.isDate,fS=Yi&&Yi.isMap,hS=Yi&&Yi.isRegExp,gS=Yi&&Yi.isSet,mS=Yi&&Yi.isTypedArray;function Ai(ee,Te,fe){switch(fe.length){case 0:return ee.call(Te);case 1:return ee.call(Te,fe[0]);case 2:return ee.call(Te,fe[0],fe[1]);case 3:return ee.call(Te,fe[0],fe[1],fe[2])}return ee.apply(Te,fe)}function KU(ee,Te,fe,et){for(var _t=-1,Jt=ee==null?0:ee.length;++_t-1}function t5(ee,Te,fe){for(var et=-1,_t=ee==null?0:ee.length;++et<_t;)if(fe(Te,ee[et]))return!0;return!1}function An(ee,Te){for(var fe=-1,et=ee==null?0:ee.length,_t=Array(et);++fe-1;);return fe}function wS(ee,Te){for(var fe=ee.length;fe--&&Uu(Te,ee[fe],0)>-1;);return fe}function r$(ee,Te){for(var fe=ee.length,et=0;fe--;)ee[fe]===Te&&++et;return et}var i$=a5(zU),a$=a5(HU);function o$(ee){return"\\"+GU[ee]}function s$(ee,Te){return ee==null?n:ee[Te]}function $u(ee){return PU.test(ee)}function l$(ee){return BU.test(ee)}function u$(ee){for(var Te,fe=[];!(Te=ee.next()).done;)fe.push(Te.value);return fe}function u5(ee){var Te=-1,fe=Array(ee.size);return ee.forEach(function(et,_t){fe[++Te]=[_t,et]}),fe}function AS(ee,Te){return function(fe){return ee(Te(fe))}}function ws(ee,Te){for(var fe=-1,et=ee.length,_t=0,Jt=[];++fe-1}function X$(l,d){var g=this.__data__,_=Uf(g,l);return _<0?(++this.size,g.push([l,d])):g[_][1]=d,this}Oo.prototype.clear=W$,Oo.prototype.delete=q$,Oo.prototype.get=K$,Oo.prototype.has=Y$,Oo.prototype.set=X$;function Do(l){var d=-1,g=l==null?0:l.length;for(this.clear();++d=d?l:d)),l}function Ji(l,d,g,_,k,F){var z,Y=d&f,ie=d&m,Ae=d&h;if(g&&(z=k?g(l,_,k,F):g(l)),z!==n)return z;if(!Rn(l))return l;var xe=Tt(l);if(xe){if(z=eH(l),!Y)return li(l,z)}else{var Ie=Fr(l),Xe=Ie==Ve||Ie==dt;if(Rs(l))return sw(l,Y);if(Ie==U||Ie==be||Xe&&!k){if(z=ie||Xe?{}:Cw(l),!Y)return ie?jz(l,pz(z,l)):Hz(l,PS(z,l))}else{if(!mn[Ie])return k?l:{};z=tH(l,Ie,Y)}}F||(F=new xa);var st=F.get(l);if(st)return st;F.set(l,z),tA(l)?l.forEach(function(yt){z.add(Ji(yt,d,g,yt,l,F))}):Jw(l)&&l.forEach(function(yt,Ot){z.set(Ot,Ji(yt,d,g,Ot,l,F))});var bt=Ae?ie?M5:L5:ie?ci:lr,Ct=xe?n:bt(l);return Xi(Ct||l,function(yt,Ot){Ct&&(Ot=yt,yt=l[Ot]),Mc(z,Ot,Ji(yt,d,g,Ot,l,F))}),z}function fz(l){var d=lr(l);return function(g){return BS(g,l,d)}}function BS(l,d,g){var _=g.length;if(l==null)return!_;for(l=pn(l);_--;){var k=g[_],F=d[k],z=l[k];if(z===n&&!(k in l)||!F(z))return!1}return!0}function US(l,d,g){if(typeof l!="function")throw new Qi(o);return Hc(function(){l.apply(n,g)},d)}function Fc(l,d,g,_){var k=-1,F=Tf,z=!0,Y=l.length,ie=[],Ae=d.length;if(!Y)return ie;g&&(d=An(d,Ci(g))),_?(F=t5,z=!1):d.length>=i&&(F=Ic,z=!1,d=new Ml(d));e:for(;++kk?0:k+g),_=_===n||_>k?k:St(_),_<0&&(_+=k),_=g>_?0:rA(_);g<_;)l[g++]=d;return l}function zS(l,d){var g=[];return Cs(l,function(_,k,F){d(_,k,F)&&g.push(_)}),g}function br(l,d,g,_,k){var F=-1,z=l.length;for(g||(g=rH),k||(k=[]);++F0&&g(Y)?d>1?br(Y,d-1,g,_,k):Ss(k,Y):_||(k[k.length]=Y)}return k}var m5=fw(),HS=fw(!0);function no(l,d){return l&&m5(l,d,lr)}function b5(l,d){return l&&HS(l,d,lr)}function zf(l,d){return Ts(d,function(g){return Bo(l[g])})}function Pl(l,d){d=ks(d,l);for(var g=0,_=d.length;l!=null&&g<_;)l=l[io(d[g++])];return g&&g==_?l:n}function jS(l,d,g){var _=d(l);return Tt(l)?_:Ss(_,g(l))}function Xr(l){return l==null?l===n?ze:pt:Dl&&Dl in pn(l)?Qz(l):cH(l)}function y5(l,d){return l>d}function mz(l,d){return l!=null&&an.call(l,d)}function bz(l,d){return l!=null&&d in pn(l)}function yz(l,d,g){return l>=Mr(d,g)&&l=120&&xe.length>=120)?new Ml(z&&xe):n}xe=l[0];var Ie=-1,Xe=Y[0];e:for(;++Ie-1;)Y!==l&&Of.call(Y,ie,1),Of.call(l,ie,1);return l}function JS(l,d){for(var g=l?d.length:0,_=g-1;g--;){var k=d[g];if(g==_||k!==F){var F=k;Po(k)?Of.call(l,k,1):x5(l,k)}}return l}function w5(l,d){return l+Mf(DS()*(d-l+1))}function Nz(l,d,g,_){for(var k=-1,F=Jn(Lf((d-l)/(g||1)),0),z=fe(F);F--;)z[_?F:++k]=l,l+=g;return z}function A5(l,d){var g="";if(!l||d<1||d>le)return g;do d%2&&(g+=l),d=Mf(d/2),d&&(l+=l);while(d);return g}function Rt(l,d){return H5(Iw(l,d,di),l+"")}function Oz(l){return FS(Qu(l))}function Dz(l,d){var g=Qu(l);return Zf(g,Fl(d,0,g.length))}function Uc(l,d,g,_){if(!Rn(l))return l;d=ks(d,l);for(var k=-1,F=d.length,z=F-1,Y=l;Y!=null&&++kk?0:k+d),g=g>k?k:g,g<0&&(g+=k),k=d>g?0:g-d>>>0,d>>>=0;for(var F=fe(k);++_>>1,z=l[F];z!==null&&!ki(z)&&(g?z<=d:z=i){var Ae=d?null:qz(l);if(Ae)return wf(Ae);z=!1,k=Ic,ie=new Ml}else ie=d?[]:Y;e:for(;++_=_?l:ea(l,d,g)}var ow=w$||function(l){return mr.clearTimeout(l)};function sw(l,d){if(d)return l.slice();var g=l.length,_=kS?kS(g):new l.constructor(g);return l.copy(_),_}function N5(l){var d=new l.constructor(l.byteLength);return new Rf(d).set(new Rf(l)),d}function Bz(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.byteLength)}function Uz(l){var d=new l.constructor(l.source,Ke.exec(l));return d.lastIndex=l.lastIndex,d}function $z(l){return Lc?pn(Lc.call(l)):{}}function lw(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.length)}function uw(l,d){if(l!==d){var g=l!==n,_=l===null,k=l===l,F=ki(l),z=d!==n,Y=d===null,ie=d===d,Ae=ki(d);if(!Y&&!Ae&&!F&&l>d||F&&z&&ie&&!Y&&!Ae||_&&z&&ie||!g&&ie||!k)return 1;if(!_&&!F&&!Ae&&l=Y)return ie;var Ae=g[_];return ie*(Ae=="desc"?-1:1)}}return l.index-d.index}function cw(l,d,g,_){for(var k=-1,F=l.length,z=g.length,Y=-1,ie=d.length,Ae=Jn(F-z,0),xe=fe(ie+Ae),Ie=!_;++Y1?g[k-1]:n,z=k>2?g[2]:n;for(F=l.length>3&&typeof F=="function"?(k--,F):n,z&&Qr(g[0],g[1],z)&&(F=k<3?n:F,k=1),d=pn(d);++_-1?k[F?d[z]:z]:n}}function mw(l){return Fo(function(d){var g=d.length,_=g,k=Zi.prototype.thru;for(l&&d.reverse();_--;){var F=d[_];if(typeof F!="function")throw new Qi(o);if(k&&!z&&Xf(F)=="wrapper")var z=new Zi([],!0)}for(_=z?_:g;++_1&&$t.reverse(),xe&&ieY))return!1;var Ae=F.get(l),xe=F.get(d);if(Ae&&xe)return Ae==d&&xe==l;var Ie=-1,Xe=!0,st=g&y?new Ml:n;for(F.set(l,d),F.set(d,l);++Ie1?"& ":"")+d[_],d=d.join(g>2?", ":" "),l.replace(vs,`{ /* [wrapped with `+d+`] */ -`)}function rH(l){return Tt(l)||$l(l)||!!(NS&&l&&l[NS])}function Po(l,d){var g=typeof l;return d=d??le,!!d&&(g=="number"||g!="symbol"&&or.test(l))&&l>-1&&l%1==0&&l0){if(++d>=$)return arguments[0]}else d=0;return l.apply(n,arguments)}}function Zf(l,d){var g=-1,_=l.length,k=_-1;for(d=d===n?_:d;++g1?l[d-1]:n;return g=typeof g=="function"?(l.pop(),g):n,zw(l,g)});function Hw(l){var d=M(l);return d.__chain__=!0,d}function hj(l,d){return d(l),l}function Jf(l,d){return d(l)}var gj=Fo(function(l){var d=l.length,g=d?l[0]:0,_=this.__wrapped__,k=function(F){return g5(F,l)};return d>1||this.__actions__.length||!(_ instanceof Pt)||!Po(g)?this.thru(k):(_=_.slice(g,+g+(d?1:0)),_.__actions__.push({func:Jf,args:[k],thisArg:n}),new Zi(_,this.__chain__).thru(function(F){return d&&!F.length&&F.push(n),F}))});function mj(){return Hw(this)}function bj(){return new Zi(this.value(),this.__chain__)}function yj(){this.__values__===n&&(this.__values__=nA(this.value()));var l=this.__index__>=this.__values__.length,d=l?n:this.__values__[this.__index__++];return{done:l,value:d}}function Ej(){return this}function vj(l){for(var d,g=this;g instanceof Bf;){var _=Mw(g);_.__index__=0,_.__values__=n,d?k.__wrapped__=_:d=_;var k=_;g=g.__wrapped__}return k.__wrapped__=l,d}function _j(){var l=this.__wrapped__;if(l instanceof Pt){var d=l;return this.__actions__.length&&(d=new Pt(this)),d=d.reverse(),d.__actions__.push({func:Jf,args:[j5],thisArg:n}),new Zi(d,this.__chain__)}return this.thru(j5)}function Tj(){return iw(this.__wrapped__,this.__actions__)}var Sj=Vf(function(l,d,g){an.call(l,g)?++l[g]:Lo(l,g,1)});function wj(l,d,g){var _=Tt(l)?bS:hz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}function Aj(l,d){var g=Tt(l)?Ts:zS;return g(l,mt(d,3))}var Cj=gw(Fw),xj=gw(Pw);function kj(l,d){return br(e0(l,d),1)}function Ij(l,d){return br(e0(l,d),se)}function Rj(l,d,g){return g=g===n?1:wt(g),br(e0(l,d),g)}function jw(l,d){var g=Tt(l)?Xi:Cs;return g(l,mt(d,3))}function Gw(l,d){var g=Tt(l)?YU:$S;return g(l,mt(d,3))}var Nj=Vf(function(l,d,g){an.call(l,g)?l[g].push(d):Lo(l,g,[d])});function Oj(l,d,g,_){l=ui(l)?l:Qu(l),g=g&&!_?wt(g):0;var k=l.length;return g<0&&(g=Jn(k+g,0)),a0(l)?g<=k&&l.indexOf(d,g)>-1:!!k&&Uu(l,d,g)>-1}var Dj=Rt(function(l,d,g){var _=-1,k=typeof d=="function",F=ui(l)?fe(l.length):[];return Cs(l,function(z){F[++_]=k?Ai(d,z,g):Pc(z,d,g)}),F}),Lj=Vf(function(l,d,g){Lo(l,g,d)});function e0(l,d){var g=Tt(l)?An:qS;return g(l,mt(d,3))}function Mj(l,d,g,_){return l==null?[]:(Tt(d)||(d=d==null?[]:[d]),g=_?n:g,Tt(g)||(g=g==null?[]:[g]),QS(l,d,g))}var Fj=Vf(function(l,d,g){l[g?0:1].push(d)},function(){return[[],[]]});function Pj(l,d,g){var _=Tt(l)?n5:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,Cs)}function Bj(l,d,g){var _=Tt(l)?XU:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,$S)}function Uj(l,d){var g=Tt(l)?Ts:zS;return g(l,r0(mt(d,3)))}function $j(l){var d=Tt(l)?FS:Oz;return d(l)}function zj(l,d,g){(g?Qr(l,d,g):d===n)?d=1:d=wt(d);var _=Tt(l)?uz:Dz;return _(l,d)}function Hj(l){var d=Tt(l)?cz:Mz;return d(l)}function jj(l){if(l==null)return 0;if(ui(l))return a0(l)?zu(l):l.length;var d=Fr(l);return d==ot||d==Ee?l.size:_5(l).length}function Gj(l,d,g){var _=Tt(l)?r5:Fz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}var Vj=Rt(function(l,d){if(l==null)return[];var g=d.length;return g>1&&Qr(l,d[0],d[1])?d=[]:g>2&&Qr(d[0],d[1],d[2])&&(d=[d[0]]),QS(l,br(d,1),[])}),t0=A$||function(){return mr.Date.now()};function Wj(l,d){if(typeof d!="function")throw new Qi(o);return l=wt(l),function(){if(--l<1)return d.apply(this,arguments)}}function Vw(l,d,g){return d=g?n:d,d=l&&d==null?l.length:d,Mo(l,D,n,n,n,n,d)}function Ww(l,d){var g;if(typeof d!="function")throw new Qi(o);return l=wt(l),function(){return--l>0&&(g=d.apply(this,arguments)),l<=1&&(d=n),g}}var V5=Rt(function(l,d,g){var _=T;if(g.length){var k=ws(g,Yu(V5));_|=N}return Mo(l,_,d,g,k)}),qw=Rt(function(l,d,g){var _=T|E;if(g.length){var k=ws(g,Yu(qw));_|=N}return Mo(d,_,l,g,k)});function Kw(l,d,g){d=g?n:d;var _=Mo(l,w,n,n,n,n,n,d);return _.placeholder=Kw.placeholder,_}function Yw(l,d,g){d=g?n:d;var _=Mo(l,A,n,n,n,n,n,d);return _.placeholder=Yw.placeholder,_}function Xw(l,d,g){var _,k,F,z,Y,ie,Ae=0,xe=!1,Ie=!1,Xe=!0;if(typeof l!="function")throw new Qi(o);d=na(d)||0,Rn(g)&&(xe=!!g.leading,Ie="maxWait"in g,F=Ie?Jn(na(g.maxWait)||0,d):F,Xe="trailing"in g?!!g.trailing:Xe);function st(Hn){var Ia=_,$o=k;return _=k=n,Ae=Hn,z=l.apply($o,Ia),z}function bt(Hn){return Ae=Hn,Y=Hc(Ot,d),xe?st(Hn):z}function Ct(Hn){var Ia=Hn-ie,$o=Hn-Ae,gA=d-Ia;return Ie?Mr(gA,F-$o):gA}function yt(Hn){var Ia=Hn-ie,$o=Hn-Ae;return ie===n||Ia>=d||Ia<0||Ie&&$o>=F}function Ot(){var Hn=t0();if(yt(Hn))return $t(Hn);Y=Hc(Ot,Ct(Hn))}function $t(Hn){return Y=n,Xe&&_?st(Hn):(_=k=n,z)}function Ii(){Y!==n&&ow(Y),Ae=0,_=ie=k=Y=n}function Zr(){return Y===n?z:$t(t0())}function Ri(){var Hn=t0(),Ia=yt(Hn);if(_=arguments,k=this,ie=Hn,Ia){if(Y===n)return bt(ie);if(Ie)return ow(Y),Y=Hc(Ot,d),st(ie)}return Y===n&&(Y=Hc(Ot,d)),z}return Ri.cancel=Ii,Ri.flush=Zr,Ri}var qj=Rt(function(l,d){return US(l,1,d)}),Kj=Rt(function(l,d,g){return US(l,na(d)||0,g)});function Yj(l){return Mo(l,V)}function n0(l,d){if(typeof l!="function"||d!=null&&typeof d!="function")throw new Qi(o);var g=function(){var _=arguments,k=d?d.apply(this,_):_[0],F=g.cache;if(F.has(k))return F.get(k);var z=l.apply(this,_);return g.cache=F.set(k,z)||F,z};return g.cache=new(n0.Cache||Do),g}n0.Cache=Do;function r0(l){if(typeof l!="function")throw new Qi(o);return function(){var d=arguments;switch(d.length){case 0:return!l.call(this);case 1:return!l.call(this,d[0]);case 2:return!l.call(this,d[0],d[1]);case 3:return!l.call(this,d[0],d[1],d[2])}return!l.apply(this,d)}}function Xj(l){return Ww(2,l)}var Qj=Pz(function(l,d){d=d.length==1&&Tt(d[0])?An(d[0],Ci(mt())):An(br(d,1),Ci(mt()));var g=d.length;return Rt(function(_){for(var k=-1,F=Mr(_.length,g);++k=d}),$l=GS(function(){return arguments}())?GS:function(l){return Mn(l)&&an.call(l,"callee")&&!RS.call(l,"callee")},Tt=fe.isArray,pG=dS?Ci(dS):vz;function ui(l){return l!=null&&i0(l.length)&&!Bo(l)}function zn(l){return Mn(l)&&ui(l)}function fG(l){return l===!0||l===!1||Mn(l)&&Xr(l)==te}var Rs=x$||r3,hG=pS?Ci(pS):_z;function gG(l){return Mn(l)&&l.nodeType===1&&!jc(l)}function mG(l){if(l==null)return!0;if(ui(l)&&(Tt(l)||typeof l=="string"||typeof l.splice=="function"||Rs(l)||Xu(l)||$l(l)))return!l.length;var d=Fr(l);if(d==ot||d==Ee)return!l.size;if(zc(l))return!_5(l).length;for(var g in l)if(an.call(l,g))return!1;return!0}function bG(l,d){return Bc(l,d)}function yG(l,d,g){g=typeof g=="function"?g:n;var _=g?g(l,d):n;return _===n?Bc(l,d,n,g):!!_}function q5(l){if(!Mn(l))return!1;var d=Xr(l);return d==Qe||d==Re||typeof l.message=="string"&&typeof l.name=="string"&&!jc(l)}function EG(l){return typeof l=="number"&&OS(l)}function Bo(l){if(!Rn(l))return!1;var d=Xr(l);return d==Ve||d==dt||d==we||d==de}function Zw(l){return typeof l=="number"&&l==wt(l)}function i0(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=le}function Rn(l){var d=typeof l;return l!=null&&(d=="object"||d=="function")}function Mn(l){return l!=null&&typeof l=="object"}var Jw=fS?Ci(fS):Sz;function vG(l,d){return l===d||v5(l,d,P5(d))}function _G(l,d,g){return g=typeof g=="function"?g:n,v5(l,d,P5(d),g)}function TG(l){return eA(l)&&l!=+l}function SG(l){if(oH(l))throw new _t(a);return VS(l)}function wG(l){return l===null}function AG(l){return l==null}function eA(l){return typeof l=="number"||Mn(l)&&Xr(l)==Ge}function jc(l){if(!Mn(l)||Xr(l)!=U)return!1;var d=Nf(l);if(d===null)return!0;var g=an.call(d,"constructor")&&d.constructor;return typeof g=="function"&&g instanceof g&&xf.call(g)==_$}var K5=hS?Ci(hS):wz;function CG(l){return Zw(l)&&l>=-le&&l<=le}var tA=gS?Ci(gS):Az;function a0(l){return typeof l=="string"||!Tt(l)&&Mn(l)&&Xr(l)==Se}function ki(l){return typeof l=="symbol"||Mn(l)&&Xr(l)==De}var Xu=mS?Ci(mS):Cz;function xG(l){return l===n}function kG(l){return Mn(l)&&Fr(l)==Ye}function IG(l){return Mn(l)&&Xr(l)==Gt}var RG=Yf(T5),NG=Yf(function(l,d){return l<=d});function nA(l){if(!l)return[];if(ui(l))return a0(l)?Ca(l):li(l);if(Rc&&l[Rc])return u$(l[Rc]());var d=Fr(l),g=d==ot?u5:d==Ee?wf:Qu;return g(l)}function Uo(l){if(!l)return l===0?l:0;if(l=na(l),l===se||l===-se){var d=l<0?-1:1;return d*he}return l===l?l:0}function wt(l){var d=Uo(l),g=d%1;return d===d?g?d-g:d:0}function rA(l){return l?Fl(wt(l),0,X):0}function na(l){if(typeof l=="number")return l;if(ki(l))return I;if(Rn(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=Rn(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=TS(l);var g=Be.test(l);return g||un.test(l)?WU(l.slice(2),g?2:8):J.test(l)?I:+l}function iA(l){return ro(l,ci(l))}function OG(l){return l?Fl(wt(l),-le,le):l===0?l:0}function en(l){return l==null?"":xi(l)}var DG=qu(function(l,d){if(zc(d)||ui(d)){ro(d,lr(d),l);return}for(var g in d)an.call(d,g)&&Mc(l,g,d[g])}),aA=qu(function(l,d){ro(d,ci(d),l)}),o0=qu(function(l,d,g,_){ro(d,ci(d),l,_)}),LG=qu(function(l,d,g,_){ro(d,lr(d),l,_)}),MG=Fo(g5);function FG(l,d){var g=Wu(l);return d==null?g:PS(g,d)}var PG=Rt(function(l,d){l=pn(l);var g=-1,_=d.length,k=_>2?d[2]:n;for(k&&Qr(d[0],d[1],k)&&(_=1);++g<_;)for(var F=d[g],z=ci(F),Y=-1,ie=z.length;++Y1),F}),ro(l,M5(l),g),_&&(g=Ji(g,f|m|h,Kz));for(var k=d.length;k--;)x5(g,d[k]);return g});function tV(l,d){return sA(l,r0(mt(d)))}var nV=Fo(function(l,d){return l==null?{}:Iz(l,d)});function sA(l,d){if(l==null)return{};var g=An(M5(l),function(_){return[_]});return d=mt(d),ZS(l,g,function(_,k){return d(_,k[0])})}function rV(l,d,g){d=ks(d,l);var _=-1,k=d.length;for(k||(k=1,l=n);++_d){var _=l;l=d,d=_}if(g||l%1||d%1){var k=DS();return Mr(l+k*(d-l+VU("1e-"+((k+"").length-1))),d)}return w5(l,d)}var hV=Ku(function(l,d,g){return d=d.toLowerCase(),l+(g?cA(d):d)});function cA(l){return Q5(en(l).toLowerCase())}function dA(l){return l=en(l),l&&l.replace(sr,i$).replace(MU,"")}function gV(l,d,g){l=en(l),d=xi(d);var _=l.length;g=g===n?_:Fl(wt(g),0,_);var k=g;return g-=d.length,g>=0&&l.slice(g,k)==d}function mV(l){return l=en(l),l&&Zt.test(l)?l.replace(Je,a$):l}function bV(l){return l=en(l),l&&si.test(l)?l.replace(Aa,"\\$&"):l}var yV=Ku(function(l,d,g){return l+(g?"-":"")+d.toLowerCase()}),EV=Ku(function(l,d,g){return l+(g?" ":"")+d.toLowerCase()}),vV=hw("toLowerCase");function _V(l,d,g){l=en(l),d=wt(d);var _=d?zu(l):0;if(!d||_>=d)return l;var k=(d-_)/2;return Kf(Mf(k),g)+l+Kf(Lf(k),g)}function TV(l,d,g){l=en(l),d=wt(d);var _=d?zu(l):0;return d&&_>>0,g?(l=en(l),l&&(typeof d=="string"||d!=null&&!K5(d))&&(d=xi(d),!d&&$u(l))?Is(Ca(l),0,g):l.split(d,g)):[]}var IV=Ku(function(l,d,g){return l+(g?" ":"")+Q5(d)});function RV(l,d,g){return l=en(l),g=g==null?0:Fl(wt(g),0,l.length),d=xi(d),l.slice(g,g+d.length)==d}function NV(l,d,g){var _=M.templateSettings;g&&Qr(l,d,g)&&(d=n),l=en(l),d=o0({},d,_,_w);var k=o0({},d.imports,_.imports,_w),F=lr(k),z=l5(k,F),Y,ie,Ae=0,xe=d.interpolate||Qn,Ie="__p += '",Xe=c5((d.escape||Qn).source+"|"+xe.source+"|"+(xe===Xt?Nl:Qn).source+"|"+(d.evaluate||Qn).source+"|$","g"),st="//# sourceURL="+(an.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$U+"]")+` +`)}function rH(l){return Tt(l)||$l(l)||!!(NS&&l&&l[NS])}function Po(l,d){var g=typeof l;return d=d??le,!!d&&(g=="number"||g!="symbol"&&or.test(l))&&l>-1&&l%1==0&&l0){if(++d>=$)return arguments[0]}else d=0;return l.apply(n,arguments)}}function Zf(l,d){var g=-1,_=l.length,k=_-1;for(d=d===n?_:d;++g1?l[d-1]:n;return g=typeof g=="function"?(l.pop(),g):n,zw(l,g)});function Hw(l){var d=M(l);return d.__chain__=!0,d}function hj(l,d){return d(l),l}function Jf(l,d){return d(l)}var gj=Fo(function(l){var d=l.length,g=d?l[0]:0,_=this.__wrapped__,k=function(F){return g5(F,l)};return d>1||this.__actions__.length||!(_ instanceof Pt)||!Po(g)?this.thru(k):(_=_.slice(g,+g+(d?1:0)),_.__actions__.push({func:Jf,args:[k],thisArg:n}),new Zi(_,this.__chain__).thru(function(F){return d&&!F.length&&F.push(n),F}))});function mj(){return Hw(this)}function bj(){return new Zi(this.value(),this.__chain__)}function yj(){this.__values__===n&&(this.__values__=nA(this.value()));var l=this.__index__>=this.__values__.length,d=l?n:this.__values__[this.__index__++];return{done:l,value:d}}function Ej(){return this}function vj(l){for(var d,g=this;g instanceof Bf;){var _=Mw(g);_.__index__=0,_.__values__=n,d?k.__wrapped__=_:d=_;var k=_;g=g.__wrapped__}return k.__wrapped__=l,d}function _j(){var l=this.__wrapped__;if(l instanceof Pt){var d=l;return this.__actions__.length&&(d=new Pt(this)),d=d.reverse(),d.__actions__.push({func:Jf,args:[j5],thisArg:n}),new Zi(d,this.__chain__)}return this.thru(j5)}function Tj(){return iw(this.__wrapped__,this.__actions__)}var Sj=Vf(function(l,d,g){an.call(l,g)?++l[g]:Lo(l,g,1)});function wj(l,d,g){var _=Tt(l)?bS:hz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}function Aj(l,d){var g=Tt(l)?Ts:zS;return g(l,mt(d,3))}var Cj=gw(Fw),xj=gw(Pw);function kj(l,d){return br(e0(l,d),1)}function Ij(l,d){return br(e0(l,d),se)}function Rj(l,d,g){return g=g===n?1:St(g),br(e0(l,d),g)}function jw(l,d){var g=Tt(l)?Xi:Cs;return g(l,mt(d,3))}function Gw(l,d){var g=Tt(l)?YU:$S;return g(l,mt(d,3))}var Nj=Vf(function(l,d,g){an.call(l,g)?l[g].push(d):Lo(l,g,[d])});function Oj(l,d,g,_){l=ui(l)?l:Qu(l),g=g&&!_?St(g):0;var k=l.length;return g<0&&(g=Jn(k+g,0)),a0(l)?g<=k&&l.indexOf(d,g)>-1:!!k&&Uu(l,d,g)>-1}var Dj=Rt(function(l,d,g){var _=-1,k=typeof d=="function",F=ui(l)?fe(l.length):[];return Cs(l,function(z){F[++_]=k?Ai(d,z,g):Pc(z,d,g)}),F}),Lj=Vf(function(l,d,g){Lo(l,g,d)});function e0(l,d){var g=Tt(l)?An:qS;return g(l,mt(d,3))}function Mj(l,d,g,_){return l==null?[]:(Tt(d)||(d=d==null?[]:[d]),g=_?n:g,Tt(g)||(g=g==null?[]:[g]),QS(l,d,g))}var Fj=Vf(function(l,d,g){l[g?0:1].push(d)},function(){return[[],[]]});function Pj(l,d,g){var _=Tt(l)?n5:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,Cs)}function Bj(l,d,g){var _=Tt(l)?XU:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,$S)}function Uj(l,d){var g=Tt(l)?Ts:zS;return g(l,r0(mt(d,3)))}function $j(l){var d=Tt(l)?FS:Oz;return d(l)}function zj(l,d,g){(g?Qr(l,d,g):d===n)?d=1:d=St(d);var _=Tt(l)?uz:Dz;return _(l,d)}function Hj(l){var d=Tt(l)?cz:Mz;return d(l)}function jj(l){if(l==null)return 0;if(ui(l))return a0(l)?zu(l):l.length;var d=Fr(l);return d==ot||d==Ee?l.size:_5(l).length}function Gj(l,d,g){var _=Tt(l)?r5:Fz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}var Vj=Rt(function(l,d){if(l==null)return[];var g=d.length;return g>1&&Qr(l,d[0],d[1])?d=[]:g>2&&Qr(d[0],d[1],d[2])&&(d=[d[0]]),QS(l,br(d,1),[])}),t0=A$||function(){return mr.Date.now()};function Wj(l,d){if(typeof d!="function")throw new Qi(o);return l=St(l),function(){if(--l<1)return d.apply(this,arguments)}}function Vw(l,d,g){return d=g?n:d,d=l&&d==null?l.length:d,Mo(l,D,n,n,n,n,d)}function Ww(l,d){var g;if(typeof d!="function")throw new Qi(o);return l=St(l),function(){return--l>0&&(g=d.apply(this,arguments)),l<=1&&(d=n),g}}var V5=Rt(function(l,d,g){var _=T;if(g.length){var k=ws(g,Yu(V5));_|=N}return Mo(l,_,d,g,k)}),qw=Rt(function(l,d,g){var _=T|E;if(g.length){var k=ws(g,Yu(qw));_|=N}return Mo(d,_,l,g,k)});function Kw(l,d,g){d=g?n:d;var _=Mo(l,w,n,n,n,n,n,d);return _.placeholder=Kw.placeholder,_}function Yw(l,d,g){d=g?n:d;var _=Mo(l,A,n,n,n,n,n,d);return _.placeholder=Yw.placeholder,_}function Xw(l,d,g){var _,k,F,z,Y,ie,Ae=0,xe=!1,Ie=!1,Xe=!0;if(typeof l!="function")throw new Qi(o);d=na(d)||0,Rn(g)&&(xe=!!g.leading,Ie="maxWait"in g,F=Ie?Jn(na(g.maxWait)||0,d):F,Xe="trailing"in g?!!g.trailing:Xe);function st(Hn){var Ia=_,$o=k;return _=k=n,Ae=Hn,z=l.apply($o,Ia),z}function bt(Hn){return Ae=Hn,Y=Hc(Ot,d),xe?st(Hn):z}function Ct(Hn){var Ia=Hn-ie,$o=Hn-Ae,gA=d-Ia;return Ie?Mr(gA,F-$o):gA}function yt(Hn){var Ia=Hn-ie,$o=Hn-Ae;return ie===n||Ia>=d||Ia<0||Ie&&$o>=F}function Ot(){var Hn=t0();if(yt(Hn))return $t(Hn);Y=Hc(Ot,Ct(Hn))}function $t(Hn){return Y=n,Xe&&_?st(Hn):(_=k=n,z)}function Ii(){Y!==n&&ow(Y),Ae=0,_=ie=k=Y=n}function Zr(){return Y===n?z:$t(t0())}function Ri(){var Hn=t0(),Ia=yt(Hn);if(_=arguments,k=this,ie=Hn,Ia){if(Y===n)return bt(ie);if(Ie)return ow(Y),Y=Hc(Ot,d),st(ie)}return Y===n&&(Y=Hc(Ot,d)),z}return Ri.cancel=Ii,Ri.flush=Zr,Ri}var qj=Rt(function(l,d){return US(l,1,d)}),Kj=Rt(function(l,d,g){return US(l,na(d)||0,g)});function Yj(l){return Mo(l,V)}function n0(l,d){if(typeof l!="function"||d!=null&&typeof d!="function")throw new Qi(o);var g=function(){var _=arguments,k=d?d.apply(this,_):_[0],F=g.cache;if(F.has(k))return F.get(k);var z=l.apply(this,_);return g.cache=F.set(k,z)||F,z};return g.cache=new(n0.Cache||Do),g}n0.Cache=Do;function r0(l){if(typeof l!="function")throw new Qi(o);return function(){var d=arguments;switch(d.length){case 0:return!l.call(this);case 1:return!l.call(this,d[0]);case 2:return!l.call(this,d[0],d[1]);case 3:return!l.call(this,d[0],d[1],d[2])}return!l.apply(this,d)}}function Xj(l){return Ww(2,l)}var Qj=Pz(function(l,d){d=d.length==1&&Tt(d[0])?An(d[0],Ci(mt())):An(br(d,1),Ci(mt()));var g=d.length;return Rt(function(_){for(var k=-1,F=Mr(_.length,g);++k=d}),$l=GS(function(){return arguments}())?GS:function(l){return Mn(l)&&an.call(l,"callee")&&!RS.call(l,"callee")},Tt=fe.isArray,pG=dS?Ci(dS):vz;function ui(l){return l!=null&&i0(l.length)&&!Bo(l)}function zn(l){return Mn(l)&&ui(l)}function fG(l){return l===!0||l===!1||Mn(l)&&Xr(l)==te}var Rs=x$||r3,hG=pS?Ci(pS):_z;function gG(l){return Mn(l)&&l.nodeType===1&&!jc(l)}function mG(l){if(l==null)return!0;if(ui(l)&&(Tt(l)||typeof l=="string"||typeof l.splice=="function"||Rs(l)||Xu(l)||$l(l)))return!l.length;var d=Fr(l);if(d==ot||d==Ee)return!l.size;if(zc(l))return!_5(l).length;for(var g in l)if(an.call(l,g))return!1;return!0}function bG(l,d){return Bc(l,d)}function yG(l,d,g){g=typeof g=="function"?g:n;var _=g?g(l,d):n;return _===n?Bc(l,d,n,g):!!_}function q5(l){if(!Mn(l))return!1;var d=Xr(l);return d==Qe||d==Re||typeof l.message=="string"&&typeof l.name=="string"&&!jc(l)}function EG(l){return typeof l=="number"&&OS(l)}function Bo(l){if(!Rn(l))return!1;var d=Xr(l);return d==Ve||d==dt||d==we||d==de}function Zw(l){return typeof l=="number"&&l==St(l)}function i0(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=le}function Rn(l){var d=typeof l;return l!=null&&(d=="object"||d=="function")}function Mn(l){return l!=null&&typeof l=="object"}var Jw=fS?Ci(fS):Sz;function vG(l,d){return l===d||v5(l,d,P5(d))}function _G(l,d,g){return g=typeof g=="function"?g:n,v5(l,d,P5(d),g)}function TG(l){return eA(l)&&l!=+l}function SG(l){if(oH(l))throw new _t(a);return VS(l)}function wG(l){return l===null}function AG(l){return l==null}function eA(l){return typeof l=="number"||Mn(l)&&Xr(l)==Ge}function jc(l){if(!Mn(l)||Xr(l)!=U)return!1;var d=Nf(l);if(d===null)return!0;var g=an.call(d,"constructor")&&d.constructor;return typeof g=="function"&&g instanceof g&&xf.call(g)==_$}var K5=hS?Ci(hS):wz;function CG(l){return Zw(l)&&l>=-le&&l<=le}var tA=gS?Ci(gS):Az;function a0(l){return typeof l=="string"||!Tt(l)&&Mn(l)&&Xr(l)==Se}function ki(l){return typeof l=="symbol"||Mn(l)&&Xr(l)==De}var Xu=mS?Ci(mS):Cz;function xG(l){return l===n}function kG(l){return Mn(l)&&Fr(l)==Ye}function IG(l){return Mn(l)&&Xr(l)==Gt}var RG=Yf(T5),NG=Yf(function(l,d){return l<=d});function nA(l){if(!l)return[];if(ui(l))return a0(l)?Ca(l):li(l);if(Rc&&l[Rc])return u$(l[Rc]());var d=Fr(l),g=d==ot?u5:d==Ee?wf:Qu;return g(l)}function Uo(l){if(!l)return l===0?l:0;if(l=na(l),l===se||l===-se){var d=l<0?-1:1;return d*he}return l===l?l:0}function St(l){var d=Uo(l),g=d%1;return d===d?g?d-g:d:0}function rA(l){return l?Fl(St(l),0,X):0}function na(l){if(typeof l=="number")return l;if(ki(l))return I;if(Rn(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=Rn(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=TS(l);var g=Be.test(l);return g||un.test(l)?WU(l.slice(2),g?2:8):J.test(l)?I:+l}function iA(l){return ro(l,ci(l))}function OG(l){return l?Fl(St(l),-le,le):l===0?l:0}function en(l){return l==null?"":xi(l)}var DG=qu(function(l,d){if(zc(d)||ui(d)){ro(d,lr(d),l);return}for(var g in d)an.call(d,g)&&Mc(l,g,d[g])}),aA=qu(function(l,d){ro(d,ci(d),l)}),o0=qu(function(l,d,g,_){ro(d,ci(d),l,_)}),LG=qu(function(l,d,g,_){ro(d,lr(d),l,_)}),MG=Fo(g5);function FG(l,d){var g=Wu(l);return d==null?g:PS(g,d)}var PG=Rt(function(l,d){l=pn(l);var g=-1,_=d.length,k=_>2?d[2]:n;for(k&&Qr(d[0],d[1],k)&&(_=1);++g<_;)for(var F=d[g],z=ci(F),Y=-1,ie=z.length;++Y1),F}),ro(l,M5(l),g),_&&(g=Ji(g,f|m|h,Kz));for(var k=d.length;k--;)x5(g,d[k]);return g});function tV(l,d){return sA(l,r0(mt(d)))}var nV=Fo(function(l,d){return l==null?{}:Iz(l,d)});function sA(l,d){if(l==null)return{};var g=An(M5(l),function(_){return[_]});return d=mt(d),ZS(l,g,function(_,k){return d(_,k[0])})}function rV(l,d,g){d=ks(d,l);var _=-1,k=d.length;for(k||(k=1,l=n);++_d){var _=l;l=d,d=_}if(g||l%1||d%1){var k=DS();return Mr(l+k*(d-l+VU("1e-"+((k+"").length-1))),d)}return w5(l,d)}var hV=Ku(function(l,d,g){return d=d.toLowerCase(),l+(g?cA(d):d)});function cA(l){return Q5(en(l).toLowerCase())}function dA(l){return l=en(l),l&&l.replace(sr,i$).replace(MU,"")}function gV(l,d,g){l=en(l),d=xi(d);var _=l.length;g=g===n?_:Fl(St(g),0,_);var k=g;return g-=d.length,g>=0&&l.slice(g,k)==d}function mV(l){return l=en(l),l&&Zt.test(l)?l.replace(Je,a$):l}function bV(l){return l=en(l),l&&si.test(l)?l.replace(Aa,"\\$&"):l}var yV=Ku(function(l,d,g){return l+(g?"-":"")+d.toLowerCase()}),EV=Ku(function(l,d,g){return l+(g?" ":"")+d.toLowerCase()}),vV=hw("toLowerCase");function _V(l,d,g){l=en(l),d=St(d);var _=d?zu(l):0;if(!d||_>=d)return l;var k=(d-_)/2;return Kf(Mf(k),g)+l+Kf(Lf(k),g)}function TV(l,d,g){l=en(l),d=St(d);var _=d?zu(l):0;return d&&_>>0,g?(l=en(l),l&&(typeof d=="string"||d!=null&&!K5(d))&&(d=xi(d),!d&&$u(l))?Is(Ca(l),0,g):l.split(d,g)):[]}var IV=Ku(function(l,d,g){return l+(g?" ":"")+Q5(d)});function RV(l,d,g){return l=en(l),g=g==null?0:Fl(St(g),0,l.length),d=xi(d),l.slice(g,g+d.length)==d}function NV(l,d,g){var _=M.templateSettings;g&&Qr(l,d,g)&&(d=n),l=en(l),d=o0({},d,_,_w);var k=o0({},d.imports,_.imports,_w),F=lr(k),z=l5(k,F),Y,ie,Ae=0,xe=d.interpolate||Qn,Ie="__p += '",Xe=c5((d.escape||Qn).source+"|"+xe.source+"|"+(xe===Xt?Nl:Qn).source+"|"+(d.evaluate||Qn).source+"|$","g"),st="//# sourceURL="+(an.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$U+"]")+` `;l.replace(Xe,function(yt,Ot,$t,Ii,Zr,Ri){return $t||($t=Ii),Ie+=l.slice(Ae,Ri).replace(No,o$),Ot&&(Y=!0,Ie+=`' + __e(`+Ot+`) + '`),Zr&&(ie=!0,Ie+=`'; @@ -1178,7 +1178,7 @@ __p += '`),$t&&(Ie+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ie+`return __p -}`;var Ct=fA(function(){return Jt(F,st+"return "+Ie).apply(n,z)});if(Ct.source=Ie,q5(Ct))throw Ct;return Ct}function OV(l){return en(l).toLowerCase()}function DV(l){return en(l).toUpperCase()}function LV(l,d,g){if(l=en(l),l&&(g||d===n))return TS(l);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=Ca(d),F=SS(_,k),z=wS(_,k)+1;return Is(_,F,z).join("")}function MV(l,d,g){if(l=en(l),l&&(g||d===n))return l.slice(0,CS(l)+1);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=wS(_,Ca(d))+1;return Is(_,0,k).join("")}function FV(l,d,g){if(l=en(l),l&&(g||d===n))return l.replace(Or,"");if(!l||!(d=xi(d)))return l;var _=Ca(l),k=SS(_,Ca(d));return Is(_,k).join("")}function PV(l,d){var g=P,_=Z;if(Rn(d)){var k="separator"in d?d.separator:k;g="length"in d?wt(d.length):g,_="omission"in d?xi(d.omission):_}l=en(l);var F=l.length;if($u(l)){var z=Ca(l);F=z.length}if(g>=F)return l;var Y=g-zu(_);if(Y<1)return _;var ie=z?Is(z,0,Y).join(""):l.slice(0,Y);if(k===n)return ie+_;if(z&&(Y+=ie.length-Y),K5(k)){if(l.slice(Y).search(k)){var Ae,xe=ie;for(k.global||(k=c5(k.source,en(Ke.exec(k))+"g")),k.lastIndex=0;Ae=k.exec(xe);)var Ie=Ae.index;ie=ie.slice(0,Ie===n?Y:Ie)}}else if(l.indexOf(xi(k),Y)!=Y){var Xe=ie.lastIndexOf(k);Xe>-1&&(ie=ie.slice(0,Xe))}return ie+_}function BV(l){return l=en(l),l&&Nt.test(l)?l.replace(rt,f$):l}var UV=Ku(function(l,d,g){return l+(g?" ":"")+d.toUpperCase()}),Q5=hw("toUpperCase");function pA(l,d,g){return l=en(l),d=g?n:d,d===n?l$(l)?m$(l):JU(l):l.match(d)||[]}var fA=Rt(function(l,d){try{return Ai(l,n,d)}catch(g){return q5(g)?g:new _t(g)}}),$V=Fo(function(l,d){return Xi(d,function(g){g=io(g),Lo(l,g,V5(l[g],l))}),l});function zV(l){var d=l==null?0:l.length,g=mt();return l=d?An(l,function(_){if(typeof _[1]!="function")throw new Qi(o);return[g(_[0]),_[1]]}):[],Rt(function(_){for(var k=-1;++kle)return[];var g=X,_=Mr(l,X);d=mt(d),l-=X;for(var k=s5(_,d);++g0||d<0)?new Pt(g):(l<0?g=g.takeRight(-l):l&&(g=g.drop(l)),d!==n&&(d=wt(d),g=d<0?g.dropRight(-d):g.take(d-l)),g)},Pt.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Pt.prototype.toArray=function(){return this.take(X)},no(Pt.prototype,function(l,d){var g=/^(?:filter|find|map|reject)|While$/.test(d),_=/^(?:head|last)$/.test(d),k=M[_?"take"+(d=="last"?"Right":""):d],F=_||/^find/.test(d);k&&(M.prototype[d]=function(){var z=this.__wrapped__,Y=_?[1]:arguments,ie=z instanceof Pt,Ae=Y[0],xe=ie||Tt(z),Ie=function(Ot){var $t=k.apply(M,Ss([Ot],Y));return _&&Xe?$t[0]:$t};xe&&g&&typeof Ae=="function"&&Ae.length!=1&&(ie=xe=!1);var Xe=this.__chain__,st=!!this.__actions__.length,bt=F&&!Xe,Ct=ie&&!st;if(!F&&xe){z=Ct?z:new Pt(this);var yt=l.apply(z,Y);return yt.__actions__.push({func:Jf,args:[Ie],thisArg:n}),new Zi(yt,Xe)}return bt&&Ct?l.apply(this,Y):(yt=this.thru(Ie),bt?_?yt.value()[0]:yt.value():yt)})}),Xi(["pop","push","shift","sort","splice","unshift"],function(l){var d=Af[l],g=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",_=/^(?:pop|shift)$/.test(l);M.prototype[l]=function(){var k=arguments;if(_&&!this.__chain__){var F=this.value();return d.apply(Tt(F)?F:[],k)}return this[g](function(z){return d.apply(Tt(z)?z:[],k)})}}),no(Pt.prototype,function(l,d){var g=M[d];if(g){var _=g.name+"";an.call(Vu,_)||(Vu[_]=[]),Vu[_].push({name:d,func:g})}}),Vu[Wf(n,E).name]=[{name:"wrapper",func:n}],Pt.prototype.clone=B$,Pt.prototype.reverse=U$,Pt.prototype.value=$$,M.prototype.at=gj,M.prototype.chain=mj,M.prototype.commit=bj,M.prototype.next=yj,M.prototype.plant=vj,M.prototype.reverse=_j,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=Tj,M.prototype.first=M.prototype.head,Rc&&(M.prototype[Rc]=Ej),M},Hu=b$();Ol?((Ol.exports=Hu)._=Hu,J2._=Hu):mr._=Hu}).call(eu)})(um,um.exports);var D4e=um.exports;const el=Vi(D4e);function lo(e,t){const n=el.cloneDeep(e);for(const r in t)typeof t[r]=="function"?el.updateWith(n,r,t[r]):el.updateWith(n,r,i=>t[r]);return n}const kc={};kc["Requires API Key"]="#FF0000";kc.Local="#00bb00";kc["Open-Source"]="#0033FF";kc.Free="#ffff00";const L4e={inputType:"number",key:"context_length",label:"Context Length",defaultValue:2048,required:!1},M4e={inputType:"number",key:"temperature",label:"Temperature",defaultValue:void 0,required:!1,min:0,max:1,step:.01},F4e={inputType:"number",key:"top_p",label:"Top-P",defaultValue:void 0,required:!1,min:0,max:1,step:.01},P4e={inputType:"number",key:"top_k",label:"Top-K",defaultValue:void 0,required:!1,min:0,max:1,step:.01},B4e={inputType:"number",key:"presence_penalty",label:"Presence Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},U4e={inputType:"number",key:"frequency_penalty",label:"Frequency Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},Da=[L4e,M4e,P4e,F4e,B4e,U4e],CN={inputType:"text",key:"server_url",label:"Server URL",placeholder:"e.g. http://localhost:8080",required:!1},uE={title:"CodeLlama Instruct",description:"A model from Meta, fine-tuned for code generation and conversation",refUrl:"",params:{title:"CodeLlama-7b-Instruct",model:"codellama:7b-instruct",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"codellama:7b-instruct",title:"CodeLlama-7b-Instruct"},"13b":{model:"codellama:13b-instruct",title:"CodeLlama-13b-Instruct"},"34b":{model:"codellama:34b-instruct",title:"CodeLlama-34b-Instruct"}}}]},cE={title:"Llama2 Chat",description:"The latest Llama model from Meta, fine-tuned for chat",refUrl:"",params:{title:"Llama2-7b-Chat",model:"llama2:7b-chat",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"llama2:7b-chat",title:"Llama2-7b-Chat"},"13b":{model:"llama2:13b-chat",title:"Llama2-13b-Chat"},"34b":{model:"llama2:34b-chat",title:"Llama2-34b-Chat"}}}]},dE={title:"WizardCoder",description:"A CodeLlama-based code generation model from WizardLM, focused on Python",refUrl:"",params:{title:"WizardCoder-7b-Python",model:"wizardcoder:7b-python",context_length:2048,template_messages:"template_alpaca_messages",prompt_templates:{edit:"alpaca_edit_prompt"}},icon:"wizardlm.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"wizardcoder:7b-python",title:"WizardCoder-7b-Python"},"13b":{model:"wizardcoder:13b-python",title:"WizardCoder-13b-Python"},"34b":{model:"wizardcoder:34b-python",title:"WizardCoder-34b-Python"}}}]},sU={title:"Phind CodeLlama (34b)",description:"A finetune of CodeLlama by Phind",params:{title:"Phind CodeLlama",model:"phind-codellama",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}}},pE={title:"Mistral (7b)",description:"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",params:{title:"Mistral",model:"mistral",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},icon:"mistral.png"},lU={title:"SQLCoder",description:"A finetune of StarCoder by Defog.ai, focused specifically on SQL",params:{title:"SQLCoder",model:"sqlcoder",context_length:2048,template_messages:"sqlcoder_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"sqlcoder:7b",title:"SQLCoder-7b"},"13b":{model:"sqlcoder:15b",title:"SQLCoder-15b"}}}]},$4e={title:"CodeUp (13b)",description:"An open-source coding model based on Llama2",params:{title:"CodeUp",model:"codeup",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"alpaca_edit_prompt"}}},o1=[uE,cE,dE,sU,lU,pE,$4e],xN={title:"GPT-4",description:"The latest model from OpenAI",params:{model:"gpt-4",context_length:8096,api_key:"",title:"GPT-4"}},kN={title:"GPT-3.5-Turbo",description:"A faster, cheaper OpenAI model with slightly lower capabilities",params:{model:"gpt-3.5-turbo",context_length:8096,title:"GPT-3.5-Turbo",api_key:""}},z4e={"codellama:7b-instruct":"meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e","codellama:13b-instruct":"meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7","codellama:34b-instruct":"meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e","llama2:7b-chat":"meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e","llama2:13b-chat":"meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d"};function IN(e){return z4e[e]||e}const uU={openai:{title:"OpenAI",class:"OpenAI",description:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",longDescription:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",icon:"openai.png",tags:["Requires API Key"],packages:[xN,kN],collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your OpenAI API key",required:!0},...Da]},anthropic:{title:"Anthropic",class:"AnthropicLLM",description:"Claude-2 is a highly capable model with a 100k context length",icon:"anthropic.png",tags:["Requires API Key"],longDescription:"To get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.",collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your Anthropic API key",required:!0},...Da],packages:[{title:"Claude-2",description:"A highly capable model with a 100k context length",params:{model:"claude-2",context_length:1e5,title:"Claude-2"}}]},ollama:{title:"Ollama",class:"Ollama",description:"One of the fastest ways to get started with local models on Mac or Linux",longDescription:'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',icon:"ollama.png",tags:["Local","Open-Source"],packages:o1,collectInputFor:[...Da]},together:{title:"TogetherAI",class:"TogetherLLM",description:"Use the TogetherAI API for extremely fast streaming of open-source models",icon:"together.png",longDescription:`Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together: +}`;var Ct=fA(function(){return Jt(F,st+"return "+Ie).apply(n,z)});if(Ct.source=Ie,q5(Ct))throw Ct;return Ct}function OV(l){return en(l).toLowerCase()}function DV(l){return en(l).toUpperCase()}function LV(l,d,g){if(l=en(l),l&&(g||d===n))return TS(l);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=Ca(d),F=SS(_,k),z=wS(_,k)+1;return Is(_,F,z).join("")}function MV(l,d,g){if(l=en(l),l&&(g||d===n))return l.slice(0,CS(l)+1);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=wS(_,Ca(d))+1;return Is(_,0,k).join("")}function FV(l,d,g){if(l=en(l),l&&(g||d===n))return l.replace(Or,"");if(!l||!(d=xi(d)))return l;var _=Ca(l),k=SS(_,Ca(d));return Is(_,k).join("")}function PV(l,d){var g=P,_=Z;if(Rn(d)){var k="separator"in d?d.separator:k;g="length"in d?St(d.length):g,_="omission"in d?xi(d.omission):_}l=en(l);var F=l.length;if($u(l)){var z=Ca(l);F=z.length}if(g>=F)return l;var Y=g-zu(_);if(Y<1)return _;var ie=z?Is(z,0,Y).join(""):l.slice(0,Y);if(k===n)return ie+_;if(z&&(Y+=ie.length-Y),K5(k)){if(l.slice(Y).search(k)){var Ae,xe=ie;for(k.global||(k=c5(k.source,en(Ke.exec(k))+"g")),k.lastIndex=0;Ae=k.exec(xe);)var Ie=Ae.index;ie=ie.slice(0,Ie===n?Y:Ie)}}else if(l.indexOf(xi(k),Y)!=Y){var Xe=ie.lastIndexOf(k);Xe>-1&&(ie=ie.slice(0,Xe))}return ie+_}function BV(l){return l=en(l),l&&Nt.test(l)?l.replace(rt,f$):l}var UV=Ku(function(l,d,g){return l+(g?" ":"")+d.toUpperCase()}),Q5=hw("toUpperCase");function pA(l,d,g){return l=en(l),d=g?n:d,d===n?l$(l)?m$(l):JU(l):l.match(d)||[]}var fA=Rt(function(l,d){try{return Ai(l,n,d)}catch(g){return q5(g)?g:new _t(g)}}),$V=Fo(function(l,d){return Xi(d,function(g){g=io(g),Lo(l,g,V5(l[g],l))}),l});function zV(l){var d=l==null?0:l.length,g=mt();return l=d?An(l,function(_){if(typeof _[1]!="function")throw new Qi(o);return[g(_[0]),_[1]]}):[],Rt(function(_){for(var k=-1;++kle)return[];var g=X,_=Mr(l,X);d=mt(d),l-=X;for(var k=s5(_,d);++g0||d<0)?new Pt(g):(l<0?g=g.takeRight(-l):l&&(g=g.drop(l)),d!==n&&(d=St(d),g=d<0?g.dropRight(-d):g.take(d-l)),g)},Pt.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Pt.prototype.toArray=function(){return this.take(X)},no(Pt.prototype,function(l,d){var g=/^(?:filter|find|map|reject)|While$/.test(d),_=/^(?:head|last)$/.test(d),k=M[_?"take"+(d=="last"?"Right":""):d],F=_||/^find/.test(d);k&&(M.prototype[d]=function(){var z=this.__wrapped__,Y=_?[1]:arguments,ie=z instanceof Pt,Ae=Y[0],xe=ie||Tt(z),Ie=function(Ot){var $t=k.apply(M,Ss([Ot],Y));return _&&Xe?$t[0]:$t};xe&&g&&typeof Ae=="function"&&Ae.length!=1&&(ie=xe=!1);var Xe=this.__chain__,st=!!this.__actions__.length,bt=F&&!Xe,Ct=ie&&!st;if(!F&&xe){z=Ct?z:new Pt(this);var yt=l.apply(z,Y);return yt.__actions__.push({func:Jf,args:[Ie],thisArg:n}),new Zi(yt,Xe)}return bt&&Ct?l.apply(this,Y):(yt=this.thru(Ie),bt?_?yt.value()[0]:yt.value():yt)})}),Xi(["pop","push","shift","sort","splice","unshift"],function(l){var d=Af[l],g=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",_=/^(?:pop|shift)$/.test(l);M.prototype[l]=function(){var k=arguments;if(_&&!this.__chain__){var F=this.value();return d.apply(Tt(F)?F:[],k)}return this[g](function(z){return d.apply(Tt(z)?z:[],k)})}}),no(Pt.prototype,function(l,d){var g=M[d];if(g){var _=g.name+"";an.call(Vu,_)||(Vu[_]=[]),Vu[_].push({name:d,func:g})}}),Vu[Wf(n,E).name]=[{name:"wrapper",func:n}],Pt.prototype.clone=B$,Pt.prototype.reverse=U$,Pt.prototype.value=$$,M.prototype.at=gj,M.prototype.chain=mj,M.prototype.commit=bj,M.prototype.next=yj,M.prototype.plant=vj,M.prototype.reverse=_j,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=Tj,M.prototype.first=M.prototype.head,Rc&&(M.prototype[Rc]=Ej),M},Hu=b$();Ol?((Ol.exports=Hu)._=Hu,J2._=Hu):mr._=Hu}).call(eu)})(um,um.exports);var D4e=um.exports;const el=Vi(D4e);function lo(e,t){const n=el.cloneDeep(e);for(const r in t)typeof t[r]=="function"?el.updateWith(n,r,t[r]):el.updateWith(n,r,i=>t[r]);return n}const kc={};kc["Requires API Key"]="#FF0000";kc.Local="#00bb00";kc["Open-Source"]="#0033FF";kc.Free="#ffff00";const L4e={inputType:"number",key:"context_length",label:"Context Length",defaultValue:2048,required:!1},M4e={inputType:"number",key:"temperature",label:"Temperature",defaultValue:void 0,required:!1,min:0,max:1,step:.01},F4e={inputType:"number",key:"top_p",label:"Top-P",defaultValue:void 0,required:!1,min:0,max:1,step:.01},P4e={inputType:"number",key:"top_k",label:"Top-K",defaultValue:void 0,required:!1,min:0,max:1,step:.01},B4e={inputType:"number",key:"presence_penalty",label:"Presence Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},U4e={inputType:"number",key:"frequency_penalty",label:"Frequency Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},Da=[L4e,M4e,P4e,F4e,B4e,U4e],CN={inputType:"text",key:"server_url",label:"Server URL",placeholder:"e.g. http://localhost:8080",required:!1},uE={title:"CodeLlama Instruct",description:"A model from Meta, fine-tuned for code generation and conversation",refUrl:"",params:{title:"CodeLlama-7b-Instruct",model:"codellama:7b-instruct",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"codellama:7b-instruct",title:"CodeLlama-7b-Instruct"},"13b":{model:"codellama:13b-instruct",title:"CodeLlama-13b-Instruct"},"34b":{model:"codellama:34b-instruct",title:"CodeLlama-34b-Instruct"}}}]},cE={title:"Llama2 Chat",description:"The latest Llama model from Meta, fine-tuned for chat",refUrl:"",params:{title:"Llama2-7b-Chat",model:"llama2:7b-chat",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"llama2:7b-chat",title:"Llama2-7b-Chat"},"13b":{model:"llama2:13b-chat",title:"Llama2-13b-Chat"},"34b":{model:"llama2:34b-chat",title:"Llama2-34b-Chat"}}}]},dE={title:"WizardCoder",description:"A CodeLlama-based code generation model from WizardLM, focused on Python",refUrl:"",params:{title:"WizardCoder-7b-Python",model:"wizardcoder:7b-python",context_length:2048,template_messages:"template_alpaca_messages",prompt_templates:{edit:"alpaca_edit_prompt"}},icon:"wizardlm.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"wizardcoder:7b-python",title:"WizardCoder-7b-Python"},"13b":{model:"wizardcoder:13b-python",title:"WizardCoder-13b-Python"},"34b":{model:"wizardcoder:34b-python",title:"WizardCoder-34b-Python"}}}]},sU={title:"Phind CodeLlama (34b)",description:"A finetune of CodeLlama by Phind",params:{title:"Phind CodeLlama",model:"phind-codellama",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}}},pE={title:"Mistral (7b)",description:"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",params:{title:"Mistral",model:"mistral",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},icon:"mistral.png"},lU={title:"SQLCoder",description:"A finetune of StarCoder by Defog.ai, focused specifically on SQL",params:{title:"SQLCoder",model:"sqlcoder",context_length:2048,template_messages:"sqlcoder_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"sqlcoder:7b",title:"SQLCoder-7b"},"13b":{model:"sqlcoder:15b",title:"SQLCoder-15b"}}}]},$4e={title:"CodeUp (13b)",description:"An open-source coding model based on Llama2",params:{title:"CodeUp",model:"codeup",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"alpaca_edit_prompt"}}},o1=[uE,cE,dE,sU,lU,pE,$4e],xN={title:"GPT-4",description:"The latest model from OpenAI",params:{model:"gpt-4",context_length:8096,api_key:"",title:"GPT-4"}},kN={title:"GPT-3.5-Turbo",description:"A faster, cheaper OpenAI model with slightly lower capabilities",params:{model:"gpt-3.5-turbo",context_length:8096,title:"GPT-3.5-Turbo",api_key:""}},z4e={"codellama:7b-instruct":"meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e","codellama:13b-instruct":"meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7","codellama:34b-instruct":"meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e","llama2:7b-chat":"meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e","llama2:13b-chat":"meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d"};function IN(e){return z4e[e]||e}const uU={openai:{title:"OpenAI",class:"OpenAI",description:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",longDescription:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",icon:"openai.png",tags:["Requires API Key"],packages:[xN,kN],collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your OpenAI API key",required:!0},...Da]},anthropic:{title:"Anthropic",class:"AnthropicLLM",description:"Claude-2 is a highly capable model with a 100k context length",icon:"anthropic.png",tags:["Requires API Key"],longDescription:"To get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.",collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your Anthropic API key",required:!0},...Da],packages:[{title:"Claude-2",description:"A highly capable model with a 100k context length",params:{model:"claude-2",context_length:1e5,title:"Claude-2"}}]},ollama:{title:"Ollama",class:"Ollama",description:"One of the fastest ways to get started with local models on Mac or Linux",longDescription:'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',icon:"ollama.png",tags:["Local","Open-Source"],packages:o1,collectInputFor:[...Da]},together:{title:"TogetherAI",class:"TogetherLLM",description:"Use the TogetherAI API for extremely fast streaming of open-source models",icon:"together.png",longDescription:`Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together: 1. Obtain an API key from [here](https://together.ai) 2. Paste below 3. Select a model preset`,tags:["Requires API Key","Open-Source"],params:{api_key:""},collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your TogetherAI API key",required:!0},...Da],packages:[lo(cE,{"dimensions[0].options":e=>el.mapValues(e,t=>el.assign({},t,{model:"togethercomputer/"+t.model.replace("llama2","llama-2").replace(":","-")}))}),lo(uE,{"dimensions[0].options":e=>el.mapValues(e,t=>el.assign({},t,{model:"togethercomputer/"+t.model.replace("codellama","CodeLlama").replace(":","-").replace("instruct","Instruct")}))}),lo(dE,{"params.model":"WizardLM/WizardCoder-15B-V1.0","params.title":"WizardCoder-15b","dimensions[0].options":{"15b":{model:"WizardLM/WizardCoder-15B-V1.0",title:"WizardCoder-15b"},"34b (Python)":{model:"WizardLM/WizardCoder-Python-34B-V1.0",title:"WizardCoder-34b-Python"}}}),lo(sU,{"params.model":"Phind/Phind-CodeLlama-34B-Python-v1"}),lo(pE,{"params.model":"mistralai/Mistral-7B-Instruct-v0.1"})].map(e=>(e.params.context_length=4096,e))},lmstudio:{title:"LM Studio",class:"GGML",description:"One of the fastest ways to get started with local models on Mac or Windows",longDescription:`LMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started: @@ -1234,7 +1234,7 @@ function print() { __p += __j.call(arguments, '') } cursor: pointer; outline: 1px solid ${ha}; } -`;function cU(e){var o,s,u,c;const t=St(p=>p.config.vscMediaUrl),[n,r]=C.useState(((o=e.dimensions)==null?void 0:o.map(p=>Object.keys(p.options)[0]))||[]),[i,a]=C.useState(!1);return R.jsxs(H4e,{disabled:e.disabled||!1,color:ha,hovered:i,children:[R.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:"px-2 py-1",onClick:e.disabled?void 0:p=>{p.target.closest("a")||e.onClick(p,n)},children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[t&&e.icon&&R.jsx("img",{src:`${t}/logos/${e.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h3",{children:e.title})]}),(s=e.tags)==null?void 0:s.map(p=>R.jsx("span",{style:{backgroundColor:`${kc[p]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:p})),R.jsx("p",{children:e.description}),e.refUrl&&R.jsx("a",{style:{position:"absolute",right:"8px",top:"8px"},href:e.refUrl,target:"_blank",children:R.jsx(Ti,{text:"Read the docs",children:R.jsx(sQ,{width:"1.6em",height:"1.6em"})})})]}),((u=e.dimensions)==null?void 0:u.length)&&R.jsx(j4e,{children:(c=e.dimensions)==null?void 0:c.map((p,f)=>R.jsxs("div",{className:"flex items-center",children:[R.jsx(sE,{msg:p.description}),R.jsx("p",{className:"mx-2 text-sm my-0 py-0",children:p.name}),Object.keys(p.options).map(m=>R.jsx(G4e,{onClick:h=>{h.stopPropagation();const b=[...n];b[f]=m,r(b)},selected:n[f]===m,children:m}))]}))})]})}const V4e=He.div` +`;function cU(e){var o,s,u,c;const t=wt(p=>p.config.vscMediaUrl),[n,r]=C.useState(((o=e.dimensions)==null?void 0:o.map(p=>Object.keys(p.options)[0]))||[]),[i,a]=C.useState(!1);return R.jsxs(H4e,{disabled:e.disabled||!1,color:ha,hovered:i,children:[R.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:"px-2 py-1",onClick:e.disabled?void 0:p=>{p.target.closest("a")||e.onClick(p,n)},children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[t&&e.icon&&R.jsx("img",{src:`${t}/logos/${e.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h3",{children:e.title})]}),(s=e.tags)==null?void 0:s.map(p=>R.jsx("span",{style:{backgroundColor:`${kc[p]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:p})),R.jsx("p",{children:e.description}),e.refUrl&&R.jsx("a",{style:{position:"absolute",right:"8px",top:"8px"},href:e.refUrl,target:"_blank",children:R.jsx(Ti,{text:"Read the docs",children:R.jsx(sQ,{width:"1.6em",height:"1.6em"})})})]}),((u=e.dimensions)==null?void 0:u.length)&&R.jsx(j4e,{children:(c=e.dimensions)==null?void 0:c.map((p,f)=>R.jsxs("div",{className:"flex items-center",children:[R.jsx(sE,{msg:p.description}),R.jsx("p",{className:"mx-2 text-sm my-0 py-0",children:p.name}),Object.keys(p.options).map(m=>R.jsx(G4e,{onClick:h=>{h.stopPropagation();const b=[...n];b[f]=m,r(b)},selected:n[f]===m,children:m}))]}))})]})}const V4e=He.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-gap: 2rem; @@ -1267,4 +1267,4 @@ function print() { __p += __j.call(arguments, '') } cursor: pointer; } `} -`;function Y4e(){var u,c,p,f,m;const e=oU(),{modelName:t}=Vme(),[n,r]=C.useState(void 0);C.useEffect(()=>{t&&r(uU[t])},[t]);const i=C.useContext(eo);Io();const a=bs(),o=St(h=>h.config.vscMediaUrl),s=C.useCallback(()=>{var h;return((h=n==null?void 0:n.collectInputFor)==null?void 0:h.some(b=>{if(!b.required)return!1;const y=e.watch(b.key);return typeof y>"u"||typeof y=="string"&&y===""}))||!1},[n,e]);return R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex m-0 p-0 sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt,zIndex:2},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>a("/models"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Configure Model"})]}),R.jsxs("div",{className:"px-2",children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o&&(n==null?void 0:n.icon)&&R.jsx("img",{src:`${o}/logos/${n==null?void 0:n.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h2",{children:n==null?void 0:n.title})]}),(u=n==null?void 0:n.tags)==null?void 0:u.map(h=>R.jsx("span",{style:{backgroundColor:`${kc[h]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:h})),R.jsx(zg,{className:"mt-2",source:(n==null?void 0:n.longDescription)||(n==null?void 0:n.description),maxHeight:200}),R.jsx("br",{}),(((c=n==null?void 0:n.collectInputFor)==null?void 0:c.filter(h=>h.required).length)||0)>0&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{className:"mb-2",children:"Enter required parameters"}),(p=n==null?void 0:n.collectInputFor)==null?void 0:p.filter(h=>h.required).map(h=>R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!0})})]}))]}),(((f=n==null?void 0:n.collectInputFor)==null?void 0:f.filter(h=>!h.required).length)||0)>0&&R.jsxs("details",{children:[R.jsx("summary",{className:"mb-2",children:R.jsx("b",{children:"Advanced (optional)"})}),(m=n==null?void 0:n.collectInputFor)==null?void 0:m.map(h=>h.required?null:R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!1})})]}))]}),R.jsx("h3",{className:"mb-2",children:"Select a model preset"})]}),R.jsxs(q4e,{children:[n==null?void 0:n.packages.map(h=>R.jsx(cU,{disabled:s(),title:h.title,description:h.description,tags:h.tags,refUrl:h.refUrl,icon:h.icon||n.icon,dimensions:h.dimensions,onClick:(b,y)=>{var E;if(s())return;const T={};for(const v of n.collectInputFor||[])T[v.key]=v.inputType==="text"?e.watch(v.key):parseFloat(e.watch(v.key));i==null||i.addModelForRole("*",n.class,{...h.params,...n.params,...el.merge({},...((E=h.dimensions)==null?void 0:E.map((v,w)=>y!=null&&y[w]?{...v.options[y[w]]}:{}))||[]),...T}),a("/")}})),R.jsx(K4e,{disabled:s(),onClick:h=>{var y;if(!n||s())return;const b={};for(const T of n.collectInputFor||[])b[T.key]=T.inputType==="text"?e.watch(T.key):parseFloat(e.watch(T.key));i==null||i.addModelForRole("*",n.class,{...(y=n.packages[0])==null?void 0:y.params,...n.params,...b}),a("/")},children:R.jsx("h3",{className:"text-center my-2",children:"Configure Model in config.py"})})]})]})})}const bd=window,dU=pf({name:"config",initialState:{apiUrl:bd.serverUrl||"http://localhost:8000",vscMediaUrl:bd.vscMediaUrl||localStorage.getItem("vscMediaUrl")||void 0,workspacePaths:bd.workspacePaths||[],vscMachineId:bd.vscMachineId||void 0,windowId:bd.windowId||void 0},reducers:{setWorkspacePaths:(e,t)=>({...e,workspacePaths:t.payload}),setApiUrl:(e,t)=>({...e,apiUrl:t.payload}),setVscMachineId:(e,t)=>({...e,vscMachineId:t.payload}),setSessionId:(e,t)=>({...e,sessionId:t.payload}),setVscMediaUrl:(e,t)=>(localStorage.setItem("vscMediaUrl",t.payload),{...e,vscMediaUrl:t.payload}),setDataSwitchOn:(e,t)=>({...e,dataSwitchOn:t.payload})}}),{setVscMachineId:RN,setApiUrl:X4e,setWorkspacePaths:Q4e,setSessionId:eye,setVscMediaUrl:tye,setDataSwitchOn:nye}=dU.actions,Z4e=dU.reducer;function J4e(e,t){const n=St(u=>u.config.apiUrl),r=St(u=>u.sessionState.active),i=St(u=>u.sessionState.title),a=St(u=>u.sessionState.history),[o,s]=C.useState(!1);C.useEffect(()=>{t(Xd(!1)),qa("onLoad",{})},[]),C.useEffect(()=>{(async()=>{if(e&&!o&&!r&&i==="New Session"&&a.filter(u=>!u.hide).length>=2){s(!0);const u=await e.getSessionTitle(a);t(kP(u))}})()},[r,a,i,e,o]),C.useEffect(()=>{e&&(e.onSessionUpdate(u=>{t(b0e(u))}),e.onAddContextItem(u=>{t(CP(u))}),e.onConfigUpdate(u=>{t(LR(u))}),fetch(`${n}/slash_commands`).then(async u=>{const c=await u.json();t(qge(c))}),fetch(`${n}/context_providers`).then(async u=>{const c=await u.json();t(Wge(c))}),e.getConfig().then(u=>{t(LR(u))}))},[e]),C.useEffect(()=>{const u=c=>{switch(c.data.type){case"onLoad":window.windowId=c.data.windowId,window.serverUrl=c.data.serverUrl,window.workspacePaths=c.data.workspacePaths,window.vscMachineId=c.data.vscMachineId,window.vscMediaUrl=c.data.vscMediaUrl,t(X4e(c.data.serverUrl)),t(Q4e(c.data.workspacePaths)),t(RN(c.data.vscMachineId)),t(RN(c.data.vscMachineId));break;case"highlightedCode":t(y0e({rangeInFileWithContents:c.data.rangeInFileWithContents,edit:c.data.edit}));break;case"serverStatus":t(Z0e(c.data.message));break;case"stopSession":e==null||e.stopSession();break}};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[e]),C.useEffect(()=>{document.body.style.getPropertyValue("--vscode-editor-foreground")&&localStorage.setItem("--vscode-editor-foreground",document.body.style.getPropertyValue("--vscode-editor-foreground")),document.body.style.getPropertyValue("--vscode-editor-background")&&localStorage.setItem("--vscode-editor-background",document.body.style.getPropertyValue("--vscode-editor-background")),document.body.style.getPropertyValue("--vscode-list-hoverBackground")&&localStorage.setItem("--vscode-list-hoverBackground",document.body.style.getPropertyValue("--vscode-list-hoverBackground"))},[])}const ebe=l2e([{path:"/",element:R.jsx(d3e,{}),errorElement:R.jsx(o4e,{}),children:[{path:"/index.html",element:R.jsx(XR,{})},{path:"/",element:R.jsx(XR,{})},{path:"/history",element:R.jsx(A2e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/settings",element:R.jsx(O4e,{})},{path:"/models",element:R.jsx(W4e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/modelconfig/:modelName",element:R.jsx(Y4e,{})}]}]),eo=C.createContext(void 0);function tbe(){const e=a4e(!1),t=Io();return J4e(e,t),R.jsx(eo.Provider,{value:e,children:R.jsx(r2e,{router:ebe})})}var zT={},HT={};HT.__esModule=!0;HT.default=ibe;function Xh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xh=function(n){return typeof n}:Xh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Xh(e)}function J4(){}var nbe={getItem:J4,setItem:J4,removeItem:J4};function rbe(e){if((typeof self>"u"?"undefined":Xh(self))!=="object"||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch{return!1}return!0}function ibe(e){var t="".concat(e,"Storage");return rbe(t)?self[t]:nbe}zT.__esModule=!0;zT.default=sbe;var abe=obe(HT);function obe(e){return e&&e.__esModule?e:{default:e}}function sbe(e){var t=(0,abe.default)(e);return{getItem:function(r){return new Promise(function(i,a){i(t.getItem(r))})},setItem:function(r,i){return new Promise(function(a,o){a(t.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(t.removeItem(r))})}}}var pU=void 0,lbe=ube(zT);function ube(e){return e&&e.__esModule?e:{default:e}}var cbe=(0,lbe.default)("local");pU=cbe;var jT="persist:",fU="persist/FLUSH",GT="persist/REHYDRATE",hU="persist/PAUSE",gU="persist/PERSIST",mU="persist/PURGE",bU="persist/REGISTER",dbe=-1;function Qh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qh=function(n){return typeof n}:Qh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Qh(e)}function NN(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 pbe(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sbe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}var wbe=5e3;function Abe(e,t){var n=e.version!==void 0?e.version:dbe;e.debug;var r=e.stateReconciler===void 0?hbe:e.stateReconciler,i=e.getStoredState||bbe,a=e.timeout!==void 0?e.timeout:wbe,o=null,s=!1,u=!0,c=function(f){return f._persist.rehydrated&&o&&!u&&o.update(f),f};return function(p,f){var m=p||{},h=m._persist,b=Tbe(m,["_persist"]),y=b;if(f.type===gU){var T=!1,E=function(B,V){T||(f.rehydrate(e.key,B,V),T=!0)};if(a&&setTimeout(function(){!T&&E(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},a),u=!1,o||(o=gbe(e)),h)return Yo({},t(y,f),{_persist:h});if(typeof f.rehydrate!="function"||typeof f.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return f.register(e.key),i(e).then(function(D){var B=e.migrate||function(V,P){return Promise.resolve(V)};B(D,n).then(function(V){E(V)},function(V){E(void 0,V)})},function(D){E(void 0,D)}),Yo({},t(y,f),{_persist:{version:n,rehydrated:!1}})}else{if(f.type===mU)return s=!0,f.result(Ebe(e)),Yo({},t(y,f),{_persist:h});if(f.type===fU)return f.result(o&&o.flush()),Yo({},t(y,f),{_persist:h});if(f.type===hU)u=!0;else if(f.type===GT){if(s)return Yo({},y,{_persist:Yo({},h,{rehydrated:!0})});if(f.key===e.key){var v=t(y,f),w=f.payload,A=r!==!1&&w!==void 0?r(w,p,v,e):v,N=Yo({},A,{_persist:Yo({},h,{rehydrated:!0})});return c(N)}}}if(!h)return t(p,f);var x=t(y,f);return x===y?p:c(Yo({},x,{_persist:h}))}}function DN(e){return kbe(e)||xbe(e)||Cbe()}function Cbe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function xbe(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function kbe(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0&&arguments[0]!==void 0?arguments[0]:yU,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case bU:return fE({},t,{registry:[].concat(DN(t.registry),[n.key])});case GT:var r=t.registry.indexOf(n.key),i=DN(t.registry);return i.splice(r,1),fE({},t,{registry:i,bootstrapped:i.length===0});default:return t}};function Nbe(e,t,n){var r=n||!1,i=sT(Rbe,yU,t&&t.enhancer?t.enhancer:void 0),a=function(c){i.dispatch({type:bU,key:c})},o=function(c,p,f){var m={type:GT,payload:p,err:f,key:c};e.dispatch(m),i.dispatch(m),r&&s.getState().bootstrapped&&(r(),r=!1)},s=fE({},i,{purge:function(){var c=[];return e.dispatch({type:mU,result:function(f){c.push(f)}}),Promise.all(c)},flush:function(){var c=[];return e.dispatch({type:fU,result:function(f){c.push(f)}}),Promise.all(c)},pause:function(){e.dispatch({type:hU})},persist:function(){e.dispatch({type:gU,register:a,rehydrate:o})}});return t&&t.manualPersist||s.persist(),s}const Obe=vP({config:Z4e,misc:J0e,uiState:Y0e,sessionState:v0e,serverState:Kge}),Dbe={key:"root",storage:pU},Lbe=Abe(Dbe,Obe),EU=r0e({reducer:Lbe,middleware:e=>e({serializableCheck:!1})}),Mbe=Nbe(EU);function Zh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zh=function(n){return typeof n}:Zh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zh(e)}function Fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MN(e,t){for(var n=0;n{const t=St(i=>{var a,o;return(o=(a=i==null?void 0:i.serverState)==null?void 0:a.config)==null?void 0:o.allow_anonymous_telemetry}),[n,r]=ut.useState(void 0);return C.useEffect(()=>{t?(Jd.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",{api_host:"https://app.posthog.com",disable_session_recording:!0}),r(n)):r(void 0)},[t]),t?R.jsx($ge,{client:n,children:e}):R.jsx(R.Fragment,{children:e})};tb.createRoot(document.getElementById("root")).render(R.jsx(ut.StrictMode,{children:R.jsx(Sfe,{store:EU,children:R.jsx(vU,{loading:null,persistor:Mbe,children:R.jsx($be,{children:R.jsx(tbe,{})})})})})); +`;function Y4e(){var u,c,p,f,m;const e=oU(),{modelName:t}=Vme(),[n,r]=C.useState(void 0);C.useEffect(()=>{t&&r(uU[t])},[t]);const i=C.useContext(eo);Io();const a=bs(),o=wt(h=>h.config.vscMediaUrl),s=C.useCallback(()=>{var h;return((h=n==null?void 0:n.collectInputFor)==null?void 0:h.some(b=>{if(!b.required)return!1;const y=e.watch(b.key);return typeof y>"u"||typeof y=="string"&&y===""}))||!1},[n,e]);return R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex m-0 p-0 sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt,zIndex:2},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>a("/models"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Configure Model"})]}),R.jsxs("div",{className:"px-2",children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o&&(n==null?void 0:n.icon)&&R.jsx("img",{src:`${o}/logos/${n==null?void 0:n.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h2",{children:n==null?void 0:n.title})]}),(u=n==null?void 0:n.tags)==null?void 0:u.map(h=>R.jsx("span",{style:{backgroundColor:`${kc[h]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:h})),R.jsx(zg,{className:"mt-2",source:(n==null?void 0:n.longDescription)||(n==null?void 0:n.description),maxHeight:200}),R.jsx("br",{}),(((c=n==null?void 0:n.collectInputFor)==null?void 0:c.filter(h=>h.required).length)||0)>0&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{className:"mb-2",children:"Enter required parameters"}),(p=n==null?void 0:n.collectInputFor)==null?void 0:p.filter(h=>h.required).map(h=>R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!0})})]}))]}),(((f=n==null?void 0:n.collectInputFor)==null?void 0:f.filter(h=>!h.required).length)||0)>0&&R.jsxs("details",{children:[R.jsx("summary",{className:"mb-2",children:R.jsx("b",{children:"Advanced (optional)"})}),(m=n==null?void 0:n.collectInputFor)==null?void 0:m.map(h=>h.required?null:R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!1})})]}))]}),R.jsx("h3",{className:"mb-2",children:"Select a model preset"})]}),R.jsxs(q4e,{children:[n==null?void 0:n.packages.map(h=>R.jsx(cU,{disabled:s(),title:h.title,description:h.description,tags:h.tags,refUrl:h.refUrl,icon:h.icon||n.icon,dimensions:h.dimensions,onClick:(b,y)=>{var E;if(s())return;const T={};for(const v of n.collectInputFor||[])T[v.key]=v.inputType==="text"?e.watch(v.key):parseFloat(e.watch(v.key));i==null||i.addModelForRole("*",n.class,{...h.params,...n.params,...el.merge({},...((E=h.dimensions)==null?void 0:E.map((v,w)=>y!=null&&y[w]?{...v.options[y[w]]}:{}))||[]),...T}),a("/")}})),R.jsx(K4e,{disabled:s(),onClick:h=>{var y;if(!n||s())return;const b={};for(const T of n.collectInputFor||[])b[T.key]=T.inputType==="text"?e.watch(T.key):parseFloat(e.watch(T.key));i==null||i.addModelForRole("*",n.class,{...(y=n.packages[0])==null?void 0:y.params,...n.params,...b}),a("/")},children:R.jsx("h3",{className:"text-center my-2",children:"Configure Model in config.py"})})]})]})})}const bd=window,dU=pf({name:"config",initialState:{apiUrl:bd.serverUrl||"http://localhost:8000",vscMediaUrl:bd.vscMediaUrl||localStorage.getItem("vscMediaUrl")||void 0,workspacePaths:bd.workspacePaths||[],vscMachineId:bd.vscMachineId||void 0,windowId:bd.windowId||void 0},reducers:{setWorkspacePaths:(e,t)=>({...e,workspacePaths:t.payload}),setApiUrl:(e,t)=>({...e,apiUrl:t.payload}),setVscMachineId:(e,t)=>({...e,vscMachineId:t.payload}),setSessionId:(e,t)=>({...e,sessionId:t.payload}),setVscMediaUrl:(e,t)=>(localStorage.setItem("vscMediaUrl",t.payload),{...e,vscMediaUrl:t.payload}),setDataSwitchOn:(e,t)=>({...e,dataSwitchOn:t.payload})}}),{setVscMachineId:RN,setApiUrl:X4e,setWorkspacePaths:Q4e,setSessionId:eye,setVscMediaUrl:tye,setDataSwitchOn:nye}=dU.actions,Z4e=dU.reducer;function J4e(e,t){const n=wt(u=>u.config.apiUrl),r=wt(u=>u.sessionState.active),i=wt(u=>u.sessionState.title),a=wt(u=>u.sessionState.history),[o,s]=C.useState(!1);C.useEffect(()=>{t(Xd(!1)),qa("onLoad",{})},[]),C.useEffect(()=>{(async()=>{if(e&&!o&&!r&&i==="New Session"&&a.filter(u=>!u.hide).length>=2){s(!0);const u=await e.getSessionTitle(a);t(kP(u))}})()},[r,a,i,e,o]),C.useEffect(()=>{e&&(e.onSessionUpdate(u=>{t(b0e(u))}),e.onAddContextItem(u=>{t(CP(u))}),e.onConfigUpdate(u=>{t(LR(u))}),fetch(`${n}/slash_commands`).then(async u=>{const c=await u.json();t(qge(c))}),fetch(`${n}/context_providers`).then(async u=>{const c=await u.json();t(Wge(c))}),e.getConfig().then(u=>{t(LR(u))}))},[e]),C.useEffect(()=>{const u=c=>{switch(c.data.type){case"onLoad":window.windowId=c.data.windowId,window.serverUrl=c.data.serverUrl,window.workspacePaths=c.data.workspacePaths,window.vscMachineId=c.data.vscMachineId,window.vscMediaUrl=c.data.vscMediaUrl,t(X4e(c.data.serverUrl)),t(Q4e(c.data.workspacePaths)),t(RN(c.data.vscMachineId)),t(RN(c.data.vscMachineId));break;case"highlightedCode":t(y0e({rangeInFileWithContents:c.data.rangeInFileWithContents,edit:c.data.edit}));break;case"serverStatus":t(Z0e(c.data.message));break;case"stopSession":e==null||e.stopSession();break}};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[e]),C.useEffect(()=>{document.body.style.getPropertyValue("--vscode-editor-foreground")&&localStorage.setItem("--vscode-editor-foreground",document.body.style.getPropertyValue("--vscode-editor-foreground")),document.body.style.getPropertyValue("--vscode-editor-background")&&localStorage.setItem("--vscode-editor-background",document.body.style.getPropertyValue("--vscode-editor-background")),document.body.style.getPropertyValue("--vscode-list-hoverBackground")&&localStorage.setItem("--vscode-list-hoverBackground",document.body.style.getPropertyValue("--vscode-list-hoverBackground"))},[])}const ebe=l2e([{path:"/",element:R.jsx(d3e,{}),errorElement:R.jsx(o4e,{}),children:[{path:"/index.html",element:R.jsx(XR,{})},{path:"/",element:R.jsx(XR,{})},{path:"/history",element:R.jsx(A2e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/settings",element:R.jsx(O4e,{})},{path:"/models",element:R.jsx(W4e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/modelconfig/:modelName",element:R.jsx(Y4e,{})}]}]),eo=C.createContext(void 0);function tbe(){const e=a4e(!1),t=Io();return J4e(e,t),R.jsx(eo.Provider,{value:e,children:R.jsx(r2e,{router:ebe})})}var zT={},HT={};HT.__esModule=!0;HT.default=ibe;function Xh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xh=function(n){return typeof n}:Xh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Xh(e)}function J4(){}var nbe={getItem:J4,setItem:J4,removeItem:J4};function rbe(e){if((typeof self>"u"?"undefined":Xh(self))!=="object"||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch{return!1}return!0}function ibe(e){var t="".concat(e,"Storage");return rbe(t)?self[t]:nbe}zT.__esModule=!0;zT.default=sbe;var abe=obe(HT);function obe(e){return e&&e.__esModule?e:{default:e}}function sbe(e){var t=(0,abe.default)(e);return{getItem:function(r){return new Promise(function(i,a){i(t.getItem(r))})},setItem:function(r,i){return new Promise(function(a,o){a(t.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(t.removeItem(r))})}}}var pU=void 0,lbe=ube(zT);function ube(e){return e&&e.__esModule?e:{default:e}}var cbe=(0,lbe.default)("local");pU=cbe;var jT="persist:",fU="persist/FLUSH",GT="persist/REHYDRATE",hU="persist/PAUSE",gU="persist/PERSIST",mU="persist/PURGE",bU="persist/REGISTER",dbe=-1;function Qh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qh=function(n){return typeof n}:Qh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Qh(e)}function NN(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 pbe(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sbe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}var wbe=5e3;function Abe(e,t){var n=e.version!==void 0?e.version:dbe;e.debug;var r=e.stateReconciler===void 0?hbe:e.stateReconciler,i=e.getStoredState||bbe,a=e.timeout!==void 0?e.timeout:wbe,o=null,s=!1,u=!0,c=function(f){return f._persist.rehydrated&&o&&!u&&o.update(f),f};return function(p,f){var m=p||{},h=m._persist,b=Tbe(m,["_persist"]),y=b;if(f.type===gU){var T=!1,E=function(B,V){T||(f.rehydrate(e.key,B,V),T=!0)};if(a&&setTimeout(function(){!T&&E(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},a),u=!1,o||(o=gbe(e)),h)return Yo({},t(y,f),{_persist:h});if(typeof f.rehydrate!="function"||typeof f.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return f.register(e.key),i(e).then(function(D){var B=e.migrate||function(V,P){return Promise.resolve(V)};B(D,n).then(function(V){E(V)},function(V){E(void 0,V)})},function(D){E(void 0,D)}),Yo({},t(y,f),{_persist:{version:n,rehydrated:!1}})}else{if(f.type===mU)return s=!0,f.result(Ebe(e)),Yo({},t(y,f),{_persist:h});if(f.type===fU)return f.result(o&&o.flush()),Yo({},t(y,f),{_persist:h});if(f.type===hU)u=!0;else if(f.type===GT){if(s)return Yo({},y,{_persist:Yo({},h,{rehydrated:!0})});if(f.key===e.key){var v=t(y,f),w=f.payload,A=r!==!1&&w!==void 0?r(w,p,v,e):v,N=Yo({},A,{_persist:Yo({},h,{rehydrated:!0})});return c(N)}}}if(!h)return t(p,f);var x=t(y,f);return x===y?p:c(Yo({},x,{_persist:h}))}}function DN(e){return kbe(e)||xbe(e)||Cbe()}function Cbe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function xbe(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function kbe(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0&&arguments[0]!==void 0?arguments[0]:yU,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case bU:return fE({},t,{registry:[].concat(DN(t.registry),[n.key])});case GT:var r=t.registry.indexOf(n.key),i=DN(t.registry);return i.splice(r,1),fE({},t,{registry:i,bootstrapped:i.length===0});default:return t}};function Nbe(e,t,n){var r=n||!1,i=sT(Rbe,yU,t&&t.enhancer?t.enhancer:void 0),a=function(c){i.dispatch({type:bU,key:c})},o=function(c,p,f){var m={type:GT,payload:p,err:f,key:c};e.dispatch(m),i.dispatch(m),r&&s.getState().bootstrapped&&(r(),r=!1)},s=fE({},i,{purge:function(){var c=[];return e.dispatch({type:mU,result:function(f){c.push(f)}}),Promise.all(c)},flush:function(){var c=[];return e.dispatch({type:fU,result:function(f){c.push(f)}}),Promise.all(c)},pause:function(){e.dispatch({type:hU})},persist:function(){e.dispatch({type:gU,register:a,rehydrate:o})}});return t&&t.manualPersist||s.persist(),s}const Obe=vP({config:Z4e,misc:J0e,uiState:Y0e,sessionState:v0e,serverState:Kge}),Dbe={key:"root",storage:pU},Lbe=Abe(Dbe,Obe),EU=r0e({reducer:Lbe,middleware:e=>e({serializableCheck:!1})}),Mbe=Nbe(EU);function Zh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zh=function(n){return typeof n}:Zh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zh(e)}function Fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MN(e,t){for(var n=0;n{const t=wt(i=>{var a,o;return(o=(a=i==null?void 0:i.serverState)==null?void 0:a.config)==null?void 0:o.allow_anonymous_telemetry}),[n,r]=ut.useState(void 0);return C.useEffect(()=>{t?(Jd.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",{api_host:"https://app.posthog.com",disable_session_recording:!0}),r(n)):r(void 0)},[t]),t?R.jsx($ge,{client:n,children:e}):R.jsx(R.Fragment,{children:e})};tb.createRoot(document.getElementById("root")).render(R.jsx(ut.StrictMode,{children:R.jsx(Sfe,{store:EU,children:R.jsx(vU,{loading:null,persistor:Mbe,children:R.jsx($be,{children:R.jsx(tbe,{})})})})})); diff --git a/extensions/vscode/gui/assets/index.js b/extensions/vscode/gui/assets/index.js index 6da0d5f1f..63e2704aa 100644 --- a/extensions/vscode/gui/assets/index.js +++ b/extensions/vscode/gui/assets/index.js @@ -354,7 +354,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var M2=C,nfe=tfe;function rfe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ife=typeof Object.is=="function"?Object.is:rfe,afe=nfe.useSyncExternalStore,ofe=M2.useRef,sfe=M2.useEffect,lfe=M2.useMemo,ufe=M2.useDebugValue;cP.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=ofe(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=lfe(function(){function u(h){if(!c){if(c=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var b=o.value;if(i(b,h))return f=b}return f=h}if(b=f,ife(p,h))return b;var y=r(h);return i!==void 0&&i(b,y)?b:(p=h,f=y)}var c=!1,p,f,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,i]);var s=afe(e,a[0],a[1]);return sfe(function(){o.hasValue=!0,o.value=s},[s]),ufe(s),s};uP.exports=cP;var cfe=uP.exports;function dfe(e){e()}let dP=dfe;const pfe=e=>dP=e,ffe=()=>dP,RI=Symbol.for("react-redux-context"),NI=typeof globalThis<"u"?globalThis:{};function hfe(){var e;if(!C.createContext)return{};const t=(e=NI[RI])!=null?e:NI[RI]=new Map;let n=t.get(C.createContext);return n||(n=C.createContext(null),t.set(C.createContext,n)),n}const yl=hfe();function eT(e=yl){return function(){return C.useContext(e)}}const pP=eT(),gfe=()=>{throw new Error("uSES not initialized!")};let fP=gfe;const mfe=e=>{fP=e},bfe=(e,t)=>e===t;function yfe(e=yl){const t=e===yl?pP:eT(e);return function(r,i={}){const{equalityFn:a=bfe,stabilityCheck:o=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:u,subscription:c,getServerState:p,stabilityCheck:f,noopCheck:m}=t();C.useRef(!0);const h=C.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o]),b=fP(c.addNestedSub,u.getState,p||u.getState,h,a);return C.useDebugValue(b),b}}const St=yfe();function Efe(){const e=ffe();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){!i||t===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const OI={notify(){},get:()=>[]};function vfe(e,t){let n,r=OI;function i(f){return u(),r.subscribe(f)}function a(){r.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return!!n}function u(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=Efe())}function c(){n&&(n(),n=void 0,r.clear(),r=OI)}const p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:c,getListeners:()=>r};return p}const _fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tfe=_fe?C.useLayoutEffect:C.useEffect;function Sfe({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:a="once"}){const o=C.useMemo(()=>{const c=vfe(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:a}},[e,r,i,a]),s=C.useMemo(()=>e.getState(),[e]);Tfe(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,s]);const u=t||yl;return C.createElement(u.Provider,{value:o},n)}function hP(e=yl){const t=e===yl?pP:eT(e);return function(){const{store:r}=t();return r}}const wfe=hP();function Afe(e=yl){const t=e===yl?wfe:hP(e);return function(){return t().dispatch}}const Io=Afe();mfe(cfe.useSyncExternalStoreWithSelector);pfe(c9.unstable_batchedUpdates);function za(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:tT(e)?2:nT(e)?3:0}function W1(e,t){return Cc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Cfe(e,t){return Cc(e)===2?e.get(t):e[t]}function gP(e,t,n){var r=Cc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function mP(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function tT(e){return Ofe&&e instanceof Map}function nT(e){return Dfe&&e instanceof Set}function Zl(e){return e.o||e.t}function rT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=yP(e);delete t[xn];for(var n=q1(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=xfe),Object.freeze(e),t&&Su(e,function(n,r){return iT(r,!0)},!0)),e}function xfe(){za(2)}function aT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function To(e){var t=Ay[e];return t||za(18,e),t}function kfe(e,t){Ay[e]||(Ay[e]=t)}function Ty(){return Cp}function E4(e,t){t&&(To("Patches"),e.u=[],e.s=[],e.v=t)}function Vg(e){Sy(e),e.p.forEach(Ife),e.p=null}function Sy(e){e===Cp&&(Cp=e.l)}function DI(e){return Cp={p:[],l:Cp,h:e,m:!0,_:0}}function Ife(e){var t=e[xn];t.i===0||t.i===1?t.j():t.g=!0}function v4(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||To("ES5").S(t,e,r),r?(n[xn].P&&(Vg(t),za(4)),ps(e)&&(e=Wg(t,e),t.l||qg(t,e)),t.u&&To("Patches").M(n[xn].t,e,t.u,t.s)):e=Wg(t,n,[]),Vg(t),t.u&&t.v(t.u,t.s),e!==bP?e:void 0}function Wg(e,t,n){if(aT(t))return t;var r=t[xn];if(!r)return Su(t,function(s,u){return LI(e,r,t,s,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return qg(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=rT(r.k):r.o,a=i,o=!1;r.i===3&&(a=new Set(i),i.clear(),o=!0),Su(a,function(s,u){return LI(e,r,i,s,u,n,o)}),qg(e,i,!1),n&&e.u&&To("Patches").N(r,n,e.u,e.s)}return r.o}function LI(e,t,n,r,i,a,o){if(El(i)){var s=Wg(e,i,a&&t&&t.i!==3&&!W1(t.R,r)?a.concat(r):void 0);if(gP(n,r,s),!El(s))return;e.m=!1}else o&&n.add(i);if(ps(i)&&!aT(i)){if(!e.h.D&&e._<1)return;Wg(e,i),t&&t.A.l||qg(e,i)}}function qg(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&iT(t,n)}function _4(e,t){var n=e[xn];return(n?Zl(n):e)[t]}function MI(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function qs(e){e.P||(e.P=!0,e.l&&qs(e.l))}function T4(e){e.o||(e.o=rT(e.t))}function wy(e,t,n){var r=tT(t)?To("MapSet").F(t,n):nT(t)?To("MapSet").T(t,n):e.O?function(i,a){var o=Array.isArray(i),s={i:o?1:0,A:a?a.A:Ty(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},u=s,c=xp;o&&(u=[s],c=Sd);var p=Proxy.revocable(u,c),f=p.revoke,m=p.proxy;return s.k=m,s.j=f,m}(t,n):To("ES5").J(t,n);return(n?n.A:Ty()).p.push(r),r}function Rfe(e){return El(e)||za(22,e),function t(n){if(!ps(n))return n;var r,i=n[xn],a=Cc(n);if(i){if(!i.P&&(i.i<4||!To("ES5").K(i)))return i.t;i.I=!0,r=FI(n,a),i.I=!1}else r=FI(n,a);return Su(r,function(o,s){i&&Cfe(i.t,o)===s||gP(r,o,t(s))}),a===3?new Set(r):r}(e)}function FI(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return rT(e)}function Nfe(){function e(a,o){var s=i[a];return s?s.enumerable=o:i[a]=s={configurable:!0,enumerable:o,get:function(){var u=this[xn];return xp.get(u,a)},set:function(u){var c=this[xn];xp.set(c,a,u)}},s}function t(a){for(var o=a.length-1;o>=0;o--){var s=a[o][xn];if(!s.P)switch(s.i){case 5:r(s)&&qs(s);break;case 4:n(s)&&qs(s)}}}function n(a){for(var o=a.t,s=a.k,u=q1(s),c=u.length-1;c>=0;c--){var p=u[c];if(p!==xn){var f=o[p];if(f===void 0&&!W1(o,p))return!0;var m=s[p],h=m&&m[xn];if(h?h.t!==f:!mP(m,f))return!0}}var b=!!o[xn];return u.length!==q1(o).length+(b?0:1)}function r(a){var o=a.k;if(o.length!==a.t.length)return!0;var s=Object.getOwnPropertyDescriptor(o,o.length-1);if(s&&!s.get)return!0;for(var u=0;u1?E-1:0),w=1;w1?p-1:0),m=1;m=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var o=To("Patches").$;return El(n)?o(n,r):this.produce(n,function(s){return o(s,r)})},e}(),ji=new Mfe,EP=ji.produce;ji.produceWithPatches.bind(ji);ji.setAutoFreeze.bind(ji);ji.setUseProxies.bind(ji);ji.applyPatches.bind(ji);ji.createDraft.bind(ji);ji.finishDraft.bind(ji);function kp(e){"@babel/helpers - typeof";return kp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kp(e)}function Ffe(e,t){if(kp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pfe(e){var t=Ffe(e,"string");return kp(t)==="symbol"?t:String(t)}function Bfe(e,t,n){return t=Pfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $I(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 zI(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ur(1));return n(sT)(e,t)}if(typeof e!="function")throw new Error(Ur(2));var i=e,a=t,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function p(){if(u)throw new Error(Ur(3));return a}function f(y){if(typeof y!="function")throw new Error(Ur(4));if(u)throw new Error(Ur(5));var T=!0;return c(),s.push(y),function(){if(T){if(u)throw new Error(Ur(6));T=!1,c();var v=s.indexOf(y);s.splice(v,1),o=null}}}function m(y){if(!Ufe(y))throw new Error(Ur(7));if(typeof y.type>"u")throw new Error(Ur(8));if(u)throw new Error(Ur(9));try{u=!0,a=i(a,y)}finally{u=!1}for(var T=o=s,E=0;E"u")throw new Error(Ur(12));if(typeof n(void 0,{type:Kg.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ur(13))})}function vP(e){for(var t=Object.keys(e),n={},r=0;r"u")throw c&&c.type,new Error(Ur(14));f[h]=T,p=p||T!==y}return p=p||a.length!==Object.keys(u).length,p?f:u}}function Yg(){for(var e=arguments.length,t=new Array(e),n=0;n0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{let n=e.active;typeof t.stop=="boolean"&&(n=!t.stop);let r;t.index>e.history.length?r={...t.update}:t.delta===!0?(r={...e.history[t.index]},t.update.name&&(r.name=(r.name??"")+t.update.name),t.update.description&&(r.description=(r.description??"")+t.update.description),t.update.observations&&(r.observations=[...r.observations??[],...t.update.observations]),t.update.logs&&(r.logs=[...r.logs??[],...t.update.logs])):t.delta===!1&&(r={...e.history[t.index],...t.update});let i=[...e.history];return r&&(i[t.index]=r),{...e,history:i,active:n}},newSession:(e,{payload:t})=>t?(console.log("NEW SESSION"),{...e,history:t.session_state.history,context_items:t.session_state.context_items,contextItemsAtIndex:{},active:!1,title:t.title,session_id:t.session_id}):{...e,history:[],context_items:[],contextItemsAtIndex:{},active:!1,title:"New Session",session_id:Yd()},setTitle:(e,{payload:t})=>({...e,title:t}),setActive:(e,{payload:t})=>({...e,active:t}),setHistory:(e,{payload:t})=>({...e,history:t}),deleteAtIndex:(e,{payload:t})=>{let n=[...e.history];return n[t]={...n[t],hide:!0},{...e,history:n}},addContextItem:(e,{payload:t})=>(console.log("HERE...",t),{...e,context_items:[...e.context_items,t]}),addContextItemAtIndex:(e,{payload:t})=>({...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:[...e.contextItemsAtIndex[t.index]??[],t.item]}}),addHighlightedCode:(e,{payload:t})=>{let n=[...e.context_items].map(a=>({...a,editing:!1}));const r=`(${t.rangeInFileWithContents.range.start.line+1}-${t.rangeInFileWithContents.range.end.line+1})`,i=t.rangeInFileWithContents.filepath.split(/[\\/]/).pop();return n.push({description:{name:`${i} ${r}`,description:t.rangeInFileWithContents.filepath,id:{provider_title:"code",item_id:Yd()}},content:t.rangeInFileWithContents.contents,editing:!0,editable:!0}),{...e,context_items:n}},deleteContextWithIds:(e,{payload:t})=>{const n=t.ids.map(r=>`${r.provider_title}-${r.item_id}`);return typeof t.index>"u"?{...e,context_items:e.context_items.filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}}},setEditingAtIds:(e,{payload:t})=>{const n=t.ids.map(r=>r.item_id);return typeof t.index>"u"?{...e,context_items:e.context_items.map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}}}}}),{setActive:Xd,setHistory:YI,processSessionUpdate:b0e,newSession:F2,deleteAtIndex:C4,addContextItem:CP,addContextItemAtIndex:xP,addHighlightedCode:y0e,deleteContextWithIds:x4,setTitle:kP,setEditingAtIds:E0e}=AP.actions,v0e=AP.reducer,_0e=He.button` + */var M2=C,nfe=tfe;function rfe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ife=typeof Object.is=="function"?Object.is:rfe,afe=nfe.useSyncExternalStore,ofe=M2.useRef,sfe=M2.useEffect,lfe=M2.useMemo,ufe=M2.useDebugValue;cP.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=ofe(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=lfe(function(){function u(h){if(!c){if(c=!0,p=h,h=r(h),i!==void 0&&o.hasValue){var b=o.value;if(i(b,h))return f=b}return f=h}if(b=f,ife(p,h))return b;var y=r(h);return i!==void 0&&i(b,y)?b:(p=h,f=y)}var c=!1,p,f,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,i]);var s=afe(e,a[0],a[1]);return sfe(function(){o.hasValue=!0,o.value=s},[s]),ufe(s),s};uP.exports=cP;var cfe=uP.exports;function dfe(e){e()}let dP=dfe;const pfe=e=>dP=e,ffe=()=>dP,RI=Symbol.for("react-redux-context"),NI=typeof globalThis<"u"?globalThis:{};function hfe(){var e;if(!C.createContext)return{};const t=(e=NI[RI])!=null?e:NI[RI]=new Map;let n=t.get(C.createContext);return n||(n=C.createContext(null),t.set(C.createContext,n)),n}const yl=hfe();function eT(e=yl){return function(){return C.useContext(e)}}const pP=eT(),gfe=()=>{throw new Error("uSES not initialized!")};let fP=gfe;const mfe=e=>{fP=e},bfe=(e,t)=>e===t;function yfe(e=yl){const t=e===yl?pP:eT(e);return function(r,i={}){const{equalityFn:a=bfe,stabilityCheck:o=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:u,subscription:c,getServerState:p,stabilityCheck:f,noopCheck:m}=t();C.useRef(!0);const h=C.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o]),b=fP(c.addNestedSub,u.getState,p||u.getState,h,a);return C.useDebugValue(b),b}}const wt=yfe();function Efe(){const e=ffe();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){!i||t===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const OI={notify(){},get:()=>[]};function vfe(e,t){let n,r=OI;function i(f){return u(),r.subscribe(f)}function a(){r.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return!!n}function u(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=Efe())}function c(){n&&(n(),n=void 0,r.clear(),r=OI)}const p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:c,getListeners:()=>r};return p}const _fe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Tfe=_fe?C.useLayoutEffect:C.useEffect;function Sfe({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:a="once"}){const o=C.useMemo(()=>{const c=vfe(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:a}},[e,r,i,a]),s=C.useMemo(()=>e.getState(),[e]);Tfe(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,s]);const u=t||yl;return C.createElement(u.Provider,{value:o},n)}function hP(e=yl){const t=e===yl?pP:eT(e);return function(){const{store:r}=t();return r}}const wfe=hP();function Afe(e=yl){const t=e===yl?wfe:hP(e);return function(){return t().dispatch}}const Io=Afe();mfe(cfe.useSyncExternalStoreWithSelector);pfe(c9.unstable_batchedUpdates);function za(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:tT(e)?2:nT(e)?3:0}function W1(e,t){return Cc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Cfe(e,t){return Cc(e)===2?e.get(t):e[t]}function gP(e,t,n){var r=Cc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function mP(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function tT(e){return Ofe&&e instanceof Map}function nT(e){return Dfe&&e instanceof Set}function Zl(e){return e.o||e.t}function rT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=yP(e);delete t[xn];for(var n=q1(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=xfe),Object.freeze(e),t&&Su(e,function(n,r){return iT(r,!0)},!0)),e}function xfe(){za(2)}function aT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function To(e){var t=Ay[e];return t||za(18,e),t}function kfe(e,t){Ay[e]||(Ay[e]=t)}function Ty(){return Cp}function E4(e,t){t&&(To("Patches"),e.u=[],e.s=[],e.v=t)}function Vg(e){Sy(e),e.p.forEach(Ife),e.p=null}function Sy(e){e===Cp&&(Cp=e.l)}function DI(e){return Cp={p:[],l:Cp,h:e,m:!0,_:0}}function Ife(e){var t=e[xn];t.i===0||t.i===1?t.j():t.g=!0}function v4(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||To("ES5").S(t,e,r),r?(n[xn].P&&(Vg(t),za(4)),ps(e)&&(e=Wg(t,e),t.l||qg(t,e)),t.u&&To("Patches").M(n[xn].t,e,t.u,t.s)):e=Wg(t,n,[]),Vg(t),t.u&&t.v(t.u,t.s),e!==bP?e:void 0}function Wg(e,t,n){if(aT(t))return t;var r=t[xn];if(!r)return Su(t,function(s,u){return LI(e,r,t,s,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return qg(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=rT(r.k):r.o,a=i,o=!1;r.i===3&&(a=new Set(i),i.clear(),o=!0),Su(a,function(s,u){return LI(e,r,i,s,u,n,o)}),qg(e,i,!1),n&&e.u&&To("Patches").N(r,n,e.u,e.s)}return r.o}function LI(e,t,n,r,i,a,o){if(El(i)){var s=Wg(e,i,a&&t&&t.i!==3&&!W1(t.R,r)?a.concat(r):void 0);if(gP(n,r,s),!El(s))return;e.m=!1}else o&&n.add(i);if(ps(i)&&!aT(i)){if(!e.h.D&&e._<1)return;Wg(e,i),t&&t.A.l||qg(e,i)}}function qg(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&iT(t,n)}function _4(e,t){var n=e[xn];return(n?Zl(n):e)[t]}function MI(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function qs(e){e.P||(e.P=!0,e.l&&qs(e.l))}function T4(e){e.o||(e.o=rT(e.t))}function wy(e,t,n){var r=tT(t)?To("MapSet").F(t,n):nT(t)?To("MapSet").T(t,n):e.O?function(i,a){var o=Array.isArray(i),s={i:o?1:0,A:a?a.A:Ty(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},u=s,c=xp;o&&(u=[s],c=Sd);var p=Proxy.revocable(u,c),f=p.revoke,m=p.proxy;return s.k=m,s.j=f,m}(t,n):To("ES5").J(t,n);return(n?n.A:Ty()).p.push(r),r}function Rfe(e){return El(e)||za(22,e),function t(n){if(!ps(n))return n;var r,i=n[xn],a=Cc(n);if(i){if(!i.P&&(i.i<4||!To("ES5").K(i)))return i.t;i.I=!0,r=FI(n,a),i.I=!1}else r=FI(n,a);return Su(r,function(o,s){i&&Cfe(i.t,o)===s||gP(r,o,t(s))}),a===3?new Set(r):r}(e)}function FI(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return rT(e)}function Nfe(){function e(a,o){var s=i[a];return s?s.enumerable=o:i[a]=s={configurable:!0,enumerable:o,get:function(){var u=this[xn];return xp.get(u,a)},set:function(u){var c=this[xn];xp.set(c,a,u)}},s}function t(a){for(var o=a.length-1;o>=0;o--){var s=a[o][xn];if(!s.P)switch(s.i){case 5:r(s)&&qs(s);break;case 4:n(s)&&qs(s)}}}function n(a){for(var o=a.t,s=a.k,u=q1(s),c=u.length-1;c>=0;c--){var p=u[c];if(p!==xn){var f=o[p];if(f===void 0&&!W1(o,p))return!0;var m=s[p],h=m&&m[xn];if(h?h.t!==f:!mP(m,f))return!0}}var b=!!o[xn];return u.length!==q1(o).length+(b?0:1)}function r(a){var o=a.k;if(o.length!==a.t.length)return!0;var s=Object.getOwnPropertyDescriptor(o,o.length-1);if(s&&!s.get)return!0;for(var u=0;u1?E-1:0),w=1;w1?p-1:0),m=1;m=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var o=To("Patches").$;return El(n)?o(n,r):this.produce(n,function(s){return o(s,r)})},e}(),ji=new Mfe,EP=ji.produce;ji.produceWithPatches.bind(ji);ji.setAutoFreeze.bind(ji);ji.setUseProxies.bind(ji);ji.applyPatches.bind(ji);ji.createDraft.bind(ji);ji.finishDraft.bind(ji);function kp(e){"@babel/helpers - typeof";return kp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kp(e)}function Ffe(e,t){if(kp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kp(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pfe(e){var t=Ffe(e,"string");return kp(t)==="symbol"?t:String(t)}function Bfe(e,t,n){return t=Pfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $I(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 zI(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ur(1));return n(sT)(e,t)}if(typeof e!="function")throw new Error(Ur(2));var i=e,a=t,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function p(){if(u)throw new Error(Ur(3));return a}function f(y){if(typeof y!="function")throw new Error(Ur(4));if(u)throw new Error(Ur(5));var T=!0;return c(),s.push(y),function(){if(T){if(u)throw new Error(Ur(6));T=!1,c();var v=s.indexOf(y);s.splice(v,1),o=null}}}function m(y){if(!Ufe(y))throw new Error(Ur(7));if(typeof y.type>"u")throw new Error(Ur(8));if(u)throw new Error(Ur(9));try{u=!0,a=i(a,y)}finally{u=!1}for(var T=o=s,E=0;E"u")throw new Error(Ur(12));if(typeof n(void 0,{type:Kg.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ur(13))})}function vP(e){for(var t=Object.keys(e),n={},r=0;r"u")throw c&&c.type,new Error(Ur(14));f[h]=T,p=p||T!==y}return p=p||a.length!==Object.keys(u).length,p?f:u}}function Yg(){for(var e=arguments.length,t=new Array(e),n=0;n0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{let n=e.active;typeof t.stop=="boolean"&&(n=!t.stop);let r;t.index>e.history.length?r={...t.update}:t.delta===!0?(r={...e.history[t.index]},t.update.name&&(r.name=(r.name??"")+t.update.name),t.update.description&&(r.description=(r.description??"")+t.update.description),t.update.observations&&(r.observations=[...r.observations??[],...t.update.observations]),t.update.logs&&(r.logs=[...r.logs??[],...t.update.logs])):t.delta===!1&&(r={...e.history[t.index],...t.update});let i=[...e.history];return r&&(i[t.index]=r),{...e,history:i,active:n}},newSession:(e,{payload:t})=>t?(console.log("NEW SESSION"),{...e,history:t.session_state.history,context_items:t.session_state.context_items,contextItemsAtIndex:{},active:!1,title:t.title,session_id:t.session_id}):{...e,history:[],context_items:[],contextItemsAtIndex:{},active:!1,title:"New Session",session_id:Yd()},setTitle:(e,{payload:t})=>({...e,title:t}),setActive:(e,{payload:t})=>({...e,active:t}),setHistory:(e,{payload:t})=>({...e,history:t}),deleteAtIndex:(e,{payload:t})=>{let n=[...e.history];return n[t]={...n[t],hide:!0},{...e,history:n}},addContextItem:(e,{payload:t})=>(console.log("HERE...",t),{...e,context_items:[...e.context_items,t]}),addContextItemAtIndex:(e,{payload:t})=>({...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:[...e.contextItemsAtIndex[t.index]??[],t.item]}}),addHighlightedCode:(e,{payload:t})=>{let n=[...e.context_items].map(a=>({...a,editing:!1}));const r=`(${t.rangeInFileWithContents.range.start.line+1}-${t.rangeInFileWithContents.range.end.line+1})`,i=t.rangeInFileWithContents.filepath.split(/[\\/]/).pop();return n.push({description:{name:`${i} ${r}`,description:t.rangeInFileWithContents.filepath,id:{provider_title:"code",item_id:Yd()}},content:t.rangeInFileWithContents.contents,editing:!0,editable:!0}),{...e,context_items:n}},deleteContextWithIds:(e,{payload:t})=>{const n=t.ids.map(r=>`${r.provider_title}-${r.item_id}`);return typeof t.index>"u"?{...e,context_items:e.context_items.filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).filter(r=>!n.includes(`${r.description.id.provider_title}-${r.description.id.item_id}`))}}},setEditingAtIds:(e,{payload:t})=>{const n=t.ids.map(r=>r.item_id);return typeof t.index>"u"?{...e,context_items:e.context_items.map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}:{...e,contextItemsAtIndex:{...e.contextItemsAtIndex,[t.index]:(e.contextItemsAtIndex[t.index]??[]).map(r=>({...r,editing:n.includes(r.description.id.item_id)}))}}}}}),{setActive:Xd,setHistory:YI,processSessionUpdate:b0e,newSession:F2,deleteAtIndex:C4,addContextItem:CP,addContextItemAtIndex:xP,addHighlightedCode:y0e,deleteContextWithIds:x4,setTitle:kP,setEditingAtIds:E0e}=AP.actions,v0e=AP.reducer,_0e=He.button` border: none; color: ${jt}; background-color: ${Mt}; @@ -429,7 +429,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho background-color: ${e.color}; } `} -`,x0e=e=>{const[t,n]=C.useState(!1);C.useContext(eo);const r=Io(),[i,a]=C.useState(void 0);C.useEffect(()=>{e.editing&&e.item.content.length>4e3?a("Editing such a large range may be slow"):a(void 0)},[e.editing,e.item]);const o=C.useCallback(()=>{var c,p;e.editing||r(E0e({ids:[e.item.description.id],index:e.inputIndex})),e.editingAny||(c=e.prefixInputWithEdit)==null||c.call(e,!0),e.editingAny&&e.editing&&((p=e.prefixInputWithEdit)==null||p.call(e,!1))},[e.editing,e.editingAny,e.item,e.inputIndex]),s=C.useRef(null),u=C.useRef(null);return St(c=>c.sessionState.context_items),R.jsxs("div",{style:{position:"relative"},children:[R.jsxs(S0e,{previewing:e.previewing,ref:s,children:[R.jsx(w0e,{fontSize:ir(),borderColor:e.editing&&i?"red":void 0,ref:u,onMouseEnter:()=>{n(!0),e.onHover&&e.onHover(!0)},onMouseLeave:()=>{n(!1),e.onHover&&e.onHover(!1)},className:`pill-button-${e.stepIndex||"main"}`,onKeyDown:c=>{var p,f;c.key==="Backspace"?(p=e.onDelete)==null||p.call(e,e.stepIndex):c.key==="v"?(f=e.toggleViewContent)==null||f.call(e):c.key==="e"&&o()},onClick:c=>{var p;if((p=e.onClick)==null||p.call(e,c),e.item.description.id.provider_title==="file")qa("showFile",{filepath:e.item.description.description});else if(e.item.description.id.provider_title==="code"){const f=e.item.description.name.split("(")[1].split(")")[0].split("-");qa("showLines",{filepath:e.item.description.description,start:parseInt(f[0])-1,end:parseInt(f[1])-1})}else qa("showVirtualFile",{name:e.item.description.name,content:e.item.content})},onBlur:c=>{var p,f;(p=s.current)!=null&&p.contains(c.relatedTarget)&&(c.preventDefault(),(f=u.current)==null||f.focus())},children:R.jsxs("span",{className:(t?"underline":"")+" flex",children:[["file","code"].includes(e.item.description.id.provider_title)&&R.jsx(_y,{height:"16px",width:"16px",filename:e.item.description.name.split(" ").at(0)}),e.item.description.name]})}),(e.editingAny||e.focusing&&e.item.editable||e.editing&&e.editingAny)&&R.jsxs(R.Fragment,{children:[R.jsx(C0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,text:e.editing?"Editing this range":"Edit this range (e)",onClick:o,tabIndex:-1,color:"#f0f4",selected:e.editing,children:R.jsx(zQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:"Editing this range"})]}),e.focusing&&R.jsx(A0e,{text:"Delete (⌫)",onClick:()=>{var c;return(c=e.onDelete)==null?void 0:c.call(e,e.stepIndex)},tabIndex:-1,color:"#f004",children:R.jsx(NL,{width:"1.4em",height:"1.4em"})})]}),R.jsx(Qs,{id:`edit-${e.index}`,children:e.item.editing?"Editing this section (with entire file as context)":"Edit this section"}),R.jsx(Qs,{id:`delete-${e.index}`,children:"Delete"}),e.editing&&i&&R.jsxs(R.Fragment,{children:[R.jsx(T0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,className:"z-10",children:R.jsx(xL,{style:{margin:"auto"},width:"1.0em",strokeWidth:2})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:i})]})]})},k0e={};var xy=function(e,t){return xy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},xy(e,t)};function ff(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tn=function(){return tn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]{const[t,n]=C.useState(!1);C.useContext(eo);const r=Io(),[i,a]=C.useState(void 0);C.useEffect(()=>{e.editing&&e.item.content.length>4e3?a("Editing such a large range may be slow"):a(void 0)},[e.editing,e.item]);const o=C.useCallback(()=>{var c,p;e.editing||r(E0e({ids:[e.item.description.id],index:e.inputIndex})),e.editingAny||(c=e.prefixInputWithEdit)==null||c.call(e,!0),e.editingAny&&e.editing&&((p=e.prefixInputWithEdit)==null||p.call(e,!1))},[e.editing,e.editingAny,e.item,e.inputIndex]),s=C.useRef(null),u=C.useRef(null);return wt(c=>c.sessionState.context_items),R.jsxs("div",{style:{position:"relative"},children:[R.jsxs(S0e,{previewing:e.previewing,ref:s,children:[R.jsx(w0e,{fontSize:ir(),borderColor:e.editing&&i?"red":void 0,ref:u,onMouseEnter:()=>{n(!0),e.onHover&&e.onHover(!0)},onMouseLeave:()=>{n(!1),e.onHover&&e.onHover(!1)},className:`pill-button-${e.stepIndex||"main"}`,onKeyDown:c=>{var p,f;c.key==="Backspace"?(p=e.onDelete)==null||p.call(e,e.stepIndex):c.key==="v"?(f=e.toggleViewContent)==null||f.call(e):c.key==="e"&&o()},onClick:c=>{var p;if((p=e.onClick)==null||p.call(e,c),e.item.description.id.provider_title==="file")qa("showFile",{filepath:e.item.description.description});else if(e.item.description.id.provider_title==="code"){const f=e.item.description.name.split("(")[1].split(")")[0].split("-");qa("showLines",{filepath:e.item.description.description,start:parseInt(f[0])-1,end:parseInt(f[1])-1})}else qa("showVirtualFile",{name:e.item.description.name,content:e.item.content})},onBlur:c=>{var p,f;(p=s.current)!=null&&p.contains(c.relatedTarget)&&(c.preventDefault(),(f=u.current)==null||f.focus())},children:R.jsxs("span",{className:(t?"underline":"")+" flex",children:[["file","code"].includes(e.item.description.id.provider_title)&&R.jsx(_y,{height:"16px",width:"16px",filename:e.item.description.name.split(" ").at(0)}),e.item.description.name]})}),(e.editingAny||e.focusing&&e.item.editable||e.editing&&e.editingAny)&&R.jsxs(R.Fragment,{children:[R.jsx(C0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,text:e.editing?"Editing this range":"Edit this range (e)",onClick:o,tabIndex:-1,color:"#f0f4",selected:e.editing,children:R.jsx(zQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:"Editing this range"})]}),e.focusing&&R.jsx(A0e,{text:"Delete (⌫)",onClick:()=>{var c;return(c=e.onDelete)==null?void 0:c.call(e,e.stepIndex)},tabIndex:-1,color:"#f004",children:R.jsx(NL,{width:"1.4em",height:"1.4em"})})]}),R.jsx(Qs,{id:`edit-${e.index}`,children:e.item.editing?"Editing this section (with entire file as context)":"Edit this section"}),R.jsx(Qs,{id:`delete-${e.index}`,children:"Delete"}),e.editing&&i&&R.jsxs(R.Fragment,{children:[R.jsx(T0e,{"data-tooltip-id":`circle-div-${e.item.description.name}`,className:"z-10",children:R.jsx(xL,{style:{margin:"auto"},width:"1.0em",strokeWidth:2})}),R.jsx(Qs,{id:`circle-div-${e.item.description.name}`,children:i})]})]})},k0e={};var xy=function(e,t){return xy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},xy(e,t)};function ff(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tn=function(){return tn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]"u"&&require("cross-fetch/polyfill"),c=new URL(i,this.url),a&&(p=new URLSearchParams,Object.keys(a).filter(function(w){return a[w]!==null}).map(function(w){return p.set(w,a[w])}),c.search=p.toString()),!((n=u.headers)===null||n===void 0)&&n["Content-Type"]||(o=JSON.stringify(o)),f=tn(tn({},this.headers),u.headers),v.label=1;case 1:return v.trys.push([1,6,,7]),m=this.httpClient?this.httpClient:fetch,h=m(c.toString(),tn(tn(tn({},u),this.requestConfig),{method:r,body:o,headers:f})),this.httpClient?[4,h]:[3,3];case 2:return[2,v.sent()];case 3:return[4,h.then(function(w){return I0e(w)})];case 4:return b=v.sent(),[4,b.json().catch(function(){})];case 5:return y=v.sent(),[2,y];case 6:return T=v.sent(),E=T.stack,R0e(T,E,c.toString()),[3,7];case 7:return[2]}})})},e.prototype.get=function(t,n,r){return Ne(this,void 0,void 0,function(){return Oe(this,function(i){switch(i.label){case 0:return[4,this.request({method:"GET",url:t,params:n,config:r})];case 1:return[2,i.sent()]}})})},e.prototype.post=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"POST",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.put=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"PUT",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.patch=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"PATCH",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e.prototype.delete=function(t,n,r,i){return Ne(this,void 0,void 0,function(){return Oe(this,function(a){switch(a.label){case 0:return[4,this.request({method:"DELETE",url:t,body:n,params:r,config:i})];case 1:return[2,a.sent()]}})})},e}(),Pn=function(){function e(t){this.taskUid=t.taskUid,this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.enqueuedAt=new Date(t.enqueuedAt)}return e}(),XI=function(){function e(t){this.indexUid=t.indexUid,this.status=t.status,this.type=t.type,this.uid=t.uid,this.details=t.details,this.canceledBy=t.canceledBy,this.error=t.error,this.duration=t.duration,this.startedAt=new Date(t.startedAt),this.enqueuedAt=new Date(t.enqueuedAt),this.finishedAt=new Date(t.finishedAt)}return e}(),IP=function(){function e(t){this.httpRequest=new Qg(t)}return e.prototype.getTask=function(t){return Ne(this,void 0,void 0,function(){var n,r;return Oe(this,function(i){switch(i.label){case 0:return n="tasks/".concat(t),[4,this.httpRequest.get(n)];case 1:return r=i.sent(),[2,new XI(r)]}})})},e.prototype.getTasks=function(t){return t===void 0&&(t={}),Ne(this,void 0,void 0,function(){var n,r;return Oe(this,function(i){switch(i.label){case 0:return n="tasks",[4,this.httpRequest.get(n,k4(t))];case 1:return r=i.sent(),[2,tn(tn({},r),{results:r.results.map(function(a){return new XI(a)})})]}})})},e.prototype.waitForTask=function(t,n){var r=n===void 0?{}:n,i=r.timeOutMs,a=i===void 0?5e3:i,o=r.intervalMs,s=o===void 0?50:o;return Ne(this,void 0,void 0,function(){var u,c;return Oe(this,function(p){switch(p.label){case 0:u=Date.now(),p.label=1;case 1:return Date.now()-u"u"?this.tokens.generateTenantToken(n,r,i):e.prototype.generateTenantToken.call(this,n,r,i)},t}($0e);const NP=pf({name:"uiState",initialState:{bottomMessage:void 0,bottomMessageCloseTimeout:void 0,showDialog:!1,dialogMessage:"",dialogEntryOn:!1,displayBottomMessageOnBottom:!0},reducers:{setBottomMessage:(e,t)=>{e.bottomMessage=t.payload},setBottomMessageCloseTimeout:(e,t)=>{e.bottomMessageCloseTimeout&&clearTimeout(e.bottomMessageCloseTimeout),e.bottomMessageCloseTimeout=t.payload},setDialogMessage:(e,t)=>{e.dialogMessage=t.payload},setDialogEntryOn:(e,t)=>{e.dialogEntryOn=t.payload},setShowDialog:(e,t)=>{e.showDialog=t.payload},setDisplayBottomMessageOnBottom:(e,t)=>{e.displayBottomMessageOnBottom=t.payload}}}),{setBottomMessage:pu,setBottomMessageCloseTimeout:QI,setDialogMessage:I4,setDialogEntryOn:q0e,setShowDialog:lc,setDisplayBottomMessageOnBottom:K0e}=NP.actions,Y0e=NP.reducer,X0e=He(_p)` @@ -455,7 +455,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili opacity: 0.7; `} } -`;function Q0e(e){const t=St(i=>i.config.vscMediaUrl),[n,r]=C.useState(localStorage.getItem("continueButtonColor"));return C.useEffect(()=>{const i=a=>{a.key==="continueButtonColor"&&r(a.newValue)};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),R.jsx(X0e,{showStop:e.showStop,color:n,hidden:e.hidden,style:{fontSize:"10px"},className:"m-auto press-start-2p",onClick:e.disabled?void 0:e.onClick,isDisabled:e.disabled,children:e.showStop?R.jsxs(R.Fragment,{children:[R.jsx(nZ,{width:"18px",height:"18px"}),"STOP"]}):R.jsxs(R.Fragment,{children:[t?R.jsx("img",{src:`${t}/play_button.png`,height:"18px"}):R.jsx(kL,{width:"18px",height:"18px"}),"CONTINUE"]})})}const OP=pf({name:"misc",initialState:{takenAction:!1,serverStatusMessage:"Continue Server Starting"},reducers:{setTakenActionTrue:(e,t)=>{e.takenAction=!0},setServerStatusMessage:(e,t)=>{e.serverStatusMessage=t.payload}}}),{setTakenActionTrue:wd,setServerStatusMessage:Z0e}=OP.actions,J0e=OP.reducer,ehe=(e,t,n)=>{const r=Rg(e);if(r&&e.key==="Backspace"){e.preventDefault();const i=e.target.selectionStart,a=e.target.selectionEnd;if(i!==a){const o=t.slice(0,i)+t.slice(a);n(o),e.target.selectionStart=i,e.target.selectionEnd=i}else{const o=t.lastIndexOf(` +`;function Q0e(e){const t=wt(i=>i.config.vscMediaUrl),[n,r]=C.useState(localStorage.getItem("continueButtonColor"));return C.useEffect(()=>{const i=a=>{a.key==="continueButtonColor"&&r(a.newValue)};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]),R.jsx(X0e,{showStop:e.showStop,color:n,hidden:e.hidden,style:{fontSize:"10px"},className:"m-auto press-start-2p",onClick:e.disabled?void 0:e.onClick,isDisabled:e.disabled,children:e.showStop?R.jsxs(R.Fragment,{children:[R.jsx(nZ,{width:"18px",height:"18px"}),"STOP"]}):R.jsxs(R.Fragment,{children:[t?R.jsx("img",{src:`${t}/play_button.png`,height:"18px"}):R.jsx(kL,{width:"18px",height:"18px"}),"CONTINUE"]})})}const OP=pf({name:"misc",initialState:{takenAction:!1,serverStatusMessage:"Continue Server Starting"},reducers:{setTakenActionTrue:(e,t)=>{e.takenAction=!0},setServerStatusMessage:(e,t)=>{e.serverStatusMessage=t.payload}}}),{setTakenActionTrue:wd,setServerStatusMessage:Z0e}=OP.actions,J0e=OP.reducer,ehe=(e,t,n)=>{const r=Rg(e);if(r&&e.key==="Backspace"){e.preventDefault();const i=e.target.selectionStart,a=e.target.selectionEnd;if(i!==a){const o=t.slice(0,i)+t.slice(a);n(o),e.target.selectionStart=i,e.target.selectionEnd=i}else{const o=t.lastIndexOf(` `,i-1),s=t.slice(0,o+1)+t.slice(i);n(s),e.target.selectionStart=o+1,e.target.selectionEnd=o+1}}else if(r){const i=e.target.selectionStart,a=e.target.selectionEnd;let o=i,s=a;const u=e.shiftKey;if(e.key==="ArrowLeft"){const c=t.lastIndexOf(` `,i-1);o=c===-1?0:c+1,s=u?a:o}else if(e.key==="ArrowRight"){const c=t.indexOf(` `,i);s=c===-1?t.length:c,o=u?o:s}e.target.selectionStart=o,e.target.selectionEnd=s,e.preventDefault()}},the=(e,t,n)=>{const r=e.target.selectionStart,i=e.target.selectionEnd,a=Rg(e);if(a&&e.key==="Backspace")if(e.preventDefault(),r!==i){const o=t.slice(0,r)+t.slice(i);n(o),e.target.selectionStart=r,e.target.selectionEnd=r}else{const o=t.slice(0,r).trimEnd().lastIndexOf(" "),s=t.slice(0,o+1)+t.slice(r);n(s),console.log(o),setTimeout(()=>{e.target.selectionStart=o+1,e.target.selectionEnd=o+1},10)}else if(a&&e.key==="c"){if(e.preventDefault(),e.stopPropagation(),r!==i){const o=t.slice(r,i);navigator.clipboard.writeText(o)}}else a&&e.key==="v"&&(e.preventDefault(),e.stopPropagation(),navigator.clipboard.readText().then(o=>{const s=t.slice(0,r)+o+t.slice(i);n(s);const u=r+o.length;setTimeout(()=>{e.target.selectionStart=u,e.target.selectionEnd=u},10)}))},nhe="continue_context_items",rhe=Wm` @@ -606,7 +606,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili ${({isLastItem:e})=>e&&"border-bottom: 1px solid gray;"} cursor: pointer; z-index: 500; -`,JI=ut.forwardRef((e,t)=>{var Se,De,ze,Ye,Gt,ue,ve,qe;const n=St(H=>H.serverState.meilisearchUrl||"http://127.0.0.1:7700"),[r,i]=C.useState(void 0);C.useEffect(()=>{const H=new W0e({host:n});i(H)},[n]);const a=C.useContext(eo),o=Io(),s=St(H=>H.config.workspacePaths);St(H=>H.sessionState.history);const[u,c]=ut.useState([]),[p,f]=ut.useState(0),[m,h]=ut.useState([]),b=ut.useRef(null);C.useEffect(()=>{b.current&&(b.current.style.height="auto",b.current.style.height=Math.min(b.current.scrollHeight,300)+"px")},[(Se=b.current)==null?void 0:Se.scrollHeight,(De=b.current)==null?void 0:De.clientHeight,(ze=b.current)==null?void 0:ze.value]);const[y,T]=C.useState(!1),[E,v]=C.useState(void 0),[w,A]=C.useState(void 0),N=St(H=>H.serverState.slashCommands).map(H=>({name:`/${H.name}`,description:H.description})),x=St(H=>typeof e.index<"u"?H.sessionState.contextItemsAtIndex[e.index]||[]:H.sessionState.context_items),D=St(H=>H.sessionState.history),B=St(H=>H.sessionState.active);C.useEffect(()=>{y||(v(void 0),A(void 0))},[y]);const V=St(H=>H.serverState.contextProviders),P=()=>{T(!1),v(void 0),A(void 0),se.setInputValue("@")};C.useEffect(()=>{E||h((V==null?void 0:V.map(H=>({name:H.display_title,description:H.description,id:H.title})).sort((H,me)=>H.id==="file"?-1:1))||[])},[E]);const[Z,$]=C.useState(""),oe=C.useCallback(async(H,me)=>{const We=await(a==null?void 0:a.getContextItem(H,me));e.isMainInput?o(CP(We)):typeof e.index<"u"&&o(xP({item:We,index:e.index}))},[a,e.index]),pe=C.useCallback(({inputValue:H,highlightedIndex:me})=>{var We;if(!H){h([]),v(void 0),T(!1);return}if(Z===""&&(V!=null&&V.some(ge=>ge.display_title===H))){se.setInputValue(""),$("");return}if($(H),w&&!H.startsWith(`@${w.title}`)&&A(void 0),(We=e.onInputValueChange)==null||We.call(e,H),H.endsWith("@")||y){const ge=(H==null?void 0:H.split("@"))||[];if(ge.length>1){T(!0);const j=ge[ge.length-1]||"";if(E&&!H.endsWith("@")){const W=j.split(" ");ce(E.title,W.length>1?W[1]:"").then(ne=>{h(ne)})}else{const W=(V==null?void 0:V.filter(ne=>`@${ne.title}`.toLowerCase().startsWith(H.toLowerCase())||`@${ne.display_title}`.toLowerCase().startsWith(H.toLowerCase())).map(ne=>({name:ne.display_title,description:ne.description,id:ne.title})).sort((ne,_e)=>ne.id==="file"?-1:1))||[];h(W),T(!0)}return}else T(!1),v(void 0)}v(void 0),h((N==null?void 0:N.filter(ge=>{const j=ge.name.toLowerCase(),W=H.toLowerCase();return j.startsWith(W)&&j!==W}))||[]),(H.startsWith("/")||H.startsWith("@"))&&o(wd(null))},[N,y,E,w]),ce=async(H,me)=>{const We=s&&s.length>0?`workspace_dir IN [ ${s.map(ge=>`"${ge}"`).join(", ")} ] AND provider_name = '${H}'`:void 0;try{const ge=await(r==null?void 0:r.index(nhe).search(me,{filter:We}));return(ge==null?void 0:ge.hits.map(j=>({name:j.name,description:j.description,id:j.id,content:j.content})))||[]}catch(ge){return console.log("Error searching context items",ge),[]}},{getInputProps:Le,...se}=JF({onInputValueChange:pe,items:m,itemToString(H){return H?H.name:""}});C.useEffect(()=>{se.highlightedIndex<0&&se.setHighlightedIndex(0)},[se.inputValue]);const le=ut.useRef(null),he=ut.useRef(null),I=()=>{var H;return(((H=le.current)==null?void 0:H.getBoundingClientRect().top)||Number.MAX_SAFE_INTEGER)>DP};C.useImperativeHandle(t,()=>se,[se]);const X=ut.useRef(null),ae=C.useCallback(()=>{var ge;if(Ee(!0),!X.current)return;const H=X.current.querySelectorAll(`.pill-button-${e.index||"main"}`),me=Array.from(H),We=me.findIndex(j=>j===document.activeElement);if(We===me.length-1)(ge=b.current)==null||ge.focus();else if(We!==-1){const j=me[(We+1)%me.length];j==null||j.focus()}else{const j=me[0];j==null||j.focus()}},[e.index]);C.useEffect(()=>{if(b.current){const H=me=>{me.key==="Tab"&&(me.preventDefault(),ae())};return b.current.addEventListener("keydown",H),()=>{var me;(me=b.current)==null||me.removeEventListener("keydown",H)}}},[b.current]),C.useEffect(()=>{e.value&&se.setInputValue(e.value)},[e.value,se.setInputValue]);const[O,Q]=C.useState(!1);C.useLayoutEffect(()=>{he.current&&se.setHighlightedIndex(0)},[m,se.setHighlightedIndex,he.current]);const[be,q]=C.useState(!1),[we,te]=C.useState(!1);C.useEffect(()=>{const H=We=>{We.key==="Meta"&&q(!0)},me=We=>{We.key==="Meta"&&q(!1)};return window.addEventListener("keydown",H),window.addEventListener("keyup",me),()=>{window.removeEventListener("keydown",H),window.removeEventListener("keyup",me)}},[]),C.useEffect(()=>{if(!b.current||!e.isMainInput)return;e.isMainInput&&b.current.focus();const H=me=>{var We;me.data.type==="focusContinueInput"?(b.current.focus(),o(wd(null))):me.data.type==="focusContinueInputWithEdit"?(b.current.focus(),(We=b.current)!=null&&We.value.startsWith("/edit")||se.setInputValue("/edit "),o(wd(null))):me.data.type==="focusContinueInputWithNewSession"&&(a==null||a.stopSession(),o(F2()),o(wd(null)))};return window.addEventListener("message",H),()=>{window.removeEventListener("message",H)}},[b.current,e.isMainInput]);const Me=ut.useRef(null),Re=C.useCallback(H=>{const me=m[se.highlightedIndex],We=me==null?void 0:me.name,ge=V.find(j=>j.display_title===We);if(ge){if(ge.dynamic&&ge.requires_query){A(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}else if(ge.dynamic){if(!me.id)return;const j=se.inputValue.split("@"),W=j[j.length-1];if(oe(me.id,W),se.inputValue.includes("@")){const ne=V.find(_e=>_e.title===me.id);!E&&!(ne!=null&&ne.dynamic)?(se.setInputValue(`@${me.id} `),v(ne)):se.setInputValue("")}se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}}else{if(E&&me.id){oe(me.id,""),se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}v(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault(),ce(ge.title,"").then(j=>h(j))},[m,se.highlightedIndex,V,E,se.inputValue,oe]),[Qe,Ve]=C.useState(!1),[dt,ot]=C.useState(!1),[Ge,pt]=C.useState(void 0),[U,re]=C.useState(void 0),de=ut.useRef(null),[ke,Ee]=C.useState(!1);return C.useEffect(()=>{we||Ee(!1)},[we]),R.jsxs("div",{ref:de,style:{paddingTop:"4px",backgroundColor:Vt},children:[x.length===0&&e.isMainInput&&R.jsxs("div",{style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",paddingTop:ir(),width:"calc(100% - 24px)"},children:[R.jsx("span",{onClick:()=>{var H;se.setInputValue("@"),(H=b.current)==null||H.focus()},className:"hover:underline cursor-pointer",children:"+ Add Context"}),(((Ye=se.inputValue)==null?void 0:Ye.startsWith("/edit"))||we&&be&&((Gt=se.inputValue)==null?void 0:Gt.length)>0)&&R.jsx("span",{className:"float-right",children:"Inserting at cursor"})]}),e.isMainInput||x.length>0&&ke?R.jsxs("div",{className:"px-2 flex gap-2 items-center flex-wrap",ref:X,style:{backgroundColor:Vt},children:[x.length>0&&R.jsx("div",{className:"cursor-pointer",onClick:H=>{ot(me=>!me)},id:"toggle-context-div",children:dt?R.jsx(gQ,{width:"14px",height:"14px",color:Et}):R.jsx(yQ,{width:"14px",height:"14px",color:Et})}),R.jsx(ahe,{className:x.length>0?`pill-button-${e.index||"main"}`:"",onClick:()=>{var H;o(x4({ids:x.map(me=>me.description.id),index:e.index})),(H=b.current)==null||H.focus(),pt(void 0),re(void 0)},onKeyDown:H=>{var me;H.key==="Backspace"&&(o(x4({ids:x.map(We=>We.description.id),index:e.index})),(me=b.current)==null||me.focus(),pt(void 0),re(void 0))},children:R.jsx(NL,{width:"1.4em",height:"1.4em"})}),x.map((H,me)=>{var We,ge,j,W;return R.jsx(x0e,{inputIndex:e.index,areMultipleItems:x.length>1,item:H,editing:H.editing&&((ge=(We=b.current)==null?void 0:We.value)==null?void 0:ge.startsWith("/edit")),editingAny:(W=(j=b.current)==null?void 0:j.value)==null?void 0:W.startsWith("/edit"),stepIndex:e.index,index:me,onDelete:()=>{var ne;o(x4({ids:[H.description.id],index:e.index})),(ne=b.current)==null||ne.focus(),(H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name||H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name)&&(pt(void 0),re(void 0))},onClick:ne=>{H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name?re(void 0):re(H)},onBlur:()=>{re(void 0)},toggleViewContent:()=>{pt(ne=>{if(!ne)return H;if(!(ne.description.id.item_id===H.description.id.item_id&&ne.description.id.provider_name===H.description.id.provider_name))return H})},previewing:H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name,focusing:H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name,prefixInputWithEdit:ne=>{var _e,Ze,Fe;!ne&&((_e=b.current)!=null&&_e.value.startsWith("/edit"))&&se.setInputValue((Ze=b.current)==null?void 0:Ze.value.replace("/edit ","")),!se.inputValue.startsWith("/edit")&&(se.setInputValue(`/edit ${se.inputValue}`),(Fe=b.current)==null||Fe.focus())}},`${H.description.id.item_id}${me}`)})]}):x.length>0&&R.jsxs("div",{onClick:()=>{var H;(H=b.current)==null||H.focus(),Ee(!0)},style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",cursor:"default",paddingTop:ir(),width:"fit-content"},children:[e.active?"Using":"Used"," ",x.length," ","context item",x.length===1?"":"s"]}),Ge&&R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(Ge.description.description)} +`,JI=ut.forwardRef((e,t)=>{var Se,De,ze,Ye,Gt,ue,ve,qe;const n=wt(H=>H.serverState.meilisearchUrl||"http://127.0.0.1:7700"),[r,i]=C.useState(void 0);C.useEffect(()=>{const H=new W0e({host:n});i(H)},[n]);const a=C.useContext(eo),o=Io(),s=wt(H=>H.config.workspacePaths);wt(H=>H.sessionState.history);const[u,c]=ut.useState([]),[p,f]=ut.useState(0),[m,h]=ut.useState([]),b=ut.useRef(null);C.useEffect(()=>{b.current&&(b.current.style.height="auto",b.current.style.height=Math.min(b.current.scrollHeight,300)+"px")},[(Se=b.current)==null?void 0:Se.scrollHeight,(De=b.current)==null?void 0:De.clientHeight,(ze=b.current)==null?void 0:ze.value]);const[y,T]=C.useState(!1),[E,v]=C.useState(void 0),[w,A]=C.useState(void 0),N=wt(H=>H.serverState.slashCommands).map(H=>({name:`/${H.name}`,description:H.description})),x=wt(H=>typeof e.index<"u"?H.sessionState.contextItemsAtIndex[e.index]||[]:H.sessionState.context_items),D=wt(H=>H.sessionState.history),B=wt(H=>H.sessionState.active);C.useEffect(()=>{y||(v(void 0),A(void 0))},[y]);const V=wt(H=>H.serverState.contextProviders),P=()=>{T(!1),v(void 0),A(void 0),se.setInputValue("@")};C.useEffect(()=>{E||h((V==null?void 0:V.map(H=>({name:H.display_title,description:H.description,id:H.title})).sort((H,me)=>H.id==="file"?-1:1))||[])},[E]);const[Z,$]=C.useState(""),oe=C.useCallback(async(H,me)=>{const We=await(a==null?void 0:a.getContextItem(H,me));e.isMainInput?o(CP(We)):typeof e.index<"u"&&o(xP({item:We,index:e.index}))},[a,e.index]),pe=C.useCallback(({inputValue:H,highlightedIndex:me})=>{var We;if(!H){h([]),v(void 0),T(!1);return}if(Z===""&&(V!=null&&V.some(ge=>ge.display_title===H))){se.setInputValue(""),$("");return}if($(H),w&&!H.startsWith(`@${w.title}`)&&A(void 0),(We=e.onInputValueChange)==null||We.call(e,H),H.endsWith("@")||y){const ge=(H==null?void 0:H.split("@"))||[];if(ge.length>1){T(!0);const j=ge[ge.length-1]||"";if(E&&!H.endsWith("@")){const W=j.split(" ");ce(E.title,W.length>1?W[1]:"").then(ne=>{h(ne)})}else{const W=(V==null?void 0:V.filter(ne=>`@${ne.title}`.toLowerCase().startsWith(H.toLowerCase())||`@${ne.display_title}`.toLowerCase().startsWith(H.toLowerCase())).map(ne=>({name:ne.display_title,description:ne.description,id:ne.title})).sort((ne,_e)=>ne.id==="file"?-1:1))||[];h(W),T(!0)}return}else T(!1),v(void 0)}v(void 0),h((N==null?void 0:N.filter(ge=>{const j=ge.name.toLowerCase(),W=H.toLowerCase();return j.startsWith(W)&&j!==W}))||[]),(H.startsWith("/")||H.startsWith("@"))&&o(wd(null))},[N,y,E,w]),ce=async(H,me)=>{const We=s&&s.length>0?`workspace_dir IN [ ${s.map(ge=>`"${ge}"`).join(", ")} ] AND provider_name = '${H}'`:void 0;try{const ge=await(r==null?void 0:r.index(nhe).search(me,{filter:We}));return(ge==null?void 0:ge.hits.map(j=>({name:j.name,description:j.description,id:j.id,content:j.content})))||[]}catch(ge){return console.log("Error searching context items",ge),[]}},{getInputProps:Le,...se}=JF({onInputValueChange:pe,items:m,itemToString(H){return H?H.name:""}});C.useEffect(()=>{se.highlightedIndex<0&&se.setHighlightedIndex(0)},[se.inputValue]);const le=ut.useRef(null),he=ut.useRef(null),I=()=>{var H;return(((H=le.current)==null?void 0:H.getBoundingClientRect().top)||Number.MAX_SAFE_INTEGER)>DP};C.useImperativeHandle(t,()=>se,[se]);const X=ut.useRef(null),ae=C.useCallback(()=>{var ge;if(Ee(!0),!X.current)return;const H=X.current.querySelectorAll(`.pill-button-${e.index||"main"}`),me=Array.from(H),We=me.findIndex(j=>j===document.activeElement);if(We===me.length-1)(ge=b.current)==null||ge.focus();else if(We!==-1){const j=me[(We+1)%me.length];j==null||j.focus()}else{const j=me[0];j==null||j.focus()}},[e.index]);C.useEffect(()=>{if(b.current){const H=me=>{me.key==="Tab"&&(me.preventDefault(),ae())};return b.current.addEventListener("keydown",H),()=>{var me;(me=b.current)==null||me.removeEventListener("keydown",H)}}},[b.current]),C.useEffect(()=>{e.value&&se.setInputValue(e.value)},[e.value,se.setInputValue]);const[O,Q]=C.useState(!1);C.useLayoutEffect(()=>{he.current&&se.setHighlightedIndex(0)},[m,se.setHighlightedIndex,he.current]);const[be,q]=C.useState(!1),[we,te]=C.useState(!1);C.useEffect(()=>{const H=We=>{We.key==="Meta"&&q(!0)},me=We=>{We.key==="Meta"&&q(!1)};return window.addEventListener("keydown",H),window.addEventListener("keyup",me),()=>{window.removeEventListener("keydown",H),window.removeEventListener("keyup",me)}},[]),C.useEffect(()=>{if(!b.current||!e.isMainInput)return;e.isMainInput&&b.current.focus();const H=me=>{var We;me.data.type==="focusContinueInput"?(b.current.focus(),o(wd(null))):me.data.type==="focusContinueInputWithEdit"?(b.current.focus(),(We=b.current)!=null&&We.value.startsWith("/edit")||se.setInputValue("/edit "),o(wd(null))):me.data.type==="focusContinueInputWithNewSession"&&(a==null||a.stopSession(),o(F2()),o(wd(null)))};return window.addEventListener("message",H),()=>{window.removeEventListener("message",H)}},[b.current,e.isMainInput]);const Me=ut.useRef(null),Re=C.useCallback(H=>{const me=m[se.highlightedIndex],We=me==null?void 0:me.name,ge=V.find(j=>j.display_title===We);if(ge){if(ge.dynamic&&ge.requires_query){A(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}else if(ge.dynamic){if(!me.id)return;const j=se.inputValue.split("@"),W=j[j.length-1];if(oe(me.id,W),se.inputValue.includes("@")){const ne=V.find(_e=>_e.title===me.id);!E&&!(ne!=null&&ne.dynamic)?(se.setInputValue(`@${me.id} `),v(ne)):se.setInputValue("")}se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}}else{if(E&&me.id){oe(me.id,""),se.setInputValue(""),T(!1),v(void 0),A(void 0),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault();return}v(ge),se.setInputValue(`@${ge.title} `),H.nativeEvent.preventDownshiftDefault=!0,H.preventDefault(),ce(ge.title,"").then(j=>h(j))},[m,se.highlightedIndex,V,E,se.inputValue,oe]),[Qe,Ve]=C.useState(!1),[dt,ot]=C.useState(!1),[Ge,pt]=C.useState(void 0),[U,re]=C.useState(void 0),de=ut.useRef(null),[ke,Ee]=C.useState(!1);return C.useEffect(()=>{we||Ee(!1)},[we]),R.jsxs("div",{ref:de,style:{paddingTop:"4px",backgroundColor:Vt},children:[x.length===0&&e.isMainInput&&R.jsxs("div",{style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",paddingTop:ir(),width:"calc(100% - 24px)"},children:[R.jsx("span",{onClick:()=>{var H;se.setInputValue("@"),(H=b.current)==null||H.focus()},className:"hover:underline cursor-pointer",children:"+ Add Context"}),(((Ye=se.inputValue)==null?void 0:Ye.startsWith("/edit"))||we&&be&&((Gt=se.inputValue)==null?void 0:Gt.length)>0)&&R.jsx("span",{className:"float-right",children:"Inserting at cursor"})]}),e.isMainInput||x.length>0&&ke?R.jsxs("div",{className:"px-2 flex gap-2 items-center flex-wrap",ref:X,style:{backgroundColor:Vt},children:[x.length>0&&R.jsx("div",{className:"cursor-pointer",onClick:H=>{ot(me=>!me)},id:"toggle-context-div",children:dt?R.jsx(gQ,{width:"14px",height:"14px",color:Et}):R.jsx(yQ,{width:"14px",height:"14px",color:Et})}),R.jsx(ahe,{className:x.length>0?`pill-button-${e.index||"main"}`:"",onClick:()=>{var H;o(x4({ids:x.map(me=>me.description.id),index:e.index})),(H=b.current)==null||H.focus(),pt(void 0),re(void 0)},onKeyDown:H=>{var me;H.key==="Backspace"&&(o(x4({ids:x.map(We=>We.description.id),index:e.index})),(me=b.current)==null||me.focus(),pt(void 0),re(void 0))},children:R.jsx(NL,{width:"1.4em",height:"1.4em"})}),x.map((H,me)=>{var We,ge,j,W;return R.jsx(x0e,{inputIndex:e.index,areMultipleItems:x.length>1,item:H,editing:H.editing&&((ge=(We=b.current)==null?void 0:We.value)==null?void 0:ge.startsWith("/edit")),editingAny:(W=(j=b.current)==null?void 0:j.value)==null?void 0:W.startsWith("/edit"),stepIndex:e.index,index:me,onDelete:()=>{var ne;o(x4({ids:[H.description.id],index:e.index})),(ne=b.current)==null||ne.focus(),(H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name||H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name)&&(pt(void 0),re(void 0))},onClick:ne=>{H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name?re(void 0):re(H)},onBlur:()=>{re(void 0)},toggleViewContent:()=>{pt(ne=>{if(!ne)return H;if(!(ne.description.id.item_id===H.description.id.item_id&&ne.description.id.provider_name===H.description.id.provider_name))return H})},previewing:H.description.id.item_id===(Ge==null?void 0:Ge.description.id.item_id)&&(Ge==null?void 0:Ge.description.id.provider_name)===H.description.id.provider_name,focusing:H.description.id.item_id===(U==null?void 0:U.description.id.item_id)&&(U==null?void 0:U.description.id.provider_name)===H.description.id.provider_name,prefixInputWithEdit:ne=>{var _e,Ze,Fe;!ne&&((_e=b.current)!=null&&_e.value.startsWith("/edit"))&&se.setInputValue((Ze=b.current)==null?void 0:Ze.value.replace("/edit ","")),!se.inputValue.startsWith("/edit")&&(se.setInputValue(`/edit ${se.inputValue}`),(Fe=b.current)==null||Fe.focus())}},`${H.description.id.item_id}${me}`)})]}):x.length>0&&R.jsxs("div",{onClick:()=>{var H;(H=b.current)==null||H.focus(),Ee(!0)},style:{color:Et,fontSize:"10px",backgroundColor:Vt,paddingLeft:"12px",cursor:"default",paddingTop:ir(),width:"fit-content"},children:[e.active?"Using":"Used"," ",x.length," ","context item",x.length===1?"":"s"]}),Ge&&R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(Ge.description.description)} ${Ge.content} \`\`\``,maxHeight:200})}),dt&&R.jsx("div",{children:x.map(H=>R.jsxs(ohe,{children:[R.jsxs(she,{children:[R.jsx(_y,{height:"20px",width:"20px",filename:H.description.name}),H.description.name]}),R.jsx("pre",{className:"m-0",children:R.jsx(zg,{source:`\`\`\`${qC(H.description.description)} ${H.content} @@ -724,7 +724,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho background-color: #ff02; border-radius: ${At}; padding: 8px 4px; -`;function g2e(e){var f,m;const t=oB(),[n,r]=C.useState(parseInt(localStorage.getItem("stage")||"0")),i=St(h=>h.sessionState.history),a=St(h=>h.serverState.selectedContextItems.some(b=>b.description.id.provider_title==="code")),[o,s]=C.useState(!1),[u,c]=C.useState(0),p=C.useCallback(()=>i.filter(b=>!b.hide&&b.name==="User Input").length-u<=0,[i,u]);return R.jsx(R.Fragment,{children:o||n>YR-1||!p()||parseInt(localStorage.getItem("tutorialClosedCount")||"0")>0||R.jsxs(h2e,{children:[R.jsxs("div",{className:"flex",children:[R.jsx(RL,{width:"1.3em",height:"1.3em",color:"yellow"}),R.jsxs("b",{className:"ml-1",children:["Tutorial (",n+1,"/",YR,")"]})]}),R.jsx("div",{style:{color:jt,paddingLeft:"4px"},children:n{s(!0);const h=parseInt(localStorage.getItem("tutorialClosedCount")||"0");localStorage.setItem("tutorialClosedCount",(h+1).toString()),t==null||t.capture("tutorial_closed",{stage:n,tutorialClosedCount:h})},children:R.jsx(Qm,{width:"1.2em",height:"1.2em"})}),R.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:(m=Gh[n])==null?void 0:m.map((h,b)=>R.jsx(f2e,{disabled:!a,...h,onClick:()=>{a&&(e.onClick(h.textInput),t==null||t.capture("tutorial_stage_complete",{stage:n}),r(n+1),localStorage.setItem("stage",(n+1).toString()),s(!0),c(y=>y+1))}},b))})]})})}const m2e=He.div` +`;function g2e(e){var f,m;const t=oB(),[n,r]=C.useState(parseInt(localStorage.getItem("stage")||"0")),i=wt(h=>h.sessionState.history),a=wt(h=>h.serverState.selectedContextItems.some(b=>b.description.id.provider_title==="code")),[o,s]=C.useState(!1),[u,c]=C.useState(0),p=C.useCallback(()=>i.filter(b=>!b.hide&&b.name==="User Input").length-u<=0,[i,u]);return R.jsx(R.Fragment,{children:o||n>YR-1||!p()||parseInt(localStorage.getItem("tutorialClosedCount")||"0")>0||R.jsxs(h2e,{children:[R.jsxs("div",{className:"flex",children:[R.jsx(RL,{width:"1.3em",height:"1.3em",color:"yellow"}),R.jsxs("b",{className:"ml-1",children:["Tutorial (",n+1,"/",YR,")"]})]}),R.jsx("div",{style:{color:jt,paddingLeft:"4px"},children:n{s(!0);const h=parseInt(localStorage.getItem("tutorialClosedCount")||"0");localStorage.setItem("tutorialClosedCount",(h+1).toString()),t==null||t.capture("tutorial_closed",{stage:n,tutorialClosedCount:h})},children:R.jsx(Qm,{width:"1.2em",height:"1.2em"})}),R.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:(m=Gh[n])==null?void 0:m.map((h,b)=>R.jsx(f2e,{disabled:!a,...h,onClick:()=>{a&&(e.onClick(h.textInput),t==null||t.capture("tutorial_stage_complete",{stage:n}),r(n+1),localStorage.setItem("stage",(n+1).toString()),s(!0),c(y=>y+1))}},b))})]})})}const m2e=He.div` overflow-y: scroll; scrollbar-width: none; /* Firefox */ @@ -782,7 +782,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho top: 0; z-index: 100; background-color: ${Vt}; -`;function XR(e){var le,he;const t=C.useContext(eo),n=oB(),r=Io(),i=bs(),a=St(I=>I.sessionState),o=St(I=>{var X;return(X=I.serverState.config.models)==null?void 0:X.default}),s=St(I=>I.misc.serverStatusMessage),u=St(I=>I.serverState.userInputQueue),c=St(I=>I.sessionState.title),p=St(I=>I.sessionState.active),[f,m]=C.useState(!1),[h,b]=C.useState([]),[y,T]=C.useState(!0),[E,v]=C.useState(!0),w=C.useRef(null),A=C.useRef(null),N=C.useRef(null),x=St(I=>I.uiState.bottomMessage),D=St(I=>I.misc.takenAction);C.useEffect(()=>{N.current&&r(K0e(N.current.getBoundingClientRect().top{var X;const I=()=>{var q,we;const O=((q=A.current)==null?void 0:q.scrollTop)||0,Q=((we=A.current)==null?void 0:we.scrollHeight)||0,be=window.innerHeight||0;O+be+-25>=Q?V(!1):V(!0)};return(X=A.current)==null||X.addEventListener("scroll",I),()=>{window.removeEventListener("scroll",I)}},[A.current]),C.useLayoutEffect(()=>{var I,X;B||(X=A.current)==null||X.scrollTo({top:(I=A.current)==null?void 0:I.scrollHeight,behavior:"instant"})},[(le=A.current)==null?void 0:le.scrollHeight,a.history]),C.useEffect(()=>{const I=X=>{X.key==="Backspace"&&Rg(X)&&!X.shiftKey&&p?(t==null||t.stopSession(),r(Xd(!1))):X.key==="Escape"&&r(pu(void 0))};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[t,p]),C.useEffect(()=>{if(t&&y){T(!1);for(const I of u)t.sendMainInput(I)}},[t,u,y]);const P=C.useCallback(I=>{if((o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(!I.startsWith("/")||I.startsWith("/edit"))){const Q=localStorage.getItem("ftc");if(Q){const be=parseInt(Q);if(localStorage.setItem("ftc",(be+1).toString()),be>=250){r(lc(!0)),r(I4(R.jsx(c2e,{}))),n==null||n.capture("ftc_reached");return}}else localStorage.setItem("ftc","1")}m(!0);const X=[...a.history,{name:"User Input",description:I,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:I},hide:!1,depth:0}],ae={history:X,context_items:a.context_items};for(let Q of a.context_items)r(xP({item:Q,index:X.length-1}));t.runFromState(ae),X.push({name:"Generating Response...",description:" ",observations:[],logs:[],step_type:"SimpleChatStep",params:{},hide:!1,depth:0}),r(YI(X)),r(Xd(!0));const O=localStorage.getItem("mainTextEntryCounter");if(O){let Q=parseInt(O);localStorage.setItem("mainTextEntryCounter",(Q+1).toString()),Q===300&&(r(I4(R.jsxs("div",{className:"text-center p-4",children:["👋 Thanks for using Continue. We are a beta product and love working closely with our first users. If you're interested in speaking, enter your name and email. We won't use this information for anything other than reaching out.",R.jsx("br",{}),R.jsx("br",{}),R.jsxs("form",{onSubmit:be=>{be.preventDefault(),n==null||n.capture("user_interest_form",{name:be.target.elements[0].value,email:be.target.elements[1].value}),r(I4(R.jsx("div",{className:"text-center p-4",children:"Thanks! We'll be in touch soon."})))},style:{display:"flex",flexDirection:"column",gap:"10px"},children:[R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"text",name:"name",placeholder:"Name",required:!0}),R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"email",name:"email",placeholder:"Email",required:!0}),R.jsx("button",{style:{padding:"10px",borderRadius:"5px",cursor:"pointer"},type:"submit",children:"Submit"})]})]}))),r(q0e(!1)),r(lc(!0)))}else localStorage.setItem("mainTextEntryCounter","1")},[t,a.history,a.context_items]);C.useEffect(()=>{const I=X=>{X.data.type==="userInput"&&P(X.data.input)};return window.addEventListener("message",I),()=>window.removeEventListener("message",I)},[P]);const Z=I=>{if(r(wd(null)),w.current){let X=w.current.inputValue;if(console.log("Sending main input",X),X.trim()==="")return;if(X.startsWith("#")&&(X.length===7||X.length===4)){localStorage.setItem("continueButtonColor",X),w.current.setInputValue("");return}if(I&&Rg(I)&&(X=`/edit ${X}`),w.current.setInputValue(""),!t){r(Vge(X));return}P(X)}},$=(I,X)=>{t&&t.sendStepUserInput(I,X)},oe=C.useCallback(I=>{let X=!1;for(let ae=I+1;ae{const X=[];let ae=-1;for(let O=I;O>=0;O--)if(typeof a.history[O]<"u"&&a.history[O].name==="User Input"&&a.history[O].hide===!1){X.push(O),ae=O;break}if(X.length===0)return[];for(let O=ae+1;O{const X=pe(I),ae=X[0];b(O=>{const Q=[...O];return Q[I]=!Q[I],!X.some((q,we)=>we>0&&Q[q])?Q[ae]=!1:!X.some((we,te)=>te>0&&!Q[we])&&(Q[ae]=!0),Q})},[pe]);C.useEffect(()=>{c&&se(c)},[c]);const[Le,se]=C.useState(c||"New Session");return R.jsxs(m2e,{ref:A,onKeyDown:I=>{I.key==="Enter"&&I.ctrlKey&&Z()},children:[R.jsxs(v2e,{children:[R.jsx(b2e,{onClick:I=>{I.target.setSelectionRange(0,I.target.value.length)},value:Le,onChange:I=>se(I.target.value),onBlur:I=>{I.target.value===c||typeof c>"u"&&I.target.value==="New Session"||r(kP(I.target.value))},onKeyDown:I=>{I.key==="Enter"?(I.preventDefault(),I.target.blur()):I.key==="Escape"&&(se(c||"New Session"),I.target.blur())}}),R.jsxs("div",{className:"flex gap-2",children:[a.history.filter(I=>!I.hide).length>0&&R.jsx(Ti,{onClick:()=>{t==null||t.stopSession(),r(F2())},text:"New Session (⌥⌘N)",children:R.jsx(IL,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{i("/history")},text:"History",children:R.jsx(OQ,{width:"1.4em",height:"1.4em"})})]})]}),(D||E)&&typeof t>"u"&&R.jsxs(R.Fragment,{children:[R.jsx(jge,{}),R.jsx("p",{style:{textAlign:"center",margin:"0px",fontSize:"14px"},children:s}),R.jsxs("div",{className:"flex mx-8 my-2",children:[R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/troubleshooting",target:"_blank",children:"Troubleshooting help"})})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},onClick:()=>{qa("toggleDevTools",{})},children:R.jsx("u",{children:"View logs"})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/walkthroughs/manually-run-continue#recommended-use-the-continuedev-pypi-package",target:"_blank",children:"Manually start server"})})})]})]}),R.jsx("br",{}),R.jsx(g2e,{onClick:I=>{t==null||t.sendMainInput(I)}}),R.jsx(y2e,{children:a.history.map((I,X)=>I.hide?null:R.jsx(C.Fragment,{children:I.name==="User Input"?I.hide||R.jsx(JI,{isMainInput:!1,value:I.description,active:p&&oe(X),onEnter:(ae,O)=>{if(O){t==null||t.stopSession();const Q=[...a.history.slice(0,X),{name:"User Input",description:O,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:O},hide:!1,depth:0}];r(YI(Q)),r(Xd(!0));const be={history:Q,context_items:a.context_items};console.log("State: ",be),t.runFromState(be)}ae==null||ae.stopPropagation(),ae==null||ae.preventDefault()},groupIndices:pe(X),onToggle:ae=>{b(O=>{const Q=[...O];return pe(X).forEach(be=>{Q[be]=ae}),Q})},onToggleAll:ae=>{b(O=>O.map(Q=>ae))},isToggleOpen:typeof h[X]>"u"?!0:h[X],index:X,onDelete:()=>{pe(X).forEach(ae=>{console.log(ae),r(C4(ae))})}}):R.jsx(Qge,{historyNode:I,iconElement:I.step_type==="DefaultModelEditCodeStep"?R.jsx(wQ,{width:"16px",height:"16px"}):I.error?R.jsx(xL,{width:"16px",height:"16px",color:"red"}):R.jsx(CL,{width:"16px",height:"16px"}),open:typeof h[X]>"u"?!I.error:h[X],onToggle:()=>ce(X),children:I.error?R.jsx(Jge,{onClose:()=>ce(X),error:I.error,onDelete:()=>{r(C4(X))}}):R.jsx(zue,{index:X,isLast:X===a.history.length-1,isFirst:X===0,open:typeof h[X]>"u"?!0:h[X],onUserInput:ae=>{$(ae,X)},step:I,onReverse:()=>{t==null||t.reverseToIndex(X)},onRetry:()=>{t==null||t.retryAtIndex(X),m(!0)},onDelete:()=>{r(C4(X))},noUserInputParent:pe(X).length===0},X)})},X))}),R.jsx("div",{children:(he=u==null?void 0:u.map)==null?void 0:he.call(u,(I,X)=>R.jsx(E2e,{children:I},X))}),R.jsx("div",{ref:N}),R.jsx(JI,{isMainInput:!0,ref:w,onEnter:(I,X)=>{Z(I),I==null||I.stopPropagation(),I==null||I.preventDefault()},onInputValueChange:()=>{},onToggleAddContext:()=>{t==null||t.toggleAddingHighlightedCode()}})]})}const _2e=He.div` +`;function XR(e){var le,he;const t=C.useContext(eo),n=oB(),r=Io(),i=bs(),a=wt(I=>I.sessionState),o=wt(I=>{var X;return(X=I.serverState.config.models)==null?void 0:X.default}),s=wt(I=>I.misc.serverStatusMessage),u=wt(I=>I.serverState.userInputQueue),c=wt(I=>I.sessionState.title),p=wt(I=>I.sessionState.active),[f,m]=C.useState(!1),[h,b]=C.useState([]),[y,T]=C.useState(!0),[E,v]=C.useState(!1);C.useEffect(()=>{setTimeout(()=>{v(!0)},5e3)},[]);const w=C.useRef(null),A=C.useRef(null),N=C.useRef(null),x=wt(I=>I.uiState.bottomMessage),D=wt(I=>I.misc.takenAction);C.useEffect(()=>{N.current&&r(K0e(N.current.getBoundingClientRect().top{var X;const I=()=>{var q,we;const O=((q=A.current)==null?void 0:q.scrollTop)||0,Q=((we=A.current)==null?void 0:we.scrollHeight)||0,be=window.innerHeight||0;O+be+-25>=Q?V(!1):V(!0)};return(X=A.current)==null||X.addEventListener("scroll",I),()=>{window.removeEventListener("scroll",I)}},[A.current]),C.useLayoutEffect(()=>{var I,X;B||(X=A.current)==null||X.scrollTo({top:(I=A.current)==null?void 0:I.scrollHeight,behavior:"instant"})},[(le=A.current)==null?void 0:le.scrollHeight,a.history]),C.useEffect(()=>{const I=X=>{X.key==="Backspace"&&Rg(X)&&!X.shiftKey&&p?(t==null||t.stopSession(),r(Xd(!1))):X.key==="Escape"&&r(pu(void 0))};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[t,p]),C.useEffect(()=>{if(t&&y){T(!1);for(const I of u)t.sendMainInput(I)}},[t,u,y]);const P=C.useCallback(I=>{if((o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(!I.startsWith("/")||I.startsWith("/edit"))){const Q=localStorage.getItem("ftc");if(Q){const be=parseInt(Q);if(localStorage.setItem("ftc",(be+1).toString()),be>=250){r(lc(!0)),r(I4(R.jsx(c2e,{}))),n==null||n.capture("ftc_reached");return}}else localStorage.setItem("ftc","1")}m(!0);const X=[...a.history,{name:"User Input",description:I,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:I},hide:!1,depth:0}],ae={history:X,context_items:a.context_items};for(let Q of a.context_items)r(xP({item:Q,index:X.length-1}));t.runFromState(ae),X.push({name:"Generating Response...",description:" ",observations:[],logs:[],step_type:"SimpleChatStep",params:{},hide:!1,depth:0}),r(YI(X)),r(Xd(!0));const O=localStorage.getItem("mainTextEntryCounter");if(O){let Q=parseInt(O);localStorage.setItem("mainTextEntryCounter",(Q+1).toString()),Q===300&&(r(I4(R.jsxs("div",{className:"text-center p-4",children:["👋 Thanks for using Continue. We are a beta product and love working closely with our first users. If you're interested in speaking, enter your name and email. We won't use this information for anything other than reaching out.",R.jsx("br",{}),R.jsx("br",{}),R.jsxs("form",{onSubmit:be=>{be.preventDefault(),n==null||n.capture("user_interest_form",{name:be.target.elements[0].value,email:be.target.elements[1].value}),r(I4(R.jsx("div",{className:"text-center p-4",children:"Thanks! We'll be in touch soon."})))},style:{display:"flex",flexDirection:"column",gap:"10px"},children:[R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"text",name:"name",placeholder:"Name",required:!0}),R.jsx("input",{style:{padding:"10px",borderRadius:"5px"},type:"email",name:"email",placeholder:"Email",required:!0}),R.jsx("button",{style:{padding:"10px",borderRadius:"5px",cursor:"pointer"},type:"submit",children:"Submit"})]})]}))),r(q0e(!1)),r(lc(!0)))}else localStorage.setItem("mainTextEntryCounter","1")},[t,a.history,a.context_items]);C.useEffect(()=>{const I=X=>{X.data.type==="userInput"&&P(X.data.input)};return window.addEventListener("message",I),()=>window.removeEventListener("message",I)},[P]);const Z=I=>{if(r(wd(null)),w.current){let X=w.current.inputValue;if(console.log("Sending main input",X),X.trim()==="")return;if(X.startsWith("#")&&(X.length===7||X.length===4)){localStorage.setItem("continueButtonColor",X),w.current.setInputValue("");return}if(I&&Rg(I)&&(X=`/edit ${X}`),w.current.setInputValue(""),!t){r(Vge(X));return}P(X)}},$=(I,X)=>{t&&t.sendStepUserInput(I,X)},oe=C.useCallback(I=>{let X=!1;for(let ae=I+1;ae{const X=[];let ae=-1;for(let O=I;O>=0;O--)if(typeof a.history[O]<"u"&&a.history[O].name==="User Input"&&a.history[O].hide===!1){X.push(O),ae=O;break}if(X.length===0)return[];for(let O=ae+1;O{const X=pe(I),ae=X[0];b(O=>{const Q=[...O];return Q[I]=!Q[I],!X.some((q,we)=>we>0&&Q[q])?Q[ae]=!1:!X.some((we,te)=>te>0&&!Q[we])&&(Q[ae]=!0),Q})},[pe]);C.useEffect(()=>{c&&se(c)},[c]);const[Le,se]=C.useState(c||"New Session");return R.jsxs(m2e,{ref:A,onKeyDown:I=>{I.key==="Enter"&&I.ctrlKey&&Z()},children:[R.jsxs(v2e,{children:[R.jsx(b2e,{onClick:I=>{I.target.setSelectionRange(0,I.target.value.length)},value:Le,onChange:I=>se(I.target.value),onBlur:I=>{I.target.value===c||typeof c>"u"&&I.target.value==="New Session"||r(kP(I.target.value))},onKeyDown:I=>{I.key==="Enter"?(I.preventDefault(),I.target.blur()):I.key==="Escape"&&(se(c||"New Session"),I.target.blur())}}),R.jsxs("div",{className:"flex gap-2",children:[a.history.filter(I=>!I.hide).length>0&&R.jsx(Ti,{onClick:()=>{t==null||t.stopSession(),r(F2())},text:"New Session (⌥⌘N)",children:R.jsx(IL,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{i("/history")},text:"History",children:R.jsx(OQ,{width:"1.4em",height:"1.4em"})})]})]}),D&&E&&typeof t>"u"&&R.jsxs(R.Fragment,{children:[R.jsx(jge,{}),R.jsx("p",{style:{textAlign:"center",margin:"0px",fontSize:"14px"},children:s}),R.jsxs("div",{className:"flex mx-8 my-2",children:[R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/troubleshooting",target:"_blank",children:"Troubleshooting help"})})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},onClick:()=>{qa("toggleDevTools",{})},children:R.jsx("u",{children:"View logs"})}),R.jsx("p",{style:{margin:"auto",textAlign:"center",marginTop:"4px",fontSize:"12px",cursor:"pointer",opacity:.7},children:R.jsx("u",{children:R.jsx("a",{style:{color:"inherit"},href:"https://continue.dev/docs/walkthroughs/manually-run-continue#recommended-use-the-continuedev-pypi-package",target:"_blank",children:"Manually start server"})})})]})]}),R.jsx("br",{}),R.jsx(g2e,{onClick:I=>{t==null||t.sendMainInput(I)}}),R.jsx(y2e,{children:a.history.map((I,X)=>I.hide?null:R.jsx(C.Fragment,{children:I.name==="User Input"?I.hide||R.jsx(JI,{isMainInput:!1,value:I.description,active:p&&oe(X),onEnter:(ae,O)=>{if(O){t==null||t.stopSession();const Q=[...a.history.slice(0,X),{name:"User Input",description:O,observations:[],logs:[],step_type:"UserInputStep",params:{user_input:O},hide:!1,depth:0}];r(YI(Q)),r(Xd(!0));const be={history:Q,context_items:a.context_items};console.log("State: ",be),t.runFromState(be)}ae==null||ae.stopPropagation(),ae==null||ae.preventDefault()},groupIndices:pe(X),onToggle:ae=>{b(O=>{const Q=[...O];return pe(X).forEach(be=>{Q[be]=ae}),Q})},onToggleAll:ae=>{b(O=>O.map(Q=>ae))},isToggleOpen:typeof h[X]>"u"?!0:h[X],index:X,onDelete:()=>{pe(X).forEach(ae=>{console.log(ae),r(C4(ae))})}}):R.jsx(Qge,{historyNode:I,iconElement:I.step_type==="DefaultModelEditCodeStep"?R.jsx(wQ,{width:"16px",height:"16px"}):I.error?R.jsx(xL,{width:"16px",height:"16px",color:"red"}):R.jsx(CL,{width:"16px",height:"16px"}),open:typeof h[X]>"u"?!I.error:h[X],onToggle:()=>ce(X),children:I.error?R.jsx(Jge,{onClose:()=>ce(X),error:I.error,onDelete:()=>{r(C4(X))}}):R.jsx(zue,{index:X,isLast:X===a.history.length-1,isFirst:X===0,open:typeof h[X]>"u"?!0:h[X],onUserInput:ae=>{$(ae,X)},step:I,onReverse:()=>{t==null||t.reverseToIndex(X)},onRetry:()=>{t==null||t.retryAtIndex(X),m(!0)},onDelete:()=>{r(C4(X))},noUserInputParent:pe(X).length===0},X)})},X))}),R.jsx("div",{children:(he=u==null?void 0:u.map)==null?void 0:he.call(u,(I,X)=>R.jsx(E2e,{children:I},X))}),R.jsx("div",{ref:N}),R.jsx(JI,{isMainInput:!0,ref:w,onEnter:(I,X)=>{Z(I),I==null||I.stopPropagation(),I==null||I.preventDefault()},onInputValueChange:()=>{},onToggleAddContext:()=>{t==null||t.toggleAddingHighlightedCode()}})]})}const _2e=He.div` display: flex; flex-direction: row; align-items: center; @@ -830,7 +830,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho padding-right: 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; -`;function QR(e){const t=e.includes("/")?"/":"\\";return e.split(t).pop()||e}function A2e(){const e=bs(),t=Io(),[n,r]=C.useState([]),[i,a]=C.useState([]),o=C.useContext(eo),s=St(E=>E.config.apiUrl),u=St(E=>E.config.workspacePaths),c=St(E=>E.sessionState),p=St(E=>{var v;return((v=E.config.workspacePaths)==null?void 0:v[0])||""}),[f,m]=C.useState(!1);C.useEffect(()=>{(async()=>{if(!s)return;const v=await fetch(`${s}/sessions/list`);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const w=await v.json();r(w)})()},[o]),C.useEffect(()=>{a(n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).sort((E,v)=>sh(v.date_created).getTime()-sh(E.date_created).getTime()))},[f,n]);const h=new Date(Date.now()-1e3*60*60*24),b=new Date(Date.now()-1e3*60*60*24*7),y=new Date(Date.now()-1e3*60*60*24*30),T=new Date(0);return R.jsxs("div",{className:"overflow-y-scroll",style:{fontSize:ir()},children:[R.jsxs("div",{className:"sticky top-0",style:{backgroundColor:Vt},children:[R.jsxs("div",{className:"items-center flex m-0 p-0",style:{borderBottom:`0.5px solid ${Et}`},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>e("/"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"History"})]}),u&&u.length>0&&R.jsx(T2e,{checked:f,onClick:()=>m(E=>!E),title:`Show only sessions from ${QR(u[u.length-1])}/`})]}),n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).length===0&&R.jsxs("div",{className:"text-center m-4",children:['No past sessions found. To start a new session, either click the "+" button or use the keyboard shortcut: ',R.jsx("b",{children:"Option + Command + N"})]}),R.jsxs("div",{children:[R.jsx("table",{className:"w-full border-spacing-0 border-collapse",children:R.jsx("tbody",{children:i.map((E,v)=>{const w=v>0?sh(i[v-1].date_created):T,A=sh(E.date_created);return R.jsxs(C.Fragment,{children:[v===0&&A>h&&R.jsx(U4,{children:"Today"}),Ab&&w>h&&R.jsx(U4,{children:"This Week"}),Ay&&w>b&&R.jsx(U4,{children:"This Month"}),R.jsx(S2e,{children:R.jsx("td",{children:R.jsxs(w2e,{onClick:async()=>{const N={session_state:{history:c.history,context_items:c.context_items},title:c.title,workspace_directory:p,session_id:c.session_id};console.log(N),await fetch(`${s}/sessions/save`,{method:"POST",body:JSON.stringify(N),headers:{"Content-Type":"application/json"}});const x=await fetch(`${s}/sessions/${E.session_id}`);if(!x.ok)throw new Error(`HTTP error! status: ${x.status}`);const D=await x.json();o==null||o.stopSession(),t(F2(D)),e("/")},children:[R.jsx("div",{className:"text-md",children:E.title}),R.jsxs("div",{className:"text-gray-400",children:[A.toLocaleString("en-US",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0})," | ",QR(E.workspace_directory||""),"/"]})]})})},v)]},v)})})}),R.jsx("br",{}),R.jsx("i",{className:"text-sm ml-4",children:"All session data is saved in ~/.continue/sessions"})]})]})}const C2e=He.div` +`;function QR(e){const t=e.includes("/")?"/":"\\";return e.split(t).pop()||e}function A2e(){const e=bs(),t=Io(),[n,r]=C.useState([]),[i,a]=C.useState([]),o=C.useContext(eo),s=wt(E=>E.config.apiUrl),u=wt(E=>E.config.workspacePaths),c=wt(E=>E.sessionState),p=wt(E=>{var v;return((v=E.config.workspacePaths)==null?void 0:v[0])||""}),[f,m]=C.useState(!1);C.useEffect(()=>{(async()=>{if(!s)return;const v=await fetch(`${s}/sessions/list`);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const w=await v.json();r(w)})()},[o]),C.useEffect(()=>{a(n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).sort((E,v)=>sh(v.date_created).getTime()-sh(E.date_created).getTime()))},[f,n]);const h=new Date(Date.now()-1e3*60*60*24),b=new Date(Date.now()-1e3*60*60*24*7),y=new Date(Date.now()-1e3*60*60*24*30),T=new Date(0);return R.jsxs("div",{className:"overflow-y-scroll",style:{fontSize:ir()},children:[R.jsxs("div",{className:"sticky top-0",style:{backgroundColor:Vt},children:[R.jsxs("div",{className:"items-center flex m-0 p-0",style:{borderBottom:`0.5px solid ${Et}`},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>e("/"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"History"})]}),u&&u.length>0&&R.jsx(T2e,{checked:f,onClick:()=>m(E=>!E),title:`Show only sessions from ${QR(u[u.length-1])}/`})]}),n.filter(E=>!f||typeof u>"u"||typeof E.workspace_directory>"u"?!0:u.includes(E.workspace_directory)).length===0&&R.jsxs("div",{className:"text-center m-4",children:['No past sessions found. To start a new session, either click the "+" button or use the keyboard shortcut: ',R.jsx("b",{children:"Option + Command + N"})]}),R.jsxs("div",{children:[R.jsx("table",{className:"w-full border-spacing-0 border-collapse",children:R.jsx("tbody",{children:i.map((E,v)=>{const w=v>0?sh(i[v-1].date_created):T,A=sh(E.date_created);return R.jsxs(C.Fragment,{children:[v===0&&A>h&&R.jsx(U4,{children:"Today"}),Ab&&w>h&&R.jsx(U4,{children:"This Week"}),Ay&&w>b&&R.jsx(U4,{children:"This Month"}),R.jsx(S2e,{children:R.jsx("td",{children:R.jsxs(w2e,{onClick:async()=>{const N={session_state:{history:c.history,context_items:c.context_items},title:c.title,workspace_directory:p,session_id:c.session_id};console.log(N),await fetch(`${s}/sessions/save`,{method:"POST",body:JSON.stringify(N),headers:{"Content-Type":"application/json"}});const x=await fetch(`${s}/sessions/${E.session_id}`);if(!x.ok)throw new Error(`HTTP error! status: ${x.status}`);const D=await x.json();o==null||o.stopSession(),t(F2(D)),e("/")},children:[R.jsx("div",{className:"text-md",children:E.title}),R.jsxs("div",{className:"text-gray-400",children:[A.toLocaleString("en-US",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0})," | ",QR(E.workspace_directory||""),"/"]})]})})},v)]},v)})})}),R.jsx("br",{}),R.jsx("i",{className:"text-sm ml-4",children:"All session data is saved in ~/.continue/sessions"})]})]})}const C2e=He.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-gap: 2rem; @@ -998,7 +998,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &:hover { background-color: ${ha}44; } -`;function V4(e){return e!=null&&e.title?e==null?void 0:e.title:(e==null?void 0:e.model)!==void 0&&(e==null?void 0:e.model.trim())!==""?e!=null&&e.class_name?`${e==null?void 0:e.class_name} - ${e==null?void 0:e.model}`:e==null?void 0:e.model:e==null?void 0:e.class_name}function J5e(e){const t=C.useContext(eo),n=St(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.default}),r=St(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.saved}),i=bs(),a={value:JSON.stringify({t:"default",idx:-1}),title:"GPT-4"},[o,s]=C.useState([a]);C.useEffect(()=>{if(!n&&!r){s([a]);return}const c=[];n&&c.push({value:JSON.stringify({t:"default",idx:-1}),title:V4(n)}),r==null||r.forEach((p,f)=>{c.push({value:JSON.stringify({t:"saved",idx:f}),title:V4(p)})}),s(c)},[n,r]);const u=document.getElementById("model-select-top-div");return R.jsx(R.Fragment,{children:R.jsxs(q5e,{children:[R.jsx(Y5e,{value:JSON.stringify({t:"default",idx:-1}),onChange:c=>{const p=JSON.parse(c);p.t==="saved"&&(t==null||t.setModelForRoleFromIndex("*",p.idx))},defaultValue:"0",children:R.jsxs("div",{className:"relative",children:[R.jsxs(X5e,{children:[R.jsx("div",{children:V4(n)||"GPT-4"}),R.jsx("div",{className:"pointer-events-none flex items-center",children:R.jsx(_Q,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),u&&d9.createPortal(R.jsx(W5e,{as:C.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:R.jsx(Q5e,{children:o.map((c,p)=>R.jsx(Z5e,{selected:c.value===JSON.stringify({t:"default",idx:-1}),value:c.value,children:R.jsx("span",{children:c.title})},p))})}),u)]})}),R.jsx(K5e,{width:"1.3em",height:"1.3em",onClick:()=>{i("/models")}})]})})}const e3e=He.div` +`;function V4(e){return e!=null&&e.title?e==null?void 0:e.title:(e==null?void 0:e.model)!==void 0&&(e==null?void 0:e.model.trim())!==""?e!=null&&e.class_name?`${e==null?void 0:e.class_name} - ${e==null?void 0:e.model}`:e==null?void 0:e.model:e==null?void 0:e.class_name}function J5e(e){const t=C.useContext(eo),n=wt(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.default}),r=wt(c=>{var p,f;return(f=(p=c.serverState.config)==null?void 0:p.models)==null?void 0:f.saved}),i=bs(),a={value:JSON.stringify({t:"default",idx:-1}),title:"GPT-4"},[o,s]=C.useState([a]);C.useEffect(()=>{if(!n&&!r){s([a]);return}const c=[];n&&c.push({value:JSON.stringify({t:"default",idx:-1}),title:V4(n)}),r==null||r.forEach((p,f)=>{c.push({value:JSON.stringify({t:"saved",idx:f}),title:V4(p)})}),s(c)},[n,r]);const u=document.getElementById("model-select-top-div");return R.jsx(R.Fragment,{children:R.jsxs(q5e,{children:[R.jsx(Y5e,{value:JSON.stringify({t:"default",idx:-1}),onChange:c=>{const p=JSON.parse(c);p.t==="saved"&&(t==null||t.setModelForRoleFromIndex("*",p.idx))},defaultValue:"0",children:R.jsxs("div",{className:"relative",children:[R.jsxs(X5e,{children:[R.jsx("div",{children:V4(n)||"GPT-4"}),R.jsx("div",{className:"pointer-events-none flex items-center",children:R.jsx(_Q,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),u&&d9.createPortal(R.jsx(W5e,{as:C.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:R.jsx(Q5e,{children:o.map((c,p)=>R.jsx(Z5e,{selected:c.value===JSON.stringify({t:"default",idx:-1}),value:c.value,children:R.jsx("span",{children:c.title})},p))})}),u)]})}),R.jsx(K5e,{width:"1.3em",height:"1.3em",onClick:()=>{i("/models")}})]})})}const e3e=He.div` width: 100px; height: 6px; border-radius: 6px; @@ -1080,7 +1080,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho margin-left: 8px; z-index: 200; font-size: ${ir()}; -`,d3e=()=>{const e=bs(),t=ST(),n=C.useContext(eo),r=Io(),i=St(p=>p.uiState.dialogMessage),a=St(p=>p.uiState.showDialog),o=St(p=>{var f;return(f=p.serverState.config.models)==null?void 0:f.default}),s=St(p=>p.uiState.bottomMessage),u=St(p=>p.uiState.displayBottomMessageOnBottom),c=St(p=>p.sessionState.history);return C.useEffect(()=>{const p=f=>{var m;if(f.metaKey&&f.altKey&&f.code==="KeyN"&&(n==null||n.stopSession(),r(F2())),(f.metaKey||f.ctrlKey)&&f.code==="KeyC"){const h=(m=window.getSelection())==null?void 0:m.toString();h&&setTimeout(()=>{navigator.clipboard.writeText(h)},100)}};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p)}},[n,c]),C.useEffect(()=>{const p=f=>{f.data.type==="addModel"?e("/models"):f.data.type==="openSettings"&&e("/settings")};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[]),R.jsxs(o3e,{children:[R.jsxs("div",{style:{scrollbarGutter:"stable both-edges",minHeight:"100%",display:"grid",gridTemplateRows:"1fr auto"},children:[R.jsx(M2e,{showDialog:a,onEnter:()=>{r(lc(!1))},onClose:()=>{r(lc(!1))},message:i}),R.jsxs(u3e,{children:[R.jsx(a2e,{}),R.jsx(c3e,{id:"model-select-top-div"}),R.jsxs(l3e,{children:[R.jsxs("div",{className:"mr-auto flex gap-2 items-center",children:[localStorage.getItem("ide")==="jetbrains"||localStorage.getItem("hideFeature")==="true"||R.jsx(RL,{className:"cursor-pointer",onClick:()=>{localStorage.setItem("hideFeature","true")},onMouseEnter:()=>{r(pu("🎁 New Feature: Use ⌘⇧R automatically debug errors in the terminal (you can click the sparkle icon to make it go away)"))},onMouseLeave:()=>{r(QI(setTimeout(()=>{r(pu(void 0))},2e3)))},width:"1.3em",height:"1.3em",color:"yellow"}),R.jsx(J5e,{}),(o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(t.pathname==="/settings"||parseInt(localStorage.getItem("ftc")||"0")>=125)&&R.jsx(i3e,{completed:parseInt(localStorage.getItem("ftc")||"0"),total:250})]}),R.jsx(Ti,{text:"Help",onClick:()=>{e("/help")},children:R.jsx(QQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{e("/settings")},text:"Settings",children:R.jsx(xQ,{width:"1.4em",height:"1.4em"})})]})]}),R.jsx(s3e,{displayOnBottom:u,onMouseEnter:()=>{r(QI(void 0))},onMouseLeave:p=>{p.buttons||r(pu(void 0))},hidden:!s,children:s})]}),R.jsx("div",{className:"text-sm",id:"tooltip-portal-div"})]})};class p3e{}const Co=Object.create(null);Co.open="0";Co.close="1";Co.ping="2";Co.pong="3";Co.message="4";Co.upgrade="5";Co.noop="6";const Vh=Object.create(null);Object.keys(Co).forEach(e=>{Vh[Co[e]]=e});const tE={type:"error",data:"parser error"},MB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FB=typeof ArrayBuffer=="function",PB=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NT=({type:e,data:t},n,r)=>MB&&t instanceof Blob?n?r(t):oN(t,r):FB&&(t instanceof ArrayBuffer||PB(t))?n?r(t):oN(new Blob([t]),r):r(Co[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function sN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let W4;function f3e(e,t){if(MB&&e.data instanceof Blob)return e.data.arrayBuffer().then(sN).then(t);if(FB&&(e.data instanceof ArrayBuffer||PB(e.data)))return t(sN(e.data));NT(e,!1,n=>{W4||(W4=new TextEncoder),t(W4.encode(n))})}const lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,a,o,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),p=new Uint8Array(c);for(r=0;r>4,p[i++]=(o&15)<<4|s>>2,p[i++]=(s&3)<<6|u&63;return c},g3e=typeof ArrayBuffer=="function",OT=(e,t)=>{if(typeof e!="string")return{type:"message",data:BB(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:m3e(e.substring(1),t)}:Vh[n]?e.length>1?{type:Vh[n],data:e.substring(1)}:{type:Vh[n]}:tE},m3e=(e,t)=>{if(g3e){const n=h3e(e);return BB(n,t)}else return{base64:!0,data:e}},BB=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},UB=String.fromCharCode(30),b3e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,o)=>{NT(a,!1,s=>{r[o]=s,++i===n&&t(r.join(UB))})})},y3e=(e,t)=>{const n=e.split(UB),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let q4;function dh(e){return e.reduce((t,n)=>t+n.length,0)}function ph(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(tE);break}i=p*Math.pow(2,32)+c.getUint32(4),r=3}else{if(dh(n)e){s.enqueue(tE);break}}}})}const $B=4;function Xn(e){if(e)return _3e(e)}function _3e(e){for(var t in Xn.prototype)e[t]=Xn.prototype[t];return e}Xn.prototype.on=Xn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Xn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function zB(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const T3e=da.setTimeout,S3e=da.clearTimeout;function q2(e,t){t.useNativeTimers?(e.setTimeoutFn=T3e.bind(da),e.clearTimeoutFn=S3e.bind(da)):(e.setTimeoutFn=da.setTimeout.bind(da),e.clearTimeoutFn=da.clearTimeout.bind(da))}const w3e=1.33;function A3e(e){return typeof e=="string"?C3e(e):Math.ceil((e.byteLength||e.size)*w3e)}function C3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function x3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function k3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function jB(){const e=dN(+new Date);return e!==cN?(uN=0,cN=e):e+"."+dN(uN++)}for(;fh{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};y3e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b3e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jB()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Y1(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Y1=class Wh extends Xn{constructor(t,n){super(),q2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=zB(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new VB(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Wh.requestsCount++,Wh.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=O3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Wh.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Y1.requestsCount=0;Y1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pN);else if(typeof addEventListener=="function"){const e="onpagehide"in da?"pagehide":"unload";addEventListener(e,pN,!1)}}function pN(){for(let e in Y1.requests)Y1.requests.hasOwnProperty(e)&&Y1.requests[e].abort()}const LT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),hh=da.WebSocket||da.MozWebSocket,fN=!0,M3e="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F3e extends DT{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:zB(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new hh(t,n):new hh(t):new hh(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const o={};try{fN&&this.ws.send(a)}catch{}i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jB()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!hh}}class P3e extends DT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=v3e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=E3e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const B3e={websocket:F3e,webtransport:P3e,polling:L3e},U3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function rE(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=U3e.exec(e||""),a={},o=14;for(;o--;)a[$3e[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=z3e(a,a.path),a.queryKey=H3e(a,a.query),a}function z3e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function H3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let WB=class p1 extends Xn{constructor(t,n={}){super(),this.binaryType=M3e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=rE(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=rE(n.host).host),q2(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=k3e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=$B,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new B3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&p1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;p1.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;p1.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function a(){r||(r=!0,p(),n.close(),n=null)}const o=f=>{const m=new Error("probe error: "+f);m.transport=n.name,a(),this.emitReserved("upgradeError",m)};function s(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&a()}const p=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",s),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",p1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){p1.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qB=Object.prototype.toString,W3e=typeof Blob=="function"||typeof Blob<"u"&&qB.call(Blob)==="[object BlobConstructor]",q3e=typeof File=="function"||typeof File<"u"&&qB.call(File)==="[object FileConstructor]";function MT(e){return G3e&&(e instanceof ArrayBuffer||V3e(e))||W3e&&e instanceof Blob||q3e&&e instanceof File}function qh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(a),n.apply(this,[null,...o])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((o,s)=>r?o?a(o):i(s):i(o)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case zt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case zt.EVENT:case zt.BINARY_EVENT:this.onevent(t);break;case zt.ACK:case zt.BINARY_ACK:this.onack(t);break;case zt.DISCONNECT:this.ondisconnect();break;case zt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:zt.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}xc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};xc.prototype.reset=function(){this.attempts=0};xc.prototype.setMin=function(e){this.ms=e};xc.prototype.setMax=function(e){this.max=e};xc.prototype.setJitter=function(e){this.jitter=e};class oE extends Xn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,q2(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new xc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||e4e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new WB(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ua(n,"open",function(){r.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=Ua(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ua(t,"ping",this.onping.bind(this)),Ua(t,"data",this.ondata.bind(this)),Ua(t,"error",this.onerror.bind(this)),Ua(t,"close",this.onclose.bind(this)),Ua(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){LT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KB(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const gd={};function Kh(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=j3e(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,o=gd[i]&&a in gd[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let u;return s?u=new oE(r,t):(gd[i]||(gd[i]=new oE(r,t)),u=gd[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Kh,{Manager:oE,Socket:KB,io:Kh,connect:Kh});class YB{}class n4e extends YB{constructor(n){super();zl(this,"socket");console.log("Connecting to socket.io endpoint: ",n,window.windowId),this.socket=Kh(`${n}?window_id=${window.windowId}`,{path:"/gui/socket.io",transports:["websocket","polling","flashsocket"]})}send(n,r){this.socket.emit("message",{message_type:n,data:r,message_id:Yd()})}onMessageType(n,r){this.socket.on("message",({message_type:i,data:a})=>{n===i&&r(a)})}onMessage(n){this.socket.on("message",({messageType:r,data:i})=>{n(r,i)})}onOpen(n){this.socket.on("connect",n)}onClose(n){this.socket.on("disconnect",n)}async sendAndReceive(n,r){return new Promise((i,a)=>{this.socket.emit("message",{message_type:n,data:r,message_id:Yd()},o=>{o&&o.error?a(o.error):i(o)})})}onError(n){this.socket.on("error",n)}close(){this.socket.disconnect()}}class r4e extends YB{constructor(n){super();zl(this,"serverUrl");this.serverUrl=n,qa("websocketForwardingOpen",{url:this.serverUrl})}send(n,r){qa("websocketForwardingMessage",{message:{messageType:n,data:r},url:this.serverUrl})}onMessageType(n,r){window.addEventListener("message",i=>{if(i.data.type==="websocketForwardingMessage"){const a=JSON.parse(i.data.data);a.messageType===n&&r(a.data)}})}onMessage(n){window.addEventListener("message",r=>{if(r.data.type==="websocketForwardingMessage"){const i=JSON.parse(r.data.data);n(i.messageType,i.data)}})}onError(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingError"&&n(r.data.error)})}sendAndReceive(n,r){return new Promise(i=>{const a=o=>{if(o.data.type==="websocketForwardingMessage"){const s=JSON.parse(o.data.data);s.messageType===n&&(window.removeEventListener("message",a),i(s.data))}};window.addEventListener("message",a),this.send(n,r)})}onOpen(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingOpen"&&n()})}onClose(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingClose"&&n()})}close(){qa("websocketForwardingClose",{url:this.serverUrl})}}class i4e extends p3e{constructor(n,r){super();zl(this,"messenger");zl(this,"serverUrl");zl(this,"useVscodeMessagePassing");zl(this,"onStateUpdateCallbacks",[]);this.serverUrl=n,this.useVscodeMessagePassing=r,this.serverUrl=n,this.useVscodeMessagePassing=r,this.messenger=r?new r4e(n):new n4e(n),document.body.appendChild(document.createTextNode(`WHATWHATWHAT ${n}`)),this.messenger.onClose(()=>{console.log("GUI Connection closed: ",n)}),this.messenger.onError(i=>{console.log("GUI Connection error: ",i)}),this.messenger.onOpen(()=>{console.log("GUI Connection opened: ",n)}),this.messenger.onMessage((i,a)=>{this.handleMessage(i,a)})}onConnected(n){var r;(r=this.messenger)==null||r.onOpen(n)}handleMessage(n,r){switch(n){case"state_update":if(r.state)for(const i of this.onStateUpdateCallbacks)i(r.state);break}}loadSession(n){var r;(r=this.messenger)==null||r.send("load_session",{session_id:n})}sendMainInput(n){var r;(r=this.messenger)==null||r.send("main_input",{input:n})}runFromState(n){var r;(r=this.messenger)==null||r.send("run_from_state",{state:n})}async getSessionTitle(n){var r;return await((r=this.messenger)==null?void 0:r.sendAndReceive("get_session_title",{history:n}))}reverseToIndex(n){var r;(r=this.messenger)==null||r.send("reverse_to_index",{index:n})}sendRefinementInput(n,r){var i;(i=this.messenger)==null||i.send("refinement_input",{input:n,index:r})}sendStepUserInput(n,r){var i;(i=this.messenger)==null||i.send("step_user_input",{input:n,index:r})}onStateUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("state_update",i=>{i.state&&n(i.state)}),this.onStateUpdateCallbacks.push(n)}onSessionUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("session_update",i=>{n(i)})}onConfigUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("config_update",i=>{n(i)})}getConfig(){var n;return(n=this.messenger)==null?void 0:n.sendAndReceive("get_config",{})}onAddContextItem(n){var r;(r=this.messenger)==null||r.onMessageType("add_context_item",i=>{n(i)})}onAvailableSlashCommands(n){var r;(r=this.messenger)==null||r.onMessageType("available_slash_commands",i=>{i.commands&&n(i.commands)})}stopSession(){var n;(n=this.messenger)==null||n.send("stop_session",{})}sendClear(){var n;(n=this.messenger)==null||n.send("clear_history",{})}retryAtIndex(n){var r;(r=this.messenger)==null||r.send("retry_at_index",{index:n})}deleteContextWithIds(n,r){var i;(i=this.messenger)==null||i.send("delete_context_with_ids",{ids:n.map(a=>`${a.provider_title}-${a.item_id}`),index:r})}setEditingAtIds(n){var r;(r=this.messenger)==null||r.send("set_editing_at_ids",{ids:n})}toggleAddingHighlightedCode(){var n;(n=this.messenger)==null||n.send("toggle_adding_highlighted_code",{})}showContextVirtualFile(n){var r;(r=this.messenger)==null||r.send("show_context_virtual_file",{index:n})}selectContextItem(n,r){var i;(i=this.messenger)==null||i.send("select_context_item",{id:n,query:r})}async getContextItem(n,r){var i;return await((i=this.messenger)==null?void 0:i.sendAndReceive("get_context_item",{id:n,query:r}))}selectContextItemAtIndex(n,r,i){var a;(a=this.messenger)==null||a.send("select_context_item_at_index",{id:n,query:r,index:i})}editStepAtIndex(n,r){var i;(i=this.messenger)==null||i.send("edit_step_at_index",{user_input:n,index:r})}setSystemMessage(n){var r;(r=this.messenger)==null||r.send("set_system_message",{system_message:n})}setTemperature(n){var r;(r=this.messenger)==null||r.send("set_temperature",{temperature:n})}addModelForRole(n,r,i){var a;(a=this.messenger)==null||a.send("add_model_for_role",{role:n,model:i,model_class:r})}setModelForRoleFromIndex(n,r){var i;(i=this.messenger)==null||i.send("set_model_for_role_from_index",{role:n,index:r})}saveContextGroup(n,r){var i;(i=this.messenger)==null||i.send("save_context_group",{context_items:r,title:n})}selectContextGroup(n){var r;(r=this.messenger)==null||r.send("select_context_group",{id:n})}deleteContextGroup(n){var r;(r=this.messenger)==null||r.send("delete_context_group",{id:n})}}function a4e(e=!0){const[t,n]=C.useState(void 0),r=St(i=>i.config.apiUrl);return C.useEffect(()=>{const i=r||window.serverUrl,a=window.windowId;if(i==null||a==null)return;console.log("Creating GUI websocket",i,e);const o=new i4e(i,e);o.onConnected(()=>{n(o)})},[r,window.windowId]),t}function o4e(){const e=TB();return console.error(e),R.jsxs("div",{id:"error-page",className:"text-center",children:[R.jsx("h1",{children:"Error in Continue React App"}),R.jsx("p",{children:R.jsx("i",{children:e.statusText||e.message})}),R.jsx("br",{}),R.jsx("pre",{className:"text-left m-4",children:e.stack})]})}const XB="28px",s4e=He.div` +`,d3e=()=>{const e=bs(),t=ST(),n=C.useContext(eo),r=Io(),i=wt(p=>p.uiState.dialogMessage),a=wt(p=>p.uiState.showDialog),o=wt(p=>{var f;return(f=p.serverState.config.models)==null?void 0:f.default}),s=wt(p=>p.uiState.bottomMessage),u=wt(p=>p.uiState.displayBottomMessageOnBottom),c=wt(p=>p.sessionState.history);return C.useEffect(()=>{const p=f=>{var m;if(f.metaKey&&f.altKey&&f.code==="KeyN"&&(n==null||n.stopSession(),r(F2())),(f.metaKey||f.ctrlKey)&&f.code==="KeyC"){const h=(m=window.getSelection())==null?void 0:m.toString();h&&setTimeout(()=>{navigator.clipboard.writeText(h)},100)}};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p)}},[n,c]),C.useEffect(()=>{const p=f=>{f.data.type==="addModel"?e("/models"):f.data.type==="openSettings"&&e("/settings")};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[]),R.jsxs(o3e,{children:[R.jsxs("div",{style:{scrollbarGutter:"stable both-edges",minHeight:"100%",display:"grid",gridTemplateRows:"1fr auto"},children:[R.jsx(M2e,{showDialog:a,onEnter:()=>{r(lc(!1))},onClose:()=>{r(lc(!1))},message:i}),R.jsxs(u3e,{children:[R.jsx(a2e,{}),R.jsx(c3e,{id:"model-select-top-div"}),R.jsxs(l3e,{children:[R.jsxs("div",{className:"mr-auto flex gap-2 items-center",children:[localStorage.getItem("ide")==="jetbrains"||localStorage.getItem("hideFeature")==="true"||R.jsx(RL,{className:"cursor-pointer",onClick:()=>{localStorage.setItem("hideFeature","true")},onMouseEnter:()=>{r(pu("🎁 New Feature: Use ⌘⇧R automatically debug errors in the terminal (you can click the sparkle icon to make it go away)"))},onMouseLeave:()=>{r(QI(setTimeout(()=>{r(pu(void 0))},2e3)))},width:"1.3em",height:"1.3em",color:"yellow"}),R.jsx(J5e,{}),(o==null?void 0:o.class_name)==="OpenAIFreeTrial"&&(o==null?void 0:o.api_key)===""&&(t.pathname==="/settings"||parseInt(localStorage.getItem("ftc")||"0")>=125)&&R.jsx(i3e,{completed:parseInt(localStorage.getItem("ftc")||"0"),total:250})]}),R.jsx(Ti,{text:"Help",onClick:()=>{e("/help")},children:R.jsx(QQ,{width:"1.4em",height:"1.4em"})}),R.jsx(Ti,{onClick:()=>{e("/settings")},text:"Settings",children:R.jsx(xQ,{width:"1.4em",height:"1.4em"})})]})]}),R.jsx(s3e,{displayOnBottom:u,onMouseEnter:()=>{r(QI(void 0))},onMouseLeave:p=>{p.buttons||r(pu(void 0))},hidden:!s,children:s})]}),R.jsx("div",{className:"text-sm",id:"tooltip-portal-div"})]})};class p3e{}const Co=Object.create(null);Co.open="0";Co.close="1";Co.ping="2";Co.pong="3";Co.message="4";Co.upgrade="5";Co.noop="6";const Vh=Object.create(null);Object.keys(Co).forEach(e=>{Vh[Co[e]]=e});const tE={type:"error",data:"parser error"},MB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FB=typeof ArrayBuffer=="function",PB=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NT=({type:e,data:t},n,r)=>MB&&t instanceof Blob?n?r(t):oN(t,r):FB&&(t instanceof ArrayBuffer||PB(t))?n?r(t):oN(new Blob([t]),r):r(Co[e]+(t||"")),oN=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function sN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let W4;function f3e(e,t){if(MB&&e.data instanceof Blob)return e.data.arrayBuffer().then(sN).then(t);if(FB&&(e.data instanceof ArrayBuffer||PB(e.data)))return t(sN(e.data));NT(e,!1,n=>{W4||(W4=new TextEncoder),t(W4.encode(n))})}const lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,a,o,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),p=new Uint8Array(c);for(r=0;r>4,p[i++]=(o&15)<<4|s>>2,p[i++]=(s&3)<<6|u&63;return c},g3e=typeof ArrayBuffer=="function",OT=(e,t)=>{if(typeof e!="string")return{type:"message",data:BB(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:m3e(e.substring(1),t)}:Vh[n]?e.length>1?{type:Vh[n],data:e.substring(1)}:{type:Vh[n]}:tE},m3e=(e,t)=>{if(g3e){const n=h3e(e);return BB(n,t)}else return{base64:!0,data:e}},BB=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},UB=String.fromCharCode(30),b3e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,o)=>{NT(a,!1,s=>{r[o]=s,++i===n&&t(r.join(UB))})})},y3e=(e,t)=>{const n=e.split(UB),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let q4;function dh(e){return e.reduce((t,n)=>t+n.length,0)}function ph(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(tE);break}i=p*Math.pow(2,32)+c.getUint32(4),r=3}else{if(dh(n)e){s.enqueue(tE);break}}}})}const $B=4;function Xn(e){if(e)return _3e(e)}function _3e(e){for(var t in Xn.prototype)e[t]=Xn.prototype[t];return e}Xn.prototype.on=Xn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Xn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function zB(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const T3e=da.setTimeout,S3e=da.clearTimeout;function q2(e,t){t.useNativeTimers?(e.setTimeoutFn=T3e.bind(da),e.clearTimeoutFn=S3e.bind(da)):(e.setTimeoutFn=da.setTimeout.bind(da),e.clearTimeoutFn=da.clearTimeout.bind(da))}const w3e=1.33;function A3e(e){return typeof e=="string"?C3e(e):Math.ceil((e.byteLength||e.size)*w3e)}function C3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function x3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function k3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function jB(){const e=dN(+new Date);return e!==cN?(uN=0,cN=e):e+"."+dN(uN++)}for(;fh{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};y3e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b3e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jB()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Y1(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Y1=class Wh extends Xn{constructor(t,n){super(),q2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=zB(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new VB(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Wh.requestsCount++,Wh.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=O3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Wh.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Y1.requestsCount=0;Y1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",pN);else if(typeof addEventListener=="function"){const e="onpagehide"in da?"pagehide":"unload";addEventListener(e,pN,!1)}}function pN(){for(let e in Y1.requests)Y1.requests.hasOwnProperty(e)&&Y1.requests[e].abort()}const LT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),hh=da.WebSocket||da.MozWebSocket,fN=!0,M3e="arraybuffer",hN=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class F3e extends DT{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=hN?{}:zB(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=fN&&!hN?n?new hh(t,n):new hh(t):new hh(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const o={};try{fN&&this.ws.send(a)}catch{}i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jB()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!hh}}class P3e extends DT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=v3e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=E3e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&<(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const B3e={websocket:F3e,webtransport:P3e,polling:L3e},U3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function rE(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=U3e.exec(e||""),a={},o=14;for(;o--;)a[$3e[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=z3e(a,a.path),a.queryKey=H3e(a,a.query),a}function z3e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function H3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let WB=class p1 extends Xn{constructor(t,n={}){super(),this.binaryType=M3e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=rE(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=rE(n.host).host),q2(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=k3e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=$B,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new B3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&p1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;p1.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;p1.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function a(){r||(r=!0,p(),n.close(),n=null)}const o=f=>{const m=new Error("probe error: "+f);m.transport=n.name,a(),this.emitReserved("upgradeError",m)};function s(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&a()}const p=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",s),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",p1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){p1.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qB=Object.prototype.toString,W3e=typeof Blob=="function"||typeof Blob<"u"&&qB.call(Blob)==="[object BlobConstructor]",q3e=typeof File=="function"||typeof File<"u"&&qB.call(File)==="[object FileConstructor]";function MT(e){return G3e&&(e instanceof ArrayBuffer||V3e(e))||W3e&&e instanceof Blob||q3e&&e instanceof File}function qh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let o=0;o{this.io.clearTimeoutFn(a),n.apply(this,[null,...o])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((o,s)=>r?o?a(o):i(s):i(o)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case zt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case zt.EVENT:case zt.BINARY_EVENT:this.onevent(t);break;case zt.ACK:case zt.BINARY_ACK:this.onack(t);break;case zt.DISCONNECT:this.ondisconnect();break;case zt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:zt.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}xc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};xc.prototype.reset=function(){this.attempts=0};xc.prototype.setMin=function(e){this.ms=e};xc.prototype.setMax=function(e){this.max=e};xc.prototype.setJitter=function(e){this.jitter=e};class oE extends Xn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,q2(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new xc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||e4e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new WB(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ua(n,"open",function(){r.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=Ua(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ua(t,"ping",this.onping.bind(this)),Ua(t,"data",this.ondata.bind(this)),Ua(t,"error",this.onerror.bind(this)),Ua(t,"close",this.onclose.bind(this)),Ua(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){LT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KB(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const gd={};function Kh(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=j3e(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,o=gd[i]&&a in gd[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let u;return s?u=new oE(r,t):(gd[i]||(gd[i]=new oE(r,t)),u=gd[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Kh,{Manager:oE,Socket:KB,io:Kh,connect:Kh});class YB{}class n4e extends YB{constructor(n){super();zl(this,"socket");console.log("Connecting to socket.io endpoint: ",n,window.windowId),this.socket=Kh(`${n}?window_id=${window.windowId}`,{path:"/gui/socket.io",transports:["websocket","polling","flashsocket"]})}send(n,r){this.socket.emit("message",{message_type:n,data:r,message_id:Yd()})}onMessageType(n,r){this.socket.on("message",({message_type:i,data:a})=>{n===i&&r(a)})}onMessage(n){this.socket.on("message",({messageType:r,data:i})=>{n(r,i)})}onOpen(n){this.socket.on("connect",n)}onClose(n){this.socket.on("disconnect",n)}async sendAndReceive(n,r){return new Promise((i,a)=>{this.socket.emit("message",{message_type:n,data:r,message_id:Yd()},o=>{o&&o.error?a(o.error):i(o)})})}onError(n){this.socket.on("error",n)}close(){this.socket.disconnect()}}class r4e extends YB{constructor(n){super();zl(this,"serverUrl");this.serverUrl=n,qa("websocketForwardingOpen",{url:this.serverUrl})}send(n,r){qa("websocketForwardingMessage",{message:{messageType:n,data:r},url:this.serverUrl})}onMessageType(n,r){window.addEventListener("message",i=>{if(i.data.type==="websocketForwardingMessage"){const a=JSON.parse(i.data.data);a.messageType===n&&r(a.data)}})}onMessage(n){window.addEventListener("message",r=>{if(r.data.type==="websocketForwardingMessage"){const i=JSON.parse(r.data.data);n(i.messageType,i.data)}})}onError(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingError"&&n(r.data.error)})}sendAndReceive(n,r){return new Promise(i=>{const a=o=>{if(o.data.type==="websocketForwardingMessage"){const s=JSON.parse(o.data.data);s.messageType===n&&(window.removeEventListener("message",a),i(s.data))}};window.addEventListener("message",a),this.send(n,r)})}onOpen(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingOpen"&&n()})}onClose(n){window.addEventListener("message",r=>{r.data.type==="websocketForwardingClose"&&n()})}close(){qa("websocketForwardingClose",{url:this.serverUrl})}}class i4e extends p3e{constructor(n,r){super();zl(this,"messenger");zl(this,"serverUrl");zl(this,"useVscodeMessagePassing");zl(this,"onStateUpdateCallbacks",[]);this.serverUrl=n,this.useVscodeMessagePassing=r,this.serverUrl=n,this.useVscodeMessagePassing=r,this.messenger=r?new r4e(n):new n4e(n),this.messenger.onClose(()=>{console.log("GUI Connection closed: ",n)}),this.messenger.onError(i=>{console.log("GUI Connection error: ",i)}),this.messenger.onOpen(()=>{console.log("GUI Connection opened: ",n)}),this.messenger.onMessage((i,a)=>{this.handleMessage(i,a)})}onConnected(n){var r;(r=this.messenger)==null||r.onOpen(n)}handleMessage(n,r){switch(n){case"state_update":if(r.state)for(const i of this.onStateUpdateCallbacks)i(r.state);break}}loadSession(n){var r;(r=this.messenger)==null||r.send("load_session",{session_id:n})}sendMainInput(n){var r;(r=this.messenger)==null||r.send("main_input",{input:n})}runFromState(n){var r;(r=this.messenger)==null||r.send("run_from_state",{state:n})}async getSessionTitle(n){var r;return await((r=this.messenger)==null?void 0:r.sendAndReceive("get_session_title",{history:n}))}reverseToIndex(n){var r;(r=this.messenger)==null||r.send("reverse_to_index",{index:n})}sendRefinementInput(n,r){var i;(i=this.messenger)==null||i.send("refinement_input",{input:n,index:r})}sendStepUserInput(n,r){var i;(i=this.messenger)==null||i.send("step_user_input",{input:n,index:r})}onStateUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("state_update",i=>{i.state&&n(i.state)}),this.onStateUpdateCallbacks.push(n)}onSessionUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("session_update",i=>{n(i)})}onConfigUpdate(n){var r;(r=this.messenger)==null||r.onMessageType("config_update",i=>{n(i)})}getConfig(){var n;return(n=this.messenger)==null?void 0:n.sendAndReceive("get_config",{})}onAddContextItem(n){var r;(r=this.messenger)==null||r.onMessageType("add_context_item",i=>{n(i)})}onAvailableSlashCommands(n){var r;(r=this.messenger)==null||r.onMessageType("available_slash_commands",i=>{i.commands&&n(i.commands)})}stopSession(){var n;(n=this.messenger)==null||n.send("stop_session",{})}sendClear(){var n;(n=this.messenger)==null||n.send("clear_history",{})}retryAtIndex(n){var r;(r=this.messenger)==null||r.send("retry_at_index",{index:n})}deleteContextWithIds(n,r){var i;(i=this.messenger)==null||i.send("delete_context_with_ids",{ids:n.map(a=>`${a.provider_title}-${a.item_id}`),index:r})}setEditingAtIds(n){var r;(r=this.messenger)==null||r.send("set_editing_at_ids",{ids:n})}toggleAddingHighlightedCode(){var n;(n=this.messenger)==null||n.send("toggle_adding_highlighted_code",{})}showContextVirtualFile(n){var r;(r=this.messenger)==null||r.send("show_context_virtual_file",{index:n})}selectContextItem(n,r){var i;(i=this.messenger)==null||i.send("select_context_item",{id:n,query:r})}async getContextItem(n,r){var i;return await((i=this.messenger)==null?void 0:i.sendAndReceive("get_context_item",{id:n,query:r}))}selectContextItemAtIndex(n,r,i){var a;(a=this.messenger)==null||a.send("select_context_item_at_index",{id:n,query:r,index:i})}editStepAtIndex(n,r){var i;(i=this.messenger)==null||i.send("edit_step_at_index",{user_input:n,index:r})}setSystemMessage(n){var r;(r=this.messenger)==null||r.send("set_system_message",{system_message:n})}setTemperature(n){var r;(r=this.messenger)==null||r.send("set_temperature",{temperature:n})}addModelForRole(n,r,i){var a;(a=this.messenger)==null||a.send("add_model_for_role",{role:n,model:i,model_class:r})}setModelForRoleFromIndex(n,r){var i;(i=this.messenger)==null||i.send("set_model_for_role_from_index",{role:n,index:r})}saveContextGroup(n,r){var i;(i=this.messenger)==null||i.send("save_context_group",{context_items:r,title:n})}selectContextGroup(n){var r;(r=this.messenger)==null||r.send("select_context_group",{id:n})}deleteContextGroup(n){var r;(r=this.messenger)==null||r.send("delete_context_group",{id:n})}}function a4e(e=!0){const[t,n]=C.useState(void 0);return C.useEffect(()=>{const r=window.serverUrl,i=window.windowId;if(r==null||i==null)return;console.log("Creating GUI websocket",r,e);const a=new i4e(r,e);a.onConnected(()=>{n(a)})},[window.windowId]),t}function o4e(){const e=TB();return console.error(e),R.jsxs("div",{id:"error-page",className:"text-center",children:[R.jsx("h1",{children:"Error in Continue React App"}),R.jsx("p",{children:R.jsx("i",{children:e.statusText||e.message})}),R.jsx("br",{}),R.jsx("pre",{className:"text-left m-4",children:e.stack})]})}const XB="28px",s4e=He.div` margin-top: 16px; margin: auto; width: ${XB}; @@ -1096,7 +1096,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho opacity: 0.4; } } -`;function l4e(e){const t=St(n=>n.config.vscMediaUrl);return R.jsx(s4e,{children:t?R.jsx("img",{src:`${t}/play_button.png`,width:"22px"}):R.jsx(kL,{width:e.size||XB})})}const sE=({msg:e})=>{const t="info-hover",n=document.getElementById("tooltip-portal-div");return R.jsxs(R.Fragment,{children:[R.jsx(MQ,{"data-tooltip-id":t,className:"h-5 w-5 text-gray-500 cursor-help"}),n&&d9.createPortal(R.jsx(Qs,{id:t,place:"bottom",children:e}),n)]})};var bf=e=>e.type==="checkbox",F1=e=>e instanceof Date,ei=e=>e==null;const QB=e=>typeof e=="object";var ar=e=>!ei(e)&&!Array.isArray(e)&&QB(e)&&!F1(e),u4e=e=>ar(e)&&e.target?bf(e.target)?e.target.checked:e.target.value:e,c4e=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d4e=(e,t)=>e.has(c4e(t)),p4e=e=>{const t=e.constructor&&e.constructor.prototype;return ar(t)&&t.hasOwnProperty("isPrototypeOf")},PT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qo(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(PT&&(e instanceof Blob||e instanceof FileList))&&(n||ar(e)))if(t=n?[]:{},!n&&!p4e(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Qo(e[r]));else return e;return t}var yf=e=>Array.isArray(e)?e.filter(Boolean):[],qn=e=>e===void 0,lt=(e,t,n)=>{if(!t||!ar(e))return n;const r=yf(t.split(/[,[\].]+?/)).reduce((i,a)=>ei(i)?i:i[a],e);return qn(r)||r===e?qn(e[t])?n:e[t]:r},lu=e=>typeof e=="boolean";const mN={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ha={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ko={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},f4e=ut.createContext(null),ZB=e=>{const{children:t,...n}=e;return ut.createElement(f4e.Provider,{value:n},t)};var h4e=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const o=a;return t._proxyFormState[o]!==Ha.all&&(t._proxyFormState[o]=!r||Ha.all),n&&(n[o]=!0),e[o]}});return i},sa=e=>ar(e)&&!Object.keys(e).length,g4e=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return sa(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||Ha.all))},K4=e=>Array.isArray(e)?e:[e];function m4e(e){const t=ut.useRef(e);t.current=e,ut.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var yo=e=>typeof e=="string",b4e=(e,t,n,r,i)=>yo(e)?(r&&t.watch.add(e),lt(n,e,i)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),lt(n,a))):(r&&(t.watchAll=!0),n),BT=e=>/^\w*$/.test(e),JB=e=>yf(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Cn(e,t,n){let r=-1;const i=BT(t)?[t]:JB(t),a=i.length,o=a-1;for(;++rt?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{};const lE=(e,t,n)=>{for(const r of n||Object.keys(e)){const i=lt(e,r);if(i){const{_f:a,...o}=i;if(a&&t(a.name)){if(a.ref.focus){a.ref.focus();break}else if(a.refs&&a.refs[0].focus){a.refs[0].focus();break}}else ar(o)&&lE(o,t)}}};var bN=e=>({isOnSubmit:!e||e===Ha.onSubmit,isOnBlur:e===Ha.onBlur,isOnChange:e===Ha.onChange,isOnAll:e===Ha.all,isOnTouch:e===Ha.onTouched}),yN=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),E4e=(e,t,n)=>{const r=yf(lt(e,n));return Cn(r,"root",t[n]),Cn(e,n,r),e},UT=e=>e.type==="file",Js=e=>typeof e=="function",am=e=>{if(!PT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yh=e=>yo(e),$T=e=>e.type==="radio",om=e=>e instanceof RegExp;const EN={value:!1,isValid:!1},vN={value:!0,isValid:!0};var eU=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!qn(e[0].attributes.value)?qn(e[0].value)||e[0].value===""?vN:{value:e[0].value,isValid:!0}:vN:EN}return EN};const _N={isValid:!1,value:null};var tU=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,_N):_N;function TN(e,t,n="validate"){if(Yh(e)||Array.isArray(e)&&e.every(Yh)||lu(e)&&!e)return{type:n,message:Yh(e)?e:"",ref:t}}var a1=e=>ar(e)&&!om(e)?e:{value:e,message:""},SN=async(e,t,n,r,i)=>{const{ref:a,refs:o,required:s,maxLength:u,minLength:c,min:p,max:f,pattern:m,validate:h,name:b,valueAsNumber:y,mount:T,disabled:E}=e._f,v=lt(t,b);if(!T||E)return{};const w=o?o[0]:a,A=$=>{r&&w.reportValidity&&(w.setCustomValidity(lu($)?"":$||""),w.reportValidity())},N={},x=$T(a),D=bf(a),B=x||D,V=(y||UT(a))&&qn(a.value)&&qn(v)||am(a)&&a.value===""||v===""||Array.isArray(v)&&!v.length,P=y4e.bind(null,b,n,N),Z=($,oe,pe,ce=Ko.maxLength,Le=Ko.minLength)=>{const se=$?oe:pe;N[b]={type:$?ce:Le,message:se,ref:a,...P($?ce:Le,se)}};if(i?!Array.isArray(v)||!v.length:s&&(!B&&(V||ei(v))||lu(v)&&!v||D&&!eU(o).isValid||x&&!tU(o).isValid)){const{value:$,message:oe}=Yh(s)?{value:!!s,message:s}:a1(s);if($&&(N[b]={type:Ko.required,message:oe,ref:w,...P(Ko.required,oe)},!n))return A(oe),N}if(!V&&(!ei(p)||!ei(f))){let $,oe;const pe=a1(f),ce=a1(p);if(!ei(v)&&!isNaN(v)){const Le=a.valueAsNumber||v&&+v;ei(pe.value)||($=Le>pe.value),ei(ce.value)||(oe=Lenew Date(new Date().toDateString()+" "+I),le=a.type=="time",he=a.type=="week";yo(pe.value)&&v&&($=le?se(v)>se(pe.value):he?v>pe.value:Le>new Date(pe.value)),yo(ce.value)&&v&&(oe=le?se(v)+$.value,ce=!ei(oe.value)&&v.length<+oe.value;if((pe||ce)&&(Z(pe,$.message,oe.message),!n))return A(N[b].message),N}if(m&&!V&&yo(v)){const{value:$,message:oe}=a1(m);if(om($)&&!v.match($)&&(N[b]={type:Ko.pattern,message:oe,ref:a,...P(Ko.pattern,oe)},!n))return A(oe),N}if(h){if(Js(h)){const $=await h(v,t),oe=TN($,w);if(oe&&(N[b]={...oe,...P(Ko.validate,oe.message)},!n))return A(oe.message),N}else if(ar(h)){let $={};for(const oe in h){if(!sa($)&&!n)break;const pe=TN(await h[oe](v,t),w,oe);pe&&($={...pe,...P(oe,pe.message)},A(pe.message),n&&(N[b]=$))}if(!sa($)&&(N[b]={ref:w,...$},!n))return N}}return A(!0),N};function v4e(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}}var sm=e=>ei(e)||!QB(e);function uu(e,t){if(sm(e)||sm(t))return e===t;if(F1(e)&&F1(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const a=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if(F1(a)&&F1(o)||ar(a)&&ar(o)||Array.isArray(a)&&Array.isArray(o)?!uu(a,o):a!==o)return!1}}return!0}var nU=e=>e.type==="select-multiple",T4e=e=>$T(e)||bf(e),X4=e=>am(e)&&e.isConnected,rU=e=>{for(const t in e)if(Js(e[t]))return!0;return!1};function lm(e,t={}){const n=Array.isArray(e);if(ar(e)||n)for(const r in e)Array.isArray(e[r])||ar(e[r])&&!rU(e[r])?(t[r]=Array.isArray(e[r])?[]:{},lm(e[r],t[r])):ei(e[r])||(t[r]=!0);return t}function iU(e,t,n){const r=Array.isArray(e);if(ar(e)||r)for(const i in e)Array.isArray(e[i])||ar(e[i])&&!rU(e[i])?qn(t)||sm(n[i])?n[i]=Array.isArray(e[i])?lm(e[i],[]):{...lm(e[i])}:iU(e[i],ei(t)?{}:t[i],n[i]):n[i]=!uu(e[i],t[i]);return n}var Q4=(e,t)=>iU(e,t,lm(t)),aU=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>qn(e)?e:t?e===""?NaN:e&&+e:n&&yo(e)?new Date(e):r?r(e):e;function Z4(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return UT(t)?t.files:$T(t)?tU(e.refs).value:nU(t)?[...t.selectedOptions].map(({value:n})=>n):bf(t)?eU(e.refs).value:aU(qn(t.value)?e.ref.value:t.value,e)}var S4e=(e,t,n,r)=>{const i={};for(const a of e){const o=lt(t,a);o&&Cn(i,a,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},md=e=>qn(e)?e:om(e)?e.source:ar(e)?om(e.value)?e.value.source:e.value:e,w4e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function wN(e,t,n){const r=lt(e,n);if(r||BT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=lt(t,a),s=lt(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};i.pop()}return{name:n}}var A4e=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,C4e=(e,t)=>!yf(lt(e,t)).length&&vr(e,t);const x4e={mode:Ha.onSubmit,reValidateMode:Ha.onChange,shouldFocusError:!0};function k4e(e={},t){let n={...x4e,...e},r={submitCount:0,isDirty:!1,isLoading:Js(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},a=ar(n.defaultValues)||ar(n.values)?Qo(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:Qo(a),s={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,p=0;const f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={values:Y4(),array:Y4(),state:Y4()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,b=bN(n.mode),y=bN(n.reValidateMode),T=n.criteriaMode===Ha.all,E=U=>re=>{clearTimeout(p),p=setTimeout(U,re)},v=async U=>{if(f.isValid||U){const re=n.resolver?sa((await V()).errors):await Z(i,!0);re!==r.isValid&&m.state.next({isValid:re})}},w=U=>f.isValidating&&m.state.next({isValidating:U}),A=(U,re=[],de,ke,Ee=!0,Se=!0)=>{if(ke&&de){if(s.action=!0,Se&&Array.isArray(lt(i,U))){const De=de(lt(i,U),ke.argA,ke.argB);Ee&&Cn(i,U,De)}if(Se&&Array.isArray(lt(r.errors,U))){const De=de(lt(r.errors,U),ke.argA,ke.argB);Ee&&Cn(r.errors,U,De),C4e(r.errors,U)}if(f.touchedFields&&Se&&Array.isArray(lt(r.touchedFields,U))){const De=de(lt(r.touchedFields,U),ke.argA,ke.argB);Ee&&Cn(r.touchedFields,U,De)}f.dirtyFields&&(r.dirtyFields=Q4(a,o)),m.state.next({name:U,isDirty:oe(U,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Cn(o,U,re)},N=(U,re)=>{Cn(r.errors,U,re),m.state.next({errors:r.errors})},x=(U,re,de,ke)=>{const Ee=lt(i,U);if(Ee){const Se=lt(o,U,qn(de)?lt(a,U):de);qn(Se)||ke&&ke.defaultChecked||re?Cn(o,U,re?Se:Z4(Ee._f)):Le(U,Se),s.mount&&v()}},D=(U,re,de,ke,Ee)=>{let Se=!1,De=!1;const ze={name:U};if(!de||ke){f.isDirty&&(De=r.isDirty,r.isDirty=ze.isDirty=oe(),Se=De!==ze.isDirty);const Ye=uu(lt(a,U),re);De=lt(r.dirtyFields,U),Ye?vr(r.dirtyFields,U):Cn(r.dirtyFields,U,!0),ze.dirtyFields=r.dirtyFields,Se=Se||f.dirtyFields&&De!==!Ye}if(de){const Ye=lt(r.touchedFields,U);Ye||(Cn(r.touchedFields,U,de),ze.touchedFields=r.touchedFields,Se=Se||f.touchedFields&&Ye!==de)}return Se&&Ee&&m.state.next(ze),Se?ze:{}},B=(U,re,de,ke)=>{const Ee=lt(r.errors,U),Se=f.isValid&&lu(re)&&r.isValid!==re;if(e.delayError&&de?(c=E(()=>N(U,de)),c(e.delayError)):(clearTimeout(p),c=null,de?Cn(r.errors,U,de):vr(r.errors,U)),(de?!uu(Ee,de):Ee)||!sa(ke)||Se){const De={...ke,...Se&&lu(re)?{isValid:re}:{},errors:r.errors,name:U};r={...r,...De},m.state.next(De)}w(!1)},V=async U=>n.resolver(o,n.context,S4e(U||u.mount,i,n.criteriaMode,n.shouldUseNativeValidation)),P=async U=>{const{errors:re}=await V(U);if(U)for(const de of U){const ke=lt(re,de);ke?Cn(r.errors,de,ke):vr(r.errors,de)}else r.errors=re;return re},Z=async(U,re,de={valid:!0})=>{for(const ke in U){const Ee=U[ke];if(Ee){const{_f:Se,...De}=Ee;if(Se){const ze=u.array.has(Se.name),Ye=await SN(Ee,o,T,n.shouldUseNativeValidation&&!re,ze);if(Ye[Se.name]&&(de.valid=!1,re))break;!re&&(lt(Ye,Se.name)?ze?E4e(r.errors,Ye,Se.name):Cn(r.errors,Se.name,Ye[Se.name]):vr(r.errors,Se.name))}De&&await Z(De,re,de)}}return de.valid},$=()=>{for(const U of u.unMount){const re=lt(i,U);re&&(re._f.refs?re._f.refs.every(de=>!X4(de)):!X4(re._f.ref))&&q(U)}u.unMount=new Set},oe=(U,re)=>(U&&re&&Cn(o,U,re),!uu(X(),a)),pe=(U,re,de)=>b4e(U,u,{...s.mount?o:qn(re)?a:yo(U)?{[U]:re}:re},de,re),ce=U=>yf(lt(s.mount?o:a,U,e.shouldUnregister?lt(a,U,[]):[])),Le=(U,re,de={})=>{const ke=lt(i,U);let Ee=re;if(ke){const Se=ke._f;Se&&(!Se.disabled&&Cn(o,U,aU(re,Se)),Ee=am(Se.ref)&&ei(re)?"":re,nU(Se.ref)?[...Se.ref.options].forEach(De=>De.selected=Ee.includes(De.value)):Se.refs?bf(Se.ref)?Se.refs.length>1?Se.refs.forEach(De=>(!De.defaultChecked||!De.disabled)&&(De.checked=Array.isArray(Ee)?!!Ee.find(ze=>ze===De.value):Ee===De.value)):Se.refs[0]&&(Se.refs[0].checked=!!Ee):Se.refs.forEach(De=>De.checked=De.value===Ee):UT(Se.ref)?Se.ref.value="":(Se.ref.value=Ee,Se.ref.type||m.values.next({name:U,values:{...o}})))}(de.shouldDirty||de.shouldTouch)&&D(U,Ee,de.shouldTouch,de.shouldDirty,!0),de.shouldValidate&&I(U)},se=(U,re,de)=>{for(const ke in re){const Ee=re[ke],Se=`${U}.${ke}`,De=lt(i,Se);(u.array.has(U)||!sm(Ee)||De&&!De._f)&&!F1(Ee)?se(Se,Ee,de):Le(Se,Ee,de)}},le=(U,re,de={})=>{const ke=lt(i,U),Ee=u.array.has(U),Se=Qo(re);Cn(o,U,Se),Ee?(m.array.next({name:U,values:{...o}}),(f.isDirty||f.dirtyFields)&&de.shouldDirty&&m.state.next({name:U,dirtyFields:Q4(a,o),isDirty:oe(U,Se)})):ke&&!ke._f&&!ei(Se)?se(U,Se,de):Le(U,Se,de),yN(U,u)&&m.state.next({...r}),m.values.next({name:U,values:{...o}}),!s.mount&&t()},he=async U=>{const re=U.target;let de=re.name,ke=!0;const Ee=lt(i,de),Se=()=>re.type?Z4(Ee._f):u4e(U);if(Ee){let De,ze;const Ye=Se(),Gt=U.type===mN.BLUR||U.type===mN.FOCUS_OUT,ue=!w4e(Ee._f)&&!n.resolver&&!lt(r.errors,de)&&!Ee._f.deps||A4e(Gt,lt(r.touchedFields,de),r.isSubmitted,y,b),ve=yN(de,u,Gt);Cn(o,de,Ye),Gt?(Ee._f.onBlur&&Ee._f.onBlur(U),c&&c(0)):Ee._f.onChange&&Ee._f.onChange(U);const qe=D(de,Ye,Gt,!1),H=!sa(qe)||ve;if(!Gt&&m.values.next({name:de,type:U.type,values:{...o}}),ue)return f.isValid&&v(),H&&m.state.next({name:de,...ve?{}:qe});if(!Gt&&ve&&m.state.next({...r}),w(!0),n.resolver){const{errors:me}=await V([de]),We=wN(r.errors,i,de),ge=wN(me,i,We.name||de);De=ge.error,de=ge.name,ze=sa(me)}else De=(await SN(Ee,o,T,n.shouldUseNativeValidation))[de],ke=Number.isNaN(Ye)||Ye===lt(o,de,Ye),ke&&(De?ze=!1:f.isValid&&(ze=await Z(i,!0)));ke&&(Ee._f.deps&&I(Ee._f.deps),B(de,ze,De,qe))}},I=async(U,re={})=>{let de,ke;const Ee=K4(U);if(w(!0),n.resolver){const Se=await P(qn(U)?U:Ee);de=sa(Se),ke=U?!Ee.some(De=>lt(Se,De)):de}else U?(ke=(await Promise.all(Ee.map(async Se=>{const De=lt(i,Se);return await Z(De&&De._f?{[Se]:De}:De)}))).every(Boolean),!(!ke&&!r.isValid)&&v()):ke=de=await Z(i);return m.state.next({...!yo(U)||f.isValid&&de!==r.isValid?{}:{name:U},...n.resolver||!U?{isValid:de}:{},errors:r.errors,isValidating:!1}),re.shouldFocus&&!ke&&lE(i,Se=>Se&<(r.errors,Se),U?Ee:u.mount),ke},X=U=>{const re={...a,...s.mount?o:{}};return qn(U)?re:yo(U)?lt(re,U):U.map(de=>lt(re,de))},ae=(U,re)=>({invalid:!!lt((re||r).errors,U),isDirty:!!lt((re||r).dirtyFields,U),isTouched:!!lt((re||r).touchedFields,U),error:lt((re||r).errors,U)}),O=U=>{U&&K4(U).forEach(re=>vr(r.errors,re)),m.state.next({errors:U?r.errors:{}})},Q=(U,re,de)=>{const ke=(lt(i,U,{_f:{}})._f||{}).ref;Cn(r.errors,U,{...re,ref:ke}),m.state.next({name:U,errors:r.errors,isValid:!1}),de&&de.shouldFocus&&ke&&ke.focus&&ke.focus()},be=(U,re)=>Js(U)?m.values.subscribe({next:de=>U(pe(void 0,re),de)}):pe(U,re,!0),q=(U,re={})=>{for(const de of U?K4(U):u.mount)u.mount.delete(de),u.array.delete(de),re.keepValue||(vr(i,de),vr(o,de)),!re.keepError&&vr(r.errors,de),!re.keepDirty&&vr(r.dirtyFields,de),!re.keepTouched&&vr(r.touchedFields,de),!n.shouldUnregister&&!re.keepDefaultValue&&vr(a,de);m.values.next({values:{...o}}),m.state.next({...r,...re.keepDirty?{isDirty:oe()}:{}}),!re.keepIsValid&&v()},we=({disabled:U,name:re,field:de,fields:ke})=>{if(lu(U)){const Ee=U?void 0:lt(o,re,Z4(de?de._f:lt(ke,re)._f));Cn(o,re,Ee),D(re,Ee,!1,!1,!0)}},te=(U,re={})=>{let de=lt(i,U);const ke=lu(re.disabled);return Cn(i,U,{...de||{},_f:{...de&&de._f?de._f:{ref:{name:U}},name:U,mount:!0,...re}}),u.mount.add(U),de?we({field:de,disabled:re.disabled,name:U}):x(U,!0,re.value),{...ke?{disabled:re.disabled}:{},...n.progressive?{required:!!re.required,min:md(re.min),max:md(re.max),minLength:md(re.minLength),maxLength:md(re.maxLength),pattern:md(re.pattern)}:{},name:U,onChange:he,onBlur:he,ref:Ee=>{if(Ee){te(U,re),de=lt(i,U);const Se=qn(Ee.value)&&Ee.querySelectorAll&&Ee.querySelectorAll("input,select,textarea")[0]||Ee,De=T4e(Se),ze=de._f.refs||[];if(De?ze.find(Ye=>Ye===Se):Se===de._f.ref)return;Cn(i,U,{_f:{...de._f,...De?{refs:[...ze.filter(X4),Se,...Array.isArray(lt(a,U))?[{}]:[]],ref:{type:Se.type,name:U}}:{ref:Se}}}),x(U,!1,void 0,Se)}else de=lt(i,U,{}),de._f&&(de._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(d4e(u.array,U)&&s.action)&&u.unMount.add(U)}}},Me=()=>n.shouldFocusError&&lE(i,U=>U&<(r.errors,U),u.mount),Re=(U,re)=>async de=>{de&&(de.preventDefault&&de.preventDefault(),de.persist&&de.persist());let ke=Qo(o);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:Ee,values:Se}=await V();r.errors=Ee,ke=Se}else await Z(i);vr(r.errors,"root"),sa(r.errors)?(m.state.next({errors:{}}),await U(ke,de)):(re&&await re({...r.errors},de),Me(),setTimeout(Me)),m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:sa(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Qe=(U,re={})=>{lt(i,U)&&(qn(re.defaultValue)?le(U,lt(a,U)):(le(U,re.defaultValue),Cn(a,U,re.defaultValue)),re.keepTouched||vr(r.touchedFields,U),re.keepDirty||(vr(r.dirtyFields,U),r.isDirty=re.defaultValue?oe(U,lt(a,U)):oe()),re.keepError||(vr(r.errors,U),f.isValid&&v()),m.state.next({...r}))},Ve=(U,re={})=>{const de=U?Qo(U):a,ke=Qo(de),Ee=U&&!sa(U)?ke:a;if(re.keepDefaultValues||(a=de),!re.keepValues){if(re.keepDirtyValues||h)for(const Se of u.mount)lt(r.dirtyFields,Se)?Cn(Ee,Se,lt(o,Se)):le(Se,lt(Ee,Se));else{if(PT&&qn(U))for(const Se of u.mount){const De=lt(i,Se);if(De&&De._f){const ze=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(am(ze)){const Ye=ze.closest("form");if(Ye){Ye.reset();break}}}}i={}}o=e.shouldUnregister?re.keepDefaultValues?Qo(a):{}:Qo(Ee),m.array.next({values:{...Ee}}),m.values.next({values:{...Ee}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!f.isValid||!!re.keepIsValid,s.watch=!!e.shouldUnregister,m.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!uu(U,a)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:re.keepDirtyValues?r.dirtyFields:re.keepDefaultValues&&U?Q4(a,U):{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},dt=(U,re)=>Ve(Js(U)?U(o):U,re);return{control:{register:te,unregister:q,getFieldState:ae,handleSubmit:Re,setError:Q,_executeSchema:V,_getWatch:pe,_getDirty:oe,_updateValid:v,_removeUnmounted:$,_updateFieldArray:A,_updateDisabledField:we,_getFieldArray:ce,_reset:Ve,_resetDefaultValues:()=>Js(n.defaultValues)&&n.defaultValues().then(U=>{dt(U,n.resetOptions),m.state.next({isLoading:!1})}),_updateFormState:U=>{r={...r,...U}},_subjects:m,_proxyFormState:f,get _fields(){return i},get _formValues(){return o},get _state(){return s},set _state(U){s=U},get _defaultValues(){return a},get _names(){return u},set _names(U){u=U},get _formState(){return r},set _formState(U){r=U},get _options(){return n},set _options(U){n={...n,...U}}},trigger:I,register:te,handleSubmit:Re,watch:be,setValue:le,getValues:X,reset:dt,resetField:Qe,clearErrors:O,unregister:q,setError:Q,setFocus:(U,re={})=>{const de=lt(i,U),ke=de&&de._f;if(ke){const Ee=ke.refs?ke.refs[0]:ke.ref;Ee.focus&&(Ee.focus(),re.shouldSelect&&Ee.select())}},getFieldState:ae}}function oU(e={}){const t=ut.useRef(),n=ut.useRef(),[r,i]=ut.useState({isDirty:!1,isValidating:!1,isLoading:Js(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:Js(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...k4e(e,()=>i(o=>({...o}))),formState:r});const a=t.current.control;return a._options=e,m4e({subject:a._subjects.state,next:o=>{g4e(o,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),ut.useEffect(()=>{e.values&&!uu(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values):a._resetDefaultValues()},[e.values,a]),ut.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=h4e(r,a),t.current}const AN=He.hr` +`;function l4e(e){const t=wt(n=>n.config.vscMediaUrl);return R.jsx(s4e,{children:t?R.jsx("img",{src:`${t}/play_button.png`,width:"22px"}):R.jsx(kL,{width:e.size||XB})})}const sE=({msg:e})=>{const t="info-hover",n=document.getElementById("tooltip-portal-div");return R.jsxs(R.Fragment,{children:[R.jsx(MQ,{"data-tooltip-id":t,className:"h-5 w-5 text-gray-500 cursor-help"}),n&&d9.createPortal(R.jsx(Qs,{id:t,place:"bottom",children:e}),n)]})};var bf=e=>e.type==="checkbox",F1=e=>e instanceof Date,ei=e=>e==null;const QB=e=>typeof e=="object";var ar=e=>!ei(e)&&!Array.isArray(e)&&QB(e)&&!F1(e),u4e=e=>ar(e)&&e.target?bf(e.target)?e.target.checked:e.target.value:e,c4e=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d4e=(e,t)=>e.has(c4e(t)),p4e=e=>{const t=e.constructor&&e.constructor.prototype;return ar(t)&&t.hasOwnProperty("isPrototypeOf")},PT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qo(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(PT&&(e instanceof Blob||e instanceof FileList))&&(n||ar(e)))if(t=n?[]:{},!n&&!p4e(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Qo(e[r]));else return e;return t}var yf=e=>Array.isArray(e)?e.filter(Boolean):[],qn=e=>e===void 0,lt=(e,t,n)=>{if(!t||!ar(e))return n;const r=yf(t.split(/[,[\].]+?/)).reduce((i,a)=>ei(i)?i:i[a],e);return qn(r)||r===e?qn(e[t])?n:e[t]:r},lu=e=>typeof e=="boolean";const mN={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ha={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ko={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},f4e=ut.createContext(null),ZB=e=>{const{children:t,...n}=e;return ut.createElement(f4e.Provider,{value:n},t)};var h4e=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const o=a;return t._proxyFormState[o]!==Ha.all&&(t._proxyFormState[o]=!r||Ha.all),n&&(n[o]=!0),e[o]}});return i},sa=e=>ar(e)&&!Object.keys(e).length,g4e=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return sa(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||Ha.all))},K4=e=>Array.isArray(e)?e:[e];function m4e(e){const t=ut.useRef(e);t.current=e,ut.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var yo=e=>typeof e=="string",b4e=(e,t,n,r,i)=>yo(e)?(r&&t.watch.add(e),lt(n,e,i)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),lt(n,a))):(r&&(t.watchAll=!0),n),BT=e=>/^\w*$/.test(e),JB=e=>yf(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Cn(e,t,n){let r=-1;const i=BT(t)?[t]:JB(t),a=i.length,o=a-1;for(;++rt?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{};const lE=(e,t,n)=>{for(const r of n||Object.keys(e)){const i=lt(e,r);if(i){const{_f:a,...o}=i;if(a&&t(a.name)){if(a.ref.focus){a.ref.focus();break}else if(a.refs&&a.refs[0].focus){a.refs[0].focus();break}}else ar(o)&&lE(o,t)}}};var bN=e=>({isOnSubmit:!e||e===Ha.onSubmit,isOnBlur:e===Ha.onBlur,isOnChange:e===Ha.onChange,isOnAll:e===Ha.all,isOnTouch:e===Ha.onTouched}),yN=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),E4e=(e,t,n)=>{const r=yf(lt(e,n));return Cn(r,"root",t[n]),Cn(e,n,r),e},UT=e=>e.type==="file",Js=e=>typeof e=="function",am=e=>{if(!PT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yh=e=>yo(e),$T=e=>e.type==="radio",om=e=>e instanceof RegExp;const EN={value:!1,isValid:!1},vN={value:!0,isValid:!0};var eU=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!qn(e[0].attributes.value)?qn(e[0].value)||e[0].value===""?vN:{value:e[0].value,isValid:!0}:vN:EN}return EN};const _N={isValid:!1,value:null};var tU=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,_N):_N;function TN(e,t,n="validate"){if(Yh(e)||Array.isArray(e)&&e.every(Yh)||lu(e)&&!e)return{type:n,message:Yh(e)?e:"",ref:t}}var a1=e=>ar(e)&&!om(e)?e:{value:e,message:""},SN=async(e,t,n,r,i)=>{const{ref:a,refs:o,required:s,maxLength:u,minLength:c,min:p,max:f,pattern:m,validate:h,name:b,valueAsNumber:y,mount:T,disabled:E}=e._f,v=lt(t,b);if(!T||E)return{};const w=o?o[0]:a,A=$=>{r&&w.reportValidity&&(w.setCustomValidity(lu($)?"":$||""),w.reportValidity())},N={},x=$T(a),D=bf(a),B=x||D,V=(y||UT(a))&&qn(a.value)&&qn(v)||am(a)&&a.value===""||v===""||Array.isArray(v)&&!v.length,P=y4e.bind(null,b,n,N),Z=($,oe,pe,ce=Ko.maxLength,Le=Ko.minLength)=>{const se=$?oe:pe;N[b]={type:$?ce:Le,message:se,ref:a,...P($?ce:Le,se)}};if(i?!Array.isArray(v)||!v.length:s&&(!B&&(V||ei(v))||lu(v)&&!v||D&&!eU(o).isValid||x&&!tU(o).isValid)){const{value:$,message:oe}=Yh(s)?{value:!!s,message:s}:a1(s);if($&&(N[b]={type:Ko.required,message:oe,ref:w,...P(Ko.required,oe)},!n))return A(oe),N}if(!V&&(!ei(p)||!ei(f))){let $,oe;const pe=a1(f),ce=a1(p);if(!ei(v)&&!isNaN(v)){const Le=a.valueAsNumber||v&&+v;ei(pe.value)||($=Le>pe.value),ei(ce.value)||(oe=Lenew Date(new Date().toDateString()+" "+I),le=a.type=="time",he=a.type=="week";yo(pe.value)&&v&&($=le?se(v)>se(pe.value):he?v>pe.value:Le>new Date(pe.value)),yo(ce.value)&&v&&(oe=le?se(v)+$.value,ce=!ei(oe.value)&&v.length<+oe.value;if((pe||ce)&&(Z(pe,$.message,oe.message),!n))return A(N[b].message),N}if(m&&!V&&yo(v)){const{value:$,message:oe}=a1(m);if(om($)&&!v.match($)&&(N[b]={type:Ko.pattern,message:oe,ref:a,...P(Ko.pattern,oe)},!n))return A(oe),N}if(h){if(Js(h)){const $=await h(v,t),oe=TN($,w);if(oe&&(N[b]={...oe,...P(Ko.validate,oe.message)},!n))return A(oe.message),N}else if(ar(h)){let $={};for(const oe in h){if(!sa($)&&!n)break;const pe=TN(await h[oe](v,t),w,oe);pe&&($={...pe,...P(oe,pe.message)},A(pe.message),n&&(N[b]=$))}if(!sa($)&&(N[b]={ref:w,...$},!n))return N}}return A(!0),N};function v4e(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}}var sm=e=>ei(e)||!QB(e);function uu(e,t){if(sm(e)||sm(t))return e===t;if(F1(e)&&F1(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const a=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if(F1(a)&&F1(o)||ar(a)&&ar(o)||Array.isArray(a)&&Array.isArray(o)?!uu(a,o):a!==o)return!1}}return!0}var nU=e=>e.type==="select-multiple",T4e=e=>$T(e)||bf(e),X4=e=>am(e)&&e.isConnected,rU=e=>{for(const t in e)if(Js(e[t]))return!0;return!1};function lm(e,t={}){const n=Array.isArray(e);if(ar(e)||n)for(const r in e)Array.isArray(e[r])||ar(e[r])&&!rU(e[r])?(t[r]=Array.isArray(e[r])?[]:{},lm(e[r],t[r])):ei(e[r])||(t[r]=!0);return t}function iU(e,t,n){const r=Array.isArray(e);if(ar(e)||r)for(const i in e)Array.isArray(e[i])||ar(e[i])&&!rU(e[i])?qn(t)||sm(n[i])?n[i]=Array.isArray(e[i])?lm(e[i],[]):{...lm(e[i])}:iU(e[i],ei(t)?{}:t[i],n[i]):n[i]=!uu(e[i],t[i]);return n}var Q4=(e,t)=>iU(e,t,lm(t)),aU=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>qn(e)?e:t?e===""?NaN:e&&+e:n&&yo(e)?new Date(e):r?r(e):e;function Z4(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return UT(t)?t.files:$T(t)?tU(e.refs).value:nU(t)?[...t.selectedOptions].map(({value:n})=>n):bf(t)?eU(e.refs).value:aU(qn(t.value)?e.ref.value:t.value,e)}var S4e=(e,t,n,r)=>{const i={};for(const a of e){const o=lt(t,a);o&&Cn(i,a,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},md=e=>qn(e)?e:om(e)?e.source:ar(e)?om(e.value)?e.value.source:e.value:e,w4e=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function wN(e,t,n){const r=lt(e,n);if(r||BT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=lt(t,a),s=lt(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};i.pop()}return{name:n}}var A4e=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,C4e=(e,t)=>!yf(lt(e,t)).length&&vr(e,t);const x4e={mode:Ha.onSubmit,reValidateMode:Ha.onChange,shouldFocusError:!0};function k4e(e={},t){let n={...x4e,...e},r={submitCount:0,isDirty:!1,isLoading:Js(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},a=ar(n.defaultValues)||ar(n.values)?Qo(n.defaultValues||n.values)||{}:{},o=n.shouldUnregister?{}:Qo(a),s={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,p=0;const f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={values:Y4(),array:Y4(),state:Y4()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,b=bN(n.mode),y=bN(n.reValidateMode),T=n.criteriaMode===Ha.all,E=U=>re=>{clearTimeout(p),p=setTimeout(U,re)},v=async U=>{if(f.isValid||U){const re=n.resolver?sa((await V()).errors):await Z(i,!0);re!==r.isValid&&m.state.next({isValid:re})}},w=U=>f.isValidating&&m.state.next({isValidating:U}),A=(U,re=[],de,ke,Ee=!0,Se=!0)=>{if(ke&&de){if(s.action=!0,Se&&Array.isArray(lt(i,U))){const De=de(lt(i,U),ke.argA,ke.argB);Ee&&Cn(i,U,De)}if(Se&&Array.isArray(lt(r.errors,U))){const De=de(lt(r.errors,U),ke.argA,ke.argB);Ee&&Cn(r.errors,U,De),C4e(r.errors,U)}if(f.touchedFields&&Se&&Array.isArray(lt(r.touchedFields,U))){const De=de(lt(r.touchedFields,U),ke.argA,ke.argB);Ee&&Cn(r.touchedFields,U,De)}f.dirtyFields&&(r.dirtyFields=Q4(a,o)),m.state.next({name:U,isDirty:oe(U,re),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Cn(o,U,re)},N=(U,re)=>{Cn(r.errors,U,re),m.state.next({errors:r.errors})},x=(U,re,de,ke)=>{const Ee=lt(i,U);if(Ee){const Se=lt(o,U,qn(de)?lt(a,U):de);qn(Se)||ke&&ke.defaultChecked||re?Cn(o,U,re?Se:Z4(Ee._f)):Le(U,Se),s.mount&&v()}},D=(U,re,de,ke,Ee)=>{let Se=!1,De=!1;const ze={name:U};if(!de||ke){f.isDirty&&(De=r.isDirty,r.isDirty=ze.isDirty=oe(),Se=De!==ze.isDirty);const Ye=uu(lt(a,U),re);De=lt(r.dirtyFields,U),Ye?vr(r.dirtyFields,U):Cn(r.dirtyFields,U,!0),ze.dirtyFields=r.dirtyFields,Se=Se||f.dirtyFields&&De!==!Ye}if(de){const Ye=lt(r.touchedFields,U);Ye||(Cn(r.touchedFields,U,de),ze.touchedFields=r.touchedFields,Se=Se||f.touchedFields&&Ye!==de)}return Se&&Ee&&m.state.next(ze),Se?ze:{}},B=(U,re,de,ke)=>{const Ee=lt(r.errors,U),Se=f.isValid&&lu(re)&&r.isValid!==re;if(e.delayError&&de?(c=E(()=>N(U,de)),c(e.delayError)):(clearTimeout(p),c=null,de?Cn(r.errors,U,de):vr(r.errors,U)),(de?!uu(Ee,de):Ee)||!sa(ke)||Se){const De={...ke,...Se&&lu(re)?{isValid:re}:{},errors:r.errors,name:U};r={...r,...De},m.state.next(De)}w(!1)},V=async U=>n.resolver(o,n.context,S4e(U||u.mount,i,n.criteriaMode,n.shouldUseNativeValidation)),P=async U=>{const{errors:re}=await V(U);if(U)for(const de of U){const ke=lt(re,de);ke?Cn(r.errors,de,ke):vr(r.errors,de)}else r.errors=re;return re},Z=async(U,re,de={valid:!0})=>{for(const ke in U){const Ee=U[ke];if(Ee){const{_f:Se,...De}=Ee;if(Se){const ze=u.array.has(Se.name),Ye=await SN(Ee,o,T,n.shouldUseNativeValidation&&!re,ze);if(Ye[Se.name]&&(de.valid=!1,re))break;!re&&(lt(Ye,Se.name)?ze?E4e(r.errors,Ye,Se.name):Cn(r.errors,Se.name,Ye[Se.name]):vr(r.errors,Se.name))}De&&await Z(De,re,de)}}return de.valid},$=()=>{for(const U of u.unMount){const re=lt(i,U);re&&(re._f.refs?re._f.refs.every(de=>!X4(de)):!X4(re._f.ref))&&q(U)}u.unMount=new Set},oe=(U,re)=>(U&&re&&Cn(o,U,re),!uu(X(),a)),pe=(U,re,de)=>b4e(U,u,{...s.mount?o:qn(re)?a:yo(U)?{[U]:re}:re},de,re),ce=U=>yf(lt(s.mount?o:a,U,e.shouldUnregister?lt(a,U,[]):[])),Le=(U,re,de={})=>{const ke=lt(i,U);let Ee=re;if(ke){const Se=ke._f;Se&&(!Se.disabled&&Cn(o,U,aU(re,Se)),Ee=am(Se.ref)&&ei(re)?"":re,nU(Se.ref)?[...Se.ref.options].forEach(De=>De.selected=Ee.includes(De.value)):Se.refs?bf(Se.ref)?Se.refs.length>1?Se.refs.forEach(De=>(!De.defaultChecked||!De.disabled)&&(De.checked=Array.isArray(Ee)?!!Ee.find(ze=>ze===De.value):Ee===De.value)):Se.refs[0]&&(Se.refs[0].checked=!!Ee):Se.refs.forEach(De=>De.checked=De.value===Ee):UT(Se.ref)?Se.ref.value="":(Se.ref.value=Ee,Se.ref.type||m.values.next({name:U,values:{...o}})))}(de.shouldDirty||de.shouldTouch)&&D(U,Ee,de.shouldTouch,de.shouldDirty,!0),de.shouldValidate&&I(U)},se=(U,re,de)=>{for(const ke in re){const Ee=re[ke],Se=`${U}.${ke}`,De=lt(i,Se);(u.array.has(U)||!sm(Ee)||De&&!De._f)&&!F1(Ee)?se(Se,Ee,de):Le(Se,Ee,de)}},le=(U,re,de={})=>{const ke=lt(i,U),Ee=u.array.has(U),Se=Qo(re);Cn(o,U,Se),Ee?(m.array.next({name:U,values:{...o}}),(f.isDirty||f.dirtyFields)&&de.shouldDirty&&m.state.next({name:U,dirtyFields:Q4(a,o),isDirty:oe(U,Se)})):ke&&!ke._f&&!ei(Se)?se(U,Se,de):Le(U,Se,de),yN(U,u)&&m.state.next({...r}),m.values.next({name:U,values:{...o}}),!s.mount&&t()},he=async U=>{const re=U.target;let de=re.name,ke=!0;const Ee=lt(i,de),Se=()=>re.type?Z4(Ee._f):u4e(U);if(Ee){let De,ze;const Ye=Se(),Gt=U.type===mN.BLUR||U.type===mN.FOCUS_OUT,ue=!w4e(Ee._f)&&!n.resolver&&!lt(r.errors,de)&&!Ee._f.deps||A4e(Gt,lt(r.touchedFields,de),r.isSubmitted,y,b),ve=yN(de,u,Gt);Cn(o,de,Ye),Gt?(Ee._f.onBlur&&Ee._f.onBlur(U),c&&c(0)):Ee._f.onChange&&Ee._f.onChange(U);const qe=D(de,Ye,Gt,!1),H=!sa(qe)||ve;if(!Gt&&m.values.next({name:de,type:U.type,values:{...o}}),ue)return f.isValid&&v(),H&&m.state.next({name:de,...ve?{}:qe});if(!Gt&&ve&&m.state.next({...r}),w(!0),n.resolver){const{errors:me}=await V([de]),We=wN(r.errors,i,de),ge=wN(me,i,We.name||de);De=ge.error,de=ge.name,ze=sa(me)}else De=(await SN(Ee,o,T,n.shouldUseNativeValidation))[de],ke=Number.isNaN(Ye)||Ye===lt(o,de,Ye),ke&&(De?ze=!1:f.isValid&&(ze=await Z(i,!0)));ke&&(Ee._f.deps&&I(Ee._f.deps),B(de,ze,De,qe))}},I=async(U,re={})=>{let de,ke;const Ee=K4(U);if(w(!0),n.resolver){const Se=await P(qn(U)?U:Ee);de=sa(Se),ke=U?!Ee.some(De=>lt(Se,De)):de}else U?(ke=(await Promise.all(Ee.map(async Se=>{const De=lt(i,Se);return await Z(De&&De._f?{[Se]:De}:De)}))).every(Boolean),!(!ke&&!r.isValid)&&v()):ke=de=await Z(i);return m.state.next({...!yo(U)||f.isValid&&de!==r.isValid?{}:{name:U},...n.resolver||!U?{isValid:de}:{},errors:r.errors,isValidating:!1}),re.shouldFocus&&!ke&&lE(i,Se=>Se&<(r.errors,Se),U?Ee:u.mount),ke},X=U=>{const re={...a,...s.mount?o:{}};return qn(U)?re:yo(U)?lt(re,U):U.map(de=>lt(re,de))},ae=(U,re)=>({invalid:!!lt((re||r).errors,U),isDirty:!!lt((re||r).dirtyFields,U),isTouched:!!lt((re||r).touchedFields,U),error:lt((re||r).errors,U)}),O=U=>{U&&K4(U).forEach(re=>vr(r.errors,re)),m.state.next({errors:U?r.errors:{}})},Q=(U,re,de)=>{const ke=(lt(i,U,{_f:{}})._f||{}).ref;Cn(r.errors,U,{...re,ref:ke}),m.state.next({name:U,errors:r.errors,isValid:!1}),de&&de.shouldFocus&&ke&&ke.focus&&ke.focus()},be=(U,re)=>Js(U)?m.values.subscribe({next:de=>U(pe(void 0,re),de)}):pe(U,re,!0),q=(U,re={})=>{for(const de of U?K4(U):u.mount)u.mount.delete(de),u.array.delete(de),re.keepValue||(vr(i,de),vr(o,de)),!re.keepError&&vr(r.errors,de),!re.keepDirty&&vr(r.dirtyFields,de),!re.keepTouched&&vr(r.touchedFields,de),!n.shouldUnregister&&!re.keepDefaultValue&&vr(a,de);m.values.next({values:{...o}}),m.state.next({...r,...re.keepDirty?{isDirty:oe()}:{}}),!re.keepIsValid&&v()},we=({disabled:U,name:re,field:de,fields:ke})=>{if(lu(U)){const Ee=U?void 0:lt(o,re,Z4(de?de._f:lt(ke,re)._f));Cn(o,re,Ee),D(re,Ee,!1,!1,!0)}},te=(U,re={})=>{let de=lt(i,U);const ke=lu(re.disabled);return Cn(i,U,{...de||{},_f:{...de&&de._f?de._f:{ref:{name:U}},name:U,mount:!0,...re}}),u.mount.add(U),de?we({field:de,disabled:re.disabled,name:U}):x(U,!0,re.value),{...ke?{disabled:re.disabled}:{},...n.progressive?{required:!!re.required,min:md(re.min),max:md(re.max),minLength:md(re.minLength),maxLength:md(re.maxLength),pattern:md(re.pattern)}:{},name:U,onChange:he,onBlur:he,ref:Ee=>{if(Ee){te(U,re),de=lt(i,U);const Se=qn(Ee.value)&&Ee.querySelectorAll&&Ee.querySelectorAll("input,select,textarea")[0]||Ee,De=T4e(Se),ze=de._f.refs||[];if(De?ze.find(Ye=>Ye===Se):Se===de._f.ref)return;Cn(i,U,{_f:{...de._f,...De?{refs:[...ze.filter(X4),Se,...Array.isArray(lt(a,U))?[{}]:[]],ref:{type:Se.type,name:U}}:{ref:Se}}}),x(U,!1,void 0,Se)}else de=lt(i,U,{}),de._f&&(de._f.mount=!1),(n.shouldUnregister||re.shouldUnregister)&&!(d4e(u.array,U)&&s.action)&&u.unMount.add(U)}}},Me=()=>n.shouldFocusError&&lE(i,U=>U&<(r.errors,U),u.mount),Re=(U,re)=>async de=>{de&&(de.preventDefault&&de.preventDefault(),de.persist&&de.persist());let ke=Qo(o);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:Ee,values:Se}=await V();r.errors=Ee,ke=Se}else await Z(i);vr(r.errors,"root"),sa(r.errors)?(m.state.next({errors:{}}),await U(ke,de)):(re&&await re({...r.errors},de),Me(),setTimeout(Me)),m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:sa(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Qe=(U,re={})=>{lt(i,U)&&(qn(re.defaultValue)?le(U,lt(a,U)):(le(U,re.defaultValue),Cn(a,U,re.defaultValue)),re.keepTouched||vr(r.touchedFields,U),re.keepDirty||(vr(r.dirtyFields,U),r.isDirty=re.defaultValue?oe(U,lt(a,U)):oe()),re.keepError||(vr(r.errors,U),f.isValid&&v()),m.state.next({...r}))},Ve=(U,re={})=>{const de=U?Qo(U):a,ke=Qo(de),Ee=U&&!sa(U)?ke:a;if(re.keepDefaultValues||(a=de),!re.keepValues){if(re.keepDirtyValues||h)for(const Se of u.mount)lt(r.dirtyFields,Se)?Cn(Ee,Se,lt(o,Se)):le(Se,lt(Ee,Se));else{if(PT&&qn(U))for(const Se of u.mount){const De=lt(i,Se);if(De&&De._f){const ze=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(am(ze)){const Ye=ze.closest("form");if(Ye){Ye.reset();break}}}}i={}}o=e.shouldUnregister?re.keepDefaultValues?Qo(a):{}:Qo(Ee),m.array.next({values:{...Ee}}),m.values.next({values:{...Ee}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!f.isValid||!!re.keepIsValid,s.watch=!!e.shouldUnregister,m.state.next({submitCount:re.keepSubmitCount?r.submitCount:0,isDirty:re.keepDirty?r.isDirty:!!(re.keepDefaultValues&&!uu(U,a)),isSubmitted:re.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:re.keepDirtyValues?r.dirtyFields:re.keepDefaultValues&&U?Q4(a,U):{},touchedFields:re.keepTouched?r.touchedFields:{},errors:re.keepErrors?r.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},dt=(U,re)=>Ve(Js(U)?U(o):U,re);return{control:{register:te,unregister:q,getFieldState:ae,handleSubmit:Re,setError:Q,_executeSchema:V,_getWatch:pe,_getDirty:oe,_updateValid:v,_removeUnmounted:$,_updateFieldArray:A,_updateDisabledField:we,_getFieldArray:ce,_reset:Ve,_resetDefaultValues:()=>Js(n.defaultValues)&&n.defaultValues().then(U=>{dt(U,n.resetOptions),m.state.next({isLoading:!1})}),_updateFormState:U=>{r={...r,...U}},_subjects:m,_proxyFormState:f,get _fields(){return i},get _formValues(){return o},get _state(){return s},set _state(U){s=U},get _defaultValues(){return a},get _names(){return u},set _names(U){u=U},get _formState(){return r},set _formState(U){r=U},get _options(){return n},set _options(U){n={...n,...U}}},trigger:I,register:te,handleSubmit:Re,watch:be,setValue:le,getValues:X,reset:dt,resetField:Qe,clearErrors:O,unregister:q,setError:Q,setFocus:(U,re={})=>{const de=lt(i,U),ke=de&&de._f;if(ke){const Ee=ke.refs?ke.refs[0]:ke.ref;Ee.focus&&(Ee.focus(),re.shouldSelect&&Ee.select())}},getFieldState:ae}}function oU(e={}){const t=ut.useRef(),n=ut.useRef(),[r,i]=ut.useState({isDirty:!1,isValidating:!1,isLoading:Js(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:Js(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...k4e(e,()=>i(o=>({...o}))),formState:r});const a=t.current.control;return a._options=e,m4e({subject:a._subjects.state,next:o=>{g4e(o,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),ut.useEffect(()=>{e.values&&!uu(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values):a._resetDefaultValues()},[e.values,a]),ut.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=h4e(r,a),t.current}const AN=He.hr` border: 0.5px solid ${Et}; `,I4e=He(_p)` background-color: transparent; @@ -1148,7 +1148,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho outline: none; border: none; } -`;function O4e(){const e=oU(),t=s=>console.log(s),n=bs(),r=C.useContext(eo),i=St(s=>s.serverState.config);Io();const a=()=>{if(!r)return;const s=e.watch("system_message"),u=e.watch("temperature");r.setSystemMessage(s||""),u&&r.setTemperature(u)},o=()=>{a(),n("/")};return C.useEffect(()=>{i&&(e.setValue("system_message",i.system_message),e.setValue("temperature",i.temperature))},[i]),R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:o,className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Settings"})]}),R.jsx("form",{onSubmit:e.handleSubmit(t),children:i?R.jsxs("div",{className:"p-2",children:[R.jsxs("h3",{className:"flex gap-1",children:["System Message",R.jsx(sE,{msg:`Set a system message with information that the LLM should always +`;function O4e(){const e=oU(),t=s=>console.log(s),n=bs(),r=C.useContext(eo),i=wt(s=>s.serverState.config);Io();const a=()=>{if(!r)return;const s=e.watch("system_message"),u=e.watch("temperature");r.setSystemMessage(s||""),u&&r.setTemperature(u)},o=()=>{a(),n("/")};return C.useEffect(()=>{i&&(e.setValue("system_message",i.system_message),e.setValue("temperature",i.temperature))},[i]),R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:o,className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Settings"})]}),R.jsx("form",{onSubmit:e.handleSubmit(t),children:i?R.jsxs("div",{className:"p-2",children:[R.jsxs("h3",{className:"flex gap-1",children:["System Message",R.jsx(sE,{msg:`Set a system message with information that the LLM should always keep in mind (e.g. "Please give concise answers. Always respond in Spanish.")`})]}),R.jsx(VX,{placeholder:"Enter a system message (e.g. 'Always respond in German')",...e.register("system_message")}),R.jsx(AN,{}),R.jsxs("h3",{className:"flex gap-1",children:["Temperature",R.jsx(sE,{msg:`Set temperature to any value between 0 and 1. Higher values will make the LLM more creative, while lower values will make it more @@ -1159,9 +1159,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */um.exports;(function(e,t){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",c=500,p="__lodash_placeholder__",f=1,m=2,h=4,b=1,y=2,T=1,E=2,v=4,w=8,A=16,N=32,x=64,D=128,B=256,V=512,P=30,Z="...",$=800,oe=16,pe=1,ce=2,Le=3,se=1/0,le=9007199254740991,he=17976931348623157e292,I=0/0,X=4294967295,ae=X-1,O=X>>>1,Q=[["ary",D],["bind",T],["bindKey",E],["curry",w],["curryRight",A],["flip",V],["partial",N],["partialRight",x],["rearg",B]],be="[object Arguments]",q="[object Array]",we="[object AsyncFunction]",te="[object Boolean]",Me="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ve="[object Function]",dt="[object GeneratorFunction]",ot="[object Map]",Ge="[object Number]",pt="[object Null]",U="[object Object]",re="[object Promise]",de="[object Proxy]",ke="[object RegExp]",Ee="[object Set]",Se="[object String]",De="[object Symbol]",ze="[object Undefined]",Ye="[object WeakMap]",Gt="[object WeakSet]",ue="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",H="[object Float64Array]",me="[object Int8Array]",We="[object Int16Array]",ge="[object Int32Array]",j="[object Uint8Array]",W="[object Uint8ClampedArray]",ne="[object Uint16Array]",_e="[object Uint32Array]",Ze=/\b__p \+= '';/g,Fe=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rt=/&(?:amp|lt|gt|quot|#39);/g,Je=/[&<>"']/g,Nt=RegExp(rt.source),Zt=RegExp(Je.source),It=/<%-([\s\S]+?)%>/g,rn=/<%([\s\S]+?)%>/g,Xt=/<%=([\s\S]+?)%>/g,Wr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qr=/^\w*$/,Kr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aa=/[\\^$.*+?()[\]{}|]/g,si=RegExp(Aa.source),Or=/^\s+/,Es=/\s/,vs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yr=/\{\n\/\* \[wrapped with (.+)\] \*/,_s=/,? & /,Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dr=/[()=,{}\[\]\/\s]/,wi=/\\(\\)?/g,Nl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ke=/\w*$/,J=/^[-+]0x[0-9a-f]+$/i,Be=/^0b[01]+$/i,it=/^\[object .+?Constructor\]$/,un=/^0o[0-7]+$/i,or=/^(?:0|[1-9]\d*)$/,sr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qn=/($^)/,No=/['\n\r\u2028\u2029\\]/g,to="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ef="\\ufe20-\\ufe2f",vf="\\u20d0-\\u20ff",VT=Lr+Ef+vf,WT="\\u2700-\\u27bf",qT="a-z\\xdf-\\xf6\\xf8-\\xff",_U="\\xac\\xb1\\xd7\\xf7",TU="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SU="\\u2000-\\u206f",wU=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",KT="A-Z\\xc0-\\xd6\\xd8-\\xde",YT="\\ufe0e\\ufe0f",XT=_U+TU+SU+wU,K2="['’]",AU="["+to+"]",QT="["+XT+"]",_f="["+VT+"]",ZT="\\d+",CU="["+WT+"]",JT="["+qT+"]",eS="[^"+to+XT+ZT+WT+qT+KT+"]",Y2="\\ud83c[\\udffb-\\udfff]",xU="(?:"+_f+"|"+Y2+")",tS="[^"+to+"]",X2="(?:\\ud83c[\\udde6-\\uddff]){2}",Q2="[\\ud800-\\udbff][\\udc00-\\udfff]",Bu="["+KT+"]",nS="\\u200d",rS="(?:"+JT+"|"+eS+")",kU="(?:"+Bu+"|"+eS+")",iS="(?:"+K2+"(?:d|ll|m|re|s|t|ve))?",aS="(?:"+K2+"(?:D|LL|M|RE|S|T|VE))?",oS=xU+"?",sS="["+YT+"]?",IU="(?:"+nS+"(?:"+[tS,X2,Q2].join("|")+")"+sS+oS+")*",RU="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NU="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",lS=sS+oS+IU,OU="(?:"+[CU,X2,Q2].join("|")+")"+lS,DU="(?:"+[tS+_f+"?",_f,X2,Q2,AU].join("|")+")",LU=RegExp(K2,"g"),MU=RegExp(_f,"g"),Z2=RegExp(Y2+"(?="+Y2+")|"+DU+lS,"g"),FU=RegExp([Bu+"?"+JT+"+"+iS+"(?="+[QT,Bu,"$"].join("|")+")",kU+"+"+aS+"(?="+[QT,Bu+rS,"$"].join("|")+")",Bu+"?"+rS+"+"+iS,Bu+"+"+aS,NU,RU,ZT,OU].join("|"),"g"),PU=RegExp("["+nS+to+VT+YT+"]"),BU=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,UU=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$U=-1,En={};En[qe]=En[H]=En[me]=En[We]=En[ge]=En[j]=En[W]=En[ne]=En[_e]=!0,En[be]=En[q]=En[ue]=En[te]=En[ve]=En[Me]=En[Qe]=En[Ve]=En[ot]=En[Ge]=En[U]=En[ke]=En[Ee]=En[Se]=En[Ye]=!1;var mn={};mn[be]=mn[q]=mn[ue]=mn[ve]=mn[te]=mn[Me]=mn[qe]=mn[H]=mn[me]=mn[We]=mn[ge]=mn[ot]=mn[Ge]=mn[U]=mn[ke]=mn[Ee]=mn[Se]=mn[De]=mn[j]=mn[W]=mn[ne]=mn[_e]=!0,mn[Qe]=mn[Ve]=mn[Ye]=!1;var zU={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"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",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},HU={"&":"&","<":"<",">":">",'"':""","'":"'"},jU={"&":"&","<":"<",">":">",""":'"',"'":"'"},GU={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},VU=parseFloat,WU=parseInt,uS=typeof eu=="object"&&eu&&eu.Object===Object&&eu,qU=typeof self=="object"&&self&&self.Object===Object&&self,mr=uS||qU||Function("return this")(),J2=t&&!t.nodeType&&t,Ol=J2&&!0&&e&&!e.nodeType&&e,cS=Ol&&Ol.exports===J2,e5=cS&&uS.process,Yi=function(){try{var ee=Ol&&Ol.require&&Ol.require("util").types;return ee||e5&&e5.binding&&e5.binding("util")}catch{}}(),dS=Yi&&Yi.isArrayBuffer,pS=Yi&&Yi.isDate,fS=Yi&&Yi.isMap,hS=Yi&&Yi.isRegExp,gS=Yi&&Yi.isSet,mS=Yi&&Yi.isTypedArray;function Ai(ee,Te,fe){switch(fe.length){case 0:return ee.call(Te);case 1:return ee.call(Te,fe[0]);case 2:return ee.call(Te,fe[0],fe[1]);case 3:return ee.call(Te,fe[0],fe[1],fe[2])}return ee.apply(Te,fe)}function KU(ee,Te,fe,et){for(var _t=-1,Jt=ee==null?0:ee.length;++_t-1}function t5(ee,Te,fe){for(var et=-1,_t=ee==null?0:ee.length;++et<_t;)if(fe(Te,ee[et]))return!0;return!1}function An(ee,Te){for(var fe=-1,et=ee==null?0:ee.length,_t=Array(et);++fe-1;);return fe}function wS(ee,Te){for(var fe=ee.length;fe--&&Uu(Te,ee[fe],0)>-1;);return fe}function r$(ee,Te){for(var fe=ee.length,et=0;fe--;)ee[fe]===Te&&++et;return et}var i$=a5(zU),a$=a5(HU);function o$(ee){return"\\"+GU[ee]}function s$(ee,Te){return ee==null?n:ee[Te]}function $u(ee){return PU.test(ee)}function l$(ee){return BU.test(ee)}function u$(ee){for(var Te,fe=[];!(Te=ee.next()).done;)fe.push(Te.value);return fe}function u5(ee){var Te=-1,fe=Array(ee.size);return ee.forEach(function(et,_t){fe[++Te]=[_t,et]}),fe}function AS(ee,Te){return function(fe){return ee(Te(fe))}}function ws(ee,Te){for(var fe=-1,et=ee.length,_t=0,Jt=[];++fe-1}function X$(l,d){var g=this.__data__,_=Uf(g,l);return _<0?(++this.size,g.push([l,d])):g[_][1]=d,this}Oo.prototype.clear=W$,Oo.prototype.delete=q$,Oo.prototype.get=K$,Oo.prototype.has=Y$,Oo.prototype.set=X$;function Do(l){var d=-1,g=l==null?0:l.length;for(this.clear();++d=d?l:d)),l}function Ji(l,d,g,_,k,F){var z,Y=d&f,ie=d&m,Ae=d&h;if(g&&(z=k?g(l,_,k,F):g(l)),z!==n)return z;if(!Rn(l))return l;var xe=Tt(l);if(xe){if(z=eH(l),!Y)return li(l,z)}else{var Ie=Fr(l),Xe=Ie==Ve||Ie==dt;if(Rs(l))return sw(l,Y);if(Ie==U||Ie==be||Xe&&!k){if(z=ie||Xe?{}:Cw(l),!Y)return ie?jz(l,pz(z,l)):Hz(l,PS(z,l))}else{if(!mn[Ie])return k?l:{};z=tH(l,Ie,Y)}}F||(F=new xa);var st=F.get(l);if(st)return st;F.set(l,z),tA(l)?l.forEach(function(yt){z.add(Ji(yt,d,g,yt,l,F))}):Jw(l)&&l.forEach(function(yt,Ot){z.set(Ot,Ji(yt,d,g,Ot,l,F))});var bt=Ae?ie?M5:L5:ie?ci:lr,Ct=xe?n:bt(l);return Xi(Ct||l,function(yt,Ot){Ct&&(Ot=yt,yt=l[Ot]),Mc(z,Ot,Ji(yt,d,g,Ot,l,F))}),z}function fz(l){var d=lr(l);return function(g){return BS(g,l,d)}}function BS(l,d,g){var _=g.length;if(l==null)return!_;for(l=pn(l);_--;){var k=g[_],F=d[k],z=l[k];if(z===n&&!(k in l)||!F(z))return!1}return!0}function US(l,d,g){if(typeof l!="function")throw new Qi(o);return Hc(function(){l.apply(n,g)},d)}function Fc(l,d,g,_){var k=-1,F=Tf,z=!0,Y=l.length,ie=[],Ae=d.length;if(!Y)return ie;g&&(d=An(d,Ci(g))),_?(F=t5,z=!1):d.length>=i&&(F=Ic,z=!1,d=new Ml(d));e:for(;++kk?0:k+g),_=_===n||_>k?k:wt(_),_<0&&(_+=k),_=g>_?0:rA(_);g<_;)l[g++]=d;return l}function zS(l,d){var g=[];return Cs(l,function(_,k,F){d(_,k,F)&&g.push(_)}),g}function br(l,d,g,_,k){var F=-1,z=l.length;for(g||(g=rH),k||(k=[]);++F0&&g(Y)?d>1?br(Y,d-1,g,_,k):Ss(k,Y):_||(k[k.length]=Y)}return k}var m5=fw(),HS=fw(!0);function no(l,d){return l&&m5(l,d,lr)}function b5(l,d){return l&&HS(l,d,lr)}function zf(l,d){return Ts(d,function(g){return Bo(l[g])})}function Pl(l,d){d=ks(d,l);for(var g=0,_=d.length;l!=null&&g<_;)l=l[io(d[g++])];return g&&g==_?l:n}function jS(l,d,g){var _=d(l);return Tt(l)?_:Ss(_,g(l))}function Xr(l){return l==null?l===n?ze:pt:Dl&&Dl in pn(l)?Qz(l):cH(l)}function y5(l,d){return l>d}function mz(l,d){return l!=null&&an.call(l,d)}function bz(l,d){return l!=null&&d in pn(l)}function yz(l,d,g){return l>=Mr(d,g)&&l=120&&xe.length>=120)?new Ml(z&&xe):n}xe=l[0];var Ie=-1,Xe=Y[0];e:for(;++Ie-1;)Y!==l&&Of.call(Y,ie,1),Of.call(l,ie,1);return l}function JS(l,d){for(var g=l?d.length:0,_=g-1;g--;){var k=d[g];if(g==_||k!==F){var F=k;Po(k)?Of.call(l,k,1):x5(l,k)}}return l}function w5(l,d){return l+Mf(DS()*(d-l+1))}function Nz(l,d,g,_){for(var k=-1,F=Jn(Lf((d-l)/(g||1)),0),z=fe(F);F--;)z[_?F:++k]=l,l+=g;return z}function A5(l,d){var g="";if(!l||d<1||d>le)return g;do d%2&&(g+=l),d=Mf(d/2),d&&(l+=l);while(d);return g}function Rt(l,d){return H5(Iw(l,d,di),l+"")}function Oz(l){return FS(Qu(l))}function Dz(l,d){var g=Qu(l);return Zf(g,Fl(d,0,g.length))}function Uc(l,d,g,_){if(!Rn(l))return l;d=ks(d,l);for(var k=-1,F=d.length,z=F-1,Y=l;Y!=null&&++kk?0:k+d),g=g>k?k:g,g<0&&(g+=k),k=d>g?0:g-d>>>0,d>>>=0;for(var F=fe(k);++_>>1,z=l[F];z!==null&&!ki(z)&&(g?z<=d:z=i){var Ae=d?null:qz(l);if(Ae)return wf(Ae);z=!1,k=Ic,ie=new Ml}else ie=d?[]:Y;e:for(;++_=_?l:ea(l,d,g)}var ow=w$||function(l){return mr.clearTimeout(l)};function sw(l,d){if(d)return l.slice();var g=l.length,_=kS?kS(g):new l.constructor(g);return l.copy(_),_}function N5(l){var d=new l.constructor(l.byteLength);return new Rf(d).set(new Rf(l)),d}function Bz(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.byteLength)}function Uz(l){var d=new l.constructor(l.source,Ke.exec(l));return d.lastIndex=l.lastIndex,d}function $z(l){return Lc?pn(Lc.call(l)):{}}function lw(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.length)}function uw(l,d){if(l!==d){var g=l!==n,_=l===null,k=l===l,F=ki(l),z=d!==n,Y=d===null,ie=d===d,Ae=ki(d);if(!Y&&!Ae&&!F&&l>d||F&&z&&ie&&!Y&&!Ae||_&&z&&ie||!g&&ie||!k)return 1;if(!_&&!F&&!Ae&&l=Y)return ie;var Ae=g[_];return ie*(Ae=="desc"?-1:1)}}return l.index-d.index}function cw(l,d,g,_){for(var k=-1,F=l.length,z=g.length,Y=-1,ie=d.length,Ae=Jn(F-z,0),xe=fe(ie+Ae),Ie=!_;++Y1?g[k-1]:n,z=k>2?g[2]:n;for(F=l.length>3&&typeof F=="function"?(k--,F):n,z&&Qr(g[0],g[1],z)&&(F=k<3?n:F,k=1),d=pn(d);++_-1?k[F?d[z]:z]:n}}function mw(l){return Fo(function(d){var g=d.length,_=g,k=Zi.prototype.thru;for(l&&d.reverse();_--;){var F=d[_];if(typeof F!="function")throw new Qi(o);if(k&&!z&&Xf(F)=="wrapper")var z=new Zi([],!0)}for(_=z?_:g;++_1&&$t.reverse(),xe&&ieY))return!1;var Ae=F.get(l),xe=F.get(d);if(Ae&&xe)return Ae==d&&xe==l;var Ie=-1,Xe=!0,st=g&y?new Ml:n;for(F.set(l,d),F.set(d,l);++Ie1?"& ":"")+d[_],d=d.join(g>2?", ":" "),l.replace(vs,`{ + */um.exports;(function(e,t){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",c=500,p="__lodash_placeholder__",f=1,m=2,h=4,b=1,y=2,T=1,E=2,v=4,w=8,A=16,N=32,x=64,D=128,B=256,V=512,P=30,Z="...",$=800,oe=16,pe=1,ce=2,Le=3,se=1/0,le=9007199254740991,he=17976931348623157e292,I=0/0,X=4294967295,ae=X-1,O=X>>>1,Q=[["ary",D],["bind",T],["bindKey",E],["curry",w],["curryRight",A],["flip",V],["partial",N],["partialRight",x],["rearg",B]],be="[object Arguments]",q="[object Array]",we="[object AsyncFunction]",te="[object Boolean]",Me="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ve="[object Function]",dt="[object GeneratorFunction]",ot="[object Map]",Ge="[object Number]",pt="[object Null]",U="[object Object]",re="[object Promise]",de="[object Proxy]",ke="[object RegExp]",Ee="[object Set]",Se="[object String]",De="[object Symbol]",ze="[object Undefined]",Ye="[object WeakMap]",Gt="[object WeakSet]",ue="[object ArrayBuffer]",ve="[object DataView]",qe="[object Float32Array]",H="[object Float64Array]",me="[object Int8Array]",We="[object Int16Array]",ge="[object Int32Array]",j="[object Uint8Array]",W="[object Uint8ClampedArray]",ne="[object Uint16Array]",_e="[object Uint32Array]",Ze=/\b__p \+= '';/g,Fe=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rt=/&(?:amp|lt|gt|quot|#39);/g,Je=/[&<>"']/g,Nt=RegExp(rt.source),Zt=RegExp(Je.source),It=/<%-([\s\S]+?)%>/g,rn=/<%([\s\S]+?)%>/g,Xt=/<%=([\s\S]+?)%>/g,Wr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qr=/^\w*$/,Kr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aa=/[\\^$.*+?()[\]{}|]/g,si=RegExp(Aa.source),Or=/^\s+/,Es=/\s/,vs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yr=/\{\n\/\* \[wrapped with (.+)\] \*/,_s=/,? & /,Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dr=/[()=,{}\[\]\/\s]/,wi=/\\(\\)?/g,Nl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ke=/\w*$/,J=/^[-+]0x[0-9a-f]+$/i,Be=/^0b[01]+$/i,it=/^\[object .+?Constructor\]$/,un=/^0o[0-7]+$/i,or=/^(?:0|[1-9]\d*)$/,sr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qn=/($^)/,No=/['\n\r\u2028\u2029\\]/g,to="\\ud800-\\udfff",Lr="\\u0300-\\u036f",Ef="\\ufe20-\\ufe2f",vf="\\u20d0-\\u20ff",VT=Lr+Ef+vf,WT="\\u2700-\\u27bf",qT="a-z\\xdf-\\xf6\\xf8-\\xff",_U="\\xac\\xb1\\xd7\\xf7",TU="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SU="\\u2000-\\u206f",wU=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",KT="A-Z\\xc0-\\xd6\\xd8-\\xde",YT="\\ufe0e\\ufe0f",XT=_U+TU+SU+wU,K2="['’]",AU="["+to+"]",QT="["+XT+"]",_f="["+VT+"]",ZT="\\d+",CU="["+WT+"]",JT="["+qT+"]",eS="[^"+to+XT+ZT+WT+qT+KT+"]",Y2="\\ud83c[\\udffb-\\udfff]",xU="(?:"+_f+"|"+Y2+")",tS="[^"+to+"]",X2="(?:\\ud83c[\\udde6-\\uddff]){2}",Q2="[\\ud800-\\udbff][\\udc00-\\udfff]",Bu="["+KT+"]",nS="\\u200d",rS="(?:"+JT+"|"+eS+")",kU="(?:"+Bu+"|"+eS+")",iS="(?:"+K2+"(?:d|ll|m|re|s|t|ve))?",aS="(?:"+K2+"(?:D|LL|M|RE|S|T|VE))?",oS=xU+"?",sS="["+YT+"]?",IU="(?:"+nS+"(?:"+[tS,X2,Q2].join("|")+")"+sS+oS+")*",RU="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NU="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",lS=sS+oS+IU,OU="(?:"+[CU,X2,Q2].join("|")+")"+lS,DU="(?:"+[tS+_f+"?",_f,X2,Q2,AU].join("|")+")",LU=RegExp(K2,"g"),MU=RegExp(_f,"g"),Z2=RegExp(Y2+"(?="+Y2+")|"+DU+lS,"g"),FU=RegExp([Bu+"?"+JT+"+"+iS+"(?="+[QT,Bu,"$"].join("|")+")",kU+"+"+aS+"(?="+[QT,Bu+rS,"$"].join("|")+")",Bu+"?"+rS+"+"+iS,Bu+"+"+aS,NU,RU,ZT,OU].join("|"),"g"),PU=RegExp("["+nS+to+VT+YT+"]"),BU=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,UU=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$U=-1,En={};En[qe]=En[H]=En[me]=En[We]=En[ge]=En[j]=En[W]=En[ne]=En[_e]=!0,En[be]=En[q]=En[ue]=En[te]=En[ve]=En[Me]=En[Qe]=En[Ve]=En[ot]=En[Ge]=En[U]=En[ke]=En[Ee]=En[Se]=En[Ye]=!1;var mn={};mn[be]=mn[q]=mn[ue]=mn[ve]=mn[te]=mn[Me]=mn[qe]=mn[H]=mn[me]=mn[We]=mn[ge]=mn[ot]=mn[Ge]=mn[U]=mn[ke]=mn[Ee]=mn[Se]=mn[De]=mn[j]=mn[W]=mn[ne]=mn[_e]=!0,mn[Qe]=mn[Ve]=mn[Ye]=!1;var zU={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"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",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},HU={"&":"&","<":"<",">":">",'"':""","'":"'"},jU={"&":"&","<":"<",">":">",""":'"',"'":"'"},GU={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},VU=parseFloat,WU=parseInt,uS=typeof eu=="object"&&eu&&eu.Object===Object&&eu,qU=typeof self=="object"&&self&&self.Object===Object&&self,mr=uS||qU||Function("return this")(),J2=t&&!t.nodeType&&t,Ol=J2&&!0&&e&&!e.nodeType&&e,cS=Ol&&Ol.exports===J2,e5=cS&&uS.process,Yi=function(){try{var ee=Ol&&Ol.require&&Ol.require("util").types;return ee||e5&&e5.binding&&e5.binding("util")}catch{}}(),dS=Yi&&Yi.isArrayBuffer,pS=Yi&&Yi.isDate,fS=Yi&&Yi.isMap,hS=Yi&&Yi.isRegExp,gS=Yi&&Yi.isSet,mS=Yi&&Yi.isTypedArray;function Ai(ee,Te,fe){switch(fe.length){case 0:return ee.call(Te);case 1:return ee.call(Te,fe[0]);case 2:return ee.call(Te,fe[0],fe[1]);case 3:return ee.call(Te,fe[0],fe[1],fe[2])}return ee.apply(Te,fe)}function KU(ee,Te,fe,et){for(var _t=-1,Jt=ee==null?0:ee.length;++_t-1}function t5(ee,Te,fe){for(var et=-1,_t=ee==null?0:ee.length;++et<_t;)if(fe(Te,ee[et]))return!0;return!1}function An(ee,Te){for(var fe=-1,et=ee==null?0:ee.length,_t=Array(et);++fe-1;);return fe}function wS(ee,Te){for(var fe=ee.length;fe--&&Uu(Te,ee[fe],0)>-1;);return fe}function r$(ee,Te){for(var fe=ee.length,et=0;fe--;)ee[fe]===Te&&++et;return et}var i$=a5(zU),a$=a5(HU);function o$(ee){return"\\"+GU[ee]}function s$(ee,Te){return ee==null?n:ee[Te]}function $u(ee){return PU.test(ee)}function l$(ee){return BU.test(ee)}function u$(ee){for(var Te,fe=[];!(Te=ee.next()).done;)fe.push(Te.value);return fe}function u5(ee){var Te=-1,fe=Array(ee.size);return ee.forEach(function(et,_t){fe[++Te]=[_t,et]}),fe}function AS(ee,Te){return function(fe){return ee(Te(fe))}}function ws(ee,Te){for(var fe=-1,et=ee.length,_t=0,Jt=[];++fe-1}function X$(l,d){var g=this.__data__,_=Uf(g,l);return _<0?(++this.size,g.push([l,d])):g[_][1]=d,this}Oo.prototype.clear=W$,Oo.prototype.delete=q$,Oo.prototype.get=K$,Oo.prototype.has=Y$,Oo.prototype.set=X$;function Do(l){var d=-1,g=l==null?0:l.length;for(this.clear();++d=d?l:d)),l}function Ji(l,d,g,_,k,F){var z,Y=d&f,ie=d&m,Ae=d&h;if(g&&(z=k?g(l,_,k,F):g(l)),z!==n)return z;if(!Rn(l))return l;var xe=Tt(l);if(xe){if(z=eH(l),!Y)return li(l,z)}else{var Ie=Fr(l),Xe=Ie==Ve||Ie==dt;if(Rs(l))return sw(l,Y);if(Ie==U||Ie==be||Xe&&!k){if(z=ie||Xe?{}:Cw(l),!Y)return ie?jz(l,pz(z,l)):Hz(l,PS(z,l))}else{if(!mn[Ie])return k?l:{};z=tH(l,Ie,Y)}}F||(F=new xa);var st=F.get(l);if(st)return st;F.set(l,z),tA(l)?l.forEach(function(yt){z.add(Ji(yt,d,g,yt,l,F))}):Jw(l)&&l.forEach(function(yt,Ot){z.set(Ot,Ji(yt,d,g,Ot,l,F))});var bt=Ae?ie?M5:L5:ie?ci:lr,Ct=xe?n:bt(l);return Xi(Ct||l,function(yt,Ot){Ct&&(Ot=yt,yt=l[Ot]),Mc(z,Ot,Ji(yt,d,g,Ot,l,F))}),z}function fz(l){var d=lr(l);return function(g){return BS(g,l,d)}}function BS(l,d,g){var _=g.length;if(l==null)return!_;for(l=pn(l);_--;){var k=g[_],F=d[k],z=l[k];if(z===n&&!(k in l)||!F(z))return!1}return!0}function US(l,d,g){if(typeof l!="function")throw new Qi(o);return Hc(function(){l.apply(n,g)},d)}function Fc(l,d,g,_){var k=-1,F=Tf,z=!0,Y=l.length,ie=[],Ae=d.length;if(!Y)return ie;g&&(d=An(d,Ci(g))),_?(F=t5,z=!1):d.length>=i&&(F=Ic,z=!1,d=new Ml(d));e:for(;++kk?0:k+g),_=_===n||_>k?k:St(_),_<0&&(_+=k),_=g>_?0:rA(_);g<_;)l[g++]=d;return l}function zS(l,d){var g=[];return Cs(l,function(_,k,F){d(_,k,F)&&g.push(_)}),g}function br(l,d,g,_,k){var F=-1,z=l.length;for(g||(g=rH),k||(k=[]);++F0&&g(Y)?d>1?br(Y,d-1,g,_,k):Ss(k,Y):_||(k[k.length]=Y)}return k}var m5=fw(),HS=fw(!0);function no(l,d){return l&&m5(l,d,lr)}function b5(l,d){return l&&HS(l,d,lr)}function zf(l,d){return Ts(d,function(g){return Bo(l[g])})}function Pl(l,d){d=ks(d,l);for(var g=0,_=d.length;l!=null&&g<_;)l=l[io(d[g++])];return g&&g==_?l:n}function jS(l,d,g){var _=d(l);return Tt(l)?_:Ss(_,g(l))}function Xr(l){return l==null?l===n?ze:pt:Dl&&Dl in pn(l)?Qz(l):cH(l)}function y5(l,d){return l>d}function mz(l,d){return l!=null&&an.call(l,d)}function bz(l,d){return l!=null&&d in pn(l)}function yz(l,d,g){return l>=Mr(d,g)&&l=120&&xe.length>=120)?new Ml(z&&xe):n}xe=l[0];var Ie=-1,Xe=Y[0];e:for(;++Ie-1;)Y!==l&&Of.call(Y,ie,1),Of.call(l,ie,1);return l}function JS(l,d){for(var g=l?d.length:0,_=g-1;g--;){var k=d[g];if(g==_||k!==F){var F=k;Po(k)?Of.call(l,k,1):x5(l,k)}}return l}function w5(l,d){return l+Mf(DS()*(d-l+1))}function Nz(l,d,g,_){for(var k=-1,F=Jn(Lf((d-l)/(g||1)),0),z=fe(F);F--;)z[_?F:++k]=l,l+=g;return z}function A5(l,d){var g="";if(!l||d<1||d>le)return g;do d%2&&(g+=l),d=Mf(d/2),d&&(l+=l);while(d);return g}function Rt(l,d){return H5(Iw(l,d,di),l+"")}function Oz(l){return FS(Qu(l))}function Dz(l,d){var g=Qu(l);return Zf(g,Fl(d,0,g.length))}function Uc(l,d,g,_){if(!Rn(l))return l;d=ks(d,l);for(var k=-1,F=d.length,z=F-1,Y=l;Y!=null&&++kk?0:k+d),g=g>k?k:g,g<0&&(g+=k),k=d>g?0:g-d>>>0,d>>>=0;for(var F=fe(k);++_>>1,z=l[F];z!==null&&!ki(z)&&(g?z<=d:z=i){var Ae=d?null:qz(l);if(Ae)return wf(Ae);z=!1,k=Ic,ie=new Ml}else ie=d?[]:Y;e:for(;++_=_?l:ea(l,d,g)}var ow=w$||function(l){return mr.clearTimeout(l)};function sw(l,d){if(d)return l.slice();var g=l.length,_=kS?kS(g):new l.constructor(g);return l.copy(_),_}function N5(l){var d=new l.constructor(l.byteLength);return new Rf(d).set(new Rf(l)),d}function Bz(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.byteLength)}function Uz(l){var d=new l.constructor(l.source,Ke.exec(l));return d.lastIndex=l.lastIndex,d}function $z(l){return Lc?pn(Lc.call(l)):{}}function lw(l,d){var g=d?N5(l.buffer):l.buffer;return new l.constructor(g,l.byteOffset,l.length)}function uw(l,d){if(l!==d){var g=l!==n,_=l===null,k=l===l,F=ki(l),z=d!==n,Y=d===null,ie=d===d,Ae=ki(d);if(!Y&&!Ae&&!F&&l>d||F&&z&&ie&&!Y&&!Ae||_&&z&&ie||!g&&ie||!k)return 1;if(!_&&!F&&!Ae&&l=Y)return ie;var Ae=g[_];return ie*(Ae=="desc"?-1:1)}}return l.index-d.index}function cw(l,d,g,_){for(var k=-1,F=l.length,z=g.length,Y=-1,ie=d.length,Ae=Jn(F-z,0),xe=fe(ie+Ae),Ie=!_;++Y1?g[k-1]:n,z=k>2?g[2]:n;for(F=l.length>3&&typeof F=="function"?(k--,F):n,z&&Qr(g[0],g[1],z)&&(F=k<3?n:F,k=1),d=pn(d);++_-1?k[F?d[z]:z]:n}}function mw(l){return Fo(function(d){var g=d.length,_=g,k=Zi.prototype.thru;for(l&&d.reverse();_--;){var F=d[_];if(typeof F!="function")throw new Qi(o);if(k&&!z&&Xf(F)=="wrapper")var z=new Zi([],!0)}for(_=z?_:g;++_1&&$t.reverse(),xe&&ieY))return!1;var Ae=F.get(l),xe=F.get(d);if(Ae&&xe)return Ae==d&&xe==l;var Ie=-1,Xe=!0,st=g&y?new Ml:n;for(F.set(l,d),F.set(d,l);++Ie1?"& ":"")+d[_],d=d.join(g>2?", ":" "),l.replace(vs,`{ /* [wrapped with `+d+`] */ -`)}function rH(l){return Tt(l)||$l(l)||!!(NS&&l&&l[NS])}function Po(l,d){var g=typeof l;return d=d??le,!!d&&(g=="number"||g!="symbol"&&or.test(l))&&l>-1&&l%1==0&&l0){if(++d>=$)return arguments[0]}else d=0;return l.apply(n,arguments)}}function Zf(l,d){var g=-1,_=l.length,k=_-1;for(d=d===n?_:d;++g1?l[d-1]:n;return g=typeof g=="function"?(l.pop(),g):n,zw(l,g)});function Hw(l){var d=M(l);return d.__chain__=!0,d}function hj(l,d){return d(l),l}function Jf(l,d){return d(l)}var gj=Fo(function(l){var d=l.length,g=d?l[0]:0,_=this.__wrapped__,k=function(F){return g5(F,l)};return d>1||this.__actions__.length||!(_ instanceof Pt)||!Po(g)?this.thru(k):(_=_.slice(g,+g+(d?1:0)),_.__actions__.push({func:Jf,args:[k],thisArg:n}),new Zi(_,this.__chain__).thru(function(F){return d&&!F.length&&F.push(n),F}))});function mj(){return Hw(this)}function bj(){return new Zi(this.value(),this.__chain__)}function yj(){this.__values__===n&&(this.__values__=nA(this.value()));var l=this.__index__>=this.__values__.length,d=l?n:this.__values__[this.__index__++];return{done:l,value:d}}function Ej(){return this}function vj(l){for(var d,g=this;g instanceof Bf;){var _=Mw(g);_.__index__=0,_.__values__=n,d?k.__wrapped__=_:d=_;var k=_;g=g.__wrapped__}return k.__wrapped__=l,d}function _j(){var l=this.__wrapped__;if(l instanceof Pt){var d=l;return this.__actions__.length&&(d=new Pt(this)),d=d.reverse(),d.__actions__.push({func:Jf,args:[j5],thisArg:n}),new Zi(d,this.__chain__)}return this.thru(j5)}function Tj(){return iw(this.__wrapped__,this.__actions__)}var Sj=Vf(function(l,d,g){an.call(l,g)?++l[g]:Lo(l,g,1)});function wj(l,d,g){var _=Tt(l)?bS:hz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}function Aj(l,d){var g=Tt(l)?Ts:zS;return g(l,mt(d,3))}var Cj=gw(Fw),xj=gw(Pw);function kj(l,d){return br(e0(l,d),1)}function Ij(l,d){return br(e0(l,d),se)}function Rj(l,d,g){return g=g===n?1:wt(g),br(e0(l,d),g)}function jw(l,d){var g=Tt(l)?Xi:Cs;return g(l,mt(d,3))}function Gw(l,d){var g=Tt(l)?YU:$S;return g(l,mt(d,3))}var Nj=Vf(function(l,d,g){an.call(l,g)?l[g].push(d):Lo(l,g,[d])});function Oj(l,d,g,_){l=ui(l)?l:Qu(l),g=g&&!_?wt(g):0;var k=l.length;return g<0&&(g=Jn(k+g,0)),a0(l)?g<=k&&l.indexOf(d,g)>-1:!!k&&Uu(l,d,g)>-1}var Dj=Rt(function(l,d,g){var _=-1,k=typeof d=="function",F=ui(l)?fe(l.length):[];return Cs(l,function(z){F[++_]=k?Ai(d,z,g):Pc(z,d,g)}),F}),Lj=Vf(function(l,d,g){Lo(l,g,d)});function e0(l,d){var g=Tt(l)?An:qS;return g(l,mt(d,3))}function Mj(l,d,g,_){return l==null?[]:(Tt(d)||(d=d==null?[]:[d]),g=_?n:g,Tt(g)||(g=g==null?[]:[g]),QS(l,d,g))}var Fj=Vf(function(l,d,g){l[g?0:1].push(d)},function(){return[[],[]]});function Pj(l,d,g){var _=Tt(l)?n5:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,Cs)}function Bj(l,d,g){var _=Tt(l)?XU:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,$S)}function Uj(l,d){var g=Tt(l)?Ts:zS;return g(l,r0(mt(d,3)))}function $j(l){var d=Tt(l)?FS:Oz;return d(l)}function zj(l,d,g){(g?Qr(l,d,g):d===n)?d=1:d=wt(d);var _=Tt(l)?uz:Dz;return _(l,d)}function Hj(l){var d=Tt(l)?cz:Mz;return d(l)}function jj(l){if(l==null)return 0;if(ui(l))return a0(l)?zu(l):l.length;var d=Fr(l);return d==ot||d==Ee?l.size:_5(l).length}function Gj(l,d,g){var _=Tt(l)?r5:Fz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}var Vj=Rt(function(l,d){if(l==null)return[];var g=d.length;return g>1&&Qr(l,d[0],d[1])?d=[]:g>2&&Qr(d[0],d[1],d[2])&&(d=[d[0]]),QS(l,br(d,1),[])}),t0=A$||function(){return mr.Date.now()};function Wj(l,d){if(typeof d!="function")throw new Qi(o);return l=wt(l),function(){if(--l<1)return d.apply(this,arguments)}}function Vw(l,d,g){return d=g?n:d,d=l&&d==null?l.length:d,Mo(l,D,n,n,n,n,d)}function Ww(l,d){var g;if(typeof d!="function")throw new Qi(o);return l=wt(l),function(){return--l>0&&(g=d.apply(this,arguments)),l<=1&&(d=n),g}}var V5=Rt(function(l,d,g){var _=T;if(g.length){var k=ws(g,Yu(V5));_|=N}return Mo(l,_,d,g,k)}),qw=Rt(function(l,d,g){var _=T|E;if(g.length){var k=ws(g,Yu(qw));_|=N}return Mo(d,_,l,g,k)});function Kw(l,d,g){d=g?n:d;var _=Mo(l,w,n,n,n,n,n,d);return _.placeholder=Kw.placeholder,_}function Yw(l,d,g){d=g?n:d;var _=Mo(l,A,n,n,n,n,n,d);return _.placeholder=Yw.placeholder,_}function Xw(l,d,g){var _,k,F,z,Y,ie,Ae=0,xe=!1,Ie=!1,Xe=!0;if(typeof l!="function")throw new Qi(o);d=na(d)||0,Rn(g)&&(xe=!!g.leading,Ie="maxWait"in g,F=Ie?Jn(na(g.maxWait)||0,d):F,Xe="trailing"in g?!!g.trailing:Xe);function st(Hn){var Ia=_,$o=k;return _=k=n,Ae=Hn,z=l.apply($o,Ia),z}function bt(Hn){return Ae=Hn,Y=Hc(Ot,d),xe?st(Hn):z}function Ct(Hn){var Ia=Hn-ie,$o=Hn-Ae,gA=d-Ia;return Ie?Mr(gA,F-$o):gA}function yt(Hn){var Ia=Hn-ie,$o=Hn-Ae;return ie===n||Ia>=d||Ia<0||Ie&&$o>=F}function Ot(){var Hn=t0();if(yt(Hn))return $t(Hn);Y=Hc(Ot,Ct(Hn))}function $t(Hn){return Y=n,Xe&&_?st(Hn):(_=k=n,z)}function Ii(){Y!==n&&ow(Y),Ae=0,_=ie=k=Y=n}function Zr(){return Y===n?z:$t(t0())}function Ri(){var Hn=t0(),Ia=yt(Hn);if(_=arguments,k=this,ie=Hn,Ia){if(Y===n)return bt(ie);if(Ie)return ow(Y),Y=Hc(Ot,d),st(ie)}return Y===n&&(Y=Hc(Ot,d)),z}return Ri.cancel=Ii,Ri.flush=Zr,Ri}var qj=Rt(function(l,d){return US(l,1,d)}),Kj=Rt(function(l,d,g){return US(l,na(d)||0,g)});function Yj(l){return Mo(l,V)}function n0(l,d){if(typeof l!="function"||d!=null&&typeof d!="function")throw new Qi(o);var g=function(){var _=arguments,k=d?d.apply(this,_):_[0],F=g.cache;if(F.has(k))return F.get(k);var z=l.apply(this,_);return g.cache=F.set(k,z)||F,z};return g.cache=new(n0.Cache||Do),g}n0.Cache=Do;function r0(l){if(typeof l!="function")throw new Qi(o);return function(){var d=arguments;switch(d.length){case 0:return!l.call(this);case 1:return!l.call(this,d[0]);case 2:return!l.call(this,d[0],d[1]);case 3:return!l.call(this,d[0],d[1],d[2])}return!l.apply(this,d)}}function Xj(l){return Ww(2,l)}var Qj=Pz(function(l,d){d=d.length==1&&Tt(d[0])?An(d[0],Ci(mt())):An(br(d,1),Ci(mt()));var g=d.length;return Rt(function(_){for(var k=-1,F=Mr(_.length,g);++k=d}),$l=GS(function(){return arguments}())?GS:function(l){return Mn(l)&&an.call(l,"callee")&&!RS.call(l,"callee")},Tt=fe.isArray,pG=dS?Ci(dS):vz;function ui(l){return l!=null&&i0(l.length)&&!Bo(l)}function zn(l){return Mn(l)&&ui(l)}function fG(l){return l===!0||l===!1||Mn(l)&&Xr(l)==te}var Rs=x$||r3,hG=pS?Ci(pS):_z;function gG(l){return Mn(l)&&l.nodeType===1&&!jc(l)}function mG(l){if(l==null)return!0;if(ui(l)&&(Tt(l)||typeof l=="string"||typeof l.splice=="function"||Rs(l)||Xu(l)||$l(l)))return!l.length;var d=Fr(l);if(d==ot||d==Ee)return!l.size;if(zc(l))return!_5(l).length;for(var g in l)if(an.call(l,g))return!1;return!0}function bG(l,d){return Bc(l,d)}function yG(l,d,g){g=typeof g=="function"?g:n;var _=g?g(l,d):n;return _===n?Bc(l,d,n,g):!!_}function q5(l){if(!Mn(l))return!1;var d=Xr(l);return d==Qe||d==Re||typeof l.message=="string"&&typeof l.name=="string"&&!jc(l)}function EG(l){return typeof l=="number"&&OS(l)}function Bo(l){if(!Rn(l))return!1;var d=Xr(l);return d==Ve||d==dt||d==we||d==de}function Zw(l){return typeof l=="number"&&l==wt(l)}function i0(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=le}function Rn(l){var d=typeof l;return l!=null&&(d=="object"||d=="function")}function Mn(l){return l!=null&&typeof l=="object"}var Jw=fS?Ci(fS):Sz;function vG(l,d){return l===d||v5(l,d,P5(d))}function _G(l,d,g){return g=typeof g=="function"?g:n,v5(l,d,P5(d),g)}function TG(l){return eA(l)&&l!=+l}function SG(l){if(oH(l))throw new _t(a);return VS(l)}function wG(l){return l===null}function AG(l){return l==null}function eA(l){return typeof l=="number"||Mn(l)&&Xr(l)==Ge}function jc(l){if(!Mn(l)||Xr(l)!=U)return!1;var d=Nf(l);if(d===null)return!0;var g=an.call(d,"constructor")&&d.constructor;return typeof g=="function"&&g instanceof g&&xf.call(g)==_$}var K5=hS?Ci(hS):wz;function CG(l){return Zw(l)&&l>=-le&&l<=le}var tA=gS?Ci(gS):Az;function a0(l){return typeof l=="string"||!Tt(l)&&Mn(l)&&Xr(l)==Se}function ki(l){return typeof l=="symbol"||Mn(l)&&Xr(l)==De}var Xu=mS?Ci(mS):Cz;function xG(l){return l===n}function kG(l){return Mn(l)&&Fr(l)==Ye}function IG(l){return Mn(l)&&Xr(l)==Gt}var RG=Yf(T5),NG=Yf(function(l,d){return l<=d});function nA(l){if(!l)return[];if(ui(l))return a0(l)?Ca(l):li(l);if(Rc&&l[Rc])return u$(l[Rc]());var d=Fr(l),g=d==ot?u5:d==Ee?wf:Qu;return g(l)}function Uo(l){if(!l)return l===0?l:0;if(l=na(l),l===se||l===-se){var d=l<0?-1:1;return d*he}return l===l?l:0}function wt(l){var d=Uo(l),g=d%1;return d===d?g?d-g:d:0}function rA(l){return l?Fl(wt(l),0,X):0}function na(l){if(typeof l=="number")return l;if(ki(l))return I;if(Rn(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=Rn(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=TS(l);var g=Be.test(l);return g||un.test(l)?WU(l.slice(2),g?2:8):J.test(l)?I:+l}function iA(l){return ro(l,ci(l))}function OG(l){return l?Fl(wt(l),-le,le):l===0?l:0}function en(l){return l==null?"":xi(l)}var DG=qu(function(l,d){if(zc(d)||ui(d)){ro(d,lr(d),l);return}for(var g in d)an.call(d,g)&&Mc(l,g,d[g])}),aA=qu(function(l,d){ro(d,ci(d),l)}),o0=qu(function(l,d,g,_){ro(d,ci(d),l,_)}),LG=qu(function(l,d,g,_){ro(d,lr(d),l,_)}),MG=Fo(g5);function FG(l,d){var g=Wu(l);return d==null?g:PS(g,d)}var PG=Rt(function(l,d){l=pn(l);var g=-1,_=d.length,k=_>2?d[2]:n;for(k&&Qr(d[0],d[1],k)&&(_=1);++g<_;)for(var F=d[g],z=ci(F),Y=-1,ie=z.length;++Y1),F}),ro(l,M5(l),g),_&&(g=Ji(g,f|m|h,Kz));for(var k=d.length;k--;)x5(g,d[k]);return g});function tV(l,d){return sA(l,r0(mt(d)))}var nV=Fo(function(l,d){return l==null?{}:Iz(l,d)});function sA(l,d){if(l==null)return{};var g=An(M5(l),function(_){return[_]});return d=mt(d),ZS(l,g,function(_,k){return d(_,k[0])})}function rV(l,d,g){d=ks(d,l);var _=-1,k=d.length;for(k||(k=1,l=n);++_d){var _=l;l=d,d=_}if(g||l%1||d%1){var k=DS();return Mr(l+k*(d-l+VU("1e-"+((k+"").length-1))),d)}return w5(l,d)}var hV=Ku(function(l,d,g){return d=d.toLowerCase(),l+(g?cA(d):d)});function cA(l){return Q5(en(l).toLowerCase())}function dA(l){return l=en(l),l&&l.replace(sr,i$).replace(MU,"")}function gV(l,d,g){l=en(l),d=xi(d);var _=l.length;g=g===n?_:Fl(wt(g),0,_);var k=g;return g-=d.length,g>=0&&l.slice(g,k)==d}function mV(l){return l=en(l),l&&Zt.test(l)?l.replace(Je,a$):l}function bV(l){return l=en(l),l&&si.test(l)?l.replace(Aa,"\\$&"):l}var yV=Ku(function(l,d,g){return l+(g?"-":"")+d.toLowerCase()}),EV=Ku(function(l,d,g){return l+(g?" ":"")+d.toLowerCase()}),vV=hw("toLowerCase");function _V(l,d,g){l=en(l),d=wt(d);var _=d?zu(l):0;if(!d||_>=d)return l;var k=(d-_)/2;return Kf(Mf(k),g)+l+Kf(Lf(k),g)}function TV(l,d,g){l=en(l),d=wt(d);var _=d?zu(l):0;return d&&_>>0,g?(l=en(l),l&&(typeof d=="string"||d!=null&&!K5(d))&&(d=xi(d),!d&&$u(l))?Is(Ca(l),0,g):l.split(d,g)):[]}var IV=Ku(function(l,d,g){return l+(g?" ":"")+Q5(d)});function RV(l,d,g){return l=en(l),g=g==null?0:Fl(wt(g),0,l.length),d=xi(d),l.slice(g,g+d.length)==d}function NV(l,d,g){var _=M.templateSettings;g&&Qr(l,d,g)&&(d=n),l=en(l),d=o0({},d,_,_w);var k=o0({},d.imports,_.imports,_w),F=lr(k),z=l5(k,F),Y,ie,Ae=0,xe=d.interpolate||Qn,Ie="__p += '",Xe=c5((d.escape||Qn).source+"|"+xe.source+"|"+(xe===Xt?Nl:Qn).source+"|"+(d.evaluate||Qn).source+"|$","g"),st="//# sourceURL="+(an.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$U+"]")+` +`)}function rH(l){return Tt(l)||$l(l)||!!(NS&&l&&l[NS])}function Po(l,d){var g=typeof l;return d=d??le,!!d&&(g=="number"||g!="symbol"&&or.test(l))&&l>-1&&l%1==0&&l0){if(++d>=$)return arguments[0]}else d=0;return l.apply(n,arguments)}}function Zf(l,d){var g=-1,_=l.length,k=_-1;for(d=d===n?_:d;++g1?l[d-1]:n;return g=typeof g=="function"?(l.pop(),g):n,zw(l,g)});function Hw(l){var d=M(l);return d.__chain__=!0,d}function hj(l,d){return d(l),l}function Jf(l,d){return d(l)}var gj=Fo(function(l){var d=l.length,g=d?l[0]:0,_=this.__wrapped__,k=function(F){return g5(F,l)};return d>1||this.__actions__.length||!(_ instanceof Pt)||!Po(g)?this.thru(k):(_=_.slice(g,+g+(d?1:0)),_.__actions__.push({func:Jf,args:[k],thisArg:n}),new Zi(_,this.__chain__).thru(function(F){return d&&!F.length&&F.push(n),F}))});function mj(){return Hw(this)}function bj(){return new Zi(this.value(),this.__chain__)}function yj(){this.__values__===n&&(this.__values__=nA(this.value()));var l=this.__index__>=this.__values__.length,d=l?n:this.__values__[this.__index__++];return{done:l,value:d}}function Ej(){return this}function vj(l){for(var d,g=this;g instanceof Bf;){var _=Mw(g);_.__index__=0,_.__values__=n,d?k.__wrapped__=_:d=_;var k=_;g=g.__wrapped__}return k.__wrapped__=l,d}function _j(){var l=this.__wrapped__;if(l instanceof Pt){var d=l;return this.__actions__.length&&(d=new Pt(this)),d=d.reverse(),d.__actions__.push({func:Jf,args:[j5],thisArg:n}),new Zi(d,this.__chain__)}return this.thru(j5)}function Tj(){return iw(this.__wrapped__,this.__actions__)}var Sj=Vf(function(l,d,g){an.call(l,g)?++l[g]:Lo(l,g,1)});function wj(l,d,g){var _=Tt(l)?bS:hz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}function Aj(l,d){var g=Tt(l)?Ts:zS;return g(l,mt(d,3))}var Cj=gw(Fw),xj=gw(Pw);function kj(l,d){return br(e0(l,d),1)}function Ij(l,d){return br(e0(l,d),se)}function Rj(l,d,g){return g=g===n?1:St(g),br(e0(l,d),g)}function jw(l,d){var g=Tt(l)?Xi:Cs;return g(l,mt(d,3))}function Gw(l,d){var g=Tt(l)?YU:$S;return g(l,mt(d,3))}var Nj=Vf(function(l,d,g){an.call(l,g)?l[g].push(d):Lo(l,g,[d])});function Oj(l,d,g,_){l=ui(l)?l:Qu(l),g=g&&!_?St(g):0;var k=l.length;return g<0&&(g=Jn(k+g,0)),a0(l)?g<=k&&l.indexOf(d,g)>-1:!!k&&Uu(l,d,g)>-1}var Dj=Rt(function(l,d,g){var _=-1,k=typeof d=="function",F=ui(l)?fe(l.length):[];return Cs(l,function(z){F[++_]=k?Ai(d,z,g):Pc(z,d,g)}),F}),Lj=Vf(function(l,d,g){Lo(l,g,d)});function e0(l,d){var g=Tt(l)?An:qS;return g(l,mt(d,3))}function Mj(l,d,g,_){return l==null?[]:(Tt(d)||(d=d==null?[]:[d]),g=_?n:g,Tt(g)||(g=g==null?[]:[g]),QS(l,d,g))}var Fj=Vf(function(l,d,g){l[g?0:1].push(d)},function(){return[[],[]]});function Pj(l,d,g){var _=Tt(l)?n5:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,Cs)}function Bj(l,d,g){var _=Tt(l)?XU:_S,k=arguments.length<3;return _(l,mt(d,4),g,k,$S)}function Uj(l,d){var g=Tt(l)?Ts:zS;return g(l,r0(mt(d,3)))}function $j(l){var d=Tt(l)?FS:Oz;return d(l)}function zj(l,d,g){(g?Qr(l,d,g):d===n)?d=1:d=St(d);var _=Tt(l)?uz:Dz;return _(l,d)}function Hj(l){var d=Tt(l)?cz:Mz;return d(l)}function jj(l){if(l==null)return 0;if(ui(l))return a0(l)?zu(l):l.length;var d=Fr(l);return d==ot||d==Ee?l.size:_5(l).length}function Gj(l,d,g){var _=Tt(l)?r5:Fz;return g&&Qr(l,d,g)&&(d=n),_(l,mt(d,3))}var Vj=Rt(function(l,d){if(l==null)return[];var g=d.length;return g>1&&Qr(l,d[0],d[1])?d=[]:g>2&&Qr(d[0],d[1],d[2])&&(d=[d[0]]),QS(l,br(d,1),[])}),t0=A$||function(){return mr.Date.now()};function Wj(l,d){if(typeof d!="function")throw new Qi(o);return l=St(l),function(){if(--l<1)return d.apply(this,arguments)}}function Vw(l,d,g){return d=g?n:d,d=l&&d==null?l.length:d,Mo(l,D,n,n,n,n,d)}function Ww(l,d){var g;if(typeof d!="function")throw new Qi(o);return l=St(l),function(){return--l>0&&(g=d.apply(this,arguments)),l<=1&&(d=n),g}}var V5=Rt(function(l,d,g){var _=T;if(g.length){var k=ws(g,Yu(V5));_|=N}return Mo(l,_,d,g,k)}),qw=Rt(function(l,d,g){var _=T|E;if(g.length){var k=ws(g,Yu(qw));_|=N}return Mo(d,_,l,g,k)});function Kw(l,d,g){d=g?n:d;var _=Mo(l,w,n,n,n,n,n,d);return _.placeholder=Kw.placeholder,_}function Yw(l,d,g){d=g?n:d;var _=Mo(l,A,n,n,n,n,n,d);return _.placeholder=Yw.placeholder,_}function Xw(l,d,g){var _,k,F,z,Y,ie,Ae=0,xe=!1,Ie=!1,Xe=!0;if(typeof l!="function")throw new Qi(o);d=na(d)||0,Rn(g)&&(xe=!!g.leading,Ie="maxWait"in g,F=Ie?Jn(na(g.maxWait)||0,d):F,Xe="trailing"in g?!!g.trailing:Xe);function st(Hn){var Ia=_,$o=k;return _=k=n,Ae=Hn,z=l.apply($o,Ia),z}function bt(Hn){return Ae=Hn,Y=Hc(Ot,d),xe?st(Hn):z}function Ct(Hn){var Ia=Hn-ie,$o=Hn-Ae,gA=d-Ia;return Ie?Mr(gA,F-$o):gA}function yt(Hn){var Ia=Hn-ie,$o=Hn-Ae;return ie===n||Ia>=d||Ia<0||Ie&&$o>=F}function Ot(){var Hn=t0();if(yt(Hn))return $t(Hn);Y=Hc(Ot,Ct(Hn))}function $t(Hn){return Y=n,Xe&&_?st(Hn):(_=k=n,z)}function Ii(){Y!==n&&ow(Y),Ae=0,_=ie=k=Y=n}function Zr(){return Y===n?z:$t(t0())}function Ri(){var Hn=t0(),Ia=yt(Hn);if(_=arguments,k=this,ie=Hn,Ia){if(Y===n)return bt(ie);if(Ie)return ow(Y),Y=Hc(Ot,d),st(ie)}return Y===n&&(Y=Hc(Ot,d)),z}return Ri.cancel=Ii,Ri.flush=Zr,Ri}var qj=Rt(function(l,d){return US(l,1,d)}),Kj=Rt(function(l,d,g){return US(l,na(d)||0,g)});function Yj(l){return Mo(l,V)}function n0(l,d){if(typeof l!="function"||d!=null&&typeof d!="function")throw new Qi(o);var g=function(){var _=arguments,k=d?d.apply(this,_):_[0],F=g.cache;if(F.has(k))return F.get(k);var z=l.apply(this,_);return g.cache=F.set(k,z)||F,z};return g.cache=new(n0.Cache||Do),g}n0.Cache=Do;function r0(l){if(typeof l!="function")throw new Qi(o);return function(){var d=arguments;switch(d.length){case 0:return!l.call(this);case 1:return!l.call(this,d[0]);case 2:return!l.call(this,d[0],d[1]);case 3:return!l.call(this,d[0],d[1],d[2])}return!l.apply(this,d)}}function Xj(l){return Ww(2,l)}var Qj=Pz(function(l,d){d=d.length==1&&Tt(d[0])?An(d[0],Ci(mt())):An(br(d,1),Ci(mt()));var g=d.length;return Rt(function(_){for(var k=-1,F=Mr(_.length,g);++k=d}),$l=GS(function(){return arguments}())?GS:function(l){return Mn(l)&&an.call(l,"callee")&&!RS.call(l,"callee")},Tt=fe.isArray,pG=dS?Ci(dS):vz;function ui(l){return l!=null&&i0(l.length)&&!Bo(l)}function zn(l){return Mn(l)&&ui(l)}function fG(l){return l===!0||l===!1||Mn(l)&&Xr(l)==te}var Rs=x$||r3,hG=pS?Ci(pS):_z;function gG(l){return Mn(l)&&l.nodeType===1&&!jc(l)}function mG(l){if(l==null)return!0;if(ui(l)&&(Tt(l)||typeof l=="string"||typeof l.splice=="function"||Rs(l)||Xu(l)||$l(l)))return!l.length;var d=Fr(l);if(d==ot||d==Ee)return!l.size;if(zc(l))return!_5(l).length;for(var g in l)if(an.call(l,g))return!1;return!0}function bG(l,d){return Bc(l,d)}function yG(l,d,g){g=typeof g=="function"?g:n;var _=g?g(l,d):n;return _===n?Bc(l,d,n,g):!!_}function q5(l){if(!Mn(l))return!1;var d=Xr(l);return d==Qe||d==Re||typeof l.message=="string"&&typeof l.name=="string"&&!jc(l)}function EG(l){return typeof l=="number"&&OS(l)}function Bo(l){if(!Rn(l))return!1;var d=Xr(l);return d==Ve||d==dt||d==we||d==de}function Zw(l){return typeof l=="number"&&l==St(l)}function i0(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=le}function Rn(l){var d=typeof l;return l!=null&&(d=="object"||d=="function")}function Mn(l){return l!=null&&typeof l=="object"}var Jw=fS?Ci(fS):Sz;function vG(l,d){return l===d||v5(l,d,P5(d))}function _G(l,d,g){return g=typeof g=="function"?g:n,v5(l,d,P5(d),g)}function TG(l){return eA(l)&&l!=+l}function SG(l){if(oH(l))throw new _t(a);return VS(l)}function wG(l){return l===null}function AG(l){return l==null}function eA(l){return typeof l=="number"||Mn(l)&&Xr(l)==Ge}function jc(l){if(!Mn(l)||Xr(l)!=U)return!1;var d=Nf(l);if(d===null)return!0;var g=an.call(d,"constructor")&&d.constructor;return typeof g=="function"&&g instanceof g&&xf.call(g)==_$}var K5=hS?Ci(hS):wz;function CG(l){return Zw(l)&&l>=-le&&l<=le}var tA=gS?Ci(gS):Az;function a0(l){return typeof l=="string"||!Tt(l)&&Mn(l)&&Xr(l)==Se}function ki(l){return typeof l=="symbol"||Mn(l)&&Xr(l)==De}var Xu=mS?Ci(mS):Cz;function xG(l){return l===n}function kG(l){return Mn(l)&&Fr(l)==Ye}function IG(l){return Mn(l)&&Xr(l)==Gt}var RG=Yf(T5),NG=Yf(function(l,d){return l<=d});function nA(l){if(!l)return[];if(ui(l))return a0(l)?Ca(l):li(l);if(Rc&&l[Rc])return u$(l[Rc]());var d=Fr(l),g=d==ot?u5:d==Ee?wf:Qu;return g(l)}function Uo(l){if(!l)return l===0?l:0;if(l=na(l),l===se||l===-se){var d=l<0?-1:1;return d*he}return l===l?l:0}function St(l){var d=Uo(l),g=d%1;return d===d?g?d-g:d:0}function rA(l){return l?Fl(St(l),0,X):0}function na(l){if(typeof l=="number")return l;if(ki(l))return I;if(Rn(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=Rn(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=TS(l);var g=Be.test(l);return g||un.test(l)?WU(l.slice(2),g?2:8):J.test(l)?I:+l}function iA(l){return ro(l,ci(l))}function OG(l){return l?Fl(St(l),-le,le):l===0?l:0}function en(l){return l==null?"":xi(l)}var DG=qu(function(l,d){if(zc(d)||ui(d)){ro(d,lr(d),l);return}for(var g in d)an.call(d,g)&&Mc(l,g,d[g])}),aA=qu(function(l,d){ro(d,ci(d),l)}),o0=qu(function(l,d,g,_){ro(d,ci(d),l,_)}),LG=qu(function(l,d,g,_){ro(d,lr(d),l,_)}),MG=Fo(g5);function FG(l,d){var g=Wu(l);return d==null?g:PS(g,d)}var PG=Rt(function(l,d){l=pn(l);var g=-1,_=d.length,k=_>2?d[2]:n;for(k&&Qr(d[0],d[1],k)&&(_=1);++g<_;)for(var F=d[g],z=ci(F),Y=-1,ie=z.length;++Y1),F}),ro(l,M5(l),g),_&&(g=Ji(g,f|m|h,Kz));for(var k=d.length;k--;)x5(g,d[k]);return g});function tV(l,d){return sA(l,r0(mt(d)))}var nV=Fo(function(l,d){return l==null?{}:Iz(l,d)});function sA(l,d){if(l==null)return{};var g=An(M5(l),function(_){return[_]});return d=mt(d),ZS(l,g,function(_,k){return d(_,k[0])})}function rV(l,d,g){d=ks(d,l);var _=-1,k=d.length;for(k||(k=1,l=n);++_d){var _=l;l=d,d=_}if(g||l%1||d%1){var k=DS();return Mr(l+k*(d-l+VU("1e-"+((k+"").length-1))),d)}return w5(l,d)}var hV=Ku(function(l,d,g){return d=d.toLowerCase(),l+(g?cA(d):d)});function cA(l){return Q5(en(l).toLowerCase())}function dA(l){return l=en(l),l&&l.replace(sr,i$).replace(MU,"")}function gV(l,d,g){l=en(l),d=xi(d);var _=l.length;g=g===n?_:Fl(St(g),0,_);var k=g;return g-=d.length,g>=0&&l.slice(g,k)==d}function mV(l){return l=en(l),l&&Zt.test(l)?l.replace(Je,a$):l}function bV(l){return l=en(l),l&&si.test(l)?l.replace(Aa,"\\$&"):l}var yV=Ku(function(l,d,g){return l+(g?"-":"")+d.toLowerCase()}),EV=Ku(function(l,d,g){return l+(g?" ":"")+d.toLowerCase()}),vV=hw("toLowerCase");function _V(l,d,g){l=en(l),d=St(d);var _=d?zu(l):0;if(!d||_>=d)return l;var k=(d-_)/2;return Kf(Mf(k),g)+l+Kf(Lf(k),g)}function TV(l,d,g){l=en(l),d=St(d);var _=d?zu(l):0;return d&&_>>0,g?(l=en(l),l&&(typeof d=="string"||d!=null&&!K5(d))&&(d=xi(d),!d&&$u(l))?Is(Ca(l),0,g):l.split(d,g)):[]}var IV=Ku(function(l,d,g){return l+(g?" ":"")+Q5(d)});function RV(l,d,g){return l=en(l),g=g==null?0:Fl(St(g),0,l.length),d=xi(d),l.slice(g,g+d.length)==d}function NV(l,d,g){var _=M.templateSettings;g&&Qr(l,d,g)&&(d=n),l=en(l),d=o0({},d,_,_w);var k=o0({},d.imports,_.imports,_w),F=lr(k),z=l5(k,F),Y,ie,Ae=0,xe=d.interpolate||Qn,Ie="__p += '",Xe=c5((d.escape||Qn).source+"|"+xe.source+"|"+(xe===Xt?Nl:Qn).source+"|"+(d.evaluate||Qn).source+"|$","g"),st="//# sourceURL="+(an.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$U+"]")+` `;l.replace(Xe,function(yt,Ot,$t,Ii,Zr,Ri){return $t||($t=Ii),Ie+=l.slice(Ae,Ri).replace(No,o$),Ot&&(Y=!0,Ie+=`' + __e(`+Ot+`) + '`),Zr&&(ie=!0,Ie+=`'; @@ -1178,7 +1178,7 @@ __p += '`),$t&&(Ie+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ie+`return __p -}`;var Ct=fA(function(){return Jt(F,st+"return "+Ie).apply(n,z)});if(Ct.source=Ie,q5(Ct))throw Ct;return Ct}function OV(l){return en(l).toLowerCase()}function DV(l){return en(l).toUpperCase()}function LV(l,d,g){if(l=en(l),l&&(g||d===n))return TS(l);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=Ca(d),F=SS(_,k),z=wS(_,k)+1;return Is(_,F,z).join("")}function MV(l,d,g){if(l=en(l),l&&(g||d===n))return l.slice(0,CS(l)+1);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=wS(_,Ca(d))+1;return Is(_,0,k).join("")}function FV(l,d,g){if(l=en(l),l&&(g||d===n))return l.replace(Or,"");if(!l||!(d=xi(d)))return l;var _=Ca(l),k=SS(_,Ca(d));return Is(_,k).join("")}function PV(l,d){var g=P,_=Z;if(Rn(d)){var k="separator"in d?d.separator:k;g="length"in d?wt(d.length):g,_="omission"in d?xi(d.omission):_}l=en(l);var F=l.length;if($u(l)){var z=Ca(l);F=z.length}if(g>=F)return l;var Y=g-zu(_);if(Y<1)return _;var ie=z?Is(z,0,Y).join(""):l.slice(0,Y);if(k===n)return ie+_;if(z&&(Y+=ie.length-Y),K5(k)){if(l.slice(Y).search(k)){var Ae,xe=ie;for(k.global||(k=c5(k.source,en(Ke.exec(k))+"g")),k.lastIndex=0;Ae=k.exec(xe);)var Ie=Ae.index;ie=ie.slice(0,Ie===n?Y:Ie)}}else if(l.indexOf(xi(k),Y)!=Y){var Xe=ie.lastIndexOf(k);Xe>-1&&(ie=ie.slice(0,Xe))}return ie+_}function BV(l){return l=en(l),l&&Nt.test(l)?l.replace(rt,f$):l}var UV=Ku(function(l,d,g){return l+(g?" ":"")+d.toUpperCase()}),Q5=hw("toUpperCase");function pA(l,d,g){return l=en(l),d=g?n:d,d===n?l$(l)?m$(l):JU(l):l.match(d)||[]}var fA=Rt(function(l,d){try{return Ai(l,n,d)}catch(g){return q5(g)?g:new _t(g)}}),$V=Fo(function(l,d){return Xi(d,function(g){g=io(g),Lo(l,g,V5(l[g],l))}),l});function zV(l){var d=l==null?0:l.length,g=mt();return l=d?An(l,function(_){if(typeof _[1]!="function")throw new Qi(o);return[g(_[0]),_[1]]}):[],Rt(function(_){for(var k=-1;++kle)return[];var g=X,_=Mr(l,X);d=mt(d),l-=X;for(var k=s5(_,d);++g0||d<0)?new Pt(g):(l<0?g=g.takeRight(-l):l&&(g=g.drop(l)),d!==n&&(d=wt(d),g=d<0?g.dropRight(-d):g.take(d-l)),g)},Pt.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Pt.prototype.toArray=function(){return this.take(X)},no(Pt.prototype,function(l,d){var g=/^(?:filter|find|map|reject)|While$/.test(d),_=/^(?:head|last)$/.test(d),k=M[_?"take"+(d=="last"?"Right":""):d],F=_||/^find/.test(d);k&&(M.prototype[d]=function(){var z=this.__wrapped__,Y=_?[1]:arguments,ie=z instanceof Pt,Ae=Y[0],xe=ie||Tt(z),Ie=function(Ot){var $t=k.apply(M,Ss([Ot],Y));return _&&Xe?$t[0]:$t};xe&&g&&typeof Ae=="function"&&Ae.length!=1&&(ie=xe=!1);var Xe=this.__chain__,st=!!this.__actions__.length,bt=F&&!Xe,Ct=ie&&!st;if(!F&&xe){z=Ct?z:new Pt(this);var yt=l.apply(z,Y);return yt.__actions__.push({func:Jf,args:[Ie],thisArg:n}),new Zi(yt,Xe)}return bt&&Ct?l.apply(this,Y):(yt=this.thru(Ie),bt?_?yt.value()[0]:yt.value():yt)})}),Xi(["pop","push","shift","sort","splice","unshift"],function(l){var d=Af[l],g=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",_=/^(?:pop|shift)$/.test(l);M.prototype[l]=function(){var k=arguments;if(_&&!this.__chain__){var F=this.value();return d.apply(Tt(F)?F:[],k)}return this[g](function(z){return d.apply(Tt(z)?z:[],k)})}}),no(Pt.prototype,function(l,d){var g=M[d];if(g){var _=g.name+"";an.call(Vu,_)||(Vu[_]=[]),Vu[_].push({name:d,func:g})}}),Vu[Wf(n,E).name]=[{name:"wrapper",func:n}],Pt.prototype.clone=B$,Pt.prototype.reverse=U$,Pt.prototype.value=$$,M.prototype.at=gj,M.prototype.chain=mj,M.prototype.commit=bj,M.prototype.next=yj,M.prototype.plant=vj,M.prototype.reverse=_j,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=Tj,M.prototype.first=M.prototype.head,Rc&&(M.prototype[Rc]=Ej),M},Hu=b$();Ol?((Ol.exports=Hu)._=Hu,J2._=Hu):mr._=Hu}).call(eu)})(um,um.exports);var D4e=um.exports;const el=Vi(D4e);function lo(e,t){const n=el.cloneDeep(e);for(const r in t)typeof t[r]=="function"?el.updateWith(n,r,t[r]):el.updateWith(n,r,i=>t[r]);return n}const kc={};kc["Requires API Key"]="#FF0000";kc.Local="#00bb00";kc["Open-Source"]="#0033FF";kc.Free="#ffff00";const L4e={inputType:"number",key:"context_length",label:"Context Length",defaultValue:2048,required:!1},M4e={inputType:"number",key:"temperature",label:"Temperature",defaultValue:void 0,required:!1,min:0,max:1,step:.01},F4e={inputType:"number",key:"top_p",label:"Top-P",defaultValue:void 0,required:!1,min:0,max:1,step:.01},P4e={inputType:"number",key:"top_k",label:"Top-K",defaultValue:void 0,required:!1,min:0,max:1,step:.01},B4e={inputType:"number",key:"presence_penalty",label:"Presence Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},U4e={inputType:"number",key:"frequency_penalty",label:"Frequency Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},Da=[L4e,M4e,P4e,F4e,B4e,U4e],CN={inputType:"text",key:"server_url",label:"Server URL",placeholder:"e.g. http://localhost:8080",required:!1},uE={title:"CodeLlama Instruct",description:"A model from Meta, fine-tuned for code generation and conversation",refUrl:"",params:{title:"CodeLlama-7b-Instruct",model:"codellama:7b-instruct",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"codellama:7b-instruct",title:"CodeLlama-7b-Instruct"},"13b":{model:"codellama:13b-instruct",title:"CodeLlama-13b-Instruct"},"34b":{model:"codellama:34b-instruct",title:"CodeLlama-34b-Instruct"}}}]},cE={title:"Llama2 Chat",description:"The latest Llama model from Meta, fine-tuned for chat",refUrl:"",params:{title:"Llama2-7b-Chat",model:"llama2:7b-chat",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"llama2:7b-chat",title:"Llama2-7b-Chat"},"13b":{model:"llama2:13b-chat",title:"Llama2-13b-Chat"},"34b":{model:"llama2:34b-chat",title:"Llama2-34b-Chat"}}}]},dE={title:"WizardCoder",description:"A CodeLlama-based code generation model from WizardLM, focused on Python",refUrl:"",params:{title:"WizardCoder-7b-Python",model:"wizardcoder:7b-python",context_length:2048,template_messages:"template_alpaca_messages",prompt_templates:{edit:"alpaca_edit_prompt"}},icon:"wizardlm.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"wizardcoder:7b-python",title:"WizardCoder-7b-Python"},"13b":{model:"wizardcoder:13b-python",title:"WizardCoder-13b-Python"},"34b":{model:"wizardcoder:34b-python",title:"WizardCoder-34b-Python"}}}]},sU={title:"Phind CodeLlama (34b)",description:"A finetune of CodeLlama by Phind",params:{title:"Phind CodeLlama",model:"phind-codellama",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}}},pE={title:"Mistral (7b)",description:"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",params:{title:"Mistral",model:"mistral",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},icon:"mistral.png"},lU={title:"SQLCoder",description:"A finetune of StarCoder by Defog.ai, focused specifically on SQL",params:{title:"SQLCoder",model:"sqlcoder",context_length:2048,template_messages:"sqlcoder_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"sqlcoder:7b",title:"SQLCoder-7b"},"13b":{model:"sqlcoder:15b",title:"SQLCoder-15b"}}}]},$4e={title:"CodeUp (13b)",description:"An open-source coding model based on Llama2",params:{title:"CodeUp",model:"codeup",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"alpaca_edit_prompt"}}},o1=[uE,cE,dE,sU,lU,pE,$4e],xN={title:"GPT-4",description:"The latest model from OpenAI",params:{model:"gpt-4",context_length:8096,api_key:"",title:"GPT-4"}},kN={title:"GPT-3.5-Turbo",description:"A faster, cheaper OpenAI model with slightly lower capabilities",params:{model:"gpt-3.5-turbo",context_length:8096,title:"GPT-3.5-Turbo",api_key:""}},z4e={"codellama:7b-instruct":"meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e","codellama:13b-instruct":"meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7","codellama:34b-instruct":"meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e","llama2:7b-chat":"meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e","llama2:13b-chat":"meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d"};function IN(e){return z4e[e]||e}const uU={openai:{title:"OpenAI",class:"OpenAI",description:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",longDescription:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",icon:"openai.png",tags:["Requires API Key"],packages:[xN,kN],collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your OpenAI API key",required:!0},...Da]},anthropic:{title:"Anthropic",class:"AnthropicLLM",description:"Claude-2 is a highly capable model with a 100k context length",icon:"anthropic.png",tags:["Requires API Key"],longDescription:"To get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.",collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your Anthropic API key",required:!0},...Da],packages:[{title:"Claude-2",description:"A highly capable model with a 100k context length",params:{model:"claude-2",context_length:1e5,title:"Claude-2"}}]},ollama:{title:"Ollama",class:"Ollama",description:"One of the fastest ways to get started with local models on Mac or Linux",longDescription:'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',icon:"ollama.png",tags:["Local","Open-Source"],packages:o1,collectInputFor:[...Da]},together:{title:"TogetherAI",class:"TogetherLLM",description:"Use the TogetherAI API for extremely fast streaming of open-source models",icon:"together.png",longDescription:`Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together: +}`;var Ct=fA(function(){return Jt(F,st+"return "+Ie).apply(n,z)});if(Ct.source=Ie,q5(Ct))throw Ct;return Ct}function OV(l){return en(l).toLowerCase()}function DV(l){return en(l).toUpperCase()}function LV(l,d,g){if(l=en(l),l&&(g||d===n))return TS(l);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=Ca(d),F=SS(_,k),z=wS(_,k)+1;return Is(_,F,z).join("")}function MV(l,d,g){if(l=en(l),l&&(g||d===n))return l.slice(0,CS(l)+1);if(!l||!(d=xi(d)))return l;var _=Ca(l),k=wS(_,Ca(d))+1;return Is(_,0,k).join("")}function FV(l,d,g){if(l=en(l),l&&(g||d===n))return l.replace(Or,"");if(!l||!(d=xi(d)))return l;var _=Ca(l),k=SS(_,Ca(d));return Is(_,k).join("")}function PV(l,d){var g=P,_=Z;if(Rn(d)){var k="separator"in d?d.separator:k;g="length"in d?St(d.length):g,_="omission"in d?xi(d.omission):_}l=en(l);var F=l.length;if($u(l)){var z=Ca(l);F=z.length}if(g>=F)return l;var Y=g-zu(_);if(Y<1)return _;var ie=z?Is(z,0,Y).join(""):l.slice(0,Y);if(k===n)return ie+_;if(z&&(Y+=ie.length-Y),K5(k)){if(l.slice(Y).search(k)){var Ae,xe=ie;for(k.global||(k=c5(k.source,en(Ke.exec(k))+"g")),k.lastIndex=0;Ae=k.exec(xe);)var Ie=Ae.index;ie=ie.slice(0,Ie===n?Y:Ie)}}else if(l.indexOf(xi(k),Y)!=Y){var Xe=ie.lastIndexOf(k);Xe>-1&&(ie=ie.slice(0,Xe))}return ie+_}function BV(l){return l=en(l),l&&Nt.test(l)?l.replace(rt,f$):l}var UV=Ku(function(l,d,g){return l+(g?" ":"")+d.toUpperCase()}),Q5=hw("toUpperCase");function pA(l,d,g){return l=en(l),d=g?n:d,d===n?l$(l)?m$(l):JU(l):l.match(d)||[]}var fA=Rt(function(l,d){try{return Ai(l,n,d)}catch(g){return q5(g)?g:new _t(g)}}),$V=Fo(function(l,d){return Xi(d,function(g){g=io(g),Lo(l,g,V5(l[g],l))}),l});function zV(l){var d=l==null?0:l.length,g=mt();return l=d?An(l,function(_){if(typeof _[1]!="function")throw new Qi(o);return[g(_[0]),_[1]]}):[],Rt(function(_){for(var k=-1;++kle)return[];var g=X,_=Mr(l,X);d=mt(d),l-=X;for(var k=s5(_,d);++g0||d<0)?new Pt(g):(l<0?g=g.takeRight(-l):l&&(g=g.drop(l)),d!==n&&(d=St(d),g=d<0?g.dropRight(-d):g.take(d-l)),g)},Pt.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Pt.prototype.toArray=function(){return this.take(X)},no(Pt.prototype,function(l,d){var g=/^(?:filter|find|map|reject)|While$/.test(d),_=/^(?:head|last)$/.test(d),k=M[_?"take"+(d=="last"?"Right":""):d],F=_||/^find/.test(d);k&&(M.prototype[d]=function(){var z=this.__wrapped__,Y=_?[1]:arguments,ie=z instanceof Pt,Ae=Y[0],xe=ie||Tt(z),Ie=function(Ot){var $t=k.apply(M,Ss([Ot],Y));return _&&Xe?$t[0]:$t};xe&&g&&typeof Ae=="function"&&Ae.length!=1&&(ie=xe=!1);var Xe=this.__chain__,st=!!this.__actions__.length,bt=F&&!Xe,Ct=ie&&!st;if(!F&&xe){z=Ct?z:new Pt(this);var yt=l.apply(z,Y);return yt.__actions__.push({func:Jf,args:[Ie],thisArg:n}),new Zi(yt,Xe)}return bt&&Ct?l.apply(this,Y):(yt=this.thru(Ie),bt?_?yt.value()[0]:yt.value():yt)})}),Xi(["pop","push","shift","sort","splice","unshift"],function(l){var d=Af[l],g=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",_=/^(?:pop|shift)$/.test(l);M.prototype[l]=function(){var k=arguments;if(_&&!this.__chain__){var F=this.value();return d.apply(Tt(F)?F:[],k)}return this[g](function(z){return d.apply(Tt(z)?z:[],k)})}}),no(Pt.prototype,function(l,d){var g=M[d];if(g){var _=g.name+"";an.call(Vu,_)||(Vu[_]=[]),Vu[_].push({name:d,func:g})}}),Vu[Wf(n,E).name]=[{name:"wrapper",func:n}],Pt.prototype.clone=B$,Pt.prototype.reverse=U$,Pt.prototype.value=$$,M.prototype.at=gj,M.prototype.chain=mj,M.prototype.commit=bj,M.prototype.next=yj,M.prototype.plant=vj,M.prototype.reverse=_j,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=Tj,M.prototype.first=M.prototype.head,Rc&&(M.prototype[Rc]=Ej),M},Hu=b$();Ol?((Ol.exports=Hu)._=Hu,J2._=Hu):mr._=Hu}).call(eu)})(um,um.exports);var D4e=um.exports;const el=Vi(D4e);function lo(e,t){const n=el.cloneDeep(e);for(const r in t)typeof t[r]=="function"?el.updateWith(n,r,t[r]):el.updateWith(n,r,i=>t[r]);return n}const kc={};kc["Requires API Key"]="#FF0000";kc.Local="#00bb00";kc["Open-Source"]="#0033FF";kc.Free="#ffff00";const L4e={inputType:"number",key:"context_length",label:"Context Length",defaultValue:2048,required:!1},M4e={inputType:"number",key:"temperature",label:"Temperature",defaultValue:void 0,required:!1,min:0,max:1,step:.01},F4e={inputType:"number",key:"top_p",label:"Top-P",defaultValue:void 0,required:!1,min:0,max:1,step:.01},P4e={inputType:"number",key:"top_k",label:"Top-K",defaultValue:void 0,required:!1,min:0,max:1,step:.01},B4e={inputType:"number",key:"presence_penalty",label:"Presence Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},U4e={inputType:"number",key:"frequency_penalty",label:"Frequency Penalty",defaultValue:void 0,required:!1,min:0,max:1,step:.01},Da=[L4e,M4e,P4e,F4e,B4e,U4e],CN={inputType:"text",key:"server_url",label:"Server URL",placeholder:"e.g. http://localhost:8080",required:!1},uE={title:"CodeLlama Instruct",description:"A model from Meta, fine-tuned for code generation and conversation",refUrl:"",params:{title:"CodeLlama-7b-Instruct",model:"codellama:7b-instruct",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"codellama:7b-instruct",title:"CodeLlama-7b-Instruct"},"13b":{model:"codellama:13b-instruct",title:"CodeLlama-13b-Instruct"},"34b":{model:"codellama:34b-instruct",title:"CodeLlama-34b-Instruct"}}}]},cE={title:"Llama2 Chat",description:"The latest Llama model from Meta, fine-tuned for chat",refUrl:"",params:{title:"Llama2-7b-Chat",model:"llama2:7b-chat",context_length:2048,template_messages:"llama2_template_messages"},icon:"meta.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"llama2:7b-chat",title:"Llama2-7b-Chat"},"13b":{model:"llama2:13b-chat",title:"Llama2-13b-Chat"},"34b":{model:"llama2:34b-chat",title:"Llama2-34b-Chat"}}}]},dE={title:"WizardCoder",description:"A CodeLlama-based code generation model from WizardLM, focused on Python",refUrl:"",params:{title:"WizardCoder-7b-Python",model:"wizardcoder:7b-python",context_length:2048,template_messages:"template_alpaca_messages",prompt_templates:{edit:"alpaca_edit_prompt"}},icon:"wizardlm.png",dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"wizardcoder:7b-python",title:"WizardCoder-7b-Python"},"13b":{model:"wizardcoder:13b-python",title:"WizardCoder-13b-Python"},"34b":{model:"wizardcoder:34b-python",title:"WizardCoder-34b-Python"}}}]},sU={title:"Phind CodeLlama (34b)",description:"A finetune of CodeLlama by Phind",params:{title:"Phind CodeLlama",model:"phind-codellama",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}}},pE={title:"Mistral (7b)",description:"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",params:{title:"Mistral",model:"mistral",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},icon:"mistral.png"},lU={title:"SQLCoder",description:"A finetune of StarCoder by Defog.ai, focused specifically on SQL",params:{title:"SQLCoder",model:"sqlcoder",context_length:2048,template_messages:"sqlcoder_template_messages",prompt_templates:{edit:"codellama_edit_prompt"}},dimensions:[{name:"Parameter Count",description:"The number of parameters in the model",options:{"7b":{model:"sqlcoder:7b",title:"SQLCoder-7b"},"13b":{model:"sqlcoder:15b",title:"SQLCoder-15b"}}}]},$4e={title:"CodeUp (13b)",description:"An open-source coding model based on Llama2",params:{title:"CodeUp",model:"codeup",context_length:2048,template_messages:"llama2_template_messages",prompt_templates:{edit:"alpaca_edit_prompt"}}},o1=[uE,cE,dE,sU,lU,pE,$4e],xN={title:"GPT-4",description:"The latest model from OpenAI",params:{model:"gpt-4",context_length:8096,api_key:"",title:"GPT-4"}},kN={title:"GPT-3.5-Turbo",description:"A faster, cheaper OpenAI model with slightly lower capabilities",params:{model:"gpt-3.5-turbo",context_length:8096,title:"GPT-3.5-Turbo",api_key:""}},z4e={"codellama:7b-instruct":"meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e","codellama:13b-instruct":"meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7","codellama:34b-instruct":"meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e","llama2:7b-chat":"meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e","llama2:13b-chat":"meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d"};function IN(e){return z4e[e]||e}const uU={openai:{title:"OpenAI",class:"OpenAI",description:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",longDescription:"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",icon:"openai.png",tags:["Requires API Key"],packages:[xN,kN],collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your OpenAI API key",required:!0},...Da]},anthropic:{title:"Anthropic",class:"AnthropicLLM",description:"Claude-2 is a highly capable model with a 100k context length",icon:"anthropic.png",tags:["Requires API Key"],longDescription:"To get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.",collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your Anthropic API key",required:!0},...Da],packages:[{title:"Claude-2",description:"A highly capable model with a 100k context length",params:{model:"claude-2",context_length:1e5,title:"Claude-2"}}]},ollama:{title:"Ollama",class:"Ollama",description:"One of the fastest ways to get started with local models on Mac or Linux",longDescription:'To get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama pull `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model="codellama:7b-instruct"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.',icon:"ollama.png",tags:["Local","Open-Source"],packages:o1,collectInputFor:[...Da]},together:{title:"TogetherAI",class:"TogetherLLM",description:"Use the TogetherAI API for extremely fast streaming of open-source models",icon:"together.png",longDescription:`Together is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together: 1. Obtain an API key from [here](https://together.ai) 2. Paste below 3. Select a model preset`,tags:["Requires API Key","Open-Source"],params:{api_key:""},collectInputFor:[{inputType:"text",key:"api_key",label:"API Key",placeholder:"Enter your TogetherAI API key",required:!0},...Da],packages:[lo(cE,{"dimensions[0].options":e=>el.mapValues(e,t=>el.assign({},t,{model:"togethercomputer/"+t.model.replace("llama2","llama-2").replace(":","-")}))}),lo(uE,{"dimensions[0].options":e=>el.mapValues(e,t=>el.assign({},t,{model:"togethercomputer/"+t.model.replace("codellama","CodeLlama").replace(":","-").replace("instruct","Instruct")}))}),lo(dE,{"params.model":"WizardLM/WizardCoder-15B-V1.0","params.title":"WizardCoder-15b","dimensions[0].options":{"15b":{model:"WizardLM/WizardCoder-15B-V1.0",title:"WizardCoder-15b"},"34b (Python)":{model:"WizardLM/WizardCoder-Python-34B-V1.0",title:"WizardCoder-34b-Python"}}}),lo(sU,{"params.model":"Phind/Phind-CodeLlama-34B-Python-v1"}),lo(pE,{"params.model":"mistralai/Mistral-7B-Instruct-v0.1"})].map(e=>(e.params.context_length=4096,e))},lmstudio:{title:"LM Studio",class:"GGML",description:"One of the fastest ways to get started with local models on Mac or Windows",longDescription:`LMStudio provides a professional and well-designed GUI for exploring, configuring, and serving LLMs. It is available on both Mac and Windows. To get started: @@ -1234,7 +1234,7 @@ function print() { __p += __j.call(arguments, '') } cursor: pointer; outline: 1px solid ${ha}; } -`;function cU(e){var o,s,u,c;const t=St(p=>p.config.vscMediaUrl),[n,r]=C.useState(((o=e.dimensions)==null?void 0:o.map(p=>Object.keys(p.options)[0]))||[]),[i,a]=C.useState(!1);return R.jsxs(H4e,{disabled:e.disabled||!1,color:ha,hovered:i,children:[R.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:"px-2 py-1",onClick:e.disabled?void 0:p=>{p.target.closest("a")||e.onClick(p,n)},children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[t&&e.icon&&R.jsx("img",{src:`${t}/logos/${e.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h3",{children:e.title})]}),(s=e.tags)==null?void 0:s.map(p=>R.jsx("span",{style:{backgroundColor:`${kc[p]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:p})),R.jsx("p",{children:e.description}),e.refUrl&&R.jsx("a",{style:{position:"absolute",right:"8px",top:"8px"},href:e.refUrl,target:"_blank",children:R.jsx(Ti,{text:"Read the docs",children:R.jsx(sQ,{width:"1.6em",height:"1.6em"})})})]}),((u=e.dimensions)==null?void 0:u.length)&&R.jsx(j4e,{children:(c=e.dimensions)==null?void 0:c.map((p,f)=>R.jsxs("div",{className:"flex items-center",children:[R.jsx(sE,{msg:p.description}),R.jsx("p",{className:"mx-2 text-sm my-0 py-0",children:p.name}),Object.keys(p.options).map(m=>R.jsx(G4e,{onClick:h=>{h.stopPropagation();const b=[...n];b[f]=m,r(b)},selected:n[f]===m,children:m}))]}))})]})}const V4e=He.div` +`;function cU(e){var o,s,u,c;const t=wt(p=>p.config.vscMediaUrl),[n,r]=C.useState(((o=e.dimensions)==null?void 0:o.map(p=>Object.keys(p.options)[0]))||[]),[i,a]=C.useState(!1);return R.jsxs(H4e,{disabled:e.disabled||!1,color:ha,hovered:i,children:[R.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:"px-2 py-1",onClick:e.disabled?void 0:p=>{p.target.closest("a")||e.onClick(p,n)},children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[t&&e.icon&&R.jsx("img",{src:`${t}/logos/${e.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h3",{children:e.title})]}),(s=e.tags)==null?void 0:s.map(p=>R.jsx("span",{style:{backgroundColor:`${kc[p]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:p})),R.jsx("p",{children:e.description}),e.refUrl&&R.jsx("a",{style:{position:"absolute",right:"8px",top:"8px"},href:e.refUrl,target:"_blank",children:R.jsx(Ti,{text:"Read the docs",children:R.jsx(sQ,{width:"1.6em",height:"1.6em"})})})]}),((u=e.dimensions)==null?void 0:u.length)&&R.jsx(j4e,{children:(c=e.dimensions)==null?void 0:c.map((p,f)=>R.jsxs("div",{className:"flex items-center",children:[R.jsx(sE,{msg:p.description}),R.jsx("p",{className:"mx-2 text-sm my-0 py-0",children:p.name}),Object.keys(p.options).map(m=>R.jsx(G4e,{onClick:h=>{h.stopPropagation();const b=[...n];b[f]=m,r(b)},selected:n[f]===m,children:m}))]}))})]})}const V4e=He.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-gap: 2rem; @@ -1267,4 +1267,4 @@ function print() { __p += __j.call(arguments, '') } cursor: pointer; } `} -`;function Y4e(){var u,c,p,f,m;const e=oU(),{modelName:t}=Vme(),[n,r]=C.useState(void 0);C.useEffect(()=>{t&&r(uU[t])},[t]);const i=C.useContext(eo);Io();const a=bs(),o=St(h=>h.config.vscMediaUrl),s=C.useCallback(()=>{var h;return((h=n==null?void 0:n.collectInputFor)==null?void 0:h.some(b=>{if(!b.required)return!1;const y=e.watch(b.key);return typeof y>"u"||typeof y=="string"&&y===""}))||!1},[n,e]);return R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex m-0 p-0 sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt,zIndex:2},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>a("/models"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Configure Model"})]}),R.jsxs("div",{className:"px-2",children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o&&(n==null?void 0:n.icon)&&R.jsx("img",{src:`${o}/logos/${n==null?void 0:n.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h2",{children:n==null?void 0:n.title})]}),(u=n==null?void 0:n.tags)==null?void 0:u.map(h=>R.jsx("span",{style:{backgroundColor:`${kc[h]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:h})),R.jsx(zg,{className:"mt-2",source:(n==null?void 0:n.longDescription)||(n==null?void 0:n.description),maxHeight:200}),R.jsx("br",{}),(((c=n==null?void 0:n.collectInputFor)==null?void 0:c.filter(h=>h.required).length)||0)>0&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{className:"mb-2",children:"Enter required parameters"}),(p=n==null?void 0:n.collectInputFor)==null?void 0:p.filter(h=>h.required).map(h=>R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!0})})]}))]}),(((f=n==null?void 0:n.collectInputFor)==null?void 0:f.filter(h=>!h.required).length)||0)>0&&R.jsxs("details",{children:[R.jsx("summary",{className:"mb-2",children:R.jsx("b",{children:"Advanced (optional)"})}),(m=n==null?void 0:n.collectInputFor)==null?void 0:m.map(h=>h.required?null:R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!1})})]}))]}),R.jsx("h3",{className:"mb-2",children:"Select a model preset"})]}),R.jsxs(q4e,{children:[n==null?void 0:n.packages.map(h=>R.jsx(cU,{disabled:s(),title:h.title,description:h.description,tags:h.tags,refUrl:h.refUrl,icon:h.icon||n.icon,dimensions:h.dimensions,onClick:(b,y)=>{var E;if(s())return;const T={};for(const v of n.collectInputFor||[])T[v.key]=v.inputType==="text"?e.watch(v.key):parseFloat(e.watch(v.key));i==null||i.addModelForRole("*",n.class,{...h.params,...n.params,...el.merge({},...((E=h.dimensions)==null?void 0:E.map((v,w)=>y!=null&&y[w]?{...v.options[y[w]]}:{}))||[]),...T}),a("/")}})),R.jsx(K4e,{disabled:s(),onClick:h=>{var y;if(!n||s())return;const b={};for(const T of n.collectInputFor||[])b[T.key]=T.inputType==="text"?e.watch(T.key):parseFloat(e.watch(T.key));i==null||i.addModelForRole("*",n.class,{...(y=n.packages[0])==null?void 0:y.params,...n.params,...b}),a("/")},children:R.jsx("h3",{className:"text-center my-2",children:"Configure Model in config.py"})})]})]})})}const bd=window,dU=pf({name:"config",initialState:{apiUrl:bd.serverUrl||"http://localhost:8000",vscMediaUrl:bd.vscMediaUrl||localStorage.getItem("vscMediaUrl")||void 0,workspacePaths:bd.workspacePaths||[],vscMachineId:bd.vscMachineId||void 0,windowId:bd.windowId||void 0},reducers:{setWorkspacePaths:(e,t)=>({...e,workspacePaths:t.payload}),setApiUrl:(e,t)=>({...e,apiUrl:t.payload}),setVscMachineId:(e,t)=>({...e,vscMachineId:t.payload}),setSessionId:(e,t)=>({...e,sessionId:t.payload}),setVscMediaUrl:(e,t)=>(localStorage.setItem("vscMediaUrl",t.payload),{...e,vscMediaUrl:t.payload}),setDataSwitchOn:(e,t)=>({...e,dataSwitchOn:t.payload})}}),{setVscMachineId:RN,setApiUrl:X4e,setWorkspacePaths:Q4e,setSessionId:eye,setVscMediaUrl:tye,setDataSwitchOn:nye}=dU.actions,Z4e=dU.reducer;function J4e(e,t){const n=St(u=>u.config.apiUrl),r=St(u=>u.sessionState.active),i=St(u=>u.sessionState.title),a=St(u=>u.sessionState.history),[o,s]=C.useState(!1);C.useEffect(()=>{t(Xd(!1)),qa("onLoad",{})},[]),C.useEffect(()=>{(async()=>{if(e&&!o&&!r&&i==="New Session"&&a.filter(u=>!u.hide).length>=2){s(!0);const u=await e.getSessionTitle(a);t(kP(u))}})()},[r,a,i,e,o]),C.useEffect(()=>{e&&(e.onSessionUpdate(u=>{t(b0e(u))}),e.onAddContextItem(u=>{t(CP(u))}),e.onConfigUpdate(u=>{t(LR(u))}),fetch(`${n}/slash_commands`).then(async u=>{const c=await u.json();t(qge(c))}),fetch(`${n}/context_providers`).then(async u=>{const c=await u.json();t(Wge(c))}),e.getConfig().then(u=>{t(LR(u))}))},[e]),C.useEffect(()=>{const u=c=>{switch(c.data.type){case"onLoad":window.windowId=c.data.windowId,window.serverUrl=c.data.serverUrl,window.workspacePaths=c.data.workspacePaths,window.vscMachineId=c.data.vscMachineId,window.vscMediaUrl=c.data.vscMediaUrl,t(X4e(c.data.serverUrl)),t(Q4e(c.data.workspacePaths)),t(RN(c.data.vscMachineId)),t(RN(c.data.vscMachineId));break;case"highlightedCode":t(y0e({rangeInFileWithContents:c.data.rangeInFileWithContents,edit:c.data.edit}));break;case"serverStatus":t(Z0e(c.data.message));break;case"stopSession":e==null||e.stopSession();break}};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[e]),C.useEffect(()=>{document.body.style.getPropertyValue("--vscode-editor-foreground")&&localStorage.setItem("--vscode-editor-foreground",document.body.style.getPropertyValue("--vscode-editor-foreground")),document.body.style.getPropertyValue("--vscode-editor-background")&&localStorage.setItem("--vscode-editor-background",document.body.style.getPropertyValue("--vscode-editor-background")),document.body.style.getPropertyValue("--vscode-list-hoverBackground")&&localStorage.setItem("--vscode-list-hoverBackground",document.body.style.getPropertyValue("--vscode-list-hoverBackground"))},[])}const ebe=l2e([{path:"/",element:R.jsx(d3e,{}),errorElement:R.jsx(o4e,{}),children:[{path:"/index.html",element:R.jsx(XR,{})},{path:"/",element:R.jsx(XR,{})},{path:"/history",element:R.jsx(A2e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/settings",element:R.jsx(O4e,{})},{path:"/models",element:R.jsx(W4e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/modelconfig/:modelName",element:R.jsx(Y4e,{})}]}]),eo=C.createContext(void 0);function tbe(){const e=a4e(!1),t=Io();return J4e(e,t),R.jsx(eo.Provider,{value:e,children:R.jsx(r2e,{router:ebe})})}var zT={},HT={};HT.__esModule=!0;HT.default=ibe;function Xh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xh=function(n){return typeof n}:Xh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Xh(e)}function J4(){}var nbe={getItem:J4,setItem:J4,removeItem:J4};function rbe(e){if((typeof self>"u"?"undefined":Xh(self))!=="object"||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch{return!1}return!0}function ibe(e){var t="".concat(e,"Storage");return rbe(t)?self[t]:nbe}zT.__esModule=!0;zT.default=sbe;var abe=obe(HT);function obe(e){return e&&e.__esModule?e:{default:e}}function sbe(e){var t=(0,abe.default)(e);return{getItem:function(r){return new Promise(function(i,a){i(t.getItem(r))})},setItem:function(r,i){return new Promise(function(a,o){a(t.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(t.removeItem(r))})}}}var pU=void 0,lbe=ube(zT);function ube(e){return e&&e.__esModule?e:{default:e}}var cbe=(0,lbe.default)("local");pU=cbe;var jT="persist:",fU="persist/FLUSH",GT="persist/REHYDRATE",hU="persist/PAUSE",gU="persist/PERSIST",mU="persist/PURGE",bU="persist/REGISTER",dbe=-1;function Qh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qh=function(n){return typeof n}:Qh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Qh(e)}function NN(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 pbe(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sbe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}var wbe=5e3;function Abe(e,t){var n=e.version!==void 0?e.version:dbe;e.debug;var r=e.stateReconciler===void 0?hbe:e.stateReconciler,i=e.getStoredState||bbe,a=e.timeout!==void 0?e.timeout:wbe,o=null,s=!1,u=!0,c=function(f){return f._persist.rehydrated&&o&&!u&&o.update(f),f};return function(p,f){var m=p||{},h=m._persist,b=Tbe(m,["_persist"]),y=b;if(f.type===gU){var T=!1,E=function(B,V){T||(f.rehydrate(e.key,B,V),T=!0)};if(a&&setTimeout(function(){!T&&E(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},a),u=!1,o||(o=gbe(e)),h)return Yo({},t(y,f),{_persist:h});if(typeof f.rehydrate!="function"||typeof f.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return f.register(e.key),i(e).then(function(D){var B=e.migrate||function(V,P){return Promise.resolve(V)};B(D,n).then(function(V){E(V)},function(V){E(void 0,V)})},function(D){E(void 0,D)}),Yo({},t(y,f),{_persist:{version:n,rehydrated:!1}})}else{if(f.type===mU)return s=!0,f.result(Ebe(e)),Yo({},t(y,f),{_persist:h});if(f.type===fU)return f.result(o&&o.flush()),Yo({},t(y,f),{_persist:h});if(f.type===hU)u=!0;else if(f.type===GT){if(s)return Yo({},y,{_persist:Yo({},h,{rehydrated:!0})});if(f.key===e.key){var v=t(y,f),w=f.payload,A=r!==!1&&w!==void 0?r(w,p,v,e):v,N=Yo({},A,{_persist:Yo({},h,{rehydrated:!0})});return c(N)}}}if(!h)return t(p,f);var x=t(y,f);return x===y?p:c(Yo({},x,{_persist:h}))}}function DN(e){return kbe(e)||xbe(e)||Cbe()}function Cbe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function xbe(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function kbe(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0&&arguments[0]!==void 0?arguments[0]:yU,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case bU:return fE({},t,{registry:[].concat(DN(t.registry),[n.key])});case GT:var r=t.registry.indexOf(n.key),i=DN(t.registry);return i.splice(r,1),fE({},t,{registry:i,bootstrapped:i.length===0});default:return t}};function Nbe(e,t,n){var r=n||!1,i=sT(Rbe,yU,t&&t.enhancer?t.enhancer:void 0),a=function(c){i.dispatch({type:bU,key:c})},o=function(c,p,f){var m={type:GT,payload:p,err:f,key:c};e.dispatch(m),i.dispatch(m),r&&s.getState().bootstrapped&&(r(),r=!1)},s=fE({},i,{purge:function(){var c=[];return e.dispatch({type:mU,result:function(f){c.push(f)}}),Promise.all(c)},flush:function(){var c=[];return e.dispatch({type:fU,result:function(f){c.push(f)}}),Promise.all(c)},pause:function(){e.dispatch({type:hU})},persist:function(){e.dispatch({type:gU,register:a,rehydrate:o})}});return t&&t.manualPersist||s.persist(),s}const Obe=vP({config:Z4e,misc:J0e,uiState:Y0e,sessionState:v0e,serverState:Kge}),Dbe={key:"root",storage:pU},Lbe=Abe(Dbe,Obe),EU=r0e({reducer:Lbe,middleware:e=>e({serializableCheck:!1})}),Mbe=Nbe(EU);function Zh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zh=function(n){return typeof n}:Zh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zh(e)}function Fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MN(e,t){for(var n=0;n{const t=St(i=>{var a,o;return(o=(a=i==null?void 0:i.serverState)==null?void 0:a.config)==null?void 0:o.allow_anonymous_telemetry}),[n,r]=ut.useState(void 0);return C.useEffect(()=>{t?(Jd.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",{api_host:"https://app.posthog.com",disable_session_recording:!0}),r(n)):r(void 0)},[t]),t?R.jsx($ge,{client:n,children:e}):R.jsx(R.Fragment,{children:e})};tb.createRoot(document.getElementById("root")).render(R.jsx(ut.StrictMode,{children:R.jsx(Sfe,{store:EU,children:R.jsx(vU,{loading:null,persistor:Mbe,children:R.jsx($be,{children:R.jsx(tbe,{})})})})})); +`;function Y4e(){var u,c,p,f,m;const e=oU(),{modelName:t}=Vme(),[n,r]=C.useState(void 0);C.useEffect(()=>{t&&r(uU[t])},[t]);const i=C.useContext(eo);Io();const a=bs(),o=wt(h=>h.config.vscMediaUrl),s=C.useCallback(()=>{var h;return((h=n==null?void 0:n.collectInputFor)==null?void 0:h.some(b=>{if(!b.required)return!1;const y=e.watch(b.key);return typeof y>"u"||typeof y=="string"&&y===""}))||!1},[n,e]);return R.jsx(ZB,{...e,children:R.jsxs("div",{className:"overflow-y-scroll",children:[R.jsxs("div",{className:"items-center flex m-0 p-0 sticky top-0",style:{borderBottom:`0.5px solid ${Et}`,backgroundColor:Vt,zIndex:2},children:[R.jsx(hc,{width:"1.2em",height:"1.2em",onClick:()=>a("/models"),className:"inline-block ml-4 cursor-pointer"}),R.jsx("h3",{className:"text-lg font-bold m-2 inline-block",children:"Configure Model"})]}),R.jsxs("div",{className:"px-2",children:[R.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o&&(n==null?void 0:n.icon)&&R.jsx("img",{src:`${o}/logos/${n==null?void 0:n.icon}`,height:"24px",style:{marginRight:"10px"}}),R.jsx("h2",{children:n==null?void 0:n.title})]}),(u=n==null?void 0:n.tags)==null?void 0:u.map(h=>R.jsx("span",{style:{backgroundColor:`${kc[h]}55`,color:"white",padding:"2px 4px",borderRadius:At,marginRight:"4px"},children:h})),R.jsx(zg,{className:"mt-2",source:(n==null?void 0:n.longDescription)||(n==null?void 0:n.description),maxHeight:200}),R.jsx("br",{}),(((c=n==null?void 0:n.collectInputFor)==null?void 0:c.filter(h=>h.required).length)||0)>0&&R.jsxs(R.Fragment,{children:[R.jsx("h3",{className:"mb-2",children:"Enter required parameters"}),(p=n==null?void 0:n.collectInputFor)==null?void 0:p.filter(h=>h.required).map(h=>R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!0})})]}))]}),(((f=n==null?void 0:n.collectInputFor)==null?void 0:f.filter(h=>!h.required).length)||0)>0&&R.jsxs("details",{children:[R.jsx("summary",{className:"mb-2",children:R.jsx("b",{children:"Advanced (optional)"})}),(m=n==null?void 0:n.collectInputFor)==null?void 0:m.map(h=>h.required?null:R.jsxs("div",{children:[R.jsx("label",{htmlFor:h.key,children:h.key}),R.jsx(Ng,{type:h.inputType,id:h.key,className:"border-2 border-gray-200 rounded-md p-2 m-2",placeholder:h.key,defaultValue:h.defaultValue,min:h.min,max:h.max,step:h.step,...e.register(h.key,{required:!1})})]}))]}),R.jsx("h3",{className:"mb-2",children:"Select a model preset"})]}),R.jsxs(q4e,{children:[n==null?void 0:n.packages.map(h=>R.jsx(cU,{disabled:s(),title:h.title,description:h.description,tags:h.tags,refUrl:h.refUrl,icon:h.icon||n.icon,dimensions:h.dimensions,onClick:(b,y)=>{var E;if(s())return;const T={};for(const v of n.collectInputFor||[])T[v.key]=v.inputType==="text"?e.watch(v.key):parseFloat(e.watch(v.key));i==null||i.addModelForRole("*",n.class,{...h.params,...n.params,...el.merge({},...((E=h.dimensions)==null?void 0:E.map((v,w)=>y!=null&&y[w]?{...v.options[y[w]]}:{}))||[]),...T}),a("/")}})),R.jsx(K4e,{disabled:s(),onClick:h=>{var y;if(!n||s())return;const b={};for(const T of n.collectInputFor||[])b[T.key]=T.inputType==="text"?e.watch(T.key):parseFloat(e.watch(T.key));i==null||i.addModelForRole("*",n.class,{...(y=n.packages[0])==null?void 0:y.params,...n.params,...b}),a("/")},children:R.jsx("h3",{className:"text-center my-2",children:"Configure Model in config.py"})})]})]})})}const bd=window,dU=pf({name:"config",initialState:{apiUrl:bd.serverUrl||"http://localhost:8000",vscMediaUrl:bd.vscMediaUrl||localStorage.getItem("vscMediaUrl")||void 0,workspacePaths:bd.workspacePaths||[],vscMachineId:bd.vscMachineId||void 0,windowId:bd.windowId||void 0},reducers:{setWorkspacePaths:(e,t)=>({...e,workspacePaths:t.payload}),setApiUrl:(e,t)=>({...e,apiUrl:t.payload}),setVscMachineId:(e,t)=>({...e,vscMachineId:t.payload}),setSessionId:(e,t)=>({...e,sessionId:t.payload}),setVscMediaUrl:(e,t)=>(localStorage.setItem("vscMediaUrl",t.payload),{...e,vscMediaUrl:t.payload}),setDataSwitchOn:(e,t)=>({...e,dataSwitchOn:t.payload})}}),{setVscMachineId:RN,setApiUrl:X4e,setWorkspacePaths:Q4e,setSessionId:eye,setVscMediaUrl:tye,setDataSwitchOn:nye}=dU.actions,Z4e=dU.reducer;function J4e(e,t){const n=wt(u=>u.config.apiUrl),r=wt(u=>u.sessionState.active),i=wt(u=>u.sessionState.title),a=wt(u=>u.sessionState.history),[o,s]=C.useState(!1);C.useEffect(()=>{t(Xd(!1)),qa("onLoad",{})},[]),C.useEffect(()=>{(async()=>{if(e&&!o&&!r&&i==="New Session"&&a.filter(u=>!u.hide).length>=2){s(!0);const u=await e.getSessionTitle(a);t(kP(u))}})()},[r,a,i,e,o]),C.useEffect(()=>{e&&(e.onSessionUpdate(u=>{t(b0e(u))}),e.onAddContextItem(u=>{t(CP(u))}),e.onConfigUpdate(u=>{t(LR(u))}),fetch(`${n}/slash_commands`).then(async u=>{const c=await u.json();t(qge(c))}),fetch(`${n}/context_providers`).then(async u=>{const c=await u.json();t(Wge(c))}),e.getConfig().then(u=>{t(LR(u))}))},[e]),C.useEffect(()=>{const u=c=>{switch(c.data.type){case"onLoad":window.windowId=c.data.windowId,window.serverUrl=c.data.serverUrl,window.workspacePaths=c.data.workspacePaths,window.vscMachineId=c.data.vscMachineId,window.vscMediaUrl=c.data.vscMediaUrl,t(X4e(c.data.serverUrl)),t(Q4e(c.data.workspacePaths)),t(RN(c.data.vscMachineId)),t(RN(c.data.vscMachineId));break;case"highlightedCode":t(y0e({rangeInFileWithContents:c.data.rangeInFileWithContents,edit:c.data.edit}));break;case"serverStatus":t(Z0e(c.data.message));break;case"stopSession":e==null||e.stopSession();break}};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[e]),C.useEffect(()=>{document.body.style.getPropertyValue("--vscode-editor-foreground")&&localStorage.setItem("--vscode-editor-foreground",document.body.style.getPropertyValue("--vscode-editor-foreground")),document.body.style.getPropertyValue("--vscode-editor-background")&&localStorage.setItem("--vscode-editor-background",document.body.style.getPropertyValue("--vscode-editor-background")),document.body.style.getPropertyValue("--vscode-list-hoverBackground")&&localStorage.setItem("--vscode-list-hoverBackground",document.body.style.getPropertyValue("--vscode-list-hoverBackground"))},[])}const ebe=l2e([{path:"/",element:R.jsx(d3e,{}),errorElement:R.jsx(o4e,{}),children:[{path:"/index.html",element:R.jsx(XR,{})},{path:"/",element:R.jsx(XR,{})},{path:"/history",element:R.jsx(A2e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/settings",element:R.jsx(O4e,{})},{path:"/models",element:R.jsx(W4e,{})},{path:"/help",element:R.jsx(ZR,{})},{path:"/modelconfig/:modelName",element:R.jsx(Y4e,{})}]}]),eo=C.createContext(void 0);function tbe(){const e=a4e(!1),t=Io();return J4e(e,t),R.jsx(eo.Provider,{value:e,children:R.jsx(r2e,{router:ebe})})}var zT={},HT={};HT.__esModule=!0;HT.default=ibe;function Xh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xh=function(n){return typeof n}:Xh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Xh(e)}function J4(){}var nbe={getItem:J4,setItem:J4,removeItem:J4};function rbe(e){if((typeof self>"u"?"undefined":Xh(self))!=="object"||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch{return!1}return!0}function ibe(e){var t="".concat(e,"Storage");return rbe(t)?self[t]:nbe}zT.__esModule=!0;zT.default=sbe;var abe=obe(HT);function obe(e){return e&&e.__esModule?e:{default:e}}function sbe(e){var t=(0,abe.default)(e);return{getItem:function(r){return new Promise(function(i,a){i(t.getItem(r))})},setItem:function(r,i){return new Promise(function(a,o){a(t.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(t.removeItem(r))})}}}var pU=void 0,lbe=ube(zT);function ube(e){return e&&e.__esModule?e:{default:e}}var cbe=(0,lbe.default)("local");pU=cbe;var jT="persist:",fU="persist/FLUSH",GT="persist/REHYDRATE",hU="persist/PAUSE",gU="persist/PERSIST",mU="persist/PURGE",bU="persist/REGISTER",dbe=-1;function Qh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qh=function(n){return typeof n}:Qh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Qh(e)}function NN(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 pbe(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sbe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}var wbe=5e3;function Abe(e,t){var n=e.version!==void 0?e.version:dbe;e.debug;var r=e.stateReconciler===void 0?hbe:e.stateReconciler,i=e.getStoredState||bbe,a=e.timeout!==void 0?e.timeout:wbe,o=null,s=!1,u=!0,c=function(f){return f._persist.rehydrated&&o&&!u&&o.update(f),f};return function(p,f){var m=p||{},h=m._persist,b=Tbe(m,["_persist"]),y=b;if(f.type===gU){var T=!1,E=function(B,V){T||(f.rehydrate(e.key,B,V),T=!0)};if(a&&setTimeout(function(){!T&&E(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},a),u=!1,o||(o=gbe(e)),h)return Yo({},t(y,f),{_persist:h});if(typeof f.rehydrate!="function"||typeof f.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return f.register(e.key),i(e).then(function(D){var B=e.migrate||function(V,P){return Promise.resolve(V)};B(D,n).then(function(V){E(V)},function(V){E(void 0,V)})},function(D){E(void 0,D)}),Yo({},t(y,f),{_persist:{version:n,rehydrated:!1}})}else{if(f.type===mU)return s=!0,f.result(Ebe(e)),Yo({},t(y,f),{_persist:h});if(f.type===fU)return f.result(o&&o.flush()),Yo({},t(y,f),{_persist:h});if(f.type===hU)u=!0;else if(f.type===GT){if(s)return Yo({},y,{_persist:Yo({},h,{rehydrated:!0})});if(f.key===e.key){var v=t(y,f),w=f.payload,A=r!==!1&&w!==void 0?r(w,p,v,e):v,N=Yo({},A,{_persist:Yo({},h,{rehydrated:!0})});return c(N)}}}if(!h)return t(p,f);var x=t(y,f);return x===y?p:c(Yo({},x,{_persist:h}))}}function DN(e){return kbe(e)||xbe(e)||Cbe()}function Cbe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function xbe(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function kbe(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0&&arguments[0]!==void 0?arguments[0]:yU,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case bU:return fE({},t,{registry:[].concat(DN(t.registry),[n.key])});case GT:var r=t.registry.indexOf(n.key),i=DN(t.registry);return i.splice(r,1),fE({},t,{registry:i,bootstrapped:i.length===0});default:return t}};function Nbe(e,t,n){var r=n||!1,i=sT(Rbe,yU,t&&t.enhancer?t.enhancer:void 0),a=function(c){i.dispatch({type:bU,key:c})},o=function(c,p,f){var m={type:GT,payload:p,err:f,key:c};e.dispatch(m),i.dispatch(m),r&&s.getState().bootstrapped&&(r(),r=!1)},s=fE({},i,{purge:function(){var c=[];return e.dispatch({type:mU,result:function(f){c.push(f)}}),Promise.all(c)},flush:function(){var c=[];return e.dispatch({type:fU,result:function(f){c.push(f)}}),Promise.all(c)},pause:function(){e.dispatch({type:hU})},persist:function(){e.dispatch({type:gU,register:a,rehydrate:o})}});return t&&t.manualPersist||s.persist(),s}const Obe=vP({config:Z4e,misc:J0e,uiState:Y0e,sessionState:v0e,serverState:Kge}),Dbe={key:"root",storage:pU},Lbe=Abe(Dbe,Obe),EU=r0e({reducer:Lbe,middleware:e=>e({serializableCheck:!1})}),Mbe=Nbe(EU);function Zh(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zh=function(n){return typeof n}:Zh=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zh(e)}function Fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MN(e,t){for(var n=0;n{const t=wt(i=>{var a,o;return(o=(a=i==null?void 0:i.serverState)==null?void 0:a.config)==null?void 0:o.allow_anonymous_telemetry}),[n,r]=ut.useState(void 0);return C.useEffect(()=>{t?(Jd.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",{api_host:"https://app.posthog.com",disable_session_recording:!0}),r(n)):r(void 0)},[t]),t?R.jsx($ge,{client:n,children:e}):R.jsx(R.Fragment,{children:e})};tb.createRoot(document.getElementById("root")).render(R.jsx(ut.StrictMode,{children:R.jsx(Sfe,{store:EU,children:R.jsx(vU,{loading:null,persistor:Mbe,children:R.jsx($be,{children:R.jsx(tbe,{})})})})})); diff --git a/gui/src/hooks/useWebsocket.ts b/gui/src/hooks/useWebsocket.ts index 2fd9b9e47..a20835d42 100644 --- a/gui/src/hooks/useWebsocket.ts +++ b/gui/src/hooks/useWebsocket.ts @@ -12,10 +12,8 @@ function useContinueGUIProtocol(useVscodeMessagePassing: boolean = true) { undefined ); - const apiUrl = useSelector((store: RootStore) => store.config.apiUrl); - useEffect(() => { - const serverUrl = apiUrl || (window as any).serverUrl; + const serverUrl = (window as any).serverUrl; const windowId = (window as any).windowId; if (serverUrl === undefined || serverUrl === null) return; if (windowId === undefined || windowId === null) return; @@ -29,7 +27,7 @@ function useContinueGUIProtocol(useVscodeMessagePassing: boolean = true) { newClient.onConnected(() => { setClient(newClient); }); - }, [apiUrl, (window as any).windowId]); + }, [(window as any).windowId]); return client; } diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index 961410b9d..c50d7ad0c 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -159,7 +159,13 @@ function GUI(props: GUIProps) { const [waitingForSteps, setWaitingForSteps] = useState(false); const [stepsOpen, setStepsOpen] = useState<(boolean | undefined)[]>([]); const [waitingForClient, setWaitingForClient] = useState(true); - const [showLoading, setShowLoading] = useState(true); + const [showLoading, setShowLoading] = useState(false); + + useEffect(() => { + setTimeout(() => { + setShowLoading(true); + }, 5000); + }, []); // #endregion @@ -590,7 +596,7 @@ function GUI(props: GUIProps) { - {(takenAction || showLoading) && typeof client === "undefined" && ( + {takenAction && showLoading && typeof client === "undefined" && ( <>