(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,525567,e=>{"use strict";var t=e.i(16043);let n=t.forwardRef(function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))});e.s(["f",0,n],525567)},776175,(e,t,n)=>{e.e,t.exports=function(){var t=function(e,n){return(t=Object.setPrototypeOf||(({__proto__:[]})instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,n)},n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g,i=Object.keys,a=Array.isArray;function s(e,t){return"object"==typeof t&&i(t).forEach(function(n){e[n]=t[n]}),e}"u"typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof K?function(e){var t;return null!=e&&(t=e[K])&&t.apply(e)}:function(){return null};function R(e,t){0<=(t=e.indexOf(t))&&e.splice(t,1)}var I={};function M(e){var t,n,r,o;if(1==arguments.length){if(a(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(o=D(e))for(n=[];!(r=o.next()).done;)n.push(r.value);else{if(null==e||"number"!=typeof(t=e.length))return[e];for(n=Array(t);t--;)n[t]=e[t]}}else for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}var q="u">typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},C=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],B=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(C),F={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function N(e,t){this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join("\n")}function L(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function V(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(e){return t[e]}),this.failuresByPos=t,this.message=z(e,this.failures)}p(N).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p(L).from(N),p(V).from(N);var W=B.reduce(function(e,t){return e[t]=t+"Error",e},{}),U=B.reduce(function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=F[t]||n,this.inner=null)}return p(r).from(N),e[t]=r,e},{}),$=(U.Syntax=SyntaxError,U.Type=TypeError,U.Range=RangeError,C.reduce(function(e,t){return e[t+"Error"]=U[t],e},{}));function G(){}function Y(e){return e}function H(e,t){return null==e||e===Y?t:function(n){return t(e(n))}}function Q(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function X(e,t){return e===G?t:function(){var n=e.apply(this,arguments),r=(void 0!==n&&(arguments[0]=n),this.onsuccess),o=this.onerror,i=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return r&&(this.onsuccess=this.onsuccess?Q(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Q(o,this.onerror):o),void 0!==i?i:n}}function J(e,t){return e===G?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Q(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Q(r,this.onerror):r)}}function Z(e,t){return e===G?t:function(){var n=e.apply(this,arguments),r=(s(arguments[0],n),this.onsuccess),o=this.onerror,i=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return r&&(this.onsuccess=this.onsuccess?Q(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Q(o,this.onerror):o),void 0===n?void 0===i?void 0:i:s(n,i)}}function ee(e,t){return e===G?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function et(e,t){return e===G?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,o=arguments.length,i=Array(o);o--;)i[o]=arguments[o];return n.then(function(){return t.apply(r,i)})}return t.apply(this,arguments)}}(C=B.reduce(function(e,t){return -1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=U[t]),e},{})).ModifyError=L,C.DexieError=N,C.BulkError=V;var en="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),er={},eo="u"typeof crypto&&crypto.subtle?[eo=crypto.subtle.digest("SHA-512",new Uint8Array([0])),u(eo),B]:[B,u(B),B]),B=eo[0],ei=eo[1],ei=ei&&ei.then,ea=B&&B.constructor,es=!!eo[2],eu=function(e,t){em.push([e,t]),ec&&(queueMicrotask(eC),ec=!1)},el=!0,ec=!0,ef=[],ed=[],eh=Y,ep={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:G,pgp:!1,env:{},finalize:G},ey=ep,em=[],ev=0,eg=[];function eb(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ey;if("function"!=typeof e){if(e!==er)throw TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],!1===this._state&&ex(this,this._value)}else this._state=null,this._value=null,++t.ref,function e(t,n){try{n(function(n){if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var r=t._lib&&eE();n&&"function"==typeof n.then?e(t,function(e,t){n instanceof eb?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,ek(t)),r&&eO()}},ex.bind(null,t))}catch(e){ex(t,e)}}(this,e)}var ew={get:function(){var e=ey,t=eM;function n(n,r){var o=this,i=!e.global&&(e!==ey||t!==eM),a=i&&!eN(),s=new eb(function(t,s){eS(o,new e_(e$(n,e,i,a),e$(r,e,i,a),t,s,e))});return this._consoleTask&&(s._consoleTask=this._consoleTask),s}return n.prototype=er,n},set:function(e){h(this,"then",e&&e.prototype===er?ew:{get:function(){return e},set:ew.set})}};function e_(e,t,n,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=o}function ex(e,t){var n;ed.push(t),null===e._state&&(n=e._lib&&eE(),t=eh(t),e._state=!1,e._value=t,ef.some(function(t){return t._value===e._value})||ef.push(e),ek(e),n)&&eO()}function ek(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n{for(var t=ef.length;t;)if(ef[--t]._value===e._value)return ef.splice(t,1)})(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--ev&&ej(),--n.psd.ref||n.psd.finalize()}}function eC(){eU(ep,function(){eE()&&eO()})}function eE(){var e=el;return ec=el=!1,e}function eO(){var e,t,n;do for(;0typeof Symbol&&Symbol.toStringTag&&h(eb.prototype,Symbol.toStringTag,"Dexie.Promise"),ep.env=eW(),f(eb,{all:function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(function(o,i){return eb.resolve(o).then(function(n){e[i]=n,--r||t(e)},n)})})},resolve:function(e){return e instanceof eb?e:e&&"function"==typeof e.then?new eb(function(t,n){e.then(t,n)}):new eb(er,!0,e)},reject:eT,race:function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){e.map(function(e){return eb.resolve(e).then(t,n)})})},PSD:{get:function(){return ey},set:function(e){return ey=e}},totalEchoes:{get:function(){return eM}},newPSD:eB,usePSD:eU,scheduler:{get:function(){return eu},set:function(e){eu=e}},rejectionMapper:{get:function(){return eh},set:function(e){eh=e}},follow:function(e,t){return new eb(function(n,r){return eB(function(t,n){var r=ey;r.unhandleds=[],r.onunhandled=n,r.finalize=Q(function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},eg.push(function t(){e(),eg.splice(eg.indexOf(t),1)}),++ev,eu(function(){0==--ev&&ej()},[])},r.finalize),e()},t,n,r)})}}),ea&&(ea.allSettled&&h(eb,"allSettled",function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t){0===e.length&&t([]);var n=e.length,r=Array(n);e.forEach(function(e,o){return eb.resolve(e).then(function(e){return r[o]={status:"fulfilled",value:e}},function(e){return r[o]={status:"rejected",reason:e}}).then(function(){return--n||t(r)})})})}),ea.any&&"u">typeof AggregateError&&h(eb,"any",function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){0===e.length&&n(AggregateError([]));var r=e.length,o=Array(r);e.forEach(function(e,i){return eb.resolve(e).then(function(e){return t(e)},function(e){o[i]=e,--r||n(AggregateError(o))})})})}),ea.withResolvers)&&(eb.withResolvers=ea.withResolvers);var eK={awaits:0,echoes:0,id:0},eD=0,eR=[],eI=0,eM=0,eq=0;function eB(e,t,n,r){var o=ey,i=Object.create(o),t=(i.parent=o,i.ref=0,i.global=!1,i.id=++eq,ep.env,i.env=es?{Promise:eb,PromiseProp:{value:eb,configurable:!0,writable:!0},all:eb.all,race:eb.race,allSettled:eb.allSettled,any:eb.any,resolve:eb.resolve,reject:eb.reject}:{},t&&s(i,t),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()},eU(i,e,n,r));return 0===i.ref&&i.finalize(),t}function eF(){return eK.id||(eK.id=++eD),++eK.awaits,eK.echoes+=100,eK.id}function eN(){return!!eK.awaits&&(0==--eK.awaits&&(eK.id=0),eK.echoes=100*eK.awaits,!0)}function ez(e){return eK.echoes&&e&&e.constructor===ea?(eF(),e.then(function(e){return eN(),e},function(e){return eN(),eY(e)})):e}function eL(){var e=eR[eR.length-1];eR.pop(),eV(e,!1)}function eV(e,t){var n,r,i=ey;(t?!eK.echoes||eI++&&e===ey:!eI||--eI&&e===ey)||queueMicrotask(t?(function(e){++eM,eK.echoes&&0!=--eK.echoes||(eK.echoes=eK.awaits=eK.id=0),eR.push(ey),eV(e,!0)}).bind(null,e):eL),e!==ey&&(ey=e,i===ep&&(ep.env=eW()),es)&&(n=ep.env.Promise,r=e.env,i.global||e.global)&&(Object.defineProperty(o,"Promise",r.PromiseProp),n.all=r.all,n.race=r.race,n.resolve=r.resolve,n.reject=r.reject,r.allSettled&&(n.allSettled=r.allSettled),r.any)&&(n.any=r.any)}function eW(){var e=o.Promise;return es?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function eU(e,t,n,r,o){var i=ey;try{return eV(e,!0),t(n,r,o)}finally{eV(i,!1)}}function e$(e,t,n,r){return"function"!=typeof e?e:function(){var o=ey;n&&eF(),eV(t,!0);try{return e.apply(this,arguments)}finally{eV(o,!1),r&&queueMicrotask(eN)}}}function eG(e){Promise===ea&&0===eK.echoes?0===eI?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+ei).indexOf("[native code]")&&(eF=eN=G);var eY=eb.reject,eH=String.fromCharCode(65535),eQ="Invalid key provided. Keys must be of type string, number, Date or Array.",eX="String expected.",eJ="__dbnames",eZ="readonly",e0="readwrite";function e1(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var e2={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function e3(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=j(t))[e],t}}function e4(){throw U.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function e5(e,t){try{var n=e6(e),r=e6(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?0/0:-1;switch(n){case"number":case"Date":case"string":return ttypeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(r.schema[o])return t(r.idbtrans,r);throw new U.NotFound("Table "+o+" not part of transaction")}var s=eE();try{var u=r&&r.db._novip===this.db._novip?r===ey.trans?r._promise(e,a,n):eB(function(){return r._promise(e,a,n)},{trans:r,transless:ey.transless||ey}):function e(t,n,r,o){if(t.idbdb&&(t._state.openComplete||ey.letThrough||t._vip)){var i=t._createTransaction(n,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then(function(){return e(t,n,r,o)})):eY(i)}return i._promise(n,function(e,t){return eB(function(){return ey.trans=i,o(e,t,i)})}).then(function(e){if("readwrite"===n)try{i.idbtrans.commit()}catch(e){}return"readonly"===n?e:i._completion.then(function(){return e})})}if(t._state.openComplete)return eY(new U.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return eY(new U.DatabaseClosed);t.open().catch(G)}return t._state.dbReadyPromise.then(function(){return e(t,n,r,o)})}(this.db,e,[this.name],a);return i&&(u._consoleTask=i,u=u.catch(function(e){return console.trace(e),eY(e)})),u}finally{s&&eO()}},tt.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?eY(new U.Type("Invalid argument to Table.get()")):this._trans("readonly",function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},tt.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=i(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(e){if(e.compound&&t.every(function(t){return 0<=e.keyPath.indexOf(t)})){for(var n=0;n{if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=i}function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o),Object.defineProperty(i.prototype,"db",{get:function(){return n},enumerable:!1,configurable:!0}),i.prototype.table=function(){return r},i})(e)),new Set),i=e.prototype;i;i=u(i))Object.getOwnPropertyNames(i).forEach(function(e){return o.add(e)});function a(t){if(!t)return t;var n,r=Object.create(e.prototype);for(n in t)if(!o.has(n))try{r[n]=t[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=a,this.hook("reading",a),e},tt.prototype.defineClass=function(){return this.mapToClass(function(e){s(this,e)})},tt.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=e3(i)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):e.lastResult}).then(function(t){if(i)try{x(e,i,t)}catch(e){}return t})},tt.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",function(o){return n.core.get({trans:o,key:e}).then(function(i){var a=null!=i?i:{};return te(a,t),r&&x(a,r,e),n.core.mutate({trans:o,type:"put",values:[a],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):!!i})})})},tt.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=_(e,this.schema.primKey.keyPath))?eY(new U.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},tt.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=e3(i)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):e.lastResult}).then(function(t){if(i)try{x(e,i,t)}catch(e){}return t})},tt.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then(function(n){return e7(t,[e],n)}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):void 0})})},tt.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:e2}).then(function(t){return e7(e,null,t)})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):void 0})},tt.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(e){return e.map(function(e){return t.hook.reading.fire(e)})})})},tt.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,a=n.auto,n=n.keyPath;if(n&&o)throw new U.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,a=n&&a?e.map(e3(n)):e;return r.core.mutate({trans:t,type:"add",keys:o,values:a,wantResults:i}).then(function(e){var t=e.numFailures,n=e.failures;if(0===t)return i?e.results:e.lastResult;throw new V("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(s," operations failed"),n)})})},tt.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,a=n.auto,n=n.keyPath;if(n&&o)throw new U.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,a=n&&a?e.map(e3(n)):e;return r.core.mutate({trans:t,type:"put",keys:o,values:a,wantResults:i}).then(function(e){var t=e.numFailures,n=e.failures;if(0===t)return i?e.results:e.lastResult;throw new V("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(s," operations failed"),n)})})},tt.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(e){return e.key}),o=e.map(function(e){return e.changes}),i=[];return this._trans("readwrite",function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then(function(s){var u=[],l=[],c=(e.forEach(function(e,n){var r=e.key,o=e.changes,a=s[n];if(a){for(var c=0,f=Object.keys(o);cd+h&&u(d+f)})})})(0).then(function(){if(0{for(var a=Math.min(e.length,r.length),s=-1,u=0;uo(e[u],n[u])?e.substr(0,u)+n[u]+n.substr(u+1):0>o(e[u],r[u])?e.substr(0,u)+r[u]+n.substr(u+1):0<=s?e.substr(0,s)+t[s]+n.substr(s+1):null;0>o(e[u],l)&&(s=u)}return a=o(e[0],e[1])}))return ty(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",U.InvalidArgument);var u,l=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers,f=o;function d(e,t){return f(e[0],t[0])}try{(u=e.reduce(function(e,t){for(var n=0,o=e.length;nr(t[0],i[1])&&0typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604),hasIdb3Features:"getAllRecords"in l},i=n.schema,s=n.hasGetAll,u=n.hasIdb3Features,l=i.tables.map(function(e){var t=e.name;return{name:t,schema:e,mutate:function(e){var n=e.trans,o=e.type,i=e.keys,a=e.values,s=e.range;return new Promise(function(e,u){e=eA(e);var l=n.objectStore(t),c=null==l.keyPath,f="put"===o||"add"===o;if(!f&&"delete"!==o&&"deleteRange"!==o)throw Error("Invalid operation type: "+o);var d,h=(i||a||{length:1}).length;if(i&&a&&i.length!==a.length)throw Error("Given keys array must have same length as given values array.");if(0===h)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++v,tk(e)}var y=[],m=[],v=0;if("deleteRange"===o){if(4===s.type)return e({numFailures:v,failures:m,results:[],lastResult:void 0});3===s.type?y.push(d=l.clear()):y.push(d=l.delete(r(s)))}else{var c=f?c?[a,i]:[a,null]:[i,null],g=c[0],b=c[1];if(f)for(var w=0;wtypeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function tG(e){return e.split(",").map(function(e,t){var n=e.split(":"),r=null==(r=n[1])?void 0:r.trim(),n=(e=n[0].trim()).replace(/([&*]|\+\+)/g,""),o=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return tj(n,o||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(o),0===t,r)})}function tY(){}tY.prototype._createTableSchema=tA,tY.prototype._parseIndexSyntax=tG,tY.prototype._parseStoresSpec=function(e,t){var n=this;i(e).forEach(function(r){if(null!==e[r]){var o=n._parseIndexSyntax(e[r]),i=o.shift();if(!i)throw new U.Schema("Invalid schema for table "+r+": "+e[r]);if(i.unique=!0,i.multi)throw new U.Schema("Primary key cannot be multiEntry*");o.forEach(function(e){if(e.auto)throw new U.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new U.Schema("Index must have a name and cannot be an empty string")}),i=n._createTableSchema(r,i,o),t[r]=i}})},tY.prototype.stores=function(e){var t=this.db,e=(this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e,t._versions),n={},r={};return e.forEach(function(e){s(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)}),t._dbSchema=r,tF(t,[t._allTables,t,t.Transaction.prototype]),tB(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],i(r),r),t._storeNames=i(r),this},tY.prototype.upgrade=function(e){return this._cfg.contentUpgrade=et(this._cfg.contentUpgrade||G,e),this};var tH="u">typeof FinalizationRegistry&&"u">typeof WeakRef?(nS=new Set,nP=new FinalizationRegistry(function(e){nS.delete(e)}),{toArray:function(){return Array.from(nS).map(function(e){return e.deref()}).filter(function(e){return void 0!==e})},add:function(e){var t=new WeakRef(e._novip);nS.add(t),nP.register(e._novip,t,t),nS.size>e._options.maxConnections&&(t=nS.values().next().value,nS.delete(t),nP.unregister(t))},remove:function(e){if(e)for(var t=nS.values(),n=t.next();!n.done;){var r=n.value;if(r.deref()===e._novip)return nS.delete(r),void nP.unregister(r);n=t.next()}}}):(nC=[],{toArray:function(){return nC},add:function(e){nC.push(e._novip)},remove:function(e){e&&-1!==(e=nC.indexOf(e._novip))&&nC.splice(e,1)}});function tQ(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new nx(eJ,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function tX(e){return e&&"function"==typeof e.databases}function tJ(e){return eB(function(){return ey.letThrough=!0,e()})}function tZ(e){return!("from"in e)}var t0=function(e,t){var n;if(!this)return n=new t0,e&&"d"in e&&s(n,e),n;s(this,arguments.length?{d:1,from:e,to:1e5(n,e.from))return r?t1(r,t,n):e.l={from:t,to:n,d:1,l:null,r:null},t5(e);if(0e5(t,e.from)&&(e.from=t,e.l=null,e.d=o?o.d+1:1),0=e5(s.from,o.to)&&0<=e5(s.to,o.from))return!0;0>e5(o.from,s.from)?o=(r=n.next(s.from)).value:s=(a=i.next(o.from)).value}return!1}function t4(e){var t=tZ(e)?null:{s:0,n:e};return{next:function(e){for(var n=0e5(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=e5(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function t5(e){var t,r,o,i=((null==(i=e.r)?void 0:i.d)||0)-((null==(i=e.l)?void 0:i.d)||0),i=1=e5(t.from,e)&&0<=e5(t.to,e)}})[K]=function(){return t4(this)},B));var t8={},ne={},nt=!1;function nn(e){t9(ne,e),nt||(nt=!0,setTimeout(function(){nt=!1,nr(ne,(ne={},!1))},0))}function nr(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(t8);re5(n,r.upper):0>=e5(n,r.upper)))}function ng(e,t,n,r,o,i){var s,u,l,c,f,d,h;return n&&0!==n.length&&(u=(s=t.query.index).multiEntry,l=t.query.range,c=r.schema.primaryKey.extractKey,f=s.extractKey,d=(s.lowLevelIndex||s).extractKey,(r=n.reduce(function(e,n){var r=e,o=[];if("add"===n.type||"put"===n.type)for(var i=new t0,s=n.values.length-1;0<=s;--s){var d,h=n.values[s],p=c(h);!i.hasKey(p)&&(d=f(h),u&&a(d)?d.some(function(e){return nv(e,l)}):nv(d,l))&&(i.addKey(p),o.push(h))}switch(n.type){case"add":var y=(new t0).addKeys(t.values?e.map(function(e){return c(e)}):e),r=e.concat(t.values?o.filter(function(e){return e=c(e),!y.hasKey(e)&&(y.addKey(e),!0)}):o.map(function(e){return c(e)}).filter(function(e){return!y.hasKey(e)&&(y.addKey(e),!0)}));break;case"put":var m=(new t0).addKeys(n.values.map(function(e){return c(e)}));r=e.filter(function(e){return!m.hasKey(t.values?c(e):e)}).concat(t.values?o:o.map(function(e){return c(e)}));break;case"delete":var v=(new t0).addKeys(n.keys);r=e.filter(function(e){return!v.hasKey(t.values?c(e):e)});break;case"deleteRange":var g=n.range;r=e.filter(function(e){return!nv(c(e),g)})}return r},e))!==e)?(h=function(e,t){return e5(d(e),d(t))||e5(c(e),c(t))},r.sort("prev"===t.direction||"prevunique"===t.direction?function(e,t){return h(t,e)}:h),t.limit&&t.limit<1/0&&(r.length>t.limit?r.length=t.limit:e.length===t.limit&&r.length{var o=t8["idb://".concat(e,"/").concat(t)];if(!o)return[];if(!(e=o.queries[n]))return[null,!1,o,null];var i=e[(r.query?r.query.index.name:null)||""];if(!i)return[null,!1,o,null];switch(n){case"query":var a=null!=(s=r.direction)?s:"next",s=i.find(function(e){var t;return e.req.limit===r.limit&&e.req.values===r.values&&(null!=(t=e.req.direction)?t:"next")===a&&nb(e.req.query.range,r.query.range)});return s?[s,!0,o,i]:[i.find(function(e){var t,n,o;return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(null!=(t=e.req.direction)?t:"next")===a&&(!r.values||e.req.values)&&(n=e.req.query.range,o=r.query.range,0>=((e,t,n,r)=>{if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(e=e5(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return -1}return e})(n.lower,o.lower,n.lowerOpen,o.lowerOpen)&&0<=((e,t,n,r)=>{if(void 0===e)return+(void 0!==t);if(void 0===t)return -1;if(0===(e=e5(e,t))){if(n&&r)return 0;if(n)return -1;if(r)return 1}return e})(n.upper,o.upper,n.upperOpen,o.upperOpen))}),!1,o,i];case"count":return[s=i.find(function(e){return nb(e.req.query.range,r.query.range)}),!!s,o,i]}})(t,r,"query",e))[0],s=l[2],u=l[3],c&&l[1]?c.obsSet=e.obsSet:(l=o.query(e).then(function(e){var t=e.result;if(c&&(c.res=t),n){for(var r=0,o=t.length;r0x4000000000000000?0:r.oldVersion)<1,e.idbdb=h.result,a&&function(e,t){tV(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=tU(0,e.idbdb,t);t$(e,e._dbSchema,t);for(var r=0,o=tz(n,e._dbSchema).change;r{if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach(function(t){en&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),tW(n,t)})})(o[r]);if("object"==typeof i)return i.value}}(e,c),s=o/10,u=c,p=e._dbSchema,(u.objectStoreNames.contains("$meta")&&!p.$meta&&(p.$meta=tA("$meta",tG("")[0],[]),e._storeNames.push("$meta")),y=e._createTransaction("readwrite",e._storeNames,p)).create(u),y._completion.catch(l),m=y._reject.bind(y),v=ey.transless||ey,eB(function(){if(ey.trans=y,ey.transless=v,0!==s)return tq(e,u),(y.storeNames.includes("$meta")?y.table("$meta").get("version").then(function(e){return null!=e?e:s}):eb.resolve(s)).then(function(t){var n=t,r=[],t=e._versions,o=e._dbSchema=tU(0,e.idbdb,u);return 0===(t=t.filter(function(e){return e._cfg.version>=n})).length?eb.resolve():(t.forEach(function(t){r.push(function(){var r,a,s,l=o,c=t._cfg.dbschema,f=(t$(e,l,u),t$(e,c,u),o=e._dbSchema=c,tz(l,c)),d=(f.add.forEach(function(e){tL(u,e[0],e[1].primKey,e[1].indexes)}),f.change.forEach(function(e){if(e.recreate)throw new U.Upgrade("Not yet support for changing primary key");var t=u.objectStore(e.name);e.add.forEach(function(e){return tW(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),tW(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})}),t._cfg.contentUpgrade);if(d&&t._cfg.version>n)return tq(e,u),y._memoizedTables={},r=k(c),f.del.forEach(function(e){r[e]=l[e]}),tF(e,[e.Transaction.prototype]),tB(e,[e.Transaction.prototype],i(r),r),y.schema=r,(a=q(d))&&eF(),c=eb.follow(function(){var e;(s=d(y))&&a&&(e=eN.bind(null,null),s.then(e,e))}),s&&"function"==typeof s.then?eb.resolve(s):c.then(function(){return s})}),r.push(function(n){var r=t._cfg.dbschema;[].slice.call(n.db.objectStoreNames).forEach(function(e){return null==r[e]&&n.db.deleteObjectStore(e)}),tF(e,[e.Transaction.prototype]),tB(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),y.schema=e._dbSchema}),r.push(function(n){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===t._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter(function(e){return"$meta"!==e})):n.objectStore("$meta").put(t._cfg.version,"version"))})}),(function e(){return r.length?eb.resolve(r.shift()(y.idbtrans)).then(e):eb.resolve()})().then(function(){tV(o,u)}))}).catch(m);i(p).forEach(function(e){tL(u,e,p[e].primKey,p[e].indexes)}),tq(e,u),eb.follow(function(){return e.on.populate.fire(y)}).catch(m)}))},l),h.onsuccess=eA(function(){c=null;var n,s,l,p,y=e.idbdb=h.result,m=v(y.objectStoreNames);if(0e5(e,t)?e:t},this._IDBKeyRange=s._deps.IDBKeyRange,!this._IDBKeyRange)throw new U.MissingAPI})),this.on("versionchange",function(e){0typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",nO=(nj.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},nj.prototype[ei]=function(){return this},nj);function nj(e){this._subscribe=e}try{nE={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(e){nE={indexedDB:null,IDBKeyRange:null}}function nT(e){var t,n=!1,r=new nO(function(r){var o,i=q(e),a=!1,s={},u={},l={get closed(){return a},unsubscribe:function(){a||(a=!0,o&&o.abort(),c&&tC.storagemutated.unsubscribe(d))}},c=(r.start&&r.start(l),!1),f=function(){return eG(h)},d=function(e){t9(s,e),t7(u,s)&&f()},h=function(){var l,h,p;!a&&nE.indexedDB&&(s={},l={},o&&o.abort(),p=(t=>{var n=eE();try{i&&eF();var r=eB(e,t);return r=i?r.finally(eN):r}finally{n&&eO()}})(h={subscr:l,signal:(o=new AbortController).signal,requery:f,querier:e,trans:null}),c||(tC.storagemutated.subscribe(d),c=!0),Promise.resolve(p).then(function(e){n=!0,t=e,a||h.signal.aborted||(t7(u,s)||t7(u=l,s)?f():(s={},eG(function(){return!a&&r.next&&r.next(e)})))},function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||eG(function(){a||r.error&&r.error(e)})}))};return setTimeout(f,0),l});return r.hasValue=function(){return n},r.getValue=function(){return t},r}function nA(e){var t=nD;try{nD=!0,tC.storagemutated.fire(e),nr(e,!0)}finally{nD=t}}f(nx,n(n({},C),{delete:function(e){return new nx(e,{addons:[]}).delete()},exists:function(e){return new nx(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){var t,n;try{return n=(t=nx.dependencies).indexedDB,t=t.IDBKeyRange,(tX(n)?Promise.resolve(n.databases()).then(function(e){return e.map(function(e){return e.name}).filter(function(e){return e!==eJ})}):tQ(n,t).toCollection().primaryKeys()).then(e)}catch(e){return eY(new U.MissingAPI)}},defineClass:function(){return function(e){s(this,e)}},ignoreTransaction:function(e){return ey.trans?eU(ey.transless||ep,e):e()},vip:tJ,async:function(e){return function(){try{var t=ni(e.apply(this,arguments));return t&&"function"==typeof t.then?t:eb.resolve(t)}catch(e){return eY(e)}}},spawn:function(e,t,n){try{var r=ni(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:eb.resolve(r)}catch(e){return eY(e)}},currentTransaction:{get:function(){return ey.trans||null}},waitFor:function(e,t){return e=eb.resolve("function"==typeof e?nx.ignoreTransaction(e):e).timeout(t||6e4),ey.trans?ey.trans.waitFor(e):e},Promise:eb,debug:{get:function(){return en},set:function(e){en=e}},derive:p,extend:s,props:f,override:g,Events:tn,on:tC,liveQuery:nT,extendObservabilitySet:t9,getByKeyPath:_,setByKeyPath:x,delByKeyPath:function(e,t){"string"==typeof t?x(e,t,void 0):"length"in t&&[].map.call(t,function(t){x(e,t,void 0)})},shallowClone:k,deepClone:j,getObjectDiff:nu,cmp:e5,asap:w,minKey:-1/0,addons:[],connections:{get:tH.toArray},errnames:W,dependencies:nE,cache:t8,semVer:"4.4.6",version:"4.4.6".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),nx.maxKey=tK(nx.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(tC(tS,function(e){nD||(e=new CustomEvent(tP,{detail:e}),nD=!0,dispatchEvent(e),nD=!1)}),addEventListener(tP,function(e){e=e.detail,nD||nA(e)}));var nK,nD=!1,nR=function(){};return"u">typeof BroadcastChannel&&((nR=function(){(nK=new BroadcastChannel(tP)).onmessage=function(e){return e.data&&nA(e.data)}})(),"function"==typeof nK.unref&&nK.unref(),tC(tS,function(e){nD||nK.postMessage(e)})),"u">typeof addEventListener&&(addEventListener("pagehide",function(e){if(!nx.disableBfCache&&e.persisted){en&&console.debug("Dexie: handling persisted pagehide"),null!=nK&&nK.close();for(var t=0,n=tH.toArray();t{"use strict";var t=e.i(960773),n=e.i(989487);e.i(67089);let r="019cfd11-9232-0000-ed38-3cc8663b8948";e.s(["G",0,{Compare:"compare",Rerun:"rerun",TryAnother:"try_another",SelectModelSet:"select_model_set",SelectSynthesizer:"select_synthesizer",ToggleWebSearch:"toggle_web_search",ImprovePrompt:"improve_prompt",ImprovePromptApply:"improve_prompt_apply",AddAttachment:"add_attachment",StopRun:"stop_run",DownloadMarkdown:"download_markdown"},"f",0,function(e){return t.j.capture("survey sent",{$survey_id:r,$survey_response:e}),!0},"U",0,!!r,"V",0,function(e,r){let o,i;o=`model_fusion:${e}`,i=Object.fromEntries(Object.entries(r??{}).map(([e,t])=>[(0,n.h)(e),t])),t.j.capture(o,i)}])},757062,e=>{"use strict";var t=e.i(663456),n=e.i(67089),r=e.i(776175);let o=Symbol.for("Dexie"),i=globalThis[o]||(globalThis[o]=r.default);if(r.default.semVer!==i.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${r.default.semVer} and ${i.semVer}`);let{liveQuery:a,mergeRanges:s,rangesOverlap:u,RangeSet:l,cmp:c,Entity:f,PropModification:d,replacePrefix:h,add:p,remove:y,DexieYProvider:m}=i,v=i;var g=e.i(16043),b=e.i(784814);class w extends v{runs;presets;constructor(){super("MixtureDatabase"),this.version(1).stores({runs:"++id, createdAt"}),this.version(2).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"}),this.version(3).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"}),this.version(4).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"})}}let _=null;function x(){return _||(_=new w),_}let k={get runs(){return x().runs},get modelSets(){return x().presets}};async function S(e){return k.runs.add(e)}async function P(e){return k.runs.orderBy("createdAt").reverse().filter(t=>(0,b.Q)(t,e)).toArray()}async function C(e){return k.modelSets.orderBy("createdAt").filter(t=>(0,b.Q)(t,e)).toArray()}async function E(e,t){await k.runs.update(e,t)}async function O(e){await k.runs.delete(e)}async function j(e){return k.modelSets.add(e)}async function T(e){await k.modelSets.delete(e)}function A(e){return(0,n.L)("Dexie live query error",{error:e})}e.s(["D",0,class{values=new Map;get(e){return this.values.get(e)}set(e,t){this.values.set(e,t)}},"g",0,T,"O",0,O,"K",0,function(e){let t={};for(let[n,r]of Object.entries(e))t[n]={...r,reasoning:r.reasoning??"",isLoading:!1};return t},"U",0,k,"k",0,C,"X",0,P,"W",0,j,"V",0,S,"z",0,function(e){let t={};for(let[n,r]of Object.entries(e))t[n]={content:r.content,reasoning:r.reasoning,error:r.error,errorStatus:r.errorStatus,totalTime:r.totalTime,tokenCount:r.tokenCount};return t},"n",0,E,"_",0,function(e){let n,r,o=(0,t.c)(8),{querier:i,deps:s,defaultValue:u,cache:l,cacheKey:c}=e;o[0]!==l||o[1]!==c||o[2]!==u?(n=()=>(function({cache:e,cacheKey:t,defaultValue:n}){return void 0===e||void 0===t?n:e.get(t)??n})({cache:l,cacheKey:c,defaultValue:u}),o[0]=l,o[1]=c,o[2]=u,o[3]=n):n=o[3];let[f,d]=(0,g.useState)(n);return o[4]!==l||o[5]!==c||o[6]!==i?(r=()=>{let e=a(i).subscribe({next:e=>{void 0!==l&&void 0!==c&&l.set(c,e),d(e)},error:A});return()=>e.unsubscribe()},o[4]=l,o[5]=c,o[6]=i,o[7]=r):r=o[7],(0,g.useEffect)(r,s),f}],757062)},565043,120765,925204,665898,426431,88689,677453,e=>{"use strict";var t=e.i(659350),n=e.i(663456),r=e.i(6146),o=e.i(77825),i=e.i(674896),a=e.i(205194),s=e.i(656921);e.i(707060);var u=e.i(288265),l=e.i(498449),c=e.i(404142),f=e.i(329415),d=e.i(902988),h=e.i(215370),p=e.i(134611),y=e.i(790870),m=e.i(342837),v=e.i(647204),g=e.i(988590),b=e.i(67089),w=e.i(960421),_=e.i(313939),x=e.i(766074),k=e.i(624621),S=e.i(624665),P=e.i(679728),C=e.i(757062);let E={phase:"idle",isAnalyzing:!1,error:null,startTime:null,endTime:null};var O=e.i(810632),j=e.i(10758),T=e.i(55569),A=e.i(393182),K=e.i(948913),D=e.i(387086),R=e.i(357107),I=e.i(423491),M=e.i(711359),q=e.i(549692);async function*B(e){for await(let t of(0,M.f)(e)){if((0,v.V)(t))return void(yield(0,q.O)({status:m.g.S502_Bad_Gateway,rawError:t.error,location:"processStream:sse"}));if(t.data===I.f)break;let e=(0,v.$)(()=>JSON.parse(t.data));if((0,v.V)(e))return void(yield(0,q.O)({status:m.g.S502_Bad_Gateway,rawError:e.error,location:"processStream:json-parse"}));let n=e.data;if("error"===n.type||(0,q.w)(n)){let e=n.error??n.message??"Unknown streaming error";yield(0,q.O)({rawError:e,location:"processStream:streaming",metadata:n.error?.metadata});return}yield(0,v.N)(n)}}async function F(e){let{config:t,callbacks:n,signal:r,reject:o}=e,i={content:{},reasoning:{},analysis:null,synthesis:"",didCompleteFusionCall:!1,didCompleteSynthesis:!1,preFusionText:"",responses:[],failedModels:[]};try{var a,s,u;let e,l=await fetch("/api/v1/responses",{method:"POST",headers:{"Content-Type":"application/json",...function(e){let{origin:t,pathname:n}=window.location;return{"HTTP-Referer":`${t}${n}`,"X-OpenRouter-Title":e}}("OpenRouter: Fusion")},body:JSON.stringify((a=t,e=[{type:"input_text",text:a.prompt},...a.contentParts??[]],{model:A.f.Fusion,stream:!0,tool_choice:"required",...void 0!==a.maxCompletionTokens?{max_output_tokens:a.maxCompletionTokens}:{},input:[{role:"user",content:e}],tools:[{type:K.d.OpenRouterFusion,parameters:{analysis_models:a.analysisModels,model:a.analystModel,...a.reasoning?{reasoning:a.reasoning}:{},...void 0!==a.temperature?{temperature:a.temperature}:{},...void 0!==a.maxCompletionTokens?{max_completion_tokens:a.maxCompletionTokens}:{},...void 0!==a.webSearchEnabled?{web_search:a.webSearchEnabled}:{}}}]})),cache:"no-store",signal:r});if(!l.ok){let e,t=await l.text();n.onError({message:(s=t,e=(0,T.N)(s),null!==e&&"object"==typeof e&&e.error?.metadata?.code===O.I)?O.F:t||`HTTP ${l.status}`,stage:"connection",reason:"http_error"});return}if(!l.body)return void n.onError({message:"Empty response body",stage:"connection",reason:"empty_body"});let c=!1,f={...n,onDone:e=>{c=!0,n.onDone(e)},onError:e=>{c=!0,n.onError(e)}};for await(let e of B(l.body)){if(r?.aborted)break;if((0,v.V)(e)){return void f.onError({message:(0,j.t)(e.error)?O.F:(u=e.error,"string"==typeof u?u:u instanceof Error||null!==u&&"object"==typeof u&&"message"in u&&"string"==typeof u.message?u.message:(0,R.q)((0,D.b)("Fusion stream failed"))),stage:"stream",reason:"stream_error"})}!function(e){let{event:t,accumulator:n,callbacks:r}=e;switch(t.type){case"response.fusion_call.panel.added":n.content[t.model]="",n.reasoning[t.model]="",r.onPanelDelta(t.model,{content:"",reasoning:"",isLoading:!0,error:null});return;case"response.fusion_call.panel.delta":n.content[t.model]=(n.content[t.model]??"")+t.delta,r.onPanelDelta(t.model,{content:n.content[t.model]??"",reasoning:n.reasoning[t.model]??"",isLoading:!0,error:null});return;case"response.fusion_call.panel.reasoning.delta":n.reasoning[t.model]=(n.reasoning[t.model]??"")+t.delta,r.onPanelDelta(t.model,{content:n.content[t.model]??"",reasoning:n.reasoning[t.model]??"",isLoading:!0,error:null});return;case"response.fusion_call.panel.completed":n.content[t.model]=t.content,n.responses.push({model:t.model,content:t.content}),r.onPanelComplete({model:t.model,content:t.content,reasoning:n.reasoning[t.model]??""});return;case"response.fusion_call.panel.failed":n.failedModels.push({model:t.model,error:t.error,...void 0!==t.status_code?{status_code:t.status_code}:{}}),r.onPanelError({model:t.model,error:t.error,statusCode:t.status_code});return;case"response.fusion_call.analysis.in_progress":return r.onAnalysisStarted();case"response.fusion_call.analysis.completed":n.analysis=t.analysis,r.onAnalysisComplete(t.analysis);return;case"response.fusion_call.completed":n.didCompleteFusionCall=!0;return;case"response.output_text.delta":if(!n.didCompleteFusionCall){n.preFusionText+=t.delta;return}n.synthesis+=t.delta,r.onSynthesisDelta(n.synthesis);return;case"response.output_text.done":n.didCompleteFusionCall&&""!==n.synthesis&&(n.didCompleteSynthesis=!0);return;case"response.completed":case"response.incomplete":n.didCompleteFusionCall||""!==n.synthesis||""===n.preFusionText||(n.synthesis=n.preFusionText,r.onSynthesisDelta(n.synthesis)),r.onDone({analysis:n.analysis??N,responses:n.responses,failed_models:n.failedModels});return;case"response.failed":if(n.didCompleteSynthesis){(0,b.L)("fusion synthesis completed but stream emitted a trailing response.failed",{error_message:t.response.error?.message??null,error_code:t.response.error?.code??null}),r.onDone({analysis:n.analysis??N,responses:n.responses,failed_models:n.failedModels});return}r.onError({message:t.response.error?.message??"Fusion run failed before completion",stage:"server",reason:t.response.error?.code??"response_failed"})}}({event:e.data,accumulator:i,callbacks:f})}c||o(r?.aborted?{message:"Aborted",stage:"connection",reason:"aborted"}:{message:"Stream ended without completion event",stage:"connection",reason:"unexpected_end"})}catch(e){if(r?.aborted)return void o({message:"Aborted",stage:"connection",reason:"aborted"});n.onError({message:e instanceof Error?e.message:"Stream connection failed",stage:"connection",reason:"fetch_error"})}}e.s(["f",0,B],120765);let N={consensus:[],contradictions:[],partial_coverage:[],unique_insights:[],blind_spots:[]};var z=e.i(16043),L=e.i(556295);let V={runs:{}},W=new Map,U=new Map,$=new Map,G=new Map,Y=new Map,H=new Map;function Q(e,t){let n=e.runs[t];if(n)return n;let r={responses:{},analysisContent:null,synthesisContent:null};return e.runs[t]=r,r}let X=(0,_.f)()((0,L.f)(e=>({...V,setResponses:(t,n)=>{e(e=>{Q(e,t).responses=n})},queueResponseUpdate:({runId:t,slug:n,response:r})=>{let o=W.get(t);if(o||(o=new Map,W.set(t,o)),o.set(n,r),!U.has(t)){let n=setTimeout(()=>{let n=W.get(t);n&&0!==n.size?e(e=>{let r=Q(e,t);for(let[e,t]of n)r.responses[e]=t;n.clear(),U.delete(t)}):U.delete(t)},100);U.set(t,n)}},setAnalysisContent:(t,n)=>{if(null===n){$.delete(t);let n=G.get(t);n&&(clearTimeout(n),G.delete(t)),e(e=>{Q(e,t).analysisContent=null});return}if($.set(t,{value:n}),!G.has(t)){let n=setTimeout(()=>{let n=$.get(t);e(e=>{n&&(Q(e,t).analysisContent=n.value),$.delete(t),G.delete(t)})},100);G.set(t,n)}},setSynthesisContent:(t,n)=>{if(null===n||""===n){Y.delete(t);let r=H.get(t);r&&(clearTimeout(r),H.delete(t)),e(e=>{Q(e,t).synthesisContent=n});return}if(Y.set(t,{value:n}),!H.has(t)){let n=setTimeout(()=>{let n=Y.get(t);e(e=>{n&&(Q(e,t).synthesisContent=n.value),Y.delete(t),H.delete(t)})},100);H.set(t,n)}},flushPending:t=>{let n=W.get(t),r=$.get(t),o=Y.get(t),i=void 0!==n&&n.size>0,a=void 0!==r,s=void 0!==o;(i||a||s)&&e(e=>{let u=Q(e,t);if(i&&n){for(let[e,t]of n)u.responses[e]=t;n.clear();let e=U.get(t);e&&(clearTimeout(e),U.delete(t))}if(a&&r){u.analysisContent=r.value,$.delete(t);let e=G.get(t);e&&(clearTimeout(e),G.delete(t))}if(s&&o){u.synthesisContent=o.value,Y.delete(t);let e=H.get(t);e&&(clearTimeout(e),H.delete(t))}})},clearRun:t=>{let n,r,o,i;(n=W.get(t))&&(n.clear(),W.delete(t)),(r=U.get(t))&&(clearTimeout(r),U.delete(t)),$.delete(t),(o=G.get(t))&&(clearTimeout(o),G.delete(t)),Y.delete(t),(i=H.get(t))&&(clearTimeout(i),H.delete(t)),e(e=>{delete e.runs[t]})}})));function J(e,t){return null===t?{}:e.runs[t]?.responses??{}}function Z(e,t){return null===t?null:e.runs[t]?.analysisContent??null}function ee(e,t){return null===t?null:e.runs[t]?.synthesisContent??null}e.s(["P",0,Z,"A",0,J,"R",0,ee,"e",0,function(e){let t,r=(0,n.c)(2);return r[0]!==e?(t=t=>Z(t,e),r[0]=e,r[1]=t):t=r[1],X(t)},"H",0,X,"J",0,function(e,t){let r,o=(0,n.c)(3);return o[0]!==e||o[1]!==t?(r=n=>null!==e?n.runs[e]?.responses[t]:void 0,o[0]=e,o[1]=t,o[2]=r):r=o[2],X(r)},"Y",0,function(e){let t,r=(0,n.c)(2);return r[0]!==e?(t=t=>ee(t,e),r[0]=e,r[1]=t):t=r[1],X(t)}],925204);let et="Insufficient credits to run models.";function en(e,t){return null!==e&&"object"==typeof e&&"message"in e&&e.message===O.F?O.F:Object.values(t).some(e=>e.errorStatus===m.g.S402_Payment_Required)?et:"Fusion failed. You can retry from the results view."}e.s(["D",0,et,"w",0,en],665898);let er=new Map;function eo(e){return er.has(e)}function ei(e){let t=er.get(e);t&&(t.abort(),er.delete(e))}function ea(e){er.delete(e)}let es={phase:"idle",prompt:"",isAnalyzing:!1,startTime:null,endTime:null,error:null,attachmentContentParts:[],resetGeneration:0,currentRunDbId:null},eu=(0,_.f)()((0,x.V)((e,t)=>{let n=(n,r)=>{let o,{runLifecycles:i}=t(),a=i[n]??E,s=function(e,t){switch(t.type){case"started":return{phase:"streaming",isAnalyzing:!1,error:null,startTime:t.startTime,endTime:null};case"restarted":return{...e,phase:"streaming",isAnalyzing:!1,error:null};case"analysisStarted":return"streaming"!==e.phase||e.isAnalyzing?e:{...e,isAnalyzing:!0};case"analysisCompleted":return{...e,phase:"all-complete",isAnalyzing:!1};case"synthesisStarted":return"synthesizing"===e.phase?e:{...e,phase:"synthesizing",isAnalyzing:!1,error:null};case"firstPassFailed":return{...e,phase:"all-complete",isAnalyzing:!1,error:t.error};case"completed":return{...e,phase:"complete",isAnalyzing:!1,endTime:t.endTime};case"failed":return{...e,phase:"idle",isAnalyzing:!1,error:t.error};case"stopped":return"complete"===e.phase||"idle"===e.phase?e:{...e,phase:"all-complete",isAnalyzing:!1,error:null,endTime:t.endTime};default:return t}}(a,r);if(s===a)return;let u={runLifecycles:{...i,[n]:s}};n===t().currentRunDbId&&Object.assign(u,(o={},s.phase!==a.phase&&(o.phase=s.phase),s.isAnalyzing!==a.isAnalyzing&&(o.isAnalyzing=s.isAnalyzing),s.error!==a.error&&(o.error=s.error),s.startTime!==a.startTime&&(o.startTime=s.startTime),s.endTime!==a.endTime&&(o.endTime=s.endTime),o)),e(u)},r=async(r,o)=>{let i,a=(ei(r),i=new AbortController,er.set(r,i),i),s=await (0,v.$)(async()=>{let i=Date.now();n(r,{type:"started",startTime:i}),e({currentRunDbId:r,phase:"streaming",isAnalyzing:!1,startTime:i,endTime:null,error:null});let s=(e,t)=>{a.signal.aborted||X.getState().queueResponseUpdate({runId:r,slug:e,response:t})},u=o.synthesizerSlug;u||(u=(0,p.i)(o.selectedModels[0])),o.synthesizerSlug=u;let l=await (0,v.$)(()=>{var e,t,i;return e={prompt:o.prompt,analysisModels:o.selectedModels.map(e=>(0,p.i)(e)),analystModel:u,maxCompletionTokens:o.maxCompletionTokens??void 0,reasoning:o.reasoningEffort?{effort:o.reasoningEffort}:void 0,temperature:o.temperature??void 0,webSearchEnabled:o.isWebSearchEnabled,contentParts:o.attachmentContentParts.length>0?o.attachmentContentParts:void 0},t={onPanelDelta:(e,t)=>{s(e,t)},onPanelComplete:({model:e,content:t,reasoning:n})=>{s(e,{content:t,reasoning:n,isLoading:!1,error:null})},onPanelError:({model:e,error:t,statusCode:n})=>{s(e,{content:"",reasoning:"",isLoading:!1,error:t,errorStatus:(0,g.q)(n,m.g)?n:null})},onAnalysisStarted:()=>{n(r,{type:"analysisStarted"})},onAnalysisComplete:e=>{X.getState().setAnalysisContent(r,e),n(r,{type:"analysisCompleted"})},onSynthesisDelta:e=>{a.signal.aborted||(n(r,{type:"synthesisStarted"}),X.getState().setSynthesisContent(r,e))},onDone:()=>{},onError:()=>{}},i=a.signal,new Promise((n,r)=>{F({config:e,callbacks:{...t,onDone:e=>{t.onDone(e),n(e)},onError:e=>{t.onError(e),r(e)}},signal:i,reject:r})})});if(a.signal.aborted)return;if((0,v.V)(l)){X.getState().flushPending(r);let e=J(X.getState(),r);if(r>0){let t=X.getState(),n=await (0,v.$)(()=>(0,C.n)(r,{responses:(0,C.z)(e),analysisContent:Z(t,r),synthesisContent:ee(t,r)??null,synthesizerSlug:u}));(0,v.V)(n)&&(0,b.L)("Failed to persist partial fusion run after error",{error:n.error})}return n(r,{type:"firstPassFailed",error:en(l.error,e)}),ea(r),k.f.getState().isChatNotificationsEnabled&&(0,S.c)("first-pass-error"),r>0?r:void 0}X.getState().flushPending(r);let c=J(X.getState(),r),f=ee(X.getState(),r);if(r===t().currentRunDbId&&e({synthesizerSlug:u}),r>0){let e=await (0,v.$)(()=>(0,C.n)(r,{responses:(0,C.z)(c),analysisContent:l.data.analysis,synthesisContent:f??null,isSynthesized:!!f,synthesizerSlug:u,isComplete:!0}));(0,v.V)(e)&&(0,b.L)("Failed to update fusion run in Dexie",{error:e.error})}return n(r,{type:"completed",endTime:Date.now()}),ea(r),k.f.getState().isChatNotificationsEnabled&&(0,S.c)("final-pass"),r>0?r:void 0});if((0,v.V)(s)){let e=a.signal.aborted;e||(0,b.L)("Unexpected error in fusion run",{error:s.error}),ea(r),e||n(r,{type:"failed",error:"Something went wrong. Please try again."});return}return s.data};return{...es,runLifecycles:{},workspacePartitionId:null,didResolveWorkspacePartition:!1,selectedModelSet:y.j,selectedModels:[],isSidebarOpen:!0,synthesizerSlug:y.b,isWebSearchEnabled:!0,reasoningEffort:w.n.High,temperature:null,maxCompletionTokens:null,setPrompt:t=>e({prompt:t}),selectModelSet:(t,n)=>{e({selectedModelSet:t,selectedModels:n}),"custom"!==t&&"number"!=typeof t&&(0,P.V)(P.G.SelectModelSet,{modelSetId:t})},setSelectedModels:t=>e({selectedModels:t}),toggleCustomModel:n=>{let{selectedModels:r}=t(),o=(0,p.i)(n);r.some(e=>(0,p.i)(e)===o)?e({selectedModels:r.filter(e=>(0,p.i)(e)!==o)}):e({selectedModels:[...r,n]})},removeModel:n=>{let{selectedModels:r}=t();e({selectedModelSet:"custom",selectedModels:r.filter(e=>(0,p.i)(e)!==n)})},setSynthesizerSlug:t=>{e({synthesizerSlug:t}),t&&(0,P.V)(P.G.SelectSynthesizer,{})},setWebSearchEnabled:t=>{e({isWebSearchEnabled:t}),(0,P.V)(P.G.ToggleWebSearch)},setReasoningEffort:t=>e({reasoningEffort:t}),setTemperature:t=>e({temperature:t}),setMaxCompletionTokens:t=>e({maxCompletionTokens:t}),setAttachmentContentParts:t=>e({attachmentContentParts:t}),compare:async()=>{let n,{prompt:o,selectedModels:a,didResolveWorkspacePartition:s}=t();if(!s||!o.trim()||a.length<2)return;(0,S.z)().catch(()=>{});let u={prompt:o,selectedModels:[...a],synthesizerSlug:t().synthesizerSlug,isWebSearchEnabled:t().isWebSearchEnabled,reasoningEffort:t().reasoningEffort,temperature:t().temperature,maxCompletionTokens:t().maxCompletionTokens,attachmentContentParts:[...t().attachmentContentParts]},{selectedModelSet:l}=t(),c=a.map(e=>(0,p.i)(e));(0,P.V)(P.G.Compare,{modelCount:a.length,promptLength:o.length}),e({phase:"streaming",isAnalyzing:!1,error:null});let f=(0,i.P)(window.location.pathname,i.L.Fusion),d=await (0,v.$)(()=>(0,C.V)({createdAt:new Date,prompt:o,presetId:l,modelSlugs:c,responses:{},isSynthesized:!1,synthesizerSlug:null,synthesisContent:null,analysisContent:null,isWebSearchEnabled:u.isWebSearchEnabled,isComplete:!1,workspaceId:t().workspacePartitionId??void 0}));return(0,v.V)(d)?((0,b.L)("Failed to save run to Dexie",{error:d.error}),n=-Date.now()):(n=d.data,null!==f&&window.history.replaceState(null,"",`${f}/${n}`)),r(n,u)},rerun:async()=>{let{prompt:e,selectedModels:o,currentRunDbId:i}=t();if(null===i||!e.trim()||o.length<2)return;(0,S.z)().catch(()=>{});let a={prompt:e,selectedModels:[...o],synthesizerSlug:t().synthesizerSlug,isWebSearchEnabled:t().isWebSearchEnabled,reasoningEffort:t().reasoningEffort,temperature:t().temperature,maxCompletionTokens:t().maxCompletionTokens,attachmentContentParts:[...t().attachmentContentParts]};if((0,P.V)(P.G.Rerun,{modelCount:o.length,promptLength:e.length}),ei(i),X.getState().clearRun(i),n(i,{type:"restarted"}),i>0){let e=await (0,v.$)(()=>(0,C.n)(i,{responses:{},analysisContent:null,synthesisContent:null,isSynthesized:!1,isComplete:!1}));(0,v.V)(e)&&(0,b.L)("Failed to reset fusion run before rerun",{error:e.error})}await r(i,a)},tryAnother:()=>{(0,P.V)(P.G.TryAnother,{}),t().resetWorkspace()},stopRun:e=>{let r=e??t().currentRunDbId;null===r||er.has(r)&&((0,P.V)(P.G.StopRun,{}),ei(r),X.getState().setSynthesisContent(r,null),X.getState().flushPending(r),n(r,{type:"stopped",endTime:Date.now()}))},resetWorkspace:()=>{e({...es,resetGeneration:t().resetGeneration+1})},setWorkspacePartition:n=>{let{workspacePartitionId:r,didResolveWorkspacePartition:o,resetGeneration:i}=t();if(!o)return void e({workspacePartitionId:n,didResolveWorkspacePartition:!0});if(r===n)return;let{selectedModelSet:a}=t();e({...es,workspacePartitionId:n,resetGeneration:i+1,..."number"==typeof a?{selectedModelSet:y.j,selectedModels:[]}:{}})},initializeFromRun:(n,r)=>{e({...es,resetGeneration:t().resetGeneration+1,prompt:n,selectedModelSet:r})},loadPastRun:(n,r)=>{let o=(0,C.K)(n.responses),i=n.modelSlugs[0]??null,a=n.id??null;if(null!==a&&!eo(a)){let e=X.getState();e.setResponses(a,o),e.setAnalysisContent(a,n.analysisContent??null),e.setSynthesisContent(a,n.synthesisContent),e.flushPending(a)}let s=null!==a?t().runLifecycles[a]:void 0,u=s?.phase??(n.isSynthesized?"complete":"all-complete"),l=s?.isAnalyzing??!1,c=s?.error??null,f=s?.startTime??n.createdAt.getTime(),d=s?.endTime??n.createdAt.getTime();e({resetGeneration:t().resetGeneration+1,phase:u,prompt:n.prompt,selectedModelSet:n.presetId,selectedModels:r??[],synthesizerSlug:n.synthesizerSlug??i,isWebSearchEnabled:n.isWebSearchEnabled??!1,isAnalyzing:l,startTime:f,endTime:d,error:c,attachmentContentParts:[],currentRunDbId:a})},deleteRun:async n=>{ei(n),X.getState().clearRun(n);let{runLifecycles:r}=t(),{[n]:o,...i}=r;n===t().currentRunDbId?e({...es,runLifecycles:i,resetGeneration:t().resetGeneration+1}):e({runLifecycles:i});let a=await (0,v.$)(()=>(0,C.O)(n));(0,v.V)(a)&&(0,b.L)("Failed to delete run from Dexie",{error:a.error})},toggleSidebar:()=>{let{isSidebarOpen:n}=t();e({isSidebarOpen:!n})},saveModelSet:async n=>{let{selectedModels:r,didResolveWorkspacePartition:o}=t();if(!o)return;let i=r.map(e=>(0,p.i)(e)),a=await (0,v.$)(()=>(0,C.W)({label:n,modelSlugs:i,createdAt:new Date,workspaceId:t().workspacePartitionId??void 0}));(0,v.V)(a)?(0,b.L)("Failed to save model set to Dexie",{error:a.error}):e({selectedModelSet:a.data})},deleteUserModelSet:async n=>{let{selectedModelSet:r}=t(),o=await (0,v.$)(()=>(0,C.g)(n));(0,v.V)(o)?(0,b.L)("Failed to delete model set from Dexie",{error:o.error}):r===n&&e({selectedModelSet:"custom"})}}},{name:"openrouter:mixture-settings",version:2,storage:(0,x.j)(()=>localStorage),partialize:e=>({synthesizerSlug:e.synthesizerSlug,isWebSearchEnabled:e.isWebSearchEnabled,maxCompletionTokens:e.maxCompletionTokens,reasoningEffort:e.reasoningEffort,temperature:e.temperature,prompt:e.prompt,selectedModelSet:e.selectedModelSet,modelSlugs:e.selectedModels.map(p.i)}),migrate:(e,t)=>{if(0===t&&null!=e&&"object"==typeof e&&"selectedPreset"in e){let{selectedPreset:t,...n}=e;return{...n,selectedModelSet:t,synthesizerSlug:y.b}}return t<=1&&null!=e&&"object"==typeof e&&"synthesizerSlug"in e&&null===e.synthesizerSlug?{...e,synthesizerSlug:y.b}:e}}));function el(){let e=(0,h.f)(),t=eu(ef);return eu(ec)&&e.isReady&&e.partitionId===t}function ec(e){return e.didResolveWorkspacePartition}function ef(e){return e.workspacePartitionId}e.s(["p",0,eo,"B",0,eu],426431),e.s(["f",0,el],88689);var ed=e.i(797521),eh=e.i(359980),ep=e.i(196991),ey=e.i(153746),em=e.i(649896),ev=e.i(485741),eg=e.i(525567),eb=e.i(194215),ew=e.i(136562),e_=e.i(82045),ex=e.i(139697),ek=e.i(624112),eS=e.i(751155),eP=e.i(463686);e.i(406201);var eC=e.i(967605);function eE(e){let r,o,s,u,l=(0,n.c)(17),{run:c}=e,f=eu(eT),d=eu(ej),h=eu(eO),p=(0,a.f)(),y=(0,i.W)(i.L.Fusion),m=(0,eP.useParams)(),v=m?.runId?Number(m.runId):null,g=v?c.id===v:c.id===f;l[0]!==c.id?(r=e=>{if(void 0===c.id)return!1;let t=e.runLifecycles[c.id];return t?"streaming"===t.phase||"synthesizing"===t.phase||t.isAnalyzing:eo(c.id)},l[0]=c.id,l[1]=r):r=l[1];let b=eu(r);l[2]!==d||l[3]!==y||l[4]!==g||l[5]!==p||l[6]!==c.id?(o=async()=>{void 0!==c.id&&(await d(c.id),g&&p.push(y))},l[2]=d,l[3]=y,l[4]=g,l[5]=p,l[6]=c.id,l[7]=o):o=l[7];let w=o;l[8]!==c.id||l[9]!==h?(s=()=>{void 0!==c.id&&h(c.id)},l[8]=c.id,l[9]=h,l[10]=s):s=l[10];let _=s;return l[11]!==w||l[12]!==_||l[13]!==g||l[14]!==b||l[15]!==c?(u=(0,t.jsx)(eA,{run:c,isActive:g,isInProgress:b,onDelete:w,onStop:_}),l[11]=w,l[12]=_,l[13]=g,l[14]=b,l[15]=c,l[16]=u):u=l[16],u}function eO(e){return e.stopRun}function ej(e){return e.deleteRun}function eT(e){return e.currentRunDbId}function eA(e){let r,o,a,s,l,c,f,d,h,p,y,m,v,g,b,w,_,x,k,S,P,C,E,O,j=(0,n.c)(53),{run:T,isActive:A,isInProgress:K,onDelete:D,onStop:R}=e,I=(0,u.f)(),[M,q]=(0,z.useState)(!1),[B,F]=(0,z.useState)(!1),N=(0,i.W)(i.L.Fusion);j[0]!==T.prompt?(r=T.prompt.length>40?`${T.prompt.slice(0,40)}…`:T.prompt,j[0]=T.prompt,j[1]=r):r=j[1];let L=r,V=`${N}/${T.id}`,W=A?"bg-accent text-accent-foreground":"hover:bg-card-hover";j[2]!==W?(o=(0,ew.f)("ph-no-capture group relative flex h-9 w-full items-center rounded-lg pr-1 transition-colors",W),j[2]=W,j[3]=o):o=j[3];let U=A&&"text-accent-foreground";j[4]!==U?(a=(0,ew.f)("flex h-full min-w-0 flex-1 items-center gap-2 pl-3 pr-2 text-sm font-medium","text-muted-foreground hover:text-accent-foreground",U),j[4]=U,j[5]=a):a=j[5],j[6]!==K?(s=K&&(0,t.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60"}),(0,t.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-primary"})]}),j[6]=K,j[7]=s):s=j[7],j[8]!==L?(l=L||(0,t.jsx)(ep.T,{children:"Empty prompt"}),j[8]=L,j[9]=l):l=j[9],j[10]!==l?(c=(0,t.jsx)("span",{className:"truncate text-sm",children:l}),j[10]=l,j[11]=c):c=j[11],j[12]!==T.prompt||j[13]!==V||j[14]!==a||j[15]!==s||j[16]!==c?(f=(0,t.jsxs)(eC.Link,{href:V,className:a,title:T.prompt,children:[s,c]}),j[12]=T.prompt,j[13]=V,j[14]=a,j[15]=s,j[16]=c,j[17]=f):f=j[17],j[18]!==I||j[19]!==K||j[20]!==R?(d=K&&(0,t.jsx)(eS.Tooltip,{content:I("Stop this fusion"),children:(0,t.jsx)(ex.Button,{variant:"ghost-muted",size:"icon-sm",onClick:e=>{e.stopPropagation(),e.preventDefault(),R()},"aria-label":I("Stop run"),children:(0,t.jsx)(eg.f,{className:"h-4 w-4"})})}),j[18]=I,j[19]=K,j[20]=R,j[21]=d):d=j[21];let $=A&&"opacity-100";return j[22]!==$?(h=(0,ew.f)("group-hover:opacity-100 focus-visible:opacity-100 md:opacity-0","data-[state=open]:opacity-100",$,"hover:bg-transparent dark:hover:bg-transparent"),j[22]=$,j[23]=h):h=j[23],j[24]!==I?(p=I("Run actions"),j[24]=I,j[25]=p):p=j[25],j[26]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsx)(ev.f,{className:"size-5"}),j[26]=y):y=j[26],j[27]!==h||j[28]!==p?(m=(0,t.jsx)(ek.J,{render:(0,t.jsx)(ex.Button,{variant:"ghost",size:"icon-sm",className:h,"aria-label":p,children:y})}),j[27]=h,j[28]=p,j[29]=m):m=j[29],j[30]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{q(!1),F(!0)},g=(0,t.jsx)(eb.f,{className:"size-4"}),j[30]=v,j[31]=g):(v=j[30],g=j[31]),j[32]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)(ek.T,{side:"right",text:"body",className:"w-48 p-1.5",children:(0,t.jsxs)(ex.Button,{align:"start",size:"sm",variant:"ghost",className:"w-full text-negative hover:text-negative",onClick:v,children:[g," ",(0,t.jsx)(ep.T,{children:"Delete"})]})}),j[32]=b):b=j[32],j[33]!==M||j[34]!==m?(w=(0,t.jsxs)(ek.V,{open:M,onOpenChange:q,children:[m,b]}),j[33]=M,j[34]=m,j[35]=w):w=j[35],j[36]!==d||j[37]!==w?(_=(0,t.jsxs)("div",{className:"flex items-center",children:[d,w]}),j[36]=d,j[37]=w,j[38]=_):_=j[38],j[39]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(e_.g,{children:(0,t.jsx)(ep.T,{children:"Delete fusion"})}),j[39]=x):x=j[39],j[40]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsxs)(e_.O,{children:[x,(0,t.jsx)(e_.I,{children:(0,t.jsx)(ep.T,{children:"This will permanently delete this fusion. This action cannot be undone."})})]}),j[40]=k):k=j[40],j[41]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(e_.D,{children:(0,t.jsx)(ep.T,{children:"Cancel"})}),j[41]=S):S=j[41],j[42]===Symbol.for("react.memo_cache_sentinel")?(P=(0,t.jsx)(ep.T,{children:"Delete"}),j[42]=P):P=j[42],j[43]!==D?(C=(0,t.jsxs)(e_.B,{children:[k,(0,t.jsxs)(e_._,{children:[S,(0,t.jsx)(e_.s,{render:(0,t.jsx)(ex.Button,{variant:"destructive",onClick:D,children:P})})]})]}),j[43]=D,j[44]=C):C=j[44],j[45]!==B||j[46]!==C?(E=(0,t.jsx)(e_.m,{open:B,onOpenChange:F,children:C}),j[45]=B,j[46]=C,j[47]=E):E=j[47],j[48]!==_||j[49]!==E||j[50]!==o||j[51]!==f?(O=(0,t.jsxs)("div",{className:o,"data-dd-privacy":"hidden",children:[f,_,E]}),j[48]=_,j[49]=E,j[50]=o,j[51]=f,j[52]=O):O=j[52],O}let eK=[],eD=new C.D;function eR(){let e,r,o,i,a,s,l,c,f,d,h,p,y,m,v,g,b,w=(0,n.c)(42),_=(0,ed.f)(),x=(0,u.f)(),[k,S]=(0,z.useState)(""),[P,E]=(0,z.useState)(k),O=eu(eq),j=eu(eM);w[0]!==k?(e=()=>{let e=setTimeout(()=>{E(k)},250);return()=>clearTimeout(e)},r=[k],w[0]=k,w[1]=e,w[2]=r):(e=w[1],r=w[2]),(0,z.useEffect)(e,r),w[3]!==j||w[4]!==O?(o=()=>j?(0,C.X)(O):Promise.resolve(eK),i=[O,j],w[3]=j,w[4]=O,w[5]=o,w[6]=i):(o=w[5],i=w[6]);let T=`fusion-runs:${O??"legacy"}`;w[7]!==o||w[8]!==i||w[9]!==T?(a={querier:o,deps:i,defaultValue:eK,cache:eD,cacheKey:T},w[7]=o,w[8]=i,w[9]=T,w[10]=a):a=w[10];let A=(0,C._)(a);w[11]!==P||w[12]!==A?(l=(s=P.trim().toLowerCase())?A.filter(e=>e.prompt.toLowerCase().includes(s)):A,w[11]=P,w[12]=A,w[13]=s,w[14]=l):(s=w[13],l=w[14]);let K=l;w[15]!==x?(c=x("Search runs..."),w[15]=x,w[16]=c):c=w[16],w[17]!==k||w[18]!==c?(f=(0,t.jsx)(em.f,{placeholder:c,value:k,onValueChange:S}),w[17]=k,w[18]=c,w[19]=f):f=w[19],w[20]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("div",{"aria-hidden":"true",className:"shrink-0 -mx-2 py-4",children:(0,t.jsx)("div",{className:"h-px bg-border"})}),w[20]=d):d=w[20];let D=K.length;return w[21]!==_||w[22]!==K.length?(h=_.number(K.length,{preset:"integer"}),w[21]=_,w[22]=K.length,w[23]=h):h=w[23],w[24]!==h?(p=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ey.d,{children:h})," run"]}),w[24]=h,w[25]=p):p=w[25],w[26]!==_||w[27]!==K.length?(y=_.number(K.length,{preset:"integer"}),w[26]=_,w[27]=K.length,w[28]=y):y=w[28],w[29]!==y?(m=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ey.d,{children:y})," runs"]}),w[29]=y,w[30]=m):m=w[30],w[31]!==p||w[32]!==m||w[33]!==K.length?(v=(0,t.jsx)("div",{className:"flex h-7 shrink-0 items-center",children:(0,t.jsx)("span",{className:"inline-flex h-7 items-center pl-3 text-xs font-medium text-muted-foreground",children:(0,t.jsx)(ep.T,{children:(0,t.jsx)(eh.f,{n:D,one:p,other:m})})})}),w[31]=p,w[32]=m,w[33]=K.length,w[34]=v):v=w[34],w[35]!==s||w[36]!==K?(g=(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",children:0===K.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:s?(0,t.jsx)(ep.T,{children:"No matching runs."}):(0,t.jsx)(ep.T,{children:"No runs yet."})}):(0,t.jsx)("div",{className:"flex flex-col gap-y-0.5",children:K.map(eI)})}),w[35]=s,w[36]=K,w[37]=g):g=w[37],w[38]!==v||w[39]!==g||w[40]!==f?(b=(0,t.jsxs)("div",{className:"flex h-full min-h-0 w-full flex-col gap-2",children:[f,d,v,g]}),w[38]=v,w[39]=g,w[40]=f,w[41]=b):b=w[41],b}function eI(e){return(0,t.jsx)(eE,{run:e},e.id)}function eM(e){return e.didResolveWorkspacePartition}function eq(e){return e.workspacePartitionId}function eB(e){let r,h,p,y,m,v,g,b,w,_=(0,n.c)(32),{isEmbedded:x,isActive:k}=e,S=void 0!==x&&x,P=void 0===k||k,C=(0,u.f)(),E=eu(ez),O=eu(eN),j=eu(eF),T=(0,a.f)(),A=(0,o.f)(),K=(0,i.W)(i.L.Fusion),D=el(),R=(0,f.f)(),I=(0,d.f)(),M=S&&!1===I;_[0]!==K||_[1]!==j||_[2]!==T?(r=()=>{j(),T.push(K)},_[0]=K,_[1]=j,_[2]=T,_[3]=r):r=_[3];let q=r;_[4]!==P||_[5]!==M?(h=e=>P&&!M&&!!e?.key&&"/"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey),_[4]=P,_[5]=M,_[6]=h):h=_[6],_[7]!==q?(p=e=>{e?.preventDefault(),q()},_[7]=q,_[8]=p):p=_[8],(0,s.f)(h,p),_[9]!==C?(y=C("Fusion"),_[9]=C,_[10]=y):y=_[10];let B=!E;return _[11]!==C?(m=C("New fusion"),_[11]=C,_[12]=m):m=_[12],_[13]!==C?(v=C("New Fusion (⌘ /)"),_[13]=C,_[14]=v):v=_[14],_[15]!==q||_[16]!==M||_[17]!==m||_[18]!==v?(g={label:m,ariaLabel:v,icon:l.f,onClick:q,shortcutHint:"⌘/",isDisabled:M},_[15]=q,_[16]=M,_[17]=m,_[18]=v,_[19]=g):g=_[19],_[20]!==S||_[21]!==D||_[22]!==R?(b=!S||D&&R?(0,t.jsx)(eR,{}):null,_[20]=S,_[21]=D,_[22]=R,_[23]=b):b=_[23],_[24]!==A||_[25]!==S||_[26]!==g||_[27]!==b||_[28]!==y||_[29]!==B||_[30]!==O?(w=(0,t.jsx)(c.f,{title:y,isCollapsed:B,onToggle:O,backAction:A,isEmbedded:S,newAction:g,containerClassName:"min-h-0",children:b}),_[24]=A,_[25]=S,_[26]=g,_[27]=b,_[28]=y,_[29]=B,_[30]=O,_[31]=w):w=_[31],w}function eF(e){return e.resetWorkspace}function eN(e){return e.toggleSidebar}function ez(e){return e.isSidebarOpen}e.s(["f",0,eR],677453),e.s(["EmbeddedRunHistorySidebar",0,function(e){let r,o=(0,n.c)(2),{isActive:i}=e;return o[0]!==i?(r=(0,t.jsx)(eB,{isEmbedded:!0,isActive:i}),o[0]=i,o[1]=r):r=o[1],r},"PageRunHistorySidebar",0,function(){let e,o=(0,n.c)(1);return(0,r.B)()?null:(o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"hidden h-full min-h-0 md:block",children:(0,t.jsx)(eB,{})}),o[0]=e):e=o[0],e)}],565043)}]); //# sourceMappingURL=1nnuk6nvoc8gw.js.map