isorite 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/embed-worker.js +9 -4
- package/dist/main.js +4205 -3670
- package/docs/setup-for-agents.md +25 -1
- package/docs/setup.md +23 -1
- package/docs/terminal.md +7 -3
- package/package.json +1 -1
- package/web/_app/immutable/chunks/{BN1DRYj2.js → 8IM6BNk6.js} +1 -1
- package/web/_app/immutable/chunks/{BNCmWi9e.js → BHPhFydX.js} +1 -1
- package/web/_app/immutable/chunks/{BqrPWk6N.js → CFA70_0c.js} +1 -1
- package/web/_app/immutable/chunks/CGgq5NWd.js +1 -0
- package/web/_app/immutable/chunks/{BcrJkegU.js → CHlFgDNB.js} +1 -1
- package/web/_app/immutable/chunks/CMp5T_-1.js +1 -0
- package/web/_app/immutable/chunks/{-XH9wLvF.js → D89YN-Dr.js} +1 -1
- package/web/_app/immutable/chunks/DF3lgcLW.js +1 -0
- package/web/_app/immutable/chunks/DGVcYHaJ.js +43 -0
- package/web/_app/immutable/chunks/{Cr4-_2Vw.js → DmgpLvxp.js} +1 -1
- package/web/_app/immutable/chunks/{D8jeeZa0.js → DrsVvzvg.js} +1 -1
- package/web/_app/immutable/entry/{app.B9MdwZzs.js → app.hlk6OrE8.js} +2 -2
- package/web/_app/immutable/entry/start.BE1F0HZV.js +1 -0
- package/web/_app/immutable/nodes/0.DMGdYhkH.js +15 -0
- package/web/_app/immutable/nodes/{1.hmQ_l8t-.js → 1.Dn_0fgt7.js} +1 -1
- package/web/_app/immutable/nodes/2.Y1Dd5PBI.js +1 -0
- package/web/_app/immutable/nodes/3.BlxuRbLf.js +1 -0
- package/web/_app/immutable/nodes/{4.QUhLgH4i.js → 4.Bt_H0MbN.js} +1 -1
- package/web/_app/immutable/nodes/{5.D3JSWVyR.js → 5.BJ-EVWbz.js} +1 -1
- package/web/_app/immutable/nodes/6.DDIiJnwi.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/index.html +15 -15
- package/web/_app/immutable/chunks/BZeALCyJ.js +0 -1
- package/web/_app/immutable/chunks/BavLcJN1.js +0 -1
- package/web/_app/immutable/chunks/D25FgEb3.js +0 -43
- package/web/_app/immutable/chunks/DsnHcTIO.js +0 -1
- package/web/_app/immutable/entry/start.gtQcHKDR.js +0 -1
- package/web/_app/immutable/nodes/0.DSajjyn5.js +0 -15
- package/web/_app/immutable/nodes/2.Bu6Zvx8F.js +0 -1
- package/web/_app/immutable/nodes/3.DcSG1nNk.js +0 -1
- package/web/_app/immutable/nodes/6.CWfUNDww.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e,I as t,L as n,X as r,Z as i,a,n as o,t as s}from"./Bze-M_kr.js";var c=class{constructor(e,t){this.status=e,this.body=typeof t==`string`?{message:t}:t||{message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}},l=class{constructor(e,t){try{new Headers({location:t})}catch{throw Error(`Invalid redirect location ${JSON.stringify(t)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=t}},u=class extends Error{constructor(e,t,n){super(n),this.status=e,this.text=t}};new URL(`sveltekit-internal://`);function d(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function f(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function p(e){for(let t in e)e[t]=decodeURIComponent(e[t]);return e}function m({href:e}){return e.split(`#`)[0]}function ee(e,t,n,r=!1){let i=new URL(e);Object.defineProperty(i,"searchParams",{value:new Proxy(i.searchParams,{get(e,r){if(r===`get`||r===`getAll`||r===`has`)return(t,...i)=>(n(t),e[r](t,...i));t();let i=Reflect.get(e,r);return typeof i==`function`?i.bind(e):i}}),enumerable:!0,configurable:!0});let a=[`href`,`pathname`,`search`,`toString`,`toJSON`];r&&a.push(`hash`);for(let n of a)Object.defineProperty(i,n,{get(){return t(),e[n]},enumerable:!0,configurable:!0});return i}function h(){}function g(...e){let t=5381;for(let n of e)if(typeof n==`string`){let e=n.length;for(;e;)t=t*33^n.charCodeAt(--e)}else if(ArrayBuffer.isView(n)){let e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r=e.length;for(;r;)t=t*33^e[--r]}else throw TypeError(`value must be a string or TypedArray`);return(t>>>0).toString(36)}new TextEncoder;function _(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var te=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&v.delete(b(e)),te(e,t));var v=new Map;function y(e,t){let n=b(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:e,...t}=JSON.parse(r.textContent);r.getAttribute(`data-b64`)!==null&&(e=_(e));let i=r.getAttribute(`data-ttl`);return i&&v.set(n,{body:e,init:t,ttl:1e3*Number(i)}),Promise.resolve(new Response(e,t))}return window.fetch(e,t)}function ne(e,t,n){if(v.size>0){let t=b(e,n),r=v.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);v.delete(t)}}return window.fetch(t,n)}function b(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=[];t.headers&&e.push([...new Headers(t.headers)].join(`,`)),t.body&&(typeof t.body==`string`||ArrayBuffer.isView(t.body))&&e.push(t.body),n+=`[data-hash="${g(...e)}"]`}return n}var re=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,ie=/^\/\((?:[^)]+)\)$/;function ae(e){let t=[];return{pattern:e===`/`||ie.test(e)?/^\/$/:RegExp(`^${se(e).map(e=>{let n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(e);if(n)return t.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),`(?:/([^]*))?`;let r=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(e);if(r)return t.push({name:r[1],matcher:r[2],optional:!0,rest:!1,chained:!0}),`(?:/([^/]+))?`;if(!e)return;let i=e.split(/\[(.+?)\](?!\])/);return`/`+i.map((e,n)=>{if(n%2){if(e.startsWith(`x+`))return le(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith(`u+`))return le(String.fromCharCode(...e.slice(2).split(`-`).map(e=>parseInt(e,16))));let[,r,a,o,s]=re.exec(e);return t.push({name:o,matcher:s,optional:!!r,rest:!!a,chained:a?n===1&&i[0]===``:!1}),a?`([^]*?)`:r?`([^/]*)?`:`([^/]+?)`}return le(e)}).join(``)}).join(``)}/?$`),params:t}}function oe(e){return e!==``&&!/^\([^)]+\)$/.test(e)}function se(e){return e.slice(1).split(`/`).filter(oe)}function ce(e,t,n){let r={},i=e.slice(1),a=i.filter(e=>e!==void 0),o=0;for(let e=0;e<t.length;e+=1){let s=t[e],c=i[e-o];if(s.chained&&s.rest&&o&&(c=i.slice(e-o,e+1).filter(e=>e).join(`/`),o=0),c===void 0){if(s.rest)c=``;else continue}if(!s.matcher||n[s.matcher](c)){r[s.name]=c;let n=t[e+1],l=i[e+1];n&&!n.rest&&n.optional&&l&&s.chained&&(o=0),!n&&!l&&Object.keys(r).length===a.length&&(o=0)}else if(s.optional&&s.chained)o++;else return}if(!o)return r}function le(e){return e.normalize().replace(/[[\]]/g,`\\$&`).replace(/%/g,`%25`).replace(/\//g,`%2[Ff]`).replace(/\?/g,`%3[Ff]`).replace(/#/g,`%23`).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var ue=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function de(e,t){let n=se(e),r=e!=`/`&&e.endsWith(`/`);return`/`+n.map(n=>n.replace(ue,(n,r,i,a)=>{let o=t[a];if(!o){if(r||i&&o!==void 0)return``;throw Error(`Missing parameter '${a}' in route ${e}`)}if(o.startsWith(`/`)||o.endsWith(`/`))throw Error(`Parameter '${a}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return o})).filter(Boolean).join(`/`)+(r?`/`:``)}function fe({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=ae(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return ce(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function pe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function me(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var x=globalThis.__sveltekit_1pjzsxi?.base??``,he=globalThis.__sveltekit_1pjzsxi?.assets??x??``,ge=`#`;function _e(...e){if(!e[0].startsWith(`/`))throw Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return x+ge+de(e[0],e[1])}var ve=`1792974176523`,ye=`sveltekit:snapshot`,be=`sveltekit:scroll`,xe=`sveltekit:states`,S=`sveltekit:history`,C=`sveltekit:navigation`,w={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Se=location.origin;function Ce(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function T(){return{x:pageXOffset,y:pageYOffset}}function E(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var we={...w,"":w.hover};function Te(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ee(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()===`A`&&e.hasAttribute(`href`))return e;e=Te(e)}}function De(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||D(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===Se&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function Oe(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=E(s,`preload-code`)),i===null&&(i=E(s,`preload-data`)),t===null&&(t=E(s,`keepfocus`)),n===null&&(n=E(s,`noscroll`)),a===null&&(a=E(s,`reload`)),o===null&&(o=E(s,`replacestate`)),s=Te(s);function c(e){switch(e){case``:case`true`:return!0;case`off`:case`false`:return!1;default:return}}return{preload_code:we[r??`off`],preload_data:we[i??`off`],keepfocus:c(t),noscroll:c(n),reload:c(a),replace_state:c(o)}}function ke(e){let t=a(e),n=!0;function r(){n=!0,t.update(e=>e)}function i(e){n=!1,t.set(e)}function o(e){let r;return t.subscribe(t=>{(r===void 0||n&&t!==r)&&e(r=t)})}return{notify:r,set:i,subscribe:o}}var Ae={v:h};function je(){let{set:e,subscribe:t}=a(!1),n;async function r(){clearTimeout(n);try{let t=await fetch(`${he}/_app/version.json`,{headers:{pragma:`no-cache`,"cache-control":`no-cache`}});if(!t.ok)return!1;let r=(await t.json()).version!==ve;return r&&(e(!0),Ae.v(),clearTimeout(n)),r}catch{return!1}}return{subscribe:t,check:r}}function D(e,t,n){return e.origin!==Se||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Me(e){}var Ne=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);[...Ne],[...new Set([...Ne])];function Pe(e){return e.filter(e=>e!=null)}function O(e,t){return e+`/`+t}function Fe(e){return e instanceof c||e instanceof u?e.status:500}function Ie(e){return e instanceof u?e.text:`Internal Error`}var k,A,Le,Re=o.toString().includes(`$$`)||/function \w+\(\) \{\}/.test(o.toString()),ze=`a:`;Re?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},A={current:null},Le={current:!1}):(k=new class{#e=i({});get data(){return e(this.#e)}set data(e){r(this.#e,e)}#t=i(null);get form(){return e(this.#t)}set form(e){r(this.#t,e)}#n=i(null);get error(){return e(this.#n)}set error(e){r(this.#n,e)}#r=i({});get params(){return e(this.#r)}set params(e){r(this.#r,e)}#i=i({id:null});get route(){return e(this.#i)}set route(e){r(this.#i,e)}#a=i({});get state(){return e(this.#a)}set state(e){r(this.#a,e)}#o=i(-1);get status(){return e(this.#o)}set status(e){r(this.#o,e)}#s=i(new URL(ze));get url(){return e(this.#s)}set url(e){r(this.#s,e)}},A=new class{#e=i(null);get current(){return e(this.#e)}set current(e){r(this.#e,e)}},Le=new class{#e=i(!1);get current(){return e(this.#e)}set current(e){r(this.#e,e)}},Ae.v=()=>Le.current=!0);function Be(e){Object.assign(k,e)}var Ve={spanContext(){return He},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},He={traceId:``,spanId:``,traceFlags:0},{onMount:Ue,tick:We}=s,Ge=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),j=null,M=pe(`sveltekit:scroll`)??{},N=pe(`sveltekit:snapshot`)??{},P={url:ke({}),page:ke({}),navigating:a(null),updated:je()};function Ke(e){M[e]=T()}function qe(e,t){let n=e+1;for(;M[n];)delete M[n],n+=1;for(n=t+1;N[n];)delete N[n],n+=1}function F(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(h)}async function Je(){if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(x||`/`);e&&await e.update()}}var Ye,Xe,I,L,Ze,R,Qe={},$e={},z=[],B=[],V=null;function H(){V?.fork?.then(e=>e?.discard()),V=null,Q={element:void 0,href:void 0}}var et=new Map,tt=new Set,nt=new Set,U=new Set,W={branch:[],error:null,url:null,nav:null},rt=!1,it=!1,at=!0,G=!1,K=!1,ot=!1,st=!1,ct,q,J,Y,lt=new Set,ut=new Map,dt=new Map;async function ft(e,t,n){if(globalThis.__sveltekit_1pjzsxi.data){let{q:e={},p:t={},l:n={},f:r={}}=globalThis.__sveltekit_1pjzsxi.data;for(let t in e)Qe[t]=e[t];for(let e in n)Qe[e]=n[e];for(let e in r)Qe[e]=r[e];for(let e in t)$e[e]=t[e]}document.URL!==location.href&&(location.href=location.href),R=e,await e.hooks.init?.(),Ye=fe(e),L=document.documentElement,Ze=t,Xe=e.nodes[0],I=e.nodes[1],Xe(),I(),q=history.state?.[S],J=history.state?.[C],q||(q=J=Date.now(),history.replaceState({...history.state,[S]:q,[C]:J},``));let r=M[q];function i(){r&&(history.scrollRestoration=`manual`,scrollTo(r.x,r.y))}n?(i(),await Bt(Ze,n)):(await Z({type:`enter`,url:Ce(R.hash?Kt(new URL(location.href)):location.href),replace_state:!0}),i()),zt()}function pt(){z.length=0,st=!1}function mt(e){B.some(e=>e?.snapshot)&&(N[e]=B.map(e=>e?.snapshot?.capture()))}function ht(e){N[e]?.forEach((e,t)=>{B[t]?.snapshot?.restore(e)})}function gt(){Ke(q),me(be,M),mt(J),me(ye,N)}async function _t(e,t,r,i){let a,o;t.invalidateAll&&H(),await Z({type:`goto`,url:Ce(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:r,nav_token:i,accept:()=>{if(t.invalidateAll){st=!0,a=new Set;for(let[e,t]of ut)for(let[n,r]of t)r.resource?.reset(),a.add(O(e,n));o=new Set;for(let[e,t]of dt)for(let n of t.keys())o.add(O(e,n))}t.invalidate&&t.invalidate.forEach(Rt)}}),t.invalidateAll&&n().then(n).then(()=>{for(let[e,t]of ut)for(let[n,{resource:r}]of t)a?.has(O(e,n))&&r.start();for(let[e,t]of dt)for(let[n,{resource:r}]of t)o?.has(O(e,n))&&r.reconnect()})}async function vt(e){if(e.id!==V?.id){H();let t={};lt.add(t),V={id:e.id,token:t,promise:Ot({...e,preload:t}).then(e=>(lt.delete(t),e.type===`loaded`&&e.state.error&&H(),e)),fork:null}}return V.promise}async function yt(e){let t=(await X(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(e=>e[1]()))}async function bt(e,t,n){let r={params:W.params,route:{id:W.route?.id??null},url:new URL(location.href)};if(W={...e.state,nav:r},Be(e.props.page),ct=new R.root({target:t,props:{...e.props,stores:P,components:B},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),n){let e={from:null,to:{...r,scroll:M[q]??T()},willUnload:!1,type:`enter`,complete:Promise.resolve()};U.forEach(t=>t(e))}ht(J),it=!0}async function xt({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(x&&(e.pathname===x||e.pathname===x+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=d(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{constructors:Pe(n).map(e=>e.node.component),page:Gt(k)}};s!==void 0&&(l.props.form=s);let u={},f=!k,p=0;for(let e=0;e<Math.max(n.length,W.branch.length);e+=1){let t=n[e],r=W.branch[e];t?.data!==r?.data&&(f=!0),t&&(u={...u,...t.data},f&&(l.props[`data_${p}`]=u),p+=1)}return(!W.url||e.href!==W.url.href||W.error!==a||s!==void 0&&s!==k.form||f)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},status:i,url:new URL(e),form:s??null,data:f?u:k.data}),l}async function St({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o=null,s=!0,c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){function e(...e){for(let t of e){let{href:e}=new URL(t,n);c.dependencies.add(e)}}let u={tracing:{enabled:!1,root:Ve,current:Ve},route:new Proxy(i,{get:(e,t)=>(s&&(c.route=!0),e[t])}),params:new Proxy(r,{get:(e,t)=>(s&&c.params.add(t),e[t])}),data:a?.data??null,url:ee(n,()=>{s&&(c.url=!0)},e=>{s&&c.search_params.add(e)},R.hash),async fetch(t,r){t instanceof Request&&(r={body:t.method===`GET`||t.method===`HEAD`?void 0:await t.blob(),cache:t.cache,credentials:t.credentials,headers:[...t.headers].length>0?t?.headers:void 0,integrity:t.integrity,keepalive:t.keepalive,method:t.method,mode:t.mode,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,signal:t.signal,...r});let{resolved:i,promise:a}=Ct(t,r,n);return s&&e(i.href),a},setHeaders:h,depends:e,parent(){return s&&(c.parent=!0),t()},untrack(e){s=!1;try{return e()}finally{s=!0}}};o=await l.universal.load.call(null,u)??null}return{node:l,loader:e,server:a,universal:l.universal?.load?{type:`data`,data:o,uses:c}:null,data:o??a?.data??null,slash:l.universal?.trailingSlash??a?.slash}}function Ct(e,t,n){let r=e instanceof Request?e.url:e,i=new URL(r,n);return i.origin===n.origin&&(r=i.href.slice(n.origin.length)),{resolved:i,promise:it?ne(r,i.href,t):y(r,t)}}function wt(e,t,n,r,i,a){if(st)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==W.params[e])return!0;for(let e of i.dependencies)if(z.some(t=>t(new URL(e))))return!0;return!1}function Tt(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function Et(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r),a=t.searchParams.getAll(r);i.every(e=>a.includes(e))&&a.every(e=>i.includes(e))&&n.delete(r)}return n}function Dt({error:e,url:t,route:n,params:r}){return{type:`loaded`,state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Gt(k),constructors:[]}}}async function Ot({id:e,invalidating:t,url:n,params:r,route:i,preload:a}){if(V?.id===e)return lt.delete(V.token),V.promise;let{errors:o,layouts:s,leaf:u}=i,d=[...s,u];o.forEach(e=>e?.().catch(h)),d.forEach(e=>e?.[1]().catch(h));let f=W.url?e!==Nt(W.url):!1,p=W.route?i.id!==W.route.id:!1,m=Et(W.url,n),ee=!1,g=d.map(async(e,t)=>{if(!e)return;let a=W.branch[t];return e[1]===a?.loader&&!wt(ee,p,f,m,a.universal?.uses,r)?a:(ee=!0,St({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await g[n])?.data);return e},server_data_node:Tt(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of g)e.catch(h);let _=[];for(let e=0;e<d.length;e+=1)if(d[e])try{_.push(await g[e])}catch(t){if(t instanceof l)return{type:`redirect`,location:t.location};if(a&<.has(a))return Dt({error:await $(t,{params:r,url:n,route:{id:i.id}}),url:n,params:r,route:i});let s=Fe(t),u;if(t instanceof c)u=t.body;else{if(await P.updated.check())return await Je(),await F(n);u=await $(t,{params:r,url:n,route:{id:i.id}})}let d=await kt(e,_,o);return d?xt({url:n,params:r,branch:_.slice(0,d.idx).concat(d.node),errors:o,status:s,error:u,route:i}):await Ft(n,{id:i.id},u,s)}else _.push(void 0);return xt({url:n,params:r,branch:_,errors:o,status:200,error:null,route:i,form:t?void 0:null})}async function kt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)--r;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function At({status:e,error:t,url:n,route:r}){let i={};try{return xt({url:n,params:i,branch:[await St({loader:Xe,url:n,params:i,route:r,parent:()=>Promise.resolve({}),server_data_node:Tt(null)}),{node:await I(),loader:I,universal:null,server:null,data:null}],status:e,error:t,errors:[],route:null})}catch(t){if(t instanceof l){await _t(new URL(t.location,location.href),{},0);return}let a=await R.get_error_template(),o=await $(t,{url:n,params:i,route:r}),s=a({status:e,message:String(o?.message??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}),c=new DOMParser().parseFromString(s,`text/html`);throw document.documentElement.replaceChild(document.adoptNode(c.head),document.head),document.documentElement.replaceChild(document.adoptNode(c.body),document.body),t}}async function jt(e){let t=e.href;if(et.has(t))return et.get(t);let n;try{let r=(async()=>{let t=await R.hooks.reroute({url:new URL(e),fetch:async(t,n)=>Ct(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);R.hash?n.hash=t:n.pathname=t,t=n}return t})();et.set(t,r),n=await r}catch{et.delete(t);return}return n}async function X(e,t){if(e&&!D(e,x,R.hash)){let n=await jt(e);if(!n)return;let r=Mt(n);for(let n of Ye){let i=n.exec(r);if(i)return{id:Nt(e),invalidating:t,route:n,params:p(i),url:e}}}}function Mt(e){return f(R.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(x.length))||`/`}function Nt(e){return(R.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Pt({url:e,type:t,intent:n,delta:r,event:i,scroll:a}){let o=!1,s=Wt(W,n,e,t,a??null);r!==void 0&&(s.navigation.delta=r),i!==void 0&&(s.navigation.event=i);let c={...s.navigation,cancel:()=>{o=!0,s.reject(Error(`navigation cancelled`))}};return G||tt.forEach(e=>e(c)),o?null:s}async function Z({type:e,url:r,popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c={},redirect_count:l=0,nav_token:d={},accept:f=h,block:p=h,event:m}){let ee=Y;Y=d;let g=await X(r,!1),_=e===`enter`?Wt(W,g,r,e):Pt({url:r,type:e,delta:i?.delta,intent:g,scroll:i?.scroll,event:m});if(!_){p(),Y===d&&(Y=ee);return}let te=q,v=J;f(),G=!0,it&&_.navigation.type!==`enter`&&P.navigating.set(A.current=_.navigation);let y=g&&await Ot(g);if(!y){if(D(r,x,R.hash))return await F(r,s);y=await Ft(r,{id:null},await $(new u(404,`Not Found`,`Not found: ${r.pathname}`),{url:r,params:{},route:{id:null}}),404,s)}if(r=g?.url||r,Y!==d){_.reject(Error(`navigation aborted`));return}if(!y)return;if(y.type===`redirect`){if(l<20){await Z({type:e,url:new URL(y.location,r),popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c,redirect_count:l+1,nav_token:d}),_.fulfil(void 0);return}if(y=await At({status:500,error:await $(Error(`Redirect loop`),{url:r,params:{},route:{id:null}}),url:r,route:{id:null}}),!y)return}else if(y.props.page.status>=400&&await P.updated.check())return await Je(),await F(r,s);if(pt(),Ke(te),mt(v),y.props.page.url.pathname!==r.pathname&&(r.pathname=y.props.page.url.pathname),c=i?i.state:c,!i){let e=+!s,t={[S]:q+=e,[C]:J+=e,[xe]:c};(s?history.replaceState:history.pushState).call(history,t,``,r),s||qe(q,J)}let ne=g&&V?.id===g.id?V.fork:null;V?.fork&&!ne?H():(V=null,Q={element:void 0,href:void 0}),y.props.page.state=c;let b;if(it){let e=(await Promise.all(Array.from(nt,e=>e(_.navigation)))).filter(e=>typeof e==`function`);if(e.length>0){function t(){e.forEach(e=>{U.delete(e)})}e.push(t),e.forEach(e=>{U.add(e)})}let n=_.navigation.to;W={...y.state,nav:{params:n.params,route:n.route,url:n.url}},y.props.page&&(y.props.page.url=r),!a&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.blur();let i=ne&&await ne;i?b=i.commit():(j=null,ct.$set(y.props),j&&Object.assign(y.props.page,j),Be(y.props.page),b=t?.()),ot=!0}else await bt(y,Ze,!1);let{activeElement:re}=document;if(await b,await n(),await n(),Y!==d){_.reject(Error(`navigation aborted`));return}y.props.page&&j&&Object.assign(y.props.page,j);let ie=null;if(at){let e=i?i.scroll:o?T():null;e?scrollTo(e.x,e.y):(ie=r.hash&&document.getElementById(qt(r)))?ie.scrollIntoView():scrollTo(0,0)}let ae=document.activeElement!==re&&document.activeElement!==document.body;!a&&!ae&&Ut(r,!ie),at=!0,G=!1,_.fulfil(void 0),_.navigation.to&&(_.navigation.to.scroll=T()),U.forEach(e=>e(_.navigation)),e===`popstate`&&ht(J),P.navigating.set(A.current=null)}async function Ft(e,t,n,r,i){return e.origin===Se&&e.pathname===location.pathname&&!rt?await At({status:r,error:n,url:e,route:t}):await F(e,i)}var Q={element:void 0,href:void 0};function It(){let e,t;L.addEventListener(`mousemove`,t=>{let n=t.target;clearTimeout(e),e=setTimeout(()=>{i(n,w.hover)},20)});function n(e){e.defaultPrevented||i(e.composedPath()[0],w.tap)}L.addEventListener(`mousedown`,n),L.addEventListener(`touchstart`,n,{passive:!0});let r=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(yt(new URL(t.target.href)),r.unobserve(t.target))},{threshold:0});async function i(e,n){let r=Ee(e,L),i=r===Q.element&&r?.href===Q.href&&n>=t;if(!r||i)return;let{url:a,external:o,download:s}=De(r,x,R.hash);if(o||s)return;let c=Oe(r),l=a&&Nt(W.url)===Nt(a);if(!(c.reload||l)){if(n<=c.preload_data){Q={element:r,href:r.href},t=w.tap;let e=await X(a,!1);if(!e)return;vt(e)}else n<=c.preload_code&&(Q={element:r,href:r.href},t=n,yt(a))}}function a(){r.disconnect();for(let e of L.querySelectorAll(`a`)){let{url:t,external:n,download:i}=De(e,x,R.hash);if(n||i)continue;let a=Oe(e);a.reload||(a.preload_code===w.viewport&&r.observe(e),a.preload_code===w.eager&&yt(t))}}U.add(a),a()}function $(e,t){if(e instanceof c)return e.body;let n=Fe(e),r=Ie(e);return R.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Lt(e,t={}){return e=new URL(Ce(e)),e.origin===Se?_t(e,t,0):Promise.reject(Error(`goto: invalid URL`))}function Rt(e){if(typeof e==`function`)z.push(e);else{let{href:t}=new URL(e,location.href);z.push(e=>e.href===t)}}function zt(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(gt(),!G){let e=Wt(W,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};tt.forEach(e=>e(n))}t?(e.preventDefault(),e.returnValue=``):history.scrollRestoration=`auto`}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&>()}),navigator.connection?.saveData||It(),L.addEventListener(`click`,async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=Ee(t.composedPath()[0],L);if(!n)return;let{url:r,external:i,target:a,download:o}=De(n,x,R.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=Oe(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&r.protocol!==`https:`&&r.protocol!==`http:`||o)return;let[c,l]=(R.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===m(location);if(i||s.reload&&(!u||!l))Pt({url:r,type:`link`,event:t})?G=!0:t.preventDefault();else{if(l!==void 0&&u){let[,i]=W.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(K=!0,Ke(q),e(r),!s.replace_state)return;K=!1}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)}),await Z({type:`link`,url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}}),L.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(D(r,x,!1))return;let i=e.target,a=Oe(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),Z({type:`form`,url:r,keepfocus:a.keepfocus,noscroll:a.noscroll,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{if(!Ht){if(t.state?.[`sveltekit:history`]){let n=t.state[S];if(Y={},n===q)return;let r=M[n],i=t.state[`sveltekit:states`]??{},a=new URL(t.state[`sveltekit:pageurl`]??location.href),o=t.state[C],s=W.url?m(location)===m(W.url):!1;if(o===J&&(ot||s)){i!==k.state&&(k.state=i),e(a),M[q]=T(),r&&scrollTo(r.x,r.y),q=n;return}let c=n-q;await Z({type:`popstate`,url:a,popped:{state:i,scroll:r,delta:c},accept:()=>{q=n,J=o},block:()=>{history.go(-c)},nav_token:Y,event:t})}else K||(e(new URL(location.href)),R.hash&&location.reload())}}),addEventListener(`hashchange`,()=>{K&&(K=!1,history.replaceState({...history.state,[S]:++q,[C]:J},``,location.href))});for(let e of document.querySelectorAll(`link`))Ge.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{e.persisted&&P.navigating.set(A.current=null)});function e(e){W.url=k.url=e,P.page.set(Gt(k)),P.page.notify()}}async function Bt(e,{status:t=200,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){rt=!0;let u=new URL(location.href),d;({params:i={},route:a={id:null}}=await X(u,!1)||{}),d=Ye.find(({id:e})=>e===a.id);let f,p=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=Vt(r.uses)),St({loader:R.nodes[t],url:u,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:Tt(r)})}),o=await Promise.all(e);if(d){let e=d.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}f=await xt({url:u,params:i,branch:o,status:t,error:n,errors:d?.errors,form:c,route:d??null})}catch(t){if(t instanceof l)return await F(new URL(t.location,location.href));f=await At({status:Fe(t),error:await $(t,{url:u,params:i,route:a}),url:u,route:a}),e.textContent=``,p=!1}f&&(f.props.page&&(f.props.page.state={}),await bt(f,e,p))}function Vt(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}var Ht=!1;function Ut(e,t=!0){let n=document.querySelector(`[autofocus]`);if(n)n.focus();else{let n=qt(e);if(n&&document.getElementById(n)){let{x:r,y:i}=T();setTimeout(()=>{let a=history.state;Ht=!0,location.replace(new URL(`#${n}`,location.href)),history.replaceState(a,``,e),t&&scrollTo(r,i),Ht=!1})}else{let e=document.body,t=e.getAttribute(`tabindex`);e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}let r=getSelection();if(r&&r.type!==`None`){let e=[];for(let t=0;t<r.rangeCount;t+=1)e.push(r.getRangeAt(t));setTimeout(()=>{if(r.rangeCount===e.length){for(let t=0;t<r.rangeCount;t+=1){let n=e[t],i=r.getRangeAt(t);if(n.commonAncestorContainer!==i.commonAncestorContainer||n.startContainer!==i.startContainer||n.endContainer!==i.endContainer||n.startOffset!==i.startOffset||n.endOffset!==i.endOffset)return}r.removeAllRanges()}})}}}function Wt(e,t,n,r,i=null){let a,o,s=new Promise((e,t)=>{a=e,o=t});return s.catch(h),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:T()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:i},willUnload:!t,type:r,complete:s},fulfil:a,reject:o}}function Gt(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Kt(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function qt(e){let t;if(R.hash){let[,,n]=e.hash.split(`#`,3);t=n??``}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Me as a,k as i,ft as n,_e as o,A as r,Lt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e,X as t,Z as n}from"./Bze-M_kr.js";import{o as r}from"./BZeALCyJ.js";var i=class extends Error{status;current;constructor(e,t,n){super(e),this.status=t,this.current=n}};function a(e=new URL(`api/`,document.baseURI).href){let t=null,n=async(t,n)=>{let r;try{r=await fetch(e+t,n)}catch{throw new i(`isorite is not answering`,0)}let a=await r.json().catch(()=>({}));if(!r.ok)throw new i(a.error??r.statusText,r.status,a.current);return a},r=()=>n(`session`),a=async(e,i,a)=>{t??=r().then(e=>e.token);let o={"Content-Type":`application/json`,"x-isorite-token":await t};return n(i,{method:e,headers:o,body:JSON.stringify(a)})},o=e=>`?id=${encodeURIComponent(e)}`;return{session:async()=>{let{token:e,...n}=await r();return t=Promise.resolve(e),n},notes:()=>n(`notes`),readNote:e=>n(`note`+o(e)),saveNote:(e,t)=>a(`PUT`,`note`+o(e),t),createNote:(e,t)=>a(`POST`,`note`+o(e),{text:t}),journal:e=>n(`journal`+o(e)),version:async(e,t)=>(await n(`version`+o(e)+`&entry=`+encodeURIComponent(t))).text,moveNote:(e,t,n)=>a(`POST`,`note/move`+o(e),{to:t,base:n}),deleteNote:async(e,t)=>{await a(`POST`,`note/delete`+o(e),{base:t})},restore:(e,t,n)=>a(`POST`,`note/restore`+o(e),{entry:t,base:n}),map:()=>n(`map`),timeline:()=>n(`timeline`),search:e=>n(`search?q=${encodeURIComponent(e)}`),ask:e=>a(`POST`,`iso/ask`,e),converse:e=>a(`POST`,`iso/converse`,e),understanding:e=>n(`understanding`+o(e)),saveScratchpad:(e,t,n)=>a(`POST`,`understanding/scratchpad`+o(e),{scratchpad:t,base:n}),undoTurn:(e,t)=>a(`POST`,`iso/undo`,{conversation:e,turn:t}),takeItem:(e,t,n)=>a(`POST`,`iso/take`,{conversation:e,turn:t,item:n}),nameRepository:async()=>!1,brokenNews:async()=>[],answer:async(e,t,n)=>{await a(`POST`,`iso/answer`,{turn:e,permission:t,decision:n})},conversation:async e=>{let t=await n(`conversation`+(e?o(e):``));return t.id?t:null},turnContext:e=>n(`turn/context?turn=${encodeURIComponent(JSON.stringify(e))}`),stop:async e=>{await a(`POST`,`iso/stop`,{request:e})},keep:(e,t,n)=>a(`POST`,`proposal/keep`+o(e),{proposal:t,...n===void 0?{}:{region:n}}),revise:async(e,t,n)=>{await a(`POST`,`proposal/revise`+o(e),{proposal:t,text:n})},discard:async(e,t,n)=>{await a(`POST`,`proposal/discard`+o(e),{proposal:t,...n===void 0?{}:{region:n}})},drafts:()=>n(`drafts`),createDraft:()=>a(`POST`,`drafts`,{}),keepDraft:(e,t,n)=>a(`POST`,`draft/keep`+o(e),{proposal:t,folder:n}),discardDraft:async e=>{await a(`POST`,`draft/discard`+o(e),{})},setDone:(e,t,n)=>a(`POST`,`note/done`+o(e),{done:t,base:n}),context:(e,t)=>n(`context`+(e?o(e):``)+(t?`${e?`&`:`?`}choice=${encodeURIComponent(JSON.stringify(t))}`:``)),clearConversation:async()=>{await a(`POST`,`context/clear`,{})},settings:()=>n(`settings`),setKey:e=>a(`PUT`,`settings/key`,{key:e}),spend:()=>n(`spend`),setSpendCap:e=>a(`PUT`,`settings/spend-cap`,{usd:e}),connect:e=>a(`POST`,`settings/connect`,{callback:e}),connected:(e,t)=>a(`POST`,`settings/connected`,{code:e,state:t}),agentTools:()=>n(`agent/tools`),agentLook:e=>a(`POST`,`agent/look`,e),agentWrite:e=>a(`POST`,`agent/write`,e),agentSend:e=>a(`POST`,`agent/send`,e),agentReceived:async(e,t)=>{await a(`POST`,`agent/received`,{id:e,agent:t})},agentStatus:async(e,t,n)=>{await a(`POST`,`agent/status`,{agent:e,session:t,busy:n})},terminal:{view:()=>n(`terminal`),prompt:async(e,t)=>{await a(`POST`,`terminal/prompt`,{asked:e,given:t})},stop:async()=>{await a(`POST`,`terminal/stop`,{})},reply:async(e,t)=>{await a(`POST`,`terminal/permission`,{id:e,decision:t})}},events(t){let n=new EventSource(e+`events`),r=e=>{try{t(JSON.parse(e.data))}catch{}};for(let e of[`note-changed`,`journal`,`record`,`iso-start`,`iso-step`,`iso-text`,`iso-item`,`iso-answer`,`iso-taken`,`iso-done`,`iso-stopped`,`iso-failed`,`agent-start`,`agent-step`,`agent-done`,`agent-sent`,`agent-received`,`terminal`])n.addEventListener(e,r);return()=>n.close()}}}var o=class{api;#e=n(null);get session(){return e(this.#e)}set session(e){t(this.#e,e)}#t=n({notes:[],dirs:[]});get listing(){return e(this.#t)}set listing(e){t(this.#t,e)}#n=n(``);get error(){return e(this.#n)}set error(e){t(this.#n,e,!0)}#r=n(``);get open(){return e(this.#r)}set open(e){t(this.#r,e,!0)}#i=n(``);get here(){return e(this.#i)}set here(e){t(this.#i,e,!0)}#a=n(null);get saving(){return e(this.#a)}set saving(e){t(this.#a,e,!0)}#o=n(null);get atlas(){return e(this.#o)}set atlas(e){t(this.#o,e)}#s=n(null);get signIn(){return e(this.#s)}set signIn(e){t(this.#s,e)}#c=n(null);get iso(){return e(this.#c)}set iso(e){t(this.#c,e)}watching=``;listeners=new Set;relist=null;async load(e=a()){this.api=e;try{[this.session,this.listing]=await Promise.all([e.session(),e.notes()])}catch(e){this.error=e.message;return}await this.signedIn(),e.events(e=>{this.follow(e);for(let t of this.listeners)t(e);e.type===`note-changed`&&(this.relist&&clearTimeout(this.relist),this.relist=setTimeout(()=>{this.refresh()},300))})}async startSignIn(){let{url:e}=await this.api.connect(location.origin+location.pathname);try{sessionStorage.setItem(s,location.hash)}catch{}location.assign(e)}async signedIn(){let e=new URLSearchParams(location.search),t,n;try{if(e.has(`code`)||e.has(`state`)||e.has(`error`)){let t=sessionStorage.getItem(s)??location.hash;return sessionStorage.removeItem(s),sessionStorage.setItem(c,JSON.stringify({code:e.get(`code`),state:e.get(`state`)})),location.replace(location.pathname+t),new Promise(()=>void 0)}let r=sessionStorage.getItem(c);if(r===null)return;sessionStorage.removeItem(c),{code:t,state:n}=JSON.parse(r)}catch{if({code:t,state:n}={code:e.get(`code`),state:e.get(`state`)},!t&&!n)return}if(!t||!n)this.signIn={ok:!1,message:`No key was made: the sign-in was left or refused.`};else try{let e=await this.api.connected(t,n);this.signIn={ok:!0,message:`Signed in at ${e.provider}: a key was made for isorite, and is held on this device.`}}catch(e){this.signIn={ok:!1,message:e.message}}}async refresh(){try{this.listing=await this.api.notes()}catch{}}follow(e){if(e.type===`iso-start`){this.iso={request:e.request,note:e.note,agent:null,state:`reading`,steps:[],message:``,start:e,text:``};return}if((e.type===`agent-start`||e.type===`agent-step`)&&this.iso?.request!==e.request){if(this.iso&&!this.iso.agent&&(this.iso.state===`reading`||this.iso.state===`writing`))return;this.iso={request:e.request,note:``,agent:e.agent,state:`reading`,steps:[],message:``}}let t=this.iso;t&&`request`in e&&e.request===t.request&&(e.type===`iso-step`||e.type===`agent-step`?this.iso={...t,state:`reading`,steps:[...t.steps,e.step]}:e.type===`iso-text`?this.iso={...t,state:`writing`,text:e.again?e.delta:(t.text??``)+e.delta}:e.type===`iso-done`||e.type===`agent-done`?this.iso={...t,state:`done`}:e.type===`iso-stopped`?this.iso={...t,state:`stopped`}:e.type===`iso-failed`&&(this.iso={...t,state:`failed`,message:e.message}))}on(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}},s=`isorite.sign-in.back`,c=`isorite.sign-in.code`,l=new o,u=e=>r(`/n/[...id]`,{id:e});function d(e){return e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function f(e){let t=e.trim().replace(/^\/+/,``).replace(/\.md$/,``),n=t.includes(`/`)?l.listing.notes.filter(e=>e.id===t):l.listing.notes.filter(e=>e.id.split(`/`).at(-1)===t),r=n.length===1?n[0]:null;return r?{id:r.id,title:r.title,kind:r.kind??`note`,done:!!r.done}:null}export{i as a,d as i,f as n,u as r,l as t};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,D as r,F as i,G as a,J as o,K as s,M as c,N as l,O as u,S as d,T as f,X as p,Y as m,Z as h,b as g,ct as _,f as ee,it as v,j as te,k as y,n as b,p as x,q as S,rt as ne,s as re,st as ie,u as ae,y as oe}from"./Bze-M_kr.js";import{t as se}from"./BZeALCyJ.js";import"./xihTtKlq.js";import{t as C}from"./BavLcJN1.js";import{i as w}from"./BN1DRYj2.js";import{i as T}from"./BcrJkegU.js";import{t as E}from"./DsnHcTIO.js";async function ce(){let{notes:e}=await C.api.notes(),t=await Promise.all(e.map(async e=>[e.id,(await C.api.readNote(e.id)).text]));return new Map(t)}async function le(e){let t=await ce(),n=[...e.keys()].filter(e=>!t.has(e));for(let[r,i]of t){if(e.has(r))continue;let t=n.find(t=>e.get(t)===i),{version:a}=await C.api.readNote(r);t?(await C.api.moveNote(r,t,a),n.splice(n.indexOf(t),1)):await C.api.deleteNote(r,a)}for(let t of n)await C.api.createNote(t,e.get(t));for(let[t,r]of e){if(n.includes(t))continue;let e=await C.api.readNote(t);e.text!==r&&await C.api.saveNote(t,{base:e.version,text:r})}await C.refresh()}var D={type:`string`};({...D}),{...D},{...D},{...D},{...D};var O={type:`string`};({...O}),{...O},{...O},{...O},{...O},{...O},{...O},{...O},{...O},{...O},{...O},{...O},{...O};var ue=`The change is written at once, under your name: the person sees your words marked in the note, and can undo it from the browser. Use this, never edit or write, for any note of the knowledge base.`;`${ue}`,`${ue}`;var k={insert:`how is a body inserted, and what does each node keep?`,rewrite:`answer my TODO`,speed:`how much faster is Barnes–Hut at N = 5000?`,octree:`How does the quadtree become an octree for 3D, and what changes in Barnes–Hut?`,close:`What goes wrong when two bodies pass close?`,octreeWrite:`write a note in algorithms on the octree: how the quadtree becomes one for 3D, and what changes in Barnes–Hut`,understand:`help me see why leapfrog's energy error stays bounded`,answer:`run backwards with −Δt, it retraces its steps`},A=`physics`,j=`integrators`,M=`algorithms`,N=`simulation`,P=(e,t)=>`${e}/${t}`,F=P(A,`newtons-law-of-gravitation`);P(A,`the-n-body-problem`);var I=P(A,`units`),L=P(A,`energy-conservation`),R=P(A,`softening`),z=P(j,`eulers-method`),B=P(j,`leapfrog`),de=P(j,`symplectic-integrators`),fe=P(j,`choosing-the-timestep`),pe=P(M,`direct-summation`),me=P(M,`centre-of-mass`),V=P(M,`the-quadtree`),H=P(M,`barnes-hut`),he=P(M,`cost-and-accuracy`),ge=P(N,`the-main-loop`);P(N,`initial-conditions`);var _e=P(N,`diagnostics`),U=P(N,`two-galaxies-colliding`),ve=`$F = G m_1 m_2 / d^2 = 1 \\cdot \\tfrac12 \\cdot \\tfrac12 / 1 = \\tfrac14$.
|
|
2
|
-
|
|
3
|
-
Each accelerates at $a = F/m = \\tfrac14 / \\tfrac12$.
|
|
4
|
-
|
|
5
|
-
So each accelerates at $\\tfrac12$, towards the other.`,ye=`$K = \\tfrac12 \\cdot \\tfrac12 \\cdot (\\tfrac12)^2 = \\tfrac1{16}$.
|
|
6
|
-
|
|
7
|
-
$U = -G m_1 m_2 / d = -\\tfrac14$.
|
|
8
|
-
|
|
9
|
-
So $E = \\tfrac1{16} - \\tfrac14 = -\\tfrac3{16}$.`,be=`$K = 2 \\times \\tfrac12 \\cdot \\tfrac12 \\cdot (\\tfrac12)^2 = \\tfrac18$, both bodies moving.
|
|
10
|
-
|
|
11
|
-
$U = -G m_1 m_2 / d = -\\tfrac14$.
|
|
12
|
-
|
|
13
|
-
So $E = \\tfrac18 - \\tfrac14 = -\\tfrac18$.`,xe=`After the step, $\\mathbf{r}' = \\mathbf{R} + \\mathbf{v}\\,\\Delta t$.
|
|
14
|
-
|
|
15
|
-
So $|\\mathbf{r}'| = R + v\\,\\Delta t$.`,Se=`After the step, $\\mathbf{r}' = \\mathbf{R} + \\mathbf{v}\\,\\Delta t$, with $\\mathbf{v}$ at right angles to $\\mathbf{R}$.
|
|
16
|
-
|
|
17
|
-
So $|\\mathbf{r}'|^2 = R^2 + v^2 \\Delta t^2$.
|
|
18
|
-
|
|
19
|
-
So $|\\mathbf{r}'| \\approx R\\,(1 + v^2 \\Delta t^2 / 2R^2)$: larger, every step, whatever the sign of $\\Delta t$.`,Ce=`Kick: $\\mathbf{v} \\mathrel{+}= \\Delta t\\, \\mathbf{a}$.
|
|
20
|
-
|
|
21
|
-
Drift: $\\mathbf{r} \\mathrel{+}= \\Delta t\\, \\mathbf{v}$.
|
|
22
|
-
|
|
23
|
-
Kick: $\\mathbf{v} \\mathrel{+}= \\Delta t\\, \\mathbf{a}$, with the new $\\mathbf{a}$.`,we=`Kick: $\\mathbf{v} \\mathrel{+}= \\tfrac12 \\Delta t\\, \\mathbf{a}$.
|
|
24
|
-
|
|
25
|
-
Drift: $\\mathbf{r} \\mathrel{+}= \\Delta t\\, \\mathbf{v}$.
|
|
26
|
-
|
|
27
|
-
Kick: $\\mathbf{v} \\mathrel{+}= \\tfrac12 \\Delta t\\, \\mathbf{a}$, with the new $\\mathbf{a}$: two half kicks make one whole.`,W=`Leapfrog keeps a nearby energy $\\tilde H = H + O(\\Delta t^2)$ exactly.
|
|
28
|
-
|
|
29
|
-
So $H$ can only wobble around $\\tilde H$, never drift.
|
|
30
|
-
|
|
31
|
-
RK4 keeps no such quantity, so its small errors add up.`,Te=`$M = 1 + 2 + 1 = 4$.
|
|
32
|
-
|
|
33
|
-
$\\mathbf{R} = (1 \\cdot (0,0) + 2 \\cdot (3,0) + 1 \\cdot (0,4)) / 4 = (6, 4)/4$.
|
|
34
|
-
|
|
35
|
-
So $\\mathbf{R} = (1.5, 1)$, with $M = 4$.`,Ee=`The drift falls as $\\Delta t^2$; at $T/100$ it is a few parts in a million.
|
|
36
|
-
|
|
37
|
-
So $\\Delta t = 2\\pi/100 \\approx 0.06$ is enough.
|
|
38
|
-
|
|
39
|
-
Check: record $E$ every 100 steps and plot the drift; halve $\\Delta t$ and it should fall by four.`,De=[{folder:A,name:`the-pull-between-two-bodies`,title:`The pull between two bodies`,uses:[F,I],made:20,question:`In units with $G = 1$, two bodies of mass $\\tfrac12$ are 1 apart. How fast does each accelerate, and which way?`,attempts:[20,17,12,5,2].map(e=>({day:e,working:ve}))},{folder:A,name:`the-energy-of-the-orbit`,title:`The energy of the two-body orbit`,uses:[L,F],made:16,question:`For the two-body orbit of the notes (masses $\\tfrac12$, 1 apart, each moving at $\\tfrac12$), find $K$, $U$ and $E$.`,attempts:[{day:16,working:ye},{day:14,working:be},{day:9,working:be},{day:3,working:be}]},{folder:j,name:`why-eulers-orbit-spirals-out`,title:`Why Euler's orbit spirals out`,uses:[z,L],made:15,question:`A body on a circular orbit of radius $R$ takes one Euler step. Show that its distance from the centre grows, and by how much, to leading order in $\\Delta t$.`,attempts:[{day:15,working:xe},{day:13,working:Se},{day:6,working:Se},{day:3,working:Se}]},{folder:j,name:`one-leapfrog-step`,title:`One leapfrog step`,uses:[B],made:12,question:`Write one leapfrog step as kick, drift and kick, and say how many times the accelerations are computed.`,attempts:[{day:12,working:Ce},{day:8,working:we},{day:3,working:we}]},{folder:j,name:`why-leapfrog-does-not-drift`,title:`Why leapfrog does not drift`,uses:[de,B],made:10,question:`RK4 is more accurate than leapfrog over one step. Why, then, does its energy drift over a long run while leapfrog's does not?`,attempts:[{day:10,working:W},{day:1,working:W}]},{folder:M,name:`the-centre-of-mass-of-a-node`,title:`The centre of mass of a node`,uses:[me],made:6,question:`A node holds bodies of mass 1 at $(0,0)$, 2 at $(3,0)$ and 1 at $(0,4)$. What is its total mass, and where is its centre of mass?`,attempts:[6,4,2,1].map(e=>({day:e,working:Te}))},{folder:M,name:`the-cost-of-direct-summation`,title:`The cost of direct summation`,uses:[pe],made:1,question:`Using Newton's third law, how many pairs does direct summation compute each step for $N$ bodies? At 20 ns a pair, how long is a step at $N = 2000$?`,attempts:[],unsent:`Each body feels the other $N - 1$.
|
|
40
|
-
|
|
41
|
-
So there are $N(N-1)$ pairs: $2000 \\times 1999 \\approx 4 \\times 10^6$.
|
|
42
|
-
|
|
43
|
-
At 20 ns a pair, a step takes 0.08 s.`},{folder:N,name:`a-timestep-for-the-orbit`,title:`A timestep for the orbit`,uses:[fe,_e],made:11,question:`For the two-body orbit (period $2\\pi$), choose $\\Delta t$ for leapfrog so that the energy drift stays below $10^{-5}$, and say how you would check it.`,attempts:[11,7].map(e=>({day:e,working:Ee}))}],G=`surfaces`,K=`curvature`,q=`global`,J=(e,t)=>`${e}/${t}`;J(G,`regular-surfaces`),J(G,`first-ff`),J(G,`second-ff`),J(G,`orientable`),J(K,`gaussian-curvature`),J(K,`egregium`),J(K,`gauss-equation`),J(K,`geodesic-curvature`),J(q,`euler`);var Y=J(q,`gauss-bonnet`);J(q,`triangulations`);var Oe=J(q,`where-is-compactness-used`);J(G,`why-ii-changes-sign`),J(K,`derivatives-when-f-is-zero`),J(q,`kg-at-the-corners`);var ke=J(q,`total-curvature-of-the-torus`),Ae=J(q,`angles-of-a-geodesic-triangle`);J(q,`gauss-bonnet-and-the-mobius-band`),J(K,`curvature-of-a-sphere`),J(K,`curvature-of-the-saddle`),J(K,`the-cylinder-and-the-plane`),J(K,`k-from-e-and-g-alone`),J(K,`catenoid-and-helicoid`),J(q,`chi-of-a-surface-of-genus-g`),`${Y}${ke}${Y}${Oe}${Ae}`;var je={back:`where is compactness used in the proof?`,remark:`put my answers on compactness together as a remark for the note`},Me=18+De.length,Ne=new Map,Pe=0,Fe=(e,t)=>n=>n.type===`iso-start`&&n.place.form===`turn`&&n.place.mode===e&&t.test(n.asked.toLowerCase()),Ie=(e,t,n=()=>!0)=>r=>{if(r.type!==`iso-done`)return!1;let i=Ne.get(r.request);return!!i&&i.mode===e&&t.test(i.asked.toLowerCase())&&n(i)},Le=e=>t=>t.type===`iso-done`&&e.test(Ne.get(t.request)?.asked.toLowerCase()??``),Re=0,ze=e=>()=>decodeURIComponent(location.hash).startsWith(e),Be=e=>()=>document.querySelector(e)!==null,Ve=e=>()=>document.querySelector(`[data-note="${e}"]`)?.classList.contains(`at`)??!1,He=e=>C.listing.notes.find(t=>e.test(t.title)),X=new Map,Ue=new Map;function We(e){C.api.readNote(e).then(t=>{X.set(e,t.text),Ue.has(e)||Ue.set(e,t.text)},()=>X.delete(e))}var Z=e=>(X.has(e)||(X.set(e,``),We(e)),X.get(e)??``),Ge=e=>(Z(e),Ue.get(e)??``),Ke=!1;function qe(){!Ke&&C.api&&(Ke=!0,C.on(e=>{e.type===`note-changed`&&X.has(e.id)&&We(e.id),e.type===`iso-start`&&e.place.form===`turn`&&Ne.set(e.request,{mode:e.place.mode,asked:e.asked,understanding:e.place.given.some(e=>e.kind===`understanding`)}),e.type===`iso-item`&&e.item.kind===`undone`&&Pe++,Ie(`write`,/todo/)(e)&&Re++}))}var Je=(e,t)=>(qe(),e.match(t)?.length??0),Ye=(e,t)=>Je(e,RegExp(`\\]\\(/${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}\\.md`,`g`)),Xe=()=>C.atlas?.chosenId?[...document.querySelectorAll(`.atlas`)]:[],Ze=!1,Qe=``,$e=0,et=()=>T.layoutChanges>$e&&T.layout===Qe;function tt(e){let t=!1,n=0;return()=>{let r=document.querySelector(`[data-folder="${e}"]`)?.getBoundingClientRect(),i=document.querySelector(`.atlas`)?.getBoundingClientRect();if(!r||!i?.width)return!1;let a=Math.max(r.width/i.width,r.height/i.height);return n||=a,(C.atlas?.here===e||a>Math.max(.5,n*1.6))&&(t=!0),t&&C.atlas?.here!==e&&a<n*1.3}}var Q=`[data-pane="iso"]`,nt=new Set;function rt(){if(qe(),!nt.size)for(let e of C.listing.notes)nt.add(e.id);Qe=T.layout,$e=T.layoutChanges}var it=()=>C.listing.notes.filter(e=>nt.size&&!nt.has(e.id)),at=[{key:`L1`,title:`The isorite knowledge base`,about:`Understand the basics of an isorite knowledge base in its three panes: the note, the Atlas, and Iso. Edit Markdown, link notes, and see the links on the Atlas.`,steps:[{go:`/atlas`,target:`[data-pane="note"] [data-settings="note"], [role="dialog"][aria-label="Note settings"]`,check:et,title:`Three panes`,text:`The Note pane is for thinking and writing, the Atlas for connecting, Iso for building and talking. The layouts are in the Note pane's settings, at the right of its header: try another, then come back to this one.`,phone:{go:`/notes`,target:`nav[aria-label="Panes"]`,check:()=>T.focus===`atlas`,text:`The Note pane is for thinking and writing, the Atlas for connecting, Iso for building and talking. On a phone they are the tabs at the foot: tap Atlas.`}},{go:`/atlas`,target:`[data-folder="integrators"]`,check:tt(`integrators`),title:`This is the Atlas`,text:`Each block is a note, each bubble a folder, each line a link. Step into integrators: click inside it, or scroll in. Then click open ground to step out.`,phone:{text:`Each block is a note, each bubble a folder, each line a link. Tap inside integrators to step in, then ↑ out at the top.`}},{go:`/atlas`,target:`[data-note="${B}"]`,check:Ve(B),title:`What a note rests on`,wrong:()=>C.atlas?.chosenId&&C.atlas.chosenId!==B?`That is ${C.atlas.chosen}. Choose Leapfrog, in integrators.`:null,text:`Click Leapfrog. What it requires, and what builds on it, light up.`,phone:{text:`Tap Leapfrog. What it requires, and what builds on it, light up.`}},{target:Xe,check:ze(`#/n/${B}`),title:`Open it`,text:`Click Leapfrog again. It opens in the Note pane.`,phone:{text:`Tap Leapfrog again. It opens in the Note pane, and the Note tab comes forward.`}},{go:`/n/${B}`,target:`[data-pane="note"] .cm-content`,check:()=>Je(Z(B),/\*\*[^*\n]+\*\*/g)>Je(Ge(B),/\*\*[^*\n]+\*\*/g),title:`A note is Markdown`,text:`Select a word and press Ctrl+B. Changes save as you type: the dot in the Note pane's header says so.`,phone:{text:`Make a word bold: type ** on each side of it. Changes save as you type.`}},{target:`[data-pane="note"] .cm-content`,check:()=>Ye(Z(B),L)>Ye(Ge(B),L),title:`Link a note`,text:`At the end of the last paragraph, type [[ener and choose Energy and its conservation.`},{target:()=>[...Xe(),...document.querySelectorAll(`path.grown`)],title:`The link, on the Atlas`,text:`Watch the Atlas: the new link is drawn from Leapfrog to Energy and its conservation.`,phone:{go:`/atlas`,target:`[data-note="${L}"]`,text:`On the Atlas, the new link runs from Leapfrog to Energy and its conservation.`}},{go:`/n/${B}`,target:`[data-pane="note"] .cm-content`,check:()=>/\]\(\/physics\/energy-conservation\.md "requires"\)/.test(Z(B)),title:`Its kind`,text:`Click in the new link, press Alt+L, and choose Requires.`,phone:{text:`Tap the button beside the new link and choose Requires.`}},{target:Xe,title:`The kind, on the Atlas`,text:`On the Atlas, requires is drawn strongest.`,phone:{go:`/atlas`,target:`[data-note="${L}"]`,text:`On the Atlas, requires is drawn strongest.`}},{go:`/n/${B}`,target:()=>[...document.querySelectorAll(`[data-pane="note"] .sw[data-switch="timeline"], .timeline, .atbar`)],check:()=>(Be(`.atbar`)()&&(Ze=!0),Ze&&!Be(`.atbar`)()),title:`Every change is kept`,text:`Switch on the timeline in the Note pane's header, then click its first mark: the note as it was. The → at the right of the bar brings you back.`,phone:{text:`Switch on the timeline in the Note pane's header, then tap its first mark: the note as it was. The → at the right of the bar brings you back.`}},{go:`/n/${B}`,target:`[data-pane="note"] .cm-content`,check:ze(`#/n/${L}`),title:`Follow the link`,wrong:()=>{let e=decodeURIComponent(location.hash).match(/^#\/n\/([^?]+)/)?.[1];return e&&e!==B&&e!==L?`That is another note. Go back, and follow the link to Energy and its conservation.`:null},text:`Ctrl+click (⌘ on a Mac) the link to Energy and its conservation.`,phone:{go:`/atlas`,target:`[data-note="${L}"]`,text:`Tap Energy and its conservation on the Atlas, then tap it again.`}},{go:`/n/${L}`,target:`[data-pane="note"] button[aria-label="All notes"], [data-pane="note"] .tree`,check:ze(`#/n/${R}`),title:`All the notes`,text:`The icon by the settings, in the Note pane's header, opens every note. Type soft to find Softening, and open it.`},{go:`/n/${R}`,target:()=>[...document.querySelectorAll(`[data-pane="note"] .tools, [data-pane="note"] .details`)],check:()=>/^tags:/m.test(Z(R))&&!/^tags:/m.test(Ge(R)),title:`Its details`,text:`Open details above the text and add a tag, say numerics.`},{go:`/atlas`,target:`[data-folder="physics"]`,check:()=>He(/^plummer sphere$/i)?.dir===`physics`,wrong:()=>{let e=He(/^plummer sphere$/i);return e&&e.dir!==`physics`?`It went into ${e.dir||`the top of the base`}. Redo, and hold inside physics.`:null},title:`A new note, where you hold`,text:`On the Atlas, press and hold inside physics until a note's icon is marked, and let go. An untitled note opens with its title chosen: type Plummer sphere, and press Enter.`},{target:()=>[...document.querySelectorAll(`[data-pane="note"] .details, [data-pane="note"] .tools`)],check:()=>it().length>0&&it().every(e=>e.dir===`galaxies`),title:`Move it`,wrong:()=>{let e=it().find(e=>e.dir!==`physics`&&e.dir!==`galaxies`);return e?`It went into ${e.dir||`the top of the base`}. Type galaxies: a new folder is made for it.`:null},text:`In details, change its folder to galaxies, a folder the base does not have yet: it is made for the note.`},{target:()=>[...document.querySelectorAll(`[data-pane="note"] .details, [data-pane="note"] .tools`)],check:()=>nt.size>0&&it().length===0&&C.listing.notes.length===Me,title:`Delete it`,text:`In details, click delete, then confirm.`},{title:`That is the base`,text:`The base is a folder of Markdown files: any editor opens them. Next, Iso, in L2.`}]},{key:`L2`,title:`Iso`,about:`Iso is an agent who knows your knowledge base. Talk with it in its own pane: ask, give it notes and passages, and let it write, with every change marked and undoable.`,steps:[{go:`/n/${V}`,target:`${Q}`,fill:k.insert,until:Fe(`ask`,/inserted/),title:`Ask Iso`,text:`Iso has a pane of its own. With the quill in its header off, it reads your notes and changes nothing. Your question from the quadtree is written in its box: press Enter.`,phone:{text:`Iso has a pane of its own: tap its tab. With the quill in its header off, it reads your notes and changes nothing. Your question from the quadtree is written in its box: send it with the arrow.`}},{target:()=>[...document.querySelectorAll(`[data-pane="atlas"] .sw[data-switch="context"], ${Q}`)],until:Ie(`ask`,/inserted/),title:`Watch it read`,text:`Switch on Iso's context, the diamond in the Atlas's header: what Iso reads is numbered on the map in order, as it reads it. In Iso's pane, each note it read opens with a click.`,phone:{target:Q,text:`Each note Iso reads is said in its pane as it reads it. On the Atlas, with the diamond in its header on, what it read is numbered in order.`}},{go:`/n/${V}`,target:()=>[...document.querySelectorAll(`[data-note="${H}"], [data-pane="note"] .cm-content`)],check:()=>w.parts.some(e=>e.kind===`note`&&e.id===H)&&w.parts.some(e=>e.kind===`passage`&&e.id===V),title:`Give Iso a note, and a passage`,text:`Iso answers from what it finds. To give it what you mean: hold Barnes–Hut on the Atlas (or drag it onto Iso's pane). Then select a sentence of the quadtree, and click send to Iso beside it.`,phone:{text:`Iso answers from what it finds. To give it what you mean: on the Atlas, hold Barnes–Hut and choose Give to Iso. Then select a sentence of the quadtree, and tap send to Iso under it.`}},{target:`${Q} .ctx, ${Q} .context`,check:()=>E.view===`context`&&E.off.length>0&&!w.parts.some(e=>e.kind===`passage`),title:`What Iso is sent`,text:`The icon in Iso's header counts what you gave: click it. Here is what Iso is sent, part by part, each with its size. Switch off your first question, and take the sentence out with its ×.`},{go:`/n/${H}`,target:()=>[...document.querySelectorAll(`${Q} .sw[data-switch="notes"], #iso-box`)],fill:k.rewrite,until:Ie(`write`,/todo/),title:`Let it write`,text:`Click the Context icon again for the conversation. Switch on the quill in Iso's header: Iso may change your notes. Barnes–Hut is open, with its TODO; the request is written for you: send it.`},{target:()=>[...document.querySelectorAll(`[data-pane="note"] .sw[data-switch="provenance"], [data-pane="note"] .cm-content`)],title:`Its words, marked`,text:`The change went straight into the note. Switch on provenance, the half-filled square in the Note pane's header: Iso's words are marked.`},{target:()=>[...document.querySelectorAll(`${Q} button[aria-label="Undo this turn's changes"], [data-pane="note"] .cm-content`)],check:()=>Pe>0&&Re>=2&&!/TODO:/.test(Z(H)),title:`Undo, and again`,text:`Under Iso's reply, ↺ puts back everything the turn changed: the TODO is back. Then send the request again, and leave the answer this time.`},{title:`Iso, in short`,text:`With the quill off Iso reads; on, it writes, and every change it makes is marked and can be undone. What it is sent is yours to choose. Next: L3, questions and problems.`}]},{key:`E1`,title:`Knowledge work with isorite`,earlier:!0,about:`isorite provides a home for structured project knowledge work. This walkthrough shows how isorite can be used in an example knowledge base on an N-body simulation.`,steps:[{go:`/n/${U}`,target:`[data-pane="note"] .cm-content`,title:`The goal`,text:`Two galaxies colliding, at N = 5000: where the tidal tails start to look right, and where direct summation is too slow. This evening's work is to get there with Barnes–Hut.`},{go:`/atlas`,target:`[data-note="${U}"]`,check:Ve(U),title:`What it rests on`,text:`Choose Two galaxies colliding: what it requires is lit, and a click on one of those steps back to it, and on, back to Newton's law. That is the reading list for tonight.`},{go:`/n/${he}`,target:Q,fill:k.speed,until:Ie(`ask`,/faster/),title:`How much faster?`,text:`Cost and accuracy is open. With the quill off, ask Iso how much faster Barnes–Hut is at N = 5000: the question is written for you.`},{target:Q,title:`Checked against your notes`,text:`Iso checked its arithmetic against direct summation and Barnes–Hut, and says to measure, as your note says.`},{target:Q,fill:k.octreeWrite,until:Ie(`write`,/octree/),title:`Plan the octree`,text:`The simulation is 3D, and the quadtree is 2D. With the quill on, ask Iso to write a note on the octree, in algorithms: the request is written for you.`},{target:`${Q} .change`,check:()=>ze(`#/n/algorithms/the-octree`)(),title:`Its note`,text:`Iso made The octree. Click it in Iso's pane to open it: it is one of your notes now, linked to the quadtree and Barnes–Hut.`},{go:`/n/${ge}`,target:`[data-pane="note"] .cm-content`,check:()=>/octree/i.test(document.querySelector(`[data-pane="note"] .cm-content`)?.textContent??``),title:`Link it in`,text:`The main loop is where it will be used. At the end of the first paragraph, type [[oct and choose the octree.`}]},{key:`L3`,base:`geometry`,title:`Questions and problems`,about:`Open questions and problems are notes of their own, beside the notes they are about. See who wrote what, follow them on the Atlas, let Iso ask you back and put your own answers together, and read how Iso reads you. On notes about the geometry of surfaces.`,steps:[{go:`/n/${Y}`,target:()=>[...document.querySelectorAll(`[data-pane="note"] .sw[data-switch="provenance"], [data-pane="note"] .cm-content`)],check:()=>T.on.provenance,title:`Whose words`,text:`These are notes on the geometry of surfaces. Gauss–Bonnet is open. Switch on provenance, the half-filled square in the Note pane's header: the proof sketch is Iso's, untouched, and the examples are yours.`},{target:()=>[...document.querySelectorAll(`[data-pane="note"] .sw[data-switch="timeline"], .timeline`)],check:()=>T.on.timeline,title:`Every change is kept`,text:`Switch on the timeline, beside it: each mark is a moment in the note's life, Iso's sketch among them.`},{target:`.cm-lp-embed`,check:ze(`#/n/${Oe}`),title:`A question in a note`,text:`After Compact: stands a question of yours, embedded. Click it: it opens as a note of its own.`,phone:{text:`After Compact: stands a question of yours, embedded. Tap it: it opens as a note of its own.`}},{go:`/atlas`,target:`.atlas a.n.question`,check:Ve(Oe),title:`Questions on the Atlas`,text:`Open questions are blocks on the Atlas with a ? in the notch, each beside what it is about. Click Where is compactness used?: its note lights, and the note it asks about.`,phone:{text:`Open questions are blocks on the Atlas with a ? in the notch, each beside what it is about. Tap Where is compactness used?: its note lights, and the note it asks about.`}},{target:()=>[...document.querySelectorAll(`[data-pane="atlas"] .sw[data-switch="web"], [data-pane="atlas"] .sw[data-switch="code"], .sat`)],check:()=>T.on.web&&T.on.code,title:`Links out of the base`,text:`Switch on web and code in the Atlas's header: links to a page and to code stand beside their note as small blocks. geodesics.jl is struck through: it is not in the repository.`},{go:`/atlas`,target:`[data-note="${Y}"]`,check:()=>w.parts.some(e=>e.kind===`note`&&e.id===Y),title:`Give Iso the note`,text:`Hold Gauss–Bonnet on the Atlas (or drag it onto Iso's pane). Its open questions go with it.`,phone:{text:`On the Atlas, hold Gauss–Bonnet and choose Give to Iso. Its open questions go with it.`}},{target:Q,fill:je.back,until:Le(/compactness is used|compactness used/),title:`Iso asks you back`,text:`Gauss–Bonnet is in Iso's context with its question. The request is written for you: send it. Given an open question, Iso asks before it explains.`},{target:Q,fill:je.remark,until:Le(/answers on compactness/),title:`Your answers, put together`,text:`Under Where is compactness used? are two answers of yours. Ask Iso to put them together: the request is written for you.`},{target:()=>[...document.querySelectorAll(`${Q} [data-offer]`)],check:()=>Je(Z(Y),/\*\*Compact:\*\*/g)>=2,title:`Inserted as yours`,text:`Iso offers the remark in your words. The arrow inserts it at the end of Gauss–Bonnet, as yours: Iso's offer is not in the note until you say.`},{go:`/n/${Y}`,target:`[data-tour="understanding"], [data-pane="note"] .u`,check:()=>T.understanding,title:`How Iso reads you`,text:`Open Gauss–Bonnet's Understanding note, the sprig in the Note pane's header. Each sentence of Iso's reading rests on something you can open: your examples, the torus you solved, the question still open.`},{go:`/n/${Oe}`,target:`[data-tour="understanding"], [data-pane="note"] .titlerow`,check:()=>/^resolved:/m.test(Z(Oe)),title:`Resolve it`,text:`Your remark is in the note. Close the Understanding note with the sprig, then press the ✓ in the question's title row: it resolves it, yours to press and never Iso's.`},{title:`Questions and problems, in short`,text:`A question or a problem is a note with a type, kept beside the notes it is about. Iso asks you back, checks a solution without marking it, and offers your own answers for you to insert. Resolving and solving are yours.`}]},{key:`E2`,title:`Learning with isorite`,steps:[],about:`How isorite gets you up to speed quickly, on the same N-body simulation project.`},{key:`L4`,title:`The terminal interface`,earlier:!0,about:`Iso shares a common substrate of understanding with you as you build together. Extending the familiar OpenCode 2, learn to use isorite's terminal and web interfaces jointly.`,steps:[{title:`isorite in the terminal`,text:`For work that needs more than notes: code. isorite term runs OpenCode, an agent that edits code, with your base beside it. To walk through it on your machine, with OpenCode 2 installed: isorite --tutorial.`},{title:`It looks before it codes`,text:`The agent has your base as tools: brief_base, search_notes, find_similar, outline_note and read_note. Asked to write Barnes–Hut, it reads your notes on it first, and cites them.`},{go:`/atlas`,target:`.atlas-world`,title:`Watched from here`,text:`While it works, this Atlas follows it: what it found and read is drawn as Iso's path is, and what it used.`},{title:`Its changes to notes wait`,text:`edit_note and write_note: what the agent changes in your notes is written at once under its name, its words marked as Iso's are, and undone the same way. Its changes to code are OpenCode's own, which asks before it writes.`},{title:`From here to there`,text:`In the terminal, /note opens a note and /atlas shows what it requires and what builds on it.`},{title:`Its tour, replayed`,link:{href:`#/terminal`,text:`isorite in the terminal: its tour, replayed`},text:`Every screen of the terminal's tour, as OpenCode drew it.`}],local:{about:`The agent in OpenCode, in the terminal beside this page, with your notes as its tools; this page follows it.`,steps:[{title:`The terminal beside this page`,text:`The terminal you ran isorite --tutorial in is this part: its own card leads, a step at a time. This page follows it. Keep the Atlas open where you can see both.`},{go:`/atlas`,target:`.atlas-world`,until:e=>e.type===`agent-done`,title:`Watched from here`,text:`In the terminal, ask the agent for code, as its card says. It looks in your notes first: watch its path drawn here as it reads, found by words, by meaning, or along a link.`},{go:`/n/${U}`,title:`Its changes to notes wait here too`,text:`When the agent would change a note, the change waits in the note, here as in the terminal, under its name. Keep it in either; the other sees it.`},{title:`On your own notes`,text:`In your project's folder: isorite term <your base>, and the browser at the address it gives. isorite serve <your base> opens the browser alone.`}]}},{key:`E3`,title:`Building with isorite`,steps:[],about:`Putting it all together: rewrite the N-body simulation to use the Barnes–Hut algorithm, with structured agentic awareness of the project.`}],ot=()=>new URLSearchParams(location.search).get(`base`)===`geometry`?`geometry`:`nbody`,st=(e,t)=>`${location.pathname}${e===`geometry`?`?base=geometry`:``}#${t}`,$=m({part:-1,at:0,left:!1,ticks:{},mistake:``}),ct=`isorite.tour`;function lt(e,t){try{sessionStorage.setItem(ct,JSON.stringify({part:e,at:t,left:!1,ticks:$.ticks}))}catch{}}function ut(){try{let e=JSON.parse(sessionStorage.getItem(ct)??`null`);return sessionStorage.removeItem(ct),e?(Object.assign($,{part:e.part,at:e.at,left:e.left,ticks:e.ticks}),e.part>=0):!1}catch{return!1}}var dt={snap:null};function ft(e,t){$.ticks[e]??=[],$.ticks[e].includes(t)||$.ticks[e].push(t)}var pt=e=>{var t=mt();r(e,t)},mt=t(`<svg class="tick svelte-1195hbs" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2 6.5l2.6 2.6L10 3.4" fill="none" stroke="currentColor" stroke-width="1.6"></path></svg>`),ht=y(`<button class="back btn quiet svelte-1195hbs" type="button">the tutorial</button>`),gt=y(`<span class="note svelte-1195hbs">an earlier version, being rewritten</span>`),_t=y(`<button type="button" class="section svelte-1195hbs"><span class="key svelte-1195hbs"> </span> <span class="what svelte-1195hbs"><span class="t svelte-1195hbs"> </span><span class="about svelte-1195hbs"> </span><!></span> <span class="progress svelte-1195hbs"><!><span class="go svelte-1195hbs" aria-hidden="true">›</span></span></button>`),vt=y(`<div class="section coming svelte-1195hbs"><span class="key svelte-1195hbs"> </span> <span class="what svelte-1195hbs"><span class="t svelte-1195hbs"> </span><span class="about svelte-1195hbs"> </span><span class="note svelte-1195hbs">coming</span></span></div>`),yt=y(`<li><!></li>`),bt=y(`<div class="coach frame parts svelte-1195hbs" role="dialog" aria-label="The tutorial" aria-live="polite"><span class="label">isorite, tutorial</span> <p class="svelte-1195hbs">This is a demo of isorite on example projects: an N-body simulation, and notes on the geometry of surfaces. Explore and read the knowledge base as you like, or follow the sections below for an interactive walkthrough.</p> <p class="faint svelte-1195hbs"><!></p> <ol class="list svelte-1195hbs"></ol> <div class="row actions svelte-1195hbs"><span class="grow"></span><button class="btn quiet svelte-1195hbs" type="button">leave</button></div></div>`),xt=y(`<div aria-hidden="true"></div>`),St=y(`<i></i>`),Ct=y(`<button class="fold svelte-1195hbs" type="button"> </button>`),wt=y(`<p class="svelte-1195hbs"> </p>`),Tt=y(`<p class="svelte-1195hbs"><a> </a></p>`),Et=y(`<p class="mistake svelte-1195hbs" role="status"> </p>`),Dt=y(`<button class="btn quiet svelte-1195hbs" type="button" aria-label="back a step">‹ back</button>`),Ot=y(`<span class="label done svelte-1195hbs"><!> done</span>`),kt=y(`<button class="btn quiet svelte-1195hbs" type="button" title="put the base back as this step found it"> </button>`),At=y(`<!> <div role="dialog" aria-label="The tutorial" aria-live="polite"><div class="row head svelte-1195hbs"><span class="label"> </span><span class="grow"></span> <span class="seg svelte-1195hbs"></span> <button class="link svelte-1195hbs" type="button">sections</button> <button class="link svelte-1195hbs" type="button">leave</button></div> <h2 class="svelte-1195hbs"><!></h2> <!> <!> <!> <div><!> <!> <span class="grow"></span> <!> <button type="button"> </button></div></div>`,1);function jt(t,c){v(c,!0);let m=!!C.session?.tutorial,y=at.filter(e=>!(m&&e.base)).map(e=>m&&e.local?{...e,...e.local}:e),w=e(()=>$.left),T=e(()=>$.part>=0?y[$.part]:null),E=h(!1),D=e(()=>{let e=i(T)?.steps[$.at];return e?{...e,...i(E)?e.phone:{}}:null}),O=e(()=>!!(i(D)?.until||i(D)?.check)),ue=e(()=>i(T)!==null&&$.at===i(T).steps.length-1),k=(e,t)=>$.ticks[e]?.includes(t)??!1,A=e(()=>i(T)!==null&&k(i(T).key,$.at)),j=h(null),M=h(void 0),N=h(!1),P=h(!1),F=h(!1),I=h(0),L=h(!1);async function R(e,t){let n=y[e].steps[t],r=(i(E)?n.phone?.go:void 0)??n.go,a=y[e].base??`nbody`;return m||a===ot()?!1:(lt(e,t),location.assign(st(a,r?typeof r==`string`?r:await r():`/`)),!0)}async function z(e){if(await R($.part,e))return;$.at=e,$.mistake=``,p(L,!1),p(P,!0),setTimeout(()=>p(P,!1),200);let t=y[$.part].steps[e],n=(i(E)?t.phone?.go:void 0)??t.go;n&&await se(`#${typeof n==`string`?n:await n()}`),dt.snap=ce().catch(()=>null)}async function B(e){rt(),!await R(e,0)&&($.part=e,$.left=!1,z(0))}function de(){i(T)&&(i(O)||ft(i(T).key,$.at),i(ue)?$.part=-1:z($.at+1))}function fe(){$.at>0&&z($.at-1)}async function pe(){let e=await dt.snap;if(e&&!i(F)){p(F,!0);try{await le(e)}finally{p(F,!1)}await z($.at)}}function me(e){return e?typeof e==`function`?e():[...document.querySelectorAll(e)]:[]}b(()=>{ut()&&(rt(),z($.at));let e=matchMedia(`(max-width: 600px)`);p(E,e.matches,!0);let t=()=>{p(E,e.matches,!0)};e.addEventListener(`change`,t);let n=()=>{i(T)&&ft(i(T).key,$.at),de()},r=C.on(e=>{!i(w)&&i(D)?.until?.(e)&&n()}),a=0,o=()=>{if(a=requestAnimationFrame(o),i(w)||!i(D)){p(j,null);return}if(p(I,0),i(E))for(let e of document.querySelectorAll(`.seed, .foot, .changes, .deck, [data-pane="iso"] .composer`)){let t=e.getBoundingClientRect();t.height&&t.top>innerHeight/2&&t.left<innerWidth&&t.right>0&&p(I,Math.max(i(I),innerHeight-t.top+8),!0)}let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let a of me(i(D).target)){let i=a.getBoundingClientRect();i.width&&i.height&&(e=Math.min(e,i.left),t=Math.min(t,i.top),n=Math.max(n,i.right),r=Math.max(r,i.bottom))}if(p(j,e<n?{x:e,y:t,w:n-e,h:r-t}:null),!i(E)&&i(M)){let e=i(M).getBoundingClientRect(),t=e.width,n=e.height,r=innerHeight-48-n,a=e=>i(j)?Math.max(0,Math.min(e+t,i(j).x+i(j).w)-Math.max(e,i(j).x))*Math.max(0,Math.min(r+n,i(j).y+i(j).h)-Math.max(r,i(j).y)):0,o=a(innerWidth-24-t),s=a(24);p(N,o>0&&s<o,!0)}};o();let s=setInterval(()=>{if(!(i(w)||!i(D)||i(F))){if(i(D).fill){let e=document.querySelector(`#iso-box`);e&&!e.value&&e.dataset.filled!==i(D).fill&&(e.dataset.filled=i(D).fill,e.value=i(D).fill,e.dispatchEvent(new Event(`input`,{bubbles:!0})))}i(D).check?.()?n():$.mistake=i(D).wrong?.()??``}},250);return()=>{r(),cancelAnimationFrame(a),clearInterval(s),e.removeEventListener(`change`,t)}});var V=u(),H=s(V),he=e=>{var t=ht();l(`click`,t,()=>{$.left=!1,$.part=-1}),r(e,t)},ge=t=>{var s=bt(),c=o(a(s),4),u=a(c),p=e=>{var t=te(`Iso and the agent are scripted, and nothing leaves your machine; what you change is kept in the tutorial's folder.`);r(e,t)},h=e=>{var t=te(`Iso is scripted, and nothing leaves this page; a reload starts it all again.`);r(e,t)};d(u,e=>{m?e(p):e(h,-1)}),_(c);var g=o(c,2);oe(g,23,()=>y,e=>e.key,(t,s,c)=>{let u=e(()=>$.ticks[i(s).key]?.length??0);var p=yt(),m=a(p),h=e=>{var t=_t(),p=a(t),m=S(p,!0),h=o(p,2),g=a(h),ee=S(g,!0),v=o(g),y=S(v,!0),b=o(v),x=e=>{var t=gt();r(e,t)};d(b,e=>{i(s).earlier&&e(x)}),_(h);var ne=o(h,2),re=a(ne),oe=e=>{pt(e)},se=e=>{var t=te();n(()=>f(t,`${i(u)??``} of ${i(s).steps.length??``}`)),r(e,t)};d(re,e=>{i(u)===i(s).steps.length?e(oe):i(u)&&e(se,1)}),ie(),_(ne),_(t),n(()=>{ae(t,`aria-label`,`${i(s).key??``}: ${i(s).title??``}${i(u)?`, ${i(u)} of ${i(s).steps.length} done`:``}`),f(m,i(s).key),f(ee,i(s).title),f(y,i(s).about)}),l(`click`,t,()=>B(i(c))),r(e,t)},g=e=>{var t=vt(),c=a(t),l=S(c,!0),u=o(c,2),d=a(u),p=S(d,!0),m=o(d),h=S(m,!0);ie(),_(u),_(t),n(()=>{ae(t,`aria-label`,`${i(s).key??``}: ${i(s).title??``}, coming`),f(l,i(s).key),f(p,i(s).title),f(h,i(s).about)}),r(e,t)};d(m,e=>{i(s).steps.length?e(h):e(g,-1)}),_(p),r(t,p)}),_(g);var ee=o(g,2),v=o(a(ee));_(ee),_(s),l(`click`,v,()=>$.left=!0),r(t,s)},_e=e=>{var t=At(),c=s(t),m=e=>{var t=xt();let a;n(()=>{a=x(t,1,`spot svelte-1195hbs`,null,a,{easing:i(P)}),ee(t,`left:${i(j).x-8}px;top:${i(j).y-8}px;width:${i(j).w+16}px;height:${i(j).h+16}px`)}),r(e,t)};d(c,e=>{i(j)&&e(m)});var h=o(c,2);let v,y;var b=a(h),ne=a(b),se=S(ne),C=o(ne,3);oe(C,21,()=>i(T).steps,g,(e,t,a)=>{var o=St();let s;n(e=>s=x(o,1,`svelte-1195hbs`,null,s,{d:e,at:a===$.at}),[()=>k(i(T).key,a)]),r(e,o)}),_(C);var w=o(C,2),ce=o(w,2);_(b);var le=o(b,2),R=a(le),z=e=>{var t=Ct(),a=S(t,!0);n(()=>{ae(t,`aria-expanded`,!i(L)),f(a,i(D).title)}),l(`click`,t,()=>p(L,!i(L))),r(e,t)},B=e=>{var t=te();n(()=>f(t,i(D).title)),r(e,t)};d(R,e=>{i(E)?e(z):e(B,-1)}),_(le);var me=o(le,2),V=e=>{var t=wt(),a=S(t,!0);n(()=>f(a,i(D).text)),r(e,t)};d(me,e=>{i(L)||e(V)});var H=o(me,2),he=e=>{var t=Tt(),o=a(t),s=S(o,!0);_(t),n(()=>{ae(o,`href`,i(D).link.href),f(s,i(D).link.text)}),r(e,t)};d(H,e=>{i(D).link&&!i(L)&&e(he)});var ge=o(H,2),_e=e=>{var t=Et(),i=S(t,!0);n(()=>f(i,$.mistake)),r(e,t)};d(ge,e=>{$.mistake&&!i(L)&&e(_e)});var U=o(ge,2);let ve;var ye=a(U),be=e=>{var t=Dt();l(`click`,t,fe),r(e,t)};d(ye,e=>{$.at>0&&e(be)});var xe=o(ye,2),Se=e=>{var t=u(),n=s(t),o=e=>{var t=Ot();pt(a(t)),ie(),_(t),r(e,t)};d(n,e=>{i(A)&&e(o)}),r(e,t)};d(xe,e=>{i(O)&&e(Se)});var Ce=o(xe,4),we=e=>{var t=kt(),a=S(t,!0);n(()=>{t.disabled=i(F),f(a,i(F)?`redoing…`:`redo`)}),l(`click`,t,pe),r(e,t)};d(Ce,e=>{i(O)&&e(we)});var W=o(Ce,2),Te=S(W,!0);_(U),_(h),re(h,e=>p(M,e),()=>i(M)),n(e=>{v=x(h,1,`coach frame svelte-1195hbs`,null,v,{small:i(L),left:i(N)&&!i(E)}),y=ee(h,``,y,{bottom:i(I)?`${i(I)}px`:null}),f(se,`${i(T).key??``} · ${e??``}`),ae(C,`aria-label`,`step ${$.at+1} of ${i(T).steps.length??``}, ${$.ticks[i(T).key]?.length??0??``} done`),ve=x(U,1,`row actions svelte-1195hbs`,null,ve,{hidden:i(L)}),x(W,1,`btn ${i(O)&&!i(A)?`quiet`:`primary`}`,`svelte-1195hbs`),f(Te,i(ue)?`done`:`next ›`)},[()=>i(T).title.toLowerCase()]),l(`click`,w,()=>$.part=-1),l(`click`,ce,()=>$.left=!0),l(`click`,W,de),r(e,t)};d(H,e=>{i(w)?e(he):i(T)?i(D)&&e(_e,2):e(ge,1)}),r(t,V),ne()}c([`click`]);export{jt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e,X as t,Z as n}from"./Bze-M_kr.js";import{t as r}from"./BavLcJN1.js";import{i,r as a}from"./BN1DRYj2.js";import{i as o}from"./BcrJkegU.js";var s=new class{#e=n(``);get id(){return e(this.#e)}set id(e){t(this.#e,e,!0)}#t=n([]);get turns(){return e(this.#t)}set turns(e){t(this.#t,e)}#n=n(``);get streaming(){return e(this.#n)}set streaming(e){t(this.#n,e,!0)}#r=n(``);get problem(){return e(this.#r)}set problem(e){t(this.#r,e,!0)}#i=n(null);get report(){return e(this.#i)}set report(e){t(this.#i,e)}#a=n(`chat`);get view(){return e(this.#a)}set view(e){t(this.#a,e,!0)}#o=n([]);get off(){return e(this.#o)}set off(e){t(this.#o,e)}toggleTurn(e){this.off=this.off.includes(e)?this.off.filter(t=>t!==e):[...this.off,e],this.measure()}sizeOf(e){let t=this.report?.given?.find(t=>t.kind===e.kind&&t.id===e.id&&(e.kind!==`passage`||t.text===e.text));return t?t.tokens:null}started=!1;timer;get running(){let e=this.turns.at(-1);return e?.state===`running`?e:null}start(){!this.started&&r.api&&(this.started=!0,r.api.conversation().then(e=>{e&&!this.id&&this.show(e)},()=>void 0),r.on(e=>this.follow(e)),this.measure())}show(e){this.id=e.id,this.turns=e.turns}fresh(){this.running||(this.id=``,this.turns=[],this.streaming=``,this.off=[],this.measure())}async send(e){if(this.problem=``,!e.trim()||this.running)return!1;try{let t=i.sent.map(e=>e.kind===`passage`?{kind:e.kind,id:e.id,text:e.text}:{kind:e.kind,id:e.id}),{conversation:n}=await r.api.converse({...this.id?{conversation:this.id}:{},mode:o.mode,asked:e.trim(),given:t,tier:a.tier,...this.off.length?{off:this.off}:{}});return this.id=n,!0}catch(e){return this.problem=e.message,!1}}async stop(){let e=this.running;e&&await r.api.stop(e.id)}async undo(e){this.problem=``;try{await r.api.undoTurn(this.id,e)}catch(e){this.problem=e.message}}async take(e,t){this.problem=``;try{await r.api.takeItem(this.id,e,t)}catch(e){this.problem=e.message}}async answer(e,t){let n=this.running;n&&await r.api.answer(n.id,e,t)}follow(e){if(e.type===`iso-start`&&e.place.form===`turn`){if(this.id&&e.place.conversation!==this.id)return;this.id=e.place.conversation,this.streaming=``,this.turns=[...this.turns.filter(t=>t.id!==e.request),{id:e.request,conversation:e.place.conversation,at:new Date().toISOString(),mode:e.place.mode,asked:e.asked,given:e.place.given,tier:e.tier,items:[],state:`running`}];return}if(!(`request`in e)){(e.type===`note-changed`||e.type===`journal`)&&this.measure();return}let t=this.turns.findIndex(t=>t.id===e.request);if(t<0)return;let n=this.turns[t],r=e=>{this.turns=this.turns.map((n,r)=>r===t?e:n)};e.type===`iso-text`?this.streaming=e.again?e.delta:this.streaming+e.delta:e.type===`iso-item`?(e.item.kind===`text`&&(this.streaming=``),r({...n,items:[...n.items,e.item]})):e.type===`iso-taken`?r({...n,items:n.items.map(t=>t.kind===`question`&&t.id===e.item?{...t,made:e.note}:t.kind===`offer`&&t.id===e.item?{...t,taken:!0}:t)}):e.type===`iso-answer`?r({...n,items:n.items.map(t=>t.kind===`permission`&&t.id===e.permission?{...t,answer:e.decision}:t)}):e.type===`iso-done`?(r({...n,state:`done`,cost:e.cost}),this.streaming=``,this.measure()):e.type===`iso-stopped`?(r({...n,state:`stopped`,...this.streaming?{items:[...n.items,{kind:`text`,text:this.streaming}]}:{}}),this.streaming=``):e.type===`iso-failed`&&(r({...n,state:`failed`,message:e.message}),this.streaming=``)}measure(){clearTimeout(this.timer),this.timer=setTimeout(()=>{if(!r.api)return;let e=i.sent.map(e=>e.kind===`passage`?{kind:e.kind,id:e.id,text:e.text}:{kind:e.kind,id:e.id});r.api.turnContext({...this.id?{conversation:this.id}:{},mode:o.mode,given:e,tier:a.tier,...this.off.length?{off:this.off}:{}}).then(e=>this.report=e,()=>void 0)},250)}};export{s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as load_css,n as start}from"../chunks/BZeALCyJ.js";
|